Skip to content

Commit

Permalink
自动提交_11:00:00
Browse files Browse the repository at this point in the history
  • Loading branch information
aa24615 committed Jun 28, 2019
1 parent 2266231 commit 69bcc3b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 19 deletions.
9 changes: 6 additions & 3 deletions login.html
Expand Up @@ -16,11 +16,11 @@
<h2>QAdmin后台模板</h2>
<form class="layui-form" method="post" target="_blank" action="">
<div class="layui-form-item">
<input type="username" name="user" placeholder="用户名(随意输入)" required lay-verify="required" class="layui-input">
<input type="username" name="user" placeholder="用户名" class="layui-input">
<i class="layui-icon input-icon">&#xe66f;</i>
</div>
<div class="layui-form-item">
<input type="password" name="pwd" placeholder="密码(随意输入)" required lay-verify="required" class="layui-input">
<input type="password" name="pwd" placeholder="密码" class="layui-input">
<i class="layui-icon input-icon">&#xe673;</i>
</div>
<div class="layui-form-item">
Expand All @@ -46,7 +46,10 @@ <h2>QAdmin后台模板</h2>
shade: 0.5,
time: 0,
});
window.location.href = 'index.html';
setTimeout(function () {
window.location.href = 'index.html';
},3000)

return false;
});
});
Expand Down
21 changes: 17 additions & 4 deletions static/admin/js/config.js
@@ -1,7 +1,20 @@

//网站名称
var webname = 'QAdmin';

//菜单列表路径 可以是本地json 也可以是api接口
var menuUrl = 'data/menu.json';
var config = {

//调试模式 (开启后左侧菜单不缓存,打开渲染速度会变慢)
debug: true,

//网站名称 (左上角显示的文字LOGO)
webname: 'QAdmin',

//菜单列表路径 (可以是本地json,也可以是api接口)
menuUrl: 'data/menu.json',

//layer全局提示层
layerMsg: {
offset: 't', //坐标 (详细说明 https://www.layui.com/doc/modules/layer.html#offset)
shade: [0.4, '#000'] //遮罩 (详细说明 https://www.layui.com/doc/modules/layer.html#shade)
}
}

35 changes: 23 additions & 12 deletions static/admin/js/script.js
Expand Up @@ -10,18 +10,16 @@ layui.use('form', function () {
var vue = new Vue({
el:'#app',
data:{
webname:webname,
webname:config.webname,
menu:[],
address:[]
},
created:function(){

//加载左侧菜单
let data = sessionStorage.menu;
if(!data){
console.log(88)
if(config.debug){
$.ajax({
url: menuUrl,
url: config.menuUrl,
dataType: 'text',
success: (menu) => {
menu = eval('(' + menu + ')');
Expand All @@ -31,13 +29,26 @@ var vue = new Vue({
this.thisAttr();
}
})
}else{
this.menu = JSON.parse(data);
this.thisActive();
this.thisAttr();
}else {
let data = sessionStorage.menu;
if (!data) {
$.ajax({
url: config.menuUrl,
dataType: 'text',
success: (menu) => {
menu = eval('(' + menu + ')');
sessionStorage.menu = JSON.stringify(menu);
this.menu = menu;
this.thisActive();
this.thisAttr();
}
})
} else {
this.menu = JSON.parse(data);
this.thisActive();
this.thisAttr();
}
}


},
methods:{
//记住收展
Expand Down Expand Up @@ -189,7 +200,7 @@ function msg(code=1,msg='',url='',s=3) {
code = code.code;
}
code = code==1 ? 1 : 2;
layer.msg(msg, {icon: code,offset: 't',shade: [0.4, '#000']});
layer.msg(msg, {icon: code,offset: config.layerMsg.offset || 't',shade: config.layerMsg.shade || [0.4, '#000']});
if(url){
setTimeout(function () {
window.location.href = url;
Expand Down

0 comments on commit 69bcc3b

Please sign in to comment.