|
|
@ -13,20 +13,32 @@ export default { |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
mounted () { |
|
|
|
|
|
|
|
const token = sessionStorage.getItem('token') |
|
|
|
const cache = localStorage.getItem('reviewPath') // 理论考试平台每次跳转都会往localStorage存路径 |
|
|
|
const cache = localStorage.getItem('reviewPath') // 理论考试平台每次跳转都会往localStorage存路径 |
|
|
|
let url = `${location.origin}/reviewCenter/` |
|
|
|
let url = `${location.origin}/reviewCenter/` |
|
|
|
if (Setting.isDev) url = `http://192.168.31.125:8099/` |
|
|
|
if (Setting.isDev) url = `http://192.168.31.125:8099/` |
|
|
|
if (cache) { |
|
|
|
if (cache) { |
|
|
|
url += `#${cache}${cache.includes('?') ? `&` : '?'}token=${sessionStorage.getItem('token')}&nakadai=1` |
|
|
|
url += '#' + this.replaceParam(cache, Date.now()) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
url += `#/myReview?token=${sessionStorage.getItem('token')}&nakadai=1` |
|
|
|
url += `#/myReview?nakadai=1${Setting.isDev ? `&token=${token}` : ''}&v=${Date.now()}` |
|
|
|
} |
|
|
|
} |
|
|
|
url += `&v=${Date.now()}` |
|
|
|
console.log("🚀 ~ mounted ~ url:", url) |
|
|
|
localStorage.setItem('review_token', sessionStorage.getItem('token')) |
|
|
|
localStorage.setItem('review_token', token) |
|
|
|
this.url = url |
|
|
|
this.url = url |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
replaceParam (url, newVValue) { |
|
|
|
|
|
|
|
const vParamRegex = /v=[^&]+/g |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let newUrl = url.replace(vParamRegex, `v=${newVValue}`) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [baseUrl, hash] = newUrl.split('#'); |
|
|
|
|
|
|
|
if (hash) { |
|
|
|
|
|
|
|
newUrl = `${baseUrl}#${hash.replace(vParamRegex, `v=${newVValue}`)}` |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return newUrl |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
</script> |
|
|
|
</script> |
|
|
|