diff --git a/app.json b/app.json index 47a2295..13468fa 100644 --- a/app.json +++ b/app.json @@ -146,7 +146,8 @@ "pages/reportIssueDetail/reportIssueDetail", "pages/suggestDict/suggestDict", "pages/suggestDictList/suggestDictList", - "pages/suggestDetail/suggestDetail" + "pages/suggestDetail/suggestDetail", + "pages/remarkOrReply/remarkOrReply" ] } ], diff --git a/pages/toRegister/toRegister.js b/pages/toRegister/toRegister.js index f68aea3..05123bd 100644 --- a/pages/toRegister/toRegister.js +++ b/pages/toRegister/toRegister.js @@ -21,7 +21,7 @@ Page({ // } // }) let that = this - const versionNum = "1.6.28" + const versionNum = "1.6.29" api.getScanSwitch(versionNum).then(function (res) { console.log(res.data) let state = res.data.scanFlag diff --git a/subpages/associationNew/pages/addTopic/addTopic.js b/subpages/associationNew/pages/addTopic/addTopic.js index 8b94139..2919814 100644 --- a/subpages/associationNew/pages/addTopic/addTopic.js +++ b/subpages/associationNew/pages/addTopic/addTopic.js @@ -47,7 +47,7 @@ Page({ // 话题内容框 值双向绑定 bindTopicValue (e) { this.setData({ - topicValue: e.detail.value + topicValue: e.detail.value.trim(' ') }) console.log(this.data.topicValue) }, @@ -275,6 +275,13 @@ Page({ this.data.imageList.forEach(item => { imagesList.push(item.ossUrl) }) + } else { + wx.showToast({ + title: '请上传图片', + icon: 'none', + duration: 2000 + }) + return false } const para = { topicType:this.data.topicType,//话题类型:0:事好儿鼓个掌 1:话对捧个场 diff --git a/subpages/discussion/pages/addIssue/addIssue.js b/subpages/discussion/pages/addIssue/addIssue.js index 4d158a6..2b0327a 100644 --- a/subpages/discussion/pages/addIssue/addIssue.js +++ b/subpages/discussion/pages/addIssue/addIssue.js @@ -34,7 +34,7 @@ Page({ // 双向绑定 内容输入框 bindTextareaInput (e) { this.setData({ - issueContent: e.detail.value + issueContent: e.detail.value.trim(' ') }) }, // 双向绑定 地址输入框 diff --git a/subpages/discussion/pages/remarkOrReply/remarkOrReply.js b/subpages/discussion/pages/remarkOrReply/remarkOrReply.js index 41a1f5c..ca4a2c8 100644 --- a/subpages/discussion/pages/remarkOrReply/remarkOrReply.js +++ b/subpages/discussion/pages/remarkOrReply/remarkOrReply.js @@ -35,7 +35,7 @@ Page({ // textarea 双向绑定 bindTextareaValue (e) { this.setData({ - textareaValue: e.detail.value + textareaValue: e.detail.value.trim(' ') }) }, remarkOrReply () { diff --git a/subpages/oneKeyService/images/ic_baidataidubianji@2x.png b/subpages/oneKeyService/images/ic_baidataidubianji@2x.png new file mode 100644 index 0000000..517244a Binary files /dev/null and b/subpages/oneKeyService/images/ic_baidataidubianji@2x.png differ diff --git a/subpages/oneKeyService/images/ic_dangbiaoqian.png b/subpages/oneKeyService/images/ic_dangbiaoqian.png new file mode 100644 index 0000000..4103137 Binary files /dev/null and b/subpages/oneKeyService/images/ic_dangbiaoqian.png differ diff --git a/subpages/oneKeyService/images/ic_fandu@2x.png b/subpages/oneKeyService/images/ic_fandu@2x.png new file mode 100644 index 0000000..0ad449b Binary files /dev/null and b/subpages/oneKeyService/images/ic_fandu@2x.png differ diff --git a/subpages/oneKeyService/images/ic_fanduihuise@2x.png b/subpages/oneKeyService/images/ic_fanduihuise@2x.png new file mode 100644 index 0000000..c3ba6fd Binary files /dev/null and b/subpages/oneKeyService/images/ic_fanduihuise@2x.png differ diff --git a/subpages/oneKeyService/images/ic_huifu@2x.png b/subpages/oneKeyService/images/ic_huifu@2x.png new file mode 100644 index 0000000..634a735 Binary files /dev/null and b/subpages/oneKeyService/images/ic_huifu@2x.png differ diff --git a/subpages/oneKeyService/images/ic_qiehuan@2x.png b/subpages/oneKeyService/images/ic_qiehuan@2x.png new file mode 100644 index 0000000..25dcbce Binary files /dev/null and b/subpages/oneKeyService/images/ic_qiehuan@2x.png differ diff --git a/subpages/oneKeyService/images/ic_zhici@2x.png b/subpages/oneKeyService/images/ic_zhici@2x.png new file mode 100644 index 0000000..5c08e19 Binary files /dev/null and b/subpages/oneKeyService/images/ic_zhici@2x.png differ diff --git a/subpages/oneKeyService/images/ic_zhicihuise@2x.png b/subpages/oneKeyService/images/ic_zhicihuise@2x.png new file mode 100644 index 0000000..4d38e43 Binary files /dev/null and b/subpages/oneKeyService/images/ic_zhicihuise@2x.png differ diff --git a/subpages/oneKeyService/pages/index/index.js b/subpages/oneKeyService/pages/index/index.js index 59773d0..c661c43 100644 --- a/subpages/oneKeyService/pages/index/index.js +++ b/subpages/oneKeyService/pages/index/index.js @@ -88,7 +88,7 @@ Page({ goDetails(e) {//模块编码(政策,通知,档案,警事,一键直通) if (e.currentTarget.dataset.modulestyle == '4') { wx.navigateTo({ - url: `../noticeDetail/noticeDetail?pid=${e.currentTarget.dataset.pid}&bannerflag=${e.currentTarget.dataset.bannerflag}&categorycode=${e.currentTarget.dataset.categorycode}&modulestyle=${e.currentTarget.dataset.modulestyle}&categoryname=${e.currentTarget.dataset.categoryname}` + url: `../noticeDetail/noticeDetail?pid=${e.currentTarget.dataset.pid}&bannerflag=${e.currentTarget.dataset.bannerflag}&categorycode=${e.currentTarget.dataset.categorycode}&modulestyle=${e.currentTarget.dataset.modulestyle}&categoryname=${e.currentTarget.dataset.categoryname}&commentFlag=${e.currentTarget.dataset.commentflag}` }) } else { if (e.currentTarget.dataset.categorycode == 'module_hardcore') { @@ -101,7 +101,7 @@ Page({ }) } else { wx.navigateTo({ - url: `../moduleList/moduleList?pid=${e.currentTarget.dataset.pid}&bannerflag=${e.currentTarget.dataset.bannerflag}&categorycode=${e.currentTarget.dataset.categorycode}&modulestyle=${e.currentTarget.dataset.modulestyle}&categoryname=${e.currentTarget.dataset.categoryname}` + url: `../moduleList/moduleList?pid=${e.currentTarget.dataset.pid}&bannerflag=${e.currentTarget.dataset.bannerflag}&categorycode=${e.currentTarget.dataset.categorycode}&modulestyle=${e.currentTarget.dataset.modulestyle}&categoryname=${e.currentTarget.dataset.categoryname}&commentFlag=${e.currentTarget.dataset.commentflag}` }) } } diff --git a/subpages/oneKeyService/pages/index/index.wxml b/subpages/oneKeyService/pages/index/index.wxml index 57ed1d8..b512860 100644 --- a/subpages/oneKeyService/pages/index/index.wxml +++ b/subpages/oneKeyService/pages/index/index.wxml @@ -6,6 +6,7 @@ wx:for-index="index" wx:for="{{modulelist}}" data-pid="{{item.id}}" + data-commentFlag="{{item.commentFlag}}" data-bannerFlag="{{item.bannerFlag}}" data-categoryCode="{{item.categoryCode}}" data-moduleStyle="{{item.moduleStyle}}" diff --git a/subpages/oneKeyService/pages/moduleList/moduleList.js b/subpages/oneKeyService/pages/moduleList/moduleList.js index 77e6d01..67c0b4a 100644 --- a/subpages/oneKeyService/pages/moduleList/moduleList.js +++ b/subpages/oneKeyService/pages/moduleList/moduleList.js @@ -299,12 +299,12 @@ Page({ const info = e.currentTarget.dataset.info if (info.moduleStyle == '4') { wx.navigateTo({ - url: `../noticeDetail/noticeDetail?pid=${info.pid}&bannerflag=${info.bannerFlag}&categorycode=${info.categoryCode}&modulestyle=${info.moduleStyle}&categoryname=${info.categoryName}` + url: `../noticeDetail/noticeDetail?pid=${info.pid}&bannerflag=${info.bannerFlag}&categorycode=${info.categoryCode}&modulestyle=${info.moduleStyle}&categoryname=${info.categoryName}&commentFlag=${info.commentFlag}` }) } else { wx.navigateTo({ - url: `./moduleList?pid=${info.id}&bannerflag=${info.bannerFlag}&categorycode=${info.categoryCode}&modulestyle=${info.moduleStyle}&categoryname=${info.categoryName}` + url: `./moduleList?pid=${info.id}&bannerflag=${info.bannerFlag}&categorycode=${info.categoryCode}&modulestyle=${info.moduleStyle}&categoryname=${info.categoryName}&commentFlag=${info.commentFlag}` }) } }, @@ -313,7 +313,7 @@ Page({ toDetail(e){ const info = e.currentTarget.dataset wx.navigateTo({ - url: `../noticeDetail/noticeDetail?id=${info.id}&title=${this.data.moduleInfo.categoryname}` + url: `../noticeDetail/noticeDetail?id=${info.id}&title=${this.data.moduleInfo.categoryname}&commentFlag=${this.data.moduleInfo.commentFlag}` }) }, diff --git a/subpages/oneKeyService/pages/noticeDetail/components/detailRemark/detailRemark.js b/subpages/oneKeyService/pages/noticeDetail/components/detailRemark/detailRemark.js new file mode 100644 index 0000000..9d56bc3 --- /dev/null +++ b/subpages/oneKeyService/pages/noticeDetail/components/detailRemark/detailRemark.js @@ -0,0 +1,46 @@ +Component({ + data: { + support: "../../../../images/ic_zhicihuise@2x.png", + supported: "../../../../images/ic_zhici@2x.png", + dispport: "../../../../images/ic_fanduihuise@2x.png", + dispported: "../../../../images/ic_fandu@2x.png" + }, + properties: { + remarkObj: { + type: Object, + value: {} + }, + remarkType: { + type: String, + value: "new" + } + }, + lifetimes: { + + }, + pageLifetimes: { + + }, + methods: { + // 对评论进行回复 + replyRemark (e) { + this.triggerEvent("replyRemark", { commentId: e.currentTarget.dataset.commentid }) + }, + // 支持评论 + supportRemark (e) { + this.triggerEvent("supportRemark", { commentId: e.currentTarget.dataset.commentid }) + }, + // 反对 评论 + dispportRemark (e) { + this.triggerEvent("dispportRemark", { commentId: e.currentTarget.dataset.commentid }) + }, + // 最新最热 切换 + changeRemarkType () { + if (this.data.remarkType === "new") { + this.triggerEvent("changeRemarkType", { type: "hot"}) + } else { + this.triggerEvent("changeRemarkType", { type: "new"}) + } + } + } +}) \ No newline at end of file diff --git a/subpages/oneKeyService/pages/noticeDetail/components/detailRemark/detailRemark.json b/subpages/oneKeyService/pages/noticeDetail/components/detailRemark/detailRemark.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/subpages/oneKeyService/pages/noticeDetail/components/detailRemark/detailRemark.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/subpages/oneKeyService/pages/noticeDetail/components/detailRemark/detailRemark.wxml b/subpages/oneKeyService/pages/noticeDetail/components/detailRemark/detailRemark.wxml new file mode 100644 index 0000000..114f2a5 --- /dev/null +++ b/subpages/oneKeyService/pages/noticeDetail/components/detailRemark/detailRemark.wxml @@ -0,0 +1,57 @@ + + + + + 评论 + 表达态度{{remarkObj.statementNum}}次 + + + + + 最新 + + + + + 最热 + + + + + + + + + {{item.content}} + {{item.replyComment.userName}}:{{item.replyComment.content}} + + + + 支持 {{item.approveNum}} + + + + 不支持 {{item.opposeNum}} + + + + 回复 + + + + + \ No newline at end of file diff --git a/subpages/oneKeyService/pages/noticeDetail/components/detailRemark/detailRemark.wxss b/subpages/oneKeyService/pages/noticeDetail/components/detailRemark/detailRemark.wxss new file mode 100644 index 0000000..35920c8 --- /dev/null +++ b/subpages/oneKeyService/pages/noticeDetail/components/detailRemark/detailRemark.wxss @@ -0,0 +1,168 @@ +.detail-remark { + width: 100%; +} +.title { + width: 100%; + height: 80rpx; + display: flex; + align-items: center; + justify-content: space-between; + box-sizing: border-box; + padding-right: 25rpx; +} +.title .left { + display: flex; + align-items: flex-end; +} +.title .left .remark-title { + font-size: 32rpx; + color: #333; + font-weight: bolder; + margin-right: 11rpx; +} +.title .left .remark-altitude { + font-size: 24rpx; + color: #999; +} +.title .right { + height: 80rpx; + width: 110rpx; + perspective: 1000; + transform-style: preserve-3d; +} +.title .right .flip { + position: relative; + transition: 0.6s; + transform-style: preserve-3d; + width: 100%; + height: 100%; +} +.title .right .flip.reverse { + transform: rotateY(180deg); +} +.title .right .flip .front, .title .right .flip .back { + display: flex; + align-items: center; + justify-content: flex-end; + position:absolute; + top: 0px; + left: 0px; + height: 100%; + width: 100%; +} +.title .right .flip .front { + z-index: 2; + background: #f7f7f7; +} +.title .right .flip .back { + transform: rotateY(-180deg); + background: #f7f7f7; +} +.title .right .latest { + font-size: 28rpx; + color: #333; + height: 80rpx; + line-height: 80rpx; +} +.title .right .latest-image { + width: 28rpx; + height: 23rpx; + object-fit: cover; + margin: 0 10rpx 0 10rpx; +} + +.remark-list { + width: 100%; +} +.remark-list .remark-list-item { + width: 100%; + box-sizing: border-box; + border-radius: 16rpx; + background: #fff; + padding: 37rpx 25rpx 0; + overflow: hidden; +} +.remark-list .remark-list-item + .remark-list-item { + margin-top: 20rpx; +} +.remark-list-item .user-info { + width: 100%; + height: 64rpx; + display: flex; + align-items: center; +} +.remark-list-item .user-info .avatar { + width: 64rpx; + height: 64rpx; + border-radius: 8rpx; + margin-right: 13rpx; +} +.remark-list-item .user-info .right { + display: flex; + flex-direction: column; + justify-content: space-between; +} +.remark-list-item .user-info .right .identify { + display: flex; + align-items: center; +} +.remark-list-item .user-info .right .nickname { + font-size: 28rpx; + color: #333; +} +.remark-list-item .user-info .right .party-flag { + width: 27rpx; + height: 27rpx; + object-fit: cover; + margin-left: 6rpx; +} +.remark-list-item .user-info .right .time { + font-size: 20rpx; + color: #999; +} +.remark-list-item .remark-content { + margin-top: 28rpx; + margin-bottom: 24rpx; + font-size: 36rpx; + color: #333; +} +.remark-list-item .remarked-content { + width: 100%; + height: 88rpx; + border-radius: 16rpx; + background: #f2f2f2; + box-sizing: border-box; + padding: 0 20rpx; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + font-size: 30rpx; + color: #999; + line-height: 88rpx; + margin-bottom: 25rpx; +} +.remark-list-item .operation { + width: 100%; + height: 85rpx; + display: flex; + align-items: center; + justify-content: space-around; + border-top: 1rpx solid #eaeaea; +} +.remark-list-item .operation .type { + flex: 1; + height: 100%; + display: flex; + align-items: center; + justify-content: center; +} +.remark-list-item .operation .type image { + width: 28rpx; + height: 28rpx; + object-fit: cover; +} +.remark-list-item .operation .type view { + font-size: 24rpx; + color: #A7A7A7; + margin-left: 15rpx; +} \ No newline at end of file diff --git a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.js b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.js index 02ddf23..93d1bad 100644 --- a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.js +++ b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.js @@ -1,5 +1,7 @@ const api = require('../../../../utils/understandJs') +const app = getApp() import util from '../../../../utils/util' +import { formatTimestamp } from "../../utils/common" Page({ /** @@ -8,8 +10,6 @@ Page({ data: { noticeObj: {}, noticeObjContent: "", - pageIndex:1, - pageSize:10, categoryName:'', preloadVisible: true, isNeedBanner: false, @@ -21,19 +21,46 @@ Page({ duration: 500, //幻灯片切换时长(ms) currentSwiper: 0, nodata: false, - showTitle: true + showTitle: true, + noticeId: '', + infoCompleted: 0, // 当前用户是否完善信息 + completeInfoDialogVisible: false, // 完善信息弹窗 + commentFlag: '0', //是否显示评论列表 + remarkType: "new", // 评论 最新最热类型 + pageIndex:1, + pageSize:10, + remarkObj: { // 评论列表 + statementNum: 0, + commentsList: [] + }, + supportTimer: "", // 点赞 支持的计时器 + dispportTimer: "", // 点踩 反对的计时器 + dialogVisible: false, // 提示信息探矿所需入参 + dialogTitle: "", + dialogContent: "", + dialogConformText: "", + dialogCancelText: "", + loadMoreVisible: false, // loadMoreVisible 和 loadMoreType 控制 超出一屏时的 加载和没有更多的显示与隐藏 + loadMoreType: "none", }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - console.log(options) + this.setData({ + infoCompleted: app.globalData.infoCompleted, + commentFlag: options.commentFlag + }) if (options.id) { wx.setNavigationBarTitle({ title: options.title }) + this.setData({ + noticeId: options.id + }) this.noticeDetail(options.id) + this.getRemarkList() } else { this.setData({ categoryName:options.categorycode @@ -99,8 +126,8 @@ Page({ noticelist () { let that = this; let params = { - pageIndex: that.data.pageIndex, - pageSize: that.data.pageSize, + pageIndex: 1, + pageSize: 10, noticeCategory: that.data.categoryName } api.noticelist(params).then(function (res) { @@ -110,9 +137,11 @@ Page({ }) } else { that.setData({ - nodata: false + nodata: false, + noticeId: res.data[0].id }) that.noticeDetail(res.data[0].id) + that.getRemarkList() } }).catch(err => { console.log(err) @@ -130,6 +159,171 @@ Page({ console.log(err) }) }, + + // 最新最热 评论列表切换 + changeRemarkType (e) { + this.setData({ + remarkType: e.detail.type, + loadMoreVisible: false + }) + this.getRemarkList() + }, + // 获取评论列表 下拉刷新 + getRemarkList () { + if (this.data.commentFlag != '1') { + return false + } + this.setData({ + pageIndex: 1, + pageSize: 10 + }) + const para = { + pageIndex: this.data.pageIndex, + pageSize: this.data.pageSize, + timestamp: formatTimestamp(), + orderType: this.data.remarkType === "new" ? 0 : 1, + noticeId: this.data.noticeId, + } + api.getCommentList(para).then(res => { + console.log("评论列表", res) + this.setData({ + remarkObj: { + statementNum: res.data.statementNum, + commentsList: [...res.data.commentsList] + }, + loadMoreType: res.data.commentsList.length === 10 ? "loading" : "none" + }) + }).catch(err => { + console.log(err) + }) + }, + // 获取评论列表 上拉加载 + loadMoreGetRemarkList () { + const para = { + pageIndex: this.data.pageIndex, + pageSize: this.data.pageSize, + timestamp: formatTimestamp(), + orderType: this.data.remarkType === "new" ? 0 : 1, + noticeId: this.data.noticeId, + } + api.getCommentList(para).then(res => { + console.log("评论列表", res) + this.setData({ + remarkObj: { + statementNum: res.data.statementNum, + commentsList: [...this.data.remarkObj.commentsList, ...res.data.commentsList] + }, + loadMoreType: res.data.commentsList.length === 10 ? "loading" : "none" + }) + }).catch(err => { + console.log(err) + }) + }, + debounceSupportRemark (e) { + clearTimeout(this.data.supportTimer) + this.data.supportTimer = setTimeout(() => { + this.supportRemark(e) + }, 300) + }, + // 评论 支持 点赞 + supportRemark (e) { + if (this.verifyCompleteInfo()) { + return false + } + const hasAttitude = this.data.remarkObj.commentsList.some(item => item.commentId === e.detail.commentId && (item.userLike || item.userDislike)) + if (hasAttitude) { + this.setData({ + dialogConformText: "知道了", + dialogContent: ["已表达过态度,不可以更改哦!"], + dialogTitle: "已表态", + dialogVisible: !this.data.dialogVisible + }) + return false + } + const index = this.data.remarkObj.commentsList.findIndex(item => item.commentId === e.detail.commentId) + this.setData({ + [`remarkObj.commentsList[${index}].userLike`]: true, + [`remarkObj.commentsList[${index}].approveNum`]: parseInt(this.data.remarkObj.commentsList[index].approveNum) + 1, + ["remarkObj.statementNum"]: parseInt(this.data.remarkObj.statementNum) + 1 + }) + const para = { + attitude: "0", + commentId: e.detail.commentId, + noticeId: this.data.noticeId + } + api.commentSupport(para).then(res => { + console.log('评论支持', res) + }).catch(err => { + console.log(err) + }) + }, + debounceDispportRemark (e) { + clearTimeout(this.data.dispportTimer) + this.data.dispportTimer = setTimeout(() => { + this.dispportRemark(e) + }, 300) + }, + // 评论 不支持 点踩 + dispportRemark (e) { + if (this.verifyCompleteInfo()) { + return false + } + const hasAttitude = this.data.remarkObj.commentsList.some(item => item.commentId === e.detail.commentId && (item.userLike || item.userDislike)) + if (hasAttitude) { + this.setData({ + dialogConformText: "知道了", + dialogContent: ["已表达过态度,不可以更改哦!"], + dialogTitle: "已表态", + dialogVisible: !this.data.dialogVisible + }) + return false + } + const index = this.data.remarkObj.commentsList.findIndex(item => item.commentId === e.detail.commentId) + this.setData({ + [`remarkObj.commentsList[${index}].userDislike`]: true, + [`remarkObj.commentsList[${index}].opposeNum`]: parseInt(this.data.remarkObj.commentsList[index].opposeNum) + 1, + ["remarkObj.statementNum"]: parseInt(this.data.remarkObj.statementNum) + 1 + }) + const para = { + attitude: "1", + commentId: e.detail.commentId, + noticeId: this.data.noticeId + } + api.commentOpposition(para).then(res => { + console.log('评论不支持', res) + }).catch(err => { + console.log(err) + }) + }, + // 进行评论 + navigateToReply () { + if (this.verifyCompleteInfo()) { + return false + } + wx.navigateTo({ + url: `../remarkOrReply/remarkOrReply?noticeId=${this.data.noticeId}&faCommentId=` + }) + }, + // 评论 回复 回调 + replyRemark (e) { + if (this.verifyCompleteInfo()) { + return false + } + wx.navigateTo({ + url: `../remarkOrReply/remarkOrReply?noticeId=${this.data.noticeId}&faCommentId=${e.detail.commentId}` + }) + }, + // 检查 是否完善信息 + verifyCompleteInfo () { + if (this.data.infoCompleted == 0) { + this.setData({ + completeInfoDialogVisible: !this.data.completeInfoDialogVisible + }) + return true + } else { + return false + } + }, /** * 生命周期函数--监听页面初次渲染完成 @@ -170,13 +364,21 @@ Page({ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - + this.setData({ + loadMoreVisible: true + }) + if (this.data.loadMoreType === "loading") { + this.setData({ + pageIndex: this.data.pageIndex + 1 + }) + this.loadMoreGetRemarkList() + } }, /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + // onShareAppMessage: function () { - } + // } }) \ No newline at end of file diff --git a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.json b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.json index a93c426..f457eb5 100644 --- a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.json +++ b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.json @@ -1,7 +1,11 @@ { "usingComponents": { "no-data": "../../../../components/nodata/nodata", - "parser": "../../../../components/parser/parser" + "parser": "../../../../components/parser/parser", + "completeInfo-dialog": "../../../../components/completeInfoDialog/completeInfoDialog", + "detail-remark": "./components/detailRemark/detailRemark", + "load-more": "../../../../components/loadMore/loadMore", + "tip-dialog": "../../compontents/notice/notice" }, "navigationBarTitleText": "" } \ No newline at end of file diff --git a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.wxml b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.wxml index d89615b..910df50 100644 --- a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.wxml +++ b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.wxml @@ -51,6 +51,41 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.wxss b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.wxss index 62380f9..306e135 100644 --- a/subpages/oneKeyService/pages/noticeDetail/noticeDetail.wxss +++ b/subpages/oneKeyService/pages/noticeDetail/noticeDetail.wxss @@ -3,10 +3,10 @@ page{ } .notice-detail { width: 100%; - height: 100%; box-sizing: border-box; padding: 20rpx; background: #f7f7f7; + margin-bottom: 80rpx; } .richContent img{ width: 100%!important; @@ -19,6 +19,7 @@ page{ border-radius: 16rpx; box-sizing: border-box; padding: 0 25rpx 38rpx; + margin-bottom: 40rpx; } .detail-title { font-family: PingFang-SC-Bold; @@ -264,4 +265,59 @@ swiper { position: absolute; top: 0; } -/* 轮播图end */ \ No newline at end of file +/* 轮播图end */ + +/* 评论 start */ +.bottom { + width: 100%; + height: 90rpx; + background: #fff; + padding: 15rpx; + box-sizing: border-box; + display: flex; + align-items: center; + position: fixed; + bottom: 0; + left: 0; +} +.reply { + width: 490rpx; + height: 70rpx; + border-radius: 8rpx; + background: #F2F2F2; + display: flex; + align-items: center; +} +.reply image { + width: 30rpx; + height: 30rpx; + margin: 0 10rpx 0 25rpx; +} +.reply input { + height: 100%; + width: calc(100% - 65rpx); + font-size: 26rpx; +} +.reply .placeholder-input { + font-size: 26rpx; + color: #a8a8a8; +} +button { + width: 200rpx; + height: 70rpx; + border-radius: 35rpx; + background: linear-gradient(to right, #FFAC00, #FFBF00); + color: #fff; + font-size: 30rpx; + line-height: 70rpx; + text-align:center; + padding: 0; + outline: 0; +} +button::after { + border:0; +} +.hover-button { + background: orange; +} +/* 评论 end */ \ No newline at end of file diff --git a/subpages/oneKeyService/pages/remarkOrReply/remarkOrReply.js b/subpages/oneKeyService/pages/remarkOrReply/remarkOrReply.js new file mode 100644 index 0000000..ba43ea0 --- /dev/null +++ b/subpages/oneKeyService/pages/remarkOrReply/remarkOrReply.js @@ -0,0 +1,108 @@ +const api = require('../../../../utils/understandJs') + +Page({ + data: { + textareaValue: "", + faCommentId: "", + noticeId: "", + violationsCount: 0, //违规次数 + isConReview: false, + lock: false, //锁定提交状态,防止双击 + }, + onLoad (options) { + this.setData({ + noticeId: options.noticeId, + faCommentId: options.faCommentId + }) + }, + // textarea 双向绑定 + bindTextareaValue (e) { + this.setData({ + textareaValue: e.detail.value.trim(' ') + }) + }, + remarkOrReply () { + if (!this.data.textareaValue) { + wx.showToast({ + title: "请输入评论内容", + icon: "none" + }) + return false + } + if (this.data.lock) { + return false + } + this.setData({ + lock: true + }) + const para = { + noticeId: this.data.noticeId, + faCommentId: this.data.faCommentId, + content: this.data.textareaValue, + // isConReview: this.data.isConReview + } + wx.showLoading({ + title: "提交中..." + }) + let that = this + if (this.data.faCommentId) { //评论 回复 回调 + api.commentReplySubmit(para).then(res => { + wx.hideLoading() + this.setData({ + lock: false + }) + console.log("评论或回复", res) + wx.showToast({ + title: "评论成功", + icon: "none", + duration: 1000 + }) + this.setData({ + textareaValue: '' + }) + const pages = getCurrentPages() + const page = pages[pages.length - 2] + if (page.getRemarkList) { + page.getRemarkList() + } + setTimeout(() => { + wx.navigateBack() + }, 500) + }).catch(err => { + console.log(err) + this.setData({ + lock: false + }) + }) + } else { //对 内容 进行评论 + api.commentSubmit(para).then(res => { + wx.hideLoading() + this.setData({ + lock: false + }) + console.log("评论或回复", res) + wx.showToast({ + title: "评论成功", + icon: "none", + duration: 1000 + }) + this.setData({ + textareaValue: '' + }) + const pages = getCurrentPages() + const page = pages[pages.length - 2] + if (page.getRemarkList) { + page.getRemarkList() + } + setTimeout(() => { + wx.navigateBack() + }, 500) + }).catch(err => { + console.log(err) + this.setData({ + lock: false + }) + }) + } + } +}) \ No newline at end of file diff --git a/subpages/oneKeyService/pages/remarkOrReply/remarkOrReply.json b/subpages/oneKeyService/pages/remarkOrReply/remarkOrReply.json new file mode 100644 index 0000000..eee523f --- /dev/null +++ b/subpages/oneKeyService/pages/remarkOrReply/remarkOrReply.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "评论" +} \ No newline at end of file diff --git a/subpages/oneKeyService/pages/remarkOrReply/remarkOrReply.wxml b/subpages/oneKeyService/pages/remarkOrReply/remarkOrReply.wxml new file mode 100644 index 0000000..42e7f50 --- /dev/null +++ b/subpages/oneKeyService/pages/remarkOrReply/remarkOrReply.wxml @@ -0,0 +1,20 @@ + + + + + {{textareaValue.length}}/200 + + + + + + \ No newline at end of file diff --git a/subpages/oneKeyService/pages/remarkOrReply/remarkOrReply.wxss b/subpages/oneKeyService/pages/remarkOrReply/remarkOrReply.wxss new file mode 100644 index 0000000..1e3c328 --- /dev/null +++ b/subpages/oneKeyService/pages/remarkOrReply/remarkOrReply.wxss @@ -0,0 +1,76 @@ +page { + width:100%; + height:100vh; +} +.remark-or-reply { + width: 100%; + height: 100%; + background: #f7f7f7; + box-sizing: border-box; + padding: 20rpx; +} +.remark-or-reply .remark-content { + width: 100%; + border-radius: 16rpx; + background: #fff; + height: 930rpx; + box-sizing: border-box; + padding: 25rpx; +} +.remark-or-reply .remark-content textarea { + width: 100%; + height: calc(100% - 50rpx); + overflow-y: auto; + font-size: 32rpx; + color: #333; + line-height: 50rpx; +} +.remark-or-reply .remark-content .content-num { + width:100%; + height: 50rpx; + line-height: 50rpx; + font-size: 28rpx; + color: #999; + text-align: right; +} +.remark-or-reply .remark-content .textarea-placeholder { + font-size: 32rpx; + color: #999; +} +.reply-btn { + width: 100%; + height: 84rpx; + display: flex; + align-items: center; + justify-content: center; + margin-top: 70rpx; +} +.reply-btn button { + width: 560rpx; + height: 100rpx; + line-height: 84rpx; + text-align: center; + color: #fff; + font-size: 36rpx; + padding: 0; + outline: 0; + border-radius: 16rpx; + /* background: linear-gradient(to right, #f40f0f, #ff4c4c); */ + background-color: transparent; +} +.reply-btn .hover-button { + /* background:red; */ +} +button image { + width: 100%; + height: 100%; +} +button text { + position: absolute; + width: 100%; + height: 100%; + left: 0; +} +button::after { + border: none; +} \ No newline at end of file diff --git a/subpages/oneKeyService/utils/common.js b/subpages/oneKeyService/utils/common.js new file mode 100644 index 0000000..2d29397 --- /dev/null +++ b/subpages/oneKeyService/utils/common.js @@ -0,0 +1,10 @@ +export function formatTimestamp () { + const date = new Date() + const year = date.getFullYear() + const month = (date.getMonth() + 1).toString().padStart(2, "0") + const day = (date.getDate()).toString().padStart(2, "0") + const hour = (date.getHours()).toString().padStart(2, "0") + const minute = (date.getMinutes()).toString().padStart(2, "0") + const second = (date.getSeconds()).toString().padStart(2, "0") + return `${year}-${month}-${day} ${hour}:${minute}:${second}` +} \ No newline at end of file diff --git a/utils/understandJs.js b/utils/understandJs.js index 45d3302..28699f7 100644 --- a/utils/understandJs.js +++ b/utils/understandJs.js @@ -10,7 +10,12 @@ module.exports = { bannerList:bannerList, videoBannerList:videoBannerList, getFullDictInfo:getFullDictInfo, - moduleCategory:moduleCategory + moduleCategory:moduleCategory, + getCommentList: getCommentList, + commentSupport: commentSupport, + commentOpposition: commentOpposition, + commentSubmit: commentSubmit, + commentReplySubmit: commentReplySubmit } // 了解锦水-模块管理接口 function modulelist(moduleCategory='') { @@ -63,4 +68,27 @@ function getFullDictInfo (dictType) { // 一键服务/解码锦水 改版模块类别接口 function moduleCategory(params) { return fly.get('news/module/moduleCategory', params) +} + +//内容评论列表【最新/最热列表】 +function getCommentList(params) { + return fly.get('news/notice/comment/list', params) +} + +//表态内容评论(赞) +function commentSupport (data) { + return fly.post("news/notice/comment/statement/support", data) +} +//表态内容评论(踩) +function commentOpposition (data) { + return fly.post("news/notice/comment/statement/opposition", data) +} + +//内容评论提交 +function commentSubmit (data) { + return fly.post("news/notice/comment/submit", data) +} +//内容评论的回复提交 +function commentReplySubmit (data) { + return fly.post("news/notice/comment/reply/submit", data) } \ No newline at end of file