From 054848933efdd0a8a836b593c98a84c621166915 Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期四, 13 二月 2025 15:41:19 +0800 Subject: [PATCH] feat: mine --- apps/cMiniApp/src/pages/home/index.vue | 56 +++++++++++++++----------------------------------------- 1 files changed, 15 insertions(+), 41 deletions(-) diff --git a/apps/cMiniApp/src/pages/home/index.vue b/apps/cMiniApp/src/pages/home/index.vue index d6483eb..a627853 100644 --- a/apps/cMiniApp/src/pages/home/index.vue +++ b/apps/cMiniApp/src/pages/home/index.vue @@ -16,7 +16,7 @@ ></BlSearchbar> </div> <div class="city-btn" @click="goCitySelect"> - <Location2 :size="16" /> + <img :src="IconLocaltion" class="city-btn-icon" /> <div class="city-btn-text">{{ locationCity }}</div> </div> </div> @@ -46,6 +46,7 @@ <HomeQueryMenuView v-model:gender="queryState.gender" @close="handleMenuSelectClose" + @reset="handleMenuSelectReset" ></HomeQueryMenuView> </MenuItem> </Menu> @@ -64,35 +65,23 @@ </template> <script setup lang="ts"> -import { useUser } from '@/hooks'; +import { useUser, useTaskList, HomeOrderType } from '@/hooks'; import { useUserStore } from '@/stores/modules/user'; import { RectDown, Location2 } from '@nutui/icons-vue-taro'; import Taro from '@tarojs/taro'; import { LocationUtils, trim } from '@12333/utils'; import _ from 'lodash'; import IconLogo from '@/assets/home/icon-logo.png'; -import { useInfiniteLoading } from '@12333/hooks'; -import { OrderInputType, Gender } from '@12333/constants'; -import * as orderServices from '@12333/services/api/Order'; import { TaskCard, ProTabs, ProTabPane } from '@12333/components'; -import { HomeOrderType } from './constants'; import HomeQueryMenuView from './HomeQueryMenuView.vue'; +import IconLocaltion from '@/assets/task/icon-localtion.png'; const { locationCity } = useUser(); -const searchValue = ref(''); - -const queryState = reactive({ - searchValueTrim: '', - orderType: HomeOrderType.Recommend, - gender: '' as any as Gender, -}); - -const handleSearch = _.debounce(function () { - queryState.searchValueTrim = trim(searchValue.value); -}, 300); - const userStore = useUserStore(); + +const { searchValue, queryState, handleSearch, infiniteLoadingProps, DefaultQueryState } = + useTaskList(); function goCitySelect() { Taro.navigateTo({ @@ -107,33 +96,13 @@ 'https://storage.360buyimg.com/jdc-article/fristfabu.jpg', ]); -const { infiniteLoadingProps } = useInfiniteLoading( - ({ pageParam }) => { - let params: API.FrontOrderListInput = { - pageModel: { - rows: 20, - page: pageParam, - orderInput: [ - queryState.orderType === HomeOrderType.Recommend - ? { property: 'isRecommend', order: OrderInputType.Desc } - : { property: 'lastShelfTime', order: OrderInputType.Desc }, - ], - }, - }; - - return orderServices.getFrontOrderList(params, { - showLoading: false, - }); - }, - { - queryKey: ['orderServices/getFrontOrderList', queryState], - } -); - const selectItem = ref(); function handleMenuSelectClose() { selectItem.value?.toggle?.(); +} +function handleMenuSelectReset() { + Object.assign(queryState, { ...DefaultQueryState }); } function goTaskDetail(item: API.FrontOrderList) { @@ -171,6 +140,11 @@ padding-left: 36px; color: boleGetCssVar('text-color', 'primary'); + .city-btn-icon { + width: 40px; + height: 40px; + } + .city-btn-text { max-width: 200px; @include ellipsis; -- Gitblit v1.9.1