搜索无数据不请求
This commit is contained in:
parent
2e90d54610
commit
8926f3d3b6
@ -226,7 +226,7 @@ let selectPage = (type) => {
|
||||
})
|
||||
tabType.value = type
|
||||
seachAllType['tabType'] = type
|
||||
seachAllType['searchid'] = setPageKey()
|
||||
seachAllType['searchid'] = setPageKey().searchid
|
||||
//根据类型初始化筛选参数
|
||||
if (type === 'person') {
|
||||
seachAllType['intermediary'] = 0
|
||||
@ -250,8 +250,9 @@ let selectPage = (type) => {
|
||||
if (tabType.value != 'need') {
|
||||
setSeachVal()
|
||||
}
|
||||
if ((seachVal.value && !setPageKey())) return
|
||||
getDataList(seachAllType)
|
||||
if ((seachVal.value && !setPageKey().searchid)) return
|
||||
let seachObj=setSeachId()
|
||||
getDataList(seachAllType,seachObj.count==0?false:true)
|
||||
}
|
||||
|
||||
let getDataList = props.getDataList
|
||||
@ -286,7 +287,8 @@ let checkPageType = () => {
|
||||
} else {
|
||||
seachAllType['intermediary'] = ''
|
||||
}
|
||||
getDataList(seachAllType)
|
||||
let seachObj=setSeachId()
|
||||
getDataList(seachAllType,seachObj.count==0?false:true)
|
||||
}
|
||||
|
||||
|
||||
@ -298,6 +300,9 @@ let seachKey = reactive({
|
||||
studentapartment: {}
|
||||
}
|
||||
})
|
||||
let seachInfoData=shallowReactive({
|
||||
data:{}
|
||||
})
|
||||
|
||||
//搜索数据
|
||||
let seachAllType = reactive({
|
||||
@ -315,7 +320,7 @@ if (isNeedHousing.value) {
|
||||
|
||||
//切换选项重置输入框内容
|
||||
let setSeachVal = () => {
|
||||
seachAllType['searchid'] = setPageKey()
|
||||
seachAllType['searchid'] = setPageKey().searchid
|
||||
seachVal.value = seachKey.key.keyword
|
||||
}
|
||||
|
||||
@ -371,12 +376,17 @@ let setSeachConditions = (type, data) => {
|
||||
seachAllType['isverified'] = 0
|
||||
seachAllType['isintermediary'] = 0
|
||||
}
|
||||
getDataList(seachAllType)
|
||||
let seachObj=setSeachId()
|
||||
getDataList(seachAllType,seachObj.count==0?false:true)
|
||||
}
|
||||
|
||||
//设置当前搜索key
|
||||
let setPageKey = () => {
|
||||
return tabType.value === 'person' ? seachKey.key.personal.searchid : tabType.value === 'intermediary' ? seachKey.key.intermediary.searchid : tabType.value === 'apartment' ? seachKey.key.studentapartment.searchid : ''
|
||||
return tabType.value === 'person' ? seachKey.key.personal : tabType.value === 'intermediary' ? seachKey.key.intermediary : tabType.value === 'apartment' ? seachKey.key.studentapartment : ''
|
||||
}
|
||||
|
||||
let setSeachId=()=>{
|
||||
return tabType.value === 'person' ? seachInfoData.data.personal : tabType.value === 'intermediary' ? seachInfoData.data.intermediary : tabType.value === 'apartment' ? seachInfoData.data.studentapartment : ''
|
||||
}
|
||||
|
||||
//搜索初始化
|
||||
@ -384,8 +394,10 @@ let searchInit = (data) => {
|
||||
api.search({ keyword: data }).then(res => {
|
||||
if (res.code === 200) {
|
||||
seachKey.key = res.data
|
||||
seachAllType.searchid = setPageKey()
|
||||
getDataList(seachAllType)
|
||||
seachInfoData.data=JSON.parse(JSON.stringify(res.data))
|
||||
let seachObj=setSeachId()
|
||||
seachAllType.searchid = seachObj.searchid
|
||||
getDataList(seachAllType,seachObj.count==0?false:true)
|
||||
} else {
|
||||
ElMessage({
|
||||
message: res.message,
|
||||
@ -403,7 +415,8 @@ let seachList = (item) => {
|
||||
}
|
||||
if (seachAllType['intermediary'] === 6) {
|
||||
seachAllType['keyword'] = seachVal.value
|
||||
getDataList(seachAllType)
|
||||
let seachObj=setSeachId()
|
||||
getDataList(seachAllType,seachObj.count==0?false:true)
|
||||
} else {
|
||||
searchInit(seachVal.value)
|
||||
}
|
||||
|
@ -416,6 +416,7 @@ let setSelectData = (id, data = [], title) => {
|
||||
setLocation('location', [selectTabCheck.id + ''])
|
||||
if (id === '') {
|
||||
selectData.data = []
|
||||
loactionArr.data=null
|
||||
setSeachCondition('location', [])
|
||||
}
|
||||
}
|
||||
@ -455,7 +456,7 @@ let selectSeach = (data = []) => {
|
||||
}
|
||||
schoolSelectObj.id = ''
|
||||
schoolSelectObj.title = ''
|
||||
|
||||
console.log(loactionArr.data,data)
|
||||
if(loactionArr.data&&(loactionArr.data.toString()===data.toString()))return
|
||||
|
||||
loactionArr.data=JSON.parse(JSON.stringify(data))
|
||||
|
@ -2409,7 +2409,8 @@ img {
|
||||
.img-video {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
margin-right: 5px;
|
||||
margin-right: 3px;
|
||||
margin-left:-2px;
|
||||
}
|
||||
|
||||
.img-icon {
|
||||
@ -2430,6 +2431,7 @@ img {
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-size: 14px;
|
||||
margin-right:8px;
|
||||
}
|
||||
|
||||
.no-img-pd{
|
||||
|
@ -61,13 +61,13 @@ let listMasonryInstance = null
|
||||
provide('count', dataCount)
|
||||
|
||||
//保存搜索设置
|
||||
let setSeachSelectData = (data) => {
|
||||
let setSeachSelectData = (data,type) => {
|
||||
pages.value = 1
|
||||
seachSelectData.data = {
|
||||
...data
|
||||
}
|
||||
loading.value = true
|
||||
getDataList(seachSelectData.data)
|
||||
getDataList(seachSelectData.data,type)
|
||||
}
|
||||
|
||||
//初始化列表参数
|
||||
@ -79,7 +79,15 @@ let setInitial = () => {
|
||||
}
|
||||
|
||||
//获取搜索数据
|
||||
let getDataList = (data) => {
|
||||
let getDataList = (data,type=true) => {
|
||||
console.log(data,type)
|
||||
if(!type){ //是否继续搜索
|
||||
seachSelectData.data.tabType !== 'apartment'?pageList.value = []:listApartment.value = []
|
||||
dataList.data = []
|
||||
dataCount.value = 0
|
||||
loading.value = false
|
||||
return
|
||||
}
|
||||
loadingText.value=' 加载中..... '
|
||||
if (!loading.value) return
|
||||
let postData = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user