添加401清除使用的数据
This commit is contained in:
@@ -11,7 +11,7 @@ export const useGenerateStore = defineStore({
|
|||||||
model: {
|
model: {
|
||||||
id: '',
|
id: '',
|
||||||
},
|
},
|
||||||
originalTryOn:{//生成穿好衣服的回参
|
originalTryOn: {//生成穿好衣服的回参
|
||||||
id: '',
|
id: '',
|
||||||
isLike: false,//是否喜欢
|
isLike: false,//是否喜欢
|
||||||
tryOnUrl:'',
|
tryOnUrl:'',
|
||||||
@@ -74,6 +74,21 @@ export const useGenerateStore = defineStore({
|
|||||||
setIsGenerate(isGenerate: boolean) {
|
setIsGenerate(isGenerate: boolean) {
|
||||||
this.isGenerate = isGenerate
|
this.isGenerate = isGenerate
|
||||||
},
|
},
|
||||||
|
clearProductData(){
|
||||||
|
this.style = {
|
||||||
|
id: '',
|
||||||
|
oldId: '',
|
||||||
|
}
|
||||||
|
this.model = {
|
||||||
|
id: '',
|
||||||
|
}
|
||||||
|
this.originalTryOn = {
|
||||||
|
id: '',
|
||||||
|
isLike: false,
|
||||||
|
tryOnUrl:'',
|
||||||
|
}
|
||||||
|
this.isGenerate = false
|
||||||
|
},
|
||||||
/** 更新顾客照片信息 */
|
/** 更新顾客照片信息 */
|
||||||
updatePhotoInfo(data: any) {
|
updatePhotoInfo(data: any) {
|
||||||
this.photoInfo.id = data.id || ""
|
this.photoInfo.id = data.id || ""
|
||||||
@@ -89,5 +104,11 @@ export const useGenerateStore = defineStore({
|
|||||||
this.customizeInfo.isRegenerated = ""
|
this.customizeInfo.isRegenerated = ""
|
||||||
this.customizeInfo.isFavorite = false
|
this.customizeInfo.isFavorite = false
|
||||||
},
|
},
|
||||||
|
//设置默认数据
|
||||||
|
clearGenerateData() {
|
||||||
|
this.clearProductData()
|
||||||
|
this.updatePhotoInfo()
|
||||||
|
this.clearCustomizeInfo()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -4,7 +4,7 @@ import { useUserInfoStore } from '@/stores/modules/userInfo'
|
|||||||
const store = useUserInfoStore()
|
const store = useUserInfoStore()
|
||||||
import { getLocal } from '@/utils/local'
|
import { getLocal } from '@/utils/local'
|
||||||
import router from '@/router/index'
|
import router from '@/router/index'
|
||||||
import { useOverallStore } from '@/stores'
|
import { useOverallStore, useGenerateStore } from '@/stores'
|
||||||
|
|
||||||
|
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
@@ -98,8 +98,13 @@ service.interceptors.response.use(
|
|||||||
// location.reload() // 为了重新实例化vue-router对象 避免bug
|
// location.reload() // 为了重新实例化vue-router对象 避免bug
|
||||||
// })
|
// })
|
||||||
// })
|
// })
|
||||||
router.replace('/login')
|
showToast({
|
||||||
return Promise.reject(error)
|
message: 'Please log in and try again.',
|
||||||
|
duration: 5000
|
||||||
|
})
|
||||||
|
router.push('/welcome')
|
||||||
|
useGenerateStore().clearGenerateData()
|
||||||
|
return Promise.reject(false)
|
||||||
}
|
}
|
||||||
error.config && removePending(error.config)
|
error.config && removePending(error.config)
|
||||||
// 关闭loading
|
// 关闭loading
|
||||||
|
|||||||
@@ -54,7 +54,11 @@ const startGenerate = ()=>{
|
|||||||
generateStore.setIsGenerate(false)
|
generateStore.setIsGenerate(false)
|
||||||
|
|
||||||
generateStore.clearCustomizeInfo()
|
generateStore.clearCustomizeInfo()
|
||||||
}).catch(()=>{
|
}).catch((error)=>{
|
||||||
|
console.log(error)
|
||||||
|
if(error === false){
|
||||||
|
return
|
||||||
|
}
|
||||||
data.isLoading = false;
|
data.isLoading = false;
|
||||||
if(generateStore.originalTryOn.id){
|
if(generateStore.originalTryOn.id){
|
||||||
router.back()
|
router.back()
|
||||||
|
|||||||
Reference in New Issue
Block a user