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
import { TopicModel } from '../../../../models/topic.js'
let topicModel = new TopicModel()
Component({
/**
* 组件的属性列表
*/
properties: {
itemData:Object,
itemData:{
type:Object,
value:{}
},
itemIndex:Number
},
@ -16,53 +17,21 @@ Component({
*/
data: {
unPraise: '/images/common/zan.png',
praise: '/images/common/star_light.png',
currentPage:1
praise: '/images/common/star_light.png'
},
/**
* 组件的方法列表
*/
methods: {
onTap() {
this.triggerEvent('clickListItem', { itemData: this.properties.itemData })
},
onClickPraise(e) {
const sIndex = e.currentTarget.dataset.index
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)
// 评论点赞
this.triggerEvent('onClickPraise', { itemData: this.properties.itemData })
},
fetchGoodIdeaPraise(id) {
topicModel.topicCommentPraise(id, res => {
console.log(res)
if (res.code === 200) {
wx.showToast({
title: res.message,
icon: 'none'
pushTopic(){
const topicId = this.properties.itemData.topicGroupId;
wx.navigateTo({
url: `/pages/topics/interactive/topicArticle/index?topicId=${topicId}`,
})
// this.fetchDetailComment()
}
})
},
}
})

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

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

15
pages/topics/goodIdea/index.js

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

2
pages/topics/goodIdea/index.wxml

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

53
pages/topics/index.js

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

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

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

1
pages/topics/interactive/index.wxml

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

25
pages/user/myIdea/index.js

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

49
pages/user/myTopics/index.js

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save