diff --git a/app.json b/app.json index 472d5db..67226e6 100644 --- a/app.json +++ b/app.json @@ -71,6 +71,13 @@ "pages/inviteRecord/inviteRecord", "pages/gridManage/gridManage" ] + }, + { + "root": "subpages/integralCentre", + "name": "integralCentre", + "pages": [ + "pages/index/index" + ] } ], "preloadRule": { diff --git a/subpages/association/pages/replyOrRemark/replyOrRemark.js b/subpages/association/pages/replyOrRemark/replyOrRemark.js index 77ecf34..58bb126 100644 --- a/subpages/association/pages/replyOrRemark/replyOrRemark.js +++ b/subpages/association/pages/replyOrRemark/replyOrRemark.js @@ -1,4 +1,7 @@ -import { remarkOrReply } from '../../utils/api' +import { + // remarkOrReply, +topicCom, +topicReply } from '../../utils/api' Page({ data: { @@ -44,17 +47,44 @@ Page({ wx.showLoading({ title: '加载中' }) - remarkOrReply(para).then(res => { - wx.hideLoading() - console.log('评论或者回复', res) - wx.showToast({ - title: '评论成功', - icon: 'none', - duration: 2000 + if (faCommentId) {//对评论进行回复 + topicReply(para).then(res => { + wx.hideLoading() + console.log('回复', res) + wx.showToast({ + title: '评论成功', + icon: 'none', + duration: 2000 + }) + wx.navigateBack() + }).catch(err => { + console.log(err) }) - wx.navigateBack() - }).catch(err => { - console.log(err) - }) + }else{ + topicCom(para).then(res => { + wx.hideLoading() + console.log('评论', res) + wx.showToast({ + title: '评论成功', + icon: 'none', + duration: 2000 + }) + wx.navigateBack() + }).catch(err => { + console.log(err) + }) + } + // remarkOrReply(para).then(res => { + // wx.hideLoading() + // console.log('评论或者回复', res) + // wx.showToast({ + // title: '评论成功', + // icon: 'none', + // duration: 2000 + // }) + // wx.navigateBack() + // }).catch(err => { + // console.log(err) + // }) } }) \ No newline at end of file diff --git a/subpages/association/pages/topicDetail/topicDetail.js b/subpages/association/pages/topicDetail/topicDetail.js index 63b1acf..2a91c10 100644 --- a/subpages/association/pages/topicDetail/topicDetail.js +++ b/subpages/association/pages/topicDetail/topicDetail.js @@ -1,4 +1,11 @@ -import { getTopicDetail, getRemarkList, closeTopic, publishStatement, getCloseReason } from '../../utils/api' +import { + getTopicDetail, + getRemarkList, + closeTopic, + // publishStatement, + topicComLike, + topicComUnlike, + getCloseReason } from '../../utils/api' import { getTimestamp } from '../../utils/common' const app = getApp() @@ -292,10 +299,10 @@ Page({ } catch (err) { return false } - publishStatement(para).then(res => { + topicComLike(para).then(res => { this.getTopicAltitudeNum() console.log('支持', res) - this.data.remarkList.forEach((item,index) => { + this.data.remarkList.forEach((item, index) => { if (item.commentId === e.detail.commentId) { this.setData({ [`remarkList[${index}].userLike`]: true, @@ -313,6 +320,27 @@ Page({ }).catch(err => { console.log(err) }) + // publishStatement(para).then(res => { + // this.getTopicAltitudeNum() + // console.log('支持', res) + // this.data.remarkList.forEach((item,index) => { + // if (item.commentId === e.detail.commentId) { + // this.setData({ + // [`remarkList[${index}].userLike`]: true, + // [`remarkList[${index}].userDislike`]: false, + // [`remarkList[${index}].approveNum`]: parseInt(this.data.remarkList[index].approveNum) + 1, + // [`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) > 0 ? parseInt(this.data.remarkList[index].opposeNum) - 1 : 0 + // }) + // wx.showToast({ + // title: '表态成功', + // icon: 'none', + // duration: 2000 + // }) + // } + // }) + // }).catch(err => { + // console.log(err) + // }) }, // 反对某条评论 debounce 防抖 debiunceDispportReply (e) { @@ -362,7 +390,7 @@ Page({ } catch (err) { return false } - publishStatement(para).then(res => { + topicComUnlike(para).then(res => { this.getTopicAltitudeNum() console.log('反对', res) this.data.remarkList.forEach((item, index) => { @@ -370,7 +398,7 @@ Page({ this.setData({ [`remarkList[${index}].userLike`]: false, [`remarkList[${index}].userDislike`]: true, - [`remarkList[${index}].approveNum`]: parseInt(this.data.remarkList[index].approveNum) > 0 ? parseInt(this.data.remarkList[index].approveNum) - 1: 0, + [`remarkList[${index}].approveNum`]: parseInt(this.data.remarkList[index].approveNum) > 0 ? parseInt(this.data.remarkList[index].approveNum) - 1 : 0, [`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) + 1 }) wx.showToast({ @@ -383,6 +411,27 @@ Page({ }).catch(err => { console.log(err) }) + // publishStatement(para).then(res => { + // this.getTopicAltitudeNum() + // console.log('反对', res) + // this.data.remarkList.forEach((item, index) => { + // if (item.commentId === e.detail.commentId) { + // this.setData({ + // [`remarkList[${index}].userLike`]: false, + // [`remarkList[${index}].userDislike`]: true, + // [`remarkList[${index}].approveNum`]: parseInt(this.data.remarkList[index].approveNum) > 0 ? parseInt(this.data.remarkList[index].approveNum) - 1: 0, + // [`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) + 1 + // }) + // wx.showToast({ + // title: '表态成功', + // icon: 'none', + // duration: 2000 + // }) + // } + // }) + // }).catch(err => { + // console.log(err) + // }) }, // 对评论进行回复 replyRemark (e) { diff --git a/subpages/association/utils/api.js b/subpages/association/utils/api.js index 6f44b02..7633cd9 100644 --- a/subpages/association/utils/api.js +++ b/subpages/association/utils/api.js @@ -223,6 +223,27 @@ export function publishStatement ({ attitude, commentId, topicId }) { }) } +/** + * 话题评论点赞 v2 + */ +export function topicComLike({ attitude, commentId, topicId }) { + return request.post('group/comment/topicComLike', { + attitude, + commentId, + topicId + }) +} +/** + * 话题评论点踩 v2 + */ +export function topicComUnlike({ attitude, commentId, topicId }) { + return request.post('group/comment/topicComUnlike', { + attitude, + commentId, + topicId + }) +} + /** * 生成网格小程序码 */ diff --git a/subpages/discussion/pages/discussionDetail/discussionDetail.js b/subpages/discussion/pages/discussionDetail/discussionDetail.js index 1f7ce29..1163027 100644 --- a/subpages/discussion/pages/discussionDetail/discussionDetail.js +++ b/subpages/discussion/pages/discussionDetail/discussionDetail.js @@ -2,14 +2,24 @@ import { getIssueDetail, getIssueTypeStatistics, getRemarkList, - showRemarkStatement, - showIssueStatement, + // showRemarkStatement, + issueComLike, + issueComUnlike, + itemComLike, + itemComUnlike, + // showIssueStatement, + issueSupport, + issueOpposition, + itemSupport, + itemOpposition, getProjectDetail, getProjectTypeStatistics, getIssueHandleProgressV2, getProjectHandleProgressV2 } from '../../utils/api' -import { formatTimestamp } from '../../utils/common' +import { + formatTimestamp +} from '../../utils/common' const app = getApp() Page({ data: { @@ -68,7 +78,7 @@ Page({ infoCompleted: 0, // 当前用户是否完善信息 showClassify: 'hide' // 是否显示 议题/项目分类列表 }, - onLoad (options) { + onLoad(options) { if (options.showClassify === 'show') { this.setData({ showClassify: 'show' @@ -85,7 +95,7 @@ Page({ }) this.getIssueHandleProgressV2(this.data.issueId).then(res => { const handleProgressList = [] - res.forEach((item,index) => { + res.forEach((item, index) => { if (index === res.length - 1) { item.type = 'point' item.isFirst = true @@ -119,7 +129,7 @@ Page({ console.log('项目和议题处理进展', res) const issueList = [] const projectList = [] - res[0].forEach((item,index) => { + res[0].forEach((item, index) => { if (index === res[0].length - 1) { item.type = 'point' item.isFirst = true @@ -149,13 +159,13 @@ Page({ }) }) this.getRemarkList() - + } this.setData({ infoCompleted: app.globalData.infoCompleted }) }, - onReachBottom () { + onReachBottom() { this.setData({ loadMoreVisible: true }) @@ -167,7 +177,7 @@ Page({ } }, // 获取议题详情 - getIssueDetail () { + getIssueDetail() { return new Promise((resolve, reject) => { getIssueDetail(this.data.issueId).then(res => { console.log('议题详情', res) @@ -186,7 +196,7 @@ Page({ }) }, // 获取项目详情 - getProjectDetail () { + getProjectDetail() { return new Promise((resolve, reject) => { getProjectDetail(this.data.projectId).then(res => { console.log('项目详情', res) @@ -206,7 +216,7 @@ Page({ }) }, // 议题类别统计 - getIssueTypeStatistics (categoryCode) { + getIssueTypeStatistics(categoryCode) { getIssueTypeStatistics(categoryCode).then(res => { console.log('议题类别统计', res) const typeStatisticsObj = {} @@ -221,7 +231,7 @@ Page({ }) }, // 项目类别统计 - getProjectTypeStatistics (categoryCode) { + getProjectTypeStatistics(categoryCode) { getProjectTypeStatistics(categoryCode).then(res => { console.log('项目类别统计', res) const typeStatisticsObj = {} @@ -236,10 +246,10 @@ Page({ }) }, // 议题处理进展 v2 - getIssueHandleProgressV2 (issueId) { + getIssueHandleProgressV2(issueId) { return new Promise((resolve, reject) => { getIssueHandleProgressV2(issueId).then(res => { - console.log('议题处理进度v2',res) + console.log('议题处理进度v2', res) resolve(res.data) }).catch(err => { console.log(err) @@ -248,7 +258,7 @@ Page({ }) }, // 项目处理进展 v2 - getProjectHandleProgressV2 () { + getProjectHandleProgressV2() { return new Promise((resolve, reject) => { getProjectHandleProgressV2(this.data.projectId).then(res => { console.log('项目处理进展', res) @@ -260,7 +270,7 @@ Page({ }) }, // 最新最热 评论列表切换 - changeRemarkType (e) { + changeRemarkType(e) { this.setData({ remarkType: e.detail.type, loadMoreVisible: false @@ -268,7 +278,7 @@ Page({ this.getRemarkList() }, // 获取评论列表 下拉刷新 - getRemarkList () { + getRemarkList() { this.setData({ timeStamp: formatTimestamp(), pageNo: 1, @@ -296,7 +306,7 @@ Page({ }) }, // 获取评论列表 上拉加载 - loadMoreGetRemarkList () { + loadMoreGetRemarkList() { const para = { pageIndex: this.data.pageNo, pageSize: this.data.pageSize, @@ -310,7 +320,7 @@ Page({ this.setData({ remarkObj: { statementNum: res.data.statementNum, - commentsList: [...this.data.remarkObj.commentsList,...res.data.commentsList] + commentsList: [...this.data.remarkObj.commentsList, ...res.data.commentsList] }, loadMoreType: res.data.commentsList.length === 10 ? 'loading' : 'none' }) @@ -318,18 +328,18 @@ Page({ console.log(err) }) }, - debounceSupportRemark (e) { + debounceSupportRemark(e) { clearTimeout(this.data.supportTimer) this.data.supportTimer = setTimeout(() => { this.supportRemark(e) }, 300) }, // 评论 支持 点赞 - supportRemark (e) { + supportRemark(e) { if (this.verifyCompleteInfo()) { return false } - if(this.verifyState()) { + if (this.verifyState()) { return false } const hasAttitude = this.data.remarkObj.commentsList.some(item => item.commentId === e.detail.commentId && (item.userLike || item.userDislike)) @@ -354,24 +364,37 @@ Page({ issueId: this.data.detailType === 'issue' ? this.data.issueId : '', itemId: this.data.detailType === 'project' ? this.data.projectId : '' } - showRemarkStatement(para).then(res => { - console.log('评论支持', res) - }).catch(err => { - console.log(err) - }) + if (this.data.detailType == 'issue') { //议题 + issueComLike(para).then(res => { + console.log('评论支持', res) + }).catch(err => { + console.log(err) + }) + } else { + itemComLike(para).then(res => { + console.log('评论支持', res) + }).catch(err => { + console.log(err) + }) + } + // showRemarkStatement(para).then(res => { + // console.log('评论支持', res) + // }).catch(err => { + // console.log(err) + // }) }, - debounceDispportRemark (e) { + debounceDispportRemark(e) { clearTimeout(this.data.dispportTimer) this.data.dispportTimer = setTimeout(() => { this.dispportRemark(e) }, 300) }, // 评论 不支持 点踩 - dispportRemark (e) { + dispportRemark(e) { if (this.verifyCompleteInfo()) { return false } - if(this.verifyState()) { + if (this.verifyState()) { return false } const hasAttitude = this.data.remarkObj.commentsList.some(item => item.commentId === e.detail.commentId && (item.userLike || item.userDislike)) @@ -397,18 +420,31 @@ Page({ issueId: this.data.detailType === 'issue' ? this.data.issueId : '', itemId: this.data.detailType === 'project' ? this.data.projectId : '' } - showRemarkStatement(para).then(res => { - console.log('评论不支持', res) - }).catch(err => { - console.log(err) - }) + if (this.data.detailType == 'issue') { //议题 + issueComUnlike(para).then(res => { + console.log('评论不支持', res) + }).catch(err => { + console.log(err) + }) + } else { + itemComUnlike(para).then(res => { + console.log('评论不支持', res) + }).catch(err => { + console.log(err) + }) + } + // showRemarkStatement(para).then(res => { + // console.log('评论不支持', res) + // }).catch(err => { + // console.log(err) + // }) }, // 对 议题/项目 进行评论 - navigateToReply () { + navigateToReply() { if (this.verifyCompleteInfo()) { return false } - if(this.verifyState()) { + if (this.verifyState()) { return false } wx.navigateTo({ @@ -416,29 +452,29 @@ Page({ }) }, // 评论 回复 回调 - replyRemark (e) { + replyRemark(e) { if (this.verifyCompleteInfo()) { return false } - if(this.verifyState()) { + if (this.verifyState()) { return false } wx.navigateTo({ url: `/subpages/discussion/pages/remarkOrReply/remarkOrReply?detailId=${this.data.detailId}&faCommentId=${e.detail.commentId}&detailType=${this.data.detailType}` }) }, - debounceSupportIssueOrProject () { + debounceSupportIssueOrProject() { clearTimeout(this.data.supportTimer) this.data.supportTimer = setTimeout(() => { this.supportIssueOrProject() }, 300) }, // 点赞 议题或评论 - supportIssueOrProject () { + supportIssueOrProject() { if (this.verifyCompleteInfo()) { return false } - if(this.verifyState()) { + if (this.verifyState()) { return false } if (this.data.detailObj.userDislike || this.data.detailObj.userLike) { @@ -459,24 +495,39 @@ Page({ issueId: this.data.detailType === 'issue' ? this.data.issueId : '', itemId: this.data.detailType === 'project' ? this.data.projectId : '' } - showIssueStatement(para).then(res => { - console.log('点赞议题或项目', res) - }).catch(err => { - console.log(err) - }) + + // showIssueStatement(para).then(res => { + // console.log('点赞议题或项目', res) + // }).catch(err => { + // console.log(err) + // }) + if (this.data.detailType == 'issue') { //议题 + issueSupport(para).then(res => { //v2新接口 2020.5.8 + console.log('点赞议题', res) + }).catch(err => { + console.log(err) + }) + } else { //项目 itemSupport, + itemSupport(para).then(res => { //v2新接口 2020.5.8 + console.log('点赞项目', res) + }).catch(err => { + console.log(err) + }) + } + }, - debounceDispportIssueOrProject () { + debounceDispportIssueOrProject() { clearTimeout(this.data.dispportTimer) this.data.dispportTimer = setTimeout(() => { this.dispportIssueOrProject() }, 300) }, // 点踩 议题活评论 - dispportIssueOrProject () { + dispportIssueOrProject() { if (this.verifyCompleteInfo()) { return false } - if(this.verifyState()) { + if (this.verifyState()) { return false } if (this.data.detailObj.userDislike || this.data.detailObj.userLike) { @@ -497,14 +548,29 @@ Page({ issueId: this.data.detailType === 'issue' ? this.data.issueId : '', itemId: this.data.detailType === 'project' ? this.data.projectId : '' } - showIssueStatement(para).then(res => { - console.log('点踩议题或项目', res) - }).catch(err => { - console.log(err) - }) + + // showIssueStatement(para).then(res => { + // console.log('点踩议题或项目', res) + // }).catch(err => { + // console.log(err) + // }) + if (this.data.detailType == 'issue') { //议题 + issueOpposition(para).then(res => { //v2新接口 2020.5.8 + console.log('点踩议题', res) + }).catch(err => { + console.log(err) + }) + } else { + itemOpposition(para).then(res => { //v2新接口 2020.5.8 + console.log('点踩项目', res) + }).catch(err => { + console.log(err) + }) + } + }, // 跳转到 分类列表 - navigateToCategoryList () { + navigateToCategoryList() { if (this.data.showClassify === 'show') { wx.navigateTo({ url: `/subpages/discussion/pages/categoryList/categoryList?type=${this.data.detailType}&categoryCode=${this.data.detailObj.firstCategoryCode}` @@ -512,14 +578,14 @@ Page({ } }, // 满意度评价 - publishEvaluation () { + publishEvaluation() { if (this.verifyCompleteInfo()) { return false } if (this.data.detailObj.itemState !== 10) { this.setData({ dialogConformText: '知道了', - dialogContent: ['项目未处理完毕或已关闭','不能进行评价!'], + dialogContent: ['项目未处理完毕或已关闭', '不能进行评价!'], dialogTitle: '满意度评价', dialogVisible: !this.data.dialogVisible }) @@ -530,11 +596,11 @@ Page({ }) }, // 检查 议题/项目的状态 - verifyState () { + verifyState() { if (this.data.detailType === 'issue' && !this.data.detailObj.operational) { this.setData({ dialogConformText: '知道了', - dialogContent: ['议题已关闭,不可再进行','评论/回复/支持/不支持等表达态度'], + dialogContent: ['议题已关闭,不可再进行', '评论/回复/支持/不支持等表达态度'], dialogTitle: '已关闭', dialogVisible: !this.data.dialogVisible }) @@ -543,7 +609,7 @@ Page({ if (this.data.detailObj.itemState === 5) { this.setData({ dialogConformText: '知道了', - dialogContent: ['项目已关闭,不可再进行','评论/回复/支持/不支持等表达态度'], + dialogContent: ['项目已关闭,不可再进行', '评论/回复/支持/不支持等表达态度'], dialogTitle: '已关闭', dialogVisible: !this.data.dialogVisible }) @@ -551,7 +617,7 @@ Page({ } else if (this.data.detailObj.itemState === 10) { this.setData({ dialogConformText: '知道了', - dialogContent: ['项目已结案,不可再进行','评论/回复/支持/不支持等表达态度'], + dialogContent: ['项目已结案,不可再进行', '评论/回复/支持/不支持等表达态度'], dialogTitle: '已结案', dialogVisible: !this.data.dialogVisible }) @@ -560,7 +626,7 @@ Page({ } }, // 检查 是否完善信息 - verifyCompleteInfo () { + verifyCompleteInfo() { if (this.data.infoCompleted == 0) { this.setData({ completeInfoDialogVisible: !this.data.completeInfoDialogVisible diff --git a/subpages/discussion/pages/remarkOrReply/remarkOrReply.js b/subpages/discussion/pages/remarkOrReply/remarkOrReply.js index 260a5d3..24587b2 100644 --- a/subpages/discussion/pages/remarkOrReply/remarkOrReply.js +++ b/subpages/discussion/pages/remarkOrReply/remarkOrReply.js @@ -1,4 +1,7 @@ -import { remarkOrReply } from '../../utils/api' +import { + // remarkOrReply, + issueCom, issueComReply, itemCom, itemComReply +} from '../../utils/api' Page({ data: { @@ -8,7 +11,7 @@ Page({ issueId: '', projectId: '' }, - onLoad (options) { + onLoad(options) { if (options.detailType === 'issue') { this.setData({ detailType: 'issue', @@ -23,16 +26,16 @@ Page({ }) } }, - onShow () { - + onShow() { + }, // textarea 双向绑定 - bindTextareaValue (e) { + bindTextareaValue(e) { this.setData({ textareaValue: e.detail.value }) }, - remarkOrReply () { + remarkOrReply() { if (!this.data.textareaValue) { wx.showToast({ title: '请输入回复内容', @@ -49,24 +52,109 @@ Page({ wx.showLoading({ title: '加载中...' }) - remarkOrReply(para).then(res => { - wx.hideLoading() - console.log('评论或回复', res) - wx.showToast({ - title: '评论成功', - icon: 'none', - duration: 1000 - }) - const pages = getCurrentPages() - const page = pages[pages.length - 2] - if (page.getRemarkList) { - page.getRemarkList() + if (this.data.faCommentId) { //评论 回复 回调 + if (this.data.detailType === 'issue') { //议题 + issueComReply(para).then(res => { + wx.hideLoading() + console.log('评论或回复', res) + wx.showToast({ + title: '评论成功', + icon: 'none', + duration: 1000 + }) + const pages = getCurrentPages() + const page = pages[pages.length - 2] + if (page.getRemarkList) { + page.getRemarkList() + } + setTimeout(() => { + wx.navigateBack() + }, 500) + }).catch(err => { + console.log(err) + }) + } else { //项目 + itemComReply(para).then(res => { + wx.hideLoading() + console.log('评论或回复', res) + wx.showToast({ + title: '评论成功', + icon: 'none', + duration: 1000 + }) + const pages = getCurrentPages() + const page = pages[pages.length - 2] + if (page.getRemarkList) { + page.getRemarkList() + } + setTimeout(() => { + wx.navigateBack() + }, 500) + }).catch(err => { + console.log(err) + }) } - setTimeout(() => { - wx.navigateBack() - }, 500) - }).catch(err => { - console.log(err) - }) + } else { //对 议题/项目 进行评论 + if (this.data.detailType === 'issue') { //议题 + issueCom(para).then(res => { + wx.hideLoading() + console.log('评论或回复', res) + wx.showToast({ + title: '评论成功', + icon: 'none', + duration: 1000 + }) + const pages = getCurrentPages() + const page = pages[pages.length - 2] + if (page.getRemarkList) { + page.getRemarkList() + } + setTimeout(() => { + wx.navigateBack() + }, 500) + }).catch(err => { + console.log(err) + }) + } else { //项目 + itemCom(para).then(res => { + wx.hideLoading() + console.log('评论或回复', res) + wx.showToast({ + title: '评论成功', + icon: 'none', + duration: 1000 + }) + const pages = getCurrentPages() + const page = pages[pages.length - 2] + if (page.getRemarkList) { + page.getRemarkList() + } + setTimeout(() => { + wx.navigateBack() + }, 500) + }).catch(err => { + console.log(err) + }) + } + } + // remarkOrReply(para).then(res => { + // wx.hideLoading() + // console.log('评论或回复', res) + // wx.showToast({ + // title: '评论成功', + // icon: 'none', + // duration: 1000 + // }) + // const pages = getCurrentPages() + // const page = pages[pages.length - 2] + // if (page.getRemarkList) { + // page.getRemarkList() + // } + // setTimeout(() => { + // wx.navigateBack() + // }, 500) + // }).catch(err => { + // console.log(err) + // }) } }) \ No newline at end of file diff --git a/subpages/discussion/utils/api.js b/subpages/discussion/utils/api.js index fe10a4d..20929ef 100644 --- a/subpages/discussion/utils/api.js +++ b/subpages/discussion/utils/api.js @@ -81,6 +81,74 @@ export function remarkOrReply ({ issueId, faCommentId, content, itemId }) { }) } +/** + * 话题评论 v2 + */ +export function topicCom({ issueId, faCommentId, content, itemId }) { + return request.post('group/comment/topicCom', { + issueId, + faCommentId, + content, + itemId + }) +} +/** + * 话题回复 v2 + */ +export function topicReply({ issueId, faCommentId, content, itemId }) { + return request.post('group/comment/topicReply', { + issueId, + faCommentId, + content, + itemId + }) +} +/** + * 议题评论 v2 + */ + +export function issueCom({ issueId, faCommentId, content, itemId }) { + return request.post('events/comment/issueCom', { + issueId, + faCommentId, + content, + itemId + }) +} +/** + * 议题评论的回复 v2 + */ +export function issueComReply({ issueId, faCommentId, content, itemId }) { + return request.post('events/comment/issueComReply', { + issueId, + faCommentId, + content, + itemId + }) +} + +/** + * 项目评论 v2 + */ +export function itemCom({ issueId, faCommentId, content, itemId }) { + return request.post('events/comment/itemCom', { + issueId, + faCommentId, + content, + itemId + }) +} +/** + * 项目评论的回复 v2 + */ +export function itemComReply({ issueId, faCommentId, content, itemId }) { + return request.post('events/comment/itemComReply', { + issueId, + faCommentId, + content, + itemId + }) +} /** * 表态 评论 支持/不支持 */ @@ -93,6 +161,56 @@ export function showRemarkStatement ({ attitude, commentId, issueId, itemId }) { }) } +/** + * 议题评论点赞 v2 + */ +export function issueComLike({ attitude, commentId, issueId, itemId }) { + return request.post('events/comment/issueComLike', { + attitude, + commentId, + issueId, + itemId + }) +} + +/** + * 议题评论点踩 v2 + */ +export function issueComUnlike({ attitude, commentId, issueId, itemId }) { + return request.post('events/comment/issueComUnlike', { + attitude, + commentId, + issueId, + itemId + }) +} + +/** + * 项目评论点赞 v2 + */ +export function itemComLike({ attitude, commentId, issueId, itemId }) { + return request.post('events/comment/itemComLike', { + attitude, + commentId, + issueId, + itemId + }) +} + +/** + * 项目评论点踩 v2 + */ +export function itemComUnlike({ attitude, commentId, issueId, itemId }) { + return request.post('events/comment/itemComUnlike', { + attitude, + commentId, + issueId, + itemId + }) +} + + + /** * 表态议题 支持/不支持 */ @@ -103,6 +221,53 @@ export function showIssueStatement ({ attitude, issueId, itemId }) { itemId }) } +/** + * 表态议题 v2接口 议题支持 + */ + +export function issueSupport({ attitude, issueId, itemId }) { + return request.post('events/issue/issueSupport', { + attitude, + issueId, + itemId + }) +} + +/** + * 表态议题 v2接口 议题反对 + */ +export function issueOpposition({ attitude, issueId, itemId }) { + return request.post('events/issue/issueOpposition', { + attitude, + issueId, + itemId + }) +} + +/** + * 项目支持 v2接口 + */ + +export function itemSupport({ attitude, issueId, itemId }) { + return request.post('events/issue/itemSupport', { + attitude, + issueId, + itemId + }) +} + +/** + * 项目反对 v2接口 + */ + +export function itemOpposition({ attitude, issueId, itemId }) { + return request.post('events/issue/itemOpposition', { + attitude, + issueId, + itemId + }) +} + /** * 获取 议题列表 diff --git a/subpages/home/pages/newsDetail/newsDetail.js b/subpages/home/pages/newsDetail/newsDetail.js index cdeea90..2747743 100644 --- a/subpages/home/pages/newsDetail/newsDetail.js +++ b/subpages/home/pages/newsDetail/newsDetail.js @@ -128,13 +128,27 @@ Page({ newsId: this.data.detailId, attitude: attitudeState } + + if (attitudeState == 0) {//表态 0赞;1踩;2取消赞;3取消踩 + api.newsSupport(para).then(res => { + + }).catch(err => { + console.log(err) + }) + }else{ + api.newsOpposition(para).then(res => { + + }).catch(err => { + console.log(err) + }) + } // const res = await newsPosition(para) // console.log('新闻表态', res) - api.newsPosition(para).then(res => { + // api.newsPosition(para).then(res => { - }).catch(err => { - console.log(err) - }) + // }).catch(err => { + // console.log(err) + // }) } } }) \ No newline at end of file diff --git a/utils/home.js b/utils/home.js index dcd041d..86bbf44 100644 --- a/utils/home.js +++ b/utils/home.js @@ -7,7 +7,9 @@ module.exports = { browseNews: browseNews, newsPosition: newsPosition, getInfoList: getInfoList, - infoDetail: infoDetail + infoDetail: infoDetail, + newsSupport: newsSupport, + newsOpposition: newsOpposition } function getNoticeList(param) { return fly.get('news/notice/list', param) @@ -27,9 +29,21 @@ function browseNotice(param) { function browseNews(param) { return fly.post('news/news/browse', param) } +// 新闻支持原接口 function newsPosition(param) { return fly.post('news/news/statement', param) } + +// 新闻支持 v2 +function newsSupport(param) { + return fly.post('news/news/newsSupport', param) +} + +// 新闻反对 v2 +function newsOpposition(param) { + return fly.post('news/news/newsOpposition', param) +} + function infoDetail(param) { return fly.post('news/information/read', param) }