|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
-<van-pull-refresh v-model="loading" @refresh="onRefresh" style="min-height:100vh">
|
|
|
+<van-pull-refresh v-model="loading" disabled style="min-height:100vh">
|
|
|
<div class="chapter-detail-page" v-if="info" :style="{paddingBottom:$store.state.hzyb.audioData.url&&'80px'}">
|
|
|
<div :class="['main-box',!info.auth_ok&&'main-box-noauth']">
|
|
|
<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>
|
|
@@ -14,7 +14,12 @@
|
|
|
<span style="color: #e3b377; margin-left: 20px" @click="showDisclaimers = true">免责声明</span>
|
|
|
</div>
|
|
|
<div class="rich-content">
|
|
|
- <div v-html="info.report_chapter_item.content" v-if="info.auth_ok"></div>
|
|
|
+ <!-- <div v-html="info.report_chapter_item.content" v-if="info.auth_ok"></div> -->
|
|
|
+ <div v-if="info.auth_ok">
|
|
|
+ <ul>
|
|
|
+ <li v-for="item in realContent" :key="item" v-html="item"></li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
<div v-html="info.report_chapter_item.content_sub" v-else ></div>
|
|
|
</div>
|
|
|
<!-- 指标数据模块 -->
|
|
@@ -115,6 +120,7 @@ import {apiApplyPermission} from '@/api/hzyb/user'
|
|
|
import {Popup,Image as VanImage,PullRefresh,Col, Row} from 'vant'
|
|
|
import AudioBox from './components/AudioBox.vue'
|
|
|
import SharePoster from '../components/SharePoster.vue'
|
|
|
+import _ from 'lodash';
|
|
|
export default {
|
|
|
components:{
|
|
|
[Popup.name]:Popup,
|
|
@@ -158,7 +164,13 @@ export default {
|
|
|
|
|
|
loading:false,
|
|
|
|
|
|
- showToTop:false
|
|
|
+ showToTop:false,
|
|
|
+
|
|
|
+ totalContent:[],
|
|
|
+ realContent:[],
|
|
|
+ page_no: 0,
|
|
|
+ pageSize: 20,//默认初始加载20个p标签
|
|
|
+ total_page: 0,
|
|
|
|
|
|
};
|
|
|
},
|
|
@@ -185,20 +197,20 @@ export default {
|
|
|
wx.previewImage({current:curImageSrc,urls:imgArray});
|
|
|
}
|
|
|
})
|
|
|
- window.addEventListener('scroll',this.handelPageScroll)
|
|
|
+ window.addEventListener('scroll',this.loadMoreHandle)
|
|
|
},
|
|
|
destroyed () {
|
|
|
- window.removeEventListener('scroll',this.handelPageScroll)
|
|
|
+ window.removeEventListener('scroll',this.loadMoreHandle)
|
|
|
},
|
|
|
methods: {
|
|
|
- handelPageScroll(){
|
|
|
- const top=document.documentElement.scrollTop||document.body.scrollTop
|
|
|
- if(top>window.outerHeight){
|
|
|
- this.showToTop=true
|
|
|
- }else{
|
|
|
- this.showToTop=false
|
|
|
- }
|
|
|
- },
|
|
|
+ // handelPageScroll(){
|
|
|
+ // const top=document.documentElement.scrollTop||document.body.scrollTop
|
|
|
+ // if(top>window.outerHeight){
|
|
|
+ // this.showToTop=true
|
|
|
+ // }else{
|
|
|
+ // this.showToTop=false
|
|
|
+ // }
|
|
|
+ // },
|
|
|
|
|
|
async getDetail(){
|
|
|
const res=await apiChapterDetail({report_chapter_id:Number(this.chapterId)})
|
|
@@ -216,6 +228,8 @@ export default {
|
|
|
this.getTickerValue()
|
|
|
}
|
|
|
|
|
|
+ this.splitContentHandle(this.info.report_chapter_item.content)
|
|
|
+
|
|
|
if(!res.data.auth_ok){
|
|
|
// 获取详情如果为联系销售根据判断条件是否主动申请一次
|
|
|
if(this.info.permission_check.type=='contact'&&!this.info.permission_check.customer_info.has_apply){
|
|
@@ -244,6 +258,43 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ /*内容分割*/
|
|
|
+ splitContentHandle(content) {
|
|
|
+ const arr = content.split('</p>');
|
|
|
+ this.totalContent = arr.map(_ => _+'</p>');
|
|
|
+ this.realContent = this.totalContent.slice(0,this.pageSize)
|
|
|
+ this.total_page = parseInt(this.totalContent.length / this.pageSize) + 1;
|
|
|
+ console.log( this.totalContent,this.realContent,this.total_page)
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 加载下一页内容 */
|
|
|
+ loadContent() {
|
|
|
+ this.realContent = this.realContent.concat(this.totalContent.slice(this.page_no*this.pageSize, (this.page_no + 1)*this.pageSize))
|
|
|
+ },
|
|
|
+
|
|
|
+ loadMoreHandle: _.throttle(function() {
|
|
|
+
|
|
|
+ const scrollTop = document.documentElement.scrollTop || document.body.scrollTop; // 滚动的高度
|
|
|
+
|
|
|
+ if(scrollTop>window.outerHeight){
|
|
|
+ this.showToTop=true
|
|
|
+ }else{
|
|
|
+ this.showToTop=false
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.page_no >= this.total_page) return
|
|
|
+
|
|
|
+ const clientHeight = document.documentElement.clientHeight || document.body.clientHeight; // 可视高度
|
|
|
+ const scrollHeight = document.body.scrollHeight; // 总高度
|
|
|
+ const bufferHeight = 400;
|
|
|
+
|
|
|
+ if((scrollHeight - scrollTop - clientHeight) < bufferHeight+100) {
|
|
|
+ console.log('触底')
|
|
|
+ this.page_no = this.page_no+1;
|
|
|
+ this.loadContent();
|
|
|
+ }
|
|
|
+ },300),
|
|
|
+
|
|
|
//获取晨报中指标数据
|
|
|
async getTickerValue(){
|
|
|
const res=await apiChapterTickerValue({report_chapter_id:Number(this.chapterId)})
|