noteAndViewpoint.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <view class="container note-and-viewpoint" v-if="detailDataForm.HasPermission == 1">
  3. <view class="content-item">
  4. <view class="author-name">
  5. <view class="img-box">
  6. <image :src="detailDataForm.HeadImg" @click="goDetailPages"></image>
  7. </view>
  8. <text style="margin-left: 10rpx">{{ detailDataForm.NickName }}</text>
  9. </view>
  10. <view class="type-time">
  11. <view class="type"> {{ detailDataForm.Type == 1 ? "笔 记" : "观 点" }} </view>
  12. <view class="time">{{ detailDataForm.PublishTime }}</view>
  13. </view>
  14. <view class="title-item global_title"> {{ detailDataForm.Title }}</view>
  15. <view class="text-conten">
  16. <mp-html :content="detailDataForm.Content" />
  17. </view>
  18. <block v-if="detailDataForm.Docs && detailDataForm.Docs.length > 0">
  19. <view @click="goFilePages(item)" class="file-item text_oneLine" v-for="(item, index) in detailDataForm.Docs" :key="index">
  20. <image :src="item.DocIcon"></image>
  21. {{ item.DocName }}
  22. </view>
  23. </block>
  24. <view class="image-conten">
  25. <image v-for="key in dataProcessing(detailDataForm.ImgUrl)" :key="key" :src="key" @click="previewImageMediahandler(key)"></image>
  26. </view>
  27. <view class="lable-conten">
  28. <view class="item" v-for="key in dataProcessing(detailDataForm.Tags)" :key="key">{{ key }}</view>
  29. </view>
  30. </view>
  31. <view class="statement-content" v-if="detailDataForm.Status == 3">
  32. <text>郑重声明:</text>
  33. 本文为用户投稿,用户在平台中发表的所有资料、言论等仅代表个人或嘉宾观点,与本网站、任何公司与任何机构立场无关。本平台对文中陈述、观点判断保持中立,不对所包含内容及数据的真实性、准确性、可靠性或完整性提供任何明示或暗示的保证。
  34. 股市波动与很多因素有关,任何用户或嘉宾的发言,都有其特定立场,投资决策是个人基于自己的研究分析所做的决定,本文章或会议目的在于事实、观点分享,不构成任何的投资建议。投资者应当自主进行投资决策,对投资者因依赖上述信息进行投资决策而导致的财产损失,本平台不承担法律责任。
  35. 本文章或会议未经本平台和作者的书面许可,任何机构和个人不得以任何形式转发、转载、翻版、复制、刊登、发表、修改、仿制或引用文章或会议的全部或部分内容。本平台对任何第三方的未经授权行为所产生的的影响不承担任何责任,同时保持实施法律行动的权利。
  36. </view>
  37. <view class="collect-conten">
  38. <image @click="collectHandler(2)" v-if="detailDataForm.IsCollect == 1" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/collected_icon.png"></image>
  39. <image @click="collectHandler(1)" v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/collect_ico.png"></image>
  40. {{ detailDataForm.IsCollect == 1 ? "已收藏" : "收藏" }}
  41. </view>
  42. <Loading />
  43. </view>
  44. <view class="nodata" v-else>
  45. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  46. <text>报告加急审核中,请耐心等待~</text>
  47. </view>
  48. </template>
  49. <script>
  50. import { purchaserApi } from "@/config/api";
  51. export default {
  52. data() {
  53. return {
  54. detailDataForm: "",
  55. detailId: 0,
  56. readTiem: 0,
  57. setIntervalTiem: null,
  58. };
  59. },
  60. methods: {
  61. previewImageMediahandler(key) {
  62. uni.previewImage({
  63. urls: [key], //查看图片的数组
  64. });
  65. },
  66. // 获取专栏详情
  67. async getDetaliData() {
  68. const res = await purchaserApi.yanxuanSpecialDetail({
  69. Id: this.detailId,
  70. });
  71. if (res.Ret === 200) {
  72. this.detailDataForm = res.Data;
  73. let str = this.detailDataForm.Type == 1 ? "笔记" : "观点";
  74. wx.setNavigationBarTitle({
  75. title: `${str}详情`,
  76. });
  77. }
  78. },
  79. // 数据处理
  80. dataProcessing(item) {
  81. return item ? item.split(",") : [];
  82. },
  83. // 收藏
  84. async collectHandler(type) {
  85. await this.$store.dispatch("checkHandle");
  86. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  87. const res = await purchaserApi.yanxuanSpecialCollect({
  88. Id: this.detailDataForm.Id,
  89. Status: type,
  90. });
  91. if (res.Ret === 200) {
  92. this.$util.toast(res.Msg);
  93. this.getDetaliData();
  94. }
  95. }
  96. },
  97. // 去往预览文件
  98. goFilePages(item) {
  99. wx.downloadFile({
  100. // 示例 url,并非真实存在
  101. url: item.DocUrl,
  102. success: function (res) {
  103. const filePath = res.tempFilePath;
  104. wx.openDocument({
  105. filePath: filePath,
  106. });
  107. },
  108. });
  109. },
  110. goDetailPages() {
  111. uni.navigateTo({ url: "/pages-purchaser/columnDetail/columnDetail?id=" + this.detailDataForm.UserId });
  112. },
  113. },
  114. onLoad(options) {
  115. this.detailId = Number(options.id) || 0;
  116. this.detailId > 0 && this.getDetaliData();
  117. },
  118. onShow() {
  119. this.readTiem = 0;
  120. this.setIntervalTiem = setInterval(() => {
  121. this.readTiem++;
  122. }, 1000);
  123. },
  124. onHide() {
  125. //页面退出
  126. if (this.detailId && this.detailId > 0) {
  127. clearInterval(this.setIntervalTiem);
  128. purchaserApi
  129. .YanxuanSpecialRecord({
  130. SpecialId: this.detailId,
  131. StopTime: this.readTiem,
  132. })
  133. .then((res) => {});
  134. }
  135. },
  136. onUnload() {
  137. if (this.detailId && this.detailId > 0) {
  138. //页面返回
  139. clearInterval(this.setIntervalTiem);
  140. purchaserApi
  141. .YanxuanSpecialRecord({
  142. SpecialId: this.detailId,
  143. StopTime: this.readTiem,
  144. })
  145. .then((res) => {});
  146. }
  147. },
  148. /** 用户点击分享 */
  149. onShareAppMessage: function (res) {
  150. return {
  151. title: this.detailDataForm.Title,
  152. path: "/pages-purchaser/noteAndViewpoint/noteAndViewpoint?id=" + this.detailId,
  153. };
  154. },
  155. };
  156. </script>
  157. <style lang="scss" scope>
  158. .note-and-viewpoint {
  159. padding: 30rpx;
  160. background: $uni-bg-color;
  161. .content-item {
  162. padding: 40rpx;
  163. background-color: #fff;
  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. margin-right: 15rpx;
  194. width: 27rpx;
  195. height: 27rpx;
  196. }
  197. }
  198. .text-conten {
  199. font-size: 32rpx;
  200. line-height: 44rpx;
  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-items: 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. .author-name {
  227. display: flex;
  228. align-items: center;
  229. margin-bottom: 50rpx;
  230. .img-box {
  231. width: 48rpx;
  232. height: 48rpx;
  233. overflow: hidden;
  234. font-size: 28rpx;
  235. color: #333;
  236. image {
  237. width: 100%;
  238. height: 100%;
  239. }
  240. }
  241. }
  242. }
  243. .collect-conten {
  244. position: fixed;
  245. bottom: 0;
  246. left: 0;
  247. width: 100%;
  248. padding: 20rpx 0 10rpx;
  249. background-color: #fff;
  250. padding-bottom: constant(safe-area-inset-bottom);
  251. padding-bottom: env(safe-area-inset-bottom);
  252. display: flex;
  253. flex-direction: column;
  254. align-items: center;
  255. color: #666666;
  256. font-size: 24rpx;
  257. line-height: 28rpx;
  258. image {
  259. display: inline-block;
  260. flex-shrink: 0;
  261. width: 44rpx;
  262. height: 44rpx;
  263. }
  264. }
  265. .statement-content {
  266. margin-top: 20rpx;
  267. padding-bottom: 200rpx;
  268. font-size: 28rpx;
  269. line-height: 48rpx;
  270. color: #666;
  271. text {
  272. font-weight: 500;
  273. font-size: 34rpx;
  274. line-height: 48rpx;
  275. }
  276. }
  277. }
  278. </style>