////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
* 版 本 ADMS V2 Learun智慧校园 敏捷 开发框架
* Copyright (c) 2013-2018 北京泉江科技有限公司
* 创建人:Learun智慧校园- 前端开发组
* 日 期:2017.03.16
* 描 述:admin顶层页面操作方法
*/
var loaddfimg;
(function ($, learun) {
"use strict";
var page = {
init: function () {
/*判断当前浏览器是否是IE浏览器*/
if ($('body').hasClass('IE') || $('body').hasClass('InternetExplorer')) {
$('#lr_loadbg').append(' ');
Pace.stop();
}
else {
Pace.on('done', function () {
$('#lr_loadbg').fadeOut();
Pace.options.target = '#learunpacenone';
});
}
// 通知栏插件初始化设置
toastr.options = {
"closeButton": true,
"debug": false,
"newestOnTop": true,
"progressBar": false,
"positionClass": "toast-top-center",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "3000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
// 打开首页模板
learun.frameTab.open({ F_ModuleId: '0', F_Icon: 'fa fa-desktop', F_FullName: '我的桌面', F_UrlAddress: '/Home/AdminDesktop' }, true);
learun.clientdata.init(function () {
page.userInit();
// 初始页面特例
bootstrap($, learun);
if ($('body').hasClass('IE') || $('body').hasClass('InternetExplorer')) {
$('#lr_loadbg').fadeOut();
}
});
// 加载数据进度
page.loadbarInit();
// 全屏按钮
page.fullScreenInit();
// 主题选择初始化
page.uitheme();
},
// 登录头像和个人设置
userInit: function () {
var loginInfo = learun.clientdata.get(['userinfo']);
var _html = '
';
$('body').append(_html);
$('#lr_loginout_btn').on('click', page.loginout);
$('#lr_userinfo_btn').on('click', page.openUserCenter);
$('#lr_clearredis_btn').on('click', page.clearredis);
$('#lr_onlineuser_btn').on('click', page.openOnlineUser);
$('#lr_cancelweixinbind_btn').on('click', page.cancelWeiXinBind);
},
loginout: function () { // 安全退出
learun.layerConfirm("注:您确定要安全退出本次登录吗?", function (r) {
if (r) {
learun.loading(true, '退出系统中...');
//Ip上网
var loginInfo = top.learun.clientdata.get(['userinfo']);
if (ACIp != null && ACIp != "") {
sendToAc(ACIp, 'logout', Ip, loginInfo.enCode, '');
}
if (ACIp2 != null && ACIp2 != "") {
sendToAc(ACIp2, 'logout', Ip, loginInfo.enCode, '');
}
learun.httpAsyncPost($.rootUrl + '/Login/OutLogin', {}, function (data) {
window.location.href = $.rootUrl + "/Login/Index";
});
}
});
},
clearredis: function () {
learun.layerConfirm("注:您确定要清空全部后台缓存数据吗?", function (r) {
if (r) {
learun.loading(true, '清理缓存数据中...');
learun.httpAsyncPost($.rootUrl + '/Home/ClearRedis', {}, function (data) {
window.location.href = $.rootUrl + "/Login/Index";
});
}
});
},
cancelWeiXinBind: function () {
learun.layerConfirm("注:您确定要解绑微信吗?", function (r) {
if (r) {
learun.loading(true, '解除绑定中...');
learun.httpAsyncPost($.rootUrl + '/Home/CancelWeiXinBind', {}, function (data) {
if (data.code == 200) {
learun.alert.success(data.info);
} else {
learun.alert.error("异常,请刷新!");
}
learun.loading(false);
});
}
});
},
openUserCenter: function () {
// 打开个人中心
learun.frameTab.open({ F_ModuleId: '1', F_Icon: 'fa fa-user', F_FullName: '个人中心', F_UrlAddress: '/UserCenter/IndexForDC' });
},
openOnlineUser: function () {
// 打开在线人员
//learun.frameTab.open({ F_ModuleId: '1', F_Icon: 'fa fa-user', F_FullName: '在线人员', F_UrlAddress: '/LR_SystemModule/Log/OnlineUserIndex' });
learun.layerForm({
id: "OnlineUserIndex",
title: '在线人员',
url: top.$.rootUrl + '/LR_SystemModule/Log/OnlineUserIndex',
width: 1000,
height: 600,
btn: null
});
},
// 全屏按钮
fullScreenInit: function () {
var _html = '';
$('body').append(_html);
$('#lr_fullscreen_btn').on('click', function () {
if (!$(this).attr('fullscreen')) {
$(this).attr('fullscreen', 'true');
page.requestFullScreen();
} else {
$(this).removeAttr('fullscreen');
page.exitFullscreen();
}
});
},
requestFullScreen: function () {
var de = document.documentElement;
if (de.requestFullscreen) {
de.requestFullscreen();
} else if (de.mozRequestFullScreen) {
de.mozRequestFullScreen();
} else if (de.webkitRequestFullScreen) {
de.webkitRequestFullScreen();
}
},
exitFullscreen: function () {
var de = document;
if (de.exitFullscreen) {
de.exitFullscreen();
} else if (de.mozCancelFullScreen) {
de.mozCancelFullScreen();
} else if (de.webkitCancelFullScreen) {
de.webkitCancelFullScreen();
}
},
// 加载数据进度
loadbarInit: function () {
var _html = '';
_html += '
';
_html += '
';
_html += '
';
$('body').append(_html);
},
// 皮肤主题设置
uitheme: function () {
var uitheme = top.$.cookie('Learn_ADMS_V6.1_UItheme') || '1';
var $setting = $('
');
var $btn = $(' ');
var _html = '界面风格
';
_html += '';
$setting.append($btn);
$setting.append(_html);
$('body').append($setting);
//客服设置
learun.httpPost(top.$.rootUrl + "/LR_Desktop/Sys_CustomerService/GetSys_CustomerServiceEntity", {}, function (res) {
if (res.code == 200) {
if (res.data != null) {
var data = res.data;
var htmlSer = '' +
'
' +
'
' + data.Title + '
' +
'
' +
'
' +
'
客户经理
' +
'
' + data.Manager + '
' + data.ManagerPhone + '
' +
'
' +
'
' +
'
客服专员
' +
'
' + data.CustomerName + '
' +
'
' +
'
' +
'
';
$('body').append(htmlSer);
}
}
});
//青桔设置
//var htmlQj = '';
//$('body').append(htmlQj);
//var htmlSer = '' +
// '
' +
// '
专职客服
' +
// '
' +
// '
' +
// '
客户经理
' +
// '
刘经理
13542658269
' +
// '
' +
// '
' +
// '
客服专员
' +
// '
张客服
QQ交谈
' +
// '
' +
// '
' +
// '
' +
// '';
//$('body').append(htmlSer);
$('.lrQj').click(function () {
var parents = $(document.getElementById('lr_iframe_0').contentWindow.document.querySelector('#qjImg'));
if (parents.hasClass('active')) {
parents.removeClass('active').slideDown(500)
}
})
var parentSet = $btn.parent();
var parentSer = $('.serBtn').parent();
$('.serBtn').click(function () {
parentSet.removeClass('opened');
if (parentSer.hasClass('opened')) {
parentSer.removeClass('opened');
}
else {
parentSer.addClass('opened');
}
})
$btn.on('click', function () {
parentSer.removeClass('opened');
if (parentSet.hasClass('opened')) {
parentSet.removeClass('opened');
}
else {
parentSet.addClass('opened');
}
});
$setting.find('input').click(function () {
var value = $(this).val();
top.$.cookie('Learn_ADMS_V6.1_UItheme', value, { path: "/" });
window.location.href = $.rootUrl + '/Home/Index';
});
},
};
$(function () {
page.init();
});
})(window.jQuery, top.learun);