forked from weberandphper/Layui-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
290 lines (275 loc) · 9.32 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!--极速模式-->
<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<!--layui-v2.3.0-->
<link rel="stylesheet" href="./plugins/layui/css/layui.css" media="all">
<link rel="stylesheet" href="./plugins/font-awesome-4.7.0/css/font-awesome.min.css" />
<!--功能按钮样式-->
<link rel="stylesheet" href="./build/css/app.css" media="all">
<!--默认样式-->
<link rel="stylesheet" href="styles.css" />
<!--默认皮肤-->
<link rel="stylesheet" href="./build/css/themes/default.css" media="all" id="skin" kit-skin />
<!--公共样式-->
<link rel="stylesheet" href="common.css" />
<link rel="shortcut icon" href="favicon.ico">
<!--访问统计 百度-->
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?1123c6760cbd8bd962766d0f2d3f2cf4";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</head>
<body class="kit-theme">
<div class="layui-layout layui-layout-admin kit-layout-admin" id="page-wrapper" v-cloak>
<div class="layui-header">
<div class="layui-logo"><a href="/">Anspray 管理后台</a></div>
<div class="layui-logo kit-logo-mobile">K</div>
<form class="layui-form layui-layout-left search-menu">
<select lay-search="" lay-filter="component" id="search-menu">
<option value="">便捷菜单查询</option>
<option value="item.name" v-for="(item, index) in menuList">
{{ item.name }}
</option>
</select>
</form>
<ul class="layui-nav layui-layout-left kit-nav">
<li class="layui-nav-item layui-action" data-type="jurisdiction">
<a href="javascript:;">权限管理一</a>
</li>
<li class="layui-nav-item layui-action" data-type="tonpl" id="tonpl">
<a href="javascript:;">权限管理二</a>
</li>
</ul>
<ul class="layui-nav layui-layout-right kit-nav" id="right-menu">
<!--服务器时间-->
<li class="layui-nav-item">
<div class="digital-clock">{{ serverDate }}</div>
</li>
<!--天气展示-->
<!-- <li class="layui-nav-item">
<iframe width="180" scrolling="no" height="18" frameborder="0" allowtransparency="true" src="http://i.tianqi.com/index.php?c=code&id=1&icon=1&wind=1&num=2&site=12"></iframe>
</li> -->
<li class="layui-nav-item hide" id="tag">
<a href="javascript:;"><i class="fa fa-tag" aria-hidden="true"></i></a>
</li>
<li class="layui-nav-item" id="color">
<a href="javascript:;">皮肤<span class="layui-badge-dot"></span></a>
</li>
<li class="layui-nav-item">
<a href="javascript:;">
<img src="resources/images/admin.jpg" class="layui-nav-img">欢迎, {{ cookie.get('name') }}
</a>
<dl class="layui-nav-child">
<dd class="layui-action" data-type="baseinfo">
<a href="javascript:;">基本资料</a>
</dd>
<dd class="layui-action" data-type="resetpassword">
<a href="javascript:;">修改密码</a>
</dd>
<dd class="layui-action" data-type="loginout">
<a href="javascript:;">退出</a>
</dd>
</dl>
</li>
<li class="layui-nav-item" id="news">
<a href="javascript:;">消息<span class="layui-badge-dot"></span></a>
</li>
<li class="layui-nav-item">
<a href="javascript:;" id="copyright" style="color:#333;"><i class="fa fa-ellipsis-v" aria-hidden="true"></i></a>
</li>
</ul>
</div>
<div class="layui-side layui-bg-black kit-side">
<div class="layui-side-scroll">
<div class="kit-side-fold">
<i class="fa fa-navicon" aria-hidden="true"></i>
</div>
<!--菜单列表-->
<ul class="layui-nav layui-nav-tree" lay-filter="kitNavbar" kit-navbar></ul>
</div>
</div>
<div class="layui-body" id="container">
<!-- 内容主体区域 -->
<div style="padding: 15px;">内容加载中,请稍等...</div>
</div>
<div class="layui-footer">
<!-- 底部固定区域 -->
CopyRight © 2017<a href=""> xxxxxx有限公司 </a>all rights rerserved MIT license
<!-- <a href="#/companylist">前端路由测试</a>
<span id="span">test</span> -->
</div>
</div>
<!--锁屏-->
<div class="admin-header-lock" id="lock-box" style="display: none;">
<div class="admin-header-lock-img"><img src="http://iwmzc.com/images/face.jpg" /></div>
<div class="admin-header-lock-name" id="lockUserName">anspray</div>
<div class="input_btn">
<input type="password" name="lockPwd" class="admin-header-lock-input layui-input" placeholder="请输入密码解锁.." id="lockPwd" />
<button class="layui-btn" id="unlock">解锁</button>
</div>
<p>请输入登陆密码进行解锁 !</p>
</div>
<script src="./plugins/layui/layui.js"></script>
<!--前端路由-->
<script src="./plugins/router.js"></script>
<!--v2.2.2-->
<script src="./plugins/vue.min.js"></script>
<!--公共函数库-->
<script src="./common.js"></script>
<!--<script src="https://js.fundebug.cn/fundebug.1.1.0.min.js"
apikey="52bc85eea4bc6c35cd9265f880502c96c5790ffd0ffbf0baa53f73aaf9e8fc00"></script>-->
<script>
var vm = new Vue({
el: '#page-wrapper',
data: {
menuList: [],
serverDate: "0000-00-00 00:00:00",
},
});
layui.config({
base: 'build/js/'
}).use(['app', 'message', 'tab', 'ajaxmod','form', 'routermod'], function() {
var app = layui.app,
$ = layui.jquery,
element = layui.element,
layer = layui.layer,
tab = layui.tab,
form = layui.form,
ajaxmod = layui.ajaxmod,
routermod = layui.routermod,
// 将message设置为全局以便子页面调用
message = layui.message;
//主入口
app.set({
type: 'iframe',
// 设置切换是否刷新
isrefresh: true
}).init();
// 获取服务器时间
ajaxFun("GET","",function (ajaxobj) {
var zDate= ajaxobj.getResponseHeader("Date") + (3600000 * 8);
var timeStamp = new Date(zDate).getTime();
setInterval(function() {
timeStamp = timeStamp + 500;
var date = new Date(timeStamp);
Y = date.getFullYear() + '-';
M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
D = date.getDate() + ' ';
h = date.getHours() + ':';
m = date.getMinutes() + ':';
s = date.getSeconds();
vm.serverDate = Y+M+D+h+m+s;
// var times = new Date(parseInt(timeStamp) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
}, 500);
})
active = {
changePage(data) {
var data = data == undefined ? {
icon: "",
id: "1tab1",
title: "机器人库",
url: "main.html"
} : data;
// $(".layui-tab-title").children("li[lay-id]").each(function() {
// var e = $(this).attr("lay-id"); -
// 1 != e && element.tabDelete('kitTab', e);
// })
layer.load(2, {
shade: [0.2, "black"]
});
setTimeout(function() {
layer.closeAll('loading');
tab.tabAdd(data);
}, 1000);
},
// 修改密码
resetpassword() {
var data = {
icon: "",
id: "1tab1",
title: "修改密码",
url: "module/other/resetpassword.html"
};
active.changePage(data);
},
// 权限管理
jurisdiction() {
active.changePage();
},
// 退出
loginout() {
cookie.clear();
window.location.href = "/login.html"
}
};
// 按钮事件
$('#page-wrapper .layui-action').on('click', function() {
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
var searchArr = [];
// 验证登录
if (!cookie.has('usertoken')) {
layer.msg("登录验证失效,即将跳转到登录页面", {
icon: 2,
shade: [0.8, '#393D49']
});
window.location.href = "login.html"
} else {
ajaxmod.layuiGet("/datas/menulist.json", "", function(res) {
var str = `<option value="">便捷菜单查询</option>`;
res.data.forEach(function (e) {
e.children.forEach(function (i) {
var strarr = i.url.split("/");
var anchor = strarr[strarr.length-1].split(".")[0];
routermod.add(anchor, (function (i) {
return function () {
var data = {
icon: i.icon,
id: i.id,
title: i.title,
url: i.url
};
active.changePage(data);
}
}(i)))
searchArr.push(i);
str+=`<option value=${i.id}>${i.title}</option>`;
})
})
$("#search-menu").html(`<select lay-filter="select-search" lay-search >${str}</select>`);
form.render();
if(!res.success) {
layer.msg(res.message, {
icon: 2
});
window.location.href = "login.html"
}
},1)
}
// 便捷查询
form.on('select(select-search)', function(data){
searchArr.forEach(function (e) {
if (e.id == data.value) {
active.changePage(e);
}
})
});
});
// token失效跳转
function tologins() {
window.location.href = "/login.html"
}
</script>
</body>
</html>