Browse Source

我的收藏

master
xuxu 5 years ago
parent
commit
230be2b15d
  1. 3
      models/user.js
  2. 21
      pages/user/myFavorite/index.js
  3. 31
      pages/user/myFavorite/index.wxml
  4. 38
      pages/user/myFavorite/index.wxss
  5. 17
      pages/user/myWhistle/evaluate/index.js

3
models/user.js

@ -109,13 +109,14 @@ class UserModel extends HTTP {
}
getMyFavoriteList(page, success) {
getMyFavoriteList(page, typeCode, success) {
let params = {
url: UserConst.user_myFavorite_url,
method: Method.POST,
data: {
page: page,
pageSize: 10,
typeCode:typeCode
},
success: success
}

21
pages/user/myFavorite/index.js

@ -11,7 +11,8 @@ Page({
*/
data: {
list: [],
currentPage: 1
currentPage: 1,
type:1
},
/**
@ -30,11 +31,11 @@ Page({
this.fetchMyFavoriteList()
},
fetchMyFavoriteList () {
console.log('啦啦啦')
let page = this.data.currentPage
userModel.getMyFavoriteList(page, res => {
const datas = res.result.list
let tempDatas = []
let page = this.data.currentPage;
let type = this.data.type;
userModel.getMyFavoriteList(page,type,res => {
const datas = res.result.list;
let tempDatas = [];
datas.forEach(item => {
tempDatas.push({
topicId: item.contentId,
@ -93,7 +94,6 @@ Page({
this.fetchMyFavoriteList()
},
clickListItem (e) {
console.log(e)
if (e.detail.id) {
let id = e.detail.id
wx.navigateTo({
@ -106,5 +106,12 @@ Page({
url: `/pages/topics/interactive/topicArticle/index?topicId=${id}`,
})
}
},
refresh:function(e){
var type = e.currentTarget.dataset.type;
this.setData({
type:type
});
this.fetchMyFavoriteList();
}
})

31
pages/user/myFavorite/index.wxml

@ -1,5 +1,34 @@
<!--pages/user/common/myFavorite/index.wxml-->
<view class="container">
<view class="title">
<view class="option" bindtap="refresh" data-type="1">
<block wx:if="{{type == '1'}}">
<text style="color:#1989fa;">宣传栏</text>
</block>
<block wx:else>
宣传栏
</block>
</view>
<view class="option" bindtap="refresh" data-type="2">
<block wx:if="{{type == '2'}}">
<text style="color:#1989fa;">通知公告</text>
</block>
<block wx:else>
通知公告
</block>
</view>
<view class="option" bindtap="refresh" data-type="3">
<block wx:if="{{type == '3'}}">
<text style="color:#1989fa;">议事厅</text>
</block>
<block wx:else>
议事厅
</block>
</view>
</view>
<view class="content">
<block wx:for="{{list}}" wx:key="{{index}}">
<block wx:if="{{item.type === '1'}}">
<artice-cell

38
pages/user/myFavorite/index.wxss

@ -1 +1,37 @@
/* pages/user/common/myFavorite/index.wxss */
/* pages/user/common/myFavorite/index.wxss */
page{
width:100%;
height: 100%;
/* background-color: WhiteSmoke; */
display: flex;
flex-direction: column;
align-items: center;
/* justify-content: center; */
font-size: 28rpx;
}
.title{
width:100%;
height: 80rpx;
display: flex;
background-color: White;
border-top: 1rpx solid rgba(0, 0, 0, 0.116);
/* position: fixed; */
/* z-index:999; */
/* margin-top:20rpx; */
/* border-bottom: 1rpx solid rgba(0, 0, 0, 0.116); */
}
.option{
width:33%;
/* height:100%; */
display:flex;
align-items: center;
justify-content:center;
}
.content{
width:100%;
flex: 1;
overflow: scroll;
}

17
pages/user/myWhistle/evaluate/index.js

@ -98,11 +98,20 @@ Page({
userModel.whistleComment(param,res=>{
if(res.code == 200){
wx.showToast({
wx.showModal({
title: '提交成功',
icon: 'success',
duration: 1500
});
content: '评价已收到,感谢您的反馈',
showCancel:false,
confirmText:'知道了',
success(res) {
if (res.confirm) {
wx.reLaunch({
url: '../index'
})
return;
}
}
})
return;
}else{
wx.showToast({

Loading…
Cancel
Save