columnListContent.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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. success: function (res) {
  105. console.log("打开文档成功");
  106. },
  107. });
  108. },
  109. });
  110. },
  111. // 去往专栏详情
  112. goDetailPages(item) {
  113. uni.navigateTo({ url: "/pages-purchaser/columnDetail/columnDetail?id=" + item.UserId });
  114. },
  115. },
  116. };
  117. </script>
  118. <style lang="scss" scope>
  119. .column-list-content-detail {
  120. position: relative;
  121. padding: 50rpx 40rpx;
  122. background: #fff;
  123. .text-conten {
  124. width: 100%;
  125. font-size: 32rpx;
  126. line-height: 40rpx;
  127. }
  128. .introduce-detail {
  129. overflow: hidden;
  130. text-overflow: ellipsis;
  131. text-align: justify;
  132. -webkit-line-clamp: 4;
  133. -webkit-box-orient: vertical;
  134. position: relative;
  135. &.expand {
  136. -webkit-line-clamp: 999;
  137. height: auto;
  138. }
  139. .expan-btn-sl {
  140. position: absolute;
  141. bottom: 0;
  142. right: 0;
  143. background-color: #fff;
  144. padding: 2rpx 0 2rpx 8rpx;
  145. z-index: 9;
  146. }
  147. }
  148. .expan-btn {
  149. margin-top: 15rpx;
  150. color: #2c83ff;
  151. text-align: right;
  152. position: relative;
  153. &.pos {
  154. padding: 0 0 0 40rpx;
  155. background-color: rgba(255, 255, 255, 0.882);
  156. position: absolute;
  157. right: 0;
  158. bottom: 0;
  159. }
  160. }
  161. .content-item {
  162. padding: 40rpx 0;
  163. border-bottom: 1px solid #f0f1f3;
  164. .type-time {
  165. display: flex;
  166. align-items: center;
  167. justify-content: space-between;
  168. color: #666666;
  169. .type {
  170. width: 110rpx;
  171. height: 42rpx;
  172. line-height: 42rpx;
  173. text-align: center;
  174. border-radius: 38rpx;
  175. color: #928563;
  176. background-color: #fff6de;
  177. font-weight: 500;
  178. }
  179. }
  180. .title-item {
  181. margin: 10rpx 0 20rpx;
  182. line-height: 46rpx;
  183. }
  184. .file-item {
  185. width: 100%;
  186. height: 42rpx;
  187. margin: 20rpx 0;
  188. display: flex;
  189. align-items: center;
  190. background-color: #f8f8fa;
  191. color: #376cbb;
  192. image {
  193. width: 27rpx;
  194. height: 27rpx;
  195. margin-right: 15rpx;
  196. }
  197. }
  198. .image-conten {
  199. display: flex;
  200. flex-wrap: wrap;
  201. image {
  202. width: 144rpx;
  203. height: 144rpx;
  204. margin-right: 20rpx;
  205. }
  206. }
  207. .lable-conten {
  208. display: flex;
  209. flex-wrap: wrap;
  210. margin: 20rpx 0;
  211. font-size: 24rpx;
  212. .item {
  213. display: flex;
  214. align-content: center;
  215. height: 34rpx;
  216. border-radius: 44rpx;
  217. padding: 0 35rpx;
  218. background-color: #f0f1f3;
  219. margin: 0 20rpx 20rpx 0;
  220. }
  221. }
  222. .collect-conten {
  223. display: flex;
  224. justify-content: flex-end;
  225. align-items: center;
  226. color: #666666;
  227. image {
  228. width: 27rpx;
  229. height: 26rpx;
  230. margin-right: 8rpx;
  231. }
  232. }
  233. .look-all-box {
  234. display: flex;
  235. justify-content: flex-end;
  236. }
  237. .look-all {
  238. width: 160rpx;
  239. height: 52rpx;
  240. border-radius: 150rpx;
  241. text-align: center;
  242. line-height: 52rpx;
  243. font-size: 28rpx;
  244. color: #fff;
  245. background-color: #376cbb;
  246. margin: 20rpx 0;
  247. }
  248. }
  249. .nodata-text {
  250. color: #999;
  251. text-align: center;
  252. margin-top: -80rpx;
  253. font-size: 24rpx;
  254. }
  255. .author-box {
  256. display: flex;
  257. align-items: center;
  258. margin-bottom: 25rpx;
  259. font-size: 28rpx;
  260. color: #333;
  261. line-height: 40rpx;
  262. image {
  263. display: inline-block;
  264. width: 48rpx;
  265. height: 48rpx;
  266. border-radius: 50%;
  267. margin-right: 10rpx;
  268. overflow: hidden;
  269. }
  270. }
  271. }
  272. </style>