columnListContent.vue 7.5 KB

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