2019-05-17 16:34:10 +00:00
|
|
|
|
layui.config({
|
|
|
|
|
|
base: "lib/okPlugins/"
|
|
|
|
|
|
}).extend({
|
|
|
|
|
|
okTab: "okTab",
|
2019-05-17 18:23:50 +00:00
|
|
|
|
okUtils: "okUtils"
|
|
|
|
|
|
}).use(["element", "layer", "okTab", "okUtils"], function () {
|
2018-07-21 14:43:18 +00:00
|
|
|
|
var $ = layui.jquery;
|
|
|
|
|
|
var layer = layui.layer;
|
2019-05-17 16:34:10 +00:00
|
|
|
|
var okTab = layui.okTab;
|
2019-05-17 18:23:50 +00:00
|
|
|
|
var okUtils = layui.okUtils;
|
2018-07-21 14:43:18 +00:00
|
|
|
|
|
2019-04-30 13:30:31 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* localhost运行提示
|
|
|
|
|
|
*/
|
|
|
|
|
|
var href = location.href;
|
|
|
|
|
|
if (href.substring(0, 4) != "http") {
|
2019-04-30 14:42:03 +00:00
|
|
|
|
layer.msg("请先部署到localhost环境下再访问!", {icon: 7, time: 3000, anim: 1});
|
2019-04-30 13:30:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-07-21 14:43:18 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 左边菜单显示/隐藏功能
|
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
|
*/
|
|
|
|
|
|
$(".menu-switch").click(function () {
|
|
|
|
|
|
if ($(".layui-layout-admin .layui-side").css("left") == '0px') {
|
2018-08-26 10:52:25 +00:00
|
|
|
|
$(".layui-layout-admin .layui-side").animate({left: "-200px"});
|
|
|
|
|
|
$(".layui-layout-admin .content-body").animate({left: "0px"});
|
|
|
|
|
|
$(".layui-layout-admin .layui-footer").animate({left: "0px"});
|
2018-07-21 14:43:18 +00:00
|
|
|
|
} else {
|
2018-08-26 10:52:25 +00:00
|
|
|
|
$(".layui-layout-admin .layui-side").animate({left: "0px"});
|
|
|
|
|
|
$(".layui-layout-admin .content-body").animate({left: "200px"});
|
|
|
|
|
|
$(".layui-layout-admin .layui-footer").animate({left: "200px"});
|
2018-07-21 14:43:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2019-05-17 18:23:50 +00:00
|
|
|
|
// TODO 加载左侧菜单 !!!!!!!!!!!!
|
|
|
|
|
|
okUtils.ajax("data/menu.json", "get").done(function (response) {
|
|
|
|
|
|
var html = "";
|
|
|
|
|
|
for (var i = 0; i < response.length; i++) {
|
|
|
|
|
|
var d = response[i];
|
|
|
|
|
|
html += "<li class='layui-nav-item'>"
|
|
|
|
|
|
html += "<a href='javascript:;'>"
|
|
|
|
|
|
html += "<i class='iconfont icon-huiyuan'></i> " + response[i].title;
|
|
|
|
|
|
html += "</a>"
|
|
|
|
|
|
if (d.children != undefined && d.children.length > 0) {
|
|
|
|
|
|
html += "<dl class='layui-nav-child'>"
|
|
|
|
|
|
for (var j = 0; j < d.children.length; j++) {
|
|
|
|
|
|
html += "<dd><a href='javascript:;' path='pages/user/user.html' tab-id='1-1'><i class='iconfont icon-dianliyonghuzongshu'></i> " + d.children[j].title + "</a></dd>";
|
|
|
|
|
|
}
|
|
|
|
|
|
html += "</dl>"
|
|
|
|
|
|
}
|
|
|
|
|
|
html += "</li>";
|
|
|
|
|
|
}
|
|
|
|
|
|
// alert(html)
|
|
|
|
|
|
// $(".layui-nav-tree").html(html);
|
|
|
|
|
|
}).fail(function (error) {
|
|
|
|
|
|
console.log(error)
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2018-07-21 14:43:18 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 点击左边菜单在右边添加选项卡
|
|
|
|
|
|
*/
|
|
|
|
|
|
$(".layui-nav-child").find("dd").click(function () {
|
2018-08-26 10:33:50 +00:00
|
|
|
|
// 纯文字
|
2019-04-14 09:30:53 +00:00
|
|
|
|
var title = $(this).text();
|
2018-08-26 10:33:50 +00:00
|
|
|
|
// 图标+文字
|
2019-04-14 09:30:53 +00:00
|
|
|
|
// var title = $(this).find("a").html();
|
2019-04-14 13:46:22 +00:00
|
|
|
|
var path = $(this).children("a").attr("path");
|
|
|
|
|
|
var tabId = $(this).children("a").attr("tab-id");
|
2019-05-17 16:34:10 +00:00
|
|
|
|
okTab.add(title, path, tabId);
|
2019-04-30 14:42:03 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
2019-03-30 11:39:17 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 修改copyright结束时间
|
|
|
|
|
|
*/
|
|
|
|
|
|
var data = new Date();
|
|
|
|
|
|
var year = data.getFullYear();
|
|
|
|
|
|
$("#endYear").text(year);
|
|
|
|
|
|
|
2018-07-21 14:43:18 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 捐赠作者
|
|
|
|
|
|
*/
|
2019-02-14 08:16:56 +00:00
|
|
|
|
$(".layui-footer button.donate").click(function () {
|
2018-07-21 14:43:18 +00:00
|
|
|
|
layer.tab({
|
|
|
|
|
|
area: ["330px", "350px"],
|
|
|
|
|
|
tab: [{
|
|
|
|
|
|
title: "支付宝",
|
2019-03-29 15:53:37 +00:00
|
|
|
|
content: "<img src='imgs/zfb.jpg' width='200' height='300' style='margin-left: 60px'>"
|
2018-07-21 14:43:18 +00:00
|
|
|
|
}, {
|
|
|
|
|
|
title: "微信",
|
2019-03-29 15:53:37 +00:00
|
|
|
|
content: "<img src='imgs/wx.jpg' width='200' height='300' style='margin-left: 60px'>"
|
2018-07-21 14:43:18 +00:00
|
|
|
|
}]
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2019-02-14 08:16:56 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* QQ群交流
|
|
|
|
|
|
*/
|
|
|
|
|
|
$(".layui-footer button.communication").click(function () {
|
|
|
|
|
|
layer.tab({
|
|
|
|
|
|
area: ["330px", "350px"],
|
|
|
|
|
|
tab: [{
|
|
|
|
|
|
title: "QQ群",
|
2019-03-29 15:53:37 +00:00
|
|
|
|
content: "<img src='imgs/qq.jpeg' width='200' height='300' style='margin-left: 60px'>"
|
2019-02-14 08:16:56 +00:00
|
|
|
|
}]
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2018-07-21 14:43:18 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 退出操作
|
|
|
|
|
|
*/
|
|
|
|
|
|
$("#logout").click(function () {
|
|
|
|
|
|
layer.confirm("确定要退出吗?", {skin: 'layui-layer-lan', icon: 3, title: '提示', anim: 6}, function () {
|
2019-05-13 11:20:49 +00:00
|
|
|
|
window.location = "pages/user/login.html";
|
2018-07-21 14:43:18 +00:00
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 锁定账户
|
|
|
|
|
|
*/
|
|
|
|
|
|
$("#lock").click(function () {
|
|
|
|
|
|
layer.confirm("确定要锁定账户吗?", {skin: 'layui-layer-lan', icon: 4, title: '提示', anim: 1}, function (index) {
|
|
|
|
|
|
layer.close(index);
|
|
|
|
|
|
$(".yy").show();
|
2018-08-26 09:00:58 +00:00
|
|
|
|
layer.prompt({
|
|
|
|
|
|
btn: ['确定'],
|
|
|
|
|
|
title: '输入密码解锁(123456)',
|
|
|
|
|
|
closeBtn: 0,
|
|
|
|
|
|
formType: 1
|
|
|
|
|
|
}, function (value, index, elem) {
|
2018-07-21 14:43:18 +00:00
|
|
|
|
if (value == "123456") {
|
|
|
|
|
|
layer.close(index);
|
|
|
|
|
|
$(".yy").hide();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
layer.msg('密码错误', {anim: 6});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
2019-02-14 08:25:31 +00:00
|
|
|
|
|
2019-05-01 08:47:17 +00:00
|
|
|
|
console.log(" __ .___ .__ \n" +
|
|
|
|
|
|
" ____ | | __ _____ __| _/_____ |__| ____ \n" +
|
|
|
|
|
|
" / _ \\| |/ / ______ \\__ \\ / __ |/ \\| |/ \\ \n" +
|
|
|
|
|
|
"( <_> ) < /_____/ / __ \\_/ /_/ | Y Y \\ | | \\\n" +
|
|
|
|
|
|
" \\____/|__|_ \\ (____ /\\____ |__|_| /__|___| /\n" +
|
|
|
|
|
|
" \\/ \\/ \\/ \\/ \\/ \n" +
|
2019-02-14 08:25:31 +00:00
|
|
|
|
"版本:v1.0\n" +
|
|
|
|
|
|
"作者:bobi\n" +
|
|
|
|
|
|
"邮箱:bobi1234@foxmail.com\n" +
|
|
|
|
|
|
"描述:一个很赞的,扁平化风格的,响应式布局的后台管理模版,旨为后端程序员减压!")
|
2019-02-14 08:16:56 +00:00
|
|
|
|
});
|