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.
 
 
 
 
 
 

299 lines
14 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_cancelweixinbind_btn"><i class="fa fa-unlock"></i>解绑微信</a></li>';
  70. _html += '<li><a href="javascript:void(0);" id="lr_schedule_btn"><i class="fa fa-calendar"></i>我的日程</a></li>';
  71. _html += '<li><a href="javascript:void(0);" id="lr_onlineuser_btn"><i class="fa fa-user"></i>在线人员</a></li>';
  72. if (loginInfo.isSystem) {
  73. _html += '<li><a href="javascript:void(0);" id="lr_clearredis_btn"><i class="fa fa-refresh"></i>清空缓存</a></li>';
  74. }
  75. _html += '<li><a href="javascript:void(0);" id="lr_loginout_btn"><i class="fa fa-power-off"></i>安全退出</a></li>';
  76. _html += '</ul></div>';
  77. $('body').append(_html);
  78. $('#lr_loginout_btn').on('click', page.loginout);
  79. $('#lr_userinfo_btn').on('click', page.openUserCenter);
  80. $('#lr_clearredis_btn').on('click', page.clearredis);
  81. $('#lr_onlineuser_btn').on('click', page.openOnlineUser);
  82. $('#lr_cancelweixinbind_btn').on('click', page.cancelWeiXinBind);
  83. },
  84. loginout: function () { // 安全退出
  85. learun.layerConfirm("注:您确定要安全退出本次登录吗?", function (r) {
  86. if (r) {
  87. learun.loading(true, '退出系统中...');
  88. //Ip上网
  89. var loginInfo = top.learun.clientdata.get(['userinfo']);
  90. if (ACIp != null && ACIp != "") {
  91. sendToAc(ACIp, 'logout', Ip, loginInfo.enCode, '');
  92. }
  93. if (ACIp2 != null && ACIp2 != "") {
  94. sendToAc(ACIp2, 'logout', Ip, loginInfo.enCode, '');
  95. }
  96. learun.httpAsyncPost($.rootUrl + '/Login/OutLogin', {}, function (data) {
  97. window.location.href = $.rootUrl + "/Login/Index";
  98. });
  99. }
  100. });
  101. },
  102. clearredis: function () {
  103. learun.layerConfirm("注:您确定要清空全部后台缓存数据吗?", function (r) {
  104. if (r) {
  105. learun.loading(true, '清理缓存数据中...');
  106. learun.httpAsyncPost($.rootUrl + '/Home/ClearRedis', {}, function (data) {
  107. window.location.href = $.rootUrl + "/Login/Index";
  108. });
  109. }
  110. });
  111. },
  112. cancelWeiXinBind: function () {
  113. learun.layerConfirm("注:您确定要解绑微信吗?", function (r) {
  114. if (r) {
  115. learun.loading(true, '解除绑定中...');
  116. learun.httpAsyncPost($.rootUrl + '/Home/CancelWeiXinBind', {}, function (data) {
  117. if (data.code == 200) {
  118. learun.alert.success(data.info);
  119. } else {
  120. learun.alert.error("异常,请刷新!");
  121. }
  122. learun.loading(false);
  123. });
  124. }
  125. });
  126. },
  127. openUserCenter: function () {
  128. // 打开个人中心
  129. learun.frameTab.open({ F_ModuleId: '1', F_Icon: 'fa fa-user', F_FullName: '个人中心', F_UrlAddress: '/UserCenter/IndexForDC' });
  130. },
  131. openOnlineUser: function () {
  132. // 打开在线人员
  133. //learun.frameTab.open({ F_ModuleId: '1', F_Icon: 'fa fa-user', F_FullName: '在线人员', F_UrlAddress: '/LR_SystemModule/Log/OnlineUserIndex' });
  134. learun.layerForm({
  135. id: "OnlineUserIndex",
  136. title: '在线人员',
  137. url: top.$.rootUrl + '/LR_SystemModule/Log/OnlineUserIndex',
  138. width: 1000,
  139. height: 600,
  140. btn: null
  141. });
  142. },
  143. // 全屏按钮
  144. fullScreenInit: function () {
  145. 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>';
  146. $('body').append(_html);
  147. $('#lr_fullscreen_btn').on('click', function () {
  148. if (!$(this).attr('fullscreen')) {
  149. $(this).attr('fullscreen', 'true');
  150. page.requestFullScreen();
  151. } else {
  152. $(this).removeAttr('fullscreen');
  153. page.exitFullscreen();
  154. }
  155. });
  156. },
  157. requestFullScreen: function () {
  158. var de = document.documentElement;
  159. if (de.requestFullscreen) {
  160. de.requestFullscreen();
  161. } else if (de.mozRequestFullScreen) {
  162. de.mozRequestFullScreen();
  163. } else if (de.webkitRequestFullScreen) {
  164. de.webkitRequestFullScreen();
  165. }
  166. },
  167. exitFullscreen: function () {
  168. var de = document;
  169. if (de.exitFullscreen) {
  170. de.exitFullscreen();
  171. } else if (de.mozCancelFullScreen) {
  172. de.mozCancelFullScreen();
  173. } else if (de.webkitCancelFullScreen) {
  174. de.webkitCancelFullScreen();
  175. }
  176. },
  177. // 加载数据进度
  178. loadbarInit: function () {
  179. var _html = '<div class="lr-loading-bar" id="lr_loading_bar" >';
  180. _html += '<div class="lr-loading-bar-bg"></div>';
  181. _html += '<div class="lr-loading-bar-message" id="lr_loading_bar_message"></div>';
  182. _html += '</div>';
  183. $('body').append(_html);
  184. },
  185. // 皮肤主题设置
  186. uitheme: function () {
  187. var uitheme = top.$.cookie('Learn_ADMS_V6.1_UItheme') || '1';
  188. var $setting = $('<div class="lr-theme-setting"></div>');
  189. var $btn = $('<button class="btn btn-default"><i class="fa fa-spin fa-gear"></i></button>');
  190. var _html = '<div class="panel-heading">界面风格</div>';
  191. _html += '<div class="panel-body">';
  192. _html += '<div><label><input type="radio" name="ui_theme" value="1" ' + (uitheme == '1' ? 'checked' : '') + '>经典版</label></div>';
  193. _html += '<div><label><input type="radio" name="ui_theme" value="2" ' + (uitheme == '2' ? 'checked' : '') + '>风尚版</label></div>';
  194. //_html += '<div><label><input type="radio" name="ui_theme" value="3" ' + (uitheme == '3' ? 'checked' : '') + '>炫动版</label></div>';
  195. _html += '<div><label><input type="radio" name="ui_theme" value="4" ' + (uitheme == '4' ? 'checked' : '') + '>飞扬版</label></div>';
  196. _html += '<div><label><input type="radio" name="ui_theme" value="5" ' + (uitheme == '5' ? 'checked' : '') + '>导航版</label></div>';
  197. _html += '</div>';
  198. $setting.append($btn);
  199. $setting.append(_html);
  200. $('body').append($setting);
  201. //客服设置
  202. learun.httpPost(top.$.rootUrl + "/LR_Desktop/Sys_CustomerService/GetSys_CustomerServiceEntity", {}, function (res) {
  203. if (res.code == 200) {
  204. if (res.data != null) {
  205. var data = res.data;
  206. var htmlSer = '<div class="lrService">' +
  207. '<div class="serBtn btn"><img src="/Content/images/service.png" alt="" /></div>' +
  208. '<div class="lrSerT">' + data.Title + '</div>' +
  209. '<div class="lrSerBox">' +
  210. '<div class="lrSerCon">' +
  211. '<div class="lrSerTitle">客户经理 </div>' +
  212. '<div class="lrSerTxt">' + data.Manager + ' <img src="/Content/images/phones.png" alt="" /> ' + data.ManagerPhone + '</div>' +
  213. '</div>' +
  214. '<div class="lrSerCon">' +
  215. '<div class="lrSerTitle">客服专员 </div>' +
  216. '<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>' +
  217. '</div>' +
  218. '</div>' +
  219. '</div>';
  220. $('body').append(htmlSer);
  221. }
  222. }
  223. });
  224. //青桔设置
  225. //var htmlQj = '<div class="lrQj btn"><img src="/Content/images/qjIcon.png" alt="" /></div>';
  226. //$('body').append(htmlQj);
  227. //var htmlSer = '<div class="lrService">' +
  228. // '<div class="serBtn btn"><img src="/Content/images/service.png" alt="" /></div>' +
  229. // '<div class="lrSerT">专职客服</div>' +
  230. // '<div class="lrSerBox">' +
  231. // '<div class="lrSerCon">' +
  232. // '<div class="lrSerTitle">客户经理 </div>' +
  233. // '<div class="lrSerTxt">刘经理 <img src="/Content/images/phones.png" alt="" /> 13542658269</div>' +
  234. // '</div>' +
  235. // '<div class="lrSerCon">' +
  236. // '<div class="lrSerTitle">客服专员 </div>' +
  237. // '<div class="lrSerTxt">张客服 <div class="serQq"><img src="/Content/images/qq.png" alt="" /> QQ交谈</div></div>' +
  238. // '</div>' +
  239. // '</div>' +
  240. // '</div>' +
  241. // '<div class="lrQj btn"><img src="/Content/images/qjIcon.png" alt="" /></div>';
  242. //$('body').append(htmlSer);
  243. $('.lrQj').click(function () {
  244. var parents = $(document.getElementById('lr_iframe_0').contentWindow.document.querySelector('#qjImg'));
  245. if (parents.hasClass('active')) {
  246. parents.removeClass('active').slideDown(500)
  247. }
  248. })
  249. var parentSet = $btn.parent();
  250. var parentSer = $('.serBtn').parent();
  251. $('.serBtn').click(function () {
  252. parentSet.removeClass('opened');
  253. if (parentSer.hasClass('opened')) {
  254. parentSer.removeClass('opened');
  255. }
  256. else {
  257. parentSer.addClass('opened');
  258. }
  259. })
  260. $btn.on('click', function () {
  261. parentSer.removeClass('opened');
  262. if (parentSet.hasClass('opened')) {
  263. parentSet.removeClass('opened');
  264. }
  265. else {
  266. parentSet.addClass('opened');
  267. }
  268. });
  269. $setting.find('input').click(function () {
  270. var value = $(this).val();
  271. top.$.cookie('Learn_ADMS_V6.1_UItheme', value, { path: "/" });
  272. window.location.href = $.rootUrl + '/Home/Index';
  273. });
  274. },
  275. };
  276. $(function () {
  277. page.init();
  278. });
  279. })(window.jQuery, top.learun);