No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.htm 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. {include file="public/layout" /}
  2. <body class="bodystyle" style="cursor: default; -moz-user-select: inherit;">
  3. <div id="append_parent"></div>
  4. <div id="ajaxwaitid"></div>
  5. <div class="page min-hg-c-10 {empty name='$web_navigation_switch'}on-off_show{/empty}">
  6. <!--遮罩给上面的class + on-off_show-->
  7. <div class="on-off_shade">
  8. <div class="on-off_shadeCon">
  9. <span>目前还没有开启导航模块功能,<a href="javascript:void(0);" data-url="{:url('Navigation/ajax_open_close')}" data-value="{$web_navigation_switch}" onclick="ajax_open_close(this);">我要开启</a></span>
  10. </div>
  11. </div>
  12. <div class="fixed-bar">
  13. <div class="item-title">
  14. {eq name='$Request.param.source' value='archives'}
  15. <a class="back_xin" href="javascript:history.back();" title="返回"><i class="iconfont e-fanhui"></i></a>
  16. {else /}
  17. <a class="back_xin" href="{:url('Index/switch_map')}" title="返回"><i class="iconfont e-fanhui"></i></a>
  18. {/eq}
  19. {notempty name='$web_navigation_switch'}
  20. <a style="margin-left: 10px; float: right;font-size: 14px;" href="javascript:void(0);" data-url="{:url('Navigation/ajax_open_close')}" data-value="{$web_navigation_switch}" onclick="ajax_open_close(this);">关闭导航</a>
  21. {/notempty}
  22. <a style="float: right;font-size: 14px;" href="javascript:void(0);" data-url="{:url('Navigation/navigation_index')}" onclick="go_navigation_index(this);">管理</a>
  23. <div class="subject">
  24. <h3>导航管理</h3>
  25. <h5></h5>
  26. </div>
  27. <ul class="tab-base nc-row">
  28. {volist name="position_list" id="vo"}
  29. <li>
  30. {eq name="$position_id" value="$vo.position_id"}
  31. <a href="javascript:void(0);" class="tab current"><span>{$vo.position_name}</span></a>
  32. {else /}
  33. <a href="{:url('Navigation/index',['position_id'=>$vo.position_id])}" class="tab"><span>{$vo.position_name}</span></a>
  34. {/eq}
  35. </li>
  36. {/volist}
  37. </ul>
  38. </div>
  39. </div>
  40. <div class="flexigrid">
  41. <div class="mDiv pt0">
  42. <div class="ftitle">
  43. <div class="fbutton">
  44. <a href="javascript:void(0);" onclick="add(this,'新增');" data-url="{:url('Navigation/add',['position_id'=>$position_id])}">
  45. <div class="add" title="新增">
  46. <span class=""><i class="layui-icon layui-icon-addition"></i>新增</span>
  47. </div>
  48. </a>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="hDiv">
  53. <div class="hDivBox">
  54. <table cellspacing="0" cellpadding="0" style="width: 100%">
  55. <thead>
  56. <tr>
  57. <th class="sign w40" axis="col0">
  58. <div class="tc"><input type="checkbox" onclick="javascript:$('input[name*=ids]').prop('checked',this.checked);"></div>
  59. </th>
  60. <th axis="col3" class="w60">
  61. <div class="tc tc">ID</div>
  62. </th>
  63. <th axis="col3" class="">
  64. <div class="" style="padding-left: 10px;">
  65. {if condition="!empty($tree['cookied_treeclicked'])"}
  66. <img src="__SKIN__/images/tv-collapsable-last.gif" id="all_treeclicked" title="关闭所有子栏目" style="float: none;" data-status="open" onClick="treeClicked(this,'all',0);">
  67. {else /}
  68. <img src="__SKIN__/images/tv-expandable.gif" id="all_treeclicked" title="展开所有子栏目" style="float: none;" data-status="close" onClick="treeClicked(this,'all',0);">
  69. {/if}
  70. <!-- <img src="__SKIN__/images/tv-expandable.gif" id="all_treeclicked" title="展开所有子栏目" style="float: none;" data-status="close" onClick="treeClicked(this,'all',0);"> -->
  71. 菜单名称
  72. </div>
  73. </th>
  74. <th axis="col2" class="w120">
  75. <div class="tc">位置</div>
  76. </th>
  77. <th axis="col2" class="w100">
  78. <div class="tc">状态</div>
  79. </th>
  80. <th axis="col1" class="w200">
  81. <div class="tc" >操作</div>
  82. </th>
  83. <th axis="col2" class="w100">
  84. <div class="tc">排序</div>
  85. </th>
  86. </tr>
  87. </thead>
  88. </table>
  89. </div>
  90. </div>
  91. <div class="bDiv" style="height: auto;">
  92. <form id="PostForm">
  93. <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
  94. <table style="width: 100%" id="arctype_table" >
  95. {empty name="list"}
  96. <tr>
  97. <td class="no-data" align="center" axis="col0" colspan="50">
  98. <div class="no_row">
  99. <div class="no_pic"><img src="__SKIN__/images/null-data.png"></div>
  100. </div>
  101. </td>
  102. </tr>
  103. {else/}
  104. {volist name="list" id="vo"}
  105. <tr nctype="0" {if condition="!in_array($vo.parent_id, $tree.cookied_treeclicked) && 0 < $vo.parent_id "} style="display: none;" {/if} class="parent_id_{$vo['parent_id']}" data-level="{$vo['level']}" data-id="{$vo['nav_id']}">
  106. <td class="sign">
  107. <div class="w40 tc"><input type="checkbox" name="ids[]" value="{$vo.nav_id}"></div>
  108. </td>
  109. <td class="sort">
  110. <div class="w60 tc">
  111. {$vo.nav_id}
  112. </div>
  113. </td>
  114. <td style="width: 100%">
  115. <div style="text-align: left;padding-left: 10px;">
  116. {gt name='vo.level' value='0'}
  117. {php}
  118. if (1 == $vo['level']) {
  119. echo '<span class="w40x"></span>';
  120. } else if ($vo['level'] >= 2) {
  121. echo '<span class="w40x w40xc'.$vo['level'].'" style="margin-right:'.(($vo['level'] - 1) * 25).'px;"></span>';
  122. }
  123. {/php}
  124. {/gt}
  125. {gt name="vo.has_children" value="0"}
  126. <img src="{in name='$vo.nav_id' value='$tree.cookied_treeclicked'}__SKIN__/images/tv-collapsable-last.gif{else /}__SKIN__/images/tv-expandable.gif{/in}" style="float: none;" fieldid="2" status="open" nc_type="flex" onClick="treeClicked(this,{$vo['nav_id']},0);" class="has_children" data-level="{$vo['level']}" data-id="{$vo['nav_id']}">
  127. <!-- <img src="__SKIN__/images/tv-expandable.gif" style="float: none;" fieldid="2" status="open" nc_type="flex" onClick="treeClicked(this,{$vo['nav_id']},0);" class="has_children"> -->
  128. {else /}
  129. <img src="__SKIN__/images/tv-collapsable-last.gif" style="float: none;" fieldid="2" status="open" nc_type="flex">
  130. {/gt}
  131. {$vo.nav_name}
  132. </div>
  133. </td>
  134. <td class="sort">
  135. <div class="w120 tc">
  136. {$position_list[$position_id]['position_name']}
  137. </div>
  138. </td>
  139. <td class="sort">
  140. <div class="w100 tc">
  141. {eq name="$vo['status']" value='1'}
  142. <span class="yes" onClick="changeTableVal('nav_list','nav_id','{$vo.nav_id}','status',this);"><i class="fa fa-check-circle"></i>是</span>
  143. {else /}
  144. <span class="no" onClick="changeTableVal('nav_list','nav_id','{$vo.nav_id}','status',this);"><i class="fa fa-ban"></i>否</span>
  145. {/eq}
  146. </div>
  147. </td>
  148. <td>
  149. <div class="w200 tc">
  150. <a href="javascript:void(0);" onclick="add(this,'新增');" data-url="{:url('Navigation/add',['position_id'=>$position_id,'nav_id'=>$vo['nav_id']])}" class="btn blue"><i class="fa fa-pencil-square-o"></i>添加子菜单</a>
  151. <a href="javascript:void(0);" onclick="add(this,'编辑');" data-url="{:url('Navigation/edit',array('nav_id'=>$vo['nav_id']))}" class="btn blue"><i class="fa fa-pencil-square-o"></i>编辑</a>
  152. <a class="btn red" href="javascript:void(0)" data-url="{:url('Navigation/list_del')}" data-id="{$vo.nav_id}" onClick="delfun(this);"><i class="fa fa-trash-o"></i>删除</a>
  153. </div>
  154. </td>
  155. <td class="sort">
  156. <div class="w100 tc">
  157. <input style="text-align: left;" name="sort_order[]" type="text" onkeyup="this.value=this.value.replace(/[^\d]/g,'');" onpaste="this.value=this.value.replace(/[^\d]/g,'');" onchange="changeTableVal('nav_list','nav_id','{$vo.nav_id}','sort_order',this);" size="4" value="{$vo.sort_order}" />
  158. </div>
  159. </td>
  160. </tr>
  161. {/volist}
  162. {/empty}
  163. </tbody>
  164. </table>
  165. </div>
  166. <div class="iDiv" style="display: none;"></div>
  167. </div>
  168. {notempty name="list"}
  169. <div class="tDiv">
  170. <div class="tDiv2">
  171. <div class="fbutton checkboxall">
  172. <input type="checkbox" class="checkAll" onclick="javascript:$('input[name*=ids]').prop('checked', this.checked);">
  173. </div>
  174. <div class="fbutton">
  175. <a onclick="batch_del(this, 'ids');" data-url="{:url('Navigation/list_del')}">
  176. <div class="add" title="批量删除">
  177. <span>批量删除</span>
  178. </div>
  179. </a>
  180. </div>
  181. <div class="fbutton">
  182. <a href="javascript:void(0);" onclick="copyToClipBoard('{$position_id}');">
  183. <div class="add" title="标签调用">
  184. <span>标签调用</span>
  185. </div>
  186. </a>
  187. </div>
  188. </div>
  189. <div style="clear:both"></div>
  190. </div>
  191. {/notempty}
  192. </div>
  193. </div>
  194. <script type="text/javascript">
  195. $(function() {
  196. $('input[type=checkbox].checkAll').click(function() {
  197. $('input[type=checkbox]').prop('checked', this.checked);
  198. });
  199. setCookies('navigation-treeClicked-Arr',JSON.stringify({$tree.cookied_treeclicked_arr}));
  200. });
  201. $(document).ready(function(){
  202. // 表格行点击选中切换
  203. $('#flexigrid > table>tbody >tr').click(function(){
  204. $(this).toggleClass('trSelected');
  205. });
  206. // 点击刷新数据
  207. $('.fa-refresh').click(function(){
  208. location.href = location.href;
  209. });
  210. // 批量操作
  211. $(".dropdown-bt").click(function(){
  212. $(".dropdown-menus").slideToggle(200);
  213. event.stopPropagation();
  214. })
  215. $(document).click(function(){
  216. $(".dropdown-menus").slideUp(200);
  217. event.stopPropagation();
  218. })
  219. });
  220. function add(obj,name) {
  221. var url = $(obj).data('url');
  222. layer.open({
  223. shade: layer_shade,
  224. type: 2,
  225. title: name+'菜单',
  226. area: ['80%', '90%'],
  227. content: url
  228. });
  229. }
  230. // 点击展开 收缩节点
  231. function treeClicked(obj,id,reload){
  232. if (id == 'all') {
  233. if (1 == reload) {
  234. var status = getCookie('navigation-treeClicked');
  235. if (!status) {
  236. status = $(obj).attr('data-status');
  237. }
  238. } else {
  239. var status = $(obj).attr('data-status');
  240. }
  241. if (status == 'close') {
  242. setCookies('navigation-treeClicked-Arr', JSON.stringify({$tree.parent_ids}));
  243. setCookies('navigation-treeClicked_All', 1);//1为全部展开,0-为非全部展开
  244. $('tr[class^=parent_id_]').show().find('img').attr('src', '__SKIN__/images/tv-collapsable-last.gif');
  245. $(obj).attr('data-status', 'open').attr('title','关闭所有子栏目').attr('src','__SKIN__/images/tv-collapsable-last.gif');
  246. } else {
  247. setCookies('navigation-treeClicked-Arr', '');
  248. setCookies('navigation-treeClicked_All', 0);
  249. $('tr[data-level=0]').find('img.has_children').attr('src', '/public/static/admin/images/tv-collapsable-last.gif').trigger('click');
  250. $('tr[class^=parent_id_]').removeClass('trSelected');
  251. $(obj).attr('data-status', 'close').attr('title','展开所有子栏目').attr('src','__SKIN__/images/tv-expandable.gif');
  252. }
  253. setCookies('navigation-treeClicked', status);
  254. return false;
  255. }
  256. var src = $(obj).attr('src');
  257. if (src == '__SKIN__/images/tv-expandable.gif') {
  258. var arr = [];
  259. var str = getCookie('navigation-treeClicked-Arr');
  260. if ('' == str || null == str || 'null' == str) {
  261. arr.push(id);
  262. } else {
  263. arr = JSON.parse(str);
  264. if (!arr.includes(id)) arr.push(id);
  265. }
  266. arr = JSON.stringify(arr);
  267. setCookies('navigation-treeClicked-Arr', arr);
  268. $(".parent_id_"+id).show();
  269. $(obj).attr('src','__SKIN__/images/tv-collapsable-last.gif');
  270. var status = 'close';
  271. } else {
  272. var str = getCookie('navigation-treeClicked-Arr');
  273. var arr = [];
  274. var key = -1;
  275. var level = '';
  276. if ('' != str) {
  277. arr = JSON.parse(str);
  278. key = $.inArray(id,arr);
  279. if (-1 < key) arr.splice(key,1);
  280. level = $(obj).attr('data-level');
  281. $(obj).parent().parent().parent().nextAll().each(function() {
  282. if ($(this).attr('data-level') > level) {
  283. key = $.inArray(parseInt($(this).attr('data-id')),arr);
  284. if (-1 < key) arr.splice(key,1);
  285. } else {
  286. return false;
  287. }
  288. });
  289. arr = JSON.stringify(arr);
  290. setCookies('navigation-treeClicked-Arr', arr);
  291. setCookies('navigation-treeClicked_All', 0);
  292. }
  293. $(obj).attr('src','__SKIN__/images/tv-expandable.gif');
  294. var status = 'open';
  295. // 如果是点击减号, 遍历循环他下面的所有都关闭
  296. var tbl = document.getElementById("arctype_table");
  297. cur_tr = obj.parentNode.parentNode.parentNode;
  298. var fnd = false;
  299. for (i = 0; i < tbl.rows.length; i++)
  300. {
  301. var row = tbl.rows[i];
  302. if (row == cur_tr)
  303. {
  304. fnd = true;
  305. }
  306. else
  307. {
  308. if (fnd == true)
  309. {
  310. var level = parseInt($(row).data('level'));
  311. var cur_level = $(cur_tr).data('level');
  312. if (level > cur_level)
  313. {
  314. $(row).hide();
  315. $(row).find('img.has_children').attr('src','__SKIN__/images/tv-expandable.gif');
  316. }
  317. else
  318. {
  319. fnd = false;
  320. break;
  321. }
  322. }
  323. }
  324. }
  325. }
  326. setCookies('navigation-treeClicked', status);
  327. }
  328. function go_navigation_index(obj) {
  329. var url = $(obj).data('url');
  330. layer.open({
  331. type: 2,
  332. shade: layer_shade,
  333. title: '导航管理',
  334. area: ['80%', '90%'],
  335. content: url
  336. });
  337. }
  338. function copyToClipBoard(position_id) {
  339. var liststr ="{\eyou:navigation position_id='"+position_id+"' id='nav'}\n" +
  340. ' <li>\n' +
  341. ' <img src="{\$nav.nav_pic}">\n' +
  342. ' <a href="{\$nav.nav_url}" {\$nav.target} {\$nav.nofollow}>{\$nav.nav_name}</a>\n' +
  343. ' </li>\n' +
  344. '{\/eyou:navigation}';
  345. var contentdiv = '<div class="dialog_content" style="margin: 0px; padding: 0px;"><dl style="padding:10px 30px;line-height:30px;"><dd>标签简单调用代码:</dd>';
  346. contentdiv += '<dd><textarea style="width:410px;height:135px;">' + liststr + '</textarea></dd>';
  347. contentdiv += '<dd style="border-top: dotted 1px #E7E7E7; color: #F60;">请将相应标签复制并粘贴到对应模板文件中!<a href="https://www.eyoucms.com/doc/label/all/11849.html" target="_blank">复杂调用点击去看手册</a></dd></dl></div>'
  348. layer.open({
  349. title: '标签调用',
  350. type: 1,
  351. shade: layer_shade,
  352. skin: 'layui-layer-demo',
  353. area: ['480px', '300px'], //宽高
  354. content: contentdiv
  355. });
  356. }
  357. function delfun(obj){
  358. var confirm_title = '确认删除?如有子菜单将一起清空。';
  359. layer.confirm(confirm_title, {
  360. shade: layer_shade,
  361. area: ['480px', '190px'],
  362. move: false,
  363. title: '提示',
  364. btnAlign:'r',
  365. closeBtn: 3,
  366. btn: ['确定', '取消'] ,//按钮
  367. success: function () {
  368. $(".layui-layer-content").css('text-align', 'left');
  369. }
  370. }, function(){
  371. layer_loading('正在处理');
  372. // 确定
  373. $.ajax({
  374. type : 'post',
  375. url : $(obj).attr('data-url'),
  376. data : {del_id:$(obj).attr('data-id'),_ajax:1},
  377. dataType : 'json',
  378. success : function(data){
  379. layer.closeAll();
  380. if(data.code == 1){
  381. layer.msg(data.msg, {icon: 1});
  382. window.location.reload();
  383. }else{
  384. layer.alert(data.msg, {icon: 2, title:false}); //alert(data);
  385. }
  386. }
  387. })
  388. }, function(index){
  389. layer.close(index);
  390. });
  391. return false;
  392. }
  393. function ajax_open_close(obj, inc_type, name,value){
  394. $.ajax({
  395. type : 'post',
  396. url : $(obj).attr('data-url'),
  397. data : {value:$(obj).attr('data-value'), _ajax:1},
  398. dataType : 'json',
  399. success : function(res){
  400. if(res.code == 1){
  401. window.location.reload();
  402. }else{
  403. showErrorMsg(res.msg);
  404. }
  405. },
  406. error: function(e){
  407. showErrorAlert(e.responseText);
  408. }
  409. })
  410. }
  411. </script>
  412. {include file="public/footer" /}