|
|
|
@ -18,7 +18,7 @@ |
|
|
|
|
<view class="searchContent"> |
|
|
|
|
<u-search :showAction="true" |
|
|
|
|
actionText="搜索" |
|
|
|
|
placeholder="输入搜索内容" |
|
|
|
|
placeholder="请输入" |
|
|
|
|
style="padding:16upx 25upx;" |
|
|
|
|
bgColor="#F3F5F7" |
|
|
|
|
v-if="noSearch" |
|
|
|
@ -92,14 +92,18 @@ export default{ |
|
|
|
|
disabled:true, |
|
|
|
|
noSearch:true, |
|
|
|
|
contentList:[], |
|
|
|
|
typedata:null |
|
|
|
|
typedata:null, |
|
|
|
|
originListRow:[], |
|
|
|
|
page:1, |
|
|
|
|
limit:20, |
|
|
|
|
total:0, |
|
|
|
|
wx_category_id:null |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
|
wybDropDown |
|
|
|
|
}, |
|
|
|
|
onLoad(option) { |
|
|
|
|
console.log(option,"uuu") |
|
|
|
|
this.catagoryId = option.id |
|
|
|
|
this.typedata = option.typedata |
|
|
|
|
this.getListData(option.id) |
|
|
|
@ -107,16 +111,22 @@ export default{ |
|
|
|
|
methods:{ |
|
|
|
|
getContent(val){ |
|
|
|
|
this.catagoryName = val; |
|
|
|
|
this.page=1 |
|
|
|
|
this.getListData(this.catagoryId) |
|
|
|
|
}, |
|
|
|
|
searchHandle(){ |
|
|
|
|
this.page=1 |
|
|
|
|
this.getListData(this.catagoryId) |
|
|
|
|
}, |
|
|
|
|
getListData(id){ |
|
|
|
|
let params={ |
|
|
|
|
wx_menu_id:id, |
|
|
|
|
typedata:this.typedata, |
|
|
|
|
name:this.catagoryName |
|
|
|
|
name:this.catagoryName, |
|
|
|
|
page:this.page, |
|
|
|
|
limit:this.limit, |
|
|
|
|
wx_category_id:this.wx_category_id, |
|
|
|
|
sort:'weigh' |
|
|
|
|
} |
|
|
|
|
listData(params).then(res=>{ |
|
|
|
|
if(res.searchList.length==0){ |
|
|
|
@ -126,6 +136,35 @@ export default{ |
|
|
|
|
this.tagList = res.searchList |
|
|
|
|
this.noSearch = false; |
|
|
|
|
this.contentList = res.rows; |
|
|
|
|
this.originListRow = res.rows; |
|
|
|
|
this.total = res.total; |
|
|
|
|
this.contentList.forEach(item=>{ |
|
|
|
|
let subobj = res.searchList.filter(i=>{ |
|
|
|
|
return item.wx_category_id==i.id |
|
|
|
|
}) |
|
|
|
|
this.$set(item,'subName',subobj[0].name) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
getListData1(id){ |
|
|
|
|
let params={ |
|
|
|
|
wx_menu_id:id, |
|
|
|
|
typedata:this.typedata, |
|
|
|
|
name:this.catagoryName, |
|
|
|
|
page:this.page, |
|
|
|
|
limit:this.limit, |
|
|
|
|
wx_category_id:this.wx_category_id |
|
|
|
|
} |
|
|
|
|
listData(params).then(res=>{ |
|
|
|
|
if(res.searchList.length==0){ |
|
|
|
|
this.noSearch = true; |
|
|
|
|
this.contentList = res.rows |
|
|
|
|
}else{ |
|
|
|
|
this.tagList = res.searchList |
|
|
|
|
this.noSearch = false; |
|
|
|
|
this.contentList.push(...res.rows); |
|
|
|
|
this.originListRow = res.rows; |
|
|
|
|
this.contentList.forEach(item=>{ |
|
|
|
|
let subobj = res.searchList.filter(i=>{ |
|
|
|
|
return item.wx_category_id==i.id |
|
|
|
@ -137,12 +176,23 @@ export default{ |
|
|
|
|
}, |
|
|
|
|
clickSearchItem(item,index){ |
|
|
|
|
console.log(item,index,"--==") |
|
|
|
|
this.options[0].header = item.name; |
|
|
|
|
|
|
|
|
|
this.active=index; |
|
|
|
|
this.contentList.filter(i=>{ |
|
|
|
|
return i.wx_category_id == item.id |
|
|
|
|
}) |
|
|
|
|
this.page = 1 |
|
|
|
|
if(this.active==index){ |
|
|
|
|
this.options[0].header = '国家地区选择' |
|
|
|
|
this.active=-1; |
|
|
|
|
this.wx_category_id = null, |
|
|
|
|
// this.contentList = this.originListRow |
|
|
|
|
this.getListData(this.catagoryId) |
|
|
|
|
}else{ |
|
|
|
|
this.options[0].header = item.name; |
|
|
|
|
this.active=index; |
|
|
|
|
// let afterList = this.originListRow.filter(i=>{ |
|
|
|
|
// return i.wx_category_id == item.id |
|
|
|
|
// }) |
|
|
|
|
// this.contentList = afterList |
|
|
|
|
this.wx_category_id = item.id |
|
|
|
|
this.getListData(this.catagoryId) |
|
|
|
|
} |
|
|
|
|
this.$refs.dropDown.close() |
|
|
|
|
}, |
|
|
|
|
clickHandle(){ |
|
|
|
@ -159,10 +209,22 @@ export default{ |
|
|
|
|
|
|
|
|
|
goNextSection(item){ |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url:'/pages/detail/detail?id='+item.wx_category_id |
|
|
|
|
url:'/pages/detail/detail?id='+item.id |
|
|
|
|
// url:'/pages/detail/detail?id='+item.wx_category_id |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
onReachBottom(){ |
|
|
|
|
console.log('已触底'); |
|
|
|
|
if(this.contentList.length<this.total){ |
|
|
|
|
this.page++; |
|
|
|
|
this.getListData1(this.catagoryId) |
|
|
|
|
}else{ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|