123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <template>
- <view class="project-detail">
- <swiper class="swiper" circular :indicator-dots="true">
- <swiper-item v-for="item in responsibility" :key="item.id">
- <image class="image" :src="item.url" mode="aspectFill">
- </image>
- </swiper-item>
- </swiper>
- <view class="project-title">
- <view class="project-name">{{detail.name}}</view>
- <view class="project-label">距离您{{detail.distance || '-'}}km</view>
- <button type="default" class="wx-icon" open-type="share">
- <uni-icons type="weixin" open-type="share" size="38" color="#43b156">
- </uni-icons>
- </button>
- </view>
- <view class="project-label project-article">{{detail.comment}}</view>
- <view class="project-content">
- <view class="content-title">地理位置</view>
- <view class="content-map">
- <map id="map" class="map" :show-location="true" :latitude="latitude" :longitude="longitude"></map>
- </view>
- <view class="content-title">配套设施</view>
- <view class="content-device">
- <view class="device-item"
- v-for="item in $field.findTypeNameByList('supportingFacilities',detail.supportingFacilities)"
- :key="item.id">
- <uni-icons class="device-icon" custom-prefix="iconfont" :type="item.icon" size="18"></uni-icons>
- <text class="device-label">{{item.name}}</text>
- </view>
- </view>
- <view class="content-title">房源列表</view>
- <view class="house-list">
- <house-items v-for="(item,index) in list" :house="item" :key="item.id"></house-items>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getOpenHouseListByPage
- } from '@/request/api/house.js'
- import {
- getProjectDetailById
- } from '@/request/api/project.js'
- import houseItems from "@/components/house/houseItems.vue";
- export default {
- data() {
- return {
- list: [],
- detail: {},
- responsibility: [],
- coordinates: [],
- latitude: 39.90923,
- longitude: 116.397428,
- projectId: '',
- coordinatesstr: ''
- }
- },
- onLoad(body) {
- this.projectId = body.projectId;
- this.coordinatesstr = this.$store.getters.coordinates;
- this.init();
- },
- onReady() {
- this._mapContext = uni.createMapContext("map", this);
- },
- components: {
- houseItems
- },
- methods: {
- init() {
- console.log(this.coordinatesstr);
- getProjectDetailById(this.projectId + '?coordinates=' + this.coordinatesstr).then(res => {
- if (res.code === 200) {
- this.detail = res.data;
- if (this.detail.picture) this.responsibility = JSON.parse(this.detail.picture);
- if (this.detail.coordinates) {
- this.coordinates = this.detail.coordinates.split(',');
- this.latitude = this.coordinates[1];
- this.longitude = this.coordinates[0];
- this.addMarkers();
- }
- }
- })
- getOpenHouseListByPage({
- currPage: 1,
- pageSize: 100,
- projectId: parseInt(this.projectId)
- }).then(res => {
- if (res.code === 200) {
- this.list = this.list.concat(res.data.dataList); //追加新数据
- }
- })
- },
- addMarkers() {
- const positions = [{
- latitude: this.coordinates[1],
- longitude: this.coordinates[0],
- }]
- const markers = []
- positions.forEach((p, i) => {
- markers.push(
- Object.assign({}, {
- id: i + 1,
- width: 50,
- height: 50,
- joinCluster: true, // 指定了该参数才会参与聚合
- }, p)
- )
- })
- this._mapContext.addMarkers({
- markers,
- clear: false,
- complete(res) {}
- })
- }
- },
- }
- </script>
- <style lang="scss">
- .project-detail {
- background: #fff;
- padding-bottom: 60rpx;
- .swiper {
- height: 400rpx;
- .image {
- width: 100%;
- height: 100%;
- }
- }
- .project-label {
- font-size: 24rpx;
- color: $uni-secondary-color;
- font-weight: 300;
- }
- .project-article {
- font-size: 28rpx;
- padding: 0 30rpx;
- }
- .project-title {
- padding: 40rpx 130rpx 30rpx 30rpx;
- position: relative;
- .project-name {
- font-size: 36rpx;
- font-weight: 500;
- }
- .project-label {
- margin-top: 6rpx;
- }
- .wx-icon {
- position: absolute;
- top: 0;
- right: 30rpx;
- transform: translateY(50%);
- line-height: 1;
- background: transparent;
- &::after {
- display: none;
- }
- }
- }
- .content-map {
- width: 100%;
- height: 360rpx;
- border-radius: 16rpx;
- overflow: hidden;
- display: flex;
- .map {
- flex: 1;
- height: 100%;
- border-radius: 16rpx;
- }
- }
- .project-content {
- padding: 0 30rpx;
- box-sizing: border-box;
- .content-title {
- font-size: 32rpx;
- font-weight: 500;
- margin: 30rpx 0;
- }
- .content-device {
- display: flex;
- flex-wrap: wrap;
- .device-item {
- width: 50%;
- display: flex;
- align-items: center;
- margin-bottom: 20rpx;
- .device-label {
- flex: 1;
- width: 0;
- color: $uni-secondary-color;
- font-weight: 200;
- margin-left: 10rpx;
- }
- .device-icon {
- color: $uni-base-color;
- }
- }
- }
- }
- }
- </style>
|