columnListContent.vue 7.1 KB

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