新增SpringSecurity来认证

新增音乐分享功能
修改跨域代码
http工具改为同步
This commit is contained in:
2021-10-23 13:03:45 +08:00
parent 90af00b235
commit 98da63a0d5
16 changed files with 779 additions and 217 deletions

View File

@@ -46,19 +46,55 @@
<script src="/js/qrcode.min.js"></script>
<script src="/layui/layui.js"></script>
<script src="/js/jquery-3.2.1.js"></script>
<script src="/js/myjs.js"></script>
<script>
let loginStatus = false;
$.get("/login/check.do", function (data) {
let json = JSON.parse(data);
if (json.code === 0) {
$('#login_text').text('已登录')
loginStatus = true;
window.onload=function (){
if(getParam('type')==='login'&&!loginStatus){
onLogin()
}
}
$.get("/login/check.do",{share:getParam("share")}, function (data) {
try {
let json = JSON.parse(data);
console.log(data)
if (json.code === 0) {
$('#login_text').text('已登录')
loginStatus = true;
}else if(json.code===-1&&getParam("type")!=='login'){
window.location.href='/?type=login'
}
}catch (e) {
window.location.href='/'
}
})
$('#login').click(function () {
if (loginStatus) {
return;
}
onLogin()
})
$('#logout').click(function () {
$.post('/login/logout.do', function (data) {
let json = JSON.parse(data);
layer.msg(json.msg)
window.location.href = "/"
})
});
$('#open_pc').click(function () {
layer.open({
title: "远程开机",
content: "确定开机?",
yes: function (index) {
$.post("/tools/openpc.do");
layer.close(index)
}
})
})
function onLogin(){
$.get('/login/sendCaptcha.do', function (data) {
let json = JSON.parse(data);
if (json.code === 1) {
@@ -79,38 +115,20 @@
}
})
function openLoginCode() {
layer.prompt({
title: '安全登录码'
}, function (value, index, elem) {
$.post('/login/login.do', {code: value}, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg, function () {
window.location.reload()
})
});
layer.close(index);
})
}
})
$('#logout').click(function () {
$.post('/login/logout.do', function (data) {
let json = JSON.parse(data);
layer.msg(json.msg)
window.location.href = "/"
}
function openLoginCode() {
layer.prompt({
title: '安全登录码'
}, function (value, index, elem) {
$.post('/login/login.do', {code: value,"login":true}, function (data) {
let json = JSON.parse(data);
layer.msg(json.msg, function () {
window.location.reload()
})
});
layer.close(index);
})
});
$('#open_pc').click(function () {
layer.open({
title: "远程开机",
content: "确定开机?",
yes: function (index) {
$.post("/tools/openpc.do");
layer.close(index)
}
})
})
}
$(document).ready(function () {
let mobile = layui.device().mobile;
if (mobile) {