Detail.vue 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258
  1. <template>
  2. <van-pull-refresh v-model="loading" disabled style="min-height:100vh">
  3. <!-- <div class="content-swipe" v-if="bannerDataList.length > 0">
  4. <van-swipe class="my-swipe" :autoplay="4000" :show-indicators="false">
  5. <van-swipe-item v-for="item in bannerDataList" :key="item.id" @click="bannerSwiperHandler(item)">
  6. <img :src="item.image_url_mobile" />
  7. </van-swipe-item>
  8. </van-swipe>
  9. </div> -->
  10. <div class="report-detail-page" @click="closeAttention" v-if="info" :style="{paddingBottom:$store.state.hzyb.audioData.url&&'80px'}">
  11. <!-- 晨报、周报章节 -->
  12. <div class="chapter-list-wrap" v-if="info.report_info.has_chapter&&info.report_detail_show_type===2">
  13. <div class="top-box" :style="'background-image:url(' + info.report_info.banner_url + ')'">
  14. <div class="title">{{info.report_info.classify_name_first}}</div>
  15. <div class="sub-title">{{info.report_info.title}}</div>
  16. <div class="flex top-bot">
  17. <div class="flex time-box">
  18. <div class="day">{{formatChapterTime(info.report_info.publish_time,'day')}}</div>
  19. <div>
  20. <div>{{formatChapterTime(info.report_info.publish_time,'week')}}</div>
  21. <div>{{formatChapterTime(info.report_info.publish_time,'year-month')}}</div>
  22. </div>
  23. </div>
  24. <div class="audio-play-list-box" @click="handleGoSetAudioList" v-if="info.report_info.classify_name_first=='周报'&&info.auth_ok">播放清单</div>
  25. <div class="attention-box" v-if="showAttention">
  26. 点击<span style="color:#E3B377">播放清单</span>,打开章节列表,进行<span style="color:#E3B377">播放清单配置</span>
  27. <img class="close-icon" src="@/assets/hzyb/report/close.png" alt="" @click.stop="closeAttention">
  28. </div>
  29. </div>
  30. <div :class="['stage-num',info.report_info.classify_name_first=='晨报'?'stage-num-day':'']">第{{info.report_info.stage}}期</div>
  31. </div>
  32. <div class="list-box">
  33. <div class="flex item" v-for="item in chapterList" :key="item.report_chapter_id" @click="goChapterDetail(item)">
  34. <div class="img-box">
  35. <van-image class="img" :src="item.report_chapter_type_thumb" mode="aspectFill" />
  36. </div>
  37. <div class="con">
  38. <div class="title">
  39. {{item.report_chapter_type_name}}
  40. <text class="tag" :style="{backgroundColor:getTagColor(tag)}" v-for="tag in item.trend.split(',')" :key="tag">{{tag}}</text>
  41. </div>
  42. <div class="van-multi-ellipsis--l2 sub-title">{{item.title}}</div>
  43. <div class="update-time">更新至:{{formatChapterTime(item.publish_time,'year-month-day')}}</div>
  44. <div
  45. :class="['audio-icon-box',item.video_url==$store.state.hzyb.audioData.list[$store.state.hzyb.audioData.index]?.url?'audio-icon-box_active':'']"
  46. v-if="info.report_info.classify_name_first=='周报'&&item.is_close==0"
  47. @click.stop="handlePlayWeekAudio(item)"
  48. ></div>
  49. </div>
  50. </div>
  51. </div>
  52. <!-- 无权限 -->
  53. <div class="no-auth-box" v-if="userInfo?.is_bind==0">
  54. <img class="img" src="https://hzstatic.hzinsights.com/static/icon/hzyb/activity_no_auth.png" mode="widthFix" />
  55. <div class="apply-box">
  56. <div>您尚未登录,请登录后查看更多信息</div>
  57. <div class="btn" @click="handleGoLogin">立即登录</div>
  58. </div>
  59. </div>
  60. <template v-else>
  61. <div class="no-auth-box" v-if="!info.auth_ok">
  62. <img class="img" src="https://hzstatic.hzinsights.com/static/icon/hzyb/activity_no_auth.png" mode="widthFix" />
  63. <div class="apply-box" v-if="info.permission_check.type=='apply'">
  64. <div>您暂无权限查看报告,若想查看请申请开通</div>
  65. <div class="btn" @click="handleGoApply">立即申请</div>
  66. </div>
  67. <div class="apply-box" v-else>
  68. <div>您暂无权限查看报告 </div>
  69. <div>若想查看请联系对口销售:{{info.permission_check.name}}</div>
  70. <a class="btn" :href="'tel:'+info.permission_check.mobile" tag="div">立即联系</a>
  71. </div>
  72. </div>
  73. </template>
  74. </div>
  75. <!-- 报告详情 -->
  76. <div :class="['main-box',!info.auth_ok&&'main-box-noauth']" v-else>
  77. <!-- <div class="title">【第{{info.report_info.stage}}期|{{info.report_info.classify_name_second}}】{{info.report_info.title}}</div> -->
  78. <div :style="{backgroundColor:info.report_info.canvas_color||''}">
  79. <!-- 无版头板尾显示标题 -->
  80. <template v-if="(!info.report_info.head_img) && (!info.report_info.end_img)">
  81. <div class="title">{{title}}</div>
  82. <div class="flex time">
  83. <span>{{info.report_info.author}}</span>
  84. <span>{{formatTime(info.report_info.publish_time)}}</span>
  85. </div>
  86. </template>
  87. <!-- 拼接版头 -->
  88. <div class="html-head-img-box" v-if="info.auth_ok&&info.report_info.head_img">
  89. <img :src="info.report_info.head_img" alt="" style="display:block;width:100%">
  90. <div class="head-layout-item" v-for="item in headImgStyle" :key="item.value"
  91. :style="{fontFamily:item.family,fontSize:(item.size*2)+'px',fontWeight:item.weight,textAlign:item.align,color:item.color,
  92. width:item.width,height:item.height,left:item.left,top:item.top
  93. }">
  94. {{ layoutBaseInfo[item.value] }}
  95. </div>
  96. </div>
  97. <!-- 音频模块 -->
  98. <AudioBox :audioData="audioData" v-if="info.report_info.video_url&&info.report_info.video_play_seconds>0"></AudioBox>
  99. <div class="flex tips">
  100. <div style="flex:1">
  101. <div v-if="info.road_video_id">点击<span style="color: #e3b377;" @click="goVideoPage">查看视频</span></div>
  102. <div class="abstract" v-if="info.report_info.abstract">摘要:{{info.report_info.abstract}}</div>
  103. <div>
  104. <span v-if="disclaimer">注:请务必阅读</span>
  105. <span v-if="disclaimer" style="color:#E3B377;margin-left:20px" @click="showDisclaimers=true">免责声明</span>
  106. <span
  107. v-if="info.report_info.video_url&&info.report_info.video_play_seconds>0"
  108. style="float:right;background:#E3B377;color:#fff;border-radius:30px;padding:0 10px;font-size:0.9em" @click="handlePlayAudioBG"
  109. >背景播放</span>
  110. </div>
  111. </div>
  112. </div>
  113. <div id="report-rich-content" class="rich-content" style="position: relative;" ref="richConBox">
  114. <!-- 单人报告 -->
  115. <template v-if="info.auth_ok">
  116. <div v-if="!info.report_info.has_chapter">
  117. <ul>
  118. <li v-for="item in realContent" :key="item" v-html="item"></li>
  119. </ul>
  120. </div>
  121. <!-- 展示拼接的章节报告 -->
  122. <template v-if="info.report_info.has_chapter && info.report_detail_show_type===1">
  123. <div
  124. class="chapter-concat-item"
  125. v-for="chapter in info.report_chapter_list"
  126. :key="chapter.report_chapter_id"
  127. >
  128. <div class="chapter-title">
  129. <h3 class="chapter-title-text">{{chapter.title}}</h3>
  130. </div>
  131. <div class="html-cont" v-html="chapter.content"></div>
  132. </div>
  133. </template>
  134. </template>
  135. <div v-html="info.report_info.content_sub" v-else></div>
  136. <!-- 隐藏的水印 -->
  137. <div class="hide-watermark-box" v-if="userInfo">
  138. <div v-for="item in 20" :key="item">{{userInfo.mobile}}</div>
  139. </div>
  140. </div>
  141. <!-- 拼接版尾 -->
  142. <div class="html-end-img-box" v-if="info.auth_ok&&info.report_info.end_img">
  143. <img :src="info.report_info.end_img" alt="" style="display:block;width:100%">
  144. <div class="head-layout-item" v-for="item in endImgStyle" :key="item.value"
  145. :style="{fontFamily:item.family,fontSize:(item.size*2)+'px',fontWeight:item.weight,textAlign:item.align,color:item.color,
  146. width:item.width,height:item.height,left:item.left,top:item.top
  147. }">
  148. {{ layoutBaseInfo[item.value] }}
  149. </div>
  150. </div>
  151. </div>
  152. <!-- 无权限 -->
  153. <div class="no-auth-wrap" v-if="userInfo?.is_bind==0">
  154. <div class="apply-box">
  155. <div>您尚未登录,请登录后查看更多信息</div>
  156. <div class="btn" @click="handleGoLogin">立即登录</div>
  157. </div>
  158. </div>
  159. <template v-else>
  160. <div class="no-auth-wrap" v-if="!info.auth_ok">
  161. <div class="apply-box" v-if="info.permission_check.type=='apply'">
  162. <div>您暂无权限查看报告,若想查看请申请开通</div>
  163. <div class="btn" @click="handleGoApply">立即申请</div>
  164. </div>
  165. <div class="apply-box" v-else>
  166. <div>您暂无权限查看报告 </div>
  167. <div>若想查看请联系对口销售:{{info.permission_check.name}}</div>
  168. <a class="btn" :href="'tel:'+info.permission_check.mobile" tag="div">立即联系</a>
  169. </div>
  170. </div>
  171. </template>
  172. <!-- 右侧悬浮操作栏 -->
  173. <div class="right-fix-box">
  174. <!-- 收藏 -->
  175. <img v-if="info.auth_ok" @click="handleCollect" class="item collect-icon" :src="info.collection_id>0?collectIcons:collectIcon" alt="">
  176. <!-- ppt -->
  177. <img class="item ppt-icon" v-if="hasPPt" @click="goPPtDetail" src="@/assets/hzyb/report/ppt-icon.png" alt="">
  178. <!-- 分享海报 -->
  179. <SharePoster
  180. v-if="info.auth_ok"
  181. :isSlot="true"
  182. :shareData="{
  183. type:'report_detail',
  184. code_page:'pages-report/reportDetail',
  185. code_scene:code_scene,
  186. data:posterParams
  187. }"
  188. >
  189. <img class="item share-icon" src="@/assets/hzyb/share-poster-icon.png"/>
  190. </SharePoster>
  191. <!-- 返回顶部 -->
  192. <div class="item back-top-img">
  193. <img v-show="showToTop&&info.auth_ok" @click="handleBackTop" class="back-top-img" src="@/assets/hzyb/report/back-top.png"/>
  194. </div>
  195. </div>
  196. </div>
  197. <!-- 留言点赞模块 -->
  198. <div id="messgaeBoardCont" v-if="info.auth_ok && (!info.report_info.has_chapter||info.report_detail_show_type===1)">
  199. <LeaveMessage
  200. :info="info"
  201. @like_change="giveOrCancelLike"
  202. />
  203. </div>
  204. <!-- 免责声明 -->
  205. <Disclaimer v-model:show="showDisclaimers"/>
  206. <!-- 申请提示弹窗 -->
  207. <van-popup :show="pupData.show" @close="pupData.show=false" :close-on-click-overlay="false">
  208. <div class="global-pup">
  209. <div class="content">
  210. <div v-html="pupData.content"></div>
  211. </div>
  212. <div class="flex bot">
  213. <div @click="pupData.show=false">知道了</div>
  214. </div>
  215. </div>
  216. </van-popup>
  217. </div>
  218. <reportCancel v-if="isReportPublishCancel"/>
  219. </van-pull-refresh>
  220. </template>
  221. <script>
  222. // 由于当时写在uni中 直接复制过来的 也不想改了就写成vue2形式吧
  223. import moment from 'moment'
  224. import 'moment/dist/locale/zh-cn'
  225. moment.locale('zh-cn')
  226. import {addTokenToIframe} from '../utils/common'
  227. import { apiBaseConfig } from '@/api/hzyb/common'
  228. import {apiReportDetail,apiRddpShareImg,apiReportPPtImgs,apiPublicBannerMark,apiPublicBannerList} from '@/api/hzyb/report'
  229. import {apiApplyPermission,apiUserInfo,apiSetCollect,apiCancelCollect} from '@/api/hzyb/user'
  230. import {Popup,Image as VanImage,PullRefresh,Dialog, Toast,Swipe, SwipeItem} from 'vant'
  231. import AudioBox from './components/AudioBox.vue'
  232. import SharePoster from '../components/SharePoster.vue'
  233. import _ from 'lodash';
  234. import LeaveMessage from '../components/leaveMessage/index.vue'
  235. import collectIcon from '@/assets/hzyb/collect-icon.png'
  236. import collectIcons from '@/assets/hzyb/collect-icon-s.png'
  237. import reportCancel from './components/reportCancel.vue'
  238. import Disclaimer from '../components/Disclaimer.vue'
  239. export default {
  240. components:{
  241. [Popup.name]:Popup,
  242. [VanImage.name]:VanImage,
  243. [PullRefresh.name]:PullRefresh,
  244. [Swipe.name]:Swipe,
  245. [SwipeItem.name]:SwipeItem,
  246. [Dialog.name]:Dialog,
  247. AudioBox,
  248. SharePoster,
  249. LeaveMessage,
  250. reportCancel,
  251. Disclaimer
  252. },
  253. computed:{
  254. code_scene(){
  255. return JSON.stringify({
  256. reportId:this.reportId
  257. })
  258. },
  259. posterParams(){
  260. return {
  261. report_type:this.info.report_info.classify_name_first,
  262. // report_title:`【第${this.info.report_info.stage}期 | ${this.info.report_info.classify_name_second}】${this.info.report_info.title}`,
  263. report_title:this.title,
  264. report_abstract:this.info.report_info.content
  265. }
  266. }
  267. },
  268. data () {
  269. return {
  270. showDisclaimers:false,//显示免责声明
  271. reportId:0,
  272. info:null,
  273. title:'',//标题数据
  274. audioData:{},//音频数据
  275. chapterList:[],
  276. pupData:{
  277. show:false,
  278. content:'',//弹窗html字符串
  279. },
  280. loading:false,
  281. showToTop:false,
  282. totalContent:[],
  283. realContent:[],
  284. page_no: 0,
  285. pageSize: 20,//默认初始加载20个p标签
  286. total_page: 0,
  287. fromPage: '', // message定位到留言板
  288. hasPPt:false,//是否有ppt
  289. userInfo:null,
  290. shareData:{},//分享的数据传给ppt页
  291. collectIcon,
  292. collectIcons,
  293. showAttention:false,//是否显示配置播放清单提示
  294. isReportPublishCancel:false,//报告取消发布
  295. bannerDataList:[],
  296. headImgStyle:null,//版头style
  297. endImgStyle:null,//版尾style
  298. layoutBaseInfo:{
  299. 研报标题:'',
  300. 研报作者:'',
  301. 创建时间:''
  302. },
  303. disclaimer:''//免责声明
  304. }
  305. },
  306. beforeCreate(){
  307. if(this.$route.query.token){
  308. localStorage.setItem('hzyb-token',this.$route.query.token)
  309. localStorage.setItem('hzyb-userId',this.$route.query.userId)
  310. }
  311. },
  312. created(options) {
  313. this.reportId=this.$route.query.reportId
  314. this.fromPage = this.$route.query.fromPage || ''
  315. this.getDetail()
  316. this.getUserInfo()
  317. this.getConfig()
  318. // this.getBannerList()
  319. },
  320. mounted(){
  321. $(document).on('click', '.rich-content img',function(event) {
  322. let imgArray = [];
  323. let curImageSrc = $(this).attr('src');
  324. let oParent = $(this).parent();
  325. if (curImageSrc && !oParent.attr('href')) {
  326. $('.rich-content img').each(function(index, el) {
  327. let itemSrc = $(this).attr('src');
  328. imgArray.push(itemSrc);
  329. });
  330. wx.previewImage({current:curImageSrc,urls:imgArray});
  331. }
  332. })
  333. window.addEventListener('scroll',this.loadMoreHandle)
  334. },
  335. destroyed () {
  336. window.removeEventListener('scroll',this.loadMoreHandle)
  337. },
  338. methods: {
  339. // banner 获取列表
  340. async getBannerList(){
  341. console.log(112233333);
  342. const res = await apiPublicBannerList()
  343. if(res.code ===200){
  344. this.bannerDataList = res.data
  345. }
  346. },
  347. getConfig() {
  348. apiBaseConfig().then(res => {
  349. if (res.code == 200) {
  350. this.disclaimer = res.data.disclaimer
  351. }
  352. })
  353. },
  354. // banner 点击事件
  355. async bannerSwiperHandler(item){
  356. const res = await apiPublicBannerMark({
  357. first_source: 1, //一级来源 1小程序移动 2小程序pc 3研报官网
  358. second_source: 2, //二级来源 1首页 2研报详情页
  359. id:item.id
  360. })
  361. if(res.code===200){
  362. wx.miniProgram.navigateTo({
  363. url:"/pages-report/disseminatePage/disseminatePage?imgHb="+item.jump_url_mobile+'&title='+item.remark
  364. })
  365. }
  366. },
  367. // 点击开始播放周报的列表中的音频
  368. handlePlayWeekAudio(e){
  369. const arr=[]
  370. this.chapterList.forEach(item=>{
  371. if(item.is_close==0){
  372. arr.push({
  373. url:item.video_url,
  374. videoTime:item.video_play_seconds,
  375. videoName:item.video_name,
  376. videoImg:'https://hzstatic.hzinsights.com/static/yb_wx/report_list_zhou.png'
  377. })
  378. }
  379. })
  380. console.log(arr);
  381. let index=0
  382. arr.forEach((_item,idx)=>{
  383. if(_item.url==e.video_url) index=idx
  384. })
  385. this.$store.commit('hzyb/addAudio',{
  386. list:arr,
  387. index:index
  388. })
  389. },
  390. // 设置周报的播放清单
  391. handleGoSetAudioList(){
  392. wx.miniProgram.navigateTo({
  393. url:`/pages-report/audioPlayListSet?reportId=${this.reportId}`,
  394. })
  395. },
  396. closeAttention(){
  397. if(this.info.report_info.classify_name_first=='晨报'&&!this.info.auth_ok) return
  398. localStorage.setItem('showAttention','true')
  399. this.showAttention=false
  400. },
  401. //背景音频播放报告音频
  402. handlePlayAudioBG(){
  403. wx.miniProgram.navigateTo({
  404. url:`/pages-report/reportBgAudio?chapterId=0&reportId=${this.reportId}&ctime=${parseInt(this.$store.state.hzyb.videoCtime)}`,
  405. })
  406. },
  407. async getUserInfo(){
  408. const res=await apiUserInfo()
  409. if(res.code===200){
  410. this.userInfo=res.data
  411. }
  412. },
  413. // 页面滚动
  414. // handelPageScroll(){
  415. // const top=document.documentElement.scrollTop||document.body.scrollTop
  416. // if(top>window.outerHeight){
  417. // this.showToTop=true
  418. // }else{
  419. // this.showToTop=false
  420. // }
  421. // },
  422. //跳转ppt预览页
  423. goPPtDetail(){
  424. wx.miniProgram.navigateTo({
  425. url:`/pages-report/previewImage?reportId=${this.reportId}&chapterId=0&shareImg=${this.shareData.shareImg}&shareTitle=${this.shareData.title}`,
  426. })
  427. },
  428. //获取报告对应的ppt图片
  429. async getReportPPtImg(){
  430. const res=await apiReportPPtImgs({
  431. report_id:Number(this.reportId),
  432. report_chapter_id:0
  433. })
  434. if(res.code===200&&res.data.length>0){
  435. this.hasPPt=true
  436. }
  437. },
  438. //跳转线上路演
  439. goVideoPage(){
  440. wx.miniProgram.navigateTo(
  441. {
  442. url:`/pages-roadShow/video/list?videoId=${this.info.road_video_id}&chart_permission_id=${-1}&fromPage=report`
  443. }
  444. )
  445. },
  446. //获取报告详情
  447. async getDetail(){
  448. const res=await apiReportDetail({report_id:Number(this.reportId)})
  449. if(res.code===200){
  450. this.info=res.data
  451. this.headImgStyle=res.data.report_info.head_style?JSON.parse(res.data.report_info.head_style):[]
  452. this.endImgStyle=res.data.report_info.end_style?JSON.parse(res.data.report_info.end_style):[]
  453. this.layoutBaseInfo['研报标题']=res.data.report_info.title
  454. this.layoutBaseInfo['研报作者']=res.data.report_info.author
  455. // 已发布已通过的报告才显示发布时间
  456. this.layoutBaseInfo['创建时间']=moment(res.data.report_info.publish_time).format('YYYY.MM.DD HH:mm')
  457. this.audioData={
  458. auth_ok:res.data.auth_ok,
  459. video_name:res.data.report_info.video_name||`${res.data.report_info.title}(${moment(res.data.report_info.publish_time).format('MMDD')})`,
  460. video_play_seconds:res.data.report_info.video_play_seconds,
  461. video_url:res.data.report_info.video_url,
  462. video_img:res.data.report_info.video_img
  463. }
  464. this.chapterList=res.data.report_chapter_list
  465. document.title = res.data.report_info.classify_name_first||'';
  466. //非章节报告处理内容分页
  467. (!res.data.report_info.has_chapter) && this.splitContentHandle(this.info.report_info.content);
  468. //章节拼接报告拼接iframe token
  469. if(res.data.report_info.has_chapter&&res.data.report_detail_show_type===1) {
  470. res.data.report_chapter_list.forEach(chapter => {
  471. chapter.content = addTokenToIframe(chapter.content,this.reportId,chapter.report_chapter_id)
  472. })
  473. }
  474. if(!res.data.auth_ok){
  475. // 获取详情如果为联系销售根据判断条件是否主动申请一次
  476. if(this.info.permission_check.type=='contact'&&!this.info.permission_check.customer_info.has_apply){
  477. if(this.info.permission_check.customer_info.status=='冻结'||(this.info.permission_check.customer_info.status=='试用'&&this.info.permission_check.customer_info.is_suspend==1)){
  478. apiApplyPermission({
  479. company_name:this.info.permission_check.customer_info.company_name,
  480. real_name:this.info.permission_check.customer_info.name,
  481. source:4,
  482. from_page:'报告详情'
  483. }).then(res=>{
  484. if(res.code===200){
  485. console.log('主动申请成功');
  486. }
  487. })
  488. }
  489. }
  490. }
  491. if(res.data.auth_ok){
  492. this.getReportPPtImg()
  493. this.$nextTick(()=>{
  494. this.waterMark(res.data.permission_check.customer_info.mobile,this.$refs.richConBox)
  495. })
  496. }
  497. // 处理报告标题数据
  498. // if(!this.info.report_info.has_chapter){
  499. const time=moment(res.data.report_info.publish_time).format('MMDD')
  500. if(res.data.report_info.classify_name_second==res.data.report_info.title){
  501. this.title=`【第${res.data.report_info.stage}期】${res.data.report_info.title}(${time})`
  502. }else{
  503. this.title=`【第${res.data.report_info.stage}期|${res.data.report_info.classify_name_second}】${res.data.report_info.title}(${time})`
  504. }
  505. // }
  506. //向小程序发送分享数据
  507. //处理分享标题
  508. let shareTitle=''
  509. let shareImg=''
  510. let imgText=''//分享图上需要显示的内容
  511. const shareTime=moment(res.data.report_info.publish_time).format('MMDD')
  512. if(res.data.report_info.abstract){
  513. shareTitle=res.data.report_info.abstract
  514. imgText=`<div style="font-size:78px">第${res.data.report_info.stage}期 | ${res.data.report_info.title}(${shareTime})</div>`
  515. }else{
  516. shareTitle=res.data.report_info.title
  517. imgText=`<div style="font-size:78px">${moment(res.data.report_info.publish_time).format('YYYY/MM/DD')}</div><div style="font-size:78px">第${res.data.report_info.stage}期 | ${res.data.report_info.classify_name_second}</div>`
  518. if(this.info.report_info.has_chapter){
  519. imgText=`<div style="font-size:78px">${moment(res.data.report_info.publish_time).format('YYYY/MM/DD')}</div><div style="font-size:78px">第${res.data.report_info.stage}期 | ${res.data.report_info.classify_name_first} </div>`
  520. }
  521. }
  522. const rddpImgRes=await apiRddpShareImg({
  523. pars:JSON.stringify({
  524. title:imgText,
  525. time_format:moment(res.data.report_info.publish_time).format('YYYY/MM/DD'),
  526. background_img:res.data.report_info.share_bg_img,
  527. })
  528. ReportId:Number(this.reportId),
  529. })
  530. if(rddpImgRes.code===200){
  531. shareImg=rddpImgRes.data
  532. }
  533. this.shareData={
  534. title:shareTitle,
  535. reportId:this.reportId,
  536. shareImg:shareImg
  537. }
  538. wx.miniProgram.postMessage({
  539. data: {
  540. title:shareTitle,
  541. reportId:this.reportId,
  542. shareImg:shareImg
  543. }
  544. });
  545. // 周报判断是否要显示提示
  546. if(res.data.report_info.classify_name_first=='周报'){
  547. const showAtt=localStorage.getItem('showAttention')||""
  548. if(showAtt){
  549. this.showAttention=false
  550. }else{
  551. this.showAttention=true
  552. }
  553. }
  554. }else if(res.code===4002){
  555. this.isReportPublishCancel=true
  556. }
  557. },
  558. //添加水印
  559. waterMark(text,target){
  560. if(!target) return
  561. const canvas = document.createElement("canvas");
  562. const ctx = canvas.getContext("2d");
  563. ctx.font = "18px Arial";
  564. ctx.rotate((-45 * Math.PI) / 200);
  565. ctx.fillStyle='#F1F1F1'
  566. ctx.fillText(text, 30, 200);
  567. ctx.fillText(text, -40, 100);
  568. // 将canvas的内容转换为base64编码
  569. const data = canvas.toDataURL("image/png");
  570. target.style.background = "url(" + data + ") repeat";
  571. },
  572. // 智能布局内容排版全部变成1个1行的顺排
  573. formatSmartStyle() {
  574. this.$nextTick(() =>{
  575. $('.report-drag-item-wrap_child-wrap').css({
  576. 'flex-wrap': 'wrap',
  577. });
  578. $('.report-drag-item-wrap_child-wrap').children().css({
  579. 'flex': 'none',
  580. 'width': '100%'
  581. });
  582. })
  583. },
  584. /*内容分割*/
  585. splitContentHandle(content) {
  586. content=addTokenToIframe(content,this.reportId,0)
  587. const arr = content.split('</p>');
  588. this.totalContent = arr.map(_ => _+'</p>');
  589. this.realContent = this.totalContent.slice(0,this.pageSize)
  590. this.total_page = parseInt(this.totalContent.length / this.pageSize) + 1;
  591. this.formatSmartStyle()
  592. },
  593. /* 加载下一页内容 */
  594. loadContent() {
  595. this.realContent = this.realContent.concat(this.totalContent.slice(this.page_no*this.pageSize, (this.page_no + 1)*this.pageSize))
  596. this.formatSmartStyle()
  597. },
  598. loadMoreHandle: _.throttle(function() {
  599. const scrollTop = document.documentElement.scrollTop || document.body.scrollTop; // 滚动的高度
  600. if(scrollTop>window.outerHeight){
  601. this.showToTop=true
  602. }else{
  603. this.showToTop=false
  604. }
  605. if(this.page_no >= this.total_page) return
  606. const clientHeight = document.documentElement.clientHeight || document.body.clientHeight; // 可视高度
  607. const scrollHeight = document.body.scrollHeight; // 总高度
  608. const bufferHeight = 400;
  609. if((scrollHeight - scrollTop - clientHeight) < bufferHeight+100) {
  610. console.log('触底')
  611. this.page_no = this.page_no+1;
  612. this.loadContent();
  613. }
  614. },300),
  615. //返回顶部
  616. handleBackTop(){
  617. document.body.scrollTop=document.documentElement.scrollTop=0
  618. },
  619. //跳转章节详情
  620. goChapterDetail(item){
  621. // this.$router.push({
  622. // path:'/hzyb/report/chapterdetail',
  623. // query:{
  624. // chapterId:item.report_chapter_id
  625. // }
  626. // })
  627. wx.miniProgram.navigateTo({
  628. url:`/pages-report/chapterDetail?chapterId=${item.report_chapter_id}&fromPage=reportdetail`
  629. })
  630. },
  631. // 格式化时间
  632. formatTime(time){
  633. return moment(time).format('YYYY.MM.DD HH:mm:ss')
  634. },
  635. //格式化音频时间
  636. formatVoiceTime(e){
  637. let minus=parseInt(e/60)
  638. let sec=parseInt(e%60)
  639. return `${minus>9?minus:'0'+minus}分${sec>9?sec:'0'+sec}秒`
  640. },
  641. // 格式化章节列表时间
  642. formatChapterTime(time,type){
  643. if(type==='day'){
  644. return moment(time).format('DD')
  645. }
  646. if(type==='week'){
  647. return moment(time).format('dddd')
  648. }
  649. if(type==='year-month'){
  650. return moment(time).format('YYYY-MM')
  651. }
  652. if(type==='year-month-day'){
  653. return moment(time).format('YYYY-MM-DD')
  654. }
  655. },
  656. // 联系销售
  657. // handleContact(){
  658. // uni.makePhoneCall({
  659. // phoneNumber: this.info.permission_check.mobile
  660. // });
  661. // },
  662. //登录
  663. handleGoLogin(){
  664. wx.miniProgram.navigateTo({url:'/pages/login?from=tologin'})
  665. },
  666. //点击申请
  667. async handleGoApply(){
  668. if(this.userInfo.is_bind===0){
  669. Dialog.confirm({
  670. title:'温馨提示',
  671. message:'为了优化您的用户体验,\n 请登录后查看更多信息!',
  672. confirmButtonText:'去登录',
  673. confirmButtonColor:'#E6B77D',
  674. cancelButtonColor:'#666'
  675. }).then(res=>{
  676. wx.miniProgram.reLaunch({url:'/pages/login'})
  677. })
  678. return
  679. }
  680. if(this.info.permission_check.type=='apply'){
  681. if(this.info.permission_check.customer_info.has_apply){// 已经申请过
  682. this.pupData.show=true
  683. this.pupData.content=`<p>您已提交过申请,请耐心等待</p>`
  684. }else{
  685. if(!this.info.permission_check.customer_info.status||this.info.permission_check.customer_info.status!='流失'||this.info.permission_check.customer_info.status!='关闭'){
  686. wx.miniProgram.redirectTo({
  687. url:"/pages-applyPermission/applyPermission?source=4&from_page=报告详情"
  688. })
  689. }else{//主动调一次申请权限接口
  690. const res=await apiApplyPermission({
  691. company_name:this.info.permission_check.customer_info.company_name,
  692. real_name:this.info.permission_check.customer_info.name,
  693. source:4,
  694. from_page:'报告详情'
  695. })
  696. if(res.code===200){
  697. this.pupData.show=true
  698. this.pupData.content=`<p>申请已提交</p><p>请等待销售人员与您联系</p>`
  699. this.getDetail()
  700. }
  701. }
  702. }
  703. }
  704. },
  705. /* 点赞/取消点赞 */
  706. giveOrCancelLike({like_enabled,like_num}) {
  707. this.info.like_num = like_num;
  708. this.info.like_enabled = like_enabled;
  709. },
  710. onRefresh() {
  711. this.getDetail()
  712. setTimeout(() => {
  713. this.loading=false
  714. }, 1500);
  715. },
  716. // 设置tag颜色
  717. getTagColor(str){
  718. if( str.includes('多')||str.includes('强')||str.includes('反弹') ){
  719. return "#DF6051";
  720. }else if( str.includes('空')||str.includes('调整') ){
  721. return "#6FC5B4";
  722. }else{
  723. return "#009fe6";
  724. }
  725. },
  726. // 收藏
  727. handleCollect(){
  728. if(this.info.collection_id>0){
  729. apiCancelCollect({
  730. collection_id:Number(this.info.collection_id)
  731. }).then(res=>{
  732. if(res.code===200){
  733. Toast('取消收藏!')
  734. this.info.collection_id=0
  735. }
  736. })
  737. }else{
  738. apiSetCollect({
  739. collection_type:1,
  740. primary_id:Number(this.reportId),
  741. extend_id:0
  742. }).then(res=>{
  743. if(res.code===200){
  744. Toast('收藏成功!')
  745. this.info.collection_id=res.data
  746. }
  747. })
  748. }
  749. }
  750. }
  751. }
  752. </script>
  753. <style lang="scss" scoped>
  754. /* 公共弹窗 */
  755. .global-pup{
  756. background-color: #fff;
  757. width: 90vw;
  758. min-height: 200px;
  759. font-size: 32px;
  760. .content{
  761. padding: 34px;
  762. text-align: center;
  763. min-height: 250px;
  764. display: flex;
  765. align-items: center;
  766. text-align: center;
  767. line-height: 1.7;
  768. div{
  769. flex: 1;
  770. }
  771. }
  772. .bot{
  773. border-top: 1px solid #dedede;
  774. div{
  775. line-height: 96px;
  776. flex: 1;
  777. text-align: center;
  778. border-right: 1px solid #dedede;
  779. color:#E3B377;
  780. }
  781. div:last-child {
  782. border: none;
  783. }
  784. }
  785. }
  786. .flex{
  787. display: flex;
  788. }
  789. .report-detail-page{
  790. /* padding-bottom: 50px; */
  791. .main-box{
  792. padding: 34px;
  793. .title{
  794. display: inline;
  795. margin-left: -26px;
  796. }
  797. }
  798. .main-box-noauth{
  799. height: calc(100vh - 50px);
  800. overflow: hidden;
  801. }
  802. .title{
  803. font-size: 40px;
  804. font-weight: bold;
  805. margin-bottom: 30px;
  806. }
  807. .time{
  808. justify-content: space-between;
  809. font-size: 30px;
  810. margin-top: 30px;
  811. }
  812. .audio-wrap{
  813. height: 160px;
  814. background: #FAF7EE;
  815. border-radius: 16px;
  816. margin-top: 20px;
  817. padding: 10px 31px;
  818. margin-bottom: 31px;
  819. align-items: center;
  820. img{
  821. width: 110px;
  822. height: 110px;
  823. display: block;
  824. margin-right: 16px;
  825. }
  826. }
  827. .tips{
  828. font-size: 34px;
  829. margin-bottom: 51px;
  830. position: relative;
  831. &::before{
  832. content: '';
  833. width: 10px;
  834. // height: 100%;
  835. display: inline-block;
  836. background-color: #E3B377;
  837. margin-right: 20px;
  838. // position: relative;
  839. // top: 10px;
  840. }
  841. .abstract{
  842. font-size: 34px;
  843. margin-bottom: 20px;
  844. line-height: 1.5;
  845. }
  846. }
  847. .disclaimers-box{
  848. width: 94vw;
  849. padding: 32px;
  850. }
  851. .rich-content{
  852. line-height: 1.8;
  853. font-size: 36px;
  854. :deep(img){
  855. width: 100% !important;
  856. }
  857. :deep(span){
  858. font-size: 36px !important;
  859. line-height: 1.8 !important;
  860. background-color: rgba(255, 255, 255, 0) !important;
  861. }
  862. :deep(p){
  863. font-size: 36px !important;
  864. line-height: 1.8 !important;
  865. background-color: rgba(255, 255, 255, 0) !important;
  866. }
  867. :deep(ul){
  868. font-size: 36px !important;
  869. line-height: 1.8 !important;
  870. background-color: rgba(255, 255, 255, 0) !important;
  871. }
  872. :deep(ol){
  873. font-size: 36px !important;
  874. line-height: 1.8 !important;
  875. background-color: rgba(255, 255, 255, 0) !important;
  876. }
  877. :deep(iframe){
  878. width: 100% !important;
  879. }
  880. :deep(li) {
  881. font-size: 36px !important;
  882. line-height: 1.8 !important;
  883. background-color: rgba(255, 255, 255, 0) !important;
  884. list-style: inherit !important;
  885. list-style-position: inside !important;
  886. }
  887. :deep(span.fr-emoticon) {
  888. width: 36px !important;
  889. height: 36px !important;
  890. background-repeat: no-repeat !important;
  891. background-size: cover !important;
  892. display: inline-block !important;
  893. vertical-align: middle !important;
  894. }
  895. }
  896. .no-auth-wrap{
  897. min-height: 200px;
  898. padding: 0 34px 50px 34px;
  899. background: linear-gradient(360deg, #FFFFFF 60%, rgba(255, 255, 255, 0) 88%);
  900. // position: relative;
  901. // top: -150px;
  902. position: fixed;
  903. left: 0;
  904. right: 0;
  905. bottom: 0;
  906. z-index: 99;
  907. text-align: center;
  908. font-size: 32px;
  909. color: #E3B377;
  910. .apply-box{
  911. padding-top: 250px;
  912. }
  913. .btn{
  914. width: 100%;
  915. margin-left: auto;
  916. margin-right: auto;
  917. line-height: 80px;
  918. background-color: #E6B77D;
  919. border-radius: 4px;
  920. color: #fff;
  921. margin-top: 100px;
  922. display: block;
  923. }
  924. }
  925. .chapter-list-wrap{
  926. .top-box{
  927. height: 418px;
  928. background-color: rgba($color: #000000, $alpha: 0.7);
  929. background-size: cover;
  930. color: #fff;
  931. position: relative;
  932. .title{
  933. text-align: center;
  934. font-size: 34px;
  935. font-weight: 600;
  936. padding-top: 78px;
  937. }
  938. .sub-title{
  939. font-size: 32px;
  940. text-align: center;
  941. width: 70%;
  942. margin-left: auto;
  943. margin-right: auto;
  944. }
  945. .top-bot{
  946. position: absolute;
  947. bottom: 70px;
  948. left: 34px;
  949. right: 34px;
  950. justify-content: space-between;
  951. align-items: center;
  952. .time-box{
  953. align-items: center;
  954. font-size: 24px;
  955. .day{
  956. font-size: 32px;
  957. border-right: 1px solid #fff;
  958. padding-right: 15px;
  959. margin-right: 15px;
  960. }
  961. }
  962. .audio-play-list-box{
  963. background-color: #E3B377;
  964. color: #fff;
  965. font-size: 24px;
  966. width: 180px;
  967. line-height: 52px;
  968. border-radius: 25px;
  969. text-align: center;
  970. }
  971. .attention-box{
  972. position: absolute;
  973. bottom: 110%;
  974. background-color: #fff;
  975. color: #333;
  976. box-shadow: 0px 0px 10px 4px rgba(0, 0, 0, 0.16);
  977. padding: 20px 54px 20px 20px;
  978. border-radius: 8px;
  979. .close-icon{
  980. width: 24px;
  981. height: 24px;
  982. position: absolute;
  983. top: 50%;
  984. transform: translateY(-50%);
  985. right: 20px;
  986. }
  987. &::after{
  988. content: '';
  989. display:block;
  990. width: 0;
  991. height: 0;
  992. border: 10px solid transparent;
  993. border-top-color: #fff;
  994. position: absolute;
  995. bottom: -20px;
  996. right: 20px;
  997. }
  998. }
  999. }
  1000. .stage-num{
  1001. position: absolute;
  1002. bottom: 350px;
  1003. right: 34px;
  1004. }
  1005. .stage-num-day{
  1006. bottom: 70px;
  1007. }
  1008. }
  1009. .list-box{
  1010. margin-top: -50px;
  1011. border-top-left-radius: 40px;
  1012. border-top-right-radius: 40px;
  1013. min-height: 100px;
  1014. background-color: #fff;
  1015. position: relative;
  1016. z-index: 2;
  1017. .item{
  1018. padding: 30px 34px;
  1019. border-bottom: 1px solid #E5E5E5;
  1020. .img-box{
  1021. width: 104px;
  1022. height: 104px;
  1023. box-sizing: border-box;
  1024. border-radius: 8px;
  1025. border: solid 2.5px #E5E5E5;
  1026. display: flex;
  1027. align-items: center;
  1028. justify-content: center;
  1029. margin-right: 20px;
  1030. .img{
  1031. width: 60px;
  1032. height: 60px;
  1033. }
  1034. }
  1035. // .img{
  1036. // width: 104px;
  1037. // height: 104px;
  1038. // // background-color: #f5f5f5;
  1039. // flex-shrink: 0;
  1040. // // margin-right: 20px;
  1041. // }
  1042. .con{
  1043. flex: 1;
  1044. position: relative;
  1045. .title{
  1046. font-size: 28px;
  1047. color: #57768D;
  1048. font-weight: bold;
  1049. margin-bottom: 5px;
  1050. .tag{
  1051. font-size: 20px;
  1052. color: #fff;
  1053. font-weight: normal;
  1054. display: inline-block;
  1055. background-color: #1E88E5;
  1056. line-height: 37px;
  1057. padding: 0 6px;
  1058. border-radius: 4px;
  1059. margin-left: 10px;
  1060. }
  1061. }
  1062. .sub-title{
  1063. color: #999;
  1064. }
  1065. .update-time{
  1066. color: #D4D4D4;
  1067. font-size: 24px;
  1068. margin-top: 5px;
  1069. }
  1070. .audio-icon-box{
  1071. position: absolute;
  1072. top: 0;
  1073. right: 0;
  1074. width: 44px;
  1075. height: 40px;
  1076. background-image: url('@/assets/hzyb/report/icon-1.png');
  1077. background-size: cover;
  1078. }
  1079. .audio-icon-box_active{
  1080. background-image: url('@/assets/hzyb/report/icon-2.png');
  1081. }
  1082. }
  1083. }
  1084. }
  1085. .no-auth-box{
  1086. text-align: center;
  1087. font-size: 32px;
  1088. color: #E3B377;
  1089. img{
  1090. width: 100%;
  1091. margin-bottom: 50px;
  1092. }
  1093. .btn{
  1094. width: 90%;
  1095. margin-left: auto;
  1096. margin-right: auto;
  1097. line-height: 80px;
  1098. background-color: #E6B77D;
  1099. border-radius: 4px;
  1100. color: #fff;
  1101. margin-top: 100px;
  1102. display: block;
  1103. }
  1104. }
  1105. }
  1106. .right-fix-box{
  1107. position: fixed;
  1108. z-index: 99;
  1109. right: 34px;
  1110. bottom: 130px;
  1111. .item{
  1112. margin-top: 10px;
  1113. }
  1114. .back-top-img{
  1115. width: 100px;
  1116. height: 100px;
  1117. display: block;
  1118. }
  1119. .share-icon{
  1120. width: 100px;
  1121. height: 100px;
  1122. display: block;
  1123. }
  1124. .ppt-icon{
  1125. width: 100px;
  1126. height: 100px;
  1127. display: block;
  1128. }
  1129. .collect-icon{
  1130. width: 100px;
  1131. height: 100px;
  1132. display: block;
  1133. }
  1134. }
  1135. }
  1136. .content-swipe {
  1137. width: 100%;
  1138. padding: 30px 34px 0 34px;
  1139. .my-swipe {
  1140. width: 100%;
  1141. .van-swipe-item {
  1142. width: 100%;
  1143. height: auto;
  1144. overflow: hidden;
  1145. }
  1146. img {
  1147. object-fit: contain;
  1148. width: 100%;
  1149. height: 100%;
  1150. }
  1151. }
  1152. }
  1153. .html-head-img-box,.html-end-img-box{
  1154. margin-bottom: 10px;
  1155. position: relative;
  1156. overflow: hidden;
  1157. .head-layout-item{
  1158. position: absolute;
  1159. overflow: hidden;
  1160. box-sizing: border-box
  1161. }
  1162. }
  1163. .chapter-concat-item {
  1164. padding: 20px 0;
  1165. .chapter-title {
  1166. display: flex;
  1167. align-items: center;
  1168. font-size: 30px;
  1169. .type {
  1170. height: fit-content;
  1171. display: inline-block;
  1172. color: #fff;
  1173. padding: 10px 20px;
  1174. background-color: #E6A23C;
  1175. border-radius: 8px;
  1176. margin-right: 20px;
  1177. }
  1178. .chapter-title-text {
  1179. font-size: 30px;
  1180. }
  1181. }
  1182. }
  1183. </style>