admin.js add logout function
parent
135dd3f4da
commit
f29c5acee6
|
|
@ -1,4 +1,4 @@
|
|||
.layui-layer-msg{
|
||||
border-color: whitesmoke!important;
|
||||
border-color: transparent!important;
|
||||
box-shadow: 2px 0 6px rgb(0 21 41 / 0.05)!important;
|
||||
}
|
||||
|
|
@ -16,6 +16,9 @@ layui.define(['table', 'jquery', 'element', 'yaml', 'form', 'tab', 'menu', 'fram
|
|||
let sideMenu;
|
||||
let bodyTab;
|
||||
let config;
|
||||
let logout = function(){
|
||||
location.href = "login.html";
|
||||
}
|
||||
|
||||
const body = $('body');
|
||||
|
||||
|
|
@ -210,6 +213,11 @@ layui.define(['table', 'jquery', 'element', 'yaml', 'form', 'tab', 'menu', 'fram
|
|||
pearAdmin.removeClass("dark-theme");
|
||||
pearAdmin.addClass(theme);
|
||||
}
|
||||
|
||||
this.logout = function(callback){
|
||||
|
||||
logout = callback;
|
||||
}
|
||||
};
|
||||
|
||||
function collaspe() {
|
||||
|
|
@ -227,9 +235,19 @@ layui.define(['table', 'jquery', 'element', 'yaml', 'form', 'tab', 'menu', 'fram
|
|||
admin.addClass("pear-mini");
|
||||
}
|
||||
}
|
||||
|
||||
body.on("click",".logout",function(){
|
||||
// 回调
|
||||
var result = logout();
|
||||
|
||||
if(result){
|
||||
// 清空缓存
|
||||
bodyTab.clear();
|
||||
}
|
||||
})
|
||||
|
||||
body.on("click", ".collaspe,.pear-cover", function() {
|
||||
collaspe()
|
||||
collaspe();
|
||||
});
|
||||
|
||||
body.on("click", ".fullScreen", function() {
|
||||
|
|
|
|||
|
|
@ -91,6 +91,11 @@ layui.define(['jquery', 'element'], function(exports) {
|
|||
scrollLeft: autoLeft - $tabTitle.width() / 3
|
||||
}, 200);
|
||||
}
|
||||
|
||||
pearTab.prototype.clear = function(){
|
||||
sessionStorage.removeItem(this.option.elem+"-pear-tab-data");
|
||||
sessionStorage.removeItem(this.option.elem+"-pear-tab-data-current");
|
||||
}
|
||||
|
||||
pearTab.prototype.addTab = function(opt) {
|
||||
var title = '';
|
||||
|
|
|
|||
11
index.html
11
index.html
|
|
@ -34,7 +34,7 @@
|
|||
<!-- 功 能 菜 单 -->
|
||||
<dl class="layui-nav-child">
|
||||
<dd><a user-menu-url="view/system/person.html" user-menu-id="5555" user-menu-title="基本资料">基本资料</a></dd>
|
||||
<dd><a href="login.html">注销登录</a></dd>
|
||||
<dd><a href="javascript:void(0);" class="logout">注销登录</a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
<!-- 主 题 配 置 -->
|
||||
|
|
@ -88,6 +88,15 @@
|
|||
admin.setConfigType("yml");
|
||||
admin.setConfigPath("config/pear.config.yml");
|
||||
admin.render();
|
||||
|
||||
// 登出逻辑
|
||||
admin.logout(function(){
|
||||
|
||||
// 注销逻辑 返回 true / false
|
||||
location.href = "login.html";
|
||||
|
||||
return true;
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
Loading…
Reference in New Issue