|
@@ -43,7 +43,7 @@
|
|
|
|
|
|
<script lang="ts">
|
|
|
import { Component, Vue } from 'vue-property-decorator'
|
|
|
-import { mapActions } from 'vuex'
|
|
|
+import { mapActions, mapMutations } from 'vuex'
|
|
|
import { Icon, Toast, GoodsAction, GoodsActionIcon, GoodsActionButton, Sticky } from 'vant'
|
|
|
import Recharge from '@/components/Recharge.vue'
|
|
|
import sharePop from '@/components/SharePopup.vue'
|
|
@@ -73,10 +73,14 @@ const pdfjsViewer = require('pdfjs-dist/web/pdf_viewer.js')
|
|
|
getShare: 'main/getShare',
|
|
|
getAdd: 'main/getAdd',
|
|
|
getRemove: 'main/getRemove'
|
|
|
+ }),
|
|
|
+ ...mapMutations({
|
|
|
+ clearLibState: 'main/clearMyLibState'
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
export default class extends Vue {
|
|
|
+ clearLibState: any
|
|
|
getDetails: any
|
|
|
getCoin: any
|
|
|
getDown: any
|
|
@@ -96,10 +100,10 @@ export default class extends Vue {
|
|
|
pdfDocument: any
|
|
|
config: any = {
|
|
|
PAGE_TO_VIEW: 0,
|
|
|
- SCALE: 1,
|
|
|
- CMAP_URL: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.6.347/cmaps/',
|
|
|
+ SCALE: 0,
|
|
|
+ CMAP_URL: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.1.266/cmaps/',
|
|
|
CMAP_PACKED: true,
|
|
|
- workerSrc: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.6.347/es5/build/pdf.worker.min.js'
|
|
|
+ workerSrc: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.1.266/build/pdf.worker.min.js'
|
|
|
}
|
|
|
|
|
|
pData: any = {
|
|
@@ -151,7 +155,7 @@ export default class extends Vue {
|
|
|
config: {
|
|
|
title: this.detailData.docName,
|
|
|
desc: this.detailData.docSummary,
|
|
|
- url: this.links
|
|
|
+ link: this.links
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -160,15 +164,15 @@ export default class extends Vue {
|
|
|
;(this.$refs.shares as any).show = true
|
|
|
}
|
|
|
|
|
|
- updateText ({ type = '', value = '' }) {
|
|
|
- console.log(type, value)
|
|
|
- switch (type) {
|
|
|
+ updateText (data) {
|
|
|
+ console.log(data)
|
|
|
+ switch (data.type) {
|
|
|
case 'count': {
|
|
|
- document.getElementById('page_count').textContent = value
|
|
|
+ ;(document.getElementById('page_count') as HTMLDivElement).textContent = data.value
|
|
|
break
|
|
|
}
|
|
|
case 'num': {
|
|
|
- document.getElementById('page_num').textContent = value
|
|
|
+ ;(document.getElementById('page_count') as HTMLDivElement).textContent = data.value
|
|
|
break
|
|
|
}
|
|
|
}
|
|
@@ -265,16 +269,16 @@ export default class extends Vue {
|
|
|
canged () {
|
|
|
if (this.collectd === 0) {
|
|
|
this.getAdd({ docId: this.docIds }).then((res: any) => {
|
|
|
- console.log(res)
|
|
|
if (res.error_code === 0) {
|
|
|
+ this.clearLibState('clearCollections') // 清除我的收藏列表缓存数据
|
|
|
this.collectd = 1
|
|
|
Toast('收藏成功')
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
this.getRemove({ docId: this.docIds }).then((res: any) => {
|
|
|
- console.log(res)
|
|
|
if (res.error_code === 0) {
|
|
|
+ this.clearLibState('clearCollections') // 清除我的收藏列表缓存数据
|
|
|
this.collectd = 0
|
|
|
Toast('取消收藏')
|
|
|
}
|