李富豪 před 9 měsíci
rodič
revize
da3ff3945e

+ 36 - 31
src/apis/index.ts

@@ -6,26 +6,31 @@ export type LoginApiParams = {
   password: string,
 };
 
-export type pageInfoFacApiParams = {
+export type FetchHouseListApiParams = {
   pageNum: number,
   pageSize: number,
-  dictType: String,
 };
 
-export type pageInfoApiParams = {
+export type FetchRegionListApiParams = {
+  dictType: string,
+};
+
+export type FetchFacilityListApiParams = Partial<{
+  facilitiesTitle: string,
+  dictType: string,
   pageNum: number,
   pageSize: number,
-};
+}>;
 
 // Api函数类型
 export type LoginApi = (data: LoginApiParams) => Promise<any>;
 export type LogoutApi = () => Promise<any>;
-export type SwiperImageApi = () => Promise<any>;
-export type HouseListApi = (data: pageInfoApiParams) => Promise<any>;
-export type HouseDetailApi = (id: string) => Promise<any>;
-export type FacilitiesListApi = (data: pageInfoApiParams) => Promise<any>;
-export type FacilitiesDetailApi = (id: string) => Promise<any>;
-export type RegionDataApi = (data: pageInfoFacApiParams) => Promise<any>;
+export type FetchBannerListApi = () => Promise<any>;
+export type FetchHouseListApi = (data: FetchHouseListApiParams) => Promise<any>;
+export type FetchHouseDetailApi = (id: string) => Promise<any>;
+export type FetchRegionListApi = (data: FetchRegionListApiParams) => Promise<any>;
+export type FetchFacilityListApi = (data: FetchFacilityListApiParams) => Promise<any>;
+export type FetchFacilityDetailApi = (id: string) => Promise<any>;
 
 // 登录
 const loginApi: LoginApi = async (data) => {
@@ -37,43 +42,43 @@ const logoutApi: LogoutApi = async () => {
   return api.post('/auth/appLogout');
 };
 
-// 首页轮播图
-const swiperImageApi: SwiperImageApi = async () => {
+// 获取轮播图列表
+const fetchBannerListApi: FetchBannerListApi = async () => {
   return api.get('/system/img/wximg');
 };
 
-// 房型列表
-const houseListApi: HouseListApi = async (data) => {
+// 获取房型列表
+const fetchHouseListApi: FetchHouseListApi = async (data) => {
   return api.get('/system/room/wxlist', data);
 };
 
-// 房型详情
-const houseDetailApi: HouseDetailApi = async (id) => {
+// 获取房型详情
+const fetchHouseDetailApi: FetchHouseDetailApi = async (id) => {
   return api.get(`/system/room/${id}`);
 };
 
-// 设施列表
-const facilitiesListApi: FacilitiesListApi = async (data) => {
-  return api.get('/system/facilities/list', data);
+// 获取区域列表
+const fetchRegionListApi: FetchRegionListApi = async (data) => {
+  return api.get('/system/dict/data/list', data);
 };
 
-//设施详情
-const facilitiesDetailApi: FacilitiesDetailApi = async (id) => {
-  return api.get(`/system/facilities/${id}`);
+// 获取设施列表
+const fetchFacilityListApi: FetchFacilityListApi = async (data) => {
+  return api.get('/system/facilities/list', data);
 };
 
-// 区域数据
-const regionDataApi: RegionDataApi = async (data) => {
-  return api.get('/system/dict/data/list', data);
+// 获取设施详情
+const fetchFacilityDetailApi: FetchFacilityDetailApi = async (id) => {
+  return api.get(`/system/facilities/${id}`);
 };
 
 export const apis = {
   login: loginApi,
   logout: logoutApi,
-  swiperImage: swiperImageApi,
-  houseList: houseListApi,
-  houseDetail: houseDetailApi,
-  facilitiesList: facilitiesListApi,
-  facilityDetail: facilitiesDetailApi,
-  regionList: regionDataApi,
+  fetchBannerList: fetchBannerListApi,
+  fetchHouseList: fetchHouseListApi,
+  fetchHouseDetail: fetchHouseDetailApi,
+  fetchRegionList: fetchRegionListApi,
+  fetchFacilityList: fetchFacilityListApi,
+  fetchFacilityDetail: fetchFacilityDetailApi,
 };

+ 8 - 2
src/pages.json

@@ -12,6 +12,12 @@
 				"navigationBarTitleText": "首页"
 			}
 		},
+		{
+			"path": "pages/home/houseDetail/index",
+			"style": {
+				"navigationBarTitleText": "房型详情"
+			}
+		},
 		{
 			"path": "pages/facility/index/index",
 			"style": {
@@ -19,9 +25,9 @@
 			}
 		},
 		{
-			"path": "pages/facility/houseDetail/index",
+			"path": "pages/facility/facilityDetail/index",
 			"style": {
-				"navigationBarTitleText": "房型详情"
+				"navigationBarTitleText": "设施详情"
 			}
 		},
 		{

+ 105 - 0
src/pages/facility/facilityDetail/index.vue

@@ -0,0 +1,105 @@
+<template>
+  <view class="facility-facilityDetail">
+    <wd-swiper :autoplay="false" :list="state.photoList" :indicator="{ type: 'fraction' }"
+      indicatorPosition="bottom-right" @click="onClickSwiper(state.photoList)" />
+    <view class="facility-facilityDetail-content">
+      <view class="facility-facilityDetail-content-title">
+        {{ state.info.title }}
+      </view>
+      <view class="facility-facilityDetail-content-text">
+        {{ state.info.description }}
+      </view>
+    </view>
+  </view>
+</template>
+
+<script lang="ts" setup>
+import { reactive } from 'vue';
+import { onLoad } from '@dcloudio/uni-app';
+import { apis } from '@/apis';
+
+interface State {
+  id: string,
+  photoList: string[],
+  info: {
+    title: string,// 标题
+    description: string,// 描述
+  },
+};
+
+const state = reactive<State>({
+  id: '',
+  photoList: [],
+  info: {
+    title: '',
+    description: '',
+  },
+});
+
+const api = {
+  // 获取设施详情
+  fetchFacilityDetail: async () => {
+    try {
+      const res = await apis.fetchFacilityDetail(state.id);
+      const data = res.data;
+      const photoList = data.sysimg.map((item: any) => item.url);
+      state.photoList = photoList;
+      state.info = {
+        title: data.facilitiesTitle,
+        description: data.facilitiesDesc,
+      }
+    } catch (error: any) {
+      uni.showToast({
+        icon: 'none',
+        mask: true,
+        duration: 2000,
+        title: error.msg,
+      });
+    }
+  },
+}
+
+const init = async () => {
+  uni.showLoading({
+    title: '加载中',
+  });
+  // 获取设施详情
+  await api.fetchFacilityDetail();
+  uni.hideLoading();
+};
+
+onLoad((options) => {
+  const data = options as { id: string };
+  state.id = data.id;
+  init();
+});
+
+// 点击轮播
+const onClickSwiper = (list: string[]) => {
+  uni.previewImage({
+    urls: list,
+  });
+}
+</script>
+
+<style lang="scss" scoped>
+.facility-facilityDetail {
+  :deep(.wd-swiper__track) {
+    border-radius: 0;
+  }
+
+  &-content {
+    padding: 0 20rpx;
+    background: #FFFFFF;
+
+    &-title {
+      font-weight: bold;
+      margin: 20rpx 0;
+    }
+
+    &-text {
+      color: #101010;
+    }
+  }
+}
+</style>

+ 0 - 223
src/pages/facility/houseDetail/index.vue

@@ -1,223 +0,0 @@
-<template>
-  <view class="facility-houseDetail">
-    <wd-swiper :autoplay="false" :list="state.photoList" :indicator="{ type: 'fraction' }"
-      indicatorPosition="bottom-right" v-model:current="state.swiperCurrentIndex" @click="onClickSwiper" />
-    <view class="facility-houseDetail-content">
-      <view class="facility-houseDetail-content-title">
-        三亚太保养老族库
-      </view>
-      <!-- 房型详情 -->
-      <view >
-        <view class="facility-houseDetail-content-title">
-          {{ state.detail.title }}
-        </view>
-        <view class="facility-houseDetail-content-text">
-          {{ state.detail.content }}
-        </view>
-      </view>
-      <!-- 区域list -->
-      <view v-for="(item, index) in state.areaList" :key="index">
-        <view class="facility-houseDetail-content-title">
-          {{ item.title }}
-        </view>
-        <view style="margin-bottom: 10rpx;">
-          <wd-swiper :autoplay="false" :list="item.sysimg" :indicator="{ type: 'fraction' }"
-          indicatorPosition="bottom-right" v-model:current="state.swiperCurrentIndex" @click="onClickSwiper" />
-        </view>
-        <view class="facility-houseDetail-content-text">
-          {{ item.content }}
-        </view>
-      </view>
-
-    </view>
-  </view>
-</template>
-
-<script lang="ts" setup>
-import { reactive, computed } from 'vue';
-import { onLoad } from '@dcloudio/uni-app';
-import { apis } from '@/apis';
-
-interface State {
-  swiperCurrentIndex: number,
-  photoList: string[], // 房型图片
-  detail: {   // 房型详情
-    url: string,
-    title: string,
-    content: string,
-    size: string,     //面积
-    direction: string,//朝向
-    floorNum: string, //楼层
-  },
-  areaList: [{  // 区域list
-    title: string,
-    content: string,
-    sysimg: string []
-  }];
-  areaPhotoList: string[], // 区域图片
-  id: string,
-  type: string,
-};
-
-const state: State = reactive({
-  swiperCurrentIndex: 0,
-  photoList: [],
-  areaList: [{
-    title: '',
-    content: '',
-    sysimg: []
-  }],
-  areaPhotoList: [],
-  detail : {
-    url: '',
-    title: '',
-    content: '',
-    size: '',
-    direction: '',
-    floorNum: '',
-  },
-  id: '',
-  type: '',
-});
-
-const coverUrl = computed(() => {
-  return state.photoList[0];
-})
-
-const api = {
-  // 获取房型详情
-  fetchHouseDetail: async () => {
-    uni.showLoading({
-      title: '加载中',
-    });
-    try {
-      const res = await apis.houseDetail(state.id);
-      if(res.code === 200){
-        const data = res.data;
-        state.detail = {  // 房型详情
-          url: data.sysimg[0].url,
-          title: data.roomTitle,
-          content: data.roomDesc,
-          size: data.roomSize,
-          direction: data.direction,
-          floorNum: data.floorNum,
-        }
-        data.sysimg.forEach((item: any) => {  // 房型图片
-          state.photoList.push(item.url);
-        });
-
-        const regionData = data.region;  // 区域list
-        regionData.forEach((item1: any) => {
-          state.areaList.push({
-            title: item1.regionTitle,
-            content: item1.regionDesc,
-            sysimg: item1.sysimg.map((item2: any) => {
-              return item2.url;
-            })
-          });
-        });
-      }
-    } catch (error: any) {
-      console.error(error);
-    } finally {
-      uni.hideLoading();
-    }
-  },
-
-  facilityDetail: async () => {
-    uni.showLoading({
-      title: '加载中',
-    });
-    try {
-      const res = await apis.facilityDetail(state.id);
-      if(res.code === 200){
-        const data = res.data;
-        state.detail = {  // 设施详情
-          url: data.sysimg[0].url,
-          title: data.facilitiesTitle,
-          content: data.facilitiesDesc,
-          size: '',
-          direction: '',
-          floorNum: '',
-        }
-        data.sysimg.forEach((item: any) => {  // 设施图片
-          state.photoList.push(item.url);
-        });
-      }
-    } catch (error: any) {
-      console.error(error);
-    } finally {
-      uni.hideLoading();
-    }
-  },
-}
-
-const init = async () => {
-  uni.showLoading({
-    title: '加载中',
-  });
-  
-  if(state.type !== '' && state.type !== undefined){
-    // 获取设施详情
-    await api.facilityDetail();
-  }else{
-    // 获取房型详情
-    await api.fetchHouseDetail();
-  }
-  uni.hideLoading();
-};
-
-onLoad((option) => {
-  console.log(option, 'option');
-  state.id = option?.id ?? '';
-  state.type = option?.type ?? '';
-  init();
-});
-
-// 点击轮播
-const onClickSwiper = () => {
-  uni.previewImage({
-    urls: state.photoList,
-  });
-}
-
-// 点击查看图片
-const onClickLookImage = (url: string) => {
-  if (!url) {
-    return;
-  }
-  uni.previewImage({
-    urls: [url],
-  });
-}
-</script>
-
-<style lang="scss" scoped>
-.facility-houseDetail {
-  :deep(.wd-swiper__track) {
-    border-radius: 0;
-  }
-
-  &-content {
-    padding: 0 20rpx;
-    background: #FFFFFF;
-
-    &-title {
-      font-weight: bold;
-      margin: 20rpx 0;
-    }
-
-    &-chunk {
-      width: 100%;
-      padding: 20rpx;
-      background: #F5F5F5;
-      border-radius: $border-radius-base;
-      color: #717376;
-    }
-
-    &-text {
-      color: #101010;
-    }
-  }
-}
-</style>

+ 94 - 101
src/pages/facility/index/index.vue

@@ -2,27 +2,25 @@
   <view class="facility">
     <wd-sticky :z-index="10">
       <view class="facility-top">
-        <wd-search :placeholder-left="true" placeholder="三亚太保养老族库">
+        <wd-search :placeholder-left="true" placeholder="请输入内容" v-model="state.text">
           <template #suffix>
             <view style="display: flex;align-items: center;margin: 0 20rpx;">
-              <wd-button size="small">
-                搜索
-              </wd-button>
+              <view style="margin-right: 20rpx;">
+                <wd-button size="small" @click="onClickSearch">
+                  搜索
+                </wd-button>
+              </view>
+              <view>
+                <wd-button type="info" size="small" @click="onClickReset">
+                  重置
+                </wd-button>
+              </view>
             </view>
           </template>
         </wd-search>
-        <wd-tabs slidable="always" v-model="state.tab" @click="onclickFacilityList()">
-          <wd-tab v-for="(item, index) in state.tabList" :key="index" :title="item.name" />
+        <wd-tabs slidable="always" v-model="state.tabValue">
+          <wd-tab v-for="(item, index) in state.tabList" :title="item.label" :key="index" />
         </wd-tabs>
-        <wd-drop-menu>
-          <wd-drop-menu-item v-model="state.dropMenu" :options="state.dropMenuList" />
-          <wd-drop-menu-item title="更多筛选">
-            <view>
-              <wd-cell title="标题" value="筛选内容1" />
-              <wd-cell title="标题" value="筛选内容2" />
-            </view>
-          </wd-drop-menu-item>
-        </wd-drop-menu>
       </view>
     </wd-sticky>
     <view class="facility-list">
@@ -37,7 +35,7 @@
             {{ item.title }}
           </view>
           <view class="facility-list-item-text">
-            {{ item.content }}
+            {{ item.description }}
           </view>
         </view>
       </view>
@@ -47,14 +45,13 @@
 
 <script lang="ts" setup>
 import { reactive } from 'vue';
-import { onShow, onReachBottom, onLoad } from '@dcloudio/uni-app';
+import { onShow, onReachBottom } from '@dcloudio/uni-app';
 import { apis } from '@/apis';
-import { s } from 'vite/dist/node/types.d-aGj9QkWt';
 
 interface State {
-  tab: string,
-  dropMenu: string,
-  dropMenuList: {
+  text?: string,
+  tabValue?: string,
+  tabList: {
     label: string,
     value: string,
   }[],
@@ -63,71 +60,70 @@ interface State {
     url: string,
     sign: string,
     title: string,
-    content: string,
-    date: string,
+    description: string,
   }[],
   page: {
-    pageNumber: number,
+    pageNum: number,
     pageSize: number,
     total: number,
   },
-  tabList: [
-    {
-      name: '',
-      id: '',
-    }
-  ]
 };
 
-const state: State = reactive({
-  tab: '0',
-  dropMenu: '1',
-  dropMenuList: [
-    {
-      label: '效果图',
-      value: '1',
-    },
-    {
-      label: '物料实物',
-      value: '2',
-    }
-  ],
+const state = reactive<State>({
+  text: undefined,
+  tabValue: undefined,
+  tabList: [],
   list: [],
   page: {
-    pageNumber: 1,
+    pageNum: 1,
     pageSize: 20,
     total: 0,
   },
-  tabList: [{
-    name: '',
-    id: '',
-  }],
 });
 
 const api = {
+  // 获取区域列表
+  fetchRegionList: async () => {
+    try {
+      const data = {
+        dictType: 'region_type',
+      };
+      const res = await apis.fetchRegionList(data);
+      const list = res.rows.map((item: any) => {
+        return {
+          label: item.dictLabel,
+          value: item.dictValue,
+        }
+      });
+      state.tabValue = list.length ? list[0].value : undefined;
+      state.tabList = list;
+    } catch (error: any) {
+      console.error(error);
+    }
+  },
   // 获取设施列表
-  fetchList: async (concat?: boolean) => {
+  fetchFacilityList: async (concat?: boolean) => {
     uni.showLoading({
       title: '加载中',
     });
     try {
       const data = {
-        pageNum: state.page.pageNumber,
+        facilitiesTitle: state.text,
+        dictType: state.tabValue,
+        pageNum: state.page.pageNum,
         pageSize: state.page.pageSize,
-        dictType: state.tab,
       };
-      const res = await apis.facilitiesList(data);
+      const res = await apis.fetchFacilityList(data);
       const list = res.rows.map((item: any) => {
         return {
           id: item.facilitiesId,
           url: item.sysimg[0].url,
-          sign: '',
+          sign: item.facilitiesName,
           title: item.facilitiesTitle,
-          content: item.facilitiesDesc,
-          date: item.createTime,
+          description: item.facilitiesDesc,
         };
       });
-      state.list= concat ? state.list.concat(list) : list;
+      state.list = concat ? state.list.concat(list) : list;
       state.page = {
         ...state.page,
         total: res.total,
@@ -138,77 +134,71 @@ const api = {
       uni.hideLoading();
     }
   },
-
-  //获取区域列表
-  fetchRegionList: async () => {
-    try {
-      const data = {
-        pageNum: state.page.pageNumber,
-        pageSize: state.page.pageSize,
-        dictType: 'region_type',
-      };
-      const res = await apis.regionList(data);
-      if (res.code === 200) {
-        res.rows.forEach((item: any) => {
-          state.tabList.push({
-            name: item.dictLabel,
-            id: item.dictValue,
-          });
-        });
-      }
-    } catch (error: any) {
-      console.error(error);
-    }
-  }
 }
 
 const init = async () => {
   uni.showLoading({
     title: '加载中',
   });
-  // 获取列表
-  await api.fetchList();
-  await api.fetchRegionList();
+  // 获取区域列表
+  api.fetchRegionList();
+  // 获取设施列表
+  api.fetchFacilityList();
   uni.hideLoading();
 };
 
+onShow(() => {
+  state.page = {
+    ...state.page,
+    pageNum: 1,
+  };
+  init();
+});
+
 const onChangePagination = async () => {
-  const { pageNumber, pageSize, total } = state.page;
-  if (total > pageNumber * pageSize) {
+  const { pageNum, pageSize, total } = state.page;
+  if (total > pageNum * pageSize) {
     state.page = {
       ...state.page,
-      pageNumber: pageNumber + 1,
+      pageNum: pageNum + 1,
     }
-    // 获取列表
-    await api.fetchList(true);
+    // 获取设施列表
+    await api.fetchFacilityList(true);
   }
 }
 
-onShow(() => {
+onReachBottom(() => {
+  onChangePagination();
+});
+
+// 点击搜索
+const onClickSearch = async () => {
   state.page = {
     ...state.page,
-    pageNumber: 1,
+    pageNum: 1,
   };
-  init();
-});
-
-onReachBottom(() => {
-  console.log('触发分页');
+  // 获取设施列表
+  await api.fetchFacilityList();
+}
 
-  onChangePagination();
-});
+// 点击重置
+const onClickReset = async () => {
+  state.text = undefined;
+  state.tabValue = undefined
+  state.page = {
+    ...state.page,
+    pageNum: 1,
+  };
+  // 获取设施列表
+  await api.fetchFacilityList();
+}
 
 // 点击跳转
 const onClickNavigate = (id: string) => {
   uni.navigateTo({
-    url: `/pages/facility/houseDetail/index?id=${id}&type=${state.tab}`,
+    url: `/pages/facility/facilityDetail/index?id=${id}`,
   });
 }
-
-const onclickFacilityList = async () => {
-  state.list = [];
-  api.fetchList();
-}
 </script>
 
 <style lang="scss" scoped>
@@ -238,6 +228,9 @@ const onclickFacilityList = async () => {
         padding: 0 10rpx;
         background: rgba(0, 0, 0, 0.4);
         border-top-right-radius: $border-radius-base;
+        display: flex;
+        align-items: center;
+        font-size: $font-size-mini;
         color: #FFFFFF;
         overflow: hidden;
         white-space: nowrap;

+ 169 - 0
src/pages/home/houseDetail/index.vue

@@ -0,0 +1,169 @@
+<template>
+  <view class="home-houseDetail">
+    <wd-swiper :autoplay="false" :list="state.photoList" :indicator="{ type: 'fraction' }"
+      indicatorPosition="bottom-right" @click="onClickSwiper(state.photoList)" />
+    <view class="home-houseDetail-content">
+      <view class="home-houseDetail-content-title">
+        {{ state.info.title }}
+      </view>
+      <view class="home-houseDetail-content-chunk">
+        <view style="display: flex;" v-if="state.info.size">
+          <view>
+            {{ state.info.size }}
+          </view>
+          <view style="margin:0 20rpx;">
+            |
+          </view>
+        </view>
+        <view style="display: flex;" v-if="state.info.direction">
+          <view>
+            {{ state.info.direction }}
+          </view>
+          <view style="margin:0 20rpx;">
+            |
+          </view>
+        </view>
+        <view v-if="state.info.floorNum">
+          {{ state.info.floorNum }}
+        </view>
+      </view>
+      <!-- 区域 -->
+      <view v-for="(item, index) in state.areaList" :key="index">
+        <view class="home-houseDetail-content-title">
+          {{ item.title }}
+        </view>
+        <view style="margin-bottom: 10rpx;">
+          <wd-swiper :autoplay="false" :list="item.photoList" :indicator="{ type: 'fraction' }"
+            indicatorPosition="bottom-right" @click="onClickSwiper(item.photoList)" />
+        </view>
+        <view class="home-houseDetail-content-text">
+          {{ item.description }}
+        </view>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script lang="ts" setup>
+import { reactive } from 'vue';
+import { onLoad } from '@dcloudio/uni-app';
+import { apis } from '@/apis';
+
+interface State {
+  id: string,
+  photoList: string[],
+  info: {
+    title: string,// 标题
+    description: string,// 描述
+    size: string,// 面积
+    direction: string,// 朝向
+    floorNum: string,// 楼层
+  },
+  areaList: {
+    title: string,
+    description: string,
+    photoList: string[],
+  }[];
+};
+
+const state = reactive<State>({
+  id: '',
+  photoList: [],
+  info: {
+    title: '',
+    description: '',
+    size: '',
+    direction: '',
+    floorNum: '',
+  },
+  areaList: [],
+});
+
+const api = {
+  // 获取房型详情
+  fetchHouseDetail: async () => {
+    try {
+      const res = await apis.fetchHouseDetail(state.id);
+      const data = res.data;
+      const photoList = data.sysimg.map((item: any) => item.url);
+      state.photoList = photoList;
+      state.info = {
+        title: data.roomTitle,
+        description: data.roomDesc,
+        size: data.roomSize,
+        direction: data.direction,
+        floorNum: data.floorNum,
+      }
+      const areaList = data.region.map((item: any) => {
+        return {
+          title: item.regionTitle,
+          description: item.regionDesc,
+          photoList: item.sysimg.map((record: any) => record.url),
+        }
+      });
+      state.areaList = areaList;
+    } catch (error: any) {
+      uni.showToast({
+        icon: 'none',
+        mask: true,
+        duration: 2000,
+        title: error.msg,
+      });
+    }
+  },
+}
+
+const init = async () => {
+  uni.showLoading({
+    title: '加载中',
+  });
+  // 获取房型详情
+  await api.fetchHouseDetail();
+  uni.hideLoading();
+};
+
+onLoad((options) => {
+  const data = options as { id: string };
+  state.id = data.id;
+  init();
+});
+
+// 点击轮播
+const onClickSwiper = (list: string[]) => {
+  uni.previewImage({
+    urls: list,
+  });
+}
+</script>
+
+<style lang="scss" scoped>
+.home-houseDetail {
+  :deep(.wd-swiper__track) {
+    border-radius: 0;
+  }
+
+  &-content {
+    padding: 0 20rpx;
+    background: #FFFFFF;
+
+    &-title {
+      font-weight: bold;
+      margin: 20rpx 0;
+    }
+
+    &-chunk {
+      width: 100%;
+      padding: 20rpx;
+      background: #F5F5F5;
+      border-radius: $border-radius-base;
+      color: #717376;
+      display: flex;
+      align-items: center;
+    }
+
+    &-text {
+      color: #101010;
+    }
+  }
+}
+</style>

+ 28 - 60
src/pages/home/index/index.vue

@@ -6,7 +6,6 @@
       </wd-drop-menu>
     </view>
     <view>
-      <!-- @click="onClickSwiper" -->
       <wd-swiper :autoplay="true" :list="state.swiperList" />
     </view>
     <view class="home-menu">
@@ -50,9 +49,9 @@
 
 <script lang="ts" setup>
 import { reactive } from 'vue';
-import { onShow, onLoad } from '@dcloudio/uni-app';
-import iconCitySrc from '@/static/home/icon_city.svg';
+import { onShow } from '@dcloudio/uni-app';
 import { apis } from '@/apis';
+import dayjs from 'dayjs';
 
 interface State {
   address: string,
@@ -68,14 +67,9 @@ interface State {
     content: string,
     date: string,
   }[],
-  page: {
-    pageNumber: number,
-    pageSize: number,
-    total: number,
-  },
 };
 
-const state: State = reactive({
+const state = reactive<State>({
   address: '1',
   addressList: [
     {
@@ -93,11 +87,6 @@ const state: State = reactive({
   ],
   swiperList: [],
   houseList: [],
-  page: {
-    pageNumber: 1,
-    pageSize: 2,
-    total: 0,
-  },
 });
 
 const menuList = [
@@ -134,82 +123,61 @@ const menuList = [
 ];
 
 const api = {
-  fetchImgsList: async () => {
-    state.swiperList = [];
-    const res = await apis.swiperImage();
-    res.rows.forEach((item: any) => {
-      state.swiperList.push(item.url);
-    });
-
+  // 获取轮播图列表
+  fetchBannerList: async () => {
+    try {
+      const res = await apis.fetchBannerList();
+      const list = res.rows.map((item: any) => item.url);
+      state.swiperList = list;
+    } catch (error: any) {
+      console.error(error);
+    }
   },
-
+  // 获取房型列表
   fetchHouseList: async () => {
-    uni.showLoading({
-      title: '加载中',
-    });
     try {
       const data = {
-        pageNum: state.page.pageNumber,
-        pageSize: state.page.pageSize,
+        pageNum: 1,
+        pageSize: 2,
       };
-      const res = await apis.houseList(data);
+      const res = await apis.fetchHouseList(data);
       const list = res.rows.map((item: any) => {
         return {
           id: item.roomId,
           url: item.sysimg[0].url,
           title: item.roomTitle,
           content: item.roomDesc,
-          date: item.createTime,
+          date: dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss'),
         }
       });
-      state.houseList = list.slice(0,2);
-    } catch (error) {
+      state.houseList = list.slice(0, 2);
+    } catch (error: any) {
       console.error(error);
-    } finally {
-      uni.hideLoading();
     }
   }
 }
 
-const init = () => {
+const init = async () => {
   uni.showLoading({
     title: '加载中',
   });
-  api.fetchImgsList(); //轮播图集合
-  api.fetchHouseList();//房型集合
+  await Promise.all([
+    // 获取轮播图列表
+    api.fetchBannerList(),
+    // 获取房型列表
+    api.fetchHouseList(),
+  ]);
+  uni.hideLoading();
 };
 
-const onChangePagination = async () => {
-  const { pageNumber, pageSize, total } = state.page;
-  if (total > pageNumber * pageSize) {
-    state.page = {
-      ...state.page,
-      pageNumber: pageNumber + 1,
-    }
-    // 获取列表
-    await api.fetchHouseList();
-  }
-}
-
 onShow(() => {
-  state.page = {
-    ...state.page,
-    pageNumber: 1,
-  };
   init();
 });
 
-// 点击轮播
-const onClickSwiper = () => {
-  uni.navigateTo({
-    url: `/pages/facility/houseDetail/index`,
-  });
-}
-
 // 点击跳转
 const onClickNavigate = (id: string) => {
   uni.navigateTo({
-    url: `/pages/facility/houseDetail/index?id=${id}`,
+    url: `/pages/home/houseDetail/index?id=${id}`,
   });
 }
 </script>

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

@@ -39,7 +39,7 @@ interface State {
   buttonLoading: boolean,
 };
 
-const state: State = reactive({
+const state = reactive<State>({
   account: '',
   password: '',
   rememberChecked: false,

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

@@ -43,7 +43,7 @@ interface State {
   buttonLoading: boolean,
 };
 
-const state: State = reactive({
+const state = reactive<State>({
   info: {
     userName: '测试',
     phoneNumber: '18888888888',