roadEssence.vue 16 KB

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