roadEssence.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <view class="container content-road forbid-copy">
  3. <block v-if="haveAuth === 1">
  4. <view class="container-top">
  5. <view class="content-title">
  6. {{ detali.Title }}
  7. </view>
  8. <view class="content-time">
  9. <text>{{ detali.Department }}</text>
  10. <text>{{ detali.PublishDate }}</text>
  11. </view>
  12. <view class="content-statement">
  13. <text>注:请务必阅读</text>
  14. <text class="statement" @click="isShowStatement = true">免责声明 </text>
  15. </view>
  16. <view class="content-audio">
  17. <view class="audio-img">
  18. <image v-if="isPlay" @click="audiouspend" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/suspend_icon.png"></image>
  19. <image v-else @click="audioPlay" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/play_icon.png" mode=""></image>
  20. </view>
  21. <view class="audio-title">
  22. <text>{{ detali.VideoName }}</text>
  23. <text>{{ detali.VideoPlaySeconds }}</text>
  24. </view>
  25. </view>
  26. <view class="content-abstract">
  27. <text>摘要:</text>
  28. <text>
  29. {{ detali.Abstract }}
  30. </text>
  31. </view>
  32. <view class="content-boby">
  33. <!-- <rich-text :nodes="detali.Body"></rich-text> -->
  34. <mp-html :content="detali.Body" />
  35. </view>
  36. </view>
  37. <view class="content-link" v-if="detali.ReportLink" @click="goDetali"> 查看深度报告 </view>
  38. <statement :show="isShowStatement" />
  39. </block>
  40. <view class="noauth-cont" v-else-if="haveAuth === 3 || haveAuth === 4">
  41. <image src="https://hzstatic.hzinsights.com/cygx/czbk/noauth.png" class="noauth-ico"></image>
  42. <block>
  43. <view class="tip">您暂无权限查看内容,若想查看可以申请开通哦</view>
  44. <view class="btn-cont" @click="applyAuth"> 立即申请 </view>
  45. </block>
  46. <view class="btn-cont back-btn" @click="backIndex">返回首页</view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import { Reports, User } from "@/config/api.js";
  52. import statement from "@/reportPages/components/statement.vue";
  53. let app = getApp({ allowDefault: true });
  54. export default {
  55. data() {
  56. return {
  57. id: "", //
  58. detali: "", //详情
  59. audioContext: "", //音频
  60. isPlay: false, //mp3 播放的图片
  61. isShowStatement: false, //免责声明隐现
  62. haveAuth: "", //权限判断
  63. videoUrl: "",
  64. };
  65. },
  66. methods: {
  67. async getDetail() {
  68. const res = await Reports.roadshowEssence({
  69. ArticleId: this.id,
  70. });
  71. if (res.Ret === 200) {
  72. this.detali = res.Data.Detail;
  73. this.haveAuth = res.Data.HasPermission;
  74. this.videoUrl = res.Data.Detail.VideoUrl;
  75. if (app.globalData.bgAudioManager.src === this.videoUrl && app.globalData.bgAudioManager.paused === false) {
  76. this.isPlay = true;
  77. }
  78. }
  79. },
  80. goDetali() {
  81. uni.navigateTo({
  82. url: "/pageMy/reportDetail/reportDetail?id=" + this.detali.ReportLink,
  83. });
  84. },
  85. /* 无权限申请开通权限 */
  86. applyAuth() {
  87. this.haveAuth === 4
  88. ? uni.navigateTo({
  89. url: "/pageMy/applyTrial/applyTrial",
  90. })
  91. : uni.showModal({
  92. title: "",
  93. content: "您已经提交过申请了,请耐心等待",
  94. showCancel: false,
  95. confirmColor: "#365595",
  96. success: function (res) {
  97. uni.navigateBack({
  98. fail() {
  99. uni.switchTab({
  100. url: "/pages/index/index",
  101. });
  102. },
  103. });
  104. },
  105. });
  106. },
  107. // 返回首頁
  108. backIndex() {
  109. uni.switchTab({
  110. url: "/pages/index/index",
  111. });
  112. },
  113. audioPlay(e) {
  114. if (this.videoUrl === app.globalData.bgAudioManager.src) {
  115. app.globalData.bgAudioManager.play();
  116. } else {
  117. app.globalData.bgAudioManager.title = this.detali.VideoName;
  118. app.globalData.bgAudioManager.src = this.videoUrl;
  119. }
  120. this.isPlay = true;
  121. },
  122. audiouspend() {
  123. this.isPlay = false;
  124. app.globalData.bgAudioManager.pause();
  125. },
  126. },
  127. components: {
  128. statement,
  129. },
  130. onLoad(option) {
  131. this.id = Number(option.id) || "";
  132. app.globalData.bgAudioManager.onEnded((res) => {
  133. this.isPlay = false;
  134. });
  135. app.globalData.bgAudioManager.onPause((res) => {
  136. this.isPlay = false;
  137. });
  138. app.globalData.bgAudioManager.onPlay((res) => {
  139. this.isPlay = true;
  140. });
  141. app.globalData.bgAudioManager.onStop((res) => {
  142. this.isPlay = false;
  143. });
  144. },
  145. async onShow() {
  146. await this.$store.dispatch("checkHandle");
  147. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  148. //已授权已绑定
  149. this.getDetail();
  150. this.audioContext = uni.createInnerAudioContext();
  151. //音频自然播放结束事件
  152. this.audioContext.onEnded((res) => {
  153. this.isPlay = true;
  154. });
  155. }
  156. },
  157. /**
  158. * 用户点击分享
  159. */
  160. onShareAppMessage: function (res) {
  161. return {
  162. title: this.detali.Title,
  163. url: "reportPages/roadEssence/roadEssence?id=" + this.id,
  164. success: (res) => {},
  165. fail: (err) => {},
  166. };
  167. },
  168. };
  169. </script>
  170. <style lang="scss" scoped>
  171. .content-road {
  172. padding: 10rpx 34rpx 34rpx;
  173. .container-top {
  174. font-size: 28rpx;
  175. .content-title {
  176. color: #4a4a4a;
  177. font-size: 34rpx;
  178. font-weight: bold;
  179. }
  180. .content-time {
  181. margin: 24rpx 0 34rpx 0;
  182. display: flex;
  183. justify-content: space-between;
  184. color: #333333;
  185. }
  186. .content-statement {
  187. display: flex;
  188. color: #707070;
  189. .statement {
  190. margin-left: 10rpx;
  191. color: #3385ff;
  192. }
  193. }
  194. .content-audio {
  195. margin: 60rpx 0;
  196. width: 682rpx;
  197. align-items: center;
  198. background: #ffffff;
  199. box-shadow: 0rpx 0rpx 12rpx rgba(33, 74, 135, 0.16);
  200. opacity: 1;
  201. border-radius: 16rpx;
  202. display: flex;
  203. padding: 24rpx 21rpx 18rpx;
  204. .audio-img {
  205. width: 154rpx;
  206. height: 154rpx;
  207. margin-right: 20rpx;
  208. image {
  209. width: 154rpx;
  210. height: 154rpx;
  211. }
  212. }
  213. .audio-title {
  214. font-size: 28rpx;
  215. color: #333;
  216. :first-child {
  217. width: 450rpx;
  218. overflow: hidden;
  219. text-overflow: ellipsis;
  220. white-space: nowrap;
  221. margin-bottom: 30rpx;
  222. font-size: 32rpx;
  223. }
  224. }
  225. }
  226. .content-abstract {
  227. margin-bottom: 30rpx;
  228. font-size: 32rpx;
  229. color: #4a4a4a;
  230. :first-child {
  231. float: left;
  232. font-weight: 700;
  233. }
  234. }
  235. .content-boby {
  236. font-size: 32rpx;
  237. image,
  238. img {
  239. width: 100%;
  240. }
  241. }
  242. }
  243. .content-link {
  244. width: 368rpx;
  245. height: 80rpx;
  246. border: 2rpx solid #2c83ff;
  247. opacity: 1;
  248. border-radius: 4rpx;
  249. line-height: 76rpx;
  250. text-align: center;
  251. color: #2c83ff;
  252. font-size: 32rpx;
  253. box-sizing: border-box;
  254. margin: 100rpx auto;
  255. }
  256. @import "../jurisdiction.scss";
  257. }
  258. </style>