Browse Source

Merge refs/remotes/origin/master into refs/heads/master

master
lqq 6 years ago
parent
commit
c900c492ea
  1. 51
      pages/topics/goodIdea/cell/index.js
  2. 22
      pages/topics/goodIdea/cell/index.wxml
  3. 15
      pages/topics/goodIdea/index.js
  4. 2
      pages/topics/goodIdea/index.wxml
  5. 53
      pages/topics/index.js
  6. 2
      pages/topics/index.wxml
  7. 8
      pages/topics/interactive/cell/index.wxss
  8. 1
      pages/topics/interactive/index.wxml
  9. 25
      pages/user/myIdea/index.js
  10. 49
      pages/user/myTopics/index.js
  11. 2
      pages/user/myTopics/myParticipant/cell/index.wxml
  12. 4
      pages/user/myTopics/myParticipant/cell/index.wxss
  13. 1
      pages/user/myTopics/myParticipant/index.wxml
  14. 1
      pages/user/myTopics/myRelease/index.wxml

51
pages/topics/goodIdea/cell/index.js

@ -1,13 +1,14 @@
// pages/topics/common/goodIdea/cell/index.js // pages/topics/common/goodIdea/cell/index.js
import { TopicModel } from '../../../../models/topic.js'
let topicModel = new TopicModel()
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
itemData:Object, itemData:{
type:Object,
value:{}
},
itemIndex:Number itemIndex:Number
}, },
@ -16,53 +17,21 @@ Component({
*/ */
data: { data: {
unPraise: '/images/common/zan.png', unPraise: '/images/common/zan.png',
praise: '/images/common/star_light.png', praise: '/images/common/star_light.png'
currentPage:1
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
onTap() {
this.triggerEvent('clickListItem', { itemData: this.properties.itemData })
},
onClickPraise(e) { onClickPraise(e) {
const sIndex = e.currentTarget.dataset.index this.triggerEvent('onClickPraise', { itemData: this.properties.itemData })
var selectItem = e.currentTarget.dataset.item
console.log(selectItem)
// var isPraise = "itemData.isPraise"
// this.setData({
// [isPraise]:!isPraise
// })
console.log('啦啦啦')
this.triggerEvent('tapGoodIdeaPraise', {index:sIndex})
// const commentList = this.data.commentList
// const tempList = []
// commentList.forEach((item, index) => {
// if (sIndex === index) {
// item.isPraise = !item.isPraise
// }
// tempList.push(item)
// })
// this.setData({
// commentList: tempList,
// })
this.fetchGoodIdeaPraise(selectItem.groupId)
// 评论点赞
}, },
pushTopic(){
fetchGoodIdeaPraise(id) { const topicId = this.properties.itemData.topicGroupId;
topicModel.topicCommentPraise(id, res => { wx.navigateTo({
console.log(res) url: `/pages/topics/interactive/topicArticle/index?topicId=${topicId}`,
if (res.code === 200) {
wx.showToast({
title: res.message,
icon: 'none'
}) })
// this.fetchDetailComment()
} }
})
},
} }
}) })

22
pages/topics/goodIdea/cell/index.wxml

