mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-15 13:56:43 +08:00
提交
This commit is contained in:
@@ -31,8 +31,9 @@
|
|||||||
<span v-if="loadedRatio !== 1" style="margin:0 10px;">0 / 0</span>
|
<span v-if="loadedRatio !== 1" style="margin:0 10px;">0 / 0</span>
|
||||||
<span v-else style="margin:0 10px;">{{ currentPage }} / {{ pageCount }}</span>
|
<span v-else style="margin:0 10px;">{{ currentPage }} / {{ pageCount }}</span>
|
||||||
<el-button @click="nextPage('footer')" :disabled="loadedRatio !== 1" icon="el-icon-arrow-right"></el-button> -->
|
<el-button @click="nextPage('footer')" :disabled="loadedRatio !== 1" icon="el-icon-arrow-right"></el-button> -->
|
||||||
<el-button type="text" v-if="moreState == 1"> 加载更多 </el-button>
|
<span class="pag-text-msg" v-if="moreState == 1"> 加载更多 </span>
|
||||||
<el-button type="text" v-if="moreState == 2">加载中</el-button>
|
<span class="pag-text-msg" v-if="moreState == 2">加载中</span>
|
||||||
|
<span class="pag-text-msg" v-if="moreState == 3">没有更多数据了</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -103,7 +104,6 @@ export default {
|
|||||||
// console.log(e,'loadProgress');
|
// console.log(e,'loadProgress');
|
||||||
},
|
},
|
||||||
loadedPageHandle(e){
|
loadedPageHandle(e){
|
||||||
console.log(e,'loadedPageHandle');
|
|
||||||
this.pdfpage = e;
|
this.pdfpage = e;
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -120,24 +120,16 @@ export default {
|
|||||||
},
|
},
|
||||||
//加载页面
|
//加载页面
|
||||||
loadInitPdf(url) {
|
loadInitPdf(url) {
|
||||||
|
|
||||||
if(url && url.indexOf('.pdf')>-1){
|
if(url && url.indexOf('.pdf')>-1){
|
||||||
let loadingTask = pdf.createLoadingTask(url);
|
let loadingTask = pdf.createLoadingTask(url);
|
||||||
this.src=loadingTask;
|
this.src=loadingTask;
|
||||||
|
|
||||||
loadingTask.promise.then((pdf) =>{
|
loadingTask.promise.then((pdf) =>{
|
||||||
console.log(pdf)
|
|
||||||
this.totalPages=pdf.numPages;
|
this.totalPages=pdf.numPages;
|
||||||
|
|
||||||
|
|
||||||
if(pdf.numPages>this.initNum){
|
if(pdf.numPages>this.initNum){
|
||||||
this.showPages = this.initNum;
|
this.showPages = this.initNum;
|
||||||
|
|
||||||
} else{
|
} else{
|
||||||
this.showPages =pdf.numPages;
|
this.showPages =pdf.numPages;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch((err) =>{
|
}).catch((err) =>{
|
||||||
this.$message.error("加载内容失败,请联系管理员");
|
this.$message.error("加载内容失败,请联系管理员");
|
||||||
});
|
});
|
||||||
@@ -151,38 +143,29 @@ export default {
|
|||||||
let outerHeight = document.documentElement.clientHeight
|
let outerHeight = document.documentElement.clientHeight
|
||||||
let scrollTop = document.documentElement.scrollTop
|
let scrollTop = document.documentElement.scrollTop
|
||||||
if((outerHeight + scrollTop + 350) >= innerHeight) {
|
if((outerHeight + scrollTop + 350) >= innerHeight) {
|
||||||
if(this.isscroll){
|
if(this.isscroll){
|
||||||
this.debounce(this.clickMore(),5000);
|
this.debounce(this.clickMore(),6000);
|
||||||
}
|
}
|
||||||
console.log(this.showPages,this.totalPages)
|
if( this.showPages >= this.totalPages){
|
||||||
if( this.showPages >= this.totalPages){
|
this.isscroll = false
|
||||||
this.isscroll = false
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.log(this.pdfpage,'000')
|
|
||||||
// console.log(this.totalPages,this.pdfpage)
|
|
||||||
if(this.pdfpage >= this.totalPages){
|
if(this.pdfpage >= this.totalPages){
|
||||||
this.isscroll = false
|
this.isscroll = false
|
||||||
this.moreState = 3
|
this.moreState = 3
|
||||||
// console.log('hcuewhf')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
debounce(func, wait) {// 非立即执行
|
debounce(func, wait) {// 非立即执行
|
||||||
let timeout;
|
let timeout;
|
||||||
return function () {
|
return function () {
|
||||||
let context = this;
|
let context = this;
|
||||||
let args = arguments;
|
let args = arguments;
|
||||||
if (timeout) clearTimeout(timeout);
|
if (timeout) clearTimeout(timeout);
|
||||||
timeout = setTimeout(() => {
|
timeout = setTimeout(() => {
|
||||||
func.apply(context, args)
|
func.apply(context, args)
|
||||||
}, wait);
|
}, wait);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
prePage(type) {
|
prePage(type) {
|
||||||
if (this.currentPage > 1) {
|
if (this.currentPage > 1) {
|
||||||
this.currentPage--;
|
this.currentPage--;
|
||||||
|
|||||||
Reference in New Issue
Block a user