Browse Source

v2接口部署

master
zhaoyongnian 5 years ago
parent
commit
535606bb38
  1. 7
      app.json
  2. 54
      subpages/association/pages/replyOrRemark/replyOrRemark.js
  3. 59
      subpages/association/pages/topicDetail/topicDetail.js
  4. 21
      subpages/association/utils/api.js
  5. 192
      subpages/discussion/pages/discussionDetail/discussionDetail.js
  6. 136
      subpages/discussion/pages/remarkOrReply/remarkOrReply.js
  7. 165
      subpages/discussion/utils/api.js
  8. 22
      subpages/home/pages/newsDetail/newsDetail.js
  9. 16
      utils/home.js

7
app.json

@ -71,6 +71,13 @@
"pages/inviteRecord/inviteRecord", "pages/inviteRecord/inviteRecord",
"pages/gridManage/gridManage" "pages/gridManage/gridManage"
] ]
},
{
"root": "subpages/integralCentre",
"name": "integralCentre",
"pages": [
"pages/index/index"
]
} }
], ],
"preloadRule": { "preloadRule": {

54
subpages/association/pages/replyOrRemark/replyOrRemark.js

@ -1,4 +1,7 @@
import { remarkOrReply } from '../../utils/api' import {
// remarkOrReply,
topicCom,
topicReply } from '../../utils/api'
Page({ Page({
data: { data: {
@ -44,17 +47,44 @@ Page({
wx.showLoading({ wx.showLoading({
title: '加载中' title: '加载中'
}) })
remarkOrReply(para).then(res => { if (faCommentId) {//对评论进行回复
wx.hideLoading() topicReply(para).then(res => {
console.log('评论或者回复', res) wx.hideLoading()
wx.showToast({ console.log('回复', res)
title: '评论成功', wx.showToast({
icon: 'none', title: '评论成功',
duration: 2000 icon: 'none',
duration: 2000
})
wx.navigateBack()
}).catch(err => {
console.log(err)
}) })
wx.navigateBack() }else{
}).catch(err => { topicCom(para).then(res => {
console.log(err) 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)
// })
} }
}) })

59
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' import { getTimestamp } from '../../utils/common'
const app = getApp() const app = getApp()
@ -292,10 +299,10 @@ Page({
} catch (err) { } catch (err) {
return false return false
} }
publishStatement(para).then(res => { topicComLike(para).then(res => {
this.getTopicAltitudeNum() this.getTopicAltitudeNum()
console.log('支持', res) console.log('支持', res)
this.data.remarkList.forEach((item,index) => { this.data.remarkList.forEach((item, index) => {
if (item.commentId === e.detail.commentId) { if (item.commentId === e.detail.commentId) {
this.setData({ this.setData({
[`remarkList[${index}].userLike`]: true, [`remarkList[${index}].userLike`]: true,
@ -313,6 +320,27 @@ Page({
}).catch(err => { }).catch(err => {
console.log(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 防抖 // 反对某条评论 debounce 防抖
debiunceDispportReply (e) { debiunceDispportReply (e) {
@ -362,7 +390,7 @@ Page({
} catch (err) { } catch (err) {
return false return false
} }
publishStatement(para).then(res => { topicComUnlike(para).then(res => {
this.getTopicAltitudeNum() this.getTopicAltitudeNum()
console.log('反对', res) console.log('反对', res)
this.data.remarkList.forEach((item, index) => { this.data.remarkList.forEach((item, index) => {
@ -370,7 +398,7 @@ Page({
this.setData({ this.setData({
[`remarkList[${index}].userLike`]: false, [`remarkList[${index}].userLike`]: false,
[`remarkList[${index}].userDislike`]: true, [`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 [`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) + 1
}) })
wx.showToast({ wx.showToast({
@ -383,6 +411,27 @@ Page({
}).catch(err => { }).catch(err => {
console.log(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) { replyRemark (e) {

21
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
})
}
/** /**
* 生成网格小程序码 * 生成网格小程序码
*/ */

192
subpages/discussion/pages/discussionDetail/discussionDetail.js

@ -2,14 +2,24 @@ import {
getIssueDetail, getIssueDetail,
getIssueTypeStatistics, getIssueTypeStatistics,
getRemarkList, getRemarkList,
showRemarkStatement, // showRemarkStatement,
showIssueStatement, issueComLike,
issueComUnlike,
itemComLike,
itemComUnlike,
// showIssueStatement,
issueSupport,
issueOpposition,
itemSupport,
itemOpposition,
getProjectDetail, getProjectDetail,
getProjectTypeStatistics, getProjectTypeStatistics,
getIssueHandleProgressV2, getIssueHandleProgressV2,
getProjectHandleProgressV2 getProjectHandleProgressV2
} from '../../utils/api' } from '../../utils/api'
import { formatTimestamp } from '../../utils/common' import {
formatTimestamp
} from '../../utils/common'
const app = getApp() const app = getApp()
Page({ Page({
data: { data: {
@ -68,7 +78,7 @@ Page({
infoCompleted: 0, // 当前用户是否完善信息 infoCompleted: 0, // 当前用户是否完善信息
showClassify: 'hide' // 是否显示 议题/项目分类列表 showClassify: 'hide' // 是否显示 议题/项目分类列表
}, },
onLoad (options) { onLoad(options) {
if (options.showClassify === 'show') { if (options.showClassify === 'show') {
this.setData({ this.setData({
showClassify: 'show' showClassify: 'show'
@ -85,7 +95,7 @@ Page({
}) })
this.getIssueHandleProgressV2(this.data.issueId).then(res => { this.getIssueHandleProgressV2(this.data.issueId).then(res => {
const handleProgressList = [] const handleProgressList = []
res.forEach((item,index) => { res.forEach((item, index) => {
if (index === res.length - 1) { if (index === res.length - 1) {
item.type = 'point' item.type = 'point'
item.isFirst = true item.isFirst = true
@ -119,7 +129,7 @@ Page({
console.log('项目和议题处理进展', res) console.log('项目和议题处理进展', res)
const issueList = [] const issueList = []
const projectList = [] const projectList = []
res[0].forEach((item,index) => { res[0].forEach((item, index) => {
if (index === res[0].length - 1) { if (index === res[0].length - 1) {
item.type = 'point' item.type = 'point'
item.isFirst = true item.isFirst = true
@ -149,13 +159,13 @@ Page({
}) })
}) })
this.getRemarkList() this.getRemarkList()
} }
this.setData({ this.setData({
infoCompleted: app.globalData.infoCompleted infoCompleted: app.globalData.infoCompleted
}) })
}, },
onReachBottom () { onReachBottom() {
this.setData({ this.setData({
loadMoreVisible: true loadMoreVisible: true
}) })
@ -167,7 +177,7 @@ Page({
} }
}, },
// 获取议题详情 // 获取议题详情
getIssueDetail () { getIssueDetail() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getIssueDetail(this.data.issueId).then(res => { getIssueDetail(this.data.issueId).then(res => {
console.log('议题详情', res) console.log('议题详情', res)
@ -186,7 +196,7 @@ Page({
}) })
}, },
// 获取项目详情 // 获取项目详情
getProjectDetail () { getProjectDetail() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getProjectDetail(this.data.projectId).then(res => { getProjectDetail(this.data.projectId).then(res => {
console.log('项目详情', res) console.log('项目详情', res)
@ -206,7 +216,7 @@ Page({
}) })
}, },
// 议题类别统计 // 议题类别统计
getIssueTypeStatistics (categoryCode) { getIssueTypeStatistics(categoryCode) {
getIssueTypeStatistics(categoryCode).then(res => { getIssueTypeStatistics(categoryCode).then(res => {
console.log('议题类别统计', res) console.log('议题类别统计', res)
const typeStatisticsObj = {} const typeStatisticsObj = {}
@ -221,7 +231,7 @@ Page({
}) })
}, },
// 项目类别统计 // 项目类别统计
getProjectTypeStatistics (categoryCode) { getProjectTypeStatistics(categoryCode) {
getProjectTypeStatistics(categoryCode).then(res => { getProjectTypeStatistics(categoryCode).then(res => {
console.log('项目类别统计', res) console.log('项目类别统计', res)
const typeStatisticsObj = {} const typeStatisticsObj = {}
@ -236,10 +246,10 @@ Page({
}) })
}, },
// 议题处理进展 v2 // 议题处理进展 v2
getIssueHandleProgressV2 (issueId) { getIssueHandleProgressV2(issueId) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getIssueHandleProgressV2(issueId).then(res => { getIssueHandleProgressV2(issueId).then(res => {
console.log('议题处理进度v2',res) console.log('议题处理进度v2', res)
resolve(res.data) resolve(res.data)
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
@ -248,7 +258,7 @@ Page({
}) })
}, },
// 项目处理进展 v2 // 项目处理进展 v2
getProjectHandleProgressV2 () { getProjectHandleProgressV2() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getProjectHandleProgressV2(this.data.projectId).then(res => { getProjectHandleProgressV2(this.data.projectId).then(res => {
console.log('项目处理进展', res) console.log('项目处理进展', res)
@ -260,7 +270,7 @@ Page({
}) })
}, },
// 最新最热 评论列表切换 // 最新最热 评论列表切换
changeRemarkType (e) { changeRemarkType(e) {
this.setData({ this.setData({
remarkType: e.detail.type, remarkType: e.detail.type,
loadMoreVisible: false loadMoreVisible: false
@ -268,7 +278,7 @@ Page({
this.getRemarkList() this.getRemarkList()
}, },
// 获取评论列表 下拉刷新 // 获取评论列表 下拉刷新
getRemarkList () { getRemarkList() {
this.setData({ this.setData({
timeStamp: formatTimestamp(), timeStamp: formatTimestamp(),
pageNo: 1, pageNo: 1,
@ -296,7 +306,7 @@ Page({
}) })
}, },
// 获取评论列表 上拉加载 // 获取评论列表 上拉加载
loadMoreGetRemarkList () { loadMoreGetRemarkList() {
const para = { const para = {
pageIndex: this.data.pageNo, pageIndex: this.data.pageNo,
pageSize: this.data.pageSize, pageSize: this.data.pageSize,
@ -310,7 +320,7 @@ Page({
this.setData({ this.setData({
remarkObj: { remarkObj: {
statementNum: res.data.statementNum, 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' loadMoreType: res.data.commentsList.length === 10 ? 'loading' : 'none'
}) })
@ -318,18 +328,18 @@ Page({
console.log(err) console.log(err)
}) })
}, },
debounceSupportRemark (e) { debounceSupportRemark(e) {
clearTimeout(this.data.supportTimer) clearTimeout(this.data.supportTimer)
this.data.supportTimer = setTimeout(() => { this.data.supportTimer = setTimeout(() => {
this.supportRemark(e) this.supportRemark(e)
}, 300) }, 300)
}, },
// 评论 支持 点赞 // 评论 支持 点赞
supportRemark (e) { supportRemark(e) {
if (this.verifyCompleteInfo()) { if (this.verifyCompleteInfo()) {
return false return false
} }
if(this.verifyState()) { if (this.verifyState()) {
return false return false
} }
const hasAttitude = this.data.remarkObj.commentsList.some(item => item.commentId === e.detail.commentId && (item.userLike || item.userDislike)) 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 : '', issueId: this.data.detailType === 'issue' ? this.data.issueId : '',
itemId: this.data.detailType === 'project' ? this.data.projectId : '' itemId: this.data.detailType === 'project' ? this.data.projectId : ''
} }
showRemarkStatement(para).then(res => { if (this.data.detailType == 'issue') { //议题
console.log('评论支持', res) issueComLike(para).then(res => {
}).catch(err => { console.log('评论支持', res)
console.log(err) }).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) clearTimeout(this.data.dispportTimer)
this.data.dispportTimer = setTimeout(() => { this.data.dispportTimer = setTimeout(() => {
this.dispportRemark(e) this.dispportRemark(e)
}, 300) }, 300)
}, },
// 评论 不支持 点踩 // 评论 不支持 点踩
dispportRemark (e) { dispportRemark(e) {
if (this.verifyCompleteInfo()) { if (this.verifyCompleteInfo()) {
return false return false
} }
if(this.verifyState()) { if (this.verifyState()) {
return false return false
} }
const hasAttitude = this.data.remarkObj.commentsList.some(item => item.commentId === e.detail.commentId && (item.userLike || item.userDislike)) 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 : '', issueId: this.data.detailType === 'issue' ? this.data.issueId : '',
itemId: this.data.detailType === 'project' ? this.data.projectId : '' itemId: this.data.detailType === 'project' ? this.data.projectId : ''
} }
showRemarkStatement(para).then(res => { if (this.data.detailType == 'issue') { //议题
console.log('评论不支持', res) issueComUnlike(para).then(res => {
}).catch(err => { console.log('评论不支持', res)
console.log(err) }).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()) { if (this.verifyCompleteInfo()) {
return false return false
} }
if(this.verifyState()) { if (this.verifyState()) {
return false return false
} }
wx.navigateTo({ wx.navigateTo({
@ -416,29 +452,29 @@ Page({
}) })
}, },
// 评论 回复 回调 // 评论 回复 回调
replyRemark (e) { replyRemark(e) {
if (this.verifyCompleteInfo()) { if (this.verifyCompleteInfo()) {
return false return false
} }
if(this.verifyState()) { if (this.verifyState()) {
return false return false
} }
wx.navigateTo({ wx.navigateTo({
url: `/subpages/discussion/pages/remarkOrReply/remarkOrReply?detailId=${this.data.detailId}&faCommentId=${e.detail.commentId}&detailType=${this.data.detailType}` url: `/subpages/discussion/pages/remarkOrReply/remarkOrReply?detailId=${this.data.detailId}&faCommentId=${e.detail.commentId}&detailType=${this.data.detailType}`
}) })
}, },
debounceSupportIssueOrProject () { debounceSupportIssueOrProject() {
clearTimeout(this.data.supportTimer) clearTimeout(this.data.supportTimer)
this.data.supportTimer = setTimeout(() => { this.data.supportTimer = setTimeout(() => {
this.supportIssueOrProject() this.supportIssueOrProject()
}, 300) }, 300)
}, },
// 点赞 议题或评论 // 点赞 议题或评论
supportIssueOrProject () { supportIssueOrProject() {
if (this.verifyCompleteInfo()) { if (this.verifyCompleteInfo()) {
return false return false
} }
if(this.verifyState()) { if (this.verifyState()) {
return false return false
} }
if (this.data.detailObj.userDislike || this.data.detailObj.userLike) { if (this.data.detailObj.userDislike || this.data.detailObj.userLike) {
@ -459,24 +495,39 @@ Page({
issueId: this.data.detailType === 'issue' ? this.data.issueId : '', issueId: this.data.detailType === 'issue' ? this.data.issueId : '',
itemId: this.data.detailType === 'project' ? this.data.projectId : '' itemId: this.data.detailType === 'project' ? this.data.projectId : ''
} }
showIssueStatement(para).then(res => {
console.log('点赞议题或项目', res) // showIssueStatement(para).then(res => {
}).catch(err => { // console.log('点赞议题或项目', res)
console.log(err) // }).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) clearTimeout(this.data.dispportTimer)
this.data.dispportTimer = setTimeout(() => { this.data.dispportTimer = setTimeout(() => {
this.dispportIssueOrProject() this.dispportIssueOrProject()
}, 300) }, 300)
}, },
// 点踩 议题活评论 // 点踩 议题活评论
dispportIssueOrProject () { dispportIssueOrProject() {
if (this.verifyCompleteInfo()) { if (this.verifyCompleteInfo()) {
return false return false
} }
if(this.verifyState()) { if (this.verifyState()) {
return false return false
} }
if (this.data.detailObj.userDislike || this.data.detailObj.userLike) { if (this.data.detailObj.userDislike || this.data.detailObj.userLike) {
@ -497,14 +548,29 @@ Page({
issueId: this.data.detailType === 'issue' ? this.data.issueId : '', issueId: this.data.detailType === 'issue' ? this.data.issueId : '',
itemId: this.data.detailType === 'project' ? this.data.projectId : '' itemId: this.data.detailType === 'project' ? this.data.projectId : ''
} }
showIssueStatement(para).then(res => {
console.log('点踩议题或项目', res) // showIssueStatement(para).then(res => {
}).catch(err => { // console.log('点踩议题或项目', res)
console.log(err) // }).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') { if (this.data.showClassify === 'show') {
wx.navigateTo({ wx.navigateTo({
url: `/subpages/discussion/pages/categoryList/categoryList?type=${this.data.detailType}&categoryCode=${this.data.detailObj.firstCategoryCode}` 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()) { if (this.verifyCompleteInfo()) {
return false return false
} }
if (this.data.detailObj.itemState !== 10) { if (this.data.detailObj.itemState !== 10) {
this.setData({ this.setData({
dialogConformText: '知道了', dialogConformText: '知道了',
dialogContent: ['项目未处理完毕或已关闭','不能进行评价!'], dialogContent: ['项目未处理完毕或已关闭', '不能进行评价!'],
dialogTitle: '满意度评价', dialogTitle: '满意度评价',
dialogVisible: !this.data.dialogVisible dialogVisible: !this.data.dialogVisible
}) })
@ -530,11 +596,11 @@ Page({
}) })
}, },
// 检查 议题/项目的状态 // 检查 议题/项目的状态
verifyState () { verifyState() {
if (this.data.detailType === 'issue' && !this.data.detailObj.operational) { if (this.data.detailType === 'issue' && !this.data.detailObj.operational) {
this.setData({ this.setData({
dialogConformText: '知道了', dialogConformText: '知道了',
dialogContent: ['议题已关闭,不可再进行','评论/回复/支持/不支持等表达态度'], dialogContent: ['议题已关闭,不可再进行', '评论/回复/支持/不支持等表达态度'],
dialogTitle: '已关闭', dialogTitle: '已关闭',
dialogVisible: !this.data.dialogVisible dialogVisible: !this.data.dialogVisible
}) })
@ -543,7 +609,7 @@ Page({
if (this.data.detailObj.itemState === 5) { if (this.data.detailObj.itemState === 5) {
this.setData({ this.setData({
dialogConformText: '知道了', dialogConformText: '知道了',
dialogContent: ['项目已关闭,不可再进行','评论/回复/支持/不支持等表达态度'], dialogContent: ['项目已关闭,不可再进行', '评论/回复/支持/不支持等表达态度'],
dialogTitle: '已关闭', dialogTitle: '已关闭',
dialogVisible: !this.data.dialogVisible dialogVisible: !this.data.dialogVisible
}) })
@ -551,7 +617,7 @@ Page({
} else if (this.data.detailObj.itemState === 10) { } else if (this.data.detailObj.itemState === 10) {
this.setData({ this.setData({
dialogConformText: '知道了', dialogConformText: '知道了',
dialogContent: ['项目已结案,不可再进行','评论/回复/支持/不支持等表达态度'], dialogContent: ['项目已结案,不可再进行', '评论/回复/支持/不支持等表达态度'],
dialogTitle: '已结案', dialogTitle: '已结案',
dialogVisible: !this.data.dialogVisible dialogVisible: !this.data.dialogVisible
}) })
@ -560,7 +626,7 @@ Page({
} }
}, },
// 检查 是否完善信息 // 检查 是否完善信息
verifyCompleteInfo () { verifyCompleteInfo() {
if (this.data.infoCompleted == 0) { if (this.data.infoCompleted == 0) {
this.setData({ this.setData({
completeInfoDialogVisible: !this.data.completeInfoDialogVisible completeInfoDialogVisible: !this.data.completeInfoDialogVisible

136
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({ Page({
data: { data: {
@ -8,7 +11,7 @@ Page({
issueId: '', issueId: '',
projectId: '' projectId: ''
}, },
onLoad (options) { onLoad(options) {
if (options.detailType === 'issue') { if (options.detailType === 'issue') {
this.setData({ this.setData({
detailType: 'issue', detailType: 'issue',
@ -23,16 +26,16 @@ Page({
}) })
} }
}, },
onShow () { onShow() {
}, },
// textarea 双向绑定 // textarea 双向绑定
bindTextareaValue (e) { bindTextareaValue(e) {
this.setData({ this.setData({
textareaValue: e.detail.value textareaValue: e.detail.value
}) })
}, },
remarkOrReply () { remarkOrReply() {
if (!this.data.textareaValue) { if (!this.data.textareaValue) {
wx.showToast({ wx.showToast({
title: '请输入回复内容', title: '请输入回复内容',
@ -49,24 +52,109 @@ Page({
wx.showLoading({ wx.showLoading({
title: '加载中...' title: '加载中...'
}) })
remarkOrReply(para).then(res => { if (this.data.faCommentId) { //评论 回复 回调
wx.hideLoading() if (this.data.detailType === 'issue') { //议题
console.log('评论或回复', res) issueComReply(para).then(res => {
wx.showToast({ wx.hideLoading()
title: '评论成功', console.log('评论或回复', res)
icon: 'none', wx.showToast({
duration: 1000 title: '评论成功',
}) icon: 'none',
const pages = getCurrentPages() duration: 1000
const page = pages[pages.length - 2] })
if (page.getRemarkList) { const pages = getCurrentPages()
page.getRemarkList() 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(() => { } else { //对 议题/项目 进行评论
wx.navigateBack() if (this.data.detailType === 'issue') { //议题
}, 500) issueCom(para).then(res => {
}).catch(err => { wx.hideLoading()
console.log(err) 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)
// })
} }
}) })

165
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 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
})
}
/** /**
* 获取 议题列表 * 获取 议题列表

22
subpages/home/pages/newsDetail/newsDetail.js

@ -128,13 +128,27 @@ Page({
newsId: this.data.detailId, newsId: this.data.detailId,
attitude: attitudeState 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) // const res = await newsPosition(para)
// console.log('新闻表态', res) // console.log('新闻表态', res)
api.newsPosition(para).then(res => { // api.newsPosition(para).then(res => {
}).catch(err => { // }).catch(err => {
console.log(err) // console.log(err)
}) // })
} }
} }
}) })

16
utils/home.js

@ -7,7 +7,9 @@ module.exports = {
browseNews: browseNews, browseNews: browseNews,
newsPosition: newsPosition, newsPosition: newsPosition,
getInfoList: getInfoList, getInfoList: getInfoList,
infoDetail: infoDetail infoDetail: infoDetail,
newsSupport: newsSupport,
newsOpposition: newsOpposition
} }
function getNoticeList(param) { function getNoticeList(param) {
return fly.get('news/notice/list', param) return fly.get('news/notice/list', param)
@ -27,9 +29,21 @@ function browseNotice(param) {
function browseNews(param) { function browseNews(param) {
return fly.post('news/news/browse', param) return fly.post('news/news/browse', param)
} }
// 新闻支持原接口
function newsPosition(param) { function newsPosition(param) {
return fly.post('news/news/statement', 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) { function infoDetail(param) {
return fly.post('news/information/read', param) return fly.post('news/information/read', param)
} }

Loading…
Cancel
Save