first commit:add basic layout

This commit is contained in:
2023-09-18 18:22:59 +08:00
parent 4298c6a50d
commit ad425d9614
37 changed files with 6412 additions and 0 deletions

50
assets/static/js/index.js Normal file
View File

@@ -0,0 +1,50 @@
var http_port, https_port;
(function ($) {
$(function () {
function init() {
var langLoading = layui.layer.load()
$.getJSON('/lang.json').done(function (lang) {
$.ajaxSetup({
error: function (xhr,) {
if (xhr.status === 401) {
layui.layer.msg(lang['TokenInvalid'], function () {
window.location.reload();
});
}
},
})
layui.element.on('nav(leftNav)', function (elem) {
var id = elem.attr('id');
var title = elem.text();
if (id === 'serverInfo') {
loadServerInfo(lang, title.trim());
} else if (id === 'userList') {
loadUserList(lang, title.trim());
} else if (elem.closest('.layui-nav-item').attr('id') === 'proxyList') {
if (id != null && id.trim() !== '') {
var suffix = elem.closest('.layui-nav-item').children('a').text().trim();
loadProxyInfo(lang, title + " " + suffix, id);
}
}
});
$('#leftNav .layui-this > a').click();
}).always(function () {
layui.layer.close(langLoading);
});
}
function logout() {
$.get("/logout", function (result) {
window.location.reload();
});
}
$(document).on('click.logout', '#logout', function () {
logout();
});
init();
});
})(layui.$);