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.
 
 
 
 
 
 

282 lines
13 KiB

  1. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. /*
  3. * 版 本 ADMS V2 Learun智慧校园 敏捷 开发框架
  4. * Copyright (c) 2013-2018 北京泉江科技有限公司
  5. * 创建人:Learun智慧校园- 前端开发组
  6. * 日 期:2017.03.16
  7. * 描 述:admin顶层页面操作方法
  8. */
  9. var loaddfimg;
  10. (function ($, learun) {
  11. "use strict";
  12. var page = {
  13. init: function () {
  14. /*判断当前浏览器是否是IE浏览器*/
  15. if ($('body').hasClass('IE') || $('body').hasClass('InternetExplorer')) {
  16. $('#lr_loadbg').append('<img data-img="imgdl" src="' + top.$.rootUrl + '/Content/images/ie-loader.gif" style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;margin: auto;vertical-align: middle;">');
  17. Pace.stop();
  18. }
  19. else {
  20. Pace.on('done', function () {
  21. $('#lr_loadbg').fadeOut();
  22. Pace.options.target = '#learunpacenone';
  23. });
  24. }
  25. // 通知栏插件初始化设置
  26. toastr.options = {
  27. "closeButton": true,
  28. "debug": false,
  29. "newestOnTop": true,
  30. "progressBar": false,
  31. "positionClass": "toast-top-center",
  32. "preventDuplicates": false,
  33. "onclick": null,
  34. "showDuration": "300",
  35. "hideDuration": "1000",
  36. "timeOut": "3000",
  37. "extendedTimeOut": "1000",
  38. "showEasing": "swing",
  39. "hideEasing": "linear",
  40. "showMethod": "fadeIn",
  41. "hideMethod": "fadeOut"
  42. };
  43. // 打开首页模板
  44. learun.frameTab.open({ F_ModuleId: '0', F_Icon: 'fa fa-desktop', F_FullName: '我的桌面', F_UrlAddress: '/Home/AdminDesktop' }, true);
  45. learun.clientdata.init(function () {
  46. page.userInit();
  47. // 初始页面特例
  48. bootstrap($, learun);
  49. if ($('body').hasClass('IE') || $('body').hasClass('InternetExplorer')) {
  50. $('#lr_loadbg').fadeOut();
  51. }
  52. });
  53. // 加载数据进度
  54. page.loadbarInit();
  55. // 全屏按钮
  56. page.fullScreenInit();
  57. // 主题选择初始化
  58. page.uitheme();
  59. },
  60. // 登录头像和个人设置
  61. userInit: function () {
  62. var loginInfo = learun.clientdata.get(['userinfo']);
  63. var _html = '<div class="lr-frame-personCenter"><a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown">';
  64. _html += '<img id="userhead"src="' + top.$.rootUrl + '/LR_OrganizationModule/User/GetImgForDC?userId=' + loginInfo.userId + '" >';
  65. _html += '<span>' + loginInfo.realName + '</span>';
  66. _html += '</a>';
  67. _html += '<ul class="dropdown-menu pull-right">';
  68. _html += '<li><a href="javascript:void(0);" id="lr_userinfo_btn"><i class="fa fa-user"></i>个人信息</a></li>';
  69. _html += '<li><a href="javascript:void(0);" id="lr_schedule_btn"><i class="fa fa-calendar"></i>我的日程</a></li>';
  70. _html += '<li><a href="javascript:void(0);" id="lr_onlineuser_btn"><i class="fa fa-user"></i>在线人员</a></li>';
  71. if (loginInfo.isSystem) {
  72. _html += '<li><a href="javascript:void(0);" id="lr_clearredis_btn"><i class="fa fa-refresh"></i>清空缓存</a></li>';
  73. }
  74. _html += '<li><a href="javascript:void(0);" id="lr_loginout_btn"><i class="fa fa-power-off"></i>安全退出</a></li>';
  75. _html += '</ul></div>';
  76. $('body').append(_html);
  77. $('#lr_loginout_btn').on('click', page.loginout);
  78. $('#lr_userinfo_btn').on('click', page.openUserCenter);
  79. $('#lr_clearredis_btn').on('click', page.clearredis);
  80. $('#lr_onlineuser_btn').on('click', page.openOnlineUser);
  81. },
  82. loginout: function () { // 安全退出
  83. learun.layerConfirm("注:您确定要安全退出本次登录吗?", function (r) {
  84. if (r) {
  85. learun.loading(true, '退出系统中...');
  86. //Ip上网
  87. var loginInfo = top.learun.clientdata.get(['userinfo']);
  88. if (ACIp != null && ACIp != "") {
  89. sendToAc(ACIp, 'logout', Ip, loginInfo.enCode, '');
  90. }
  91. if (ACIp2 != null && ACIp2 != "") {
  92. sendToAc(ACIp2, 'logout', Ip, loginInfo.enCode, '');
  93. }
  94. learun.httpAsyncPost($.rootUrl + '/Login/OutLogin', {}, function (data) {
  95. window.location.href = $.rootUrl + "/Login/Index";
  96. });
  97. }
  98. });
  99. },
  100. clearredis: function () {
  101. learun.layerConfirm("注:您确定要清空全部后台缓存数据吗?", function (r) {
  102. if (r) {
  103. learun.loading(true, '清理缓存数据中...');
  104. learun.httpAsyncPost($.rootUrl + '/Home/ClearRedis', {}, function (data) {
  105. window.location.href = $.rootUrl + "/Login/Index";
  106. });
  107. }
  108. });
  109. },
  110. openUserCenter: function () {
  111. // 打开个人中心
  112. learun.frameTab.open({ F_ModuleId: '1', F_Icon: 'fa fa-user', F_FullName: '个人中心', F_UrlAddress: '/UserCenter/IndexForDC' });
  113. },
  114. openOnlineUser: function () {
  115. // 打开在线人员
  116. //learun.frameTab.open({ F_ModuleId: '1', F_Icon: 'fa fa-user', F_FullName: '在线人员', F_UrlAddress: '/LR_SystemModule/Log/OnlineUserIndex' });
  117. learun.layerForm({
  118. id: "OnlineUserIndex",
  119. title: '在线人员',
  120. url: top.$.rootUrl + '/LR_SystemModule/Log/OnlineUserIndex',
  121. width: 1000,
  122. height: 600,
  123. btn: null
  124. });
  125. },
  126. // 全屏按钮
  127. fullScreenInit: function () {
  128. var _html = '<div class="lr_frame_fullscreen"><a href="javascript:void(0);" id="lr_fullscreen_btn" title="全屏"><i class="fa fa-arrows-alt"></i></a></div>';
  129. $('body').append(_html);
  130. $('#lr_fullscreen_btn').on('click', function () {
  131. if (!$(this).attr('fullscreen')) {
  132. $(this).attr('fullscreen', 'true');
  133. page.requestFullScreen();
  134. } else {
  135. $(this).removeAttr('fullscreen');
  136. page.exitFullscreen();
  137. }
  138. });
  139. },
  140. requestFullScreen: function () {
  141. var de = document.documentElement;
  142. if (de.requestFullscreen) {
  143. de.requestFullscreen();
  144. } else if (de.mozRequestFullScreen) {
  145. de.mozRequestFullScreen();
  146. } else if (de.webkitRequestFullScreen) {
  147. de.webkitRequestFullScreen();
  148. }
  149. },
  150. exitFullscreen: function () {
  151. var de = document;
  152. if (de.exitFullscreen) {
  153. de.exitFullscreen();
  154. } else if (de.mozCancelFullScreen) {
  155. de.mozCancelFullScreen();
  156. } else if (de.webkitCancelFullScreen) {
  157. de.webkitCancelFullScreen();
  158. }
  159. },
  160. // 加载数据进度
  161. loadbarInit: function () {
  162. var _html = '<div class="lr-loading-bar" id="lr_loading_bar" >';
  163. _html += '<div class="lr-loading-bar-bg"></div>';
  164. _html += '<div class="lr-loading-bar-message" id="lr_loading_bar_message"></div>';
  165. _html += '</div>';
  166. $('body').append(_html);
  167. },
  168. // 皮肤主题设置
  169. uitheme: function () {
  170. var uitheme = top.$.cookie('Learn_ADMS_V6.1_UItheme') || '1';
  171. var $setting = $('<div class="lr-theme-setting"></div>');
  172. var $btn = $('<button class="btn btn-default"><i class="fa fa-spin fa-gear"></i></button>');
  173. var _html = '<div class="panel-heading">界面风格</div>';
  174. _html += '<div class="panel-body">';
  175. _html += '<div><label><input type="radio" name="ui_theme" value="1" ' + (uitheme == '1' ? 'checked' : '') + '>经典版</label></div>';
  176. _html += '<div><label><input type="radio" name="ui_theme" value="2" ' + (uitheme == '2' ? 'checked' : '') + '>风尚版</label></div>';
  177. //_html += '<div><label><input type="radio" name="ui_theme" value="3" ' + (uitheme == '3' ? 'checked' : '') + '>炫动版</label></div>';
  178. _html += '<div><label><input type="radio" name="ui_theme" value="4" ' + (uitheme == '4' ? 'checked' : '') + '>飞扬版</label></div>';
  179. _html += '<div><label><input type="radio" name="ui_theme" value="5" ' + (uitheme == '5' ? 'checked' : '') + '>导航版</label></div>';
  180. _html += '</div>';
  181. $setting.append($btn);
  182. $setting.append(_html);
  183. $('body').append($setting);
  184. //客服设置
  185. learun.httpPost(top.$.rootUrl + "/LR_Desktop/Sys_CustomerService/GetSys_CustomerServiceEntity", {}, function (res) {
  186. if (res.code == 200) {
  187. if (res.data != null) {
  188. var data = res.data;
  189. var htmlSer = '<div class="lrService">' +
  190. '<div class="serBtn btn"><img src="/Content/images/service.png" alt="" /></div>' +
  191. '<div class="lrSerT">' + data.Title + '</div>' +
  192. '<div class="lrSerBox">' +
  193. '<div class="lrSerCon">' +
  194. '<div class="lrSerTitle">客户经理 </div>' +
  195. '<div class="lrSerTxt">' + data.Manager + ' <img src="/Content/images/phones.png" alt="" /> ' + data.ManagerPhone + '</div>' +
  196. '</div>' +
  197. '<div class="lrSerCon">' +
  198. '<div class="lrSerTitle">客服专员 </div>' +
  199. '<div class="lrSerTxt">' + data.CustomerName + ' <div class="serQq"><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=' + data.CustomerQQ + '&site=qq&menu=yes"><img src="/Content/images/qq.png" alt="" /> QQ交谈</a></div></div>' +
  200. '</div>' +
  201. '</div>' +
  202. '</div>';
  203. $('body').append(htmlSer);
  204. }
  205. }
  206. });
  207. //青桔设置
  208. //var htmlQj = '<div class="lrQj btn"><img src="/Content/images/qjIcon.png" alt="" /></div>';
  209. //$('body').append(htmlQj);
  210. //var htmlSer = '<div class="lrService">' +
  211. // '<div class="serBtn btn"><img src="/Content/images/service.png" alt="" /></div>' +
  212. // '<div class="lrSerT">专职客服</div>' +
  213. // '<div class="lrSerBox">' +
  214. // '<div class="lrSerCon">' +
  215. // '<div class="lrSerTitle">客户经理 </div>' +
  216. // '<div class="lrSerTxt">刘经理 <img src="/Content/images/phones.png" alt="" /> 13542658269</div>' +
  217. // '</div>' +
  218. // '<div class="lrSerCon">' +
  219. // '<div class="lrSerTitle">客服专员 </div>' +
  220. // '<div class="lrSerTxt">张客服 <div class="serQq"><img src="/Content/images/qq.png" alt="" /> QQ交谈</div></div>' +
  221. // '</div>' +
  222. // '</div>' +
  223. // '</div>' +
  224. // '<div class="lrQj btn"><img src="/Content/images/qjIcon.png" alt="" /></div>';
  225. //$('body').append(htmlSer);
  226. $('.lrQj').click(function () {
  227. var parents = $(document.getElementById('lr_iframe_0').contentWindow.document.querySelector('#qjImg'));
  228. if (parents.hasClass('active')) {
  229. parents.removeClass('active').slideDown(500)
  230. }
  231. })
  232. var parentSet = $btn.parent();
  233. var parentSer = $('.serBtn').parent();
  234. $('.serBtn').click(function () {
  235. parentSet.removeClass('opened');
  236. if (parentSer.hasClass('opened')) {
  237. parentSer.removeClass('opened');
  238. }
  239. else {
  240. parentSer.addClass('opened');
  241. }
  242. })
  243. $btn.on('click', function () {
  244. parentSer.removeClass('opened');
  245. if (parentSet.hasClass('opened')) {
  246. parentSet.removeClass('opened');
  247. }
  248. else {
  249. parentSet.addClass('opened');
  250. }
  251. });
  252. $setting.find('input').click(function () {
  253. var value = $(this).val();
  254. top.$.cookie('Learn_ADMS_V6.1_UItheme', value, { path: "/" });
  255. window.location.href = $.rootUrl + '/Home/Index';
  256. });
  257. },
  258. };
  259. $(function () {
  260. page.init();
  261. });
  262. })(window.jQuery, top.learun);