appraise.vue 3.7 KB

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