diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 2ac92266832271ac0eae9f3580c558be233b9637..33c3affce2da3f72c73b2d4314cb880d54edbce5 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -51,7 +51,12 @@ export const useUserStore = defineStore('user', () => { if (profile) { const ossObj = await listByIds(profile) console.log('ossObj', ossObj) - if (ossObj.data) avatar.value = ossObj.data[0].url + //修改如果对应的oss文件删除则自动退出的问题 + if (ossObj.data && ossObj.data.length > 0 ) { + avatar.value = ossObj.data[0].url + } else { + avatar.value = defAva + } console.log(avatar.value) } else { avatar.value = defAva