From 3200c4e3b556b4936671e363a9f013d808bc3d82 Mon Sep 17 00:00:00 2001 From: liudan <18634735655@163.com> Date: Mon, 20 Feb 2023 09:36:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/wyb-drop-down/wyb-drop-down.vue | 13 +++- pages.json | 4 +- pages/detail/detail.vue | 26 +++++-- pages/index/index.vue | 1 + pages/index/searchPage.vue | 84 +++++++++++++++++++--- pages/my/collection.vue | 1 + pages/my/look.vue | 1 + pages/my/share.vue | 1 + 8 files changed, 113 insertions(+), 18 deletions(-) diff --git a/components/wyb-drop-down/wyb-drop-down.vue b/components/wyb-drop-down/wyb-drop-down.vue index 19d8e48..87fcc81 100644 --- a/components/wyb-drop-down/wyb-drop-down.vue +++ b/components/wyb-drop-down/wyb-drop-down.vue @@ -39,10 +39,11 @@ transformOrigin: '50% 45%', color: headerActiveIndex === index && dropOver ? activeColor: defaultColor}" /> - { + this.$emit('getContent',val) + },400) + + }, searchHandle(){ this.$emit('getContent',this.catagoryName) this.close() diff --git a/pages.json b/pages.json index eea6b60..3122f62 100644 --- a/pages.json +++ b/pages.json @@ -24,7 +24,9 @@ },{ "path": "pages/index/searchPage", "style": { - "navigationBarTitleText": "" + "navigationBarTitleText": "", + "onReachBottomDistance":20 //距离底部多远时触发 单位为px + } },{ "path" : "pages/detail/detail", diff --git a/pages/detail/detail.vue b/pages/detail/detail.vue index 39d7d77..26a66ae 100644 --- a/pages/detail/detail.vue +++ b/pages/detail/detail.vue @@ -108,8 +108,8 @@ }, addShare(){ let routes = this.$mp.page.route - console.log(routes) - // #ifdef APP + let that = this; + // ifdef APP uni.share({ provider:'weixin',//分享服务提供商(即weixin|qq|sinaweibo) type:0,//图文 @@ -120,14 +120,32 @@ imageUrl:`http://lxwx.njrenzhou.cn${this.titleInfo.listimage}`,//图片地址,type 为 0、2、5 时必选 success(res) { //成功返回的参数 - console.log(res); + let params={ + wx_article_id:that.titleInfo.id, + wx_category_id:that.titleInfo.wx_category_id + } + uni.$u.http.post('http://lxwx.njrenzhou.cn/api/wx_article_share/add', + params, + { + header: { + 'Content-Type': 'application/x-www-form-urlencoded', + 'token':uni.getStorageSync('userInfo').token + }, + }).then((res) => { + that.$refs.uToast.show({ + message:"分享成功" + }) + that.isCollect = true + }).catch((res) =>{ + + }) }, fail(err) { //失败返回的参数 console.log(err); } }) - // #endif + // endif // let params={ // wx_article_id:this.titleInfo.id, // wx_category_id:this.titleInfo.wx_category_id diff --git a/pages/index/index.vue b/pages/index/index.vue index ae0a3c1..1256c64 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -86,6 +86,7 @@ }, godetails(item){ uni.navigateTo({ + // url:'/pages/detail/detail?id='+item.id url:'/pages/detail/detail?id='+item.wx_category_id }) }, diff --git a/pages/index/searchPage.vue b/pages/index/searchPage.vue index 713c3d2..4d021e9 100644 --- a/pages/index/searchPage.vue +++ b/pages/index/searchPage.vue @@ -18,7 +18,7 @@ { 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 diff --git a/pages/my/collection.vue b/pages/my/collection.vue index fbcc819..318614f 100644 --- a/pages/my/collection.vue +++ b/pages/my/collection.vue @@ -35,6 +35,7 @@ export default{ methods:{ godetails(item){ uni.navigateTo({ + // url:'/pages/detail/detail?id='+item.id url:'/pages/detail/detail?id='+item.wx_category_id }) }, diff --git a/pages/my/look.vue b/pages/my/look.vue index 17e64b4..6fde7fa 100644 --- a/pages/my/look.vue +++ b/pages/my/look.vue @@ -35,6 +35,7 @@ export default{ methods:{ godetails(item){ uni.navigateTo({ + // url:'/pages/detail/detail?id='+item.id url:'/pages/detail/detail?id='+item.wx_category_id }) }, diff --git a/pages/my/share.vue b/pages/my/share.vue index da1044e..e498ca0 100644 --- a/pages/my/share.vue +++ b/pages/my/share.vue @@ -35,6 +35,7 @@ export default{ methods:{ godetails(item){ uni.navigateTo({ + // url:'/pages/detail/detail?id='+item.id url:'/pages/detail/detail?id='+item.wx_category_id }) },