roadEssence.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  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. this.haveAuth = res.Data.HasPermission;
  161. if (res.Data.Detail) {
  162. let arr = res.Data.Detail.VideoPlaySeconds.split(":");
  163. res.Data.Detail.VideoPlaySeconds = arr[0] * 60 + (arr[1] - 0);
  164. this.detali = res.Data.Detail;
  165. this.videoUrl = res.Data.Detail.VideoUrl;
  166. if (this.globalBgAudioManager.src === this.videoUrl && this.globalBgAudioManager.paused === false) {
  167. this.isPlay = true;
  168. }
  169. }
  170. }
  171. },
  172. goDetali() {
  173. uni.navigateTo({
  174. url: "/pageMy/reportDetail/reportDetail?id=" + this.detali.ReportLink,
  175. });
  176. },
  177. /* 无权限申请开通权限 */
  178. applyAuth() {
  179. this.haveAuth === 4
  180. ? uni.navigateTo({
  181. url: "/pageMy/applyTrial/applyTrial?tryType=Article&detailId=" + this.id,
  182. })
  183. : uni.showModal({
  184. title: "",
  185. content: "您已经提交过申请了,请耐心等待",
  186. showCancel: false,
  187. confirmColor: "#365595",
  188. success: function (res) {
  189. uni.navigateBack({
  190. fail() {
  191. uni.switchTab({
  192. url: "/pages/index/index",
  193. });
  194. },
  195. });
  196. },
  197. });
  198. },
  199. // 返回首頁
  200. backIndex() {
  201. uni.switchTab({
  202. url: "/pages/index/index",
  203. });
  204. },
  205. //音频点击暂停播放
  206. audioPlayBack() {
  207. let list = { Url: this.detali.VideoUrl, Name: this.detali.Title, PlaySeconds: this.detali.VideoPlaySeconds };
  208. if (this.$store.state.audioBg.reportId == this.detali.ArticleId) {
  209. if (this.globalBgAudioManager.paused) {
  210. this.globalBgAudioManager.play();
  211. } else {
  212. this.globalBgAudioManager.pause();
  213. }
  214. } else {
  215. this.$store.commit("audioBg/updateAudioTime", 0);
  216. this.$store.commit("audioBg/addAudio", { list, reportId: this.detali.ArticleId });
  217. }
  218. },
  219. audiouspend() {
  220. this.isPlay = false;
  221. this.globalBgAudioManager.pause();
  222. },
  223. //获取权限弹窗是否展示免费月卡接口
  224. async userIsShowAlert() {
  225. const res = await FreeButton.userIsShowAlert();
  226. if (res.Ret === 200) {
  227. this.isShowAlert = res.Data.IsShow;
  228. }
  229. },
  230. // //拖动进度条
  231. // handleAudioSliderChange(e) {
  232. // const value = e.detail.value;
  233. // this.globalBgAudioManager.seek(value);
  234. // },
  235. // handleAudioSliderChangeing(e) {
  236. // this.curTime = e.detail.value;
  237. // },
  238. //拖动进度条
  239. handleAudioSliderChangeing(e) {
  240. this.curTime = e.detail.value;
  241. },
  242. //拖动进度条
  243. handleAudioSliderChange(e) {
  244. const value = e.detail.value;
  245. this.globalBgAudioManager.seek(value);
  246. setTimeout(() => {
  247. this.$store.commit("audioBg/setSlide", false);
  248. }, 300);
  249. },
  250. touchstartHandler() {
  251. this.$store.commit("audioBg/setSlide", true);
  252. },
  253. //倍速播放
  254. isTimesHandler(i) {
  255. let list = { Url: this.detali.VideoUrl, Name: this.detali.Title, PlaySeconds: this.detali.VideoPlaySeconds };
  256. let index = i == 3 ? 0 : i + 1;
  257. this.$store.commit("audioBg/setMultiple", this.timesTheSpeed[index].value);
  258. this.globalBgAudioManager.playbackRate = this.isTimes;
  259. this.globalBgAudioManager.startTime = this.curTime;
  260. if (this.$store.state.audioBg.reportId != this.detali.ArticleId) {
  261. this.$store.commit("audioBg/addAudio", { list, reportId: this.detali.ArticleId });
  262. this.globalBgAudioManager.play();
  263. } else {
  264. if (this.globalBgAudioManager.paused) {
  265. this.globalBgAudioManager.play();
  266. }
  267. }
  268. },
  269. //快进 快退
  270. speedReverseHandler(type) {
  271. let isTime = type == "reverse" ? this.curTime - 15 : this.curTime + 15;
  272. isTime = isTime <= 0 ? 0 : isTime >= this.detali.VideoPlaySeconds ? this.detali.VideoPlaySeconds - 1 : isTime;
  273. this.globalBgAudioManager.seek(isTime);
  274. },
  275. },
  276. components: {
  277. statement,
  278. freeCharge,
  279. audioModule,
  280. },
  281. async onLoad(option) {
  282. this.$store.commit("setRouterReport", "路演精华");
  283. this.id = Number(option.id) || "";
  284. // 免费送月卡
  285. // this.userIsShowAlert();
  286. await this.$store.dispatch("checkHandle");
  287. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  288. //已授权已绑定
  289. this.getDetail();
  290. }
  291. },
  292. onShow() {
  293. this.showAudioBox = true;
  294. },
  295. onHide() {
  296. this.showAudioBox = false;
  297. },
  298. /**
  299. * 用户点击分享
  300. */
  301. onShareAppMessage: function (res) {
  302. return {
  303. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.detali.Title,
  304. url: "reportPages/roadEssence/roadEssence?id=" + this.id,
  305. success: (res) => {},
  306. fail: (err) => {},
  307. };
  308. },
  309. };
  310. </script>
  311. <style lang="scss" scoped>
  312. .content-road {
  313. padding: 10rpx 34rpx 34rpx;
  314. .container-top {
  315. font-size: 28rpx;
  316. .content-title {
  317. color: #4a4a4a;
  318. font-size: 34rpx;
  319. font-weight: bold;
  320. }
  321. .content-time {
  322. margin: 24rpx 0 34rpx 0;
  323. display: flex;
  324. justify-content: space-between;
  325. color: #333333;
  326. }
  327. .content-statement {
  328. display: flex;
  329. color: #707070;
  330. .statement {
  331. margin-left: 10rpx;
  332. color: #3385ff;
  333. }
  334. }
  335. .content-audio {
  336. margin: 60rpx 0;
  337. width: 682rpx;
  338. align-items: center;
  339. background: #ffffff;
  340. box-shadow: 0rpx 0rpx 12rpx rgba(33, 74, 135, 0.16);
  341. opacity: 1;
  342. border-radius: 16rpx;
  343. display: flex;
  344. padding: 24rpx 21rpx 18rpx;
  345. .audio-img {
  346. width: 154rpx;
  347. height: 154rpx;
  348. margin-right: 20rpx;
  349. image {
  350. width: 154rpx;
  351. height: 154rpx;
  352. }
  353. }
  354. .audio-title {
  355. font-size: 28rpx;
  356. color: #333;
  357. :first-child {
  358. width: 450rpx;
  359. overflow: hidden;
  360. text-overflow: ellipsis;
  361. white-space: nowrap;
  362. margin-bottom: 30rpx;
  363. font-size: 32rpx;
  364. }
  365. }
  366. }
  367. .content-abstract {
  368. margin-bottom: 30rpx;
  369. font-size: 32rpx;
  370. color: #4a4a4a;
  371. :first-child {
  372. float: left;
  373. font-weight: 700;
  374. }
  375. }
  376. .content-boby {
  377. font-size: 32rpx;
  378. image,
  379. img {
  380. width: 100%;
  381. }
  382. }
  383. }
  384. .content-link {
  385. width: 368rpx;
  386. height: 80rpx;
  387. border: 2rpx solid #2c83ff;
  388. opacity: 1;
  389. border-radius: 4rpx;
  390. line-height: 76rpx;
  391. text-align: center;
  392. color: #2c83ff;
  393. font-size: 32rpx;
  394. box-sizing: border-box;
  395. margin: 100rpx auto;
  396. }
  397. .month_card {
  398. width: 100%;
  399. height: 565rpx;
  400. padding-left: -20rpx;
  401. }
  402. .btn-dl {
  403. background: linear-gradient(253deg, #fcf3e9 0%, #eedec8 100%) !important;
  404. color: #333 !important;
  405. margin: 30rpx auto !important;
  406. }
  407. .month-back {
  408. background: #f6f6f6 !important;
  409. color: #999 !important;
  410. }
  411. .moneh-text {
  412. text-align: center;
  413. width: 632rpx;
  414. margin: 0 auto 20rpx;
  415. color: #999999;
  416. }
  417. .audio-card {
  418. width: 100%;
  419. height: 282rpx;
  420. background: #f9f9f9;
  421. border-radius: 16rpx;
  422. margin: 30rpx auto;
  423. padding: 30rpx;
  424. .slider {
  425. width: 100%;
  426. margin: 0;
  427. }
  428. .slider-paly {
  429. display: flex;
  430. height: 80rpx;
  431. align-items: center;
  432. padding-left: 20rpx;
  433. }
  434. .card-title {
  435. font-size: 28rpx;
  436. padding: 0 40rpx;
  437. text-align: center;
  438. margin-bottom: 35rpx;
  439. }
  440. .card-time {
  441. display: flex;
  442. justify-content: space-between;
  443. color: #999999;
  444. font-size: 20rpx;
  445. }
  446. .is-paly-card {
  447. width: 70rpx;
  448. height: 70rpx;
  449. flex-shrink: 0;
  450. margin-left: 30rpx;
  451. image {
  452. width: 70rpx;
  453. height: 70rpx;
  454. }
  455. }
  456. .fast-reverse {
  457. display: flex;
  458. align-items: center;
  459. justify-content: center;
  460. margin-top: 30rpx;
  461. .speed-button {
  462. width: 96rpx;
  463. height: 47rpx;
  464. background: #eaeaea;
  465. border-radius: 8rpx;
  466. text-align: center;
  467. line-height: 47rpx;
  468. margin: 0 70rpx;
  469. }
  470. .speed-img {
  471. width: 50rpx;
  472. height: 50rpx;
  473. }
  474. }
  475. }
  476. @import "../jurisdiction.scss";
  477. }
  478. </style>