Browse Source

update topic and user

master
fanp 6 years ago
parent
commit
c3c53f0dda
  1. 57
      models/topic.js
  2. 88
      models/user.js
  3. 33
      pages/topics/goodIdea/cell/index.js
  4. 4
      pages/topics/goodIdea/cell/index.wxml
  5. 4
      pages/topics/goodIdea/index.js
  6. 1
      pages/topics/goodIdea/index.wxml
  7. 12
      pages/topics/index.js
  8. 2
      pages/topics/interactive/cell/index.wxml
  9. 32
      pages/topics/interactive/submitTopic/index.js
  10. 4
      pages/topics/interactive/submitTopic/index.wxml
  11. 39
      pages/topics/interactive/topicArticle/index.js
  12. 2
      pages/topics/interactive/topicArticle/index.wxml
  13. 29
      pages/topics/message/index.js
  14. 2
      pages/topics/message/index.wxml
  15. 26
      pages/user/index.js
  16. 8
      pages/user/index.wxml
  17. 1
      pages/user/index.wxss
  18. 36
      pages/user/myActivity/cell/index.js
  19. 4
      pages/user/myActivity/cell/index.json
  20. 18
      pages/user/myActivity/cell/index.wxml
  21. 106
      pages/user/myActivity/cell/index.wxss
  22. 79
      pages/user/myActivity/index.js
  23. 3
      pages/user/myActivity/index.json
  24. 2
      pages/user/myActivity/index.wxml
  25. 93
      pages/user/myFavorite/index.js
  26. 1
      pages/user/myFavorite/index.json
  27. 9
      pages/user/myFavorite/index.wxml
  28. 75
      pages/user/myIdea/index.js
  29. 2
      pages/user/myIdea/index.json
  30. 2
      pages/user/myIdea/index.wxml
  31. 6
      pages/user/myMessage/cell/index.wxml
  32. 66
      pages/user/myMessage/index.js
  33. 1
      pages/user/myMessage/index.json
  34. 2
      pages/user/myMessage/index.wxml
  35. 62
      pages/user/myTopics/index.js
  36. 4
      pages/user/myTopics/index.wxml
  37. 27
      pages/user/myTopics/myParticipant/cell/index.js
  38. 8
      pages/user/myTopics/myParticipant/cell/index.wxml
  39. 1
      pages/user/myTopics/myParticipant/cell/index.wxss
  40. 43
      pages/user/myTopics/myParticipant/index.js
  41. 7
      pages/user/myTopics/myParticipant/index.wxml
  42. 43
      pages/user/myTopics/myRelease/index.js
  43. 7
      pages/user/myTopics/myRelease/index.wxml

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

88
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 }

33
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)
// 评论点赞
}
}
})

4
pages/topics/goodIdea/cell/index.wxml

@ -12,10 +12,10 @@
<image style="width:100%;height:100%;" src="./images/goodIdea.png"></image>
</view>
</view>
<view class="userInfo-right">
<view class="userInfo-right" bindtap="onClickPraise" data-item="{{itemData}}" data-index='{{itemIndex}}'>
<view class="praiseNum">{{itemData.praiseNum}}</view>
<view class="praise-icon">
<image src="./images/praise.png" style="width:100%;"></image>
<image src="{{item.isPraise ? praise : unPraise}}" style="width:100%;"></image>
</view>
</view>
</view>

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

1
pages/topics/goodIdea/index.wxml

@ -3,6 +3,7 @@
<block wx:for="{{list}}" wx:key="{{index}}">
<cell
itemData="{{item}}"
itemIndex="{{index}}"
bind:clickListItem="clickListItem"/>
</block>
</view>

12
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)
// }
})

2
pages/topics/interactive/cell/index.wxml

@ -1,5 +1,5 @@
<!--pages/topics/common/interactive/common/imageCell/index.wxml-->
<view class="cell" id="cell" bindtap="onTap">
<view class="cell" bindtap="onTap">
<view class="left {{articleImg === '' ? 'leftActive' : ''}}">
<view class="left-top">
<view class="cell_title">{{title}}</view>

32
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)
},

4
pages/topics/interactive/submitTopic/index.wxml

