Browse Source

我的收藏

master
lqq 6 years ago
parent
commit
6aefd154d8
  1. 47
      pages/user/myFavorite/index.js
  2. 3
      pages/user/myFavorite/index.json
  3. 10
      pages/user/myFavorite/index.wxml

47
pages/user/myFavorite/index.js

@ -38,7 +38,7 @@ Page({
userIcon: item.groupAvator,
userName: item.author,
time: item.createTime,
commentNum: item.commentNum,
commentNum: item.commentNum || '',
type: item.type
})
})
@ -67,34 +67,6 @@ Page({
wx.stopPullDownRefresh()
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
@ -115,23 +87,16 @@ Page({
})
this.fetchMyFavoriteList()
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
clickListItem (e) {
const item = e.detail.item;
console.log(item);
let id = item.topicId
if(item.type === '1'){
console.log(e)
if (e.detail.id) {
let id = e.detail.id
wx.navigateTo({
url: `/pages/article/index?id=${id}`,
})
} else {
const item = e.detail.item;
let id = item.topicId
wx.navigateTo({
url: `/pages/topics/interactive/topicArticle/index?topicId=${id}`,
})

3
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"
}
}

10
pages/user/myFavorite/index.wxml

@ -1,6 +1,14 @@
<!--pages/user/common/myFavorite/index.wxml-->
<view class="container">
<block wx:for="{{list}}" wx:key="{{index}}">
<block wx:if="{{item.type === '1'}}">
<artice-cell
cId="{{item.topicId}}"
title="{{item.title}}"
time="{{item.time}}"
bind:clickListItem="clickListItem"/>
</block>
<block wx:else>
<cell
topicId="{{item.topicId}}"
title="{{item.title}}"
@ -12,4 +20,6 @@
userIcon="{{item.userIcon}}"
bind:clickListItem="clickListItem"/>
</block>
</block>
</view>

Loading…
Cancel
Save