roadEssence.vue 14 KB

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