|
@@ -1,16 +1,16 @@
|
|
<template>
|
|
<template>
|
|
- <div class="search-input">
|
|
|
|
- <el-input
|
|
|
|
- placeholder="搜索文档"
|
|
|
|
- v-model="input"
|
|
|
|
- @keyup.enter.native="submitSearch('onEnter')"
|
|
|
|
- clearable>
|
|
|
|
- <el-button @click="submitSearch('onSubmit')" slot="append" icon="el-icon-jy-search"></el-button>
|
|
|
|
- </el-input>
|
|
|
|
- <el-tabs v-model="type" v-show="tabs.length" @tab-click="submitSearch('onChangeType')">
|
|
|
|
- <el-tab-pane v-for="item in tabs" :key="item.type" :label="item.label" :name="item.type"></el-tab-pane>
|
|
|
|
- </el-tabs>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div class="search-input">
|
|
|
|
+ <el-input
|
|
|
|
+ placeholder="搜索文档"
|
|
|
|
+ v-model="input"
|
|
|
|
+ @keyup.enter.native="submitSearch('onEnter')"
|
|
|
|
+ clearable>
|
|
|
|
+ <el-button @click="submitSearch('onSubmit')" slot="append" icon="el-icon-jy-search"></el-button>
|
|
|
|
+ </el-input>
|
|
|
|
+ <!-- <el-tabs v-model="type" v-show="tabs.length" @tab-click="submitSearch('onChangeType')">
|
|
|
|
+ <el-tab-pane v-for="item in tabs" :key="item.type" :label="item.label" :name="item.type"></el-tab-pane>
|
|
|
|
+ </el-tabs> -->
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
@@ -19,123 +19,122 @@ import { getSearchTag } from '../api/modules/home'
|
|
import { recoveryPageData } from '../utils'
|
|
import { recoveryPageData } from '../utils'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
- name: 'Search-Input',
|
|
|
|
- props: {
|
|
|
|
- msg: String
|
|
|
|
- },
|
|
|
|
- components: {
|
|
|
|
- [Input.name]: Input,
|
|
|
|
- [Tabs.name]: Tabs,
|
|
|
|
- [TabPane.name]: TabPane,
|
|
|
|
- [Button.name]: Button
|
|
|
|
- },
|
|
|
|
- data () {
|
|
|
|
- return {
|
|
|
|
- input: '',
|
|
|
|
- type: '全部',
|
|
|
|
- tabs: []
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- mounted () {
|
|
|
|
- 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) {
|
|
|
|
- this.input = qUrl.text
|
|
|
|
- this.$emit('recovery', {
|
|
|
|
- type: this.type,
|
|
|
|
- text: this.input.trim().replace(/\s+/g, ' ')
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+name: 'Search-Input',
|
|
|
|
+props: {
|
|
|
|
+ msg: String
|
|
|
|
+},
|
|
|
|
+components: {
|
|
|
|
+ [Input.name]: Input,
|
|
|
|
+ [Tabs.name]: Tabs,
|
|
|
|
+ [TabPane.name]: TabPane,
|
|
|
|
+ [Button.name]: Button
|
|
|
|
+},
|
|
|
|
+data () {
|
|
|
|
+ return {
|
|
|
|
+ input: '',
|
|
|
|
+ // type: '全部',
|
|
|
|
+ // tabs: []
|
|
|
|
+ }
|
|
|
|
+},
|
|
|
|
+mounted () {
|
|
|
|
+ // 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) {
|
|
|
|
+ this.input = qUrl.text
|
|
|
|
+ this.$emit('recovery', {
|
|
|
|
+ type: this.type,
|
|
|
|
+ text: this.input.trim().replace(/\s+/g, ' ')
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+},
|
|
|
|
+methods: {
|
|
|
|
+ // async getTags () {
|
|
|
|
+ // getSearchTag().then(res => {
|
|
|
|
+ // if (!res.data.error_msg.length) {
|
|
|
|
+ // this.tabs = res.data.data.map(v => {
|
|
|
|
+ // return {
|
|
|
|
+ // type: v,
|
|
|
|
+ // label: v
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // if (this.type === '') {
|
|
|
|
+ // this.type = this.tabs[0].type
|
|
|
|
+ // }
|
|
|
|
+ // sessionStorage.setItem('jy-docs-search-tags-pc', JSON.stringify(this.tabs))
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
|
|
+ setSearchContent: function (v) {
|
|
|
|
+ this.input = v
|
|
},
|
|
},
|
|
- methods: {
|
|
|
|
- async getTags () {
|
|
|
|
- getSearchTag().then(res => {
|
|
|
|
- if (!res.data.error_msg.length) {
|
|
|
|
- this.tabs = res.data.data.map(v => {
|
|
|
|
- return {
|
|
|
|
- type: v,
|
|
|
|
- label: v
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- if (this.type === '') {
|
|
|
|
- this.type = this.tabs[0].type
|
|
|
|
- }
|
|
|
|
- sessionStorage.setItem('jy-docs-search-tags-pc', JSON.stringify(this.tabs))
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
- setSearchContent: function (v) {
|
|
|
|
- this.input = v
|
|
|
|
- },
|
|
|
|
- submitSearch (e) {
|
|
|
|
- this.$emit('submit', {
|
|
|
|
- type: this.type,
|
|
|
|
- text: this.input.trim().replace(/\s+/g, ' '),
|
|
|
|
- events: e
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ submitSearch (e) {
|
|
|
|
+ this.$emit('submit', {
|
|
|
|
+ text: this.input.trim().replace(/\s+/g, ' '),
|
|
|
|
+ events: e
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
- .search-input {
|
|
|
|
- width: 640px;
|
|
|
|
- margin: 0 auto;
|
|
|
|
- @include diy-icon('search', 24);
|
|
|
|
- ::v-deep .el-tabs__nav-wrap::after {
|
|
|
|
- background-color: transparent;
|
|
|
|
- }
|
|
|
|
- ::v-deep .el-tabs__item {
|
|
|
|
- height: 48px;
|
|
|
|
- line-height: 48px;
|
|
|
|
- font-size: 14px;
|
|
|
|
- color: #686868;
|
|
|
|
- }
|
|
|
|
- ::v-deep .el-tabs__active-bar {
|
|
|
|
- background-color: #2CB7CA;
|
|
|
|
- }
|
|
|
|
- ::v-deep .el-tabs__item.is-active {
|
|
|
|
- color: #2CB7CA;
|
|
|
|
|
|
+ .search-input {
|
|
|
|
+ width: 640px;
|
|
|
|
+ margin: 0 auto;
|
|
|
|
+ @include diy-icon('search', 24);
|
|
|
|
+ ::v-deep .el-tabs__nav-wrap::after {
|
|
|
|
+ background-color: transparent;
|
|
}
|
|
}
|
|
- ::v-deep .el-tabs--bottom .el-tabs__item.is-bottom:nth-child(2),
|
|
|
|
- ::v-deep .el-tabs--bottom .el-tabs__item.is-top:nth-child(2),
|
|
|
|
- ::v-deep .el-tabs--top .el-tabs__item.is-bottom:nth-child(2),
|
|
|
|
- ::v-deep .el-tabs--top .el-tabs__item.is-top:nth-child(2) {
|
|
|
|
- padding-left: 20px;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ::v-deep .el-tabs--bottom .el-tabs__item.is-bottom:last-child,
|
|
|
|
- ::v-deep .el-tabs--bottom .el-tabs__item.is-top:last-child,
|
|
|
|
- ::v-deep .el-tabs--top .el-tabs__item.is-bottom:last-child,
|
|
|
|
- ::v-deep .el-tabs--top .el-tabs__item.is-top:last-child {
|
|
|
|
- padding-right: 20px;
|
|
|
|
|
|
+ ::v-deep .el-tabs__item {
|
|
|
|
+ height: 48px;
|
|
|
|
+ line-height: 48px;
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ color: #686868;
|
|
}
|
|
}
|
|
|
|
+ ::v-deep .el-tabs__active-bar {
|
|
|
|
+ background-color: #2CB7CA;
|
|
|
|
+ }
|
|
|
|
+ ::v-deep .el-tabs__item.is-active {
|
|
|
|
+ color: #2CB7CA;
|
|
|
|
+ }
|
|
|
|
+ ::v-deep .el-tabs--bottom .el-tabs__item.is-bottom:nth-child(2),
|
|
|
|
+ ::v-deep .el-tabs--bottom .el-tabs__item.is-top:nth-child(2),
|
|
|
|
+ ::v-deep .el-tabs--top .el-tabs__item.is-bottom:nth-child(2),
|
|
|
|
+ ::v-deep .el-tabs--top .el-tabs__item.is-top:nth-child(2) {
|
|
|
|
+ padding-left: 20px;
|
|
|
|
+ }
|
|
|
|
|
|
- ::v-deep .el-input__inner {
|
|
|
|
- border-radius: 22px 0 0 22px;
|
|
|
|
- background: #FFFFFF;
|
|
|
|
- border: 1px solid #E0E0E0;
|
|
|
|
- padding-left: 24px;
|
|
|
|
- color: #1D1D1D;
|
|
|
|
- font-family: Microsoft YaHei;
|
|
|
|
- font-size: 16px;
|
|
|
|
- line-height: 24px;
|
|
|
|
- height: 42px;
|
|
|
|
- }
|
|
|
|
- ::v-deep .el-input-group__append {
|
|
|
|
- height: 42px;
|
|
|
|
- box-sizing: border-box;
|
|
|
|
- text-align: center;
|
|
|
|
- border: none;
|
|
|
|
- border-radius: 0px 22px 22px 0px;
|
|
|
|
- background: #2CB7CA;
|
|
|
|
- .el-button {
|
|
|
|
- padding: 8px 24px;
|
|
|
|
- margin-top: -4px;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ ::v-deep .el-tabs--bottom .el-tabs__item.is-bottom:last-child,
|
|
|
|
+ ::v-deep .el-tabs--bottom .el-tabs__item.is-top:last-child,
|
|
|
|
+ ::v-deep .el-tabs--top .el-tabs__item.is-bottom:last-child,
|
|
|
|
+ ::v-deep .el-tabs--top .el-tabs__item.is-top:last-child {
|
|
|
|
+ padding-right: 20px;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ ::v-deep .el-input__inner {
|
|
|
|
+ border-radius: 22px 0 0 22px;
|
|
|
|
+ background: #FFFFFF;
|
|
|
|
+ border: 1px solid #E0E0E0;
|
|
|
|
+ padding-left: 24px;
|
|
|
|
+ color: #1D1D1D;
|
|
|
|
+ font-family: Microsoft YaHei;
|
|
|
|
+ font-size: 16px;
|
|
|
|
+ line-height: 24px;
|
|
|
|
+ height: 42px;
|
|
|
|
+ }
|
|
|
|
+ ::v-deep .el-input-group__append {
|
|
|
|
+ height: 42px;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ text-align: center;
|
|
|
|
+ border: none;
|
|
|
|
+ border-radius: 0px 22px 22px 0px;
|
|
|
|
+ background: #2CB7CA;
|
|
|
|
+ .el-button {
|
|
|
|
+ padding: 8px 24px;
|
|
|
|
+ margin-top: -4px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
</style>
|
|
</style>
|