fix: 清理死代码 + 修复群组模式预算支出计算
- 清理 store 中未使用的 loading 状态(stats/budget/category/user) - 清理 stats store 冗余类型重导出和 catch 重置逻辑 - 清理 transaction store 未使用的 currentPage - 清理 api/group 未使用的 GroupDetail/GroupMember/getGroupDetail - 删除无引用的 api/index.ts barrel 导出文件 - 删除后端未调用的 GET /groups/:id 群组详情路由 - 合并 stats 页面重复的 loadTabData 函数 - 修复预算页群组模式下只算个人支出(不传 group_id)
This commit is contained in:
@@ -5,7 +5,6 @@ import { API_BASE } from '@/config'
|
||||
|
||||
export const useUserStore = defineStore('user', () => {
|
||||
const userInfo = ref<api.UserInfo | null>(null)
|
||||
const loading = ref(false)
|
||||
|
||||
const nickname = computed(() => {
|
||||
return userInfo.value?.nickname || uni.getStorageSync('xc:nickname') || '小菜'
|
||||
@@ -21,18 +20,10 @@ export const useUserStore = defineStore('user', () => {
|
||||
})
|
||||
|
||||
async function fetchUserInfo() {
|
||||
loading.value = true
|
||||
try {
|
||||
userInfo.value = await api.getUserInfo()
|
||||
if (userInfo.value) {
|
||||
uni.setStorageSync('xc:nickname', userInfo.value.nickname)
|
||||
uni.setStorageSync('xc:avatar_url', userInfo.value.avatar_url)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[UserStore] fetchUserInfo error:', e)
|
||||
throw e
|
||||
} finally {
|
||||
loading.value = false
|
||||
userInfo.value = await api.getUserInfo()
|
||||
if (userInfo.value) {
|
||||
uni.setStorageSync('xc:nickname', userInfo.value.nickname)
|
||||
uni.setStorageSync('xc:avatar_url', userInfo.value.avatar_url)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,5 +40,5 @@ export const useUserStore = defineStore('user', () => {
|
||||
return avatarUrl.value
|
||||
}
|
||||
|
||||
return { userInfo, loading, nickname, avatarUrl, fetchUserInfo, updateProfile, uploadAvatar }
|
||||
return { userInfo, nickname, avatarUrl, fetchUserInfo, updateProfile, uploadAvatar }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user