my-praise.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view class="my-praise-box">
  3. <view class="praise-item" v-for="(item,itemIndex) in list">
  4. <view class="praise-left">
  5. <image class="praise-head" src="/static/img/temporary/3.png" mode="aspectFill"></image>
  6. </view>
  7. <view class="praise-right">
  8. <view class="right-name sys-color-black sys-weight-600">
  9. WWWWW
  10. </view>
  11. <view class="right-time sys-color-gray-9 sys-weight-400">
  12. 2021-04-18 15:53发布.<100m
  13. </view>
  14. <view class="right-text sys-color-black sys-weight-400">
  15. 我是阳光大男孩
  16. </view>
  17. <view class="right-img">
  18. <view class="one-img" v-if="item.img.length===1">
  19. <img-one :file-list="item.img"></img-one>
  20. </view>
  21. <view class="two-img" v-else-if="item.img.length===2 || item.img.length===4">
  22. <img-two :file-list="item.img"></img-two>
  23. </view>
  24. <view class="three-img" v-else>
  25. <img-three :file-list="item.img"></img-three>
  26. </view>
  27. </view>
  28. <view class="right-tag-list" >
  29. <dynamic-tag :list="item.tag" :tag-bg="tagBg" :tag-color="tagColor"></dynamic-tag>
  30. </view>
  31. <view class="right-operation-list">
  32. <view class="operation-share">
  33. <view class="operation-item">
  34. <view class="operation-icon"><text class="iconfont" :style="{'color':operateColor}">&#xe624;</text></view>
  35. <view class="operation-text sys-weight-400" :style="{'color':operateColor}">分享</view>
  36. </view>
  37. </view>
  38. <view class="operation-items">
  39. <view class="operation-item">
  40. <view class="operation-icon" @click="setLike(itemIndex)">
  41. <text class="iconfont icon-dianzan" v-if="!item.isLike" :style="{'color':operateColor}"> &#xe8ad;</text>
  42. <text class="iconfont icon-dianzan1" v-else :style="{'color':'#ED301D'}"> &#xe8c3;</text>
  43. </view>
  44. <view class="operation-text sys-weight-400" :style="{'color':operateColor}">{{item.likeNum>0?item.likeNum:'点赞'}}</view>
  45. </view>
  46. <view class="operation-item">
  47. <view class="operation-icon"><text class="iconfont icon-pinglun" :style="{'color':operateColor}">&#xe891;</text></view>
  48. <view class="operation-text sys-weight-400" :style="{'color':operateColor}">{{item.evaluateNum>0?item.evaluateNum:'评论'}}</view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import ImgOne from "@/pages/common/img/img-one";
  58. import ImgTwo from "@/pages/common/img/img-two";
  59. import ImgThree from "@/pages/common/img/img-three";
  60. import DynamicTag from "@/pages/common/tag/dynamic-tag";
  61. export default {
  62. name: "my-praise",
  63. components: {DynamicTag, ImgThree, ImgTwo, ImgOne},
  64. props: {},
  65. data() {
  66. return {
  67. tagBg:'#F2F2F2',
  68. tagColor:'#999999',
  69. operateColor:'#999999',
  70. list:[
  71. {'text':'我是阳光大男孩我','img':['/static/img/temporary/1.png'],'tag':[{'text':'南亭新都会商场','icon':'1'},{'text':'你好认识一哈','icon':'2'}],'likeNum':1,'evaluateNum':0,'isLike':true},
  72. {'text':'我是阳光大男孩我','img':['/static/img/temporary/1.png','/static/img/temporary/2.png','/static/img/temporary/3.png','/static/img/temporary/2.png'],'tag':[{'text':'南亭新都会商场','icon':'1'},{'text':'你好认识一哈','icon':'2'}],'likeNum':0,'evaluateNum':20,'isLike':false},
  73. {'text':'我是阳光大男孩我','img':[
  74. '/static/img/temporary/1.png',
  75. '/static/img/temporary/3.png',
  76. '/static/img/temporary/2.png',
  77. '/static/img/temporary/1.png',
  78. '/static/img/temporary/3.png',
  79. '/static/img/temporary/2.png',
  80. ],'tag':[{'text':'南亭新都会商场','icon':'1'},{'text':'你好认识一哈','icon':'2'}],'likeNum':10,'evaluateNum':20,'isLike':true},
  81. ]
  82. }
  83. },
  84. watch: {},
  85. mounted() {
  86. },
  87. methods: {
  88. setLike(index){
  89. this.list[index].isLike=!this.list[index].isLike
  90. if(this.list[index].isLike){
  91. ++this.list[index].likeNum
  92. }else {
  93. --this.list[index].likeNum
  94. }
  95. }
  96. }
  97. }
  98. </script>
  99. <style scoped lang="scss">
  100. .my-praise-box{
  101. .praise-item{
  102. margin : 40rpx 0 4rpx 0;
  103. border-bottom: 1rpx solid #F2F2F2;
  104. display: flex;
  105. justify-content: space-between;
  106. .praise-left{
  107. width: 80rpx;
  108. .praise-head{
  109. width: 80rpx;
  110. height: 80rpx;
  111. border-radius: 60rpx;
  112. }
  113. }
  114. .praise-right{
  115. width: calc(100% - 80rpx);
  116. padding-left: 22rpx;
  117. .right-name{
  118. height: 40rpx;
  119. line-height: 40rpx;
  120. font-size: 32rpx;
  121. }
  122. .right-time{
  123. margin-top: 8rpx;
  124. font-size: 24rpx;
  125. height: 34rpx;
  126. line-height: 34rpx;
  127. }
  128. .right-text{
  129. margin-top: 24rpx;
  130. font-size: 28rpx;
  131. height: 40rpx;
  132. line-height: 40rpx;
  133. }
  134. .right-img{
  135. margin-top: 16rpx;
  136. }
  137. .right-tag-list{
  138. margin-top: 8rpx;
  139. }
  140. .right-operation-list{
  141. margin-top: 44rpx;
  142. padding-bottom: 42rpx;
  143. display: flex;
  144. justify-content: space-between;
  145. .operation-share{
  146. .operation-item:first-child{
  147. .operation-icon{
  148. text{
  149. font-size: 30rpx;
  150. }
  151. }
  152. }
  153. }
  154. .operation-items{
  155. display: flex;
  156. justify-content: flex-start;
  157. .operation-item:first-child{
  158. .operation-text{
  159. width: 100rpx;
  160. }
  161. }
  162. .operation-item:last-child{
  163. .operation-text{
  164. width: 80rpx;
  165. }
  166. }
  167. }
  168. .operation-item{
  169. display: flex;
  170. justify-content: flex-start;
  171. .operation-icon{
  172. width: 40rpx;
  173. height: 40rpx;
  174. margin-right: 8rpx;
  175. text{
  176. font-size: 40rpx;
  177. line-height: 40rpx;
  178. }
  179. }
  180. .operation-text{
  181. height: 40rpx;
  182. line-height: 41rpx;
  183. font-size: 26rpx;
  184. }
  185. }
  186. }
  187. }
  188. }
  189. }
  190. </style>