添加活动评论列表功能

This commit is contained in:
Renpc-kilig 2020-06-27 18:16:22 +08:00
parent 21145d88e0
commit 7e0eb907a0
5 changed files with 112 additions and 21 deletions

View File

@ -1,18 +1,56 @@
// pages/activityDialog/activityDialog.js // pages/activityDialog/activityDialog.js
var app = getApp();
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
token: '',
serviceId: ''
}, },
getToken: function() {
var self = this;
return new Promise(resolve =>{
wx.getStorage({
key: 'token',
success(res) {
self.setData({
token: res.data
})
return resolve();
}
})
})
},
getActivityHis: function() {
var self = this;
app.restAjax.get(app.restAjax.path(app.volunteerUrl + '/wxminiapp/teamactivityhis/listpageteamactivityhis?serviceId=' + self.data.serviceId, []),
{}, {
headers: {
token: self.data.token
}
}, function(code, data) {
if('200' == code) {
console.log(data)
}
}, function() {
}, function() {
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
var self = this;
self.setData({
serviceId: options.serviceId
})
this.getToken().then(result => {
this.getActivityHis()
})
}, },
/** /**

View File

@ -224,11 +224,21 @@ Page({
}) })
}, },
toActivityHis: function() {
var self = this;
wx.navigateTo({
url: '../activityDialog/activityDialog?serviceId=' + self.data.serviceId,
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
var id = options.id; var id = options.id;
var self = this;
self.setData({
serviceId: id
})
this.getToken().then(result => { this.getToken().then(result => {
this.getDetail(id); this.getDetail(id);
this.getMyTeam(); this.getMyTeam();

View File

@ -22,7 +22,10 @@
</view> </view>
<view class="activity-container"> <view class="activity-container">
<view class="part"> <view class="part">
<view class="part-title">活动详情</view> <view class="part-title">
活动详情
<view class="comment-btn" bindtap="toActivityHis">评论列表</view>
</view>
<rich-text class="part-content" nodes="{{dataMap.introduce}}"></rich-text> <rich-text class="part-content" nodes="{{dataMap.introduce}}"></rich-text>
</view> </view>
</view> </view>

View File

@ -51,6 +51,15 @@
padding-left: 10rpx; padding-left: 10rpx;
font-size: 30rpx; font-size: 30rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
display: flex;
justify-content: space-between;
}
.comment-btn{
padding: 0 10rpx;
background: #9F1512;
color: #fff;
font-size: 28rpx;
border-radius: 10rpx;
} }
.part-content{ .part-content{
font-size: 28rpx; font-size: 28rpx;

View File

@ -7,6 +7,7 @@ Page({
*/ */
data: { data: {
token: '', token: '',
volunteerMsg: [],
isAgree: false, // 是否同意志愿者注册协议 isAgree: false, // 是否同意志愿者注册协议
openExperience: 0, openExperience: 0,
tempObj: {}, // 用于临时存储字典表返回的数据 tempObj: {}, // 用于临时存储字典表返回的数据
@ -203,7 +204,13 @@ Page({
agree: self.data.isAgree, agree: self.data.isAgree,
openExperience : self.data.openExperience openExperience : self.data.openExperience
}; };
app.restAjax.post(app.restAjax.path(app.volunteerUrl + '/wxminiapp/volunteer/savevolunteer', []), var url;
if(!self.data.volunteerMsg) {
url = '/wxminiapp/volunteer/savevolunteer';
}else {
url = '/wxminiapp/volunteer/updatevolunteer/' + self.data.volunteerMsg.volunteerId;
}
app.restAjax.post(app.restAjax.path(app.volunteerUrl + url, []),
volunteerVO, { volunteerVO, {
headers: { headers: {
'token': self.data.token 'token': self.data.token
@ -263,12 +270,35 @@ Page({
}) })
}) })
}, },
getVolunteerMsg() {
var self = this;
return new Promise(resolve => {
app.restAjax.get(app.restAjax.path(app.volunteerUrl + '/wxminiapp/volunteer/getvolunteerbyuserid', []),
{}, {
headers: {
'token': self.data.token
}
}, function(code, data) {
if('200' == code) {
self.setData({
volunteerMsg: data
})
}
return resolve();
}, function() {
}, function() {
})
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
var self = this; var self = this;
this.getToken().then(result => { this.getToken().then(result => {
this.getVolunteerMsg().then(result => {
this.getDataFromDict('a223b308-014a-4e89-93fa-035a564e7fda', 1).then(result => { this.getDataFromDict('a223b308-014a-4e89-93fa-035a564e7fda', 1).then(result => {
self.setData({ self.setData({
serviceType: self.data.tempObj, serviceType: self.data.tempObj,
@ -292,6 +322,7 @@ Page({
}) })
}) })
}) })
})
}, },
/** /**