feat:增加美食表单功能
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
<div v-if="foodInfo.recordSegment === 'timeline'" class="food-calendar">
|
||||
<food-timeline />
|
||||
</div>
|
||||
|
||||
<draggable-button v-show="foodInfo.recordSegment !== 'timeline'" @click="addClick"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -35,12 +37,17 @@
|
||||
import FoodRecipe from '@/components/Food/FoodRecipe.vue'
|
||||
import FoodDaily from '@/components/Food/FoodDaily.vue'
|
||||
import FoodTimeline from '@/components/Food/FoodTimeline.vue'
|
||||
import DraggableButton from '@/components/DraggableButton.vue'
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
import { onMounted, reactive } from 'vue'
|
||||
import { useFoodStore } from '@/store/food'
|
||||
import type { IFoodSegment } from '@/types/food'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useAppStore } from '@/store/app'
|
||||
|
||||
const foodStore = useFoodStore()
|
||||
const router = useRouter()
|
||||
const appStore = useAppStore()
|
||||
|
||||
const foodInfo = reactive({
|
||||
recordSegment: 'recipe' as IFoodSegment,
|
||||
@@ -67,6 +74,25 @@ onMounted(() => {
|
||||
const changeRecordSegmentEvent = () => {
|
||||
foodStore.refreshInfo()
|
||||
}
|
||||
|
||||
const addClick = () => {
|
||||
appStore.isShowMobileBack = true
|
||||
|
||||
switch (foodInfo.recordSegment) {
|
||||
case 'recipe':
|
||||
foodStore.foodRecipeApiType = 'ADD'
|
||||
foodStore.currentFoodRecipe = foodStore.getEmptyFoodRecipe()
|
||||
router.push('/record/recipeForm')
|
||||
break
|
||||
case 'daily':
|
||||
foodStore.foodRecordApiType = 'ADD'
|
||||
foodStore.currentFoodRecord = foodStore.getEmptyFoodRecord()
|
||||
router.push('/record/recordForm')
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user