shenzhen-dev #2
@ -37,23 +37,27 @@ const router = createRouter({
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
const globalStore = GlobalStore();
|
||||
// 解决首次跳转失败
|
||||
// let freeToken = window.location.href.indexOf("token") != -1;
|
||||
// let freeSn = window.location.href.indexOf("sn") != -1;
|
||||
// if (freeToken) {
|
||||
// globalStore.token = window.location.href.split("token=")[1];
|
||||
// }
|
||||
let urlParams = new URLSearchParams(window.location.href.split('?')[1]);
|
||||
let params = {} as any;
|
||||
urlParams.forEach((value, key) => {
|
||||
params[key] = value;
|
||||
});
|
||||
console.log(params,'我的测试11111')
|
||||
if(params.token){
|
||||
globalStore.token = params.token;
|
||||
}
|
||||
if(params.sn){
|
||||
globalStore.setSN(params.sn);
|
||||
let freeToken = window.location.href.indexOf("token") != -1;
|
||||
let freeSn = window.location.href.indexOf("sn") != -1;
|
||||
if (freeToken) {
|
||||
globalStore.token = window.location.href.split("token=")[1].split("&")[0];
|
||||
}
|
||||
if (freeSn) {
|
||||
globalStore.setSN(window.location.href.split("sn=")[1]);
|
||||
}
|
||||
// let urlParams = new URLSearchParams(window.location.href.split('?')[1]);
|
||||
// let params = {} as any;
|
||||
// urlParams.forEach((value, key) => {
|
||||
// params[key] = value;
|
||||
// });
|
||||
// console.log(window.location.href.split("token=")[1].split("&")[0],'我的测试11111')
|
||||
// console.log(window.location.href.split("sn=")[1],'我的测试11111')
|
||||
// if(params.token){
|
||||
// globalStore.token = params.token;
|
||||
// }
|
||||
// if(params.sn){
|
||||
// globalStore.setSN(params.sn);
|
||||
// }
|
||||
// console.log("免登录", freeToken, globalStore.token);
|
||||
// 1.NProgress 开始
|
||||
NProgress.start();
|
||||
|
||||
@ -454,7 +454,7 @@ onMounted(async () => {
|
||||
|
||||
if (window.location.href.indexOf("token") != -1) {
|
||||
console.log("免登录跳转进来了吗----", window.location.href.indexOf("token"));
|
||||
const newToken = window.location.href.split("token=")[1];
|
||||
const newToken = window.location.href.split("token=")[1].split("&")[0];
|
||||
const data: any = await jumpLargeUserInfoApi({ token: newToken });
|
||||
console.log("跳转请求的数据----", data.result);
|
||||
if(data.result.sn){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user