Browse Source

提交

master
zhaoyongnian 5 years ago
parent
commit
3ee51d2f5d
  1. 162
      subpages/associationNew/pages/eventlist/eventlist.js
  2. 5
      subpages/associationNew/pages/eventlist/eventlist.json
  3. 60
      subpages/associationNew/pages/eventlist/eventlist.wxml
  4. 42
      subpages/associationNew/pages/eventlist/eventlist.wxss

162
subpages/associationNew/pages/eventlist/eventlist.js

@ -1,5 +1,5 @@
// subpages/associationNew/pages/eventlist/eventlist.js // subpages/associationNew/pages/eventlist/eventlist.js
import { topiclist} from '../../utils/api' import { topiclist, commentSubmit,statement } from '../../utils/api'
import { import {
getTimestamp getTimestamp
} from '../../../../utils/common' } from '../../../../utils/common'
@ -9,47 +9,149 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
images:[ topiclist: [],
"https://epdc-shibei.elinkservice.cn/epdcFile/M00/00/00/CgUipV3wgl6Afm4cAAAa8QfEb00266_big.png",
"https://epdc-shibei.elinkservice.cn/epdcFile/M00/00/00/CgUipV3wgl6Afm4cAAAa8QfEb00266_big.png",
"https://epdc-shibei.elinkservice.cn/epdcFile/M00/00/00/CgUipV3wgl6Afm4cAAAa8QfEb00266_big.png"
],
topiclist:[],
timestamp: getTimestamp(), timestamp: getTimestamp(),
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
partyGroupId:'',//党群id partyGroupId: '',//党群id
topicType:'',//0:事好儿鼓个掌 1:话对捧个场 topicType: '',//0:事好儿鼓个掌 1:话对捧个场
nodata: false,
loadMoreType: 'none',
loadMoreVisible: false,
bannedFlag: '',//是否禁言 0:否 1:是
ifcomment: false,//是否显示评论
focus: false,
topicId: '',//被评论的话题ID
commentContent: '',
}, },
//点赞
clicklike(e){
console.log(JSON.stringify(e))
// <!-- 用户是否已点赞 0否;1是 -->
console.log(e.currentTarget.dataset.likeflag)
let attitude =""
if(e.currentTarget.dataset.likeflag == '0'){//点赞
attitude = 0
}else{
attitude = 2
}
let that = this;
const para = {
topicId: e.currentTarget.dataset.id,//被评论的话题ID
attitude: attitude,//表态 0赞;1踩;2取消赞;3取消踩
}
statement(para).then(res => {
that.setData({
topiclist: [],
})
this.topiclist()
console.log('点赞成功' + res)
}).catch(err => {
console.log(err)
})
},
// Textarea获取焦点
clickTextarea(e) {
this.setData({
ifcomment: true,
focus: true,
topicId: e.currentTarget.dataset.id
})
},
// 失去焦点
bindAddressInput(e) {
this.setData({ //失去焦点以后view隐藏
ifcomment: false
})
console.log(this.data.commentContent)
},
// 身份证号 双向绑定
bindIdentity(e) {
this.setData({
commentContent: e.detail.value
})
console.log(this.data.commentContent)
},
// 评论按钮点击事件
commentSubmit() {
let that = this;
const para = {
topicId: this.data.topicId,//被评论的话题ID
faCommentId: '',//父评论(被评论)ID
content: this.data.commentContent,//评论内容
}
commentSubmit(para).then(res => {
that.setData({
topiclist: [],
})
this.topiclist()
console.log('评论成功' + res)
}).catch(err => {
console.log(err)
})
console.log('点击事件')
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({ this.setData({
partyGroupId:options.partyGroupId, partyGroupId: options.partyGroupId,
topicType:options.topicType,//0:事好儿鼓个掌 1:话对捧个场 topicType: options.topicType,//0:事好儿鼓个掌 1:话对捧个场
}) })
this.topiclist()
}, },
// 查列表
topiclist(){ topiclist() {
let that = this;
const para = { const para = {
pageIndex: this.data.pageIndex, pageIndex: this.data.pageIndex,
pageSize: this.data.pageSize, pageSize: this.data.pageSize,
timestamp: this.data.timestamp, timestamp: this.data.timestamp,
topicType:this.data.topicType, topicType: this.data.topicType,
partyGroupId: this.data.partyGroupId, //党群id partyGroupId: this.data.partyGroupId, //党群id
} }
topiclist(para).then(res => { topiclist(para).then(res => {
let that = this; that.setData({
console.log(JSON.stringify(res)) bannedFlag: res.data.bannedFlag,
this.setData({ topiclist: that.data.topiclist.concat(res.data.topicList),
topiclist: that.data.topiclist.concat(res.data), loadMoreType: res.data.topicList.length === that.data.pageSize ? 'loading' : 'none',
loadMoreVisible: res.data.topicList.length === that.data.pageSize ? false : true
})
if (that.data.topiclist.length == 0) {//没有值
that.setData({
nodata: true,
loadMoreType: 'none',
loadMoreVisible: false,
})
}
}).catch(err => {
that.setData({
topiclist: [],
nodata: true,
loadMoreType: 'none',
loadMoreVisible: false,
}) })
console.log(err)
})
},
// 跳转 发布话题
navigateToAddTopic() {
// if (this.data.groupState === '15') {
// wx.showToast({
// title: '该群已禁言,暂不可发布话题',
// icon: 'none',
// duration: 2000
// })
// return false
// }
wx.navigateTo({
url: `/subpages/associationNew/pages/addTopic/addTopic?partyGroupId=${this.data.partyGroupId}&topicType=${this.data.topicType}`
}) })
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
@ -61,7 +163,10 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
this.setData({
topiclist: [],
})
this.topiclist()
}, },
/** /**
@ -89,7 +194,16 @@ Page({
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function () {
this.setData({
loadMoreVisible: true
})
if (this.data.loadMoreType === 'loading') {
this.setData({
pageIndex: this.data.pageIndex + 1,
pageSize: this.data.pageSize,
})
this.topiclist()
}
}, },
/** /**

5
subpages/associationNew/pages/eventlist/eventlist.json

@ -1,4 +1,7 @@
{ {
"usingComponents": {}, "usingComponents": {
"load-more": "../../../../components/loadMore/loadMore",
"no-data":"../../../../components/nodata/nodata"
},
"navigationBarTitleText": "事好鼓个掌" "navigationBarTitleText": "事好鼓个掌"
} }

60
subpages/associationNew/pages/eventlist/eventlist.wxml

@ -1,50 +1,52 @@
<view class="item-list"> <view class="item-list" wx:for-index="index" wx:for-item="item" wx:key="index" wx:for="{{topiclist}}">
<view class="user-info"> <view class="user-info">
<image src="https://epdc-shibei.elinkservice.cn/epdcFile/M00/00/00/CgUipV3wgl6Afm4cAAAa8QfEb00266_big.png"></image> <image src="{{item.userFace}}"></image>
<view class="name-date"> <view class="name-date">
<view class="name">南宁路152号-梁先生</view> <view class="name">{{item.nickname}}</view>
<view class="date">2019-08-26 12:56:02</view> <view class="date">{{item.createdTime}}</view>
</view> </view>
</view> </view>
<view class="details-info">庆祝建党97周年“党徽照耀新时代”庆祝建党97周年“党徽照耀新时代”庆祝建党97周年“党徽照耀新时代”庆祝建党97周年“党徽照耀新时代”庆祝建党97周年“党徽照耀新时代”</view> <view class="details-info">{{item.topicContent}}</view>
<view wx:if="{{images.length > 0}}" class="image-list" style="height: {{images.length === 3 ? '160rpx' : images.length === 2 ? '205rpx' : images.length === 1 ? '350rpx' : '' }}"> <view wx:if="{{item.images.length > 0 && topicType == '0'}}" class="image-list"
<image mode="aspectFill" catchtap="previewImage" data-src="{{item}}" class="image-item" wx:for="{{images}}" wx:key="{{index}}" wx:for-index="index" wx:for-item="item" src="{{item}}" /> style="height: {{item.images.length === 3 ? '160rpx' : item.images.length === 2 ? '205rpx' : item.images.length === 1 ? '350rpx' : '' }}">
<image mode="aspectFill" catchtap="previewImage" data-src="{{_item}}" class="image-item"
wx:for="{{item.images}}" wx:key="{{index}}" wx:for-index="index" wx:for-item="_item" src="{{_item}}" />
</view> </view>
<view class="attitude"> <view class="attitude">
<view class="all"> <view class="all" data-id="{{item.id}}" bindtap="clicklike" data-likeFlag="{{item.likeFlag}}">
<image src="../../images/give.png"></image> <!-- 用户是否已点赞 0否;1是 -->
<view class="give-data">22222</view> <image wx:if="{{item.likeFlag == '0'}}" src="../../images/give.png"></image>
<image wx:else src="../../images/give_2.png"></image>
<view class="give-data {{item.likeFlag == '1' ? 'color' : ''}}">{{item.supportNum}}</view>
</view> </view>
<view class="all"> <view class="all">
<image src="../../images/comment.png"></image> <image src="../../images/comment.png"></image>
<view class="give-data">22222</view> <view class="give-data">{{item.commentNum}}</view>
</view> </view>
<view class="all"> <view class="all" data-id="{{item.id}}" bindtap="clickTextarea">
<image src="../../images/ic_huifu@2x.png"></image> <image src="../../images/ic_huifu@2x.png"></image>
<view class="give-data">评论</view> <view class="give-data">评论</view>
</view> </view>
</view> </view>
<view class="comment"> <view wx:if="{{item.comments.length > 0}}" class="comment">
<view class="comment-list"><text>张测试:</text>我们这个楼的小区门口也是这中事情我们这个楼的小区门口也是这中事情···我们这个楼的小区门口也是这中事情···</view> <view wx:for="{{item.comments}}" wx:key="{{index}}" wx:for-index="index" wx:for-item="item_"
<view class="comment-list"><text>张测试:</text>我们这个楼的小区门口也是这中事情我们这个楼的小区门口也是这中事情···我们这个楼的小区门口也是这中事情···</view> class="comment-list"><text>{{item_.username}}:</text>{{item_.content}}</view>
</view> </view>
</view> </view>
<view class="addIssue" bindtap="addIssue"> <view class="release" wx:if="{{ifcomment}}">
<view class="replyinfo2">
<textarea placeholder-class="input_null" fixed="true" maxlength="-1" show-confirm-bar="false"
cursor-spacing="15" auto-height="true" placeholder="请输入回复" value="{{commentContent}}" focus='{{focus}}' bindblur="bindAddressInput" bindinput="bindIdentity"></textarea>
<button bindtap="commentSubmit" form-type="submit" class="submit">发送</button>
</view>
</view>
<!--加载更多提示-->
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more>
<no-data isShow="{{nodata}}"></no-data>
<!-- 是否禁言 0:否 1:是 -->
<view wx:if="{{bannedFlag == '0'}}" class="addIssue" bindtap="navigateToAddTopic">
<image wx:if="{{topicType == '0'}}" src="../../images/story.png" /> <image wx:if="{{topicType == '0'}}" src="../../images/story.png" />
<image wx:else src="../../images/speack.png" /> <image wx:else src="../../images/speack.png" />
</view> </view>
<form bindsubmit="submitForm" report-submit="true">
<view class="release">
<view wx:if="{{reply}}" class="replyinfo1">
回复<text class="text">{{replyUserName}}</text>
<button class="cancel" bindtap="cancleReply">取消回复</button>
</view>
<view class="replyinfo2">
<textarea placeholder-class="input_null" fixed="true" maxlength="-1" show-confirm-bar="false" cursor-spacing="15" auto-height="true" placeholder="请输入回复" name="comment"></textarea>
<button form-type="submit" class="submit">发送</button>
</view>
</view>
</form>

42
subpages/associationNew/pages/eventlist/eventlist.wxss

@ -73,10 +73,12 @@ page {
height: 28rpx; height: 28rpx;
padding: 0 50rpx; padding: 0 50rpx;
} }
.attitude .all{
.attitude .all {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.attitude .all image { .attitude .all image {
width: 28rpx; width: 28rpx;
height: 28rpx; height: 28rpx;
@ -90,6 +92,10 @@ page {
/* width: 196rpx; */ /* width: 196rpx; */
} }
.attitude .all .give-data.color {
color: #FFB103;
}
.comment { .comment {
width: calc(100% - 98rpx); width: calc(100% - 98rpx);
padding: 26rpx 20rpx; padding: 26rpx 20rpx;
@ -111,7 +117,8 @@ page {
/* 评论样式 */ /* 评论样式 */
.release { .release {
align-items: flex-end; /*底部对齐*/ align-items: flex-end;
/*底部对齐*/
box-sizing: border-box; box-sizing: border-box;
position: fixed; position: fixed;
left: 0; left: 0;
@ -122,21 +129,27 @@ page {
font-size: 28rpx; font-size: 28rpx;
z-index: 999; z-index: 999;
} }
.replyinfo1{
.replyinfo1 {
display: flex; display: flex;
justify-content: space-between; /*两端对齐*/ justify-content: space-between;
/*两端对齐*/
font-size: 35rpx; font-size: 35rpx;
} }
.replyinfo2{
.replyinfo2 {
display: flex; display: flex;
justify-content: space-between; /*两端对齐*/ justify-content: space-between;
/*两端对齐*/
} }
.release textarea { .release textarea {
width: calc(100% - 200rpx); width: calc(100% - 200rpx);
min-height: 34rpx; min-height: 34rpx;
max-height: 102rpx; /*最多显示三行*/ max-height: 102rpx;
border-width: 15rpx 20rpx; /*使用padding与预期留白不一致,故使用border*/ /*最多显示三行*/
border-width: 15rpx 20rpx;
/*使用padding与预期留白不一致,故使用border*/
border-style: solid; border-style: solid;
border-color: #F2F2F2; border-color: #F2F2F2;
line-height: 34rpx; line-height: 34rpx;
@ -161,15 +174,20 @@ page {
} }
.release .submit { .release .submit {
width: 120rpx; width: 160rpx;
height: 64rpx; height: 60rpx;
line-height: 64rpx; line-height: 60rpx;
text-align: center; text-align: center;
color: #6c0;
margin: 0 3px; margin: 0 3px;
padding: 0; padding: 0;
font-size: 32rpx;
font-weight: 500;
color: rgba(255, 255, 255, 1);
background: linear-gradient(to right, #e95027, #db1a1f);
border-radius: 50rpx;
} }
.pro-box .info .text .delete { .pro-box .info .text .delete {
color: #f68135; color: #f68135;
border-radius: 50rpx; border-radius: 50rpx;

Loading…
Cancel
Save