roadEssence.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  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="audio-card">
  17. <view class="card-title text_oneLine">
  18. {{ detali.VideoName }}
  19. </view>
  20. <view class="slider-paly">
  21. <view style="flex: 1; padding-top: 20rpx">
  22. <slider
  23. activeColor="#3385FF"
  24. :max="detali.VideoPlaySeconds"
  25. :value="curTime"
  26. @change="handleAudioSliderChange($event)"
  27. @changing="handleAudioSliderChangeing($event)"
  28. block-size="16"
  29. class="slider"
  30. />
  31. <view class="card-time">
  32. <text class="time">{{ curTime | formatVoiceTime }}</text>
  33. <text class="time">{{ detali.VideoPlaySeconds | formatVoiceTime }}</text>
  34. </view>
  35. </view>
  36. <view class="is-paly-card">
  37. <image
  38. @click.stop="audioPlayBack"
  39. :src="
  40. curVoiceId === detali.ArticleId && !curAudioPaused
  41. ? 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/play_icon.gif'
  42. : 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/pause_icon.png'
  43. "
  44. ></image>
  45. </view>
  46. </view>
  47. <view class="fast-reverse">
  48. <image @click="speedReverseHandler('reverse')" class="speed-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/fastReverse_icon.png"></image>
  49. <block v-for="(item, index) in timesTheSpeed" :key="item.value">
  50. <view class="speed-button" v-if="isTimes == item.value" @click="isTimesHandler(index)">
  51. {{ item.name }}
  52. </view>
  53. </block>
  54. <image @click="speedReverseHandler('speed')" class="speed-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/speed_icon.png"></image>
  55. </view>
  56. </view>
  57. <view class="content-abstract">
  58. <text>摘要:</text>
  59. <text>
  60. {{ detali.Abstract }}
  61. </text>
  62. </view>
  63. <view class="content-boby">
  64. <mp-html :content="detali.Body" />
  65. </view>
  66. </view>
  67. <view class="content-link" v-if="detali.ReportLink" @click="goDetali"> 查看深度报告 </view>
  68. <statement :show="isShowStatement" />
  69. </block>
  70. <view class="noauth-cont" v-else-if="haveAuth === 3 || haveAuth === 4">
  71. <block v-if="!isShowAlert">
  72. <image src="https://hzstatic.hzinsights.com/cygx/czbk/noauth.png" class="noauth-ico"></image>
  73. <block>
  74. <view class="tip">您暂无权限查看此文章内容,若想查看可以申请开通哦</view>
  75. <view class="btn-cont" @click="applyAuth"> 立即申请 </view>
  76. </block>
  77. <view class="btn-cont back-btn" @click="backIndex"> 返回首页 </view>
  78. </block>
  79. <block v-else>
  80. <text class="moneh-text"> 上传名片并填写简单信息,24小时内我们会为您开通一个月的免费月卡 </text>
  81. <img src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/month_card.png" class="month_card" alt="" />
  82. <view class="btn-cont btn-dl" @click="applyAuth"> 立即上传 </view>
  83. <view class="btn-cont month-back" @click="backIndex"> 返回</view>
  84. </block>
  85. </view>
  86. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  87. <view v-show="false">
  88. <audioModule ref="refAudioPop" :showAudioPop="showAudioPop" />
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. import { Reports, User, FreeButton } from "@/config/api.js";
  94. import statement from "@/reportPages/components/statement.vue";
  95. import freeCharge from "@/components/freeCharge";
  96. import audioModule from "@/components/audioModule/index";
  97. let app = getApp({ allowDefault: true });
  98. export default {
  99. data() {
  100. return {
  101. id: "", //
  102. detali: "", //详情
  103. audioContext: "", //音频
  104. isPlay: false, //mp3 播放的图片
  105. isShowStatement: false, //免责声明隐现
  106. haveAuth: "", //权限判断
  107. videoUrl: "",
  108. isShowAlert: false,
  109. timesTheSpeed: [
  110. { name: "倍速", value: 1 },
  111. { name: "1.25倍", value: 1.25 },
  112. { name: "1.5倍", value: 1.5 },
  113. { name: "2倍", value: 2 },
  114. ],
  115. showAudioBox: false,
  116. curTime: 0,
  117. };
  118. },
  119. computed: {
  120. curVoiceId() {
  121. //当前正在播放的音频id
  122. return this.$store.state.audioBg.reportId;
  123. },
  124. curAudioPaused() {
  125. //当前音频是否暂停状态
  126. return this.$store.state.audioBg.paused;
  127. },
  128. //几倍的播放数度
  129. isTimes() {
  130. let isMultiple = this.curVoiceId === this.detali.ArticleId ? this.$store.state.audioBg.multiple : 1;
  131. return isMultiple;
  132. },
  133. showAudioPop() {
  134. return this.$store.state.audioBg.show;
  135. },
  136. },
  137. filters: {
  138. formatVoiceTime(e) {
  139. let m = parseInt(e / 60);
  140. let s = parseInt(e % 60);
  141. return `${m > 9 ? m : "0" + m}:${s > 9 ? s : "0" + s}`;
  142. },
  143. },
  144. width: {
  145. "$store.state.audioBg.curTime": {
  146. handler(newVal) {
  147. this.curTime = this.curVoiceId === this.detali.ArticleId ? newVal : 0;
  148. },
  149. immediate: true,
  150. deep: true,
  151. },
  152. },
  153. methods: {
  154. async getDetail() {
  155. const res = await Reports.roadshowEssence({
  156. ArticleId: this.id,
  157. });
  158. if (res.Ret === 200) {
  159. let arr = res.Data.Detail.VideoPlaySeconds.split(":");
  160. res.Data.Detail.VideoPlaySeconds = arr[0] * 60 + (arr[1] - 0);
  161. this.detali = res.Data.Detail;
  162. this.haveAuth = res.Data.HasPermission;
  163. this.videoUrl = res.Data.Detail.VideoUrl;
  164. if (this.globalBgAudioManager.src === this.videoUrl && this.globalBgAudioManager.paused === false) {
  165. this.isPlay = true;
  166. }
  167. }
  168. },
  169. goDetali() {
  170. uni.navigateTo({
  171. url: "/pageMy/reportDetail/reportDetail?id=" + this.detali.ReportLink,
  172. });
  173. },
  174. /* 无权限申请开通权限 */
  175. applyAuth() {
  176. this.haveAuth === 4
  177. ? uni.navigateTo({
  178. url: "/pageMy/applyTrial/applyTrial?tryType=Article&detailId=" + this.id,
  179. })
  180. : uni.showModal({
  181. title: "",
  182. content: "您已经提交过申请了,请耐心等待",
  183. showCancel: false,
  184. confirmColor: "#365595",
  185. success: function (res) {
  186. uni.navigateBack({
  187. fail() {
  188. uni.switchTab({
  189. url: "/pages/index/index",
  190. });
  191. },
  192. });
  193. },
  194. });
  195. },
  196. // 返回首頁
  197. backIndex() {
  198. uni.switchTab({
  199. url: "/pages/index/index",
  200. });
  201. },
  202. //音频点击暂停播放
  203. audioPlayBack() {
  204. let list = { Url: this.detali.VideoUrl, Name: this.detali.Title, PlaySeconds: this.detali.VideoPlaySeconds };
  205. if (this.$store.state.audioBg.reportId == this.detali.ArticleId) {
  206. if (this.globalBgAudioManager.paused) {
  207. this.globalBgAudioManager.play();
  208. } else {
  209. this.globalBgAudioManager.pause();
  210. }
  211. } else {
  212. this.$store.commit("audioBg/updateAudioTime", 0);
  213. this.$store.commit("audioBg/addAudio", { list, reportId: this.detali.ArticleId });
  214. }
  215. },
  216. audiouspend() {
  217. this.isPlay = false;
  218. this.globalBgAudioManager.pause();
  219. },
  220. //获取权限弹窗是否展示免费月卡接口
  221. async userIsShowAlert() {
  222. const res = await FreeButton.userIsShowAlert();
  223. if (res.Ret === 200) {
  224. this.isShowAlert = res.Data.IsShow;
  225. }
  226. },
  227. //拖动进度条
  228. handleAudioSliderChange(e) {
  229. const value = e.detail.value;
  230. this.globalBgAudioManager.seek(value);
  231. },
  232. handleAudioSliderChangeing(e) {
  233. this.curTime = e.detail.value;
  234. },
  235. //倍速播放
  236. isTimesHandler(i) {
  237. let list = { Url: this.detali.VideoUrl, Name: this.detali.Title, PlaySeconds: this.detali.VideoPlaySeconds };
  238. let index = i == 3 ? 0 : i + 1;
  239. this.$store.commit("audioBg/setMultiple", this.timesTheSpeed[index].value);
  240. this.globalBgAudioManager.playbackRate = this.isTimes;
  241. this.globalBgAudioManager.startTime = this.curTime;
  242. if (this.$store.state.audioBg.reportId != this.detali.ArticleId) {
  243. this.$store.commit("audioBg/addAudio", { list, reportId: this.detali.ArticleId });
  244. this.globalBgAudioManager.play();
  245. } else {
  246. if (this.globalBgAudioManager.paused) {
  247. this.globalBgAudioManager.play();
  248. }
  249. }
  250. },
  251. //快进 快退
  252. speedReverseHandler(type) {
  253. let isTime = type == "reverse" ? this.curTime - 15 : this.curTime + 15;
  254. isTime = isTime <= 0 ? 0 : isTime >= this.audioTime ? this.audioTime - 1 : isTime;
  255. this.globalBgAudioManager.seek(isTime);
  256. },
  257. },
  258. components: {
  259. statement,
  260. freeCharge,
  261. audioModule,
  262. },
  263. async onLoad(option) {
  264. this.id = Number(option.id) || "";
  265. this.userIsShowAlert();
  266. await this.$store.dispatch("checkHandle");
  267. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  268. //已授权已绑定
  269. this.getDetail();
  270. }
  271. },
  272. onShow() {
  273. this.showAudioBox = true;
  274. },
  275. onHide() {
  276. this.showAudioBox = false;
  277. },
  278. /**
  279. * 用户点击分享
  280. */
  281. onShareAppMessage: function (res) {
  282. return {
  283. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.detali.Title,
  284. url: "reportPages/roadEssence/roadEssence?id=" + this.id,
  285. success: (res) => {},
  286. fail: (err) => {},
  287. };
  288. },
  289. };
  290. </script>
  291. <style lang="scss" scoped>
  292. .content-road {
  293. padding: 10rpx 34rpx 34rpx;
  294. .container-top {
  295. font-size: 28rpx;
  296. .content-title {
  297. color: #4a4a4a;
  298. font-size: 34rpx;
  299. font-weight: bold;
  300. }
  301. .content-time {
  302. margin: 24rpx 0 34rpx 0;
  303. display: flex;
  304. justify-content: space-between;
  305. color: #333333;
  306. }
  307. .content-statement {
  308. display: flex;
  309. color: #707070;
  310. .statement {
  311. margin-left: 10rpx;
  312. color: #3385ff;
  313. }
  314. }
  315. .content-audio {
  316. margin: 60rpx 0;
  317. width: 682rpx;
  318. align-items: center;
  319. background: #ffffff;
  320. box-shadow: 0rpx 0rpx 12rpx rgba(33, 74, 135, 0.16);
  321. opacity: 1;
  322. border-radius: 16rpx;
  323. display: flex;
  324. padding: 24rpx 21rpx 18rpx;
  325. .audio-img {
  326. width: 154rpx;
  327. height: 154rpx;
  328. margin-right: 20rpx;
  329. image {
  330. width: 154rpx;
  331. height: 154rpx;
  332. }
  333. }
  334. .audio-title {
  335. font-size: 28rpx;
  336. color: #333;
  337. :first-child {
  338. width: 450rpx;
  339. overflow: hidden;
  340. text-overflow: ellipsis;
  341. white-space: nowrap;
  342. margin-bottom: 30rpx;
  343. font-size: 32rpx;
  344. }
  345. }
  346. }
  347. .content-abstract {
  348. margin-bottom: 30rpx;
  349. font-size: 32rpx;
  350. color: #4a4a4a;
  351. :first-child {
  352. float: left;
  353. font-weight: 700;
  354. }
  355. }
  356. .content-boby {
  357. font-size: 32rpx;
  358. image,
  359. img {
  360. width: 100%;
  361. }
  362. }
  363. }
  364. .content-link {
  365. width: 368rpx;
  366. height: 80rpx;
  367. border: 2rpx solid #2c83ff;
  368. opacity: 1;
  369. border-radius: 4rpx;
  370. line-height: 76rpx;
  371. text-align: center;
  372. color: #2c83ff;
  373. font-size: 32rpx;
  374. box-sizing: border-box;
  375. margin: 100rpx auto;
  376. }
  377. .month_card {
  378. width: 100%;
  379. height: 565rpx;
  380. padding-left: -20rpx;
  381. }
  382. .btn-dl {
  383. background: linear-gradient(253deg, #fcf3e9 0%, #eedec8 100%) !important;
  384. color: #333 !important;
  385. margin: 30rpx auto !important;
  386. }
  387. .month-back {
  388. background: #f6f6f6 !important;
  389. color: #999 !important;
  390. }
  391. .moneh-text {
  392. text-align: center;
  393. width: 632rpx;
  394. margin: 0 auto 20rpx;
  395. color: #999999;
  396. }
  397. .audio-card {
  398. width: 100%;
  399. height: 282rpx;
  400. background: #f9f9f9;
  401. border-radius: 16rpx;
  402. margin: 30rpx auto;
  403. padding: 30rpx;
  404. .slider {
  405. width: 100%;
  406. margin: 0;
  407. }
  408. .slider-paly {
  409. display: flex;
  410. height: 80rpx;
  411. align-items: center;
  412. padding-left: 20rpx;
  413. }
  414. .card-title {
  415. font-size: 28rpx;
  416. padding: 0 40rpx;
  417. text-align: center;
  418. margin-bottom: 35rpx;
  419. }
  420. .card-time {
  421. display: flex;
  422. justify-content: space-between;
  423. color: #999999;
  424. font-size: 20rpx;
  425. }
  426. .is-paly-card {
  427. width: 70rpx;
  428. height: 70rpx;
  429. flex-shrink: 0;
  430. margin-left: 30rpx;
  431. image {
  432. width: 70rpx;
  433. height: 70rpx;
  434. }
  435. }
  436. .fast-reverse {
  437. display: flex;
  438. align-items: center;
  439. justify-content: center;
  440. margin-top: 30rpx;
  441. .speed-button {
  442. width: 96rpx;
  443. height: 47rpx;
  444. background: #eaeaea;
  445. border-radius: 8rpx;
  446. text-align: center;
  447. line-height: 47rpx;
  448. margin: 0 70rpx;
  449. }
  450. .speed-img {
  451. width: 50rpx;
  452. height: 50rpx;
  453. }
  454. }
  455. }
  456. @import "../jurisdiction.scss";
  457. }
  458. </style>