This commit is contained in:
parent
4b681144e1
commit
5fc0a20b7f
30
index.html
30
index.html
|
|
@ -150,8 +150,9 @@
|
||||||
console.log('当前登录的token:' + token);
|
console.log('当前登录的token:' + token);
|
||||||
if (token) {
|
if (token) {
|
||||||
console.log('走的跳转登录');
|
console.log('走的跳转登录');
|
||||||
|
sessionStorage.setItem('gz-token', token);
|
||||||
// 校验传过来的token是否合法
|
// 校验传过来的token是否合法
|
||||||
let url = dataUrl + 'health/isHealth'
|
let url = dataUrl + 'backstage/health/isHealth'
|
||||||
ajaxRequest(url, "GET", null, false, function () {
|
ajaxRequest(url, "GET", null, false, function () {
|
||||||
}, function (result) {
|
}, function (result) {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
|
|
@ -161,7 +162,7 @@
|
||||||
url = url.replace(/(\?|#)[^'"]*/, ''); //去除参数
|
url = url.replace(/(\?|#)[^'"]*/, ''); //去除参数
|
||||||
window.history.pushState({}, 0, url);
|
window.history.pushState({}, 0, url);
|
||||||
}
|
}
|
||||||
sessionStorage.setItem('gz-token', token);
|
initPage(miniAdmin);
|
||||||
} else if (result.code === 401) {
|
} else if (result.code === 401) {
|
||||||
closeWindowOpen();
|
closeWindowOpen();
|
||||||
}
|
}
|
||||||
|
|
@ -170,10 +171,10 @@
|
||||||
}, null);
|
}, null);
|
||||||
} else {
|
} else {
|
||||||
// console.log('走的自己登录');
|
// console.log('走的自己登录');
|
||||||
// login();
|
// login(miniAdmin);
|
||||||
window.location = 'page/401.html';
|
window.location = 'page/401.html';
|
||||||
}
|
}
|
||||||
var options = {
|
/* var options = {
|
||||||
iniUrl: "api/init.json", // 初始化接口
|
iniUrl: "api/init.json", // 初始化接口
|
||||||
clearUrl: "api/clear.json", // 缓存清理接口
|
clearUrl: "api/clear.json", // 缓存清理接口
|
||||||
urlHashLocation: true, // 是否打开hash定位
|
urlHashLocation: true, // 是否打开hash定位
|
||||||
|
|
@ -184,7 +185,7 @@
|
||||||
pageAnim: true, // iframe窗口动画
|
pageAnim: true, // iframe窗口动画
|
||||||
maxTabNum: 20, // 最大的tab打开数量
|
maxTabNum: 20, // 最大的tab打开数量
|
||||||
};
|
};
|
||||||
miniAdmin.render(options);
|
miniAdmin.render(options); */
|
||||||
|
|
||||||
// 百度统计代码,只统计指定域名
|
// 百度统计代码,只统计指定域名
|
||||||
miniTongji.render({
|
miniTongji.render({
|
||||||
|
|
@ -203,7 +204,23 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function login() {
|
// 初始化页面
|
||||||
|
function initPage(miniAdmin){
|
||||||
|
var options = {
|
||||||
|
iniUrl: "api/init.json", // 初始化接口
|
||||||
|
clearUrl: "api/clear.json", // 缓存清理接口
|
||||||
|
urlHashLocation: true, // 是否打开hash定位
|
||||||
|
bgColorDefault: false, // 主题默认配置
|
||||||
|
multiModule: true, // 是否开启多模块
|
||||||
|
menuChildOpen: false, // 是否默认展开菜单
|
||||||
|
loadingTime: 0, // 初始化加载时间
|
||||||
|
pageAnim: true, // iframe窗口动画
|
||||||
|
maxTabNum: 20, // 最大的tab打开数量
|
||||||
|
};
|
||||||
|
miniAdmin.render(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
function login(miniAdmin) {
|
||||||
// 登录获取token
|
// 登录获取token
|
||||||
let login_url = dataUrl + 'login/userLogin'
|
let login_url = dataUrl + 'login/userLogin'
|
||||||
const params = {
|
const params = {
|
||||||
|
|
@ -217,6 +234,7 @@
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
sessionStorage.setItem('gz-token', result.token);
|
sessionStorage.setItem('gz-token', result.token);
|
||||||
sessionStorage.setItem('us', JSON.stringify(result.user));
|
sessionStorage.setItem('us', JSON.stringify(result.user));
|
||||||
|
initPage(miniAdmin);
|
||||||
} else if (result.code === 500) {
|
} else if (result.code === 500) {
|
||||||
// layer.msg(result.msg, { icon: 2 });
|
// layer.msg(result.msg, { icon: 2 });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue