|
|
@@ -6,20 +6,29 @@
|
|
|
<view class="facility-houseDetail-content-title">
|
|
|
三亚太保养老族库
|
|
|
</view>
|
|
|
- <view class="facility-houseDetail-content-chunk">
|
|
|
- 装修实例 丨 90㎡ 丨 两居
|
|
|
+ <!-- 房型详情 -->
|
|
|
+ <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-img width="100%" mode="widthFix" :src="item.url" @click="onClickLookImage(item.url)" />
|
|
|
+ <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>
|
|
|
@@ -27,21 +36,48 @@
|
|
|
<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[],
|
|
|
- areaList: {
|
|
|
+ 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: [],
|
|
|
+ areaList: [{
|
|
|
+ title: '',
|
|
|
+ content: '',
|
|
|
+ sysimg: []
|
|
|
+ }],
|
|
|
+ areaPhotoList: [],
|
|
|
+ detail : {
|
|
|
+ url: '',
|
|
|
+ title: '',
|
|
|
+ content: '',
|
|
|
+ size: '',
|
|
|
+ direction: '',
|
|
|
+ floorNum: '',
|
|
|
+ },
|
|
|
+ id: '',
|
|
|
+ type: '',
|
|
|
});
|
|
|
|
|
|
const coverUrl = computed(() => {
|
|
|
@@ -49,45 +85,69 @@ const coverUrl = computed(() => {
|
|
|
})
|
|
|
|
|
|
const api = {
|
|
|
- // 获取列表
|
|
|
- fetchList: async () => {
|
|
|
+ // 获取房型详情
|
|
|
+ fetchHouseDetail: async () => {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中',
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ console.log('1');
|
|
|
+ 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
|
|
|
+ console.log(regionData, 'regionData');
|
|
|
+ regionData.forEach((item1: any) => {
|
|
|
+ console.log(item1.sysimg, 'item1');
|
|
|
+ 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 photoList = [
|
|
|
- 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
|
|
|
- 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
|
|
|
- ];
|
|
|
- state.photoList = photoList;
|
|
|
- const list = [
|
|
|
- {
|
|
|
- url: 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
|
|
|
- title: '户型图',
|
|
|
- content: '99㎡两室一厅的户型,整屋以白色和原木色为主基调,用鲜艳的颜色点缀空间,清新淡雅,不杂乱,简单纯粹。',
|
|
|
- },
|
|
|
- {
|
|
|
- url: 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
|
|
|
- title: '客厅',
|
|
|
- content: '沙发墙特意选择了跟电视墙同色的卡其色护墙板铺贴,看上去就不会觉得单调。背景墙两侧都有卧室门,特意选择跟背景墙相近色的木门,达到隐形门的效果。 整屋以实用精致的搭配为主,吊顶也没有过多设计,在平面吊顶的基础上,安装吸顶灯和灯带做主要照明,不压层高。',
|
|
|
- },
|
|
|
- {
|
|
|
- url: 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
|
|
|
- title: '卧室',
|
|
|
- content: '主卧把飘窗拆除后也做了落地窗封窗,充足的采光融入,让空间看上去更显宽敞大气。原飘窗的位置也没有浪费,而是安装了梳妆台,有效利用空间。 卧室整体墙面留白,也没有做过多的处理,避免因为太复杂的设计让空间显得更局促。将床靠墙摆放,尽可能节省空间,留出充足的活动空间来。',
|
|
|
- },
|
|
|
- {
|
|
|
- url: 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
|
|
|
- title: '厨房',
|
|
|
- content: '厨房的面积较小,将生活阳台打通后做了双一字型的布局,将空间都有效利用起来。拥有充足的收纳空间,满足一家人对收纳的高需求。 空间虽然小,但是操作区布局也都做到了合理规划。而且还做了高低台的设计,符合人体工学,做饭洗菜时不易累腰。',
|
|
|
- },
|
|
|
- {
|
|
|
- url: 'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
|
|
|
- title: '卫生间',
|
|
|
- content: '卫生间的介绍',
|
|
|
- },
|
|
|
- ];
|
|
|
- state.areaList = list;
|
|
|
+ const res = await apis.facilityDetail(state.id);
|
|
|
+ console.log(res, 'res');
|
|
|
+ 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 {
|
|
|
@@ -100,12 +160,21 @@ const init = async () => {
|
|
|
uni.showLoading({
|
|
|
title: '加载中',
|
|
|
});
|
|
|
- // 获取列表
|
|
|
- await api.fetchList();
|
|
|
+
|
|
|
+ if(state.type === '2'){
|
|
|
+ // 获取设施详情
|
|
|
+ await api.facilityDetail();
|
|
|
+ }else{
|
|
|
+ // 获取房型详情
|
|
|
+ await api.fetchHouseDetail();
|
|
|
+ }
|
|
|
uni.hideLoading();
|
|
|
};
|
|
|
|
|
|
-onLoad(() => {
|
|
|
+onLoad((option) => {
|
|
|
+ console.log(option, 'option');
|
|
|
+ state.id = option?.id ?? '';
|
|
|
+ state.type = option?.type ?? '';
|
|
|
init();
|
|
|
});
|
|
|
|