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