index.js
2.26 KB
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
let customImportFileName = ["form", "table", "element", "jquery", "miniAdmin"]
layui.config({
base: "/js/",
version: 111
}).use(customImportFileName, function () {
var $ = layui.jquery,
layer = layui.layer,
miniAdmin = layui.miniAdmin;
//ajax
var options = {
iniUrl: "/Home/GetMenuList", // 初始化接口
clearUrl: "../lib/layuimini/api/clear.json", // 缓存清理接口
urlHashLocation: false, // 是否打开hash定位
bgColorDefault: false, // 主题默认配置
multiModule: true, // 是否开启多模块
menuChildOpen: false, // 是否默认展开菜单
loadingTime: 0, // 初始化加载时间
pageAnim: true, // iframe窗口动画
maxTabNum: 20, // 最大的tab打开数量
};
miniAdmin.render(options);
$('.login-out').on("click", function () {
layer.confirm('确认要退出吗?', {
btn: ['确定', '取消']//按钮
}, function (index) {
$.ajax({
url: "/Login/Logout",
type: "get",
success: function (data) {
if (data.code === 200) {
window.location = '../Login/Index';
} else {
layer.msg(data.msg);
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
layer.alert(errorThrown, { icon: 2, shadeClose: true, title: "错误信息" });
}
});
}, function (index) {
layer.close(index);
});
// layer.msg('退出登录成功', function () {
// window.location = 'page/login-3.html';
// });
});
$("#inputSearch").on('input', function (e) {
var strings = e.delegateTarget.value;
if (strings.replace(/(^s*)|(s*$)/g, "").length > 0) {
miniAdmin.renderMenu({ value: strings, options });
} else {
miniAdmin.renderMenu({ value: "", options });
}
});
$("#inputSearch").keypress(function (e) {
if (e.which == 13 && $("#inputSearch").val() != "") {
miniAdmin.selectedMenu();
}
});
});