@ -1,13 +1,13 @@
<!--pages/topics/common/goodIdea/cell/index.wxml--> <!--pages/topics/common/goodIdea/cell/index.wxml-->
<view class="cell" id="cell" bindtap="onTap"> <view class="cell" id="cell" >
<view class="content-left"> <view class="content-left">
<image src="" style="width:20px;height:20px;"></image> <image src="{{itemData.commentIcon}}" style="width:20px;height:20px;"></image>
</view> </view>
<view class="content-right"> <view class="content-right">
<view class="userInfo"> <view class="userInfo">
<view class="userInfo-left"> <view class="userInfo-left">
<view class="userName">{{itemData.userName}}</view> <view class="userName">{{itemData.commentName}}</view>
<view class="comment-time">{{itemData.time}}</view> <view class="comment-time">{{itemData.commentTime}}</view>
<view class="goodIdeaIcon" wx:if="{{itemData.isGoodIdea === 1}}"> <view class="goodIdeaIcon" wx:if="{{itemData.isGoodIdea === 1}}">
<image style="width:100%;height:100%;" src="./images/goodIdea.png"></image> <image style="width:100%;height:100%;" src="./images/goodIdea.png"></image>
</view> </view>
@ -20,24 +20,24 @@
</view> </view>
</view> </view>
<view style="color:#3B3B3B;font-size:14px;padding: 0 0 5px 0;">{{itemData.comment}}</view> <view style="color:#3B3B3B;font-size:14px;padding: 0 0 5px 0;">{{itemData.comment}}</view>
<view class="detail"> <view class="detail" bindtap="pushTopic">
<view class="detail-title">{{itemData.detail.title}}</view> <view class="detail-title">{{itemData.topicTtitle}}</view>
<view class="detail-userInfo"> <view class="detail-userInfo">
<view class="detail-userInfo-left"> <view class="detail-userInfo-left">
<view class="detail-user-icon"> <view class="detail-user-icon">
<image src="{{itemData.userIcon}}"></image> <image src="{{itemData.topicGroupAvator}}"></image>
</view> </view>
<view class="detail-userName">{{itemData.detail.userName}}</view> <view class="detail-userName">{{itemData.topicAuthor}}</view>
<view class="detail-time">{{itemData.detail.time}}</view> <view class="detail-time">{{itemData.topicGroupCreateTime}}</view>
</view> </view>
<view class="detail-userInfo-right"> <view class="detail-userInfo-right">
<view class="detail-comments-icon"> <view class="detail-comments-icon">
<image src="/images/common/com_count.png"></image> <image src="/images/common/com_count.png"></image>
</view> </view>
<view class="detail-commentNum">{{itemData.detail.commentNum}}</view> <view class="detail-commentNum">{{itemData.topicCommentNum}}</view>
</view> </view>
</view> </view>
<view class="detail-text">{{itemData.detail.text}}</view> <view class="detail-text">{{itemData.topicDetail}}</view>
</view> </view>
</view> </view>
</view> </view>

15
pages/topics/goodIdea/index.js

@ -1,4 +1,7 @@
// pages/topics/goodIdea/index.js // pages/topics/goodIdea/index.js
import { TopicModel } from '../../../models/topic.js'
let topicModel = new TopicModel()
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
@ -14,20 +17,18 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
list: [] commentId:''
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
clickListItem(e){ onClickPraise(e){
const itemData = e.detail.itemData; const itemData = e.detail.itemData;
console.log(itemData); // console.log(itemData);
}, // this.fetchGoodIdeaPraise(itemData.commentId)
tapGoodIdeaPraise(e) { this.triggerEvent('tapGoodIdeaPraise', { commentId: itemData.commentId })
console.log('华加快速度')
console.log(e)
} }
} }
}) })

2
pages/topics/goodIdea/index.wxml

@ -4,6 +4,6 @@
<cell <cell
itemData="{{item}}" itemData="{{item}}"
itemIndex="{{index}}" itemIndex="{{index}}"
bind:clickListItem="clickListItem"/> bind:onClickPraise="onClickPraise"/>
</block> </block>
</view> </view>

53
pages/topics/index.js

