From 3ee51d2f5d343a90ca820bf792646eeea6f14963 Mon Sep 17 00:00:00 2001 From: zhaoyongnian <541231643@qq.com> Date: Fri, 5 Jun 2020 19:49:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/eventlist/eventlist.js | 162 +++++++++++++++--- .../pages/eventlist/eventlist.json | 5 +- .../pages/eventlist/eventlist.wxml | 62 +++---- .../pages/eventlist/eventlist.wxss | 54 ++++-- 4 files changed, 210 insertions(+), 73 deletions(-) diff --git a/subpages/associationNew/pages/eventlist/eventlist.js b/subpages/associationNew/pages/eventlist/eventlist.js index 5db4504..91c9773 100644 --- a/subpages/associationNew/pages/eventlist/eventlist.js +++ b/subpages/associationNew/pages/eventlist/eventlist.js @@ -1,5 +1,5 @@ // subpages/associationNew/pages/eventlist/eventlist.js -import { topiclist} from '../../utils/api' +import { topiclist, commentSubmit,statement } from '../../utils/api' import { getTimestamp } from '../../../../utils/common' @@ -9,47 +9,149 @@ Page({ * 页面的初始数据 */ data: { - images:[ - "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:[], + topiclist: [], timestamp: getTimestamp(), pageIndex: 1, pageSize: 10, - partyGroupId:'',//党群id - topicType:'',//0:事好儿鼓个掌 1:话对捧个场 + partyGroupId: '',//党群id + 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)) + // + + 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) { - this.setData({ - partyGroupId:options.partyGroupId, - topicType:options.topicType,//0:事好儿鼓个掌 1:话对捧个场 - }) - this.topiclist() + this.setData({ + partyGroupId: options.partyGroupId, + topicType: options.topicType,//0:事好儿鼓个掌 1:话对捧个场 + }) }, - - topiclist(){ + // 查列表 + topiclist() { + let that = this; const para = { pageIndex: this.data.pageIndex, pageSize: this.data.pageSize, timestamp: this.data.timestamp, - topicType:this.data.topicType, + topicType: this.data.topicType, partyGroupId: this.data.partyGroupId, //党群id } topiclist(para).then(res => { - let that = this; - console.log(JSON.stringify(res)) - this.setData({ - topiclist: that.data.topiclist.concat(res.data), + that.setData({ + bannedFlag: res.data.bannedFlag, + topiclist: that.data.topiclist.concat(res.data.topicList), + 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 () { - + this.setData({ + topiclist: [], + }) + this.topiclist() }, /** @@ -89,7 +194,16 @@ Page({ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - + this.setData({ + loadMoreVisible: true + }) + if (this.data.loadMoreType === 'loading') { + this.setData({ + pageIndex: this.data.pageIndex + 1, + pageSize: this.data.pageSize, + }) + this.topiclist() + } }, /** diff --git a/subpages/associationNew/pages/eventlist/eventlist.json b/subpages/associationNew/pages/eventlist/eventlist.json index 3cffbae..1b1aec4 100644 --- a/subpages/associationNew/pages/eventlist/eventlist.json +++ b/subpages/associationNew/pages/eventlist/eventlist.json @@ -1,4 +1,7 @@ { - "usingComponents": {}, + "usingComponents": { + "load-more": "../../../../components/loadMore/loadMore", + "no-data":"../../../../components/nodata/nodata" + }, "navigationBarTitleText": "事好鼓个掌" } \ No newline at end of file diff --git a/subpages/associationNew/pages/eventlist/eventlist.wxml b/subpages/associationNew/pages/eventlist/eventlist.wxml index 057e4f9..7f9e581 100644 --- a/subpages/associationNew/pages/eventlist/eventlist.wxml +++ b/subpages/associationNew/pages/eventlist/eventlist.wxml @@ -1,50 +1,52 @@ - + - 庆祝建党97周年“党徽照耀新时代”庆祝建党97周年“党徽照耀新时代”庆祝建党97周年“党徽照耀新时代”庆祝建党97周年“党徽照耀新时代”庆祝建党97周年“党徽照耀新时代” + {{item.topicContent}} - - + + - - - 22222 + + + + + {{item.supportNum}} - 22222 + {{item.commentNum}} - + 评论 - - 张测试:我们这个楼的小区门口也是这中事情我们这个楼的小区门口也是这中事情···我们这个楼的小区门口也是这中事情··· - 张测试:我们这个楼的小区门口也是这中事情我们这个楼的小区门口也是这中事情···我们这个楼的小区门口也是这中事情··· + + {{item_.username}}:{{item_.content}} - + + + + + + + + + + + - - -
- - - 回复{{replyUserName}} - - - - - - - -
\ No newline at end of file +
\ No newline at end of file diff --git a/subpages/associationNew/pages/eventlist/eventlist.wxss b/subpages/associationNew/pages/eventlist/eventlist.wxss index 88abff9..92790df 100644 --- a/subpages/associationNew/pages/eventlist/eventlist.wxss +++ b/subpages/associationNew/pages/eventlist/eventlist.wxss @@ -73,10 +73,12 @@ page { height: 28rpx; padding: 0 50rpx; } -.attitude .all{ + +.attitude .all { display: flex; align-items: center; } + .attitude .all image { width: 28rpx; height: 28rpx; @@ -90,6 +92,10 @@ page { /* width: 196rpx; */ } +.attitude .all .give-data.color { + color: #FFB103; +} + .comment { width: calc(100% - 98rpx); padding: 26rpx 20rpx; @@ -111,7 +117,8 @@ page { /* 评论样式 */ .release { - align-items: flex-end; /*底部对齐*/ + align-items: flex-end; + /*底部对齐*/ box-sizing: border-box; position: fixed; left: 0; @@ -122,21 +129,27 @@ page { font-size: 28rpx; z-index: 999; } -.replyinfo1{ + +.replyinfo1 { display: flex; - justify-content: space-between; /*两端对齐*/ + justify-content: space-between; + /*两端对齐*/ font-size: 35rpx; } -.replyinfo2{ + +.replyinfo2 { display: flex; - justify-content: space-between; /*两端对齐*/ + justify-content: space-between; + /*两端对齐*/ } - + .release textarea { width: calc(100% - 200rpx); min-height: 34rpx; - max-height: 102rpx; /*最多显示三行*/ - border-width: 15rpx 20rpx; /*使用padding与预期留白不一致,故使用border*/ + max-height: 102rpx; + /*最多显示三行*/ + border-width: 15rpx 20rpx; + /*使用padding与预期留白不一致,故使用border*/ border-style: solid; border-color: #F2F2F2; line-height: 34rpx; @@ -144,12 +157,12 @@ page { background-color: #F2F2F2; border-radius: 4rpx; } - + .release .text { font-size: 40rpx; color: #c9c9c9; } - + .cancel { width: 240rpx; height: 64rpx; @@ -159,17 +172,22 @@ page { margin: 0 3px; padding: 0; } - + .release .submit { - width: 120rpx; - height: 64rpx; - line-height: 64rpx; + width: 160rpx; + height: 60rpx; + line-height: 60rpx; text-align: center; - color: #6c0; margin: 0 3px; 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 { color: #f68135; border-radius: 50rpx; @@ -192,4 +210,4 @@ page { width: 100%; height: 100%; object-fit: cover; -} +} \ No newline at end of file