|
@@ -49,7 +49,7 @@
|
|
<i :class="'el-icon-jy-' + fileType(datas.docFileType)"></i>
|
|
<i :class="'el-icon-jy-' + fileType(datas.docFileType)"></i>
|
|
<span>{{datas.docName}}</span>
|
|
<span>{{datas.docName}}</span>
|
|
</h3>
|
|
</h3>
|
|
- <span class="pages"><i id="page_num"></i> / <i id="page_count"></i></span>
|
|
|
|
|
|
+ <span class="pages"><i>{{page_num}}</i> / <i>{{page_count}}</i></span>
|
|
</div>
|
|
</div>
|
|
<div class="bottoms" id="colWidth" v-show="buyed == 1">
|
|
<div class="bottoms" id="colWidth" v-show="buyed == 1">
|
|
<div class="page">
|
|
<div class="page">
|
|
@@ -114,6 +114,8 @@ export default {
|
|
offsetTop: 0,
|
|
offsetTop: 0,
|
|
offsetWidth: 0,
|
|
offsetWidth: 0,
|
|
colWidth: 0,
|
|
colWidth: 0,
|
|
|
|
+ page_num: 0,
|
|
|
|
+ page_count: 0,
|
|
redShow: false,
|
|
redShow: false,
|
|
lineShow: false,
|
|
lineShow: false,
|
|
fixed: false,
|
|
fixed: false,
|
|
@@ -146,6 +148,14 @@ export default {
|
|
window.removeEventListener('scroll', this.initHeight)
|
|
window.removeEventListener('scroll', this.initHeight)
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ setTop () {
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ // 获取到达页面顶端的值
|
|
|
|
+ const heights = document.getElementById('fixedTop')
|
|
|
|
+ // this.offsetTop = heights.offsetTop
|
|
|
|
+ this.offsetTop = heights.getBoundingClientRect().top
|
|
|
|
+ })
|
|
|
|
+ },
|
|
initHeight () {
|
|
initHeight () {
|
|
// 获取页面滚动距离
|
|
// 获取页面滚动距离
|
|
const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
|
|
const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
|
|
@@ -162,11 +172,11 @@ export default {
|
|
updateText ({ type, value = '' }) {
|
|
updateText ({ type, value = '' }) {
|
|
switch (type) {
|
|
switch (type) {
|
|
case 'count': {
|
|
case 'count': {
|
|
- document.querySelector('#page_count').textContent = value
|
|
|
|
|
|
+ this.page_count = value
|
|
break
|
|
break
|
|
}
|
|
}
|
|
case 'num': {
|
|
case 'num': {
|
|
- document.querySelector('#page_num').textContent = value
|
|
|
|
|
|
+ this.page_num = value
|
|
break
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -188,8 +198,6 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
init () {
|
|
init () {
|
|
- console.log(this.conts.data)
|
|
|
|
- // Loading document.
|
|
|
|
pdfjsLib.GlobalWorkerOptions.workerSrc = this.config.workerSrc
|
|
pdfjsLib.GlobalWorkerOptions.workerSrc = this.config.workerSrc
|
|
const loadingTask = pdfjsLib.getDocument({
|
|
const loadingTask = pdfjsLib.getDocument({
|
|
url: this.conts.data,
|
|
url: this.conts.data,
|
|
@@ -198,7 +206,6 @@ export default {
|
|
})
|
|
})
|
|
loadingTask.promise.then((pdfDocument) => {
|
|
loadingTask.promise.then((pdfDocument) => {
|
|
this.pdfDocument = pdfDocument
|
|
this.pdfDocument = pdfDocument
|
|
- console.log(this.pdfDocument.numPages)
|
|
|
|
this.updateText({ type: 'count', value: this.pdfDocument.numPages })
|
|
this.updateText({ type: 'count', value: this.pdfDocument.numPages })
|
|
this.updateText({ type: 'num', value: 1 })
|
|
this.updateText({ type: 'num', value: 1 })
|
|
for (let i = 0; i < this.pdfDocument.numPages; i++) {
|
|
for (let i = 0; i < this.pdfDocument.numPages; i++) {
|
|
@@ -259,7 +266,7 @@ export default {
|
|
if (res.data.error_code === 0) {
|
|
if (res.data.error_code === 0) {
|
|
this.datas = res.data.data.detail
|
|
this.datas = res.data.data.detail
|
|
this.datas.docFileSize = formatSize(this.datas.docFileSize)
|
|
this.datas.docFileSize = formatSize(this.datas.docFileSize)
|
|
- this.datas.uploadDate = dateFormatter(this.datas.uploadDate, 'yyyy-MM-dd')
|
|
|
|
|
|
+ this.datas.uploadDate = dateFormatter(this.datas.uploadDate, 'yyyy/MM/dd')
|
|
this.datas.docSummary = this.datas.docSummary.split('').length >= 500 ? this.datas.docSummary + '...' : this.datas.docSummary
|
|
this.datas.docSummary = this.datas.docSummary.split('').length >= 500 ? this.datas.docSummary + '...' : this.datas.docSummary
|
|
this.datas.tags = this.datas.tags.split(',').slice(0, 3)
|
|
this.datas.tags = this.datas.tags.split(',').slice(0, 3)
|
|
this.buyed = res.data.data.status
|
|
this.buyed = res.data.data.status
|
|
@@ -285,15 +292,6 @@ export default {
|
|
this.adsUrl = res.data.data
|
|
this.adsUrl = res.data.data
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- setTop () {
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- // 获取到达页面顶端的值
|
|
|
|
- const heights = document.getElementById('fixedTop')
|
|
|
|
- // this.offsetTop = heights.offsetTop
|
|
|
|
- this.offsetTop = heights.getBoundingClientRect().top
|
|
|
|
- console.log(this.offsetTop)
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
shoucang () {
|
|
shoucang () {
|
|
console.log(this.collectd)
|
|
console.log(this.collectd)
|
|
if (this.collectd === 0) {
|
|
if (this.collectd === 0) {
|