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 @@
-
+
-
+
diff --git a/pages/topics/interactive/topicArticle/index.js b/pages/topics/interactive/topicArticle/index.js
index 4604a1f..d25c4fa 100644
--- a/pages/topics/interactive/topicArticle/index.js
+++ b/pages/topics/interactive/topicArticle/index.js
@@ -46,13 +46,14 @@ Page({
unStar: '/images/common/star.png',
star: '/images/common/star_light.png',
- isStar:true,
+ isStar:false,
topicId:String,
+ collectionId:String,
+ isCollect:Number,
currPage: 1,
commentList: [],
unPraise: '/images/common/zan.png',
- praise: '/images/common/star_light.png',
- commentId:String
+ praise: '/images/common/star_light.png'
},
/**
@@ -126,6 +127,8 @@ Page({
console.log(res)
let data = res.result
this.setData({
+ collectionId: data.collectionId,
+ isCollect: data.isCollect,
title:data.title,
time: data.createTime,
userInfo:{
@@ -191,6 +194,7 @@ Page({
console.log('收藏')
console.log(res)
if(res.code === 200){
+ this.fetchDetail()
wx.showToast({
title: '收藏成功',
icon: 'none'
@@ -198,23 +202,39 @@ Page({
}
})
},
- fetchTopicCommentPraise(){
- let commentId = this.data.commnetId
+
+ fetchTopicUnCollect(){
+ let collectionId = this.data.collectionId
+ topicModel.topicUnCollect(collectionId, res => {
+ console.log('取消收藏')
+ console.log(res)
+ if (res.code === 200) {
+ this.fetchDetail()
+ wx.showToast({
+ title: '取消收藏',
+ icon: 'none'
+ })
+ }
+ })
+ },
+
+ fetchTopicCommentPraise(commentId){
topicModel.topicCommentPraise(commentId,res =>{
console.log(res)
if (res.code === 200) {
wx.showToast({
- title: '点赞',
+ title: res.message,
icon: 'none'
})
+ this.fetchDetailComment()
}
})
},
onClickCollect() {
this.setData({
- isStar: !this.data.isStar
+ isCollect: !this.data.isCollect
})
- this.fetchTopicCollect()
+ this.data.isCollect === true ? this.fetchTopicCollect() : this.fetchTopicUnCollect()
// 收藏功能
},
@@ -232,9 +252,8 @@ Page({
})
this.setData({
commentList:tempList,
- commentId: selectItem.id
})
- this.fetchTopicCommentPraise()
+ this.fetchTopicCommentPraise(selectItem.id)
// 评论点赞
},
previewImg: function (e) {
diff --git a/pages/topics/interactive/topicArticle/index.wxml b/pages/topics/interactive/topicArticle/index.wxml
index 8b40463..532349b 100644
--- a/pages/topics/interactive/topicArticle/index.wxml
+++ b/pages/topics/interactive/topicArticle/index.wxml
@@ -9,7 +9,7 @@
{{time}}
-
+
diff --git a/pages/topics/message/index.js b/pages/topics/message/index.js
index e39de63..601e847 100644
--- a/pages/topics/message/index.js
+++ b/pages/topics/message/index.js
@@ -1,4 +1,7 @@
// pages/topics/common/message/index.js
+import { TopicModel } from '../../../models/topic.js'
+let topicModel = new TopicModel()
+
Component({
/**
* 组件的属性列表
@@ -8,7 +11,7 @@ Component({
},
/**
- * 组件的初始数据
+ * 组件的初始数据
*/
data: {
textAreaString:""
@@ -24,7 +27,29 @@ Component({
})
},
submit() {
- console.log(this.data.textAreaString)
+ if (this.data.textAreaString === ''){
+ wx.showModal({
+ title: '提示',
+ content: '请输入留言内容',
+ showCancel:false
+ })
+ return
+ }
+
+ topicModel.addMessage(this.data.textAreaString,res=>{
+ console.log(res)
+ if(res.code === 200){
+ this.setData({
+ textAreaString: ''
+ })
+
+ wx.showToast({
+ title: res.message,
+ icon: 'success'
+ })
+ }
+ })
+
}
}
})
diff --git a/pages/topics/message/index.wxml b/pages/topics/message/index.wxml
index 73a8c5e..cfa48c3 100644
--- a/pages/topics/message/index.wxml
+++ b/pages/topics/message/index.wxml
@@ -2,7 +2,7 @@
-
+
diff --git a/pages/user/index.js b/pages/user/index.js
index 8866310..69b53c9 100644
--- a/pages/user/index.js
+++ b/pages/user/index.js
@@ -1,25 +1,41 @@
// pages/user/index.js
+import dayjs from '../../utils/dayjs/index.js'
+import relativeTime from '../../utils/dayjs/relativeTime.js'
+dayjs.extend(relativeTime);
+import { UserModel } from '../../models/user.js'
+let userModel = new UserModel()
+
Page({
/**
* 页面的初始数据
*/
data: {
-
+ messageTotal: Number
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ this.getMsgStatus()
+ },
+ getMsgStatus(){
+ userModel.getMyMessageTotal(res=>{
+ console.log(res.result.total)
+ this.setData({
+ messageTotal: Number(res.result.total)
+ })
+ })
},
onTapItem (e) {
const {type} = e.currentTarget.dataset
console.log(type)
- wx.navigateTo({
- url: `/pages/user/${type}/index`,
- })
+ if(type != 'myInfo'){
+ wx.navigateTo({
+ url: `/pages/user/${type}/index`,
+ })
+ }
},
/**
* 生命周期函数--监听页面初次渲染完成
diff --git a/pages/user/index.wxml b/pages/user/index.wxml
index 1dbd621..66ced3a 100644
--- a/pages/user/index.wxml
+++ b/pages/user/index.wxml
@@ -3,8 +3,10 @@
-
- 啦啦啦拉两岸啦啦啦啦啦靓阿拉啦啦啦
+
+
+
+
@@ -16,7 +18,7 @@
title="我的消息"
link="true"
ext-class="cell-item">
-
+
+
+
+
+ {{title}}
+
+
+
+
+ {{userName}}
+ {{time}}
+
+
+
+
+
+
+
diff --git a/pages/user/myActivity/cell/index.wxss b/pages/user/myActivity/cell/index.wxss
new file mode 100644
index 0000000..3ad58a0
--- /dev/null
+++ b/pages/user/myActivity/cell/index.wxss
@@ -0,0 +1,106 @@
+/* pages/topics/common/interactive/common/imageCell/index.wxss */
+.cell {
+
+ display: flex;
+ flex-direction: row;
+ padding: 10px 20px;
+ box-sizing: border-box;
+ align-items: center;
+ position: relative;
+}
+.cell:after {
+ content: "";
+ position: absolute;
+ bottom: 1px;
+ left: 20px;
+ right: 20px;
+ border-bottom: 1px solid #E7E7E7;
+}
+.left{
+ display: flex;
+ flex-direction: column;
+ width: 70%;
+}
+.leftActive{
+ display: flex;
+ flex-direction: column;
+ width: 100%;
+}
+.left-bottom{
+ display: flex;
+ flex: row;
+ justify-content: space-between;
+}
+.left-bottom-userInfo{
+ display: flex;
+ flex: row;
+ align-items: center;
+}
+.user-icon{
+ width: 20px;
+ height: 20px;
+ border-radius: 50%;
+ background-color: #EEEEEE;
+}
+.userName{
+ margin: 0 5px 0 0;
+ font-size: 12px;
+ color: #3B3B3B;
+}
+.left-bottom-comments{
+ display: flex;
+ flex: row;
+ align-items: center;
+ margin-right: 10px;
+}
+.comments-icon{
+ width: 15px;
+ height: 12px;
+ line-height: 10px;
+ margin-right: 5px;
+}
+.image_icon {
+ width: 100%;
+ height: 100%;
+}
+.commentNum{
+ font-size: 12px;
+ color: #3B3B3B;
+}
+.right{
+ width: 30%;
+ height: 70px;
+ border-radius: 5px;
+ background-color: #EEEEEE;
+}
+image{
+ width: 100%;
+ height: 100%;
+}
+.articleImg{
+ width: 100%;
+ height: 100%;
+ border-radius: 5px;
+}
+.cell_title {
+ font-weight: 300;
+ font-size: 17px;
+ color: #000;
+}
+.cell_title_selected {
+ color: #9C9C9C;
+}
+.cell_info_meta {
+ padding-top: 10rpx;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ font-size: 12px;
+ line-height: 12px;
+ color: #D4D4D4;
+}
+.cell_info_top {
+ padding: 0 10px;
+ width: 20px;
+ height: 12px;
+}
\ No newline at end of file
diff --git a/pages/user/myActivity/index.js b/pages/user/myActivity/index.js
index 5a50b6d..2739c5b 100644
--- a/pages/user/myActivity/index.js
+++ b/pages/user/myActivity/index.js
@@ -1,4 +1,8 @@
// pages/user/common/myActivity/index.js
+import { UserModel } from '../../../models/user.js'
+let userModel = new UserModel()
+
+
Page({
/**
@@ -10,39 +14,75 @@ Page({
articleId: '1',
title: "市北区举行国际航运贸易金融创新中心核心区产业建设",
articleImg: "asdsad",
- userIcon: "",
userName: "用户名",
time: "刚刚",
- commentNum: "33",
},
{
articleId: "2",
title: "《大众日报》市北区举行国际航运贸易金融创新中心核心区产业建设",
articleImg: "",
- userIcon: "",
userName: "用户名",
- time: "1分钟前",
- commentNum: "33",
+ time: "1分钟前"
},
{
articleId: "3",
title: "青岛医疗人工智能科技创新中心落户市北",
articleImg: "asdsadad",
- userIcon: "",
userName: "用户名",
- time: "1分钟前",
- commentNum: "33",
+ time: "1分钟前"
}
- ]
+ ],
+ currentPage:1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ this.fetchDataList()
},
+ fetchDataList(){
+ let page = this.data.currentPage
+ userModel.getMyActivityList(page,res=>{
+ console.log(res)
+
+ const datas = res.result.list
+ let tempDatas = []
+ datas.forEach(item => {
+ tempDatas.push({
+ articleId: item.collectionId,
+ title: item.title,
+ articleImg: item.image,
+ userName: item.author,
+ time: item.createTime
+ })
+ })
+ if (page == 1) {
+ this.setData({
+ list: tempDatas
+ })
+ } else {
+ if (tempDatas.length > 0) {
+ const list = [...this.data.list, ...tempDatas]
+ this.setData({
+ list: list
+ })
+ } else {
+ const page = this.data.currPage - 1
+ this.setData({
+ currPage: page
+ })
+ wx.showToast({
+ title: '已加载全部',
+ icon: 'none'
+ })
+ }
+ }
+ console.log(this.data.list)
+ wx.stopPullDownRefresh()
+ })
+ },
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -75,14 +115,21 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+ this.setData({
+ currentPage:1
+ })
+ this.fetchDataList()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+ let page = this.data.currentPage+1
+ this.setData({
+ currentPage: page
+ })
+ this.fetchDataList()
},
/**
@@ -93,7 +140,11 @@ Page({
},
clickListItem(e) {
- const articleId = e.detail.articleId;
- console.log(articleId);
+ const item = e.detail.item;
+ console.log(item);
+ let id = item.articleId
+ wx.navigateTo({
+ url: `/pages/article/index?id=${id}`,
+ })
}
})
\ No newline at end of file
diff --git a/pages/user/myActivity/index.json b/pages/user/myActivity/index.json
index 87a053d..d12f789 100644
--- a/pages/user/myActivity/index.json
+++ b/pages/user/myActivity/index.json
@@ -1,6 +1,7 @@
{
+ "enablePullDownRefresh": true,
"navigationBarTitleText": "我的活动",
"usingComponents": {
- "cell": "../myTopics/myParticipant/cell/index"
+ "cell": "./cell/index"
}
}
\ No newline at end of file
diff --git a/pages/user/myActivity/index.wxml b/pages/user/myActivity/index.wxml
index cc7e607..289e5bd 100644
--- a/pages/user/myActivity/index.wxml
+++ b/pages/user/myActivity/index.wxml
@@ -1,6 +1,6 @@
-
+
{
+ console.log(res)
+
+ const datas = res.result.list
+ let tempDatas = []
+ datas.forEach(item => {
+ tempDatas.push({
+ topicId: item.collectionId,
+ title: item.title,
+ topicImg: item.image,
+ userIcon: item.groupAvator,
+ userName: item.author,
+ time: item.createTime,
+ commentNum: item.commentNum,
+ type:item.type
+ })
+ })
+ if (page == 1) {
+ this.setData({
+ list: tempDatas
+ })
+ } else {
+ if (tempDatas.length > 0) {
+ const list = [...this.data.list, ...tempDatas]
+ this.setData({
+ list: list
+ })
+ } else {
+ const page = this.data.currPage - 1
+ this.setData({
+ currPage: page
+ })
+ wx.showToast({
+ title: '已加载全部',
+ icon: 'none'
+ })
+ }
+ }
+ console.log(this.data.list)
+ wx.stopPullDownRefresh()
+ })
+ },
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -75,14 +127,21 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+ this.setData({
+ currPage: 1,
+ })
+ this.fetchMyFavoriteList()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+ let page = this.data.currentPage+1
+ this.setData({
+ currPage: page,
+ })
+ this.fetchMyFavoriteList()
},
/**
@@ -93,7 +152,17 @@ Page({
},
clickListItem(e) {
- const articleId = e.detail.articleId;
- console.log(articleId);
+ const item = e.detail.item;
+ console.log(item);
+ let id = item.topicId
+ if(item.type === '1'){
+ wx.navigateTo({
+ url: `/pages/article/index?id=${id}`,
+ })
+ }else {
+ wx.navigateTo({
+ url: `/pages/topics/interactive/topicArticle/index?topicId=${id}`,
+ })
+ }
}
})
\ No newline at end of file
diff --git a/pages/user/myFavorite/index.json b/pages/user/myFavorite/index.json
index c53089a..a8ea57f 100644
--- a/pages/user/myFavorite/index.json
+++ b/pages/user/myFavorite/index.json
@@ -1,4 +1,5 @@
{
+ "enablePullDownRefresh": true,
"navigationBarTitleText": "我的收藏",
"usingComponents": {
"cell": "../myTopics/myParticipant/cell/index"
diff --git a/pages/user/myFavorite/index.wxml b/pages/user/myFavorite/index.wxml
index b98ee7d..1e4391c 100644
--- a/pages/user/myFavorite/index.wxml
+++ b/pages/user/myFavorite/index.wxml
@@ -1,14 +1,15 @@
-
+
|
diff --git a/pages/user/myIdea/index.js b/pages/user/myIdea/index.js
index 6e3c39b..3d1c89e 100644
--- a/pages/user/myIdea/index.js
+++ b/pages/user/myIdea/index.js
@@ -1,4 +1,10 @@
// pages/user/common/myIdea/index.js
+import dayjs from '../../../utils/dayjs/index.js'
+import relativeTime from '../../../utils/dayjs/relativeTime.js'
+dayjs.extend(relativeTime);
+import { UserModel } from '../../../models/user.js'
+let userModel = new UserModel()
+
Page({
/**
@@ -38,16 +44,67 @@ Page({
text: "市北区位于青岛市主城区地理位置的中心,西部濒临胶州湾,东部与崂山区为邻,北部与李沧区接壤,南部与市南区毗连,东西最大距离11. 拷贝 2"
}
}
- ]
+ ],
+ currentPage: 1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ this.fetchMyIdeaList()
},
+ fetchMyIdeaList(){
+ let page = this.data.currentPage
+ userModel.goldenList(page,res=>{
+ console.log(res)
+
+ const datas = res.result.list
+ let tempDatas = []
+ datas.forEach(item => {
+ tempDatas.push({
+ ideaId: item.id,
+ userIcon: item.image,
+ groupId: item.groupId,
+ userName: item.username,
+ time: item.createTime,
+ comment: item.comment,
+ praiseNum: item.supportNum,
+ detail: {
+ userIcon: item.groupAvator,
+ userName: item.author,
+ commentNum: item.commentNum,
+ title: item.title,
+ text: item.content
+ }
+ })
+ })
+ if (page == 1) {
+ this.setData({
+ list: tempDatas
+ })
+ } else {
+ if (tempDatas.length > 0) {
+ const list = [...this.data.list, ...tempDatas]
+ this.setData({
+ list: list
+ })
+ } else {
+ const page = this.data.currPage - 1
+ this.setData({
+ currPage: page
+ })
+ wx.showToast({
+ title: '已加载全部',
+ icon: 'none'
+ })
+ }
+ }
+ console.log(this.data.list)
+ wx.stopPullDownRefresh()
+ })
+ },
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -80,14 +137,21 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+ this.setData({
+ currentPage:1
+ })
+ this.fetchMyIdeaList()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+ let page = this.data.currentPage+1
+ this.setData({
+ currentPage:page
+ })
+ this.fetchMyIdeaList()
},
/**
@@ -100,5 +164,8 @@ Page({
clickListItem(e) {
const itemData = e.detail.itemData;
console.log(itemData);
+ },
+ tapGoodIdeaPraise(e){
+ console.log(e)
}
})
\ No newline at end of file
diff --git a/pages/user/myIdea/index.json b/pages/user/myIdea/index.json
index 63df80b..2f60cec 100644
--- a/pages/user/myIdea/index.json
+++ b/pages/user/myIdea/index.json
@@ -1,4 +1,6 @@
+
{
+ "enablePullDownRefresh": true,
"navigationBarTitleText": "我的金点子",
"usingComponents": {
"cell": "../../topics/goodIdea/cell/index"
diff --git a/pages/user/myIdea/index.wxml b/pages/user/myIdea/index.wxml
index a433f1b..90493d2 100644
--- a/pages/user/myIdea/index.wxml
+++ b/pages/user/myIdea/index.wxml
@@ -1,6 +1,6 @@
-
+
|
diff --git a/pages/user/myMessage/cell/index.wxml b/pages/user/myMessage/cell/index.wxml
index d0d33ba..16127bf 100644
--- a/pages/user/myMessage/cell/index.wxml
+++ b/pages/user/myMessage/cell/index.wxml
@@ -1,9 +1,9 @@
-
+
-
+
-
+
diff --git a/pages/user/myMessage/index.js b/pages/user/myMessage/index.js
index ee3e3a0..ff9e6a9 100644
--- a/pages/user/myMessage/index.js
+++ b/pages/user/myMessage/index.js
@@ -1,4 +1,10 @@
// pages/user/common/myMessage/index.js
+import dayjs from '../../../utils/dayjs/index.js'
+import relativeTime from '../../../utils/dayjs/relativeTime.js'
+dayjs.extend(relativeTime);
+import { UserModel } from '../../../models/user.js'
+let userModel = new UserModel()
+
Page({
/**
@@ -24,14 +30,61 @@ Page({
title: "您的报名活动还有两天开始,查看详情",
time: "11:58"
}
- ]
+ ],
+ currentPage: 1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
+ this.fetchMyMessageList()
+ },
+
+ fetchMyMessageList(){
+ let page = this.data.currentPage
+ userModel.getMyMessageList(page,res=>{
+ console.log('我的消息')
+ console.log(res)
+
+ const datas = res.result.list
+ let tempDatas = []
+ datas.forEach(item => {
+ tempDatas.push({
+ contentId: item.contentId,
+ messageId:item.id,
+ title: item.content,
+ time: item.createTime,
+ messageStatus: item.messageStatus,
+ msgType: Number(item.messageType),
+ msgName: item.messageType === '1' ? '评论消息' : '活动消息'
+ })
+ })
+ if (page == 1) {
+ this.setData({
+ list: tempDatas
+ })
+ } else {
+ if (tempDatas.length > 0) {
+ const list = [...this.data.list, ...tempDatas]
+ this.setData({
+ list: list
+ })
+ } else {
+ const page = this.data.currPage - 1
+ this.setData({
+ currPage: page
+ })
+ wx.showToast({
+ title: '已加载全部',
+ icon: 'none'
+ })
+ }
+ }
+ console.log(this.data.list)
+ wx.stopPullDownRefresh()
+ })
},
/**
@@ -66,14 +119,21 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
-
+ this.setData({
+ currPage: 1,
+ })
+ this.fetchMyMessageList()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
-
+ const page = this.data.currPage + 1
+ this.setData({
+ currPage: page
+ })
+ this.fetchMyMessageList()
},
/**
diff --git a/pages/user/myMessage/index.json b/pages/user/myMessage/index.json
index f207f34..b253fc9 100644
--- a/pages/user/myMessage/index.json
+++ b/pages/user/myMessage/index.json
@@ -1,4 +1,5 @@
{
+ "enablePullDownRefresh": true,
"navigationBarTitleText": "我的消息",
"usingComponents": {
"cell": "./cell/index"
diff --git a/pages/user/myMessage/index.wxml b/pages/user/myMessage/index.wxml
index a02dbf8..dcb1d54 100644
--- a/pages/user/myMessage/index.wxml
+++ b/pages/user/myMessage/index.wxml
@@ -1,6 +1,6 @@
-
+
|
diff --git a/pages/user/myTopics/index.js b/pages/user/myTopics/index.js
index 29c8aa0..dbb4380 100644
--- a/pages/user/myTopics/index.js
+++ b/pages/user/myTopics/index.js
@@ -1,4 +1,10 @@
// pages/user/common/myTopics/index.js
+import dayjs from '../../../utils/dayjs/index.js'
+import relativeTime from '../../../utils/dayjs/relativeTime.js'
+dayjs.extend(relativeTime);
+import { UserModel } from '../../../models/user.js'
+let userModel = new UserModel()
+
Page({
/**
@@ -6,16 +12,62 @@ Page({
*/
data: {
headerTitles: ['我参与的', '我发布的'],
- selectedTitle: 0
+ selectedTitle: 0,
+ currentPage:1,
+ list:{
+ type:Array,
+ value:[]
+ }
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ this.fetchMyTopicList()
+ },
+ fetchMyTopicList(){
+ let page = this.data.currentPage
+ userModel.getMyTopics(page,this.data.selectedTitle+1,res=>{
+ console.log(res)
+
+ const datas = res.result.list
+ let tempDatas = []
+ datas.forEach(item => {
+ tempDatas.push({
+ topicId: item.id,
+ title: item.title,
+ userName: item.author,
+ commentNum: item.commentNum,
+ topicImg: item.image,
+ time: item.createTime,
+ })
+ })
+ if (page == 1) {
+ this.setData({
+ list: tempDatas
+ })
+ } else {
+ if (tempDatas.length > 0) {
+ const list = [...this.data.list, ...tempDatas]
+ this.setData({
+ list: list
+ })
+ } else {
+ const page = this.data.currPage - 1
+ this.setData({
+ currPage: page
+ })
+ wx.showToast({
+ title: '已加载全部',
+ icon: 'none'
+ })
+ }
+ }
+ console.log(this.data.list)
+ wx.stopPullDownRefresh()
+ })
},
-
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -69,7 +121,9 @@ Page({
tapSegment: function (e) {
const item = e.detail;
this.setData({
- selectedTitle: item.index
+ selectedTitle: item.index,
+ list:[]
});
+ this.fetchMyTopicList()
}
})
\ No newline at end of file
diff --git a/pages/user/myTopics/index.wxml b/pages/user/myTopics/index.wxml
index db1c98d..4c8b37f 100644
--- a/pages/user/myTopics/index.wxml
+++ b/pages/user/myTopics/index.wxml
@@ -1,6 +1,6 @@
-
-
+
+
diff --git a/pages/user/myTopics/myParticipant/cell/index.js b/pages/user/myTopics/myParticipant/cell/index.js
index e1c62a5..c625683 100644
--- a/pages/user/myTopics/myParticipant/cell/index.js
+++ b/pages/user/myTopics/myParticipant/cell/index.js
@@ -4,17 +4,14 @@ Component({
* 组件的属性列表
*/
properties: {
- articleId: String,
+ topicId: String,
title: String,
- articleImg:String,
- userIcon:String,
- userName:String,
+ topicImg: String,
+ userIcon: String,
+ userName: String,
time: String,
- commentNum: String,
- showTop: {
- type: Boolean,
- value: false,
- }
+ commentNum: Number,
+ type:String
},
/**
@@ -29,7 +26,17 @@ Component({
*/
methods: {
onTap() {
- this.triggerEvent('clickListItem', { articleId: this.properties.articleId })
+ let item = {
+ topicId: this.properties.topicId,
+ title: this.properties.title,
+ topicImg: this.properties.topicImg,
+ userIcon: this.properties.userIcon,
+ userName: this.properties.userName,
+ time: this.properties.time,
+ commentNum: this.properties.commentNum,
+ type: this.properties.type
+ }
+ this.triggerEvent('clickListItem', { item: item })
}
}
})
diff --git a/pages/user/myTopics/myParticipant/cell/index.wxml b/pages/user/myTopics/myParticipant/cell/index.wxml
index b9fa71a..e22691b 100644
--- a/pages/user/myTopics/myParticipant/cell/index.wxml
+++ b/pages/user/myTopics/myParticipant/cell/index.wxml
@@ -7,7 +7,7 @@
-
+
{{userName}}
@@ -16,14 +16,14 @@
-
-
+
+
diff --git a/pages/user/myTopics/myParticipant/cell/index.wxss b/pages/user/myTopics/myParticipant/cell/index.wxss
index 49f827e..07c439e 100644
--- a/pages/user/myTopics/myParticipant/cell/index.wxss
+++ b/pages/user/myTopics/myParticipant/cell/index.wxss
@@ -71,6 +71,7 @@
width: 30%;
height: 70px;
border-radius: 5px;
+ background-color: #EEEEEE;
}
image{
width: 100%;
diff --git a/pages/user/myTopics/myParticipant/index.js b/pages/user/myTopics/myParticipant/index.js
index 85e7da9..2035e9c 100644
--- a/pages/user/myTopics/myParticipant/index.js
+++ b/pages/user/myTopics/myParticipant/index.js
@@ -4,42 +4,17 @@ Component({
* 组件的属性列表
*/
properties: {
-
+ list: {
+ type: Array,
+ value: []
+ }
},
/**
* 组件的初始数据
*/
data: {
- list: [
- {
- articleId: '1',
- title: "市北区举行国际航运贸易金融创新中心核心区产业建设",
- articleImg: "asdsad",
- userIcon: "",
- userName: "用户名",
- time: "刚刚",
- commentNum: "33",
- },
- {
- articleId: "2",
- title: "《大众日报》市北区举行国际航运贸易金融创新中心核心区产业建设",
- articleImg: "",
- userIcon: "",
- userName: "用户名",
- time: "1分钟前",
- commentNum: "33",
- },
- {
- articleId: "3",
- title: "青岛医疗人工智能科技创新中心落户市北",
- articleImg: "asdsadad",
- userIcon: "",
- userName: "用户名",
- time: "1分钟前",
- commentNum: "33",
- }
- ]
+
},
/**
@@ -47,8 +22,12 @@ Component({
*/
methods: {
clickListItem(e) {
- const articleId = e.detail.articleId;
- console.log(articleId);
+ const item = e.detail.item;
+ console.log(item);
+ let id = item.topicId
+ wx.navigateTo({
+ url: `/pages/topics/interactive/topicArticle/index?topicId=${id}`,
+ })
}
}
})
diff --git a/pages/user/myTopics/myParticipant/index.wxml b/pages/user/myTopics/myParticipant/index.wxml
index 394e4ee..e500879 100644
--- a/pages/user/myTopics/myParticipant/index.wxml
+++ b/pages/user/myTopics/myParticipant/index.wxml
@@ -1,14 +1,13 @@
-
+
|
diff --git a/pages/user/myTopics/myRelease/index.js b/pages/user/myTopics/myRelease/index.js
index 2a53c33..4dfbaed 100644
--- a/pages/user/myTopics/myRelease/index.js
+++ b/pages/user/myTopics/myRelease/index.js
@@ -4,42 +4,17 @@ Component({
* 组件的属性列表
*/
properties: {
-
+ list: {
+ type: Array,
+ value: []
+ }
},
/**
* 组件的初始数据
*/
data: {
- list: [
- {
- articleId: '1',
- title: "市北区举行国际航运贸易金融创新中心核心区产业建设",
- articleImg: "",
- userIcon: "",
- userName: "用户名",
- time: "刚刚",
- commentNum: "33",
- },
- {
- articleId: "2",
- title: "《大众日报》市北区举行国际航运贸易金融创新中心核心区产业建设",
- articleImg: "",
- userIcon: "",
- userName: "用户名",
- time: "1分钟前",
- commentNum: "33",
- },
- {
- articleId: "3",
- title: "青岛医疗人工智能科技创新中心落户市北",
- articleImg: "",
- userIcon: "",
- userName: "用户名",
- time: "1分钟前",
- commentNum: "33",
- }
- ]
+
},
/**
@@ -47,8 +22,12 @@ Component({
*/
methods: {
clickListItem(e) {
- const articleId = e.detail.articleId;
- console.log(articleId);
+ const item = e.detail.item;
+ console.log(item);
+ let id = item.topicId
+ wx.navigateTo({
+ url: `/pages/topics/interactive/topicArticle/index?topicId=${id}`,
+ })
}
}
})
diff --git a/pages/user/myTopics/myRelease/index.wxml b/pages/user/myTopics/myRelease/index.wxml
index 011e49e..bf2bacc 100644
--- a/pages/user/myTopics/myRelease/index.wxml
+++ b/pages/user/myTopics/myRelease/index.wxml
@@ -1,14 +1,13 @@
-
+
|
|