|
@@ -14,8 +14,8 @@
|
|
|
<div class="search_area">
|
|
|
<div class="area_title">项目地区:</div>
|
|
|
<div class="area_wrap">
|
|
|
- <span class="area_tag" @click="focusArea('全国')" :class="areaItem == '全国'?'activeArea':''">全国</span>
|
|
|
- <span class="area_tag" v-for="(item,index) in areaList" :key="index+'A'" v-show="item != '全国'" @click="focusArea(item)" :class="areaItem == item?'activeArea':''">{{item}}</span>
|
|
|
+ <span class="area_tag" @click="focusArea('全国')" :class="areaTagsList.indexOf('全国') !== -1 && areaTagsList.length === 1?'activeArea':''">全国</span>
|
|
|
+ <span class="area_tag" v-for="item in areaList" :key="item" v-show="item != '全国'" @click="focusArea(item)" :class="areaTagsList.indexOf(item) !== -1?'activeArea':''">{{item}}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="search_wrap">
|
|
@@ -100,6 +100,7 @@ export default {
|
|
|
|
|
|
areaList: [], // 筛选地区列表
|
|
|
areaItem: '全国', // 选中的地区
|
|
|
+ areaTagsList: ['全国'], // 筛选地区多选
|
|
|
|
|
|
projectTipsType: false // 筛选内容状态,false为有内容,true为没有内容
|
|
|
}
|
|
@@ -150,32 +151,58 @@ export default {
|
|
|
let thisList = []
|
|
|
let thisTitle = ''
|
|
|
let thisType = ''
|
|
|
- if (name === '全国' && this.searchContent === '') {
|
|
|
- thisList = this.dataList
|
|
|
- } else if (name !== '全国' && this.searchContent === '') {
|
|
|
- this.dataList.forEach(item => {
|
|
|
- if (item.area === name) {
|
|
|
- thisList.push(item)
|
|
|
- }
|
|
|
- })
|
|
|
- } else if (name === '全国' && this.searchContent !== '') {
|
|
|
- this.dataList.forEach(item => {
|
|
|
- thisTitle = item.title
|
|
|
- thisType = thisTitle.indexOf(this.searchContent)
|
|
|
- if (thisType !== -1) {
|
|
|
- thisList.push(item)
|
|
|
- }
|
|
|
- })
|
|
|
- } else if (name !== '全国' && this.searchContent !== '') {
|
|
|
- this.dataList.forEach(item => {
|
|
|
- thisTitle = item.title
|
|
|
- thisType = thisTitle.indexOf(this.searchContent)
|
|
|
- if (thisType !== -1 && item.area === name) {
|
|
|
- thisList.push(item)
|
|
|
+ let tagsList = []
|
|
|
+ let num = 0
|
|
|
+ if (name === '全国') {
|
|
|
+ this.areaTagsList = ['全国']
|
|
|
+ } else {
|
|
|
+ tagsList = this.areaTagsList
|
|
|
+ tagsList.forEach((item, index) => {
|
|
|
+ if (item === name) {
|
|
|
+ num++
|
|
|
+ tagsList.splice(index, 1)
|
|
|
+ } else {
|
|
|
+ if (num === 0) {
|
|
|
+ tagsList.push(name)
|
|
|
+ tagsList = [...new Set(tagsList)]
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
+ this.areaTagsList = tagsList
|
|
|
}
|
|
|
- this.showDataList = thisList
|
|
|
+ this.areaTagsList.forEach(itemA => {
|
|
|
+ if (name !== '全国' && this.searchContent === '') {
|
|
|
+ this.dataList.forEach(item => {
|
|
|
+ if (item.area === itemA) {
|
|
|
+ thisList.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (name !== '全国' && this.searchContent !== '') {
|
|
|
+ this.dataList.forEach(item => {
|
|
|
+ thisTitle = item.title
|
|
|
+ thisType = thisTitle.indexOf(this.searchContent)
|
|
|
+ if (thisType !== -1 && item.area === itemA) {
|
|
|
+ thisList.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (name === '全国' && this.searchContent === '') {
|
|
|
+ thisList = this.dataList
|
|
|
+ } else if (name === '全国' && this.searchContent !== '') {
|
|
|
+ this.dataList.forEach(item => {
|
|
|
+ thisTitle = item.title
|
|
|
+ thisType = thisTitle.indexOf(this.searchContent)
|
|
|
+ if (thisType !== -1) {
|
|
|
+ thisList.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (this.areaTagsList.length === 1 && this.areaTagsList.indexOf('全国') !== -1) {
|
|
|
+ this.showDataList = this.dataList
|
|
|
+ } else {
|
|
|
+ this.showDataList = thisList
|
|
|
+ }
|
|
|
+ // this.showDataList = thisList
|
|
|
if (this.showDataList.length) {
|
|
|
this.projectTipsType = false
|
|
|
} else {
|
|
@@ -195,31 +222,33 @@ export default {
|
|
|
let thisList = []
|
|
|
let thisTitle = ''
|
|
|
let thisType = ''
|
|
|
- if (this.areaItem === '全国' && this.searchContent === '') {
|
|
|
- thisList = this.dataList
|
|
|
- } else if (this.areaItem !== '全国' && this.searchContent === '') {
|
|
|
- this.dataList.forEach(item => {
|
|
|
- if (item.area === this.areaItem) {
|
|
|
- thisList.push(item)
|
|
|
- }
|
|
|
- })
|
|
|
- } else if (this.areaItem === '全国' && this.searchContent !== '') {
|
|
|
- this.dataList.forEach(item => {
|
|
|
- thisTitle = item.title
|
|
|
- thisType = thisTitle.indexOf(this.searchContent)
|
|
|
- if (thisType !== -1) {
|
|
|
- thisList.push(item)
|
|
|
- }
|
|
|
- })
|
|
|
- } else if (this.areaItem !== '全国' && this.searchContent !== '') {
|
|
|
- this.dataList.forEach(item => {
|
|
|
- thisTitle = item.title
|
|
|
- thisType = thisTitle.indexOf(this.searchContent)
|
|
|
- if (thisType !== -1 && item.area === this.areaItem) {
|
|
|
- thisList.push(item)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ this.areaTagsList.forEach(itemA => {
|
|
|
+ if (this.areaItem !== '全国' && this.searchContent === '') {
|
|
|
+ this.dataList.forEach(item => {
|
|
|
+ if (item.area === itemA) {
|
|
|
+ thisList.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (this.areaItem !== '全国' && this.searchContent !== '') {
|
|
|
+ this.dataList.forEach(item => {
|
|
|
+ thisTitle = item.title
|
|
|
+ thisType = thisTitle.indexOf(this.searchContent)
|
|
|
+ if (thisType !== -1 && item.area === itemA) {
|
|
|
+ thisList.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (this.areaItem === '全国' && this.searchContent === '') {
|
|
|
+ thisList = this.dataList
|
|
|
+ } else if (this.areaItem === '全国' && this.searchContent !== '') {
|
|
|
+ this.dataList.forEach(item => {
|
|
|
+ thisTitle = item.title
|
|
|
+ thisType = thisTitle.indexOf(this.searchContent)
|
|
|
+ if (thisType !== -1) {
|
|
|
+ thisList.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
this.showDataList = thisList
|
|
|
if (this.showDataList.length) {
|
|
|
this.projectTipsType = false
|