添加活动评论列表功能

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
var app = getApp();
Page({
/**
* 页面的初始数据
*/
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) {
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) {
var id = options.id;
var self = this;
self.setData({
serviceId: id
})
this.getToken().then(result => {
this.getDetail(id);
this.getMyTeam();

View File

@ -22,7 +22,10 @@
</view>
<view class="activity-container">
<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>
</view>
</view>

View File

@ -51,6 +51,15 @@
padding-left: 10rpx;
font-size: 30rpx;
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{
font-size: 28rpx;

View File

@ -7,6 +7,7 @@ Page({
*/
data: {
token: '',
volunteerMsg: [],
isAgree: false, // 是否同意志愿者注册协议
openExperience: 0,
tempObj: {}, // 用于临时存储字典表返回的数据
@ -180,7 +181,7 @@ Page({
icon: 'none',
duration: 1500
})
return false;
return false;
}
var volunteerVO = {
serviceCity: self.data.teamCity[self.data.teamCityIndex] != ''
@ -203,7 +204,13 @@ Page({
agree: self.data.isAgree,
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, {
headers: {
'token': self.data.token
@ -263,31 +270,55 @@ 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) {
var self = this;
this.getToken().then(result => {
this.getDataFromDict('a223b308-014a-4e89-93fa-035a564e7fda', 1).then(result => {
self.setData({
serviceType: self.data.tempObj,
tempObj: {}
})
}).then(result => {
this.getDataFromDict('7b213c37-8575-4db3-bda1-86c4e38589f7', 1).then(result => {
this.getVolunteerMsg().then(result => {
this.getDataFromDict('a223b308-014a-4e89-93fa-035a564e7fda', 1).then(result => {
self.setData({
serviceIndustry: self.data.tempObj,
serviceType: self.data.tempObj,
tempObj: {}
})
})
}).then(result => {
this.getDataFromDict('4a03e904-81e2-48e9-9006-e15ea4a6bc69', 2).then(result => {
self.setData({
teamCity: self.data.tempObj,
teamCityArray: self.data.tempArray,
tempObj: {},
tempArray: []
}).then(result => {
this.getDataFromDict('7b213c37-8575-4db3-bda1-86c4e38589f7', 1).then(result => {
self.setData({
serviceIndustry: self.data.tempObj,
tempObj: {}
})
})
}).then(result => {
this.getDataFromDict('4a03e904-81e2-48e9-9006-e15ea4a6bc69', 2).then(result => {
self.setData({
teamCity: self.data.tempObj,
teamCityArray: self.data.tempArray,
tempObj: {},
tempArray: []
})
})
})
})