columnListContent.vue 6.8 KB

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