columnListContent.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <view class="column-list-content-detail">
  3. <block v-if="mySpecialList && mySpecialList.length">
  4. <view class="content-item" v-for="item in mySpecialList" :key="item.Id">
  5. <view class="author-box" @click="goDetailPages(item)">
  6. <image :src="item.HeadImg"></image>
  7. {{ item.NickName }}
  8. </view>
  9. <view class="type-time">
  10. <view class="type">{{ item.Type == 1 ? "笔 记" : "观 点" }} </view>
  11. <view class="time"> {{ item.PublishTime }}</view>
  12. </view>
  13. <view class="title-item global_title"> {{ item.Title }}</view>
  14. <view class="text-conten" v-if="item.Content">
  15. <mp-html :content="richTextSlicing(item.Content)" />
  16. </view>
  17. <view class="look-all-box" v-if="item.Content.length > 80 || item.ContentHasImg">
  18. <view class="look-all" @click="goDetail(item)"> 查看全文 </view>
  19. </view>
  20. <block v-if="item.Docs && item.Docs.length > 0">
  21. <view @click="goFilePages(key)" class="file-item text_oneLine" v-for="(key, index) in item.Docs" :key="index"> <image :src="key.DocIcon"></image>{{ key.DocName }}</view>
  22. </block>
  23. <view class="image-conten">
  24. <image v-for="key in dataProcessing(item.ImgUrl)" :key="key" :src="key" @click="previewImageMediahandler(key)"></image>
  25. </view>
  26. <view class="lable-conten">
  27. <view class="item" v-for="key in dataProcessing(item.Tags)" :key="key">{{ key }}</view>
  28. </view>
  29. <view class="collect-conten">
  30. <image class="user-pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/examine_icon.png"></image>
  31. <view style="margin-right:25rpx">
  32. {{ item.Pv }}
  33. </view>
  34. <image @click="collectHandler(2, item)" v-if="item.IsCollect == 1" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image>
  35. <image @click="collectHandler(1, item)" v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_icon.png"></image>
  36. {{ item.CollectNum }}
  37. </view>
  38. </view>
  39. </block>
  40. <view class="nodata" v-else>
  41. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  42. <view class="nodata-text">还没有发布过内容</view>
  43. </view>
  44. <Loading />
  45. </view>
  46. </template>
  47. <script>
  48. import { purchaserApi } from "@/config/api";
  49. export default {
  50. props: {
  51. authorDetail: {
  52. type: Object,
  53. default: {},
  54. },
  55. mySpecialList: {
  56. type: Array,
  57. default: [],
  58. },
  59. },
  60. data() {
  61. return {};
  62. },
  63. methods: {
  64. previewImageMediahandler(key) {
  65. uni.previewImage({
  66. urls: [key], //查看图片的数组
  67. });
  68. },
  69. // 数据处理
  70. dataProcessing(item) {
  71. return item ? item.split(",") : [];
  72. },
  73. //
  74. richTextSlicing(val) {
  75. let str = val.length >= 80 ? val.slice(0, 80) + " ..." : val;
  76. return str;
  77. },
  78. // 去往详情
  79. goDetail(item) {
  80. uni.navigateTo({ url: "/pages-purchaser/noteAndViewpoint/noteAndViewpoint?id=" + item.Id });
  81. },
  82. // 收藏取消收藏
  83. async collectHandler(type, item) {
  84. await this.$store.dispatch("checkHandle");
  85. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  86. //已授权已绑定
  87. const res = await purchaserApi.yanxuanSpecialCollect({
  88. Id: item.Id,
  89. Status: type,
  90. });
  91. if (res.Ret === 200) {
  92. this.$util.toast(res.Msg);
  93. // item.CollectNum = item.IsCollect == 1 ? item.CollectNum - 1 : item.CollectNum + 1;
  94. // item.IsCollect = item.IsCollect == 1 ? 0 : 1;
  95. this.$emit("upDateCollectHandler", item);
  96. }
  97. }
  98. },
  99. // 去往预览文件
  100. goFilePages(item) {
  101. wx.downloadFile({
  102. // 示例 url,并非真实存在
  103. url: item.DocUrl,
  104. success: function (res) {
  105. const filePath = res.tempFilePath;
  106. wx.openDocument({
  107. filePath: filePath,
  108. });
  109. },
  110. });
  111. },
  112. // 去往专栏详情
  113. goDetailPages(item) {
  114. uni.navigateTo({ url: "/pages-purchaser/columnDetail/columnDetail?id=" + item.UserId });
  115. },
  116. },
  117. };
  118. </script>
  119. <style lang="scss" scope>
  120. .column-list-content-detail {
  121. position: relative;
  122. padding: 50rpx 40rpx;
  123. background: #fff;
  124. .text-conten {
  125. width: 100%;
  126. font-size: 32rpx;
  127. line-height: 40rpx;
  128. }
  129. .introduce-detail {
  130. overflow: hidden;
  131. text-overflow: ellipsis;
  132. text-align: justify;
  133. -webkit-line-clamp: 4;
  134. -webkit-box-orient: vertical;
  135. position: relative;
  136. &.expand {
  137. -webkit-line-clamp: 999;
  138. height: auto;
  139. }
  140. .expan-btn-sl {
  141. position: absolute;
  142. bottom: 0;
  143. right: 0;
  144. background-color: #fff;
  145. padding: 2rpx 0 2rpx 8rpx;
  146. z-index: 9;
  147. }
  148. }
  149. .expan-btn {
  150. margin-top: 15rpx;
  151. color: #2c83ff;
  152. text-align: right;
  153. position: relative;
  154. &.pos {
  155. padding: 0 0 0 40rpx;
  156. background-color: rgba(255, 255, 255, 0.882);
  157. position: absolute;
  158. right: 0;
  159. bottom: 0;
  160. }
  161. }
  162. .content-item {
  163. padding: 40rpx 0;
  164. border-bottom: 1px solid #f0f1f3;
  165. .type-time {
  166. display: flex;
  167. align-items: center;
  168. justify-content: space-between;
  169. color: #666666;
  170. .type {
  171. width: 110rpx;
  172. height: 42rpx;
  173. line-height: 42rpx;
  174. text-align: center;
  175. border-radius: 38rpx;
  176. color: #928563;
  177. background-color: #fff6de;
  178. font-weight: 500;
  179. }
  180. }
  181. .title-item {
  182. margin: 10rpx 0 20rpx;
  183. line-height: 46rpx;
  184. }
  185. .file-item {
  186. width: 100%;
  187. height: 42rpx;
  188. margin: 20rpx 0;
  189. display: flex;
  190. align-items: center;
  191. background-color: #f8f8fa;
  192. color: #376cbb;
  193. image {
  194. width: 27rpx;
  195. height: 27rpx;
  196. margin-right: 15rpx;
  197. }
  198. }
  199. .image-conten {
  200. display: flex;
  201. flex-wrap: wrap;
  202. image {
  203. width: 144rpx;
  204. height: 144rpx;
  205. margin-right: 20rpx;
  206. }
  207. }
  208. .lable-conten {
  209. display: flex;
  210. flex-wrap: wrap;
  211. margin: 20rpx 0;
  212. font-size: 24rpx;
  213. .item {
  214. display: flex;
  215. align-content: center;
  216. height: 34rpx;
  217. border-radius: 44rpx;
  218. padding: 0 35rpx;
  219. background-color: #f0f1f3;
  220. margin: 0 20rpx 20rpx 0;
  221. }
  222. }
  223. .collect-conten {
  224. display: flex;
  225. justify-content: flex-end;
  226. align-items: center;
  227. color: #666666;
  228. image {
  229. width: 27rpx;
  230. height: 26rpx;
  231. margin-right: 8rpx;
  232. }
  233. .user-pv {
  234. width: 30rpx;
  235. height: 30rpx;
  236. }
  237. }
  238. .look-all-box {
  239. display: flex;
  240. justify-content: flex-end;
  241. }
  242. .look-all {
  243. width: 160rpx;
  244. height: 52rpx;
  245. border-radius: 150rpx;
  246. text-align: center;
  247. line-height: 52rpx;
  248. font-size: 28rpx;
  249. color: #fff;
  250. background-color: #376cbb;
  251. margin: 20rpx 0;
  252. }
  253. }
  254. .nodata-text {
  255. color: #999;
  256. text-align: center;
  257. margin-top: -80rpx;
  258. font-size: 24rpx;
  259. }
  260. .author-box {
  261. display: flex;
  262. align-items: center;
  263. margin-bottom: 25rpx;
  264. font-size: 28rpx;
  265. color: #333;
  266. line-height: 40rpx;
  267. image {
  268. display: inline-block;
  269. width: 48rpx;
  270. height: 48rpx;
  271. border-radius: 50%;
  272. margin-right: 10rpx;
  273. overflow: hidden;
  274. }
  275. }
  276. }
  277. </style>