From 10089fbb4958ff4780c33bf2e51ec6f04024e2b6 Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期一, 11 八月 2025 15:55:23 +0800 Subject: [PATCH] feat: 接口对接 --- apps/cMiniApp/src/pages/home/index.vue | 34 +++++++++++++++++++++++++--------- 1 files changed, 25 insertions(+), 9 deletions(-) diff --git a/apps/cMiniApp/src/pages/home/index.vue b/apps/cMiniApp/src/pages/home/index.vue index 8ec5e32..fb3d2cb 100644 --- a/apps/cMiniApp/src/pages/home/index.vue +++ b/apps/cMiniApp/src/pages/home/index.vue @@ -20,13 +20,13 @@ <div class="city-btn-text">{{ locationCity }}</div> </div> </div> - <div class="home-banner-wrapper"> + <!-- <div class="home-banner-wrapper"> <nut-swiper :auto-play="3000"> <nut-swiper-item v-for="(item, index) in list" :key="index"> <img :src="item" class="banner-img" draggable="false" /> </nut-swiper-item> </nut-swiper> - </div> + </div> --> </div> <ProTabs v-model="queryState.orderType" @@ -57,30 +57,42 @@ :key="queryState.orderType" > <template #renderItem="{ item }"> - <TaskCard @click="goTaskDetail(item)" /> + <TaskCard @click="goTaskDetail(item)" v-bind="item" @apply="goTaskApply(item)" /> </template> </InfiniteLoading> </PageLayoutWithBg> </template> <script setup lang="ts"> -import { useUser, useTaskList, HomeOrderType } from '@/hooks'; +import { useUser } 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 { setLocationCity } from '@/utils'; import _ from 'lodash'; import IconLogo from '@/assets/home/icon-logo.png'; import { TaskCard, ProTabs, ProTabPane } from '@12333/components'; import HomeQueryMenuView from './HomeQueryMenuView.vue'; import IconLocaltion from '@/assets/task/icon-localtion.png'; +import { useAllAreaList, useTaskList, HomeOrderType } from '@12333/hooks'; +import { useAccessLogin } from '@/hooks'; const { locationCity } = useUser(); -const userStore = useUserStore(); +const { findAreaCodeFromName } = useAllAreaList(); -const { searchValue, queryState, handleSearch, infiniteLoadingProps, queryMenuState } = - useTaskList(); +const { searchValue, queryState, handleSearch, infiniteLoadingProps, queryMenuState } = useTaskList( + { + cityCode: computed(() => findAreaCodeFromName(locationCity.value)), + enabled: computed(() => !!findAreaCodeFromName(locationCity.value)), + } +); + +onMounted(async () => { + try { + await setLocationCity(); + } catch (error) {} +}); function goCitySelect() { Taro.navigateTo({ @@ -101,11 +113,15 @@ selectItem.value?.toggle?.(); } -function goTaskDetail(item: API.FrontOrderList) { +function goTaskDetail(item: API.GetTaskInfosQueryResultItem) { Taro.navigateTo({ url: `${RouterPath.taskDetail}?id=${item.id}`, }); } + +const goTaskApply = useAccessLogin((item: API.GetTaskInfosQueryResultItem) => { + console.log('item: ', item); +}); </script> <style lang="scss"> -- Gitblit v1.9.1