|
@@ -10,7 +10,7 @@
|
|
</h3>
|
|
</h3>
|
|
<div class="tips">
|
|
<div class="tips">
|
|
<ul>
|
|
<ul>
|
|
- <li class="tags" v-for="item in datas.tags" :key="item">{{item}}</li>
|
|
|
|
|
|
+ <li class="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>
|
|
@@ -91,6 +91,8 @@ 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 } from '@/utils/'
|
|
import vRecommend from '@/components/recommend'
|
|
import vRecommend from '@/components/recommend'
|
|
|
|
+import { getSearchTag } from "../api/modules/home";
|
|
|
|
+import { recoveryPageData } from "../utils";
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
[Button.name]: Button,
|
|
[Button.name]: Button,
|
|
@@ -130,7 +132,8 @@ export default {
|
|
},
|
|
},
|
|
pData: {
|
|
pData: {
|
|
heightList: []
|
|
heightList: []
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ tabs: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created () {
|
|
created () {
|
|
@@ -144,9 +147,27 @@ 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 () {
|
|
setTop () {
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
@@ -261,6 +282,19 @@ 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) {
|
|
@@ -268,7 +302,7 @@ export default {
|
|
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(',')
|
|
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'
|