@ -1,8 +1,8 @@
<!--pages/topics/interactive/submitTopic/index.wxml-->
<view class="container">
<input class="title" bindinput="bindTextInput" placeholder="议题"></input>
<input class="title" value="{{topicTitle}}" bindinput="bindTextInput" placeholder="议题"></input>
<view class="line-view"></view>
<textarea class="textArea" bindinput="bindTextAreaInput" placeholder="详情内容" />
<textarea class="textArea" value="{{topicDetail}}" bindinput="bindTextAreaInput" placeholder="详情内容" />
<mp-cells ext-class="uploader_bd">
<mp-cell>
<mp-uploader ext-class="myUploader" binddelete="deleteFile" bindfail="uploadError" bindsuccess="uploadSuccess" select="{{selectFile}}" upload="{{uplaodFile}}" files="{{files}}" max-count="5" delete="true"></mp-uploader>

39
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) {

2
pages/topics/interactive/topicArticle/index.wxml

@ -9,7 +9,7 @@
{{time}}
</view>
<view class="topic_time_right">
<image src="{{isStar ? star : unStar}}" bindtap="onClickCollect"></image>
<image src="{{isCollect ? star : unStar}}" bindtap="onClickCollect"></image>
</view>
</view>
<view class="topic_userInfo">

29
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'
})
}
})
}
}
})

2
pages/topics/message/index.wxml

@ -2,7 +2,7 @@
<view class="mian">
<view class="content-wrapper">
<view class="section">
<textarea class="textArea" bindinput="bindTextAreaInput" placeholder="有什么想留言的内容?" />
<textarea class="textArea" value="{{textAreaString}}" bindinput="bindTextAreaInput" placeholder="有什么想留言的内容?" />
<view class="btnView">
<e-ibutton title="提交" bind:onTap="submit"/>
</view>

26
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`,
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成

8
pages/user/index.wxml

@ -3,8 +3,10 @@
<mp-cells ext-class="page_hd">
<mp-cell bindtap="onTapItem" data-type="myInfo">
<view class="user_hd">
<image slot="icon" class="user_logo" src=""/>
<view slot="title" class="user_name">啦啦啦拉两岸啦啦啦啦啦靓阿拉啦啦啦</view>
<!-- <image slot="icon" class="user_logo" src=""/> -->
<open-data class="user_logo" slot="icon" type="userAvatarUrl"></open-data>
<!-- <view slot="title" class="user_name">啦啦啦拉两岸啦啦啦啦啦靓阿拉啦啦啦</view> -->
<open-data class="user_name" type="userNickName" lang="zh_CN"></open-data>
</view>
</mp-cell>
@ -16,7 +18,7 @@
title="我的消息"
link="true"
ext-class="cell-item">
<view slot="footer" class="msg_footer">你有5条消息</view>
<view wx:if="{{messageTotal > 0 }}" slot="footer" class="msg_footer">你有{{messageTotal}}条消息</view>
</mp-cell>
<mp-cell
bindtap="onTapItem" data-type="myTopics"

1
pages/user/index.wxss

@ -22,7 +22,6 @@
width: 80px;
height: 80px;
border-radius: 40px;
background-color: red;
}
.user_name {
width: 400rpx;

36
pages/user/myActivity/cell/index.js

@ -0,0 +1,36 @@
// pages/topics/common/interactive/common/imageCell/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
articleId: String,
title: String,
articleImg: String,
userName: String,
time: String,
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
onTap() {
let item = {
articleId: this.properties.articleId,
title: this.properties.title,
articleImg: this.properties.articleImg,
userName: this.properties.userName,
time: this.properties.time,
}
this.triggerEvent('clickListItem', { item: item })
}
}
})

4
pages/user/myActivity/cell/index.json

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

18
pages/user/myActivity/cell/index.wxml

@ -0,0 +1,18 @@
<!--pages/topics/common/interactive/common/imageCell/index.wxml-->
<view class="cell" id="cell" bindtap="onTap">
<view class="left {{articleImg === '' ? 'leftActive' : ''}}">
<view class="left-top">
<view class="cell_title">{{title}}</view>
</view>
<view class="left-bottom">
<view class="left-bottom-userInfo">
<view class="userName">{{userName}}</view>
<view class="cell_info_meta">{{time}}</view>
</view>
</view>
</view>
<view class="right" wx:if="{{articleImg.length > 0}}">
<image class="articleImg" src="{{topicImg}}"></image>
</view>
</view>

106
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;
}

79
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}`,
})
}
})

