|
@@ -7,7 +7,7 @@
|
|
|
clearable>
|
|
|
<el-button @click="submitSearch" slot="append" icon="el-icon-jy-search"></el-button>
|
|
|
</el-input>
|
|
|
- <el-tabs v-model="type">
|
|
|
+ <el-tabs v-model="type" v-show="tabs.length">
|
|
|
<el-tab-pane v-for="item in tabs" :key="item.type" :label="item.label" :name="item.type"></el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</div>
|
|
@@ -15,6 +15,9 @@
|
|
|
|
|
|
<script>
|
|
|
import { Input, Button, Tabs, TabPane } from 'element-ui'
|
|
|
+import { getSearchTag } from '../api/modules/home'
|
|
|
+import { recoveryPageData } from '../utils'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'Search-Input',
|
|
|
props: {
|
|
@@ -29,28 +32,13 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
input: '',
|
|
|
- type: 'all',
|
|
|
- tabs: [
|
|
|
- {
|
|
|
- type: 'all',
|
|
|
- label: '全部'
|
|
|
- },
|
|
|
- {
|
|
|
- type: '招标',
|
|
|
- label: '招标'
|
|
|
- },
|
|
|
- {
|
|
|
- type: '法律法规',
|
|
|
- label: '法律法规'
|
|
|
- },
|
|
|
- {
|
|
|
- type: '行业报告',
|
|
|
- label: '行业报告'
|
|
|
- }
|
|
|
- ]
|
|
|
+ type: '全部',
|
|
|
+ tabs: []
|
|
|
}
|
|
|
},
|
|
|
beforeMount () {
|
|
|
+ this.tabs = recoveryPageData('jy-docs-search-tags-pc')
|
|
|
+ this.getTags()
|
|
|
const qUrl = this.$route.query
|
|
|
qUrl && qUrl.type && (this.type = qUrl.type)
|
|
|
if (qUrl && qUrl.text) {
|
|
@@ -62,6 +50,20 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ async getTags () {
|
|
|
+ getSearchTag().then(res => {
|
|
|
+ if (!res.data.error_msg.length) {
|
|
|
+ this.tabs = res.data.data.map(v => {
|
|
|
+ return {
|
|
|
+ type: v,
|
|
|
+ label: v
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.type = this.tabs[0].type
|
|
|
+ sessionStorage.setItem('jy-docs-search-tags-pc', JSON.stringify(this.tabs))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
submitSearch () {
|
|
|
if (!this.input.length) {
|
|
|
return
|