token问题修复5
This commit is contained in:
@ -15,8 +15,9 @@ service.interceptors.request.use(
|
|||||||
config.data = config.contentType ? config.data : qs.stringify(config.data)
|
config.data = config.contentType ? config.data : qs.stringify(config.data)
|
||||||
config.headers['Content-Type'] = config.contentType || 'application/x-www-form-urlencoded'
|
config.headers['Content-Type'] = config.contentType || 'application/x-www-form-urlencoded'
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const token = urlParams.get('token');
|
const tokenParams=this.$route.params?.token
|
||||||
this.$toast("token" + token)
|
const token = urlParams.get('token') || tokenParams;
|
||||||
|
// this.$toast("token" + token)
|
||||||
// let token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzemwiLCJhdWQiOlsic3VwcGxpZXItYXBwIl0sIm5iZiI6MTY5MjY4MDk1MywidXNlcl9pbmZvIjp7InVzZXJJZCI6NTQ1ODUsInBob25lIjoiMTc2MzAwMzU2NTgiLCJuYW1lIjoi5bCP5a6LIiwic3VwcGxpZXJOYW1lIjoi5LiK5rW35a6J55WFQSIsInN1cHBsaWVySWQiOjExMjgsInN1cHBsaWVyVHlwZSI6MSwidXNlcm5hbWUiOiJzemwiLCJ1c2VyVHlwZSI6IkFQUCIsImF1dGhvcml0aWVzIjpbXX0sInNjb3BlIjpbImFsbCJdLCJpc3MiOiJodHRwczovL3Npbm9hc3Npc3QuY29tIiwiZXhwIjoxNjkyNzY3MzUzLCJpYXQiOjE2OTI2ODA5NTN9.GClSyBkWX_LedBuO2h6xoBHyL3xsgFeGp_zirimAuTk'
|
// let token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJzemwiLCJhdWQiOlsic3VwcGxpZXItYXBwIl0sIm5iZiI6MTY5MjY4MDk1MywidXNlcl9pbmZvIjp7InVzZXJJZCI6NTQ1ODUsInBob25lIjoiMTc2MzAwMzU2NTgiLCJuYW1lIjoi5bCP5a6LIiwic3VwcGxpZXJOYW1lIjoi5LiK5rW35a6J55WFQSIsInN1cHBsaWVySWQiOjExMjgsInN1cHBsaWVyVHlwZSI6MSwidXNlcm5hbWUiOiJzemwiLCJ1c2VyVHlwZSI6IkFQUCIsImF1dGhvcml0aWVzIjpbXX0sInNjb3BlIjpbImFsbCJdLCJpc3MiOiJodHRwczovL3Npbm9hc3Npc3QuY29tIiwiZXhwIjoxNjkyNzY3MzUzLCJpYXQiOjE2OTI2ODA5NTN9.GClSyBkWX_LedBuO2h6xoBHyL3xsgFeGp_zirimAuTk'
|
||||||
config.headers['Authorization'] = `${token}`;
|
config.headers['Authorization'] = `${token}`;
|
||||||
return config
|
return config
|
||||||
|
@ -54,9 +54,12 @@ export default {
|
|||||||
total:'',
|
total:'',
|
||||||
loading:false,
|
loading:false,
|
||||||
items: [], // 当前页数
|
items: [], // 当前页数
|
||||||
|
token:'',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
this.token = urlParams.get('token')
|
||||||
this.$toast('window.location'+window.location)
|
this.$toast('window.location'+window.location)
|
||||||
this.getVehicleList();
|
this.getVehicleList();
|
||||||
},
|
},
|
||||||
@ -65,6 +68,7 @@ export default {
|
|||||||
this.$router.push({
|
this.$router.push({
|
||||||
name:'vehicleAdd',
|
name:'vehicleAdd',
|
||||||
params:{
|
params:{
|
||||||
|
token:this.token,
|
||||||
id:item.vehicleId
|
id:item.vehicleId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user