diff --git a/project.config.json b/project.config.json index 8534479..1086aa5 100644 --- a/project.config.json +++ b/project.config.json @@ -22,7 +22,7 @@ "disablePlugins": [], "outputPath": "" }, - "useCompilerModule": true, + "useCompilerModule": false, "userConfirmedUseCompilerModuleSwitch": false }, "compileType": "miniprogram", diff --git a/subpages/associationNew/components/communityList/communityList.wxss b/subpages/associationNew/components/communityList/communityList.wxss index 8663950..28fcd04 100644 --- a/subpages/associationNew/components/communityList/communityList.wxss +++ b/subpages/associationNew/components/communityList/communityList.wxss @@ -19,7 +19,7 @@ width: 100%; height: 100%; position: absolute; - background: rgba(0, 0, 0, 0.2); + background: rgba(0, 0, 0, 0.1); border-radius: 10rpx; text-align: center; display: flex; diff --git a/subpages/associationNew/pages/eventlist/eventlist.js b/subpages/associationNew/pages/eventlist/eventlist.js index ce307f8..622108e 100644 --- a/subpages/associationNew/pages/eventlist/eventlist.js +++ b/subpages/associationNew/pages/eventlist/eventlist.js @@ -1,318 +1,337 @@ -// subpages/associationNew/pages/eventlist/eventlist.js -const app = getApp() -import { topiclist, commentSubmit, statement } from '../../utils/api' -import { - getTimestamp -} from '../../../../utils/common' -Page({ - - /** - * 页面的初始数据 - */ - data: { - topiclist: [], - timestamp: '', - pageIndex: 1, - pageSize: 10, - partyGroupId: '',//党群id - topicType: '',//0:事好儿鼓个掌 1:话对捧个场 - nodata: false, - loadMoreType: 'none', - loadMoreVisible: false, - bannedFlag: '',//是否禁言 0:否 1:是 - ifcomment: false,//是否显示评论 - focus: false, - topicId: '',//被评论的话题ID - commentContent: '', - index: 0,//点击的第几条数据,用于评论的局部刷新用 - infoCompleted: 0, - completeInfoDialogVisible: false, - ifpreviewImage:false,//解决图片放大刷新列表的问题 - }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - this.setData({ - partyGroupId: options.partyGroupId, - topicType: options.topicType,//0:事好儿鼓个掌 1:话对捧个场 - infoCompleted: app.globalData.infoCompleted - }) - if (options.topicType == 0) { - wx.setNavigationBarTitle({ - title: '事好鼓个掌' - }) - } else { - wx.setNavigationBarTitle({ - title: '话对捧个场' - }) - } - - - }, - // 查列表 - topiclist() { - let that = this; - const para = { - pageIndex: this.data.pageIndex, - pageSize: this.data.pageSize, - timestamp: getTimestamp(), - topicType: this.data.topicType, - partyGroupId: this.data.partyGroupId, //党群id - partyTopicId:'' - } - topiclist(para).then(res => { - wx.stopPullDownRefresh(); - that.setData({ - bannedFlag: res.data.bannedFlag, - nodata: false, - 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 => { - wx.stopPullDownRefresh(); - that.setData({ - topiclist: [], - nodata: true, - loadMoreType: 'none', - loadMoreVisible: false, - }) - console.log(err) - }) - }, - // 跳转 发布话题 - navigateToAddTopic() { - if (this.verifyCompleteInfo()) { - return false - } - wx.navigateTo({ - url: `/subpages/associationNew/pages/addTopic/addTopic?partyGroupId=${this.data.partyGroupId}&topicType=${this.data.topicType}` - }) - }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - if(this.data.ifpreviewImage){ - this.setData({ - ifpreviewImage:false - }) - } else { - this.setData({ - pageIndex: 1, - pageSize: 10, - nodata: false, - loadMoreType: 'none', - loadMoreVisible: false, - topiclist: [], - }) - this.topiclist() - } - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - this.setData({ - pageIndex: 1, - pageSize: 10, - nodata: false, - loadMoreType: 'none', - loadMoreVisible: false, - topiclist: [], - }) - this.topiclist() - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - this.setData({ - loadMoreVisible: true - }) - if (this.data.loadMoreType === 'loading') { - this.setData({ - pageIndex: this.data.pageIndex + 1, - pageSize: this.data.pageSize, - }) - this.topiclist() - } - }, - - //点赞 - clicklike(e) { - if (this.verifyCompleteInfo()) { - return false - } - let index = e.currentTarget.dataset.index - // - if (this.data.bannedFlag == '1') {//被禁言 - wx.showToast({ - title: '您已经被禁言', - icon: 'none', - duration: 2000 - }) - return false - } - 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 => { - // 点赞成功以后实现局部刷新功能 - var obj = that.data.topiclist[index] - // - obj.likeFlag = obj.likeFlag == '0' ? '1' : '0' - obj.supportNum = obj.likeFlag == '1' ? obj.supportNum + 1 : obj.supportNum - 1 - that.setData({ - ["topiclist[" + index + "]"]: obj - }) - }).catch(err => { - console.log(err) - }) - }, - // Textarea获取焦点 - clickTextarea(e) { - if (this.verifyCompleteInfo()) { - return false - } - let index = e.currentTarget.dataset.index - if (this.data.bannedFlag == '1') {//被禁言 - wx.showToast({ - title: '您已经被禁言', - icon: 'none', - duration: 2000 - }) - return false - } - this.setData({ - ifcomment: true, - focus: true, - topicId: e.currentTarget.dataset.id, - index: index - }) - }, - - // 失去焦点 - bindAddressInput(e) { - this.setData({ //失去焦点以后view隐藏 - ifcomment: false, - commentContent: '' - }) - }, - // 双向绑定 - bindIdentity(e) { - this.setData({ - commentContent: e.detail.value - }) - }, - // 评论按钮点击事件 - commentSubmit() { - let that = this; - const para = { - topicId: that.data.topicId,//被评论的话题ID - faCommentId: '',//父评论(被评论)ID - content: that.data.commentContent,//评论内容 - } - commentSubmit(para).then(res => { - // 评论成功以后,调用接口比对出当前评论列表的数据,对已有列表数据进行替换 - that.NowTopiclist() - }).catch(err => { - console.log(err) - }) - }, - - // 列表内当前操作的数据 - NowTopiclist() { - let that = this; - const para = { - pageIndex: 1, - pageSize: 1, - timestamp: getTimestamp(), - topicType: that.data.topicType, - partyGroupId: that.data.partyGroupId, //党群id - partyTopicId: that.data.topicId - } - topiclist(para).then(res => { - console.log(JSON.stringify(res)) - // 评论成功以后实现局部刷新功能 - var obj = that.data.topiclist[that.data.index] - // 评论成功以后评论数量加1 - // obj.commentNum = obj.commentNum + 1 - // obj.comments.splice(0, 0, {username:obj.nickname,content:para.content}); - obj = res.data.topicList[0] - that.setData({ - ["topiclist[" + that.data.index + "]"]: obj - }) - }).catch(err => { - console.log(err) - }) - }, - //列表照片的放大查看 - previewImage(e) { - this.setData({ - ifpreviewImage:true - }) - app.globalData.previewImage = true - wx.previewImage({ - urls: e.currentTarget.dataset.imgarry, - current: e.currentTarget.dataset.src - }) - }, - // 检查 是否完善信息 - verifyCompleteInfo() { - if (this.data.infoCompleted == 0) { - this.setData({ - completeInfoDialogVisible: !this.data.completeInfoDialogVisible - }) - return true - } else { - return false - } - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +// subpages/associationNew/pages/eventlist/eventlist.js +const app = getApp() +import { topiclist, commentSubmit, statement } from '../../utils/api' +import { + getTimestamp +} from '../../../../utils/common' +Page({ + + /** + * 页面的初始数据 + */ + data: { + topiclist: [], + timestamp: '', + pageIndex: 1, + pageSize: 10, + partyGroupId: '',//党群id + topicType: '',//0:事好儿鼓个掌 1:话对捧个场 + nodata: false, + loadMoreType: 'none', + loadMoreVisible: false, + bannedFlag: '',//是否禁言 0:否 1:是 + ifcomment: false,//是否显示评论 + focus: false, + topicId: '',//被评论的话题ID + commentContent: '', + index: 0,//点击的第几条数据,用于评论的局部刷新用 + infoCompleted: 0, + completeInfoDialogVisible: false, + ifpreviewImage:false,//解决图片放大刷新列表的问题 + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + partyGroupId: options.partyGroupId, + topicType: options.topicType,//0:事好儿鼓个掌 1:话对捧个场 + infoCompleted: app.globalData.infoCompleted + }) + if (options.topicType == 0) { + wx.setNavigationBarTitle({ + title: '事好鼓个掌' + }) + } else { + wx.setNavigationBarTitle({ + title: '话对捧个场' + }) + } + + + }, + // 查列表 + topiclist() { + let that = this; + const para = { + pageIndex: this.data.pageIndex, + pageSize: this.data.pageSize, + timestamp: getTimestamp(), + topicType: this.data.topicType, + partyGroupId: this.data.partyGroupId, //党群id + partyTopicId:'' + } + topiclist(para).then(res => { + wx.stopPullDownRefresh(); + that.setData({ + bannedFlag: res.data.bannedFlag, + nodata: false, + 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 => { + wx.stopPullDownRefresh(); + that.setData({ + topiclist: [], + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + console.log(err) + }) + }, + // 跳转 发布话题 + navigateToAddTopic() { + if (this.verifyCompleteInfo()) { + return false + } + wx.navigateTo({ + url: `/subpages/associationNew/pages/addTopic/addTopic?partyGroupId=${this.data.partyGroupId}&topicType=${this.data.topicType}` + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + if(this.data.ifpreviewImage){ + this.setData({ + ifpreviewImage:false + }) + } else { + this.setData({ + pageIndex: 1, + pageSize: 10, + nodata: false, + loadMoreType: 'none', + loadMoreVisible: false, + topiclist: [], + }) + this.topiclist() + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + this.setData({ + pageIndex: 1, + pageSize: 10, + nodata: false, + loadMoreType: 'none', + loadMoreVisible: false, + topiclist: [], + }) + this.topiclist() + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + this.setData({ + loadMoreVisible: true + }) + if (this.data.loadMoreType === 'loading') { + this.setData({ + pageIndex: this.data.pageIndex + 1, + pageSize: this.data.pageSize, + }) + this.topiclist() + } + }, + + //点赞 + clicklike(e) { + if (this.verifyCompleteInfo()) { + return false + } + this.setData({ + index: e.currentTarget.dataset.index + }) + // + if (this.data.bannedFlag == '1') {//被禁言 + wx.showToast({ + title: '您已经被禁言', + icon: 'none', + duration: 2000 + }) + return false + } + 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.nowLikesList(e.currentTarget.dataset.id); + }).catch(err => { + console.log(err) + }) + }, + // Textarea获取焦点 + clickTextarea(e) { + if (this.verifyCompleteInfo()) { + return false + } + let index = e.currentTarget.dataset.index + if (this.data.bannedFlag == '1') {//被禁言 + wx.showToast({ + title: '您已经被禁言', + icon: 'none', + duration: 2000 + }) + return false + } + this.setData({ + ifcomment: true, + focus: true, + topicId: e.currentTarget.dataset.id, + index: index + }) + }, + + // 失去焦点 + bindAddressInput(e) { + this.setData({ //失去焦点以后view隐藏 + ifcomment: false, + commentContent: '' + }) + }, + // 双向绑定 + bindIdentity(e) { + this.setData({ + commentContent: e.detail.value + }) + }, + // 评论按钮点击事件 + commentSubmit() { + let that = this; + const para = { + topicId: that.data.topicId,//被评论的话题ID + faCommentId: '',//父评论(被评论)ID + content: that.data.commentContent,//评论内容 + } + commentSubmit(para).then(res => { + // 评论成功以后,调用接口比对出当前评论列表的数据,对已有列表数据进行替换 + that.NowTopiclist() + }).catch(err => { + console.log(err) + }) + }, + + // 列表内当前操作的数据 + NowTopiclist() { + let that = this; + const para = { + pageIndex: 1, + pageSize: 1, + timestamp: getTimestamp(), + topicType: that.data.topicType, + partyGroupId: that.data.partyGroupId, //党群id + partyTopicId: that.data.topicId + } + topiclist(para).then(res => { + console.log(JSON.stringify(res)) + // 评论成功以后实现局部刷新功能 + var obj = that.data.topiclist[that.data.index] + // 评论成功以后评论数量加1 + // obj.commentNum = obj.commentNum + 1 + // obj.comments.splice(0, 0, {username:obj.nickname,content:para.content}); + obj = res.data.topicList[0] + that.setData({ + ["topiclist[" + that.data.index + "]"]: obj + }) + }).catch(err => { + console.log(err) + }) + }, + //列表照片的放大查看 + previewImage(e) { + this.setData({ + ifpreviewImage:true + }) + app.globalData.previewImage = true + wx.previewImage({ + urls: e.currentTarget.dataset.imgarry, + current: e.currentTarget.dataset.src + }) + }, + // 检查 是否完善信息 + verifyCompleteInfo() { + if (this.data.infoCompleted == 0) { + this.setData({ + completeInfoDialogVisible: !this.data.completeInfoDialogVisible + }) + return true + } else { + return false + } + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + nowLikesList (topicId) { + let that = this; + const para = { + pageIndex: 1, + pageSize: 10, + timestamp: getTimestamp(), + topicType: this.data.topicType, + partyGroupId: this.data.partyGroupId, //党群id + partyTopicId: topicId + } + topiclist(para).then(res => { + var obj = that.data.topiclist[that.data.index] + obj = res.data.topicList[0] + // + // obj.likeFlag = obj.likeFlag == '0' ? '1' : '0' + // obj.supportNum = obj.likeFlag == '1' ? obj.supportNum + 1 : obj.supportNum - 1 + that.setData({ + ["topiclist[" + that.data.index + "]"]: obj + }) + }).catch(err => { + console.log(err) + }) + } }) \ No newline at end of file diff --git a/subpages/associationNew/pages/eventlist/eventlist.wxml b/subpages/associationNew/pages/eventlist/eventlist.wxml index 7fdf802..855fd29 100644 --- a/subpages/associationNew/pages/eventlist/eventlist.wxml +++ b/subpages/associationNew/pages/eventlist/eventlist.wxml @@ -2,8 +2,8 @@ - {{item.nickname}} - + {{item.nickname}} + {{item.createdTime}} diff --git a/subpages/associationNew/pages/eventlist/eventlist.wxss b/subpages/associationNew/pages/eventlist/eventlist.wxss index aed8c02..2b4ae7e 100644 --- a/subpages/associationNew/pages/eventlist/eventlist.wxss +++ b/subpages/associationNew/pages/eventlist/eventlist.wxss @@ -33,6 +33,8 @@ page { font-size: 28rpx; font-weight: bold; color: rgba(51, 51, 51, 1); + display: flex; + align-items: center; } .user-info .name-date .community-logo { @@ -114,8 +116,8 @@ page { } .line { width: calc(100% - 60rpx); - height: 1px; - background-color: #999999; + height: 0.5px; + background-color: #dddddd; } .comment { diff --git a/subpages/associationNew/utils/api.js b/subpages/associationNew/utils/api.js index 1619e5a..16ffc7e 100644 --- a/subpages/associationNew/utils/api.js +++ b/subpages/associationNew/utils/api.js @@ -133,3 +133,4 @@ export function getGuideInfo(partyGroupId) { + diff --git a/utils/config.js b/utils/config.js index 295d26d..7b58fc6 100644 --- a/utils/config.js +++ b/utils/config.js @@ -14,6 +14,7 @@ function BASEURL() { // return 'https://epdc-app.qingdaoshibei.cn/epdc-api/api/' // 电政办 正式环境 接口地址 // return 'https://epdc-shibei.elinkservice.cn/epdc-api/api/' // 电政办 正式环境 接口地址 // return 'https://epdc-jinshui.elinkservice.cn/epdc-api/api/' // 锦水正式环境接口地址 + // return 'http://10.10.10.40:9094/epdc-api/api/' // 锦水测试环境 } function WEBROOT() {