解决提交后刷新数据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)
}
)
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')
export function get(url, params = {}) {
// params.t = new Date().getTime(); //get方法加一个时间参数,解决ie下可能缓存问题.

@ -64,7 +64,7 @@
<el-row>
<el-col :span="24">
<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 prop="name" label="判分标准" align="center">
</el-table-column>
@ -183,7 +183,7 @@ export default {
projectName:'',
loading:false,
sss:1,
popContainer:false
popContainer:false,
}
},
watch: {

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

Loading…
Cancel
Save