@ -37,7 +37,15 @@ Page({
onShow: function () { onShow: function () {
// 页面出现在前台时执行 // 页面出现在前台时执行
console.log('啦啦啦') console.log('啦啦啦')
this.fetchTopicList(); this.setData({
currPage: 1,
})
switch (this.data.segmentIndex) {
case 0:
return this.fetchTopicList()
case 1:
return this.fetchGoodIdeaList()
}
}, },
fetchTopicList () { fetchTopicList () {
let page = this.data.currPage let page = this.data.currPage
@ -52,6 +60,7 @@ Page({
topicId: item.id, topicId: item.id,
userIcon: item.groupAvator || '', userIcon: item.groupAvator || '',
title: item.title, title: item.title,
userIcon: item.groupAvator,
userName: item.author, userName: item.author,
commentNum: item.commentNum, commentNum: item.commentNum,
topicImg: item.image, topicImg: item.image,
@ -96,22 +105,21 @@ Page({
let tempDatas = [] let tempDatas = []
datas.forEach(item => { datas.forEach(item => {
tempDatas.push({ tempDatas.push({
id: item.id, // 评论数据
userIcon: item.image, commentId: item.id,
groupId: item.groupId, commentIcon: item.commentAvator,
userName: item.username, commentName: item.username,
time: item.createTime, commentTime: item.createTime,
comment: item.comment, comment: item.comment,
praiseNum: item.supportNum, praiseNum: item.supportNum,
isPraise: false, // 议题数据
detail: { topicTtitle: item.title,
userIcon: item.groupAvator, topicGroupAvator: item.groupAvator,
userName: item.author, topicAuthor: item.author,
commentNum: item.commentNum, topicGroupCreateTime: item.groupCreateTime,
title: item.title, topicCommentNum: item.commentNum,
text: item.content, topicGroupId: item.groupId,
topicDetail: item.content
}
}) })
}) })
if (page == 1) { if (page == 1) {
@ -186,5 +194,20 @@ Page({
case 1: case 1:
return this.fetchGoodIdeaList() return this.fetchGoodIdeaList()
} }
},
tapGoodIdeaPraise(e){
this.fetchGoodIdeaPraise(e.detail.commentId)
},
fetchGoodIdeaPraise(id) {
topicModel.topicCommentPraise(id, res => {
console.log(res)
if (res.code === 200) {
wx.showToast({
title: res.message,
icon: 'none'
})
this.onPullDownRefresh()
} }
}) })
},
})

2
pages/topics/index.wxml

@ -2,6 +2,6 @@
<view class="content-wrapper"> <view class="content-wrapper">
<e-segment bind:tapSegment="tapSegment" headerTitles="{{headerTitles}}" defaultSelectIndex="{{selectedTitle}}"/> <e-segment bind:tapSegment="tapSegment" headerTitles="{{headerTitles}}" defaultSelectIndex="{{selectedTitle}}"/>
<interactive wx:if="{{segmentIndex==0}}" list="{{topicList}}" /> <interactive wx:if="{{segmentIndex==0}}" list="{{topicList}}" />
<goodIdea wx:if="{{segmentIndex==1}}" list="{{goodIdeaList}}" /> <goodIdea wx:if="{{segmentIndex==1}}" list="{{goodIdeaList}}" bind:tapGoodIdeaPraise="tapGoodIdeaPraise"/>
<message wx:if="{{segmentIndex==2}}" /> <message wx:if="{{segmentIndex==2}}" />
</view> </view>

8
pages/topics/interactive/cell/index.wxss

@ -30,12 +30,12 @@
.user-icon{ .user-icon{
width: 20px; width: 20px;
height: 20px; height: 20px;
border-radius: 50%; /* border-radius: 50%; */
border: 1px solid #ddd; /* border: 1px solid #ddd; */
background-color: #EEEEEE; /* background-color: #EEEEEE; */
} }
.user-icon image { .user-icon image {
border-radius: 50%; /* border-radius: 50%; */
} }
.userName{ .userName{
max-width: 120rpx; max-width: 120rpx;

1
pages/topics/interactive/index.wxml

@ -4,6 +4,7 @@
<cell <cell
topicId="{{item.topicId}}" topicId="{{item.topicId}}"
title="{{item.title}}" title="{{item.title}}"
userIcon="{{item.userIcon}}"
topicImg="{{item.topicImg}}" topicImg="{{item.topicImg}}"
userName="{{item.userName}}" userName="{{item.userName}}"
time="{{item.time}}" time="{{item.time}}"

25
pages/user/myIdea/index.js

@ -29,20 +29,21 @@ Page({
let tempDatas = [] let tempDatas = []
datas.forEach(item => { datas.forEach(item => {
tempDatas.push({ tempDatas.push({
ideaId: item.id, // 评论数据
userIcon: item.image, commentId: item.id,
groupId: item.groupId, commentIcon: item.commentAvator,
userName: item.username, commentName: item.username,
time: item.createTime, commentTime: item.createTime,
comment: item.comment, comment: item.comment,
praiseNum: item.supportNum, praiseNum: item.supportNum,
detail: { // 议题数据
userIcon: item.groupAvator, topicTtitle: item.title,
userName: item.author, topicGroupAvator: item.groupAvator,
commentNum: item.commentNum, topicAuthor: item.author,
title: item.title, topicGroupCreateTime: item.groupCreateTime,
text: item.content topicCommentNum: item.commentNum,
} topicGroupId: item.groupId,
topicDetail: item.content
}) })
}) })
if (page == 1) { if (page == 1) {

49
pages/user/myTopics/index.js

@ -35,6 +35,7 @@ Page({
tempDatas.push({ tempDatas.push({
topicId: item.id, topicId: item.id,
title: item.title, title: item.title,
userIcon: item.groupAvator,
userName: item.author, userName: item.author,
commentNum: item.commentNum, commentNum: item.commentNum,
topicImg: item.image, topicImg: item.image,
@ -66,54 +67,6 @@ Page({
wx.stopPullDownRefresh() wx.stopPullDownRefresh()
}) })
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
// 定义点击标题的事件处理函数,将选中标题的id赋值给selectedTitle // 定义点击标题的事件处理函数,将选中标题的id赋值给selectedTitle
tapSegment: function (e) { tapSegment: function (e) {

2
pages/user/myTopics/myParticipant/cell/index.wxml

@ -8,7 +8,7 @@
<view class="left-bottom-userInfo"> <view class="left-bottom-userInfo">
<view class="user-icon" wx:if="{{userIcon.length > 0}}"> <view class="user-icon" wx:if="{{userIcon.length > 0}}">
<image src="{{userIcon}}"></image> <image class="img" src="{{userIcon}}"></image>
</view> </view>
<view class="userName">{{userName}}</view> <view class="userName">{{userName}}</view>
<view class="cell_info_meta">{{time}}</view> <view class="cell_info_meta">{{time}}</view>

4
pages/user/myTopics/myParticipant/cell/index.wxss

@ -42,6 +42,10 @@
border-radius: 50%; border-radius: 50%;
background-color: #EEEEEE; background-color: #EEEEEE;
} }
.img{
width: 20px;
height: 20px;
}
.userName{ .userName{
max-width: 120rpx; max-width: 120rpx;
white-space: nowrap; white-space: nowrap;

1
pages/user/myTopics/myParticipant/index.wxml

@ -4,6 +4,7 @@
<cell <cell
topicId="{{item.topicId}}" topicId="{{item.topicId}}"
title="{{item.title}}" title="{{item.title}}"
userIcon="{{item.groupAvator}}"
topicImg="{{item.topicImg}}" topicImg="{{item.topicImg}}"
userName="{{item.userName}}" userName="{{item.userName}}"
time="{{item.time}}" time="{{item.time}}"

1
pages/user/myTopics/myRelease/index.wxml

@ -4,6 +4,7 @@
<cell <cell
topicId="{{item.topicId}}" topicId="{{item.topicId}}"
title="{{item.title}}" title="{{item.title}}"
userIcon="{{item.groupAvator}}"
topicImg="{{item.topicImg}}" topicImg="{{item.topicImg}}"
userName="{{item.userName}}" userName="{{item.userName}}"
time="{{item.time}}" time="{{item.time}}"

Loading…
Cancel
Save