优化及修复

This commit is contained in:
donqi 2023-03-12 22:06:15 +08:00
parent 9c031bf97d
commit 6e714fb2bc
3 changed files with 63 additions and 9 deletions

View File

@ -47,13 +47,17 @@
<text v-if="skillArrIndex !== item.goodsCategories.length - 1"></text> <text v-if="skillArrIndex !== item.goodsCategories.length - 1"></text>
</text> </text>
</view> </view>
<view> <view :class="isShowAllAreaCurCity[index] ? '' : 'certern-height'">
<text class="margin-right-xs">服务范围:</text> <text class="margin-right-xs">服务范围:</text>
<text v-for="(area, areaArrIndex) in item.workerAreas"> <text v-for="(area, areaArrIndex) in item.workerAreas">
<text>{{getLastSplitAreaName(area.mergerName)}}</text> <text>{{getLastSplitAreaName(area.mergerName)}}</text>
<text v-if="areaArrIndex !== item.workerAreas.length - 1"></text> <text v-if="areaArrIndex !== item.workerAreas.length - 1"></text>
</text> </text>
</view> </view>
<view class="text-main-color bg-white padding-top-sm" @click="showAllArea('CurCity', index)">
<text>查看全部服务区域</text>
<text :class="'cuIcon-' + (isShowAllAreaCurCity[index] ? 'fold' : 'unfold')"></text>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -127,13 +131,17 @@
<text v-if="skillArrIndex !== item.goodsCategories.length - 1"></text> <text v-if="skillArrIndex !== item.goodsCategories.length - 1"></text>
</text> </text>
</view> </view>
<view> <view :class="isShowAllAreaOtherCity[index] ? '' : 'certern-height'">
<text class="margin-right-xs">服务范围:</text> <text class="margin-right-xs">服务范围:</text>
<text v-for="(area, areaArrIndex) in item.workerAreas"> <text v-for="(area, areaArrIndex) in item.workerAreas">
<text>{{getLastSplitAreaName(area.mergerName)}}</text> <text>{{getLastSplitAreaName(area.mergerName)}}</text>
<text v-if="areaArrIndex !== item.workerAreas.length - 1"></text> <text v-if="areaArrIndex !== item.workerAreas.length - 1"></text>
</text> </text>
</view> </view>
<view class="text-main-color bg-white padding-top-sm" @click="showAllArea('OtherCity', index)">
<text>查看全部服务区域</text>
<text :class="'cuIcon-' + (isShowAllAreaOtherCity[index] ? 'fold' : 'unfold')"></text>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -207,10 +215,13 @@
pageSize: 0, pageSize: 0,
stickyTop: this.CustomBar, stickyTop: this.CustomBar,
searchInfo: {}, searchInfo: {},
curPositionDistrictId: -1,
areaList: [], areaList: [],
areaMultiIndex: [0, 0], areaMultiIndex: [0, 0],
categoryList: [], categoryList: [],
categoryMultiIndex: [0, 0, 0] categoryMultiIndex: [0, 0, 0],
isShowAllAreaCurCity: [],
isShowAllAreaOtherCity: []
} }
}, },
onReady() { onReady() {
@ -230,6 +241,7 @@
let areaArr = await this.$request.getCurArea(); let areaArr = await this.$request.getCurArea();
if (areaArr) { if (areaArr) {
this.searchInfo.area = [areaArr[1], areaArr[2]]; this.searchInfo.area = [areaArr[1], areaArr[2]];
this.curPositionDistrictId = this.searchInfo.area[1].areaId;
} }
}, },
async reloadData(params = {}) { async reloadData(params = {}) {
@ -253,6 +265,21 @@
let res = await this.$request.getWorkerList(params); let res = await this.$request.getWorkerList(params);
let rowsLength = res.rows.length; let rowsLength = res.rows.length;
if (rowsLength > 0) { if (rowsLength > 0) {
for (let i = 0; i < res.rows.length; i++) {
let curDistrictWorkerAreas = [];
let notCurDistrictWorkerAreas = [];
let sortedWorkerAreas = [];
for (let j = 0; j < res.rows[i].workerAreas.length; j++) {
let curWorkerArea = res.rows[i].workerAreas[j];
if (this.areaMultiIndex[1] === 0 && curWorkerArea.districtId === this.curPositionDistrictId) {
curDistrictWorkerAreas.push(curWorkerArea);
} else {
notCurDistrictWorkerAreas.push(curWorkerArea);
}
}
sortedWorkerAreas = curDistrictWorkerAreas.concat(notCurDistrictWorkerAreas);
res.rows[i].workerAreas = sortedWorkerAreas;
}
this.workerInfos = this.workerInfos.concat(res.rows); this.workerInfos = this.workerInfos.concat(res.rows);
this.pageNum++; this.pageNum++;
if (rowsLength === this.pageSize) { if (rowsLength === this.pageSize) {
@ -479,7 +506,15 @@
getLastSplitAreaName(mergeName) { getLastSplitAreaName(mergeName) {
let arr = mergeName.split(","); let arr = mergeName.split(",");
return arr[arr.length - 1]; return arr[arr.length - 1];
} },
showAllArea(type, index) {
let arr = this["isShowAllArea" + type];
if (arr[index] == undefined) {
arr[index] = false;
}
arr[index] = !arr[index];
this["isShowAllArea" + type] = [].concat(arr);
},
} }
} }
</script> </script>
@ -512,5 +547,10 @@
.text-beside-avatar { .text-beside-avatar {
width: 75%; width: 75%;
}
.certern-height {
max-height: 200rpx;
overflow: hidden;
} }
</style> </style>

View File

@ -16,7 +16,7 @@
</view> </view>
</uni-transition> </uni-transition>
<!-- 轮播图视频 --> <!-- 轮播图视频 -->
<swiper :class="changeSwiperHeight ? 'sm-screen-swiper' : 'sm-screen-swiper lg-screen-swiper'" @change="changeSwiper"> <swiper :autoplay="true" interval="5000" duration="500" :class="changeSwiperHeight ? 'sm-screen-swiper' : 'sm-screen-swiper lg-screen-swiper'" @change="changeSwiper">
<swiper-item v-if="productDetail.goodsVideoUrl"> <swiper-item v-if="productDetail.goodsVideoUrl">
<video style="width: 100%; height: 100%;" id="productVideo" :src="productDetail.goodsVideoUrl" :controls="true" :autoplay="false" <video style="width: 100%; height: 100%;" id="productVideo" :src="productDetail.goodsVideoUrl" :controls="true" :autoplay="false"
:show-center-play-btn="true" :show-fullscreen-btn="true"></video> :show-center-play-btn="true" :show-fullscreen-btn="true"></video>
@ -352,9 +352,11 @@
}); });
}, },
pauseVideo(e) { pauseVideo(e) {
if (this.productVideoPlaying) { if (this.productVideoPlaying) {
this.productVideoContext.exitFullScreen();
this.productVideoContext.pause(); this.productVideoContext.pause();
} else { } else {
this.productVideoContext.requestFullScreen();
this.productVideoContext.play(); this.productVideoContext.play();
} }
this.productVideoPlaying = !this.productVideoPlaying; this.productVideoPlaying = !this.productVideoPlaying;

View File

@ -18,13 +18,17 @@
<text class="cuIcon-form margin-right-xs text-main-color"></text> <text class="cuIcon-form margin-right-xs text-main-color"></text>
<text class="margin-right-xs">企业认证</text> <text class="margin-right-xs">企业认证</text>
</view> </view>
<view> <view :class="isShowAllAreaCurCity ? '' : 'certern-height'">
<text class="cuIcon-location margin-right-xs text-main-color"></text> <text class="cuIcon-location margin-right-xs text-main-color"></text>
<text class="margin-right-xs">服务范围:</text> <text class="margin-right-xs">服务范围:</text>
<text v-for="(area, areaArrIndex) in shopInfo.workerAreas"> <text v-for="(area, areaArrIndex) in shopInfo.workerAreas">
<text>{{getLastSplitAreaName(area.mergerName)}}</text> <text>{{getLastSplitAreaName(area.mergerName)}}</text>
<text v-if="areaArrIndex !== shopInfo.workerAreas.length - 1"></text> <text v-if="areaArrIndex !== shopInfo.workerAreas.length - 1"></text>
</text> </text>
</view>
<view class="text-main-color bg-white padding-top-sm" @click="showAllArea(index)">
<text>查看全部服务区域</text>
<text :class="'cuIcon-' + (isShowAllAreaCurCity ? 'fold' : 'unfold')"></text>
</view> </view>
</view> </view>
</view> </view>
@ -129,7 +133,8 @@
areaList: [], areaList: [],
areaMultiIndex: [0, 0], areaMultiIndex: [0, 0],
categoryList: [], categoryList: [],
stickyTop: this.CustomBar stickyTop: this.CustomBar,
isShowAllAreaCurCity: false
} }
}, },
onLoad(option) { onLoad(option) {
@ -278,6 +283,9 @@
getLastSplitAreaName(mergeName) { getLastSplitAreaName(mergeName) {
let arr = mergeName.split(","); let arr = mergeName.split(",");
return arr[arr.length - 1]; return arr[arr.length - 1];
},
showAllArea(index) {
this.isShowAllAreaCurCity = !this.isShowAllAreaCurCity;
} }
} }
} }
@ -286,5 +294,9 @@
<style scoped> <style scoped>
.text-beside-avatar { .text-beside-avatar {
width: 75%; width: 75%;
}
.certern-height {
max-height: 235rpx;
overflow: hidden;
} }
</style> </style>