From 186234cb3833e620aa0ae46212fe337eb2d6e77d Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期四, 13 三月 2025 13:07:02 +0800
Subject: [PATCH] feat: 接口对接

---
 apps/cMiniApp/src/pages/home/index.vue |  177 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 146 insertions(+), 31 deletions(-)

diff --git a/apps/cMiniApp/src/pages/home/index.vue b/apps/cMiniApp/src/pages/home/index.vue
index 18dcab0..de26f12 100644
--- a/apps/cMiniApp/src/pages/home/index.vue
+++ b/apps/cMiniApp/src/pages/home/index.vue
@@ -1,61 +1,176 @@
 <template>
-  <PageLayoutWithBg
-    class="index-page-wrapper"
-    :title="MatchMakingIdentityEnumTitle[matchMakingIdentity]"
-    :need-auth="false"
-  >
+  <PageLayoutWithBg class="index-page-wrapper" :title="''" :need-auth="false">
     <template #left>
-      <div class="menu-btn-wrapper city-btn" @click="goCitySelect">
-        <div class="city-btn-text">{{ locationCity }}</div>
-        <RectDown :size="12" />
+      <div class="menu-btn-wrapper menu-logo">
+        <img :src="IconLogo" class="logo" />
       </div>
     </template>
-    <FrontOrderList v-if="matchMakingIdentity === MatchMakingIdentityEnum.Contributors" />
-    <FrontResourceList v-else-if="matchMakingIdentity === MatchMakingIdentityEnum.Employing" />
+    <div class="home-header">
+      <div class="home-searchbar-wrapper">
+        <div class="searchbar-container">
+          <BlSearchbar
+            v-model.trim="searchValue"
+            placeholder="鎼滅储浠诲姟"
+            @search="handleSearch"
+            @change="handleSearch"
+          ></BlSearchbar>
+        </div>
+        <div class="city-btn" @click="goCitySelect">
+          <img :src="IconLocaltion" class="city-btn-icon" />
+          <div class="city-btn-text">{{ locationCity }}</div>
+        </div>
+      </div>
+      <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>
+    <ProTabs
+      v-model="queryState.orderType"
+      name="home-tab"
+      :showPaneContent="false"
+      :showSmile="false"
+      class="home-tabs"
+      isTransparent
+      title-gutter="8"
+      title-scroll
+    >
+      <ProTabPane :title="`鎺ㄨ崘`" :pane-key="HomeOrderType.Recommend"></ProTabPane>
+      <ProTabPane :title="`鏈�鏂癭" :pane-key="HomeOrderType.LastShelfTime"></ProTabPane>
+      <template #right>
+        <Menu>
+          <MenuItem title="绛涢��" ref="selectItem">
+            <HomeQueryMenuView
+              v-model:query="queryMenuState"
+              @close="handleMenuSelectClose"
+            ></HomeQueryMenuView>
+          </MenuItem>
+        </Menu>
+      </template>
+    </ProTabs>
+    <InfiniteLoading
+      scrollViewClassName="common-infinite-scroll-list home-list"
+      v-bind="infiniteLoadingProps"
+      :key="queryState.orderType"
+    >
+      <template #renderItem="{ item }">
+        <TaskCard @click="goTaskDetail(item)" />
+      </template>
+    </InfiniteLoading>
   </PageLayoutWithBg>
 </template>
 
 <script setup lang="ts">
-import FrontOrderList from './FrontOrderList.vue';
-import FrontResourceList from './FrontResourceList.vue';
-import { useUser } from '@/hooks';
-import { MatchMakingIdentityEnum, MatchMakingIdentityEnumTitle } from '@12333/constants';
+import { useUser, useTaskList, HomeOrderType } from '@/hooks';
 import { useUserStore } from '@/stores/modules/user';
-import { RectDown } from '@nutui/icons-vue-taro';
+import { RectDown, Location2 } from '@nutui/icons-vue-taro';
 import Taro from '@tarojs/taro';
-import { LocationUtils } 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';
 
-const { matchMakingIdentity, isSetMatchMakingIdentity, locationCity } = useUser();
+const { locationCity } = useUser();
 
 const userStore = useUserStore();
+
+const { searchValue, queryState, handleSearch, infiniteLoadingProps, queryMenuState } = useTaskList(
+  { cityName: locationCity }
+);
+
+onMounted(async () => {
+  try {
+    await setLocationCity();
+  } catch (error) {}
+});
 
 function goCitySelect() {
   Taro.navigateTo({
     url: RouterPath.citySelect,
   });
 }
-// onMounted(async () => {
-//   if (!isSetMatchMakingIdentity.value) {
-//     Taro.navigateTo({
-//       url: RouterPath.toggleMatchMakingIdentity,
-//     });
-//   }
-// });
+
+const list = ref([
+  'https://storage.360buyimg.com/jdc-article/NutUItaro34.jpg',
+  'https://storage.360buyimg.com/jdc-article/NutUItaro2.jpg',
+  'https://storage.360buyimg.com/jdc-article/welcomenutui.jpg',
+  'https://storage.360buyimg.com/jdc-article/fristfabu.jpg',
+]);
+
+const selectItem = ref();
+
+function handleMenuSelectClose() {
+  selectItem.value?.toggle?.();
+}
+
+function goTaskDetail(item: API.GetFlexTaskListOutput) {
+  Taro.navigateTo({
+    url: `${RouterPath.taskDetail}?id=${item.taskId}`,
+  });
+}
 </script>
 
 <style lang="scss">
 @import '@/styles/common.scss';
 
 .index-page-wrapper {
-  .city-btn {
-    display: flex;
-    align-items: center;
+  .menu-logo {
+    padding: 0;
 
-    .city-btn-text {
-      max-width: 200px;
-      @include ellipsis;
-      margin-right: 12px;
+    .logo {
+      width: 96px;
+      height: 64px;
     }
   }
+
+  .home-searchbar-wrapper {
+    padding: 32px 0;
+    display: flex;
+
+    .searchbar-container {
+      flex: 1;
+      min-width: 0;
+    }
+
+    .city-btn {
+      display: flex;
+      align-items: center;
+      padding-left: 36px;
+      color: boleGetCssVar('text-color', 'primary');
+
+      .city-btn-icon {
+        width: 40px;
+        height: 40px;
+      }
+
+      .city-btn-text {
+        max-width: 200px;
+        @include ellipsis;
+        margin-left: 12px;
+        font-size: 30px;
+      }
+    }
+  }
+
+  .home-banner-wrapper {
+    .banner-img {
+      width: 100%;
+      height: 260px;
+      object-fit: cover;
+    }
+  }
+
+  .home-header {
+    padding: 0 boleGetCssVar('size', 'body-padding-h');
+  }
+}
+
+.home-list {
+  @include infiniteLoadingInTabBarPage;
 }
 </style>

--
Gitblit v1.9.1