feat:更新个人中心UI

This commit is contained in:
2025-06-30 22:52:28 +08:00
parent 50991bb49a
commit be8e105a55
13 changed files with 302 additions and 200 deletions

View File

@@ -26,8 +26,8 @@ import {
addLikeApi,
addMomentApi,
deleteLikeApi,
deleteMomentApi,
queryMomentApi,
deleteMomentApi, queryMomentByIdApi,
queryMomentListApi,
updateMomentApi
} from '@/apis/moment'
@@ -105,7 +105,8 @@ export const useFoodStore = defineStore('food', {
recordStats: [] as IStatsChart[],
categoryStats: [] as IStatsChart[],
rankStats: [] as IStatsChart[],
isRefresh: false
isRefresh: false,
isLoading: false
}),
actions: {
async queryRecipeList() {
@@ -113,16 +114,24 @@ export const useFoodStore = defineStore('food', {
// const result = await queryFoodRecipeByPageApi(currentPage, pageSize, this.queryRecipe)
// this.foodRecipeList.push(...result.records)
// this.pageInfo.totalSize = result.total
this.isLoading = true
this.recipeList = await queryRecipeApi(this.queryRecipeSegment)
this.isRefresh = !this.isRefresh
this.isLoading = false
},
async queryRecordList() {
const { year, month } = this.queryRecord
const date = this.queryDateType === 'year' ? year : month
this.queryDateList = getStartEndDate(date, this.queryDateType)
this.isLoading = true
this.recordList = await queryRecordApi(this.queryDateList[0], this.queryDateList[1])
this.isRefresh = !this.isRefresh
this.isLoading = false
},
async queryMomentList() {
this.momentList = await queryMomentApi()
this.isLoading = true
this.momentList = await queryMomentListApi()
this.isLoading = false
},
async queryFoodNameList() {
this.foodNameList = await queryFoodNameListApi()
@@ -130,6 +139,11 @@ export const useFoodStore = defineStore('food', {
async queryRecipe(id: number) {
this.currentRecipe = await queryRecipeByIdApi(id)
},
async queryMoment(id: number) {
this.isLoading = true
this.momentList = await queryMomentByIdApi(id)
this.isLoading = false
},
async queryStats() {
this.stats = await queryStatsApi()
this.recordStats = await queryRecordStatsApi()
@@ -157,7 +171,7 @@ export const useFoodStore = defineStore('food', {
default:
break
}
await this.refreshInfo()
await this.queryRecipeList()
},
async handleRecordApi(record: IRecord) {
switch (this.recordApiType) {
@@ -176,7 +190,7 @@ export const useFoodStore = defineStore('food', {
default:
break
}
await this.refreshInfo()
await this.queryRecordList()
},
async handleMomentApi(moment: IMoment) {
switch (this.momentApiType) {
@@ -195,7 +209,7 @@ export const useFoodStore = defineStore('food', {
default:
break
}
await queryMomentApi()
await this.queryMomentList()
},
async addComment(id: number, content: string) {
await addCommentApi(id, content)
@@ -209,11 +223,6 @@ export const useFoodStore = defineStore('food', {
await deleteLikeApi(id)
await this.queryMomentList()
},
async refreshInfo() {
await this.queryRecipeList()
await this.queryRecordList()
this.isRefresh = !this.isRefresh
},
getEmptyRecipe(): IRecipe {
return {
category: '',