修改bug

This commit is contained in:
Renpc-kilig 2020-07-03 16:32:32 +08:00
parent 3a1c600550
commit 0bac46e527
11 changed files with 156 additions and 14 deletions

View File

@ -26,7 +26,8 @@
"pages/activityDetail/activityDetail", "pages/activityDetail/activityDetail",
"pages/activity/activity", "pages/activity/activity",
"pages/newsDetail/newsDetail", "pages/newsDetail/newsDetail",
"pages/newsList/newsList" "pages/newsList/newsList",
"pages/userAgree/userAgree"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",

View File

@ -9,7 +9,8 @@ Page({
isAgree: false, // 是否同意志愿者注册协议 isAgree: false, // 是否同意志愿者注册协议
index: 0, index: 0,
array: ['区域1','区域2','区域3','区域4'], array: ['区域1','区域2','区域3','区域4'],
photo: '', photo: '', // 用于页面显示的photo链接
uploadPhoto: '', // 用于传到后台的photoId
teamName: '', teamName: '',
count:'', count:'',
teamWatchword: '', teamWatchword: '',
@ -74,7 +75,8 @@ Page({
var data = data.substr(9, data.length); var data = data.substr(9, data.length);
data = data.substr(0, data.length - 2); data = data.substr(0, data.length - 2);
self.setData({ self.setData({
photo: app.volunteerUrl + '/route/file/downloadfile/true/' + data photo: app.volunteerUrl + '/route/file/downloadfile/true/' + data,
uploadPhoto: data
}) })
} }
}, function(code, data) { }, function(code, data) {
@ -140,6 +142,18 @@ Page({
} }
}) })
}, },
areaChange: function(e) {
var self = this;
self.setData({
teamAreaIndex: e.detail.value
})
},
userAgree: function(e) {
var type = e.currentTarget.dataset.type;
wx.navigateTo({
url: '../userAgree/userAgree?type=' + type,
})
},
changeAgree: function (e) { changeAgree: function (e) {
if(e.detail.value == ''){ if(e.detail.value == ''){
this.setData({ this.setData({
@ -162,7 +176,7 @@ Page({
return false; return false;
} }
var teamVO = { var teamVO = {
photo: self.data.photo, photo: self.data.uploadPhoto,
teamName: self.data.teamName, teamName: self.data.teamName,
count:self.data.count, count:self.data.count,
teamWatchword: self.data.teamWatchword, teamWatchword: self.data.teamWatchword,

View File

@ -49,7 +49,7 @@
<view class="row" hidden="{{areaShowStatus}}"> <view class="row" hidden="{{areaShowStatus}}">
<view class="row-title">乡镇村:</view> <view class="row-title">乡镇村:</view>
<view class="row-text"> <view class="row-text">
<picker bindchange="countyChange" value="{{teamAreaIndex}}" range="{{teamAreaArray}}"> <picker bindchange="areaChange" value="{{teamAreaIndex}}" range="{{teamAreaArray}}">
<view class="picker"> <view class="picker">
{{teamAreaArray[teamAreaIndex]}} {{teamAreaArray[teamAreaIndex]}}
</view> </view>
@ -67,7 +67,7 @@
<view class="agree"> <view class="agree">
<checkbox-group bindchange="changeAgree"> <checkbox-group bindchange="changeAgree">
<label> <label>
<checkbox value="{{isAgree}}" checked="{{isAgree}}" color="#9F1512" class="agree-checkbox"/>我已阅读并同意<text class="agreement">《团队注册服务协议》</text> <checkbox value="{{isAgree}}" checked="{{isAgree}}" color="#9F1512" class="agree-checkbox"/>我已阅读并同意<text class="agreement" style="color: red;" data-type="team" bindtap="userAgree">《团队注册服务协议》</text>
</label> </label>
</checkbox-group> </checkbox-group>
</view> </view>

View File

@ -20,7 +20,8 @@ Page({
introduce: '', // 活动介绍 introduce: '', // 活动介绍
voluntaryType: 1, // 类型 voluntaryType: 1, // 类型
tempFilePaths: '', // 宣传图片 tempFilePaths: '', // 宣传图片
photo: '', // 宣传图片 photo: '', // 用于页面显示的宣传图片链接
uploadPhoto: '', // 用于传到后台的宣传图片Id
serviceRequirement: '', // 服务要求 serviceRequirement: '', // 服务要求
}, },
getToken: function() { getToken: function() {
@ -99,7 +100,8 @@ Page({
var data = data.substr(9, data.length); var data = data.substr(9, data.length);
data = data.substr(0, data.length - 2); data = data.substr(0, data.length - 2);
self.setData({ self.setData({
photo: app.volunteerUrl + '/route/file/downloadfile/true/' + data photo: app.volunteerUrl + '/route/file/downloadfile/true/' + data,
uploadPhoto: data
}) })
} }
}, function(code, data) { }, function(code, data) {
@ -172,7 +174,7 @@ Page({
introduce: self.data.introduce, introduce: self.data.introduce,
startTime: self.data.startDate, startTime: self.data.startDate,
endTime: self.data.endDate, endTime: self.data.endDate,
photo: self.data.photo, photo: self.data.uploadPhoto,
serviceRequirement: self.data.serviceRequirement serviceRequirement: self.data.serviceRequirement
}; };
app.restAjax.post(app.restAjax.path(app.volunteerUrl + '/wxminiapp/volunteerservice/savevolunteerservice', []), app.restAjax.post(app.restAjax.path(app.volunteerUrl + '/wxminiapp/volunteerservice/savevolunteerservice', []),

View File

@ -138,7 +138,7 @@ Page({
}, function(code, data) { }, function(code, data) {
if('200' == code) { if('200' == code) {
app.dialog.msg('注册成功!'); app.dialog.msg('注册成功!');
wx.navigateTo({ wx.redirectTo({
url: '../volunteer/volunteer', url: '../volunteer/volunteer',
}) })
} }
@ -167,7 +167,7 @@ Page({
}, function(code, data) { }, function(code, data) {
if('200' == code) { if('200' == code) {
app.dialog.msg('取消报名成功!'); app.dialog.msg('取消报名成功!');
wx.navigateTo({ wx.redirectTo({
url: '../volunteer/volunteer', url: '../volunteer/volunteer',
}) })
} }

View File

@ -0,0 +1,104 @@
// pages/userAgree/userAgree.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
agreeContent: '',
token: ''
},
getToken: function() {
var self = this;
return new Promise(resolve =>{
wx.getStorage({
key: 'token',
success(res) {
self.setData({
token: res.data
})
return resolve();
}
})
})
},
getUserAgree: function(type) {
var self = this;
app.restAjax.get(app.restAjax.path(app.volunteerUrl + '/wxminiapp/agreecontent/getagreecontentbyid/' + type, []),
{}, {
headers: {
token: self.data.token
}
}, function(code, data) {
if('200' == code) {
self.setData({
agreeContent: data.content
})
}
}, function(code, data) {
app.dialog.msg(data.msg)
}, function() {
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var type = options.type;
var self = this;
this.getToken().then(result => {
this.getUserAgree(type);
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,4 @@
<!--pages/userAgree/userAgree.wxml-->
<view>
<rich-text nodes="{{agreeContent}}"></rich-text>
</view>

View File

@ -0,0 +1 @@
/* pages/userAgree/userAgree.wxss */

View File

@ -122,6 +122,7 @@ Page({
} }
}, },
changeAgree: function (e) { changeAgree: function (e) {
console.log(e)
if(e.detail.value == ''){ if(e.detail.value == ''){
this.setData({ this.setData({
isAgree: false isAgree: false
@ -132,6 +133,12 @@ Page({
}) })
} }
}, },
userAgree: function(e) {
var type = e.currentTarget.dataset.type;
wx.navigateTo({
url: '../userAgree/userAgree?type=' + type,
})
},
/** /**
* 服务类别选择 * 服务类别选择
* @param {}} e * @param {}} e
@ -205,12 +212,15 @@ Page({
openExperience : self.data.openExperience openExperience : self.data.openExperience
}; };
var url; var url;
var requ;
if(!self.data.volunteerMsg) { if(!self.data.volunteerMsg) {
url = '/wxminiapp/volunteer/savevolunteer'; url = '/wxminiapp/volunteer/savevolunteer';
requ = app.restAjax.post;
}else { }else {
url = '/wxminiapp/volunteer/updatevolunteer/' + self.data.volunteerMsg.volunteerId; url = '/wxminiapp/volunteer/updatevolunteer/' + self.data.volunteerMsg.volunteerId;
requ = app.restAjax.put;
} }
app.restAjax.post(app.restAjax.path(app.volunteerUrl + url, []), requ(app.restAjax.path(app.volunteerUrl + url, []),
volunteerVO, { volunteerVO, {
headers: { headers: {
'token': self.data.token 'token': self.data.token
@ -280,6 +290,7 @@ Page({
} }
}, function(code, data) { }, function(code, data) {
if('200' == code) { if('200' == code) {
console.log(data)
self.setData({ self.setData({
volunteerMsg: data volunteerMsg: data
}) })

View File

@ -1,4 +1,5 @@
<view class="register"> <view class="register">
<view class="row" wx:if="{{volunteerMsg}}" style="color:red;margin-bottom:15rpx;">您已经是志愿者,可修改以下信息!</view>
<view class="row" style="height: auto"> <view class="row" style="height: auto">
<view class="info-name">公开经历:</view> <view class="info-name">公开经历:</view>
<view class="info-text" style="height: auto"> <view class="info-text" style="height: auto">
@ -77,9 +78,10 @@
<view class="is-agree"> <view class="is-agree">
<checkbox-group bindchange="changeAgree"> <checkbox-group bindchange="changeAgree">
<label class="checkbox"> <label class="checkbox">
<checkbox value="{{isAgree}}" checked="{{isAgree}}" />我已阅读并同意<text class="bargain">《志愿者注册服务协议》</text> <checkbox value="{{isAgree}}" checked="{{isAgree}}" />我已阅读并同意<text class="bargain" data-type="volunteer" bindtap="userAgree">《志愿者注册服务协议》</text>
</label> </label>
</checkbox-group> </checkbox-group>
</view> </view>
<view class="submit" bindtap="submitRegister">立即注册</view> <view class="submit" bindtap="submitRegister" wx:if="{{!volunteerMsg}}">立即注册</view>
<view class="submit" bindtap="submitRegister" wx:else>立即修改</view>
</view> </view>