dynamic-items.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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. <view class="data-tag" v-for="tag in item.tag" :style="{'background':tagBg}">
  50. <!-- <image class="data-tag-img" mode="aspectFill" :src="tag.icon" ></image>-->
  51. <view class="data-tag-icon">
  52. <text class="iconfont icon-dingweixiao" v-if="tag.icon==='1'" :style="{'color':tagColor}"> &#xe87e;</text>
  53. <text class="iconfont icon-canyuhuati" v-else :style="{'color':tagColor}"> &#xe61e;</text>
  54. </view>
  55. <view class="data-tag-text sys-weight-400" :style="{'color':tagColor}">{{tag.text}}</view>
  56. </view>
  57. </view>
  58. <view class="data-operation">
  59. <view class="operation-item" @click="setLike(itemIndex)">
  60. <!-- <image class="operation-img" mode="aspectFill" :src="'/static/img/index/like-'+(item.isLike?'ok':'no')+'.png'" ></image>-->
  61. <view class="operation-icon">
  62. <text class="iconfont icon-dianzan" v-if="!item.isLike" :style="{'color':operateColor}"> &#xe8ad;</text>
  63. <text class="iconfont icon-dianzan1" v-else :style="{'color':'#ED301D'}"> &#xe8c3;</text>
  64. </view>
  65. <view class="operation-text sys-weight-400" :style="{'color':operateColor}">{{item.likeNum>0?item.likeNum:'点赞'}}</view>
  66. </view>
  67. <view class="operation-item">
  68. <!-- <image class="operation-img" mode="aspectFill" src="/static/img/index/evaluate.png" ></image>-->
  69. <view class="operation-icon"><text class="iconfont icon-pinglun" :style="{'color':operateColor}">&#xe891;</text></view>
  70. <view class="operation-text sys-weight-400" :style="{'color':operateColor}">{{item.evaluateNum>0?item.evaluateNum:'评论'}}</view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import ImgOne from "@/pages/common/img/img-one";
  79. import ImgTwo from "@/pages/common/img/img-two";
  80. import ImgThree from "@/pages/common/img/img-three";
  81. export default {
  82. name: "dynamic-items",
  83. components: {ImgThree, ImgTwo, ImgOne},
  84. props: {
  85. textColor:{
  86. type:String,
  87. default:'#fff'
  88. },
  89. tagColor:{
  90. type:String,
  91. default:'#282828'
  92. },
  93. tagBg:{
  94. type:String,
  95. default:'rgba(255,255,255,0.4)'
  96. },
  97. operateColor:{
  98. type:String,
  99. default:'#fff'
  100. },
  101. divisionColor:{
  102. type:String,
  103. default:'rgba(255,255,255,0.2)'
  104. },
  105. showAdd:{
  106. type:Boolean,
  107. default:false
  108. },
  109. },
  110. data() {
  111. return {
  112. list:[
  113. {'text':'我是阳光大男孩我','img':['/static/img/temporary/1.png'],'tag':[{'text':'南亭新都会商场','icon':'1'},{'text':'你好认识一哈','icon':'2'}],'likeNum':1,'evaluateNum':0,'isLike':true},
  114. {'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},
  115. {'text':'我是阳光大男孩我','img':[
  116. '/static/img/temporary/1.png',
  117. '/static/img/temporary/3.png',
  118. '/static/img/temporary/2.png',
  119. '/static/img/temporary/1.png',
  120. '/static/img/temporary/3.png',
  121. '/static/img/temporary/2.png',
  122. ],'tag':[{'text':'南亭新都会商场','icon':'1'},{'text':'你好认识一哈','icon':'2'}],'likeNum':10,'evaluateNum':20,'isLike':true},
  123. ]
  124. }
  125. },
  126. watch: {},
  127. mounted() {
  128. },
  129. methods: {
  130. setLike(index){
  131. this.list[index].isLike=!this.list[index].isLike
  132. if(this.list[index].isLike){
  133. ++this.list[index].likeNum
  134. }else {
  135. --this.list[index].likeNum
  136. }
  137. }
  138. }
  139. }
  140. </script>
  141. <style scoped lang="scss">
  142. @import "/static/css/en-iconfont.css";
  143. .dynamic-item-box{
  144. .dynamic-item{
  145. margin-top: 16rpx;
  146. .dynamic-title{
  147. display: flex;
  148. justify-content: space-between;
  149. .dynamic-title-left{
  150. display:table-cell;
  151. vertical-align:bottom;
  152. .dynamic-title-text{
  153. font-size: 28rpx;
  154. }
  155. .dynamic-title-text:first-child{
  156. font-size: 48rpx;
  157. margin-right: 12rpx;
  158. }
  159. }
  160. .dynamic-title-right{
  161. .dynamic-right-img{
  162. width: 6rpx;
  163. height: 26rpx;
  164. }
  165. }
  166. }
  167. .dynamic-data{
  168. margin-left: 26rpx;
  169. border-left: 1rpx solid rgba(255,255,255,0.2);
  170. padding: 4rpx 0 44rpx 40rpx;
  171. .data-issue{
  172. display: flex;
  173. justify-content: space-between;
  174. align-items: center;
  175. height: 92rpx;
  176. .issue-left{
  177. display: flex;
  178. justify-content: flex-start;
  179. .left-one{
  180. border-radius: 8rpx;
  181. height: 92rpx;
  182. width: 92rpx;
  183. margin-right: 22rpx;
  184. }
  185. .left-two{
  186. .two-title{
  187. font-size: 32rpx;
  188. }
  189. .two-text{
  190. font-size: 28rpx;
  191. }
  192. }
  193. }
  194. .issue-right{
  195. border: 2rpx solid #E0E0E0;
  196. border-radius: 200rpx;
  197. padding: 8rpx 24rpx;
  198. font-size: 28rpx;
  199. }
  200. }
  201. .data-text{
  202. .text-item{
  203. font-size: 28rpx;
  204. }
  205. }
  206. .data-img{
  207. margin-top: 30rpx;
  208. }
  209. .data-tag-list{
  210. margin-top: 28rpx;
  211. display: flex;
  212. flex-wrap: wrap;
  213. .data-tag{
  214. margin-top: 26rpx;
  215. margin-right: 20rpx;
  216. border-radius: 200rpx;
  217. background: rgba(255,255,255,0.4);
  218. display: flex;
  219. justify-content: center;
  220. padding: 4rpx 12rpx;
  221. .data-tag-img{
  222. width: 32rpx;
  223. height: 32rpx;
  224. margin-right: 8rpx;
  225. }
  226. .data-tag-icon{
  227. width: 32rpx;
  228. height: 32rpx;
  229. margin-right: 8rpx;
  230. text-align: center;
  231. line-height: 32rpx;
  232. text{
  233. font-size: 28rpx;
  234. line-height: 32rpx;
  235. }
  236. }
  237. .data-tag-text{
  238. font-size: 24rpx;
  239. height: 32rpx;
  240. line-height: 32rpx;
  241. }
  242. }
  243. }
  244. .data-operation{
  245. margin-top: 40rpx;
  246. display: flex;
  247. justify-content: flex-start;
  248. .operation-item{
  249. width: 200rpx;
  250. display: flex;
  251. justify-content: flex-start;
  252. .operation-img{
  253. width: 40rpx;
  254. height: 40rpx;
  255. margin-right: 8rpx;
  256. }
  257. .operation-icon{
  258. width: 40rpx;
  259. height: 40rpx;
  260. margin-right: 8rpx;
  261. text{
  262. font-size: 40rpx;
  263. line-height: 40rpx;
  264. }
  265. }
  266. .operation-text{
  267. height: 40rpx;
  268. line-height: 41rpx;
  269. font-size: 26rpx;
  270. }
  271. }
  272. }
  273. }
  274. }
  275. }
  276. </style>