|
@@ -11,7 +11,7 @@
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<div class="search-nav">
|
|
<div class="search-nav">
|
|
|
<div id="search-block " class="">
|
|
<div id="search-block " class="">
|
|
|
- <el-tabs v-model="searchType" type="card" @tab-click="handleClick" v-if="tabArr">
|
|
|
|
|
|
|
+ <el-tabs v-model="searchType" type="card" @tab-click="handleTypeClick" v-if="tabArr">
|
|
|
<el-tab-pane v-for="item in tabArr" :label="item.label" :name="item.name" :key="item.label"></el-tab-pane>
|
|
<el-tab-pane v-for="item in tabArr" :label="item.label" :name="item.name" :key="item.label"></el-tab-pane>
|
|
|
</el-tabs>
|
|
</el-tabs>
|
|
|
<div class="search-input">
|
|
<div class="search-input">
|
|
@@ -27,14 +27,14 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
<!--TabNav-->
|
|
<!--TabNav-->
|
|
|
- <el-tabs :value="currTab" @tab-click="handleClick" class="square-tab" v-if="menuArr">
|
|
|
|
|
|
|
+ <el-tabs :value="currTab" @tab-click="handleTabClick" class="square-tab" v-if="menuArr">
|
|
|
<el-tab-pane v-if="!menuArr.menuArr1" v-for="item in menuArr" :name="item.name" :key="item.name" class="tab-menu1">
|
|
<el-tab-pane v-if="!menuArr.menuArr1" v-for="item in menuArr" :name="item.name" :key="item.name" class="tab-menu1">
|
|
|
<span slot="label" style="font-size: 18px">{{item.label}}</span>
|
|
<span slot="label" style="font-size: 18px">{{item.label}}</span>
|
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
|
- <el-tab-pane v-if="menuArr.menuArr1" v-for="item in menuArr.menuArr1" :label="item.label" :name="item.name" :key="item.name" class="tab-menu1"></el-tab-pane>
|
|
|
|
|
|
|
+ <el-tab-pane v-if="menuArr.menuArr1" v-for="item in menuArr.menuArr1" :label="item.label" :name="item.name" :key="item.name"></el-tab-pane>
|
|
|
<!-- <el-tab-pane v-if="menuArr.menuArr1" name="name" class="tab-menu1" label="|">|</el-tab-pane>-->
|
|
<!-- <el-tab-pane v-if="menuArr.menuArr1" name="name" class="tab-menu1" label="|">|</el-tab-pane>-->
|
|
|
- <el-tab-pane v-if="menuArr.menuArr1" v-for="item in menuArr.menuArr2" :label="item.label" :name="item.name" :key="item.name" class="tab-menu2"></el-tab-pane>
|
|
|
|
|
- <el-tab-pane v-if="menuArr.menuArr1" v-for="item in menuArr.menuArr3" :label="item.label" :name="item.name" :key="item.name" class="tab-menu3"></el-tab-pane>
|
|
|
|
|
|
|
+ <el-tab-pane v-if="menuArr.menuArr1" v-for="item in menuArr.menuArr2" :label="item.label" :name="item.name" :key="item.name"></el-tab-pane>
|
|
|
|
|
+ <el-tab-pane v-if="menuArr.menuArr1" v-for="item in menuArr.menuArr3" :label="item.label" :name="item.name" :key="item.name"></el-tab-pane>
|
|
|
</el-tabs>
|
|
</el-tabs>
|
|
|
<div>
|
|
<div>
|
|
|
</div>
|
|
</div>
|
|
@@ -44,6 +44,8 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import { mapGetters , mapActions} from 'vuex'
|
|
import { mapGetters , mapActions} from 'vuex'
|
|
|
|
|
+ import commonData from '../../constants/tabMenu'
|
|
|
|
|
+ import Http from '@/js/http.js'
|
|
|
export default {
|
|
export default {
|
|
|
name: 'SearchBar',
|
|
name: 'SearchBar',
|
|
|
// components:{},
|
|
// components:{},
|
|
@@ -66,14 +68,35 @@
|
|
|
},
|
|
},
|
|
|
methods:{
|
|
methods:{
|
|
|
...mapActions(["setActiveTab"]),
|
|
...mapActions(["setActiveTab"]),
|
|
|
- handleClick(tab){
|
|
|
|
|
|
|
+ handleTabClick(tab){
|
|
|
|
|
+ // console.log(tab);
|
|
|
this.setActiveTab(tab.name);
|
|
this.setActiveTab(tab.name);
|
|
|
- this.currTab=tab.name;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ // console.log(this.getActiveTab);
|
|
|
|
|
+ let pathInfo = commonData.menuData.find((item)=>{
|
|
|
|
|
+ return item.name === tab.name})
|
|
|
|
|
+ //注意: 直接写pathInfo.targetPage 会 undefined
|
|
|
|
|
+ console.log(pathInfo);
|
|
|
|
|
+ let path = pathInfo&&pathInfo.targetPage;
|
|
|
|
|
+ console.log(path);
|
|
|
|
|
+ // console.log({searchType:'项目',keyword: this.searchVal});
|
|
|
|
|
+ this.$router.push({path,query:{searchType:'项目',keyword: this.searchVal}});
|
|
|
|
|
+ this.$router.push({path,query:{keyword: this.searchVal}});
|
|
|
|
|
+ },
|
|
|
|
|
+ handleTypeClick(tab){
|
|
|
|
|
+ this.searchType = tab.name;
|
|
|
},
|
|
},
|
|
|
- // handleSearchData(){
|
|
|
|
|
- // if(getActiveTab == 'square')
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ handleSearchData(){
|
|
|
|
|
+ // console.log(commonData.menuData);
|
|
|
|
|
+ // console.log(this.getActiveTab);
|
|
|
|
|
+ // let url = commonData.menuData.find((item)=>{return item.name = this.getActiveTab});
|
|
|
|
|
+ // let params = {"keyword": this.keyword,"activePage":this.activePage}
|
|
|
|
|
+ let targetTab = this.getActiveTab;
|
|
|
|
|
+ let pathInfo = commonData.menuData.find((item)=>{
|
|
|
|
|
+ return item.name === this.getActiveTab})
|
|
|
|
|
+ //注意: 直接写pathInfo.targetPage 会 undefined
|
|
|
|
|
+ let path = pathInfo&&pathInfo.targetPage;
|
|
|
|
|
+ this.$router.push({path,query:{keyword: this.searchVal}});
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|