yj
2024-12-05 ac3234c308e86f20cc63465573f321561ee00690
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<template>
  <view>
    <view class="eva-section">
      <view class="e-header">
        <text class="tit">
          评价
        </text>
        <text>({{ page.count }})</text>
      </view>
 
      <view v-for="(item,index) in page.items" :key="index" class="eva-box">
        <image class="portrait" :src="item.userAvatarUrl ? item.userAvatarUrl : '/static/missing-face.png'" mode="aspectFill" />
        <view class="right">
          <text class="name">
            {{ item.userNickName?item.userNickName:('用户' + item.userId) }}
          </text>
          <text class="con">
            {{ item.content }}
          </text>
          <view v-if="item.imgList && item.imgList.length > 0" class="imgs">
            <image v-for="(imgItem, imgIndex) in item.imgList" :key="imgIndex" class="ig" :src="imgItem + style(200)" @click="previewImg(item.imgList, imgIndex)" />
          </view>
          <view class="bot">
            <text class="attr">
              购买类型:{{ item.skuTitle }}
            </text>
            <text class="time">
              {{ item.gmtCreate }}
            </text>
          </view>
        </view>
      </view>
    </view>
    <!-- #ifndef MP-ALIPAY -->
    <uni-load-more :status="loadingType" />
    <!-- #endif -->
  </view>
</template>
 
<script>
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'
export default {
  components: {
    uniLoadMore
  },
  data() {
    return {
      style: this.$api.style,
      page: {},
      spuId: undefined,
      loadingType: 'more'
    }
  },
  onLoad(option) {
    this.page = JSON.parse(option.firstpage)
    this.spuId = option.spuid
    this.loadingType = this.page.pageNo < this.page.totalPageNo ? 'more' : 'nomore'
  },
  onReachBottom(e) {
    const that = this
    if (that.loadingType === 'more') {
      that.loadingType = 'loading'
      that.$api.request('appraise', 'getSpuAppraisePage', {
        spuId: that.spuId,
        pageNo: that.page.pageNo + 1,
        pageSize: 10
      }).then(res => {
        that.page.items = that.page.items.concat(res.data.items)
        that.page.pageNo = res.data.pageNo
        that.loadingType = res.data.pageNo < res.data.totalPageNo ? 'more' : 'nomore'
      })
    }
  },
  methods: {
    previewImg(imgs, index) {
      uni.previewImage({
        current: index,
        urls: imgs
      })
    }
  }
}
</script>
 
<style lang="scss">
    /* 评价 */
    .eva-section {
        display: flex;
        flex-direction: column;
        padding: 20upx 30upx;
        background: #fff;
        margin-top: 16upx;
 
        .e-header {
            display: flex;
            align-items: center;
            height: 70upx;
            font-size: $font-sm + 2upx;
            color: $font-color-light;
 
            .tit {
                font-size: $font-base + 2upx;
                color: $font-color-dark;
                margin-right: 4upx;
            }
 
            .tip {
                flex: 1;
                text-align: right;
            }
 
            .icon-you {
                margin-left: 10upx;
            }
        }
    }
 
    .eva-box {
        display: flex;
        padding: 20upx 0;
 
        .portrait {
            flex-shrink: 0;
            width: 80upx;
            height: 80upx;
            border-radius: 100px;
        }
 
        .right {
            flex: 1;
            display: flex;
            flex-direction: column;
            font-size: $font-base;
            color: $font-color-base;
            padding-left: 26upx;
 
            .con {
                font-size: $font-base;
                color: $font-color-dark;
                padding: 20upx 0;
            }
 
            .imgs {
                padding: 20upx 0;
 
                .ig {
                    width: 190upx;
                    height: 190upx;
                    padding:4upx;
                }
            }
 
            .bot {
                display: flex;
                justify-content: space-between;
                font-size: $font-sm;
                color: $font-color-light;
            }
        }
    }
</style>