diff --git a/models/topic.js b/models/topic.js index b53fd93..87e6835 100644 --- a/models/topic.js +++ b/models/topic.js @@ -1,13 +1,15 @@ import {HTTP, Method} from '../utils/http.js' const TopicBaseUrl = { - topic_list_url:'/api/group/page', - topic_goldenList_url:'/api/comment/goldenList', - topic_detail_url:'/api/group/queryById/', - topic_detailComment_url:'/api/comment/page', - topic_collect:'/api/group/collectGroup/', - topic_commentPraise_url: '/api/comment/addSupport/', - // topic_commentUnPraise_url: '/api/comment/deleteComment/{id}', + topic_list_url:'/api/group/page', // 议题列表 + topic_addGroup_url:'/api/group/addGroup', // 新建议题 + topic_goldenList_url:'/api/comment/goldenList', // 金点子列表 + topic_detail_url:'/api/group/queryById/', // 议题详情 + topic_detailComment_url:'/api/comment/page', // 评论列表 + topic_collect_url:'/api/group/collectGroup/', // 收藏 + topic_unCollect_url: '/api/collect/deleteCollection/', // 取消收藏 + topic_commentPraise_url: '/api/comment/addSupport/', // 点赞 + topic_addMessage_url:'/api/message/addMessage' // 留言箱 } class TopicModel extends HTTP { @@ -28,6 +30,21 @@ class TopicModel extends HTTP { this.request(params) } + // 新建议题 + topicAddGroup(){ + let params = { + url: TopicBaseUrl.topic_list_url, + method: Method.POST, + data: { + page: page, + pageSize: 10, + }, + success: success + } + this.request(params) + } + + getTopicDetail(id, success){ let params = { url: TopicBaseUrl.topic_detail_url+`${id}`, @@ -53,7 +70,16 @@ class TopicModel extends HTTP { topicCollect(id,success){ let params = { - url: TopicBaseUrl.topic_collect + `${id}`, + url: TopicBaseUrl.topic_collect_url + `${id}`, + method: Method.POST, + success: success + } + this.request(params) + } + + topicUnCollect(id, success){ + let params = { + url: TopicBaseUrl.topic_unCollect_url + `${id}`, method: Method.POST, success: success } @@ -75,7 +101,7 @@ class TopicModel extends HTTP { url: TopicBaseUrl.topic_goldenList_url, method: Method.POST, data: { - type:1, + type:1, // 1.全部 2.我的金点子 page: page, pageSize: 10, }, @@ -84,8 +110,17 @@ class TopicModel extends HTTP { this.request(params) } - - + addMessage(content,success){ + let params = { + url: TopicBaseUrl.topic_addMessage_url, + method: Method.POST, + data: { + content: content + }, + success: success + } + this.request(params) + } } diff --git a/models/user.js b/models/user.js index a4177a0..182887d 100644 --- a/models/user.js +++ b/models/user.js @@ -1,11 +1,97 @@ -import {HTTP} from '../utils/http.js' +import { HTTP, Method} from '../utils/http.js' const UserConst = { user_info: '', // 个人信息 + user_myMessage_url:'/api/message/page', // 我的消息 + user_myFavorite_url: '/api/collect/collectionList', // 我的收藏 + user_goldenList_url: '/api/comment/goldenList', // 我的金点子 + user_myTopics_url:'/api/group/groupByUser', // 我的议题 + user_myActivity_url:'/api/activity/activityList' // 我的活动 } class UserModel extends HTTP { constructor () { super() } + + getMyMessageList(page, success){ + let params = { + url: UserConst.user_myMessage_url, + method: Method.POST, + data: { + page: page, + pageSize: 10, + }, + success: success + } + this.request(params) + } + + getMyMessageTotal(success) { + let params = { + url: UserConst.user_myTopics_url, + method: Method.POST, + data:{ + page:1, + pageSize:10, + }, + success: success + } + this.request(params) + } + + getMyTopics(page,type,success){ + let params = { + url: UserConst.user_myTopics_url, + method: Method.POST, + data: { + page: page, + type: type, + pageSize: 10, + }, + success: success + } + this.request(params) + } + + + getMyFavoriteList(page, success) { + let params = { + url: UserConst.user_myFavorite_url, + method: Method.POST, + data: { + page: page, + pageSize: 10, + }, + success: success + } + this.request(params) + } + + goldenList(page, success) { + let params = { + url: UserConst.user_goldenList_url, + method: Method.POST, + data: { + type: 2, // 1.全部 2.我的金点子 + page: page, + pageSize: 10, + }, + success: success + } + this.request(params) + } + + getMyActivityList(page, success) { + let params = { + url: UserConst.user_myActivity_url, + method: Method.POST, + data: { + page: page, + pageSize: 10, + }, + success: success + } + this.request(params) + } } export { UserModel } \ No newline at end of file diff --git a/pages/topics/goodIdea/cell/index.js b/pages/topics/goodIdea/cell/index.js index 8df8667..5145172 100644 --- a/pages/topics/goodIdea/cell/index.js +++ b/pages/topics/goodIdea/cell/index.js @@ -1,17 +1,23 @@ // pages/topics/common/goodIdea/cell/index.js +import { TopicModel } from '../../../../models/topic.js' +let topicModel = new TopicModel() + Component({ /** * 组件的属性列表 */ properties: { - itemData:Object + itemData:Object, + itemIndex:Number }, /** * 组件的初始数据 */ data: { - + unPraise: '/images/common/zan.png', + praise: '/images/common/star_light.png', + currentPage:1 }, /** @@ -20,6 +26,29 @@ Component({ methods: { onTap() { this.triggerEvent('clickListItem', { itemData: this.properties.itemData }) + }, + onClickPraise(e) { + const sIndex = e.currentTarget.dataset.index + // var selectItem = e.currentTarget.dataset.item + // var isPraise = "itemData.isPraise" + // this.setData({ + // [isPraise]:!isPraise + // }) + + this.triggerEvent('tapGoodIdeaPraise', {index:sIndex}) + // const commentList = this.data.commentList + // const tempList = [] + // commentList.forEach((item, index) => { + // if (sIndex === index) { + // item.isPraise = !item.isPraise + // } + // tempList.push(item) + // }) + // this.setData({ + // commentList: tempList, + // }) + // this.fetchGoodIdeaPraise(selectItem.id) + // 评论点赞 } } }) diff --git a/pages/topics/goodIdea/cell/index.wxml b/pages/topics/goodIdea/cell/index.wxml index 426de48..fc576cc 100644 --- a/pages/topics/goodIdea/cell/index.wxml +++ b/pages/topics/goodIdea/cell/index.wxml @@ -12,10 +12,10 @@ - + {{itemData.praiseNum}} - + diff --git a/pages/topics/goodIdea/index.js b/pages/topics/goodIdea/index.js index fa94499..35d4e66 100644 --- a/pages/topics/goodIdea/index.js +++ b/pages/topics/goodIdea/index.js @@ -57,6 +57,10 @@ Component({ clickListItem(e){ const itemData = e.detail.itemData; console.log(itemData); + }, + tapGoodIdeaPraise(e) { + console.log('华加快速度') + console.log(e) } } }) diff --git a/pages/topics/goodIdea/index.wxml b/pages/topics/goodIdea/index.wxml index 4c9e515..7f3f5d7 100644 --- a/pages/topics/goodIdea/index.wxml +++ b/pages/topics/goodIdea/index.wxml @@ -3,6 +3,7 @@ diff --git a/pages/topics/index.js b/pages/topics/index.js index f6e776d..794a7a5 100644 --- a/pages/topics/index.js +++ b/pages/topics/index.js @@ -67,7 +67,9 @@ Page({ wx.stopPullDownRefresh() }) }, - + onRefreshList(){ + this.fetchGoodIdeaList() + }, fetchGoodIdeaList(){ let page = this.data.currPage topicModel.goldenList(page, res => { @@ -85,6 +87,7 @@ Page({ time: item.createTime, comment: item.comment, praiseNum: item.supportNum, + isPraise: false, detail:{ userIcon: item.groupAvator, userName: item.author, @@ -201,5 +204,10 @@ Page({ case 1: return this.fetchGoodIdeaList() } - } + }, + + // tapGoodIdeaPraise(e){ + // console.log('华加快速度') + // console.log(e) + // } }) \ No newline at end of file diff --git a/pages/topics/interactive/cell/index.wxml b/pages/topics/interactive/cell/index.wxml index 39e2700..f398cc7 100644 --- a/pages/topics/interactive/cell/index.wxml +++ b/pages/topics/interactive/cell/index.wxml @@ -1,5 +1,5 @@ - + {{title}} diff --git a/pages/topics/interactive/submitTopic/index.js b/pages/topics/interactive/submitTopic/index.js index 0d85e75..14c1c2c 100644 --- a/pages/topics/interactive/submitTopic/index.js +++ b/pages/topics/interactive/submitTopic/index.js @@ -76,7 +76,7 @@ Page({ onShareAppMessage: function () { }, - chooseImage: function (e) { + upload: function (e) { console.log(e) var that = this; wx.chooseImage({ @@ -90,13 +90,29 @@ Page({ } }) }, - previewImage: function (e) { - console.log(e) - wx.previewImage({ - current: e.currentTarget.id, // 当前显示图片的http链接 - urls: this.data.files // 需要预览的图片http链接列表 - }) - }, + chooseImage: function (e) { + console.log('啦啦啦') + // console.log(e) + // var that = this; + // wx.chooseImage({ + // sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + // sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + // success: function (res) { + // console.log('啦啦啦') + // // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 + // that.setData({ + // files: res.tempFilePaths + // }); + // } + // }) + }, + // previewImage: function (e) { + // console.log(e) + // wx.previewImage({ + // current: e.currentTarget.id, // 当前显示图片的http链接 + // urls: this.data.files // 需要预览的图片http链接列表 + // }) + // }, uploadError(e) { console.log('upload error', e.detail) }, diff --git a/pages/topics/interactive/submitTopic/index.wxml b/pages/topics/interactive/submitTopic/index.wxml index 7058635..1d9011e 100644 --- a/pages/topics/interactive/submitTopic/index.wxml +++ b/pages/topics/interactive/submitTopic/index.wxml @@ -1,8 +1,8 @@ - + -