This commit is contained in:
WangXiaoDong
2024-01-17 21:10:24 +08:00
parent 8d4614a6e1
commit d3608adec0
2 changed files with 39 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
NODE_ENV = 'development'
# VUE_APP_BASE_URL = 'https://develop.api.aida.com.hk'
VUE_APP_BASE_URL = 'https://develop.api.aida.com.hk'
# VUE_APP_BASE_URL = 'http://18.167.251.121:10086'
VUE_APP_BASE_URL = 'http://192.168.1.9:5567'
# VUE_APP_BASE_URL = 'http://192.168.1.9:5567'

View File

@@ -1,4 +1,4 @@
import { createApp } from 'vue'
import { createApp,nextTick } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
@@ -19,8 +19,6 @@ flexible()
import { getCookie, setCookie } from "@/tool/cookie";
// console.log(process.env)
let token = getCookie("token");
let routerName:any = router.currentRoute
let isLogin = routerName._value.name
console.log(window.location.search.substring(1));
// Https.axiosGet(Https.httpUrls.endpoint)
@@ -31,6 +29,23 @@ console.log(window.location.search.substring(1));
// .catch((res) => {
// });
nextTick().then(()=>{
console.log(router.currentRoute.value);
})
let routerName:any = ''
function getRouter (){
routerName = (router.currentRoute as any)._value.name
}
router.beforeEach((to, from, next) => {
console.log(`即将从 ${from.path} 跳转到 ${to.path}`);
// if(to.path)
console.log(to);
if(to.name != "setIdentification"){
isMurmur()
}
next();
});
async function isMurmur() {
let murmurStr: any = localStorage.getItem('murmurStr')
let id: any = localStorage.getItem('id')
@@ -45,28 +60,26 @@ async function isMurmur() {
// })
// .catch((res) => {
// });
if ((router.currentRoute as any)._rawValue.name != 'setIdentification') {
Https.axiosPost(Https.httpUrls.noLoginRequired, data)
.then((rv) => {
let isTest = rv.isTrial == 1 ? true : false
let isBeginner = rv.isBeginner == 1 ? true : false
setCookie("isMurmur", true);
setCookie("token", rv.token);
setCookie("isTest", isTest);
setCookie("isBeginner", isBeginner);
setCookie("isBeginnerNum", 0);//从第一步开始,机器人开始的话就是从第二部开始
setCookie("userInfo", JSON.stringify(rv));
sessionStorage.setItem('isTimeOne', JSON.stringify(false));//是否需要公告 提示 弹窗
let randomNum: any = Math.floor(Math.random() * 9000000000000000) + 1000000000000000;
sessionStorage.setItem('sessionId', randomNum);
// router.push("/home");
// localStorage.setItem('murmurStr',murmurStr)
})
.catch((res) => {
});
}
Https.axiosPost(Https.httpUrls.noLoginRequired, data)
.then((rv) => {
let isTest = rv.isTrial == 1 ? true : false
let isBeginner = rv.isBeginner == 1 ? true : false
setCookie("isMurmur", true);
setCookie("token", rv.token);
setCookie("isTest", isTest);
setCookie("isBeginner", isBeginner);
setCookie("isBeginnerNum", 0);//从第一步开始,机器人开始的话就是从第二部开始
setCookie("userInfo", JSON.stringify(rv));
sessionStorage.setItem('isTimeOne', JSON.stringify(false));//是否需要公告 提示 弹窗
let randomNum: any = Math.floor(Math.random() * 9000000000000000) + 1000000000000000;
sessionStorage.setItem('sessionId', randomNum);
// router.push("/home");
// localStorage.setItem('murmurStr',murmurStr)
})
.catch((res) => {
});
}
isMurmur()
let loadingParam = {
loading: require('./assets/images/homePage/loading.gif'),