From 6aefd154d801d31b5fe361d91e433737b4ab78d5 Mon Sep 17 00:00:00 2001 From: lqq Date: Mon, 21 Oct 2019 16:24:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/user/myFavorite/index.js | 63 +++++++------------------------- pages/user/myFavorite/index.json | 3 +- pages/user/myFavorite/index.wxml | 30 ++++++++++----- 3 files changed, 36 insertions(+), 60 deletions(-) diff --git a/pages/user/myFavorite/index.js b/pages/user/myFavorite/index.js index e6cede1..1e36059 100644 --- a/pages/user/myFavorite/index.js +++ b/pages/user/myFavorite/index.js @@ -11,7 +11,7 @@ Page({ */ data: { list: [], - currentPage:1 + currentPage: 1 }, /** @@ -22,12 +22,12 @@ Page({ }, - fetchMyFavoriteList(){ + fetchMyFavoriteList () { console.log('啦啦啦') let page = this.data.currentPage - userModel.getMyFavoriteList(page,res=>{ + userModel.getMyFavoriteList(page, res => { console.log(res) - + const datas = res.result.list let tempDatas = [] datas.forEach(item => { @@ -38,8 +38,8 @@ Page({ userIcon: item.groupAvator, userName: item.author, time: item.createTime, - commentNum: item.commentNum, - type:item.type + commentNum: item.commentNum || '', + type: item.type }) }) if (page == 1) { @@ -67,34 +67,6 @@ Page({ wx.stopPullDownRefresh() }) }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - /** * 页面相关事件处理函数--监听用户下拉动作 */ @@ -109,29 +81,22 @@ Page({ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - let page = this.data.currentPage+1 + let page = this.data.currentPage + 1 this.setData({ currPage: page, }) this.fetchMyFavoriteList() }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - }, - - clickListItem(e) { - const item = e.detail.item; - console.log(item); - let id = item.topicId - if(item.type === '1'){ + clickListItem (e) { + console.log(e) + if (e.detail.id) { + let id = e.detail.id wx.navigateTo({ url: `/pages/article/index?id=${id}`, }) - }else { + } else { + const item = e.detail.item; + let id = item.topicId wx.navigateTo({ url: `/pages/topics/interactive/topicArticle/index?topicId=${id}`, }) diff --git a/pages/user/myFavorite/index.json b/pages/user/myFavorite/index.json index a8ea57f..3b85f5b 100644 --- a/pages/user/myFavorite/index.json +++ b/pages/user/myFavorite/index.json @@ -2,6 +2,7 @@ "enablePullDownRefresh": true, "navigationBarTitleText": "我的收藏", "usingComponents": { - "cell": "../myTopics/myParticipant/cell/index" + "cell": "../myTopics/myParticipant/cell/index", + "artice-cell": "/components/cell/index" } } \ No newline at end of file diff --git a/pages/user/myFavorite/index.wxml b/pages/user/myFavorite/index.wxml index 1e4391c..672d77d 100644 --- a/pages/user/myFavorite/index.wxml +++ b/pages/user/myFavorite/index.wxml @@ -1,15 +1,25 @@ - + + + + + + +