diff --git a/models/topic.js b/models/topic.js
index f01061d..a1c55c1 100644
--- a/models/topic.js
+++ b/models/topic.js
@@ -6,6 +6,7 @@ const TopicBaseUrl = {
topic_goldenList_url:'/api/comment/goldenList', // 金点子列表
topic_detail_url:'/api/group/queryById/', // 议题详情
topic_detailComment_url:'/api/comment/page', // 评论列表
+ topic_addComment_url:'/api/comment/addComment',// 新建议题评论
topic_collect_url:'/api/group/collectGroup/', // 收藏
topic_unCollect_url: '/api/collect/deleteCollection/', // 取消收藏
topic_commentPraise_url: '/api/comment/addSupport/', // 点赞
@@ -89,11 +90,24 @@ class TopicModel extends HTTP {
}
this.request(params)
}
+ topicAddComment(comment,id,success){
+ let params = {
+ url: TopicBaseUrl.topic_addComment_url,
+ method: Method.POST,
+ data:{
+ comment: comment,
+ groupId:id,
+ },
+ success: success
+ }
+ this.request(params)
+ }
topicCommentPraise(id,success){
let params = {
url: TopicBaseUrl.topic_commentPraise_url + `${id}`,
method: Method.POST,
+ data:{},
success: success
}
this.request(params)
diff --git a/pages/topics/interactive/topicArticle/index.js b/pages/topics/interactive/topicArticle/index.js
index 8750720..0578daf 100644
--- a/pages/topics/interactive/topicArticle/index.js
+++ b/pages/topics/interactive/topicArticle/index.js
@@ -20,16 +20,17 @@ Page({
position:String,
detail: String,
imgArr:[],
- comments:[],
unStar: '/images/common/star.png',
star: '/images/common/star_light.png',
isStar:false,
topicId:String,
+ collectionId:String,
isCollect:Number,
currPage: 1,
commentList: [],
- unPraise: '/images/common/zan.png',
- praise: '/images/common/star_light.png'
+ praise: '/images/common/zan.png',
+ hiddenmodalput:true,
+ currentComment:'',
},
/**
@@ -60,6 +61,7 @@ Page({
let data = res.result
this.setData({
topicId: data.id,
+ collectionId: data.collectionId,
isCollect: data.isCollect,
title:data.title,
time: data.createTime,
@@ -82,9 +84,8 @@ Page({
let tempDatas = []
datas.forEach(item => {
tempDatas.push({
- isPraise: false,
id:item.id,
- userIcon: item.commentAvator,
+ commentAvator: item.commentAvator,
userName: item.username,
detail: item.comment,
time: item.createTime,
@@ -112,6 +113,7 @@ Page({
})
}
}
+ console.log(this.data.commentList)
wx.stopPullDownRefresh()
})
},
@@ -130,8 +132,8 @@ Page({
},
fetchTopicUnCollect(){
- let topicId = this.data.topicId
- topicModel.topicUnCollect(topicId, res => {
+ let collectionId = this.data.collectionId
+ topicModel.topicUnCollect(collectionId, res => {
console.log('取消收藏')
if (res.code === 200) {
this.fetchDetail()
@@ -170,19 +172,18 @@ Page({
const tempList = []
commentList.forEach( (item,index)=>{
if (sIndex === index){
- item.isPraise = !item.isPraise
+ this.fetchTopicCommentPraise(selectItem.id)
}
- tempList.push(item)
- })
- this.setData({
- commentList:tempList,
+ // tempList.push(item)
})
- this.fetchTopicCommentPraise(selectItem.id)
+ // this.setData({
+ // commentList:tempList,
+ // })
+ // this.fetchTopicCommentPraise(selectItem.id)
// 评论点赞
},
- onTapComment(){
- },
+ // 点击查看图片
previewImg: function (e) {
console.log(e.currentTarget.dataset.index);
var index = e.currentTarget.dataset.index;
@@ -194,5 +195,47 @@ Page({
fail: function (res) { },
complete: function (res) { },
})
+ },
+
+ // 点击评论
+ onTapComment(){
+ this.setData({
+ hiddenmodalput: !this.data.hiddenmodalput
+ })
+ },
+ // 弹出框 取消
+ cancel: function () {
+ this.setData({
+ hiddenmodalput: true,
+ currentComment: ''
+ });
+ },
+ // 弹出框 确认
+ confirm: function () {
+
+ if (!this.data.currentComment){
+ wx.showToast({
+ title: '请输入评论',
+ icon: 'none'
+ })
+ return
+ }
+ topicModel.topicAddComment(this.data.currentComment, this.data.topicId,res=>{
+ if(res.code === 200){
+ this.setData({
+ hiddenmodalput: true,
+ currentComment: ''
+ })
+ this.fetchDetailComment()
+ }
+ })
+ },
+
+ // 评论输入框
+ bingTextAreaInput(e){
+ console.log(e.detail.value)
+ this.setData({
+ currentComment: e.detail.value
+ })
}
})
\ No newline at end of file
diff --git a/pages/topics/interactive/topicArticle/index.wxml b/pages/topics/interactive/topicArticle/index.wxml
index 5bb3b96..7bec99d 100644
--- a/pages/topics/interactive/topicArticle/index.wxml
+++ b/pages/topics/interactive/topicArticle/index.wxml
@@ -40,13 +40,13 @@
+
+
+
\ No newline at end of file
diff --git a/pages/topics/interactive/topicArticle/index.wxss b/pages/topics/interactive/topicArticle/index.wxss
index 6b4b154..1244b8c 100644
--- a/pages/topics/interactive/topicArticle/index.wxss
+++ b/pages/topics/interactive/topicArticle/index.wxss
@@ -120,7 +120,6 @@ image{
width: 30px;
height: 30px;
border-radius: 50%;
- background-color: red;
}
.comment_icon{
width: 30px;
diff --git a/pages/user/index.js b/pages/user/index.js
index e765329..1bddeda 100644
--- a/pages/user/index.js
+++ b/pages/user/index.js
@@ -35,7 +35,6 @@ Page({
},
onShow: function () {
- console.log('啦啦啦')
this.getUserInfo()
if (store.hasPhone()) {
console.log('已经绑定手机号码')
@@ -141,10 +140,13 @@ Page({
onTapItem (e) {
const { type } = e.currentTarget.dataset
console.log(type)
- console.log(this.data.userInfo)
if (type === 'myInfo'){
+ // wx.navigateTo({
+ // url: `/pages/user/${type}/index?userIcon=${this.data.userInfo.avatarUrl}&userName=${this.data.userInfo.nickName}&userPhone=${this.data.userInfo.phone || ''}&company=${this.data.userInfo.company || ''}&position=${this.data.userInfo.position || ''}`,
+ // })
+ } else {
wx.navigateTo({
- url: `/pages/user/${type}/index?userIcon=${this.data.userInfo.avatarUrl}&userName=${this.data.userInfo.nickName}&userPhone=${this.data.userInfo.phone || ''}&company=${this.data.userInfo.company || ''}&position=${this.data.userInfo.position || ''}`,
+ url: `/pages/user/${type}/index`,
})
}
}
diff --git a/pages/user/myActivity/index.js b/pages/user/myActivity/index.js
index b2995a7..7a0e15f 100644
--- a/pages/user/myActivity/index.js
+++ b/pages/user/myActivity/index.js
@@ -24,7 +24,12 @@ Page({
let page = this.data.currentPage
userModel.getMyActivityList(page,res=>{
console.log(res)
-
+ if (res.result.list.length == 0) {
+ wx.showToast({
+ title: '暂无数据',
+ icon: 'none'
+ })
+ }
const datas = res.result.list
let tempDatas = []
datas.forEach(item => {
diff --git a/pages/user/myFavorite/index.js b/pages/user/myFavorite/index.js
index 1e36059..ea060a2 100644
--- a/pages/user/myFavorite/index.js
+++ b/pages/user/myFavorite/index.js
@@ -18,16 +18,22 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
+
+ },
+ onShow :function (){
this.fetchMyFavoriteList()
},
-
-
fetchMyFavoriteList () {
console.log('啦啦啦')
let page = this.data.currentPage
userModel.getMyFavoriteList(page, res => {
console.log(res)
-
+ if (res.result.list.length == 0) {
+ wx.showToast({
+ title: '暂无数据',
+ icon: 'none'
+ })
+ }
const datas = res.result.list
let tempDatas = []
datas.forEach(item => {
diff --git a/pages/user/myIdea/index.js b/pages/user/myIdea/index.js
index 825d0aa..5e96dbe 100644
--- a/pages/user/myIdea/index.js
+++ b/pages/user/myIdea/index.js
@@ -26,7 +26,12 @@ Page({
let page = this.data.currentPage
userModel.goldenList(page,res=>{
console.log(res)
-
+ if (res.result.list.length == 0) {
+ wx.showToast({
+ title: '暂无数据',
+ icon: 'none'
+ })
+ }
const datas = res.result.list
let tempDatas = []
datas.forEach(item => {
diff --git a/pages/user/myMessage/index.js b/pages/user/myMessage/index.js
index 59410fa..d93e0b5 100644
--- a/pages/user/myMessage/index.js
+++ b/pages/user/myMessage/index.js
@@ -27,7 +27,12 @@ Page({
userModel.getMyMessageList(page,res=>{
console.log('我的消息')
console.log(res)
-
+ if (res.result.list.length == 0){
+ wx.showToast({
+ title: '暂无数据',
+ icon: 'none'
+ })
+ }
const datas = res.result.list
let tempDatas = []
datas.forEach(item => {
diff --git a/pages/user/myTopics/index.js b/pages/user/myTopics/index.js
index dbb4380..e83b735 100644
--- a/pages/user/myTopics/index.js
+++ b/pages/user/myTopics/index.js
@@ -30,7 +30,12 @@ Page({
let page = this.data.currentPage
userModel.getMyTopics(page,this.data.selectedTitle+1,res=>{
console.log(res)
-
+ if (res.result.list.length == 0) {
+ wx.showToast({
+ title: '暂无数据',
+ icon: 'none'
+ })
+ }
const datas = res.result.list
let tempDatas = []
datas.forEach(item => {