feat:更新图片存储路径
This commit is contained in:
@@ -29,6 +29,16 @@ export const useFoodStore = defineStore('food', {
|
||||
stepList: [],
|
||||
recordList: []
|
||||
} as IFoodRecipe,
|
||||
currentFoodMaterial: {
|
||||
name: '',
|
||||
type: '',
|
||||
amount: ''
|
||||
} as IFoodMaterial,
|
||||
currentFoodStep: {
|
||||
content: '',
|
||||
sort: 0,
|
||||
imageUrl: ''
|
||||
}as IFoodStep,
|
||||
foodRecordList: [] as IFoodRecord[],
|
||||
currentFoodRecord: {
|
||||
id: 0,
|
||||
@@ -49,24 +59,11 @@ export const useFoodStore = defineStore('food', {
|
||||
queryDateType: 'month' as IDateType,
|
||||
queryDateList: [] as string[],
|
||||
foodRecipeApiType: 'ADD' as IHandleApi,
|
||||
foodRecipeDialog: {
|
||||
visible: false,
|
||||
title: '',
|
||||
data: {}
|
||||
} as IDialog<IFoodRecipe>,
|
||||
foodMaterialApiType: 'ADD' as IHandleApi,
|
||||
foodMaterialDialog: {
|
||||
visible: false,
|
||||
title: '',
|
||||
data: {}
|
||||
} as IDialog<IFoodMaterial>,
|
||||
foodMaterialDialogVisible: false,
|
||||
editFoodMaterialIndex: 0,
|
||||
foodStepApiType: 'ADD' as IHandleApi,
|
||||
foodStepDialog: {
|
||||
visible: false,
|
||||
title: '',
|
||||
data: {}
|
||||
} as IDialog<IFoodStep>,
|
||||
foodStepDialogVisible: false,
|
||||
editFoodStepIndex: 0,
|
||||
foodRecordApiType: 'ADD' as IHandleApi,
|
||||
foodRecordDialog: {
|
||||
@@ -123,25 +120,23 @@ export const useFoodStore = defineStore('food', {
|
||||
async queryFoodCategory() {
|
||||
this.foodCategoryList = await queryFoodCategoryApi()
|
||||
},
|
||||
async handleFoodRecipeApi(id?: number) {
|
||||
const { data } = this.foodRecipeDialog
|
||||
async handleFoodRecipeApi(recipe: IFoodRecipe) {
|
||||
switch (this.foodRecipeApiType) {
|
||||
case 'ADD':
|
||||
await addFoodRecipeApi(data)
|
||||
await addFoodRecipeApi(recipe)
|
||||
ElMessage.success('新增菜谱成功')
|
||||
break
|
||||
case 'UPDATE':
|
||||
await updateFoodRecipeApi(data.id as number, data)
|
||||
await updateFoodRecipeApi(recipe.id as number, recipe)
|
||||
ElMessage.success('更新菜谱成功')
|
||||
break
|
||||
case 'DELETE':
|
||||
await deleteFoodRecipeApi(id as number)
|
||||
await deleteFoodRecipeApi(recipe.id as number)
|
||||
ElMessage.success('删除菜谱成功')
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
this.foodRecipeDialog.visible = false
|
||||
await this.refreshInfo()
|
||||
},
|
||||
async handleFoodRecordApi(foodRecord: IFoodRecord) {
|
||||
|
||||
Reference in New Issue
Block a user