<template> <view class="content"> <!-- 列表 --> <view class="itemContent"> <view v-for="(item,index) in itemData" :key="index"> <view class="item"> <view class="leftView"> <image :src='item.HeadUrl' v-if="item.HeadUrl" class="storeImg"></image> <image src="../../static/img/pic_def_ava.png" mode="" class="storeImg" v-else></image> </view> <view class="rightView"> <!-- 第一行 --> <view class="firstView"> <view class="shopName">{{item.Evaluator}}</view> </view> <!-- 第2行 --> <view class="secondView"> <!-- 星星 --> <uni-rate :value="item.Overallevaluation" :max="5" color="#EEEEEE" active-color="#FF4F00" :size="16" :margin="4" :readonly="true" /> <view class="time">{{item.CreateTime.slice(0,item.CreateTime.length-8)}}</view> </view> <view class="contentMes">{{item.EContent}}</view> <!-- 照片 --> <view class="imgBg"> <view v-for="(itemImg,indexImg) in item.imgs" :key="indexImg"> <image :src="itemImg.imageUrl" class="img" @click="previewImage(itemImg.imageUrl,item.imgs)"></image> </view> </view> <!-- 商家回复 --> <view class="writeBack" v-if="item.ReplyContent">商家回复:{{item.ReplyContent}}</view> </view> </view> </view> </view> <!-- 上拉 加载更多 --> <view class="noMore" v-if="noMoreShow">没有更多数据</view> <!-- 无数据空白页 --> <nodata v-if="itemData.length==0"></nodata> </view> </template> <script> import nodata from '../../components/nodata/nodata.vue' export default { components: { nodata, }, data() { return { itemData: [], page: 1, noMoreShow: false, imgArr: [], shopId:'', } }, onLoad(opt) { this.page = 1 this.shopId = opt.shopId this.getItemData() }, methods: { previewImage(img, arrDic) { var arr = []; arrDic.forEach(item => { arr.push(item.imageUrl) }) // 预览图片 uni.previewImage({ urls: arr, current: img, longPressActions: { itemList: ['发送给朋友', '保存图片', '收藏'], success: function(data) { console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片'); }, fail: function(err) { console.log(err.errMsg); } } }); }, getItemData() { uni.showLoading({ title: '加载中' }) let url = 'worldKeepCar/worldHome/listShopTMEvaluatePage', params = { page: this.page, limit: 20, shopId:this.shopId, } this.$http(url, params, 'GET').then(res => { uni.hideLoading(); var list = res.data.Items // 处理 undefined和null转为空白字符串 list.forEach((item, index) => { for (const key in item) { item[key] = this.$praseStrEmpty(item[key]) } }) if (this.page == 1) { this.itemData = list } else { this.itemData = this.itemData.concat(list) } if (list.length < 10) { this.noMoreShow = false } else { this.noMoreShow = true } }) }, }, // 下拉刷新 上拉加载更多 onPullDownRefresh() { this.page = 1 this.getItemData() setTimeout(function() { uni.stopPullDownRefresh(); }, 1000); }, onReachBottom() { this.page++; this.getItemData() }, } </script> <style scoped> .content { background: #FFFFFF; min-height: 100vh; } .item { display: flex; justify-content: flex-start; padding: 0 24rpx; background-color: #FFFFFF; } .leftView { width: 117rpx; padding-right: 20rpx; } .storeImg { width: 72rpx; height: 72rpx; border-radius: 8rpx; margin-top: 30rpx; } .rightView { border-bottom: 1rpx #EEEEEE solid; width: 100vw; } .firstView, .secondView { display: flex; justify-content: space-between; align-items: center; } .firstView { padding-top: 30rpx; } .secondView { padding-top: 12rpx; padding-bottom: 20rpx; } .shopName { /* padding-top: 30rpx; padding-bottom: 10rpx; */ font-size: 26rpx; font-weight: bold; color: #333333; } .time { font-size: 26rpx; color: #999999; } .deleteBtn { width: 36rpx; height: 36rpx; } .contentMes { font-size: 26rpx; color: #666666; line-height: 37rpx; /* padding-top: 20rpx; */ } .imgBg { display: flex; justify-content: flex-start; padding: 30rpx 0rpx; flex-wrap: wrap; } .img { width: 140rpx; height: 140rpx; margin-right: 5rpx; border-radius: 8rpx; } .writeBack { font-size: 26rpx; color: #666666; line-height: 37rpx; padding: 20rpx; background-color: #F4F5F7; padding-bottom: 20rpx; } .noMore { text-align: center; line-height: 50rpx; color: #999999; font-size: 28rpx; } </style>