ChapterDetail.vue 34 KB

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