搜索无数据不请求

This commit is contained in:
luJianJun 2023-08-10 17:00:54 +08:00
parent 2e90d54610
commit 8926f3d3b6
4 changed files with 39 additions and 15 deletions

View File

@ -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)
}

View File

@ -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))

View File

@ -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{

View File

@ -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 = {