index.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. (function ($) {
  2. $.learuntab = {
  3. requestFullScreen: function () {
  4. var de = document.documentElement;
  5. if (de.requestFullscreen) {
  6. de.requestFullscreen();
  7. } else if (de.mozRequestFullScreen) {
  8. de.mozRequestFullScreen();
  9. } else if (de.webkitRequestFullScreen) {
  10. de.webkitRequestFullScreen();
  11. }
  12. },
  13. exitFullscreen: function () {
  14. var de = document;
  15. if (de.exitFullscreen) {
  16. de.exitFullscreen();
  17. } else if (de.mozCancelFullScreen) {
  18. de.mozCancelFullScreen();
  19. } else if (de.webkitCancelFullScreen) {
  20. de.webkitCancelFullScreen();
  21. }
  22. },
  23. refreshTab: function () {
  24. var currentId = $('.page-tabs-content').find('.active').attr('data-id');
  25. var target = $('.LRADMS_iframe[data-id="' + currentId + '"]');
  26. var url = target.attr('src');
  27. //$.loading(true);
  28. target.attr('src', url).load(function () {
  29. //$.loading(false);
  30. });
  31. },
  32. activeTab: function () {
  33. var currentId = $(this).data('id');
  34. if (!$(this).hasClass('active')) {
  35. $('.mainContent .LRADMS_iframe').each(function () {
  36. if ($(this).data('id') == currentId) {
  37. $(this).show().siblings('.LRADMS_iframe').hide();
  38. return false;
  39. }
  40. });
  41. $(this).addClass('active').siblings('.menuTab').removeClass('active');
  42. $.learuntab.scrollToTab(this);
  43. }
  44. },
  45. closeOtherTabs: function () {
  46. $('.page-tabs-content').children("[data-id]").find('.fa-remove').parents('a').not(".active").each(function () {
  47. $('.LRADMS_iframe[data-id="' + $(this).data('id') + '"]').remove();
  48. $(this).remove();
  49. });
  50. $('.page-tabs-content').css("margin-left", "0");
  51. },
  52. closeTab: function () {
  53. var closeTabId = $(this).parents('.menuTab').data('id');
  54. var currentWidth = $(this).parents('.menuTab').width();
  55. if ($(this).parents('.menuTab').hasClass('active')) {
  56. if ($(this).parents('.menuTab').next('.menuTab').size()) {
  57. var activeId = $(this).parents('.menuTab').next('.menuTab:eq(0)').data('id');
  58. $(this).parents('.menuTab').next('.menuTab:eq(0)').addClass('active');
  59. $('.mainContent .LRADMS_iframe').each(function () {
  60. if ($(this).data('id') == activeId) {
  61. $(this).show().siblings('.LRADMS_iframe').hide();
  62. return false;
  63. }
  64. });
  65. var marginLeftVal = parseInt($('.page-tabs-content').css('margin-left'));
  66. if (marginLeftVal < 0) {
  67. $('.page-tabs-content').animate({
  68. marginLeft: (marginLeftVal + currentWidth) + 'px'
  69. }, "fast");
  70. }
  71. $(this).parents('.menuTab').remove();
  72. $('.mainContent .LRADMS_iframe').each(function () {
  73. if ($(this).data('id') == closeTabId) {
  74. $(this).remove();
  75. return false;
  76. }
  77. });
  78. }
  79. if ($(this).parents('.menuTab').prev('.menuTab').size()) {
  80. var activeId = $(this).parents('.menuTab').prev('.menuTab:last').data('id');
  81. $(this).parents('.menuTab').prev('.menuTab:last').addClass('active');
  82. $('.mainContent .LRADMS_iframe').each(function () {
  83. if ($(this).data('id') == activeId) {
  84. $(this).show().siblings('.LRADMS_iframe').hide();
  85. return false;
  86. }
  87. });
  88. $(this).parents('.menuTab').remove();
  89. $('.mainContent .LRADMS_iframe').each(function () {
  90. if ($(this).data('id') == closeTabId) {
  91. $(this).remove();
  92. return false;
  93. }
  94. });
  95. }
  96. }
  97. else {
  98. $(this).parents('.menuTab').remove();
  99. $('.mainContent .LRADMS_iframe').each(function () {
  100. if ($(this).data('id') == closeTabId) {
  101. $(this).remove();
  102. return false;
  103. }
  104. });
  105. $.learuntab.scrollToTab($('.menuTab.active'));
  106. }
  107. return false;
  108. },
  109. addTab: function () {
  110. $(".navbar-custom-menu>ul>li.open").removeClass("open");
  111. var dataId = $(this).attr('data-id');
  112. if (dataId != "") {
  113. //top.$.cookie('nfine_currentmoduleid', dataId, { path: "/" });
  114. }
  115. var dataUrl = $(this).attr('href');
  116. var menuName = $.trim($(this).text());
  117. var flag = true;
  118. if (dataUrl == undefined || $.trim(dataUrl).length == 0) {
  119. return false;
  120. }
  121. $('.menuTab').each(function () {
  122. if ($(this).data('id') == dataUrl) {
  123. if (!$(this).hasClass('active')) {
  124. $(this).addClass('active').siblings('.menuTab').removeClass('active');
  125. $.learuntab.scrollToTab(this);
  126. $('.mainContent .LRADMS_iframe').each(function () {
  127. if ($(this).data('id') == dataUrl) {
  128. $(this).show().siblings('.LRADMS_iframe').hide();
  129. return false;
  130. }
  131. });
  132. }
  133. flag = false;
  134. return false;
  135. }
  136. });
  137. if (flag) {
  138. var str = '<a href="javascript:;" class="active menuTab" data-id="' + dataUrl + '">' + menuName + ' <i class="fa fa-remove"></i></a>';
  139. $('.menuTab').removeClass('active');
  140. var str1 = '<iframe class="LRADMS_iframe" id="iframe' + dataId + '" name="iframe' + dataId + '" width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataUrl + '" seamless></iframe>';
  141. $('.mainContent').find('iframe.LRADMS_iframe').hide();
  142. $('.mainContent').append(str1);
  143. //$.loading(true);
  144. $('.mainContent iframe:visible').load(function () {
  145. //$.loading(false);
  146. });
  147. $('.menuTabs .page-tabs-content').append(str);
  148. $.learuntab.scrollToTab($('.menuTab.active'));
  149. }
  150. return false;
  151. },
  152. scrollTabRight: function () {
  153. var marginLeftVal = Math.abs(parseInt($('.page-tabs-content').css('margin-left')));
  154. var tabOuterWidth = $.learuntab.calSumWidth($(".content-tabs").children().not(".menuTabs"));
  155. var visibleWidth = $(".content-tabs").outerWidth(true) - tabOuterWidth;
  156. var scrollVal = 0;
  157. if ($(".page-tabs-content").width() < visibleWidth) {
  158. return false;
  159. } else {
  160. var tabElement = $(".menuTab:first");
  161. var offsetVal = 0;
  162. while ((offsetVal + $(tabElement).outerWidth(true)) <= marginLeftVal) {
  163. offsetVal += $(tabElement).outerWidth(true);
  164. tabElement = $(tabElement).next();
  165. }
  166. offsetVal = 0;
  167. while ((offsetVal + $(tabElement).outerWidth(true)) < (visibleWidth) && tabElement.length > 0) {
  168. offsetVal += $(tabElement).outerWidth(true);
  169. tabElement = $(tabElement).next();
  170. }
  171. scrollVal = $.learuntab.calSumWidth($(tabElement).prevAll());
  172. if (scrollVal > 0) {
  173. $('.page-tabs-content').animate({
  174. marginLeft: 0 - scrollVal + 'px'
  175. }, "fast");
  176. }
  177. }
  178. },
  179. scrollTabLeft: function () {
  180. var marginLeftVal = Math.abs(parseInt($('.page-tabs-content').css('margin-left')));
  181. var tabOuterWidth = $.learuntab.calSumWidth($(".content-tabs").children().not(".menuTabs"));
  182. var visibleWidth = $(".content-tabs").outerWidth(true) - tabOuterWidth;
  183. var scrollVal = 0;
  184. if ($(".page-tabs-content").width() < visibleWidth) {
  185. return false;
  186. } else {
  187. var tabElement = $(".menuTab:first");
  188. var offsetVal = 0;
  189. while ((offsetVal + $(tabElement).outerWidth(true)) <= marginLeftVal) {
  190. offsetVal += $(tabElement).outerWidth(true);
  191. tabElement = $(tabElement).next();
  192. }
  193. offsetVal = 0;
  194. if ($.learuntab.calSumWidth($(tabElement).prevAll()) > visibleWidth) {
  195. while ((offsetVal + $(tabElement).outerWidth(true)) < (visibleWidth) && tabElement.length > 0) {
  196. offsetVal += $(tabElement).outerWidth(true);
  197. tabElement = $(tabElement).prev();
  198. }
  199. scrollVal = $.learuntab.calSumWidth($(tabElement).prevAll());
  200. }
  201. }
  202. $('.page-tabs-content').animate({
  203. marginLeft: 0 - scrollVal + 'px'
  204. }, "fast");
  205. },
  206. scrollToTab: function (element) {
  207. var marginLeftVal = $.learuntab.calSumWidth($(element).prevAll()), marginRightVal = $.learuntab.calSumWidth($(element).nextAll());
  208. var tabOuterWidth = $.learuntab.calSumWidth($(".content-tabs").children().not(".menuTabs"));
  209. var visibleWidth = $(".content-tabs").outerWidth(true) - tabOuterWidth;
  210. var scrollVal = 0;
  211. if ($(".page-tabs-content").outerWidth() < visibleWidth) {
  212. scrollVal = 0;
  213. } else if (marginRightVal <= (visibleWidth - $(element).outerWidth(true) - $(element).next().outerWidth(true))) {
  214. if ((visibleWidth - $(element).next().outerWidth(true)) > marginRightVal) {
  215. scrollVal = marginLeftVal;
  216. var tabElement = element;
  217. while ((scrollVal - $(tabElement).outerWidth()) > ($(".page-tabs-content").outerWidth() - visibleWidth)) {
  218. scrollVal -= $(tabElement).prev().outerWidth();
  219. tabElement = $(tabElement).prev();
  220. }
  221. }
  222. } else if (marginLeftVal > (visibleWidth - $(element).outerWidth(true) - $(element).prev().outerWidth(true))) {
  223. scrollVal = marginLeftVal - $(element).prev().outerWidth(true);
  224. }
  225. $('.page-tabs-content').animate({
  226. marginLeft: 0 - scrollVal + 'px'
  227. }, "fast");
  228. },
  229. calSumWidth: function (element) {
  230. var width = 0;
  231. $(element).each(function () {
  232. width += $(this).outerWidth(true);
  233. });
  234. return width;
  235. },
  236. init: function () {
  237. $('.menuItem').on('click', $.learuntab.addTab);
  238. $('.menuTabs').on('click', '.menuTab i', $.learuntab.closeTab);
  239. $('.menuTabs').on('click', '.menuTab', $.learuntab.activeTab);
  240. $('.tabLeft').on('click', $.learuntab.scrollTabLeft);
  241. $('.tabRight').on('click', $.learuntab.scrollTabRight);
  242. $('.tabReload').on('click', $.learuntab.refreshTab);
  243. $('.tabCloseCurrent').on('click', function () {
  244. $('.page-tabs-content').find('.active i').trigger("click");
  245. });
  246. $('.tabCloseAll').on('click', function () {
  247. $('.page-tabs-content').children("[data-id]").find('.fa-remove').each(function () {
  248. $('.LRADMS_iframe[data-id="' + $(this).data('id') + '"]').remove();
  249. $(this).parents('a').remove();
  250. });
  251. $('.page-tabs-content').children("[data-id]:first").each(function () {
  252. $('.LRADMS_iframe[data-id="' + $(this).data('id') + '"]').show();
  253. $(this).addClass("active");
  254. });
  255. $('.page-tabs-content').css("margin-left", "0");
  256. });
  257. $('.tabCloseOther').on('click', $.learuntab.closeOtherTabs);
  258. $('.fullscreen').on('click', function () {
  259. if (!$(this).attr('fullscreen')) {
  260. $(this).attr('fullscreen', 'true');
  261. $.learuntab.requestFullScreen();
  262. } else {
  263. $(this).removeAttr('fullscreen');
  264. $.learuntab.exitFullscreen();
  265. }
  266. });
  267. }
  268. };
  269. $.learunindex = {
  270. load: function () {
  271. $("body").removeClass("hold-transition");
  272. $("#content-wrapper").find('.mainContent').height($(window).height() - 100);
  273. $(window).resize(function (e) {
  274. $("#content-wrapper").find('.mainContent').height($(window).height() - 100);
  275. });
  276. $(".sidebar-toggle").click(function () {
  277. if (!$("body").hasClass("sidebar-collapse")) {
  278. $("body").addClass("sidebar-collapse");
  279. } else {
  280. $("body").removeClass("sidebar-collapse");
  281. }
  282. });
  283. $(window).load(function () {
  284. window.setTimeout(function () {
  285. $('#ajax-loader').fadeOut();
  286. }, 300);
  287. });
  288. },
  289. jsonWhere: function (data, action) {
  290. if (action == null) return;
  291. var reval = new Array();
  292. $(data).each(function (i, v) {
  293. if (action(v)) {
  294. reval.push(v);
  295. }
  296. });
  297. return reval;
  298. },
  299. loadMenu: function () {
  300. // -------------------------------------功能菜单数据配置-------------------------------------------------------
  301. var data =
  302. [
  303. {
  304. "F_ModuleId": "1",
  305. "F_ParentId": "0",
  306. "F_EnCode": "SysManage",
  307. "F_FullName": "数据统计",
  308. "F_Icon": "fa fa-desktop",
  309. "F_UrlAddress": null,
  310. "F_Target": "expand",
  311. "F_IsMenu": 0,
  312. "F_AllowExpand": 1,
  313. "F_IsPublic": 0,
  314. "F_AllowEdit": null,
  315. "F_AllowDelete": null,
  316. "F_SortCode": 1,
  317. "F_DeleteMark": 0,
  318. "F_EnabledMark": 1,
  319. "F_Description": null,
  320. "F_CreateDate": null,
  321. "F_CreateUserId": null,
  322. "F_CreateUserName": null,
  323. "F_ModifyDate": "2015-11-17 11:22:46",
  324. "F_ModifyUserId": "System",
  325. "F_ModifyUserName": "超级管理员"
  326. },
  327. {
  328. "F_ModuleId": "7ae94059-9aa5-48eb-8330-4e2a6565b193",
  329. "F_ParentId": "1",
  330. "F_EnCode": "AreaManage",
  331. "F_FullName": "行为分析",
  332. "F_Icon": "fa fa-leaf",
  333. "F_UrlAddress": "pages/action/action.html",
  334. "F_Target": "iframe",
  335. "F_IsMenu": 1,
  336. "F_AllowExpand": 1,
  337. "F_IsPublic": 0,
  338. "F_AllowEdit": null,
  339. "F_AllowDelete": null,
  340. "F_SortCode": 1,
  341. "F_DeleteMark": 0,
  342. "F_EnabledMark": 1,
  343. "F_Description": "留存率统计",
  344. "F_CreateDate": "2015-11-12 14:38:20",
  345. "F_CreateUserId": "System",
  346. "F_CreateUserName": "超级管理员",
  347. "F_ModifyDate": "2016-04-29 14:05:33",
  348. "F_ModifyUserId": "System",
  349. "F_ModifyUserName": "超级管理员"
  350. },
  351. {
  352. "F_ModuleId": "7ae94059-9aa5-48eb-8330-4e2a6565b193",
  353. "F_ParentId": "1",
  354. "F_EnCode": "AreaManage",
  355. "F_FullName": "留存率统计",
  356. "F_Icon": "fa fa-leaf",
  357. "F_UrlAddress": "pages/retention/retention.html",
  358. "F_Target": "iframe",
  359. "F_IsMenu": 1,
  360. "F_AllowExpand": 1,
  361. "F_IsPublic": 0,
  362. "F_AllowEdit": null,
  363. "F_AllowDelete": null,
  364. "F_SortCode": 1,
  365. "F_DeleteMark": 0,
  366. "F_EnabledMark": 1,
  367. "F_Description": "留存率统计",
  368. "F_CreateDate": "2015-11-12 14:38:20",
  369. "F_CreateUserId": "System",
  370. "F_CreateUserName": "超级管理员",
  371. "F_ModifyDate": "2016-04-29 14:05:33",
  372. "F_ModifyUserId": "System",
  373. "F_ModifyUserName": "超级管理员"
  374. },
  375. {
  376. "F_ModuleId": "7ae94059-9aa5-48eb-8330-4e2a6565b193",
  377. "F_ParentId": "1",
  378. "F_EnCode": "AreaManage",
  379. "F_FullName": "订单统计",
  380. "F_Icon": "fa fa-leaf",
  381. "F_UrlAddress": "pages/order/order.html",
  382. "F_Target": "iframe",
  383. "F_IsMenu": 1,
  384. "F_AllowExpand": 1,
  385. "F_IsPublic": 0,
  386. "F_AllowEdit": null,
  387. "F_AllowDelete": null,
  388. "F_SortCode": 1,
  389. "F_DeleteMark": 0,
  390. "F_EnabledMark": 1,
  391. "F_Description": "订单统计",
  392. "F_CreateDate": "2015-11-12 14:38:20",
  393. "F_CreateUserId": "System",
  394. "F_CreateUserName": "超级管理员",
  395. "F_ModifyDate": "2016-04-29 14:05:33",
  396. "F_ModifyUserId": "System",
  397. "F_ModifyUserName": "超级管理员"
  398. },
  399. {
  400. "F_ModuleId": "7ae94059-9aa5-48eb-8330-4e2a6565b193",
  401. "F_ParentId": "1",
  402. "F_EnCode": "AreaManage",
  403. "F_FullName": "关卡统计",
  404. "F_Icon": "fa fa-leaf",
  405. "F_UrlAddress": "pages/level/level.html",
  406. "F_Target": "iframe",
  407. "F_IsMenu": 1,
  408. "F_AllowExpand": 1,
  409. "F_IsPublic": 0,
  410. "F_AllowEdit": null,
  411. "F_AllowDelete": null,
  412. "F_SortCode": 1,
  413. "F_DeleteMark": 0,
  414. "F_EnabledMark": 1,
  415. "F_Description": "关卡统计",
  416. "F_CreateDate": "2015-11-12 14:38:20",
  417. "F_CreateUserId": "System",
  418. "F_CreateUserName": "超级管理员",
  419. "F_ModifyDate": "2016-04-29 14:05:33",
  420. "F_ModifyUserId": "System",
  421. "F_ModifyUserName": "超级管理员"
  422. },
  423. {
  424. "F_ModuleId": "7ae94059-9aa5-48eb-8330-4e2a6565b193",
  425. "F_ParentId": "1",
  426. "F_EnCode": "AreaManage",
  427. "F_FullName": "游戏登录时长",
  428. "F_Icon": "fa fa-leaf",
  429. "F_UrlAddress": "pages/GameContinuedTs/GameContinuedTs.html",
  430. "F_Target": "iframe",
  431. "F_IsMenu": 1,
  432. "F_AllowExpand": 1,
  433. "F_IsPublic": 0,
  434. "F_AllowEdit": null,
  435. "F_AllowDelete": null,
  436. "F_SortCode": 1,
  437. "F_DeleteMark": 0,
  438. "F_EnabledMark": 1,
  439. "F_Description": "游戏登录时长",
  440. "F_CreateDate": "2021-09-13 11:21:20",
  441. "F_CreateUserId": "System",
  442. "F_CreateUserName": "超级管理员",
  443. "F_ModifyDate": "2021-09-13 11:21:20",
  444. "F_ModifyUserId": "System",
  445. "F_ModifyUserName": "超级管理员"
  446. },
  447. {
  448. "F_ModuleId": "7ae94059-9aa5-48eb-8330-4e2a6565b193",
  449. "F_ParentId": "1",
  450. "F_EnCode": "AreaManage",
  451. "F_FullName": "经验金币钻石增减变化统计",
  452. "F_Icon": "fa fa-leaf",
  453. "F_UrlAddress": "pages/userBaseParams/userBaseParams.html",
  454. "F_Target": "iframe",
  455. "F_IsMenu": 1,
  456. "F_AllowExpand": 1,
  457. "F_IsPublic": 0,
  458. "F_AllowEdit": null,
  459. "F_AllowDelete": null,
  460. "F_SortCode": 1,
  461. "F_DeleteMark": 0,
  462. "F_EnabledMark": 1,
  463. "F_Description": "经验金币钻石增减变化统计",
  464. "F_CreateDate": "2021-09-13 11:21:20",
  465. "F_CreateUserId": "System",
  466. "F_CreateUserName": "超级管理员",
  467. "F_ModifyDate": "2021-09-13 11:21:20",
  468. "F_ModifyUserId": "System",
  469. "F_ModifyUserName": "超级管理员"
  470. },
  471. {
  472. "F_ModuleId": "7ae94059-9aa5-48eb-8330-4e2a6565b193",
  473. "F_ParentId": "1",
  474. "F_EnCode": "AreaManage",
  475. "F_FullName": "新增用户留存",
  476. "F_Icon": "fa fa-leaf",
  477. "F_UrlAddress": "pages/newUserRetention/newUserRetention.html",
  478. "F_Target": "iframe",
  479. "F_IsMenu": 1,
  480. "F_AllowExpand": 1,
  481. "F_IsPublic": 0,
  482. "F_AllowEdit": null,
  483. "F_AllowDelete": null,
  484. "F_SortCode": 1,
  485. "F_DeleteMark": 0,
  486. "F_EnabledMark": 1,
  487. "F_Description": "新增用户留存",
  488. "F_CreateDate": "2021-11-25 11:21:20",
  489. "F_CreateUserId": "System",
  490. "F_CreateUserName": "超级管理员",
  491. "F_ModifyDate": "2021-09-13 11:21:20",
  492. "F_ModifyUserId": "System",
  493. "F_ModifyUserName": "超级管理员"
  494. },
  495. {
  496. "F_ModuleId": "7ae94059-9aa5-48eb-8330-4e2a6565b193",
  497. "F_ParentId": "1",
  498. "F_EnCode": "AreaManage",
  499. "F_FullName": "text测试",
  500. "F_Icon": "fa fa-leaf",
  501. "F_UrlAddress": "pages/test/test.html",
  502. "F_Target": "iframe",
  503. "F_IsMenu": 1,
  504. "F_AllowExpand": 1,
  505. "F_IsPublic": 0,
  506. "F_AllowEdit": null,
  507. "F_AllowDelete": null,
  508. "F_SortCode": 1,
  509. "F_DeleteMark": 0,
  510. "F_EnabledMark": 1,
  511. "F_Description": "新增用户留存",
  512. "F_CreateDate": "2021-11-25 11:21:20",
  513. "F_CreateUserId": "System",
  514. "F_CreateUserName": "超级管理员",
  515. "F_ModifyDate": "2021-09-13 11:21:20",
  516. "F_ModifyUserId": "System",
  517. "F_ModifyUserName": "超级管理员"
  518. },
  519. {
  520. "F_ModuleId": "99",
  521. "F_ParentId": "0",
  522. "F_EnCode": "SysManage",
  523. "F_FullName": "单元测试",
  524. "F_Icon": "fa fa-desktop",
  525. "F_UrlAddress": null,
  526. "F_Target": "expand",
  527. "F_IsMenu": 0,
  528. "F_AllowExpand": 1,
  529. "F_IsPublic": 0,
  530. "F_AllowEdit": null,
  531. "F_AllowDelete": null,
  532. "F_SortCode": 1,
  533. "F_DeleteMark": 0,
  534. "F_EnabledMark": 1,
  535. "F_Description": null,
  536. "F_CreateDate": null,
  537. "F_CreateUserId": null,
  538. "F_CreateUserName": null,
  539. "F_ModifyDate": "2015-11-17 11:22:46",
  540. "F_ModifyUserId": "System",
  541. "F_ModifyUserName": "超级管理员"
  542. },
  543. {
  544. "F_ModuleId": "7ae94059-9aa5-48eb-8330-4e2a6565b193",
  545. "F_ParentId": "99",
  546. "F_EnCode": "AreaManage",
  547. "F_FullName": "常规测试",
  548. "F_Icon": "fa fa-leaf",
  549. "F_UrlAddress": "pages/test/test.html",
  550. "F_Target": "iframe",
  551. "F_IsMenu": 1,
  552. "F_AllowExpand": 1,
  553. "F_IsPublic": 0,
  554. "F_AllowEdit": null,
  555. "F_AllowDelete": null,
  556. "F_SortCode": 1,
  557. "F_DeleteMark": 0,
  558. "F_EnabledMark": 1,
  559. "F_Description": "常规测试",
  560. "F_CreateDate": "2015-11-12 14:38:20",
  561. "F_CreateUserId": "System",
  562. "F_CreateUserName": "超级管理员",
  563. "F_ModifyDate": "2016-04-29 14:05:33",
  564. "F_ModifyUserId": "System",
  565. "F_ModifyUserName": "超级管理员"
  566. }, {
  567. "F_ModuleId": "99-2",
  568. "F_ParentId": "99",
  569. "F_EnCode": "AreaManage",
  570. "F_FullName": "刚哥测试",
  571. "F_Icon": "fa fa-leaf",
  572. "F_UrlAddress": "pages/ganggetest/gtest.html",
  573. "F_Target": "iframe",
  574. "F_IsMenu": 1,
  575. "F_AllowExpand": 1,
  576. "F_IsPublic": 0,
  577. "F_AllowEdit": null,
  578. "F_AllowDelete": null,
  579. "F_SortCode": 1,
  580. "F_DeleteMark": 0,
  581. "F_EnabledMark": 1,
  582. "F_Description": "普通测试",
  583. "F_CreateDate": "2020年6月8日 17:52:35",
  584. "F_CreateUserId": "System",
  585. "F_CreateUserName": "超级管理员",
  586. "F_ModifyDate": "2020年6月8日 17:52:35",
  587. "F_ModifyUserId": "System",
  588. "F_ModifyUserName": "超级管理员"
  589. }
  590. ];
  591. var _html = "";
  592. $.each(data, function (i) {
  593. var row = data[i];
  594. if (row.F_ParentId == "0") {
  595. if (i == 0) {
  596. _html += '<li class="treeview active">';
  597. } else {
  598. _html += '<li class="treeview">';
  599. }
  600. _html += '<a href="#">';
  601. _html += '<i class="' + row.F_Icon + '"></i><span>' + row.F_FullName + '</span><i class="fa fa-angle-left pull-right"></i>';
  602. _html += '</a>';
  603. var childNodes = $.learunindex.jsonWhere(data, function (v) { return v.F_ParentId == row.F_ModuleId; });
  604. if (childNodes.length > 0) {
  605. _html += '<ul class="treeview-menu">';
  606. $.each(childNodes, function (i) {
  607. var subrow = childNodes[i];
  608. var subchildNodes = $.learunindex.jsonWhere(data, function (v) { return v.F_ParentId == subrow.F_ModuleId; });
  609. _html += '<li>';
  610. if (subchildNodes.length > 0) {
  611. _html += '<a href="#"><i class="' + subrow.F_Icon + '"></i>' + subrow.F_FullName + '';
  612. _html += '<i class="fa fa-angle-left pull-right"></i></a>';
  613. _html += '<ul class="treeview-menu">';
  614. $.each(subchildNodes, function (i) {
  615. var subchildNodesrow = subchildNodes[i];
  616. _html += '<li><a class="menuItem" data-id="' + subrow.F_ModuleId + '" href="' + subrow.F_UrlAddress + '"><i class="' + subchildNodesrow.F_Icon + '"></i>' + subchildNodesrow.F_FullName + '</a></li>';
  617. });
  618. _html += '</ul>';
  619. } else {
  620. _html += '<a class="menuItem" data-id="' + subrow.F_ModuleId + '" href="' + subrow.F_UrlAddress + '"><i class="' + subrow.F_Icon + '"></i>' + subrow.F_FullName + '</a>';
  621. }
  622. _html += '</li>';
  623. });
  624. _html += '</ul>';
  625. }
  626. _html += '</li>';
  627. }
  628. });
  629. $("#sidebar-menu").append(_html);
  630. $("#sidebar-menu li a").click(function () {
  631. var d = $(this), e = d.next();
  632. if (e.is(".treeview-menu") && e.is(":visible")) {
  633. e.slideUp(500, function () {
  634. e.removeClass("menu-open");
  635. }),
  636. e.parent("li").removeClass("active");
  637. } else if (e.is(".treeview-menu") && !e.is(":visible")) {
  638. var f = d.parents("ul").first(),
  639. g = f.find("ul:visible").slideUp(500);
  640. g.removeClass("menu-open");
  641. var h = d.parent("li");
  642. e.slideDown(500, function () {
  643. e.addClass("menu-open");
  644. f.find("li.active").removeClass("active");
  645. h.addClass("active");
  646. var _height1 = $(window).height() - $("#sidebar-menu >li.active").position().top - 41;
  647. var _height2 = $("#sidebar-menu li > ul.menu-open").height() + 10;
  648. if (_height2 > _height1) {
  649. $("#sidebar-menu >li > ul.menu-open").css({
  650. overflow: "auto",
  651. height: _height1
  652. });
  653. }
  654. });
  655. }
  656. e.is(".treeview-menu");
  657. });
  658. }
  659. };
  660. $(function () {
  661. $.learunindex.load();
  662. $.learunindex.loadMenu();
  663. $.learuntab.init();
  664. });
  665. })(jQuery);