|
@@ -13,7 +13,7 @@
|
|
|
</div>
|
|
|
<div class="botts" v-show="buyed">
|
|
|
<div class="cont-page" id="pdfPage">
|
|
|
- <iframe :src="conts" width="100%" height="100%"></iframe>
|
|
|
+ <!-- <iframe :src="conts" width="100%" height="100%"></iframe> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
<van-goods-action>
|
|
@@ -41,6 +41,8 @@ import { Icon, Toast, GoodsAction, GoodsActionIcon, GoodsActionButton } from 'va
|
|
|
import Recharge from '@/components/Recharge.vue'
|
|
|
import sharePop from '@/components/SharePopup.vue'
|
|
|
import { MixinTop } from '@/utils/mixin-top'
|
|
|
+const pdfjsLib = require('pdfjs-dist/build/pdf.js').default
|
|
|
+const pdfjsViewer = require('pdfjs-dist/web/pdf_viewer.js').default
|
|
|
|
|
|
@Component({
|
|
|
name: 'details-p',
|
|
@@ -135,39 +137,39 @@ export default class extends Vue {
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- // renders () {
|
|
|
- // const container = document.getElementById('pdfPage')
|
|
|
- // return this.pdfDocument.getPage(this.config.PAGE_TO_VIEW).then((pdfPage: any) => {
|
|
|
- // const pdfPageView = new pdfjsViewer.PDFPageView({
|
|
|
- // container: container,
|
|
|
- // id: this.config.PAGE_TO_VIEW,
|
|
|
- // scale: this.config.SCALE,
|
|
|
- // defaultViewport: pdfPage.getViewport({ scale: this.config.SCALE }),
|
|
|
- // eventBus: new pdfjsViewer.EventBus(),
|
|
|
- // annotationLayerFactory: new pdfjsViewer.DefaultAnnotationLayerFactory()
|
|
|
- // })
|
|
|
- // pdfPageView.setPdfPage(pdfPage)
|
|
|
- // this.pData.heightList.push(pdfPageView.viewport.height)
|
|
|
- // return pdfPageView.draw()
|
|
|
- // })
|
|
|
- // }
|
|
|
+ renders () {
|
|
|
+ const container = document.getElementById('pdfPage')
|
|
|
+ return this.pdfDocument.getPage(this.config.PAGE_TO_VIEW).then((pdfPage: any) => {
|
|
|
+ const pdfPageView = new pdfjsViewer.PDFPageView({
|
|
|
+ container: container,
|
|
|
+ id: this.config.PAGE_TO_VIEW,
|
|
|
+ scale: this.config.SCALE,
|
|
|
+ defaultViewport: pdfPage.getViewport({ scale: this.config.SCALE }),
|
|
|
+ eventBus: new pdfjsViewer.EventBus(),
|
|
|
+ annotationLayerFactory: new pdfjsViewer.DefaultAnnotationLayerFactory()
|
|
|
+ })
|
|
|
+ pdfPageView.setPdfPage(pdfPage)
|
|
|
+ this.pData.heightList.push(pdfPageView.viewport.height)
|
|
|
+ return pdfPageView.draw()
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- // init () {
|
|
|
- // console.log(this.conts)
|
|
|
- // const loadingTask = pdfjsLib.getDocument({
|
|
|
- // url: this.conts
|
|
|
- // })
|
|
|
- // loadingTask.promise.then((pdfDocument: any) => {
|
|
|
- // this.pdfDocument = pdfDocument
|
|
|
- // console.log(this.pdfDocument.numPages)
|
|
|
- // // this.updateText({type: 'count', value: this.pdfDocument.numPages})
|
|
|
- // // this.updateText({type: 'num', value: 1})
|
|
|
- // for (let i = 0; i < this.pdfDocument.numPages; i++) {
|
|
|
- // this.config.PAGE_TO_VIEW++
|
|
|
- // this.renders()
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
+ init () {
|
|
|
+ console.log(this.conts)
|
|
|
+ const loadingTask = pdfjsLib.getDocument({
|
|
|
+ url: this.conts
|
|
|
+ })
|
|
|
+ loadingTask.promise.then((pdfDocument: any) => {
|
|
|
+ this.pdfDocument = pdfDocument
|
|
|
+ console.log(this.pdfDocument.numPages)
|
|
|
+ // this.updateText({type: 'count', value: this.pdfDocument.numPages})
|
|
|
+ // this.updateText({type: 'num', value: 1})
|
|
|
+ for (let i = 0; i < this.pdfDocument.numPages; i++) {
|
|
|
+ this.config.PAGE_TO_VIEW++
|
|
|
+ this.renders()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
watchPage () {
|
|
|
const top = window.scrollY
|
|
@@ -181,21 +183,28 @@ export default class extends Vue {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ buyShow () {
|
|
|
+ this.getShow({ docId: this.docIds }).then((res: any) => {
|
|
|
+ console.log(res.data)
|
|
|
+ this.conts = res.data
|
|
|
+ this.init()
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
onList () {
|
|
|
- this.getDetails({ docId: this.docIds }).then((res: any) => {
|
|
|
+ this.getDetails({ docId: this.docIds, from: this.$route.query.from }).then((res: any) => {
|
|
|
console.log(res.data)
|
|
|
this.detailData = res.data.detail
|
|
|
this.buyed = res.data.status
|
|
|
+ if (res.data.status === 1) {
|
|
|
+ this.buyShow()
|
|
|
+ }
|
|
|
this.collectd = res.data.collect
|
|
|
})
|
|
|
this.getCoin({ B: true }).then((res: any) => {
|
|
|
console.log(res.data.data)
|
|
|
this.coins = res.data.data.points
|
|
|
})
|
|
|
- this.getShow({ docId: this.docIds }).then((res: any) => {
|
|
|
- console.log(res.data)
|
|
|
- this.conts = res.data
|
|
|
- })
|
|
|
}
|
|
|
|
|
|
jubaod () {
|