2020-01-01 13:17:19 +08:00
|
|
|
|
/**
|
|
|
|
|
|
|
|
|
|
@Name:layuiAdmin 公共业务
|
|
|
|
|
@Author:贤心
|
|
|
|
|
@Site:http://www.layui.com/admin/
|
|
|
|
|
@License:LPPL
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
layui.define(function(exports){
|
|
|
|
|
var $ = layui.$
|
|
|
|
|
,layer = layui.layer
|
|
|
|
|
,laytpl = layui.laytpl
|
|
|
|
|
,setter = layui.setter
|
|
|
|
|
,view = layui.view
|
|
|
|
|
,admin = layui.admin
|
|
|
|
|
|
|
|
|
|
//公共业务的逻辑处理可以写在此处,切换任何页面都会执行
|
|
|
|
|
//……
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//退出
|
|
|
|
|
admin.events.logout = function(){
|
|
|
|
|
//执行退出接口
|
|
|
|
|
admin.req({
|
2020-04-25 16:48:59 +08:00
|
|
|
|
url: AdminLogout
|
2020-01-01 13:17:19 +08:00
|
|
|
|
,type: 'get'
|
|
|
|
|
,data: {}
|
|
|
|
|
,done: function(res){ //这里要说明一下:done 是只有 response 的 code 正常才会执行。而 succese 则是只要 http 为 200 就会执行
|
|
|
|
|
|
|
|
|
|
//清空本地记录的 token,并跳转到登入页
|
|
|
|
|
admin.exit(function(){
|
|
|
|
|
|
|
|
|
|
layer.msg(res.msg,{
|
|
|
|
|
icon:1,
|
|
|
|
|
time:2000
|
|
|
|
|
}, function(){
|
2020-04-25 16:48:59 +08:00
|
|
|
|
location.href = AdminLogin;
|
2020-01-01 13:17:19 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//对外暴露的接口
|
|
|
|
|
exports('common', {});
|
|
|
|
|
});
|