ReviewList.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!-- List.vue -->
  2. <template>
  3. <view class="div ui-review-list">
  4. <view class="div list" v-for="(item, index) in list" :key="index">
  5. <view class="div content">
  6. <view class="user-info">
  7. <image mode="aspectFit" class="img avatar" :src="item.member_avatar" />
  8. {{ item.geval_isanonymous?'匿名':item.geval_frommembername }}
  9. <text class="span"
  10. v-bind:class="{
  11. 'good-review': item.geval_scores > 3,
  12. 'medium-review': item.geval_scores > 1,
  13. 'bad-review': item.geval_scores == 1
  14. }"
  15. >{{ getGrade(item.geval_scores) }}</text
  16. >
  17. </view>
  18. <text class="addtime">{{ getTime(item.geval_addtime) }}</text>
  19. </view>
  20. <view class="p" v-if="item.geval_content">{{ item.geval_content }}</view>
  21. <view class="p" v-if="!item.geval_content">无评价信息</view>
  22. <view class="div explain" v-if="item.geval_explain">
  23. <view class="div title">掌柜回复</view>
  24. <view class="div mt-5">{{item.geval_explain}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data () {
  32. return {}
  33. },
  34. props: ['list'],
  35. created () {},
  36. methods: {
  37. /*
  38. getGrade: 获取评论的等级
  39. @params: grade 等级
  40. */
  41. getGrade (grade) {
  42. if (grade == 1) {
  43. return '差评'
  44. } else if (grade == 2) {
  45. return '中评'
  46. } else {
  47. return '好评'
  48. }
  49. },
  50. /*
  51. getTime: 获取评论的时间
  52. @params: timestamps 时间戳
  53. */
  54. getTime (timestamps) {
  55. let date = new Date(timestamps * 1000)
  56. let year = date.getFullYear()
  57. let month = date.getMonth() + 1
  58. let day = date.getDate()
  59. return year + '-' + month + '-' + day
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss">
  65. .ui-review-list {
  66. background: rgba(255, 255, 255, 1);
  67. .list {
  68. padding: 0.75rem;
  69. color: #333;
  70. font-size:$h3;
  71. .explain{padding:.5rem;background: #eee;margin-top:.5rem;
  72. .title{color:#333}
  73. }
  74. .content {
  75. overflow: hidden;
  76. padding-bottom: 0.75rem;
  77. display: flex;
  78. justify-content: space-between;
  79. align-content: center;
  80. align-items: center;
  81. .avatar{width:2rem;height: 2rem;border-radius: 50%;margin-right: .3rem;}
  82. .user-info {
  83. display: flex;
  84. justify-content: space-around;
  85. align-content: center;
  86. align-items: center;
  87. .span {
  88. margin-left: 0.75rem;
  89. color: #ffffff;
  90. font-size:$fontSize;
  91. }
  92. .good-review {
  93. background: #fc2e39;
  94. width: 1.8rem;
  95. height: 0.8rem;
  96. text-align: center;
  97. background-size: cover;
  98. line-height: 0.8rem;
  99. border-radius: 0.4rem;
  100. }
  101. .medium-review {
  102. background: $primaryColor;
  103. width: 1.8rem;
  104. height: 0.8rem;
  105. text-align: center;
  106. background-size: cover;
  107. line-height: 0.8rem;
  108. border-radius: 0.4rem;
  109. }
  110. .bad-review {
  111. background: #c3c3c3;
  112. width: 1.8rem;
  113. height: 0.8rem;
  114. text-align: center;
  115. background-size: cover;
  116. line-height: 0.8rem;
  117. border-radius: 0.4rem;
  118. }
  119. }
  120. .addtime {
  121. color: #999999;
  122. font-size:$fontSize;
  123. }
  124. }
  125. .p {
  126. padding: 0;
  127. margin: 0;
  128. flex-basis: 100%;
  129. display: -webkit-box;
  130. -webkit-box-orient: vertical;
  131. -webkit-line-clamp: 2;
  132. overflow: hidden;
  133. }
  134. }
  135. }
  136. </style>