topicCell.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <div class="topicCell" :class="{topicCellMobile: mobile}" @click="clickArt(art, index)" :style="{marginLeft:
  3. left+'px'}">
  4. <div class="leftArea" :class="{noePic: !art.cover_url}">
  5. <div class="topicTitle">
  6. {{art.title}}
  7. </div>
  8. <div class="bottomArea">
  9. <div class="left" >
  10. <div class="userInfo">
  11. <img :src="info.icon_url || info.iconUrl">
  12. <div>{{info.nickname}}</div>
  13. </div>
  14. <div class="publishTime">
  15. <div>{{formatPublichTime(art.updated_at)}}</div>
  16. </div>
  17. </div>
  18. <div class="right">
  19. <div class="zan">
  20. <div class="icon"/>
  21. <div class="num">{{art.like_count}}</div>
  22. </div>
  23. <div class="comment">
  24. <div class="icon" />
  25. <div class="num">{{art.reply_count}}</div>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="rightArea" v-if="art.cover_url">
  31. <img :src="art.cover_url">
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. export default {
  37. props: [ "art", "formatPublichTime", "mobile", "info", 'left' ],
  38. components: {},
  39. data() {
  40. return {
  41. }
  42. },
  43. computed: {},
  44. created() {
  45. },
  46. mounted() {
  47. },
  48. methods: {
  49. /**
  50. * 点击文章
  51. */
  52. clickArt(art, index) {
  53. location.href = `/p/${art.hash_id}`;
  54. },
  55. }
  56. };
  57. </script>
  58. <style lang="scss" scoped>
  59. @import "../../../assets/css/scssCommon.scss";
  60. .topicCell {
  61. margin: 0 auto;
  62. width:738px;
  63. height:174px;
  64. background:rgba(255,255,255,1);
  65. box-shadow:0px 0px 0px 0px rgba(0,0,0,0.1);
  66. display: flex;
  67. justify-content: space-between;
  68. align-items: center;
  69. box-sizing: border-box;
  70. padding: 30px 20px;
  71. .leftArea {
  72. width: 528px;
  73. height: 114px;
  74. display: flex;
  75. justify-content: space-between;
  76. align-items: left;
  77. flex-direction: column;
  78. &.noePic {
  79. width: 100%;
  80. padding-right: 0;
  81. }
  82. .topicTitle {
  83. height: 50px;
  84. font-size: 18px;
  85. font-weight:600;
  86. color:rgba(51,51,51,1);
  87. line-height: 25px;
  88. width: 100%;
  89. text-align: left;
  90. overflow: hidden;
  91. text-overflow: ellipsis;
  92. display: -webkit-box;
  93. -webkit-box-orient: vertical;
  94. -webkit-line-clamp: 2;
  95. word-break: break-all;
  96. }
  97. .bottomArea {
  98. width: 100%;
  99. display: flex;
  100. justify-content: flex-start;
  101. align-items: center;
  102. .left {
  103. display: flex;
  104. align-items: center;
  105. .userInfo {
  106. display: flex;
  107. align-items: center;
  108. img {
  109. width: 24px;
  110. height: 24px;
  111. border-radius: 50%;
  112. }
  113. div {
  114. margin-left: 4px;
  115. height:17px;
  116. font-size:12px;
  117. font-weight:500;
  118. color:rgba(34,34,34,1);
  119. line-height:17px;
  120. }
  121. }
  122. .publishTime {
  123. margin-left: 10px;
  124. padding-left: 10px;
  125. height:17px;
  126. font-size:12px;
  127. font-weight:400;
  128. color:rgba(218,218,218,1);
  129. line-height:17px;
  130. border-left: 1px solid #ededed;
  131. /*transform-origin:left center;*/
  132. /*transform: scale(0.83);*/
  133. word-break: keep-all;
  134. white-space: nowrap;
  135. }
  136. }
  137. .right {
  138. display: flex;
  139. align-items: center;
  140. justify-content: flex-start;
  141. .zan, .comment {
  142. margin-left: 23px;
  143. display: flex;
  144. align-items: center;
  145. .icon {
  146. width: 16px;
  147. height: 16px;
  148. background: url("~@/assets/quan/icon/zan.png") no-repeat;
  149. background-size: cover;
  150. }
  151. .num {
  152. margin-left: 1px;
  153. height:18px;
  154. font-size:13px;
  155. font-weight:500;
  156. color:rgba(153,153,153,1);
  157. line-height:18px;
  158. word-break: keep-all;
  159. white-space: nowrap;
  160. }
  161. }
  162. .comment {
  163. margin-left: 12px;
  164. .icon {
  165. background: url("~@/assets/quan/icon/common.png") no-repeat;
  166. background-size: cover;
  167. }
  168. }
  169. }
  170. }
  171. }
  172. .rightArea {
  173. flex-shrink: 0;
  174. font-size: 0;
  175. width:154px;
  176. height:114px;
  177. img {
  178. width:154px;
  179. height:114px;
  180. border-radius:2px;
  181. }
  182. }
  183. }
  184. .topicCellMobile {
  185. margin: 0 auto;
  186. width: pxtovw(355);
  187. height: pxtovw(118);
  188. display: flex;
  189. justify-content: space-between;
  190. align-items: center;
  191. box-sizing: border-box;
  192. padding: pxtovw(10) 0 pxtovw(19) 0;
  193. .leftArea {
  194. width: pxtovw(226);
  195. height: pxtovw(89);
  196. display: flex;
  197. justify-content: space-between;
  198. align-items: left;
  199. flex-direction: column;
  200. &.noePic {
  201. width: 100%;
  202. padding-right: 0;
  203. }
  204. .topicTitle {
  205. height: pxtovw(42);
  206. font-size:pxtovw(14);
  207. font-weight:600;
  208. color:rgba(51,51,51,1);
  209. line-height:pxtovw(21);
  210. width: 100%;
  211. text-align: left;
  212. overflow: hidden;
  213. text-overflow: ellipsis;
  214. display: -webkit-box;
  215. -webkit-box-orient: vertical;
  216. -webkit-line-clamp: 2;
  217. word-break: break-all;
  218. }
  219. .bottomArea {
  220. width: 100%;
  221. display: flex;
  222. justify-content: space-between;
  223. align-items: center;
  224. .left {
  225. display: flex;
  226. align-items: center;
  227. .userInfo {
  228. display: flex;
  229. align-items: center;
  230. img {
  231. width: pxtovw(17);
  232. height: pxtovw(17);
  233. border-radius: 50%;
  234. }
  235. div {
  236. margin-left: pxtovw(5);
  237. height:pxtovw(14);
  238. font-size:pxtovw(10);
  239. font-weight:500;
  240. color:rgba(102,102,102,1);
  241. line-height:pxtovw(14);
  242. transform-origin:left center;
  243. transform: scale(0.83);
  244. word-break: keep-all;
  245. white-space: nowrap;
  246. }
  247. }
  248. .publishTime {
  249. margin-left: pxtovw(4);
  250. padding-left: pxtovw(10);
  251. height:pxtovw(14);
  252. font-size:pxtovw(10);
  253. font-weight:400;
  254. color:rgba(218,218,218,1);
  255. line-height:pxtovw(14);
  256. border-left: 1px solid #ededed;
  257. transform-origin:left center;
  258. transform: scale(0.83);
  259. word-break: keep-all;
  260. white-space: nowrap;
  261. max-width: pxtovw(80);
  262. }
  263. }
  264. .right {
  265. display: flex;
  266. align-items: center;
  267. justify-content: flex-end;
  268. .zan, .comment {
  269. display: flex;
  270. align-items: center;
  271. .icon {
  272. width: pxtovw(13);
  273. height: pxtovw(13);
  274. background: url("~@/assets/quan/icon/zan.png") no-repeat;
  275. background-size: cover;
  276. }
  277. .num {
  278. margin-left: pxtovw(2);
  279. font-size:10px;
  280. font-weight:500;
  281. color:rgba(153,153,153,1);
  282. line-height:14px;
  283. transform-origin:left center;
  284. transform: scale(0.83);
  285. word-break: keep-all;
  286. white-space: nowrap;
  287. }
  288. }
  289. .comment {
  290. margin-left: pxtovw(8);
  291. .icon {
  292. background: url("~@/assets/quan/icon/common.png") no-repeat;
  293. background-size: cover;
  294. }
  295. }
  296. }
  297. }
  298. }
  299. .rightArea {
  300. flex-shrink: 0;
  301. font-size: 0;
  302. width: pxtovw(120);
  303. height: pxtovw(89);
  304. img {
  305. width: pxtovw(120);
  306. height: pxtovw(89);
  307. }
  308. }
  309. }
  310. </style>