|
@@ -8,9 +8,9 @@
|
|
</div>
|
|
</div>
|
|
{{datas.docName}}
|
|
{{datas.docName}}
|
|
</h3>
|
|
</h3>
|
|
- <div class="tips">
|
|
|
|
|
|
+ <div class="cd-tips">
|
|
<ul>
|
|
<ul>
|
|
- <li class="tags" v-for="item in datas.tags" :key="item">{{item}}</li>
|
|
|
|
|
|
+ <li class="li-tags" v-for="item in getContentTags" :key="item">{{item}}</li>
|
|
<li>{{datas.viewTimes}}次浏览<el-divider direction="vertical"></el-divider></li>
|
|
<li>{{datas.viewTimes}}次浏览<el-divider direction="vertical"></el-divider></li>
|
|
<li>{{datas.downTimes}}次下载<el-divider direction="vertical"></el-divider></li>
|
|
<li>{{datas.downTimes}}次下载<el-divider direction="vertical"></el-divider></li>
|
|
<li>共{{datas.docPageSize}}页<el-divider direction="vertical"></el-divider></li>
|
|
<li>共{{datas.docPageSize}}页<el-divider direction="vertical"></el-divider></li>
|
|
@@ -42,14 +42,14 @@
|
|
<div class="middles" :class="{'actives':buyed == 0, 'actives1':lineShow == 1}">
|
|
<div class="middles" :class="{'actives':buyed == 0, 'actives1':lineShow == 1}">
|
|
<h3>摘要</h3>
|
|
<h3>摘要</h3>
|
|
<p>{{datas.docSummary}}</p>
|
|
<p>{{datas.docSummary}}</p>
|
|
- <div class="continue" v-show="buyed == 0">全文共{{datas.docPageSize}}页,<span @click="continued">继续阅读<i class="el-icon-arrow-down"></i></span></div>
|
|
|
|
|
|
+ <div class="continue" v-show="buyed == 0">全文共{{datas.docPageSize}}页,<span @click="continued">阅读全文<i class="el-icon-arrow-down"></i></span></div>
|
|
</div>
|
|
</div>
|
|
<div class="head-tip" id="fixedTop" :class="{'is-fixed':fixed}">
|
|
<div class="head-tip" id="fixedTop" :class="{'is-fixed':fixed}">
|
|
<h3 v-show="fixed">
|
|
<h3 v-show="fixed">
|
|
<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">
|
|
@@ -89,8 +89,9 @@
|
|
<script>
|
|
<script>
|
|
import { Button, Tooltip, Divider, Message } from 'element-ui'
|
|
import { Button, Tooltip, Divider, Message } from 'element-ui'
|
|
import { getDetails, getShow, getRecommend, getDown, getAdverse, getCoin, getAdd, getRemove } from '../api/modules/detail'
|
|
import { getDetails, getShow, getRecommend, getDown, getAdverse, getCoin, getAdd, getRemove } from '../api/modules/detail'
|
|
-import { formatSize, dateFormatter } from '@/utils/'
|
|
|
|
|
|
+import { formatSize, dateFormatter, recoveryPageData } from '@/utils/'
|
|
import vRecommend from '@/components/recommend'
|
|
import vRecommend from '@/components/recommend'
|
|
|
|
+import { getSearchTag } from '../api/modules/home'
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
[Button.name]: Button,
|
|
[Button.name]: Button,
|
|
@@ -114,6 +115,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,
|
|
@@ -128,7 +131,8 @@ export default {
|
|
},
|
|
},
|
|
pData: {
|
|
pData: {
|
|
heightList: []
|
|
heightList: []
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ tabs: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created () {
|
|
created () {
|
|
@@ -142,10 +146,36 @@ export default {
|
|
// 监听滚轮
|
|
// 监听滚轮
|
|
window.addEventListener('scroll', this.initHeight)
|
|
window.addEventListener('scroll', this.initHeight)
|
|
},
|
|
},
|
|
|
|
+ beforeMount () {
|
|
|
|
+ this.tabs = recoveryPageData('jy-docs-search-tags-pc')
|
|
|
|
+ this.getTags()
|
|
|
|
+ },
|
|
destroyed () { // 移除监听
|
|
destroyed () { // 移除监听
|
|
window.removeEventListener('scroll', this.initHeight)
|
|
window.removeEventListener('scroll', this.initHeight)
|
|
},
|
|
},
|
|
|
|
+ computed: {
|
|
|
|
+ getContentTags () {
|
|
|
|
+ const a = new Set(this.datas.tags)
|
|
|
|
+ const b = new Set(this.tabs.map(v => v.type))
|
|
|
|
+ const arr = Array.from(new Set([...b].filter(x => a.has(x))))
|
|
|
|
+
|
|
|
|
+ const oldArr = Array.from(a)
|
|
|
|
+ arr.forEach(v => {
|
|
|
|
+ oldArr.splice(oldArr.indexOf(v), 1)
|
|
|
|
+ })
|
|
|
|
+ const nArr = arr.concat(oldArr)
|
|
|
|
+ return nArr.splice(0, 3)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
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 +192,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 +218,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 +226,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++) {
|
|
@@ -238,7 +265,7 @@ export default {
|
|
this.btnName = '立即充值'
|
|
this.btnName = '立即充值'
|
|
this.redShow = true
|
|
this.redShow = true
|
|
} else {
|
|
} else {
|
|
- this.btnName = '立即兑换'
|
|
|
|
|
|
+ this.btnName = '下载文档'
|
|
this.redShow = false
|
|
this.redShow = false
|
|
this.lineShow = true
|
|
this.lineShow = true
|
|
}
|
|
}
|
|
@@ -254,14 +281,27 @@ export default {
|
|
})
|
|
})
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ getTags () {
|
|
|
|
+ getSearchTag().then(res => {
|
|
|
|
+ if (!res.data.error_msg.length) {
|
|
|
|
+ this.tabs = res.data.data.map(v => {
|
|
|
|
+ return {
|
|
|
|
+ type: v,
|
|
|
|
+ label: v
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ sessionStorage.setItem('jy-docs-search-tags-pc', JSON.stringify(this.tabs))
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
details () {
|
|
details () {
|
|
getDetails({ docId: this.docIds, from: this.$route.query.from }).then(res => {
|
|
getDetails({ docId: this.docIds, from: this.$route.query.from }).then(res => {
|
|
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.replace(/-/g, '/'), '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(',')
|
|
this.buyed = res.data.data.status
|
|
this.buyed = res.data.data.status
|
|
if (this.buyed === 1) {
|
|
if (this.buyed === 1) {
|
|
document.getElementById('fixedTop').style.display = 'block'
|
|
document.getElementById('fixedTop').style.display = 'block'
|
|
@@ -285,15 +325,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) {
|
|
@@ -395,7 +426,7 @@ export default {
|
|
margin-top: 5px;
|
|
margin-top: 5px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- .tips {
|
|
|
|
|
|
+ .cd-tips {
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
padding: 12px 0;
|
|
padding: 12px 0;
|
|
@@ -410,8 +441,11 @@ export default {
|
|
display: flex;
|
|
display: flex;
|
|
list-style-type: none;
|
|
list-style-type: none;
|
|
align-items: center;
|
|
align-items: center;
|
|
|
|
+ color: #686868;
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ line-height: 24px;
|
|
}
|
|
}
|
|
- .tags {
|
|
|
|
|
|
+ .li-tags {
|
|
padding: 2px 8px;
|
|
padding: 2px 8px;
|
|
border-radius: 4px;
|
|
border-radius: 4px;
|
|
background: rgba(44, 167, 227, 0.08);
|
|
background: rgba(44, 167, 227, 0.08);
|
|
@@ -421,11 +455,6 @@ export default {
|
|
text-align: center;
|
|
text-align: center;
|
|
margin-right: 8px;
|
|
margin-right: 8px;
|
|
}
|
|
}
|
|
- li:not(.tags, .coin) {
|
|
|
|
- color: #686868;
|
|
|
|
- font-size: 14px;
|
|
|
|
- line-height: 24px;
|
|
|
|
- }
|
|
|
|
.no-line {
|
|
.no-line {
|
|
border-right: none !important;
|
|
border-right: none !important;
|
|
}
|
|
}
|
|
@@ -462,7 +491,7 @@ export default {
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
align-items: center;
|
|
- .el-button {
|
|
|
|
|
|
+ ::v-deep .el-button {
|
|
width: 132px;
|
|
width: 132px;
|
|
height: 36px;
|
|
height: 36px;
|
|
padding: 7px 34px 8px 34px;
|
|
padding: 7px 34px 8px 34px;
|