zqf 5 місяців тому
батько
коміт
93e7390c44

+ 4 - 2
src/api/common.js

@@ -11,10 +11,12 @@ export const getBannerList = (data) => {
 };
 
 export const getTravelProjectList = (data) => {
+  const query = `?${Object.keys(data)
+    .map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(data[key])}`)
+    .join('&')}`;
   return request({
-    url: '/website/tourism/project/list',
+    url: `/website/tourism/project/list${query}`,
     method: 'GET',
-    data,
   });
 };
 

+ 9 - 0
src/components/Empty/index.vue

@@ -0,0 +1,9 @@
+<template>
+  <div class="w-full flex items-center justify-center min-h-200">
+    <div class="text-[#BFC8DB]">暂无数据</div>
+  </div>
+</template>
+
+<script setup></script>
+
+<style lang="scss" scoped></style>

+ 64 - 0
src/components/Travel/ProjectItem/index.vue

@@ -0,0 +1,64 @@
+<template>
+  <div class="flex py-10 border-b space-x-10" @click="navigateToDetail">
+    <image
+      :src="itemData.homeHotPicturesAfterConvert[0]"
+      mode="widthFix"
+      class="w-108 h-114 shrink rounded-lg overflow-hidden"
+    />
+    <div class="flex-1 flex flex-col">
+      <div class="min-h-85">
+        <div class="text-base text-black-3 line-clamp-2 font-semibold">
+          {{ itemData.projectTitle }}
+        </div>
+        <div class="flex flex-wrap gap-8 mt-5">
+          <div
+            v-for="item in lableList"
+            :key="item"
+            class="flex h-18 items-center justify-center rounded-sm border border-[#FD9A00] px-5 text-sm text-[#FD9A00]"
+          >
+            {{ item }}
+          </div>
+        </div>
+        <div class="mt-5 flex items-center space-x-10 text-sm text-[#666666B2]">
+          <span>{{ itemData.startPlace }}出发</span>
+          <div class="h-10 w-1 bg-[#f3f3f3]"></div>
+          <span>{{ itemData.countTimes }}天</span>
+        </div>
+      </div>
+      <!-- <div class="flex items-center justify-between">
+        <div class="text-[#ff0000] text-base" v-if="itemData.price">
+          <span>¥</span>
+          <span class="text-5xl font-semibold">{{ itemData.price }}</span>
+          <span>起</span>
+        </div>
+        <div
+          class="flex items-center justify-center h-20 w-60 text-white text-sm bg-primary rounded-full"
+        >
+          立即预定
+        </div>
+      </div> -->
+    </div>
+  </div>
+</template>
+
+<script setup>
+const props = defineProps({
+  itemData: {
+    type: Object,
+    default: () => {},
+  },
+});
+
+const lableList = computed(() => {
+  return props.itemData.projectLabel?.split("&") ?? [];
+});
+
+// 导航到详情页
+const navigateToDetail = () => {
+  uni.navigateTo({
+    url: `/pages/travel/detail?id=${props.itemData.id}`
+  });
+};
+</script>
+
+<style lang="scss" scoped></style>

+ 6 - 6
src/pages.json

@@ -22,6 +22,12 @@
       }
     },
     {
+      "path": "pages/travel/list",
+      "style": {
+        "navigationBarTitleText": "搜索列表"
+      }
+    },
+    {
       "path": "pages/labour/index",
       "style": {
         "navigationStyle": "custom",
@@ -70,12 +76,6 @@
         "iconPath": "static/img/tabbar_home.png",
         "selectedIconPath": "static/img/tabbar_home_selected.png",
         "text": "出国劳务"
-      },
-      {
-        "pagePath": "pages/profile/index",
-        "iconPath": "static/img/tabbar_profile.png",
-        "selectedIconPath": "static/img/tabbar_profile_selected.png",
-        "text": "我的"
       }
     ]
   },

+ 9 - 2
src/pages/home/comps/HotDestination.vue

@@ -2,10 +2,10 @@
   <div class="hot-destination">
     <div class="header">
       <text class="title">热门目的地</text>
-      <text class="more">查看更多</text>
+      <!-- <text class="more">查看更多</text> -->
     </div>
     <div class="content">
-      <div class="wrap" v-for="item in data" :key="item.id">
+      <div class="wrap" v-for="item in data" :key="item.id" @click="navigateToDetail(item)">
         <image :src="item.hotPictureUrlsAfterConvert[0]" mode="scaleToFill" />
         <text>
           {{ item.menuName }}
@@ -22,6 +22,13 @@ defineProps({
     default: () => [],
   },
 });
+
+// 导航到详情页
+const navigateToDetail = (item) => {
+  uni.navigateTo({
+    url: `/pages/travel/list?id=${item.id}&menuName=${item.menuName}`
+  });
+};
 </script>
 
 <style lang="scss" scoped>

+ 1 - 1
src/pages/home/comps/HotProjects.vue

@@ -2,7 +2,7 @@
   <div class="hot-project">
     <div class="header">
       <text class="title">热门项目</text>
-      <text class="more">查看更多</text>
+      <!-- <text class="more">查看更多</text> -->
     </div>
     <div class="content">
       <div class="wrap" v-for="item in data" :key="item.id" @click="handleToTravel(item)">

+ 2 - 2
src/pages/home/index.vue

@@ -10,8 +10,8 @@
       </swiper-item>
     </swiper>
     <SizedBox height="20" />
-    <Menu />
-    <SizedBox height="20" />
+    <!-- <Menu /> -->
+    <!-- <SizedBox height="20" /> -->
     <HotProjects v-if="hotPojectList.length" :data="hotPojectList" />
     <SizedBox height="20" />
     <HotDestination

+ 1 - 1
src/pages/labour/index.vue

@@ -37,7 +37,7 @@
       >
         <LabourJobItem v-for="item in dataList" :key="item.id" :item-data="item"> </LabourJobItem>
       </scroll-view>
-      <!-- <Empty v-else-if="!dataList.length && !loading" /> -->
+      <Empty v-else-if="!dataList.length && !loading" />
     </div>
     <!-- <Tabbar /> -->
 

+ 7 - 1
src/pages/travel/index.vue

@@ -18,7 +18,7 @@
           <div
             v-for="item in rightData"
             :key="item"
-            :to="`/travel/${item.id}?menuName=${item.menuName}`"
+            @click="navigateToDetail(item)"
             class="flex flex-col w-83 aspect-1 space-y-8 art items-center"
           >
             <image
@@ -61,6 +61,12 @@ async function getRightData(id) {
 onLoad((option) => {
   getRightData(option.parentId);
 });
+
+const navigateToDetail = (item) => {
+  uni.navigateTo({
+    url: `/pages/travel/list?id=${item.id}&menuName=${item.menuName}`,
+  });
+};
 </script>
 
 <style lang="scss" scoped>

+ 77 - 0
src/pages/travel/list.vue

@@ -0,0 +1,77 @@
+<template>
+  <div>
+    <div class="px-10 pt-20">
+      <input
+        v-model="searchStr"
+        placeholder="请输入搜索关键词"
+        confirm-type="search"
+        @confirm="onSearch"
+      />
+      <scroll-view
+        v-if="dataList.length"
+        type="list"
+        @scrolltolower="loadMore"
+        class="scroll-container"
+        scroll-y="true"
+      >
+        <TravelProjectItem v-for="item in dataList" :key="item.id" :item-data="item" />
+      </scroll-view>
+      <Empty v-else-if="!dataList.length && !loading" />
+    </div>
+  </div>
+</template>
+
+<script setup>
+import TravelProjectItem from '@/components/Travel/ProjectItem/index.vue';
+import Empty from '@/components/Empty/index.vue';
+import { getTravelProjectList } from '@/api/common';
+
+const id = ref(0);
+const searchStr = ref('');
+const dataList = ref([]);
+const loading = ref(false);
+const finished = ref(false);
+const pageNum = ref(1);
+const pageSize = ref(10);
+async function getProjects() {
+  const { data } = await getTravelProjectList({
+    pageNum: pageNum.value,
+    pageSize: pageSize.value,
+    belongTab: id.value,
+    searchString: searchStr.value,
+  });
+  dataList.value = dataList.value.concat(data.dataList);
+  loading.value = false;
+  if (dataList.value.length >= data.totalCount) {
+    finished.value = true;
+  } else {
+    finished.value = false;
+  }
+}
+
+function loadMore() {
+  pageNum.value++;
+  getProjects();
+}
+
+function onSearch() {
+  pageNum.value = 1;
+  dataList.value = [];
+  // finished.value = false;
+  getProjects();
+}
+
+onLoad((options) => {
+  id.value = options.id;
+  wx.setNavigationBarTitle({
+    title: options.menuName,
+    success: function (res) {
+    },
+    fail: function (err) {
+    },
+  });
+  getProjects();
+});
+</script>
+
+<style lang="scss" scoped></style>