dynamic-items.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="dynamic-item-box">
  3. <view class="dynamic-item" v-show="showAdd">
  4. <view class="dynamic-title">
  5. <view class="dynamic-title-left">
  6. <text class="dynamic-title-text sys-weight-600" :style="{'color':textColor}">今天</text>
  7. </view>
  8. </view>
  9. <view class="dynamic-data" :style="{'border-left':' 1rpx solid '+divisionColor}">
  10. <view class="data-issue">
  11. <view class="issue-left">
  12. <image class="left-one" mode="aspectFill" src="/static/img/temporary/2.png" ></image>
  13. <view class="left-two">
  14. <view class="two-title sys-color-black sys-weight-600">发布动态</view>
  15. <view class="two-text sys-color-gray-9">认识更多朋友</view>
  16. </view>
  17. </view>
  18. <view class="issue-right sys-color-black sys-weight-600">去发布</view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="dynamic-item" v-for="(item,itemIndex) in list">
  23. <view class="dynamic-title">
  24. <view class="dynamic-title-left">
  25. <text class="dynamic-title-text sys-weight-600" :style="{'color':textColor}">12</text>
  26. <text class="dynamic-title-text sys-weight-400" :style="{'color':textColor}">04月</text>
  27. <text class="dynamic-title-text sys-weight-400" :style="{'color':textColor}">2020年</text>
  28. </view>
  29. <view class="dynamic-title-right">
  30. <image class="dynamic-right-img" mode="aspectFill" src="/static/img/index/dynamic-all.png" ></image>
  31. </view>
  32. </view>
  33. <view class="dynamic-data" :style="{'border-left':' 1rpx solid '+divisionColor}">
  34. <view class="data-text">
  35. <text class="text-item" :style="{'color':textColor}">{{item.text}}</text>
  36. </view>
  37. <view class="data-img" v-if="item.img.length>0">
  38. <view class="one-img" v-if="item.img.length===1">
  39. <img-one :file-list="item.img"></img-one>
  40. </view>
  41. <view class="two-img" v-else-if="item.img.length===2 || item.img.length===4">
  42. <img-two :file-list="item.img"></img-two>
  43. </view>
  44. <view class="three-img" v-else>
  45. <img-three :file-list="item.img"></img-three>
  46. </view>
  47. </view>
  48. <view class="data-tag-list" >
  49. <dynamic-tag :list="item.tag" :tag-bg="tagBg" :tag-color="tagColor"></dynamic-tag>
  50. </view>
  51. <view class="data-operation">
  52. <view class="operation-item" @click="setLike(itemIndex)">
  53. <!-- <image class="operation-img" mode="aspectFill" :src="'/static/img/index/like-'+(item.isLike?'ok':'no')+'.png'" ></image>-->
  54. <view class="operation-icon">
  55. <text class="iconfont icon-dianzan" v-if="!item.isLike" :style="{'color':operateColor}"> &#xe8ad;</text>
  56. <text class="iconfont icon-dianzan1" v-else :style="{'color':'#ED301D'}"> &#xe8c3;</text>
  57. </view>
  58. <view class="operation-text sys-weight-400" :style="{'color':operateColor}">{{item.likeNum>0?item.likeNum:'点赞'}}</view>
  59. </view>
  60. <view class="operation-item">
  61. <!-- <image class="operation-img" mode="aspectFill" src="/static/img/index/evaluate.png" ></image>-->
  62. <view class="operation-icon"><text class="iconfont icon-pinglun" :style="{'color':operateColor}">&#xe891;</text></view>
  63. <view class="operation-text sys-weight-400" :style="{'color':operateColor}">{{item.evaluateNum>0?item.evaluateNum:'评论'}}</view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import ImgOne from "@/pages/common/img/img-one";
  72. import ImgTwo from "@/pages/common/img/img-two";
  73. import ImgThree from "@/pages/common/img/img-three";
  74. import DynamicTag from "@/pages/common/tag/dynamic-tag";
  75. export default {
  76. name: "dynamic-items",
  77. components: {DynamicTag, ImgThree, ImgTwo, ImgOne},
  78. props: {
  79. textColor:{
  80. type:String,
  81. default:'#fff'
  82. },
  83. tagColor:{
  84. type:String,
  85. default:'#282828'
  86. },
  87. tagBg:{
  88. type:String,
  89. default:'rgba(255,255,255,0.4)'
  90. },
  91. operateColor:{
  92. type:String,
  93. default:'#fff'
  94. },
  95. divisionColor:{
  96. type:String,
  97. default:'rgba(255,255,255,0.2)'
  98. },
  99. showAdd:{
  100. type:Boolean,
  101. default:false
  102. },
  103. },
  104. data() {
  105. return {
  106. list:[
  107. {'text':'我是阳光大男孩我','img':['/static/img/temporary/1.png'],'tag':[{'text':'南亭新都会商场','icon':'1'},{'text':'你好认识一哈','icon':'2'}],'likeNum':1,'evaluateNum':0,'isLike':true},
  108. {'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},
  109. {'text':'我是阳光大男孩我','img':[
  110. '/static/img/temporary/1.png',
  111. '/static/img/temporary/3.png',
  112. '/static/img/temporary/2.png',
  113. '/static/img/temporary/1.png',
  114. '/static/img/temporary/3.png',
  115. '/static/img/temporary/2.png',
  116. ],'tag':[{'text':'南亭新都会商场','icon':'1'},{'text':'你好认识一哈','icon':'2'}],'likeNum':10,'evaluateNum':20,'isLike':true},
  117. ]
  118. }
  119. },
  120. watch: {},
  121. mounted() {
  122. },
  123. methods: {
  124. setLike(index){
  125. this.list[index].isLike=!this.list[index].isLike
  126. if(this.list[index].isLike){
  127. ++this.list[index].likeNum
  128. }else {
  129. --this.list[index].likeNum
  130. }
  131. }
  132. }
  133. }
  134. </script>
  135. <style scoped lang="scss">
  136. @import "/static/css/en-iconfont.css";
  137. .dynamic-item-box{
  138. .dynamic-item{
  139. margin-top: 16rpx;
  140. .dynamic-title{
  141. display: flex;
  142. justify-content: space-between;
  143. .dynamic-title-left{
  144. display:table-cell;
  145. vertical-align:bottom;
  146. .dynamic-title-text{
  147. font-size: 28rpx;
  148. }
  149. .dynamic-title-text:first-child{
  150. font-size: 48rpx;
  151. margin-right: 12rpx;
  152. }
  153. }
  154. .dynamic-title-right{
  155. .dynamic-right-img{
  156. width: 6rpx;
  157. height: 26rpx;
  158. }
  159. }
  160. }
  161. .dynamic-data{
  162. margin-left: 26rpx;
  163. border-left: 1rpx solid rgba(255,255,255,0.2);
  164. padding: 4rpx 0 44rpx 40rpx;
  165. .data-issue{
  166. display: flex;
  167. justify-content: space-between;
  168. align-items: center;
  169. height: 92rpx;
  170. .issue-left{
  171. display: flex;
  172. justify-content: flex-start;
  173. .left-one{
  174. border-radius: 8rpx;
  175. height: 92rpx;
  176. width: 92rpx;
  177. margin-right: 22rpx;
  178. }
  179. .left-two{
  180. .two-title{
  181. font-size: 32rpx;
  182. }
  183. .two-text{
  184. font-size: 28rpx;
  185. }
  186. }
  187. }
  188. .issue-right{
  189. border: 2rpx solid #E0E0E0;
  190. border-radius: 200rpx;
  191. padding: 8rpx 24rpx;
  192. font-size: 28rpx;
  193. }
  194. }
  195. .data-text{
  196. .text-item{
  197. font-size: 28rpx;
  198. }
  199. }
  200. .data-img{
  201. margin-top: 30rpx;
  202. }
  203. .data-tag-list{
  204. margin-top: 28rpx;
  205. }
  206. .data-operation{
  207. margin-top: 40rpx;
  208. display: flex;
  209. justify-content: flex-start;
  210. .operation-item{
  211. width: 200rpx;
  212. display: flex;
  213. justify-content: flex-start;
  214. .operation-img{
  215. width: 40rpx;
  216. height: 40rpx;
  217. margin-right: 8rpx;
  218. }
  219. .operation-icon{
  220. width: 40rpx;
  221. height: 40rpx;
  222. margin-right: 8rpx;
  223. text{
  224. font-size: 40rpx;
  225. line-height: 40rpx;
  226. }
  227. }
  228. .operation-text{
  229. height: 40rpx;
  230. line-height: 41rpx;
  231. font-size: 26rpx;
  232. }
  233. }
  234. }
  235. }
  236. }
  237. }
  238. </style>