Browse Source

v2接口部署

master
zhaoyongnian 5 years ago
parent
commit
535606bb38
  1. 7
      app.json
  2. 36
      subpages/association/pages/replyOrRemark/replyOrRemark.js
  3. 55
      subpages/association/pages/topicDetail/topicDetail.js
  4. 21
      subpages/association/utils/api.js
  5. 84
      subpages/discussion/pages/discussionDetail/discussionDetail.js
  6. 92
      subpages/discussion/pages/remarkOrReply/remarkOrReply.js
  7. 165
      subpages/discussion/utils/api.js
  8. 20
      subpages/home/pages/newsDetail/newsDetail.js
  9. 16
      utils/home.js

7
app.json

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

36
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,9 +47,10 @@ Page({
wx.showLoading({
title: '加载中'
})
remarkOrReply(para).then(res => {
if (faCommentId) {//对评论进行回复
topicReply(para).then(res => {
wx.hideLoading()
console.log('评论或者回复', res)
console.log('回复', res)
wx.showToast({
title: '评论成功',
icon: 'none',
@ -56,5 +60,31 @@ Page({
}).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)
// })
}
})

55
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,7 +299,7 @@ Page({
} catch (err) {
return false
}
publishStatement(para).then(res => {
topicComLike(para).then(res => {
this.getTopicAltitudeNum()
console.log('支持', res)
this.data.remarkList.forEach((item, index) => {
@ -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) => {
@ -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) {

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

84
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: {
@ -354,11 +364,24 @@ Page({
issueId: this.data.detailType === 'issue' ? this.data.issueId : '',
itemId: this.data.detailType === 'project' ? this.data.projectId : ''
}
showRemarkStatement(para).then(res => {
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) {
clearTimeout(this.data.dispportTimer)
@ -397,11 +420,24 @@ Page({
issueId: this.data.detailType === 'issue' ? this.data.issueId : '',
itemId: this.data.detailType === 'project' ? this.data.projectId : ''
}
showRemarkStatement(para).then(res => {
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() {
@ -459,11 +495,26 @@ Page({
issueId: this.data.detailType === 'issue' ? this.data.issueId : '',
itemId: this.data.detailType === 'project' ? this.data.projectId : ''
}
showIssueStatement(para).then(res => {
console.log('点赞议题或项目', res)
// 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() {
clearTimeout(this.data.dispportTimer)
@ -497,11 +548,26 @@ Page({
issueId: this.data.detailType === 'issue' ? this.data.issueId : '',
itemId: this.data.detailType === 'project' ? this.data.projectId : ''
}
showIssueStatement(para).then(res => {
console.log('点踩议题或项目', res)
// 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() {

92
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: {
@ -49,7 +52,9 @@ Page({
wx.showLoading({
title: '加载中...'
})
remarkOrReply(para).then(res => {
if (this.data.faCommentId) { //评论 回复 回调
if (this.data.detailType === 'issue') { //议题
issueComReply(para).then(res => {
wx.hideLoading()
console.log('评论或回复', res)
wx.showToast({
@ -68,5 +73,88 @@ Page({
}).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)
})
}
} 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)
// })
}
})

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

20
subpages/home/pages/newsDetail/newsDetail.js

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

16
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)
}

Loading…
Cancel
Save