3
pages/user/myActivity/index.json

@ -1,6 +1,7 @@
{
"enablePullDownRefresh": true,
"navigationBarTitleText": "我的活动",
"usingComponents": {
"cell": "../myTopics/myParticipant/cell/index"
"cell": "./cell/index"
}
}

2
pages/user/myActivity/index.wxml

@ -1,6 +1,6 @@
<!--pages/user/common/myActivity/index.wxml-->
<view class="container">
<block wx:for="{{list}}" wx:key="*this">
<block wx:for="{{list}}" wx:key="{{index}}">
<cell
articleId="{{item.articleId}}"
title="{{item.title}}"

93
pages/user/myFavorite/index.js

@ -1,4 +1,9 @@
// pages/user/common/myFavorite/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({
/**
@ -7,42 +12,89 @@ Page({
data: {
list: [
{
articleId: '1',
topicId: '1',
title: "市北区举行国际航运贸易金融创新中心核心区产业建设",
articleImg: "asdsad",
topicImg: "asdsad",
userIcon: "",
userName: "用户名",
time: "刚刚",
commentNum: "33",
},
{
articleId: "2",
topicId: "2",
title: "《大众日报》市北区举行国际航运贸易金融创新中心核心区产业建设",
articleImg: "",
topicImg: "",
userIcon: "",
userName: "用户名",
time: "1分钟前",
commentNum: "33",
},
{
articleId: "3",
topicId: "3",
title: "青岛医疗人工智能科技创新中心落户市北",
articleImg: "asdsadad",
topicImg: "asdsadad",
userIcon: "",
userName: "用户名",
time: "1分钟前",
commentNum: "33",
}
]
],
currentPage:1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.fetchMyFavoriteList()
},
fetchMyFavoriteList(){
console.log('啦啦啦')
let page = this.data.currentPage
userModel.getMyFavoriteList(page,res=>{
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}`,
})
}
}
})

1
pages/user/myFavorite/index.json

@ -1,4 +1,5 @@
{
"enablePullDownRefresh": true,
"navigationBarTitleText": "我的收藏",
"usingComponents": {
"cell": "../myTopics/myParticipant/cell/index"

9
pages/user/myFavorite/index.wxml

@ -1,14 +1,15 @@
<!--pages/user/common/myFavorite/index.wxml-->
<view class="container">
<block wx:for="{{list}}" wx:key="*this">
<block wx:for="{{list}}" wx:key="{{index}}">
<cell
articleId="{{item.articleId}}"
topicId="{{item.topicId}}"
title="{{item.title}}"
articleImg="{{item.articleImg}}"
topicImg="{{item.topicImg}}"
userName="{{item.userName}}"
time="{{item.time}}"
commentNum="{{item.commentNum}}"
showTop="{{item.showTop}}"
type="{{item.type}}"
userIcon="{{item.userIcon}}"
bind:clickListItem="clickListItem"/>
</block>
</view>

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

2
pages/user/myIdea/index.json

@ -1,4 +1,6 @@
{
"enablePullDownRefresh": true,
"navigationBarTitleText": "我的金点子",
"usingComponents": {
"cell": "../../topics/goodIdea/cell/index"

2
pages/user/myIdea/index.wxml

@ -1,6 +1,6 @@
<!--pages/user/common/myIdea/index.wxml-->
<view class="container">
<block wx:for="{{list}}" wx:key="*this">
<block wx:for="{{list}}" wx:key="{{index}}">
<cell
itemData="{{item}}"
bind:clickListItem="clickListItem"/>

6
pages/user/myMessage/cell/index.wxml

@ -1,9 +1,9 @@
<!--pages/user/myMessage/cell/index.wxml-->
<view class="cell" id="cell" bindtap="onTap">
<view class="cell" bindtap="onTap">
<view class="item-left">
<image wx:if="{{itemData.msgType === 0}}" src="/images/user/activity_icon.png"></image>
<!-- <image wx:if="{{itemData.msgType === 0}}" src="/images/user/activity_icon.png"></image> -->
<image wx:if="{{itemData.msgType === 1}}" src="/images/user/msg_icon.png"></image>
<image wx:if="{{itemData.msgType === 2}}" src="/images/user/system_icon.png"></image>
<image wx:if="{{itemData.msgType === 2}}" src="/images/user/activity_icon.png"></image>
</view>
<view class="item-right">
<view class="item-text">

66
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()
},
/**

1
pages/user/myMessage/index.json

@ -1,4 +1,5 @@
{
"enablePullDownRefresh": true,
"navigationBarTitleText": "我的消息",
"usingComponents": {
"cell": "./cell/index"

2
pages/user/myMessage/index.wxml

@ -1,6 +1,6 @@
<!--pages/user/common/myMessage/index.wxml-->
<view class="container">
<block wx:for="{{list}}" wx:key="*this">
<block wx:for="{{list}}" wx:key="{{index}}">
<cell
itemData="{{item}}"
bind:clickListItem="clickListItem"/>

62
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()
}
})

4
pages/user/myTopics/index.wxml

@ -1,6 +1,6 @@
<!--pages/user/common/myTopics/index.wxml-->
<view class="content-wrapper">
<e-segment bind:tapSegment="tapSegment" headerTitles="{{headerTitles}}" defaultSelectIndex="{{selectedTitle}}"/>
<myParticipant wx:if="{{selectedTitle==0}}" />
<myRelease wx:if="{{selectedTitle==1}}" />
<myParticipant wx:if="{{selectedTitle==0}}" list="{{list}}"/>
<myRelease wx:if="{{selectedTitle==1}}" list="{{list}}"/>
</view>

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

8
pages/user/myTopics/myParticipant/cell/index.wxml

@ -7,7 +7,7 @@
<view class="left-bottom">
<view class="left-bottom-userInfo">
<view class="user-icon">
<view class="user-icon" wx:if="{{userIcon.length > 0}}">
<image src="{{userIcon}}"></image>
</view>
<view class="userName">{{userName}}</view>
@ -16,14 +16,14 @@
<view class="left-bottom-comments">
<view class="comments-icon">
<image class="image_icon" src="/images/common/com_count.png"></image>
<image src="/images/common/com_count.png"></image>
</view>
<view class="commentNum">{{commentNum}}</view>
</view>
</view>
</view>
<view class="right" wx:if="{{articleImg.length > 0}}">
<image class="articleImg" src="./images/articleImg.png"></image>
<view class="right" wx:if="{{topicImg.length > 0}}">
<image class="articleImg" src="{{topicImg}}"></image>
</view>
</view>

1
pages/user/myTopics/myParticipant/cell/index.wxss

@ -71,6 +71,7 @@
width: 30%;
height: 70px;
border-radius: 5px;
background-color: #EEEEEE;
}
image{
width: 100%;

43
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}`,
})
}
}
})

7
pages/user/myTopics/myParticipant/index.wxml

@ -1,14 +1,13 @@
<!--pages/user/myTopics/myParticipant/index.wxml-->
<view class="container">
<block wx:for="{{list}}" wx:key="*this">
<block wx:for="{{list}}" wx:key="{{index}}">
<cell
articleId="{{item.articleId}}"
topicId="{{item.topicId}}"
title="{{item.title}}"
articleImg="{{item.articleImg}}"
topicImg="{{item.topicImg}}"
userName="{{item.userName}}"
time="{{item.time}}"
commentNum="{{item.commentNum}}"
showTop="{{item.showTop}}"
bind:clickListItem="clickListItem"/>
</block>
</view>

43
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}`,
})
}
}
})

7
pages/user/myTopics/myRelease/index.wxml

@ -1,14 +1,13 @@
<!--pages/user/myTopics/myRelease/index.wxml-->
<view class="container">
<block wx:for="{{list}}" wx:key="*this">
<block wx:for="{{list}}" wx:key="{{index}}">
<cell
articleId="{{item.articleId}}"
topicId="{{item.topicId}}"
title="{{item.title}}"
articleImg="{{item.articleImg}}"
topicImg="{{item.topicImg}}"
userName="{{item.userName}}"
time="{{item.time}}"
commentNum="{{item.commentNum}}"
showTop="{{item.showTop}}"
bind:clickListItem="clickListItem"/>
</block>
</view>

Loading…
Cancel
Save