dynamic-item.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div class="dynamic-item-container">
  3. <div class="dynamic-item-avatar">
  4. <img :src="dynamicUserInfo.icon_url" alt="" />
  5. </div>
  6. <div class="dynamic-main">
  7. <div class="dynamic-user-name">{{ dynamicUserInfo.nickname }}</div>
  8. <div class="dynamic-user-login-info" v-if="dynamicUserInfo.tag.length > 0">
  9. <span>{{ dynamicUserInfo.tag[0].name }}</span>
  10. <span v-if="dynamicUserInfo.tag[1]">· {{ dynamicUserInfo.tag[1].name }}</span>
  11. </div>
  12. <p class="dynamic-content">
  13. {{ info.title }}
  14. </p>
  15. <!-- <div class="dynamic-more">
  16. 展开
  17. </div> -->
  18. <div class="dynamic-link" @click.capture.stop="clickResource(dynamicResources)" v-if="dynamicResources.resources_status == 1">
  19. <div class="dynamic-link-content">
  20. <p class="dynamic-link-title">
  21. {{ dynamicResources.resources_title }}
  22. </p>
  23. <p class="dynamic-link-herf">{{ dynamicResources.resources_url }}</p>
  24. </div>
  25. <div class="dynamic-link-img">
  26. <img :src="dynamicResources.resources_img" alt="" />
  27. </div>
  28. </div>
  29. <div class="dynamic-images" v-if="dynamicImg.length > 0">
  30. <div v-for="(item, index) in dynamicImg" :key="index" class="dynamic-image-item">
  31. <el-image style="width:90px;height:90px" fit="cover" :src="item.img" :preview-src-list="dynamicImgBig">
  32. </el-image>
  33. </div>
  34. </div>
  35. <div class="dynamic-type">
  36. {{ info.type_text }}
  37. </div>
  38. <div class="dynamic-operation">
  39. <div class="dynamic-operation-btn share" @click="gotoAppTips">分享</div>
  40. <div class="dynamic-operation-btn like" @click="gotoAppTips">点赞</div>
  41. <div class="dynamic-operation-btn comment" @click="gotoAppTips">
  42. 评论
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. export default {
  50. props: ["info"],
  51. computed: {
  52. dynamicUserInfo() {
  53. return this.info.user_info || {};
  54. },
  55. dynamicResources() {
  56. return this.info.resources || {};
  57. },
  58. dynamicImg() {
  59. return this.info.img || [];
  60. },
  61. dynamicImgBig() {
  62. let imgList = this.info.img || [];
  63. imgList = imgList.map(item => {
  64. return item.img
  65. })
  66. return imgList
  67. }
  68. },
  69. methods: {
  70. gotoAppTips() {
  71. this.checkLogin(true);
  72. this.$message("请前往APP查看");
  73. },
  74. clickResource(resources){
  75. if(resources.resources_status != 1){
  76. this.$message.info(resources.resources_text)
  77. }else{
  78. location.href = resources.resources_url
  79. }
  80. },
  81. }
  82. };
  83. </script>
  84. <style lang="scss" scoped>
  85. .dynamic-item-container {
  86. padding: 29px 24px 16px;
  87. border-bottom: 1px solid #ebeced;
  88. display: flex;
  89. // &:nth-last-child(1) {
  90. // border-bottom: none;
  91. // }
  92. }
  93. .dynamic-item-avatar {
  94. width: 24px;
  95. height: 24px;
  96. margin-right: 10px;
  97. img {
  98. width: 100%;
  99. height: 100%;
  100. border-radius: 100%;
  101. }
  102. }
  103. .dynamic-main {
  104. flex: 1;
  105. }
  106. .dynamic-user-name {
  107. font-size: 14px;
  108. font-family: PingFangSC-Medium, PingFang SC;
  109. font-weight: 500;
  110. color: #0b121a;
  111. line-height: 20px;
  112. }
  113. .dynamic-user-login-info {
  114. margin-top: 3px;
  115. font-size: 12px;
  116. font-family: PingFangSC-Regular, PingFang SC;
  117. font-weight: 400;
  118. color: #828c99;
  119. line-height: 17px;
  120. }
  121. .dynamic-content {
  122. margin-top: 12px;
  123. font-size: 14px;
  124. font-family: PingFangSC-Regular, PingFang SC;
  125. font-weight: 400;
  126. color: #0b111a;
  127. line-height: 21px;
  128. margin-bottom: 16px;
  129. }
  130. .dynamic-more {
  131. margin-top: 6px;
  132. font-size: 14px;
  133. font-family: PingFangSC-Regular, PingFang SC;
  134. font-weight: 400;
  135. color: #308eff;
  136. line-height: 21px;
  137. }
  138. .dynamic-link {
  139. margin-top: 16px;
  140. background: #f7f8fa;
  141. padding: 12px 14px;
  142. display: flex;
  143. margin-bottom: 16px;
  144. cursor: pointer;
  145. }
  146. .dynamic-link-content {
  147. flex: 1;
  148. }
  149. .dynamic-link-title {
  150. font-size: 16px;
  151. font-family: PingFangSC-Medium, PingFang SC;
  152. font-weight: 500;
  153. color: #0b111a;
  154. line-height: 21px;
  155. }
  156. .dynamic-link-herf {
  157. margin-top: 21px;
  158. font-size: 14px;
  159. font-family: PingFangSC-Regular, PingFang SC;
  160. font-weight: 400;
  161. color: #828c99;
  162. line-height: 20px;
  163. }
  164. .dynamic-link-img {
  165. width: 66px;
  166. height: 66px;
  167. margin-left: 20px;
  168. img {
  169. width: 100%;
  170. height: 100%;
  171. }
  172. }
  173. .dynamic-images {
  174. display: flex;
  175. // justify-content: space-between;
  176. flex-wrap: wrap;
  177. }
  178. .dynamic-image-item {
  179. width: 90px;
  180. height: 90px;
  181. margin-right: 10px;
  182. margin-bottom: 16px;
  183. img {
  184. width: 100%;
  185. height: 100%;
  186. }
  187. }
  188. .dynamic-type {
  189. margin-top: 16px;
  190. width: 80px;
  191. height: 23px;
  192. background: #ebf4ff;
  193. border-radius: 12px;
  194. text-align: center;
  195. line-height: 23px;
  196. font-size: 12px;
  197. font-family: PingFangSC-Regular, PingFang SC;
  198. font-weight: 400;
  199. color: #288bff;
  200. }
  201. .dynamic-operation {
  202. display: flex;
  203. margin-top: 26px;
  204. justify-content: space-around;
  205. }
  206. .dynamic-operation-btn {
  207. // flex: 1;
  208. font-size: 14px;
  209. font-family: PingFangSC-Regular, PingFang SC;
  210. font-weight: 400;
  211. color: #333333;
  212. line-height: 20px;
  213. padding-left: 26px;
  214. background-size: auto 100%;
  215. background-repeat: no-repeat;
  216. background-position: left center;
  217. cursor: pointer;
  218. &.share {
  219. background-image: url("~@/assets/img/frontend/personal/share.png");
  220. }
  221. &.like {
  222. background-image: url("~@/assets/img/frontend/personal/like2.png");
  223. }
  224. &.comment {
  225. background-image: url("~@/assets/img/frontend/personal/comment2.png");
  226. }
  227. }
  228. </style>