解决提交后刷新数据bug

解决进入页面获取不到token问题
20240205
e 3 years ago
parent 7d94f5ea97
commit 326bed7eeb
  1. 18
      src/api/api.js
  2. 4
      src/components/case/index.vue
  3. 2
      src/pages/index/list/index.vue

@ -32,7 +32,23 @@ service.interceptors.response.use(
return Promise.reject(error.response) return Promise.reject(error.response)
} }
) )
let token = sessionStorage.getItem('token') let tokens
let token
var reg = new RegExp('(^|&)'+'token'+'=([^&]*)(&|$)')
if(window.location.href.split('?')[1]){
var r = window.location.href.split('?')[1].match(reg)
if (r != null){
tokens = (r[2])
}else{
tokens = null
}
}
if(tokens){
token = tokens
}else{
token = sessionStorage.getItem('token')
}
console.log(token)
// let token = sessionStorage.getItem('token') // let token = sessionStorage.getItem('token')
export function get(url, params = {}) { export function get(url, params = {}) {
// params.t = new Date().getTime(); //get方法加一个时间参数,解决ie下可能缓存问题. // params.t = new Date().getTime(); //get方法加一个时间参数,解决ie下可能缓存问题.

@ -64,7 +64,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-card shadow="hover"> <el-card shadow="hover">
<el-table :data="requires" stripe height="405" v-loading="loading"> <el-table :data="requires" stripe height="405" v-loading="loading" :key="Math.random()">
<el-table-column type="index"></el-table-column> <el-table-column type="index"></el-table-column>
<el-table-column prop="name" label="判分标准" align="center"> <el-table-column prop="name" label="判分标准" align="center">
</el-table-column> </el-table-column>
@ -183,7 +183,7 @@ export default {
projectName:'', projectName:'',
loading:false, loading:false,
sss:1, sss:1,
popContainer:false popContainer:false,
} }
}, },
watch: { watch: {

@ -32,7 +32,7 @@ export default {
return { return {
caseVisible: true, caseVisible: true,
comingVisible: false, comingVisible: false,
timer: null timer: null,
} }
}, },

Loading…
Cancel
Save