响应拦截bug处理

master
Lee-1203 2022-03-25 09:12:33 +08:00
parent 9039cff63b
commit a5c39ea1f6
3 changed files with 20 additions and 11 deletions

View File

@ -26,17 +26,22 @@ axios.interceptors.request.use(config => {
return config return config
}) })
// 添加响应拦截器 //返回状态判断(添加响应拦截器)
axios.interceptors.response.use(response => { axios.interceptors.response.use(res =>{
// console.log(response); console.log(res,'响应数据')
let res = {} //对响应数据做些事
res.status = response.status if(res.data.code == 0){
res.data = response.data if (res.config.headers.Authorization) {
return res; localStorage.token = JSON.stringify(res.config.headers.Authorization);
}, function(err) { }
return Promise.reject(err) }else if(res.data.code == 6002 || res.data.code == 6001){
router.push({
path:'/login',
})
} }
); return res
})
Vue.use(VueAxios, axios) Vue.use(VueAxios, axios)

View File

@ -111,6 +111,10 @@
created() { created() {
this.isScroll = true; this.isScroll = true;
window.addEventListener("scroll", this.eventScrollTop); window.addEventListener("scroll", this.eventScrollTop);
if(JSON.parse(localStorage.getItem("ddEntrance")) == 'yes'){
// postMessage
dd.postMessage({name:"clearAll"});
}
}, },
mounted(){ mounted(){
this.defaultPhoneHeight = window.innerHeight this.defaultPhoneHeight = window.innerHeight

View File

@ -143,7 +143,7 @@
}, },
handleInput() { handleInput() {
this.$refs.input.value = this.value; this.$refs.input.value = this.value;
if (this.value.length >= this.number) { if (this.value.length == this.number) {
this.hideKeyboard(); this.hideKeyboard();
} }
this.handleSubmit(); this.handleSubmit();