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