修改请求方式

This commit is contained in:
Renpc-kilig 2020-06-26 18:51:28 +08:00
parent 3acc1cd9e4
commit 3cd7d19b77
18 changed files with 376 additions and 357 deletions

View File

@ -1,12 +1,11 @@
// pages/activity/activity.js // pages/activity/activity.js
var app = getApp();
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
url: 'http://192.168.0.111:8080/culturalactivity/',
imgUrl: 'http://192.168.0.111:8080/culturalactivity/route/file/downloadfile/true/',
dataList: [] dataList: []
}, },
goDetail: function (e) { goDetail: function (e) {
@ -20,20 +19,22 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
var self = this; var self = this;
wx.request({ app.restAjax.get(app.restAjax.path(app.activityUrl + 'wxminiapp/activitylibrary/listpageactivitylibraryfornetrelease', []),
url: self.data.url + 'wxminiapp/activitylibrary/listpageactivitylibraryfornetrelease', {}, null, function(code, data) {
success: function(res) { if('200' == code) {
if('200' == res.statusCode) { for(var item of data.rows) {
for(var item of res.data.rows) {
if('' != item.activityImage) { if('' != item.activityImage) {
item.activityImage = self.data.imgUrl + item.activityImage; item.activityImage = app.activityUrl + 'route/file/downloadfile/true/' + item.activityImage;
} }
} }
self.setData({ self.setData({
dataList: res.data.rows, dataList: data.rows,
}) })
} }
} }, function() {
}, function() {
}) })
}, },

View File

@ -1,12 +1,11 @@
// pages/activityDetail/activityDetail.js // pages/activityDetail/activityDetail.js
var app = getApp();
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
url: 'http://192.168.0.111:8080/culturalactivity/',
imgUrl: 'http://192.168.0.111:8080/culturalactivity/route/file/downloadfile/true/',
dataMap: {} dataMap: {}
}, },
goSign: function () { goSign: function () {
@ -20,16 +19,18 @@ Page({
onLoad: function (options) { onLoad: function (options) {
var self = this; var self = this;
var id = options.id; var id = options.id;
wx.request({ app.restAjax.get(app.restAjax.path(app.activityUrl + 'wxminiapp/activitylibrary/getactivitylibrarybyidrelease/' + id, []),
url: self.data.url + 'wxminiapp/activitylibrary/getactivitylibrarybyidrelease/' + id, {}, null, function(code, data) {
success: function(res) { if('200' == code) {
if('200' == res.statusCode) { data.activityImage = app.activityUrl + 'route/file/downloadfile/true/' + data.activityImage;
res.data.activityImage = self.data.imgUrl + res.data.activityImage;
self.setData({ self.setData({
dataMap: res.data dataMap: data
}) })
} }
} }, function() {
}, function() {
}) })
}, },

View File

@ -67,7 +67,7 @@ Page({
*/ */
toMyTeam: function() { toMyTeam: function() {
wx.navigateTo({ wx.navigateTo({
url: '../myVlounteerTeam/myVlounteerTeam', url: '../myVolunteerTeam/myVolunteerTeam',
}) })
}, },
/** /**

View File

@ -23,13 +23,13 @@
<image src="../../images/my-collect.png"></image> <image src="../../images/my-collect.png"></image>
<view class="title">我的收藏</view> <view class="title">我的收藏</view>
</view> </view>
<view class="main-box"> <view class="main-box" bindtap="toMyTeam">
<image src="../../images/share.png"></image> <image src="../../images/share.png"></image>
<view class="title" bindtap="toMyTeam">我的志愿团队</view> <view class="title">我的志愿团队</view>
</view> </view>
<view class="main-box"> <view class="main-box" bindtap="toMyVolunteerActivity">
<image src="../../images/team.png"></image> <image src="../../images/team.png"></image>
<view class="title" bindtap="toMyVolunteerActivity">我的志愿活动</view> <view class="title">我的志愿活动</view>
</view> </view>
<view class="main-box"> <view class="main-box">
<image src="../../images/share.png"></image> <image src="../../images/share.png"></image>

View File

@ -1,13 +1,13 @@
// pages/volunteer/volunteer.js // pages/volunteer/volunteer.js
var app = getApp();
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
baseUrl: 'http://192.168.0.111:8888/volunteer/',
token: '', token: '',
otherTeamMap: {}, dataMap: {},
type: '1', type: '1',
teamId: '', teamId: '',
@ -31,33 +31,53 @@ Page({
url: '../newTeam/newTeam', url: '../newTeam/newTeam',
}) })
}, },
goDetail: function (e) {
var id = e.currentTarget.dataset.id;
wx.navigateTo({
url: '../serviceActivityDetail/serviceActivityDetail?id=' + id
})
},
newActivity: function () {
wx.navigateTo({
url: '../newVolunteerActivity/newVolunteerActivity',
})
},
changeTab: function(e) { changeTab: function(e) {
var self = this; var self = this;
self.setData({ self.setData({
type: e.currentTarget.dataset.type type: e.currentTarget.dataset.type
}) })
if(self.data.type === '1') { if(self.data.type === '1') {
self.otherTeam(self.data.baseUrl + 'wxminiapp/team/otherteamm?otherTeam=true'); // 我发起的活动
self.myActivity(app.volunteerUrl + 'wxminiapp/volunteerservice/listpagevolunteerservice');
}else { }else {
self.otherTeam(self.data.baseUrl + 'wxminiapp/team/myjointeam?myTeam=true'); // 我参加的活动
self.myActivity(app.volunteerUrl + 'wxminiapp/volunteerservice/listpagemyjoinservice');
} }
}, },
otherTeam: function(url) { myActivity: function(url) {
var self = this; var self = this;
wx.request({ app.restAjax.get(app.restAjax.path(url, []),
url: url, {}, {
header: { headers: {
token: self.data.token token: self.data.token
}, }
success(res) { }, function(code, data) {
if('200' == res.statusCode) { if('200' == code) {
for(var item of data.rows) {
if('' != item.photo) {
var photoArr = item.photo.split(",");
item.photo = app.volunteerUrl + 'route/file/downloadfile/true/' + photoArr[0];
}
}
self.setData({ self.setData({
otherTeamMap: res.data.rows dataMap: data.rows
}) })
} }
console.log(res) }, function(code, data) {
console.log(self.data.otherTeamMap) app.dialog.msg(data.msg);
} }, function() {
}) })
}, },
/** /**
@ -73,45 +93,42 @@ Page({
var methodType; var methodType;
var title; var title;
if('1' == self.data.type) { if('1' == self.data.type) {
url = self.data.baseUrl + 'wxminiapp/teammember/saveteammember' url = app.volunteerUrl + 'wxminiapp/teammember/saveteammember'
teamMemberVO = { teamMemberVO = {
teamId: e.currentTarget.dataset.teamid teamId: e.currentTarget.dataset.teamid
} }
methodType = 'POST' methodType = app.restAjax.post
title = '申请成功!' title = '申请成功!'
}else { }else {
url = self.data.baseUrl + 'wxminiapp/teammember/quitTeam/' + self.data.teamId url = app.volunteerUrl + 'wxminiapp/teammember/quitTeam/' + self.data.teamId
methodType = 'GET' methodType = app.restAjax.get
title = '退出成功!' title = '退出成功!'
} }
wx.request({
url: url, methodType(app.restAjax.path(url, []),
data: teamMemberVO, teamMemberVO, {
method: methodType, headers: {
header: {
token: self.data.token token: self.data.token
}, }
success(res) { }, function(code, data) {
if('200' == res.statusCode) { if('200' == code) {
wx.showToast({ app.dialog.msg(title);
title: title,
icon: 'none',
duration: 2000
})
wx.navigateTo({ wx.navigateTo({
url: '../volunteer/volunteer', url: '../volunteer/volunteer',
}) })
} }
} }, function(code, data) {
app.dialog.msg(data.msg);
}, function() {
}) })
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
var self = this;
this.getToken().then(result => { this.getToken().then(result => {
this.otherTeam(self.data.baseUrl + 'wxminiapp/team/otherteamm?otherTeam=true'); this.myActivity(app.volunteerUrl + 'wxminiapp/volunteerservice/listpagevolunteerservice');
}) })
}, },

View File

@ -1,30 +1,30 @@
<view class="top-tab"> <view class="top-tab">
<view class="tab-box {{type==1?'active':''}}" data-type="1" bindtap="changeTab"> <view class="tab-box {{type==1?'active':''}}" data-type="1" bindtap="changeTab">
<image src="../../images/selected-l.png" class="selected-l"></image> <image src="../../images/selected-l.png" class="selected-l"></image>
未参加 我发起
<image src="../../images/selected-r.png" class="selected-r"></image> <image src="../../images/selected-r.png" class="selected-r"></image>
</view> </view>
<view class="tab-box {{type==2?'active':''}}" data-type="2" bindtap="changeTab"> <view class="tab-box {{type==2?'active':''}}" data-type="2" bindtap="changeTab">
<image src="../../images/selected-l.png" class="selected-l"></image> <image src="../../images/selected-l.png" class="selected-l"></image>
参加 参加
<image src="../../images/selected-r.png" class="selected-r"></image> <image src="../../images/selected-r.png" class="selected-r"></image>
</view> </view>
</view> </view>
<view class="team"> <view class="volunteer-activity">
<view class="team-box" wx:for="{{otherTeamMap}}" data-id="{{item.teamId}}"> <view class="activity">
<view class="name-join"> <view class="activity-box" bindtap="goDetail" data-id="{{item.volunteerServiceId}}" wx:for="{{dataMap}}">
<view class="name">{{item.teamName}}</view> <view class="activity-img">
<view class="join" wx:if="{{item.checkStatus == '' && type == 1}}" data-teamid="{{item.teamId}}" bindtap="joinOrOutTeam">申请加入</view> <image src="{{item.photo}}"></image>
<view class="join" wx:if="{{item.checkStatus == '' && type == 2}}" data-teamid="{{item.teamId}}" bindtap="joinOrOutTeam">退出</view> </view>
<view class="join" wx:if="{{item.checkStatus != '' && item.checkStatus == '0'}}">待审核</view> <view class="activity-info">
<view class="join" wx:if="{{item.checkStatus != '' && item.checkStatus == '1'}}" bindtap="joinOrOutTeam">退出</view> <view class="title">
<view class="join" wx:if="{{item.checkStatus != '' && item.checkStatus == '2'}}">审核驳回</view> <view class="activity-title">{{item.serviceName}}</view>
<view class="join" wx:if="{{item.checkStatus != '' && item.checkStatus == '3'}}">已退出 </view> </view>
<view class="date">{{item.startTime}}至{{item.endTime}}</view>
</view>
</view> </view>
<view class="slogan">团队口号:{{item.teamWatchword}}</view>
<view class="area">所属区域:{{item.teamCityDictionaryName}} {{item.teamCountyDictionaryName}} {{item.teamAreaDictionaryName}}</view>
</view> </view>
</view> </view>
<view class="new-team"> <view class="new-team">
<view class="new-team-btn" bindtap="newTeam">创建新团队</view> <view class="new-team-btn" bindtap="newActivity">发起新活动</view>
</view> </view>

View File

@ -92,3 +92,46 @@
background: #9F1512; background: #9F1512;
border-radius: 10rpx; border-radius: 10rpx;
} }
.volunteer-activity{
margin-top: 90rpx;
padding: 0 30rpx;
margin-bottom: 105rpx;
}
.activity{
padding: 20rpx 30rpx 0;
}
.activity-box{
margin-bottom: 20rpx;
box-shadow:0px 0px 17rpx 0px rgba(0,0,0,0.1);
border-radius: 10rpx;
overflow: hidden;
}
.activity-img{
height: 320rpx;
position: relative;
}
.activity-img image{
width: 100%;
height: 100%;
}
.activity-info{
padding: 15rpx 20rpx;
}
.title{
display: flex;
justify-content: space-between;
}
.activity-title{
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 30rpx;
color: #242424;
line-height: 40rpx;
}
.date{
margin-top: 10rpx;
font-size: 22rpx;
color: #242424;
}

View File

@ -1,11 +1,11 @@
// pages/volunteer/volunteer.js // pages/volunteer/volunteer.js
var app = getApp();
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
baseUrl: 'http://192.168.0.111:8888/volunteer/',
token: '', token: '',
otherTeamMap: {}, otherTeamMap: {},
type: '1', type: '1',
@ -31,33 +31,23 @@ Page({
url: '../newTeam/newTeam', url: '../newTeam/newTeam',
}) })
}, },
changeTab: function(e) {
var self = this;
self.setData({
type: e.currentTarget.dataset.type
})
if(self.data.type === '1') {
self.otherTeam(self.data.baseUrl + 'wxminiapp/team/otherteamm?otherTeam=true');
}else {
self.otherTeam(self.data.baseUrl + 'wxminiapp/team/myjointeam?myTeam=true');
}
},
otherTeam: function(url) { otherTeam: function(url) {
var self = this; var self = this;
wx.request({ app.restAjax.get(app.restAjax.path(url, []),
url: url, {}, {
header: { headers: {
token: self.data.token token: self.data.token
}, }
success(res) { }, function(code, data) {
if('200' == res.statusCode) { if('200' == code) {
self.setData({ self.setData({
otherTeamMap: res.data.rows otherTeamMap: data.rows
}) })
} }
console.log(res) }, function(code, data) {
console.log(self.data.otherTeamMap) app.dialog.msg(data.msg);
} }, function() {
}) })
}, },
/** /**
@ -73,45 +63,42 @@ Page({
var methodType; var methodType;
var title; var title;
if('1' == self.data.type) { if('1' == self.data.type) {
url = self.data.baseUrl + 'wxminiapp/teammember/saveteammember' url = app.volunteerUrl + 'wxminiapp/teammember/saveteammember'
teamMemberVO = { teamMemberVO = {
teamId: e.currentTarget.dataset.teamid teamId: e.currentTarget.dataset.teamid
} }
methodType = 'POST' methodType = app.restAjax.post
title = '申请成功!' title = '申请成功!'
}else { }else {
url = self.data.baseUrl + 'wxminiapp/teammember/quitTeam/' + self.data.teamId url = app.volunteerUrl + 'wxminiapp/teammember/quitTeam/' + self.data.teamId
methodType = 'GET' methodType = app.restAjax.get
title = '退出成功!' title = '退出成功!'
} }
wx.request({
url: url, methodType(app.restAjax.path(url, []),
data: teamMemberVO, teamMemberVO, {
method: methodType, headers: {
header: {
token: self.data.token token: self.data.token
}, }
success(res) { }, function(code, data) {
if('200' == res.statusCode) { if('200' == code) {
wx.showToast({ app.dialog.msg(title);
title: title,
icon: 'none',
duration: 2000
})
wx.navigateTo({ wx.navigateTo({
url: '../volunteer/volunteer', url: '../volunteer/volunteer',
}) })
} }
} }, function(code, data) {
app.dialog.msg(data.msg);
}, function() {
}) })
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
var self = this;
this.getToken().then(result => { this.getToken().then(result => {
this.otherTeam(self.data.baseUrl + 'wxminiapp/team/otherteamm?otherTeam=true'); this.otherTeam(app.volunteerUrl + 'wxminiapp/team/myteamm');
}) })
}, },

View File

@ -1,15 +1,3 @@
<view class="top-tab">
<view class="tab-box {{type==1?'active':''}}" data-type="1" bindtap="changeTab">
<image src="../../images/selected-l.png" class="selected-l"></image>
未参加
<image src="../../images/selected-r.png" class="selected-r"></image>
</view>
<view class="tab-box {{type==2?'active':''}}" data-type="2" bindtap="changeTab">
<image src="../../images/selected-l.png" class="selected-l"></image>
已参加
<image src="../../images/selected-r.png" class="selected-r"></image>
</view>
</view>
<view class="team"> <view class="team">
<view class="team-box" wx:for="{{otherTeamMap}}" data-id="{{item.teamId}}"> <view class="team-box" wx:for="{{otherTeamMap}}" data-id="{{item.teamId}}">
<view class="name-join"> <view class="name-join">
@ -25,6 +13,3 @@
<view class="area">所属区域:{{item.teamCityDictionaryName}} {{item.teamCountyDictionaryName}} {{item.teamAreaDictionaryName}}</view> <view class="area">所属区域:{{item.teamCityDictionaryName}} {{item.teamCountyDictionaryName}} {{item.teamAreaDictionaryName}}</view>
</view> </view>
</view> </view>
<view class="new-team">
<view class="new-team-btn" bindtap="newTeam">创建新团队</view>
</view>

View File

@ -39,9 +39,7 @@
right: 100rpx; right: 100rpx;
} }
.team{ .team{
margin-top: 90rpx;
padding: 0 30rpx; padding: 0 30rpx;
margin-bottom: 110rpx;
} }
.team-box{ .team-box{
padding: 20rpx 0; padding: 20rpx 0;

View File

@ -1,11 +1,11 @@
// pages/newTeam/newTeam.js // pages/newTeam/newTeam.js
var app = getApp();
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
baseUrl: 'http://192.168.0.111:8888/volunteer/',
isAgree: false, // 是否同意志愿者注册协议 isAgree: false, // 是否同意志愿者注册协议
index: 0, index: 0,
array: ['区域1','区域2','区域3','区域4'], array: ['区域1','区域2','区域3','区域4'],
@ -63,26 +63,24 @@ Page({
wx.chooseImage({ wx.chooseImage({
success (res) { success (res) {
const tempFilePaths = res.tempFilePaths const tempFilePaths = res.tempFilePaths
wx.uploadFile({ console.log(tempFilePaths)
url: self.data.baseUrl + 'app/file/uploadimage', app.restAjax.file(app.restAjax.path(app.volunteerUrl + 'app/file/uploadimage', []), tempFilePaths[0],
filePath: tempFilePaths[0], 'image', {
name: 'image', headers: {
header: { token: self.data.token
'token': self.data.token }
}, }, function(code, data) {
formData: { if('200' == code) {
'image': tempFilePaths[0] var data = data.substr(9, data.length);
},
success (res){
var data = res.data.substr(9, res.data.length);
data = data.substr(0, data.length - 2); data = data.substr(0, data.length - 2);
self.setData({ self.setData({
photo: data photo: data
}) })
},
fail: function(res) {
console.log(res)
} }
}, function(code, data) {
app.dialog.msg(data.msg)
}, function() {
}) })
} }
}) })
@ -186,27 +184,22 @@ Page({
self.data.teamArea[self.data.teamAreaIndex].dictionaryId : self.data.teamArea[self.data.teamAreaIndex].dictionaryId :
'', '',
}; };
wx.request({ app.restAjax.post(app.restAjax.path(app.volunteerUrl + 'wxminiapp/team/saveteam', []),
url: self.data.baseUrl + 'wxminiapp/team/saveteam', teamVO, {
method: 'POST', headers: {
header: {
'token': self.data.token 'token': self.data.token
}, }
data: teamVO, }, function(code, data) {
success(res) { if('200' == code) {
if(res.statusCode == 200) { app.dialog.msg('注册成功')
wx.showToast({
title: '注册成功!',
icon: 'none',
duration: 1500
})
wx.navigateTo({ wx.navigateTo({
url: '../volunteer/volunteer', url: '../volunteer/volunteer',
}) })
}else {
console.log('登陆失败!' + res.errMsg);
}
} }
}, function(code, data) {
app.dialog.msg(data.msg)
}, function() {
}) })
}, },
/** /**
@ -215,16 +208,15 @@ Page({
getDataFromDict: function(dictId, type) { getDataFromDict: function(dictId, type) {
var self = this; var self = this;
return new Promise(resolve => { return new Promise(resolve => {
wx.request({ app.restAjax.get(app.restAjax.path(app.volunteerUrl + 'app/datadictionary/listdictionarybyparentid/' + dictId, []),
url: self.data.baseUrl + 'app/datadictionary/listdictionarybyparentid/' + dictId, {}, {
header: { headers: {
'token': self.data.token token: self.data.token
}, }
success: function(res) { }, function(code, data) {
if('200' == res.statusCode) { if('200' == code) {
if(res.data || type === 2) {
var array = []; var array = [];
for(var item of res.data) { for(var item of data) {
delete item.dictionaryParentId; delete item.dictionaryParentId;
delete item.dictionaryParentName; delete item.dictionaryParentName;
delete item.dictionarySummary; delete item.dictionarySummary;
@ -240,11 +232,13 @@ Page({
}) })
} }
self.setData({ self.setData({
tempObj: res.data tempObj: data
}) })
}
return resolve(); return resolve();
} }, function() {
}, function() {
}) })
}) })
}, },

View File

@ -1,4 +1,5 @@
// pages/newVolunteerActivity/newVolunteerActivity.js // pages/newVolunteerActivity/newVolunteerActivity.js
var app = getApp();
var util = require('../../utils/util.js'); var util = require('../../utils/util.js');
Page({ Page({
@ -6,7 +7,6 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
baseUrl: 'http://192.168.0.111:8888/volunteer/',
token: '', token: '',
startDate: '', startDate: '',
endDate: '', endDate: '',
@ -89,26 +89,23 @@ Page({
wx.chooseImage({ wx.chooseImage({
success (res) { success (res) {
const tempFilePaths = res.tempFilePaths const tempFilePaths = res.tempFilePaths
wx.uploadFile({ app.restAjax.file(app.restAjax.path(app.volunteerUrl + 'app/file/uploadimage', []), tempFilePaths[0],
url: self.data.baseUrl + 'app/file/uploadimage', 'image', {
filePath: tempFilePaths[0], headers: {
name: 'image', token: self.data.token
header: { }
'token': self.data.token }, function(code, data) {
}, if('200' == code) {
formData: { var data = data.substr(9, data.length);
'image': tempFilePaths[0]
},
success (res){
var data = res.data.substr(9, res.data.length);
data = data.substr(0, data.length - 2); data = data.substr(0, data.length - 2);
self.setData({ self.setData({
photo: data photo: data
}) })
},
fail: function(res) {
console.log(res)
} }
}, function(code, data) {
app.dialog.msg(data.msg)
}, function() {
}) })
} }
}) })
@ -163,7 +160,6 @@ Page({
}) })
return false; return false;
} }
console.log(self.data.startDate)
var volunteerServiceVO = { var volunteerServiceVO = {
serviceName: self.data.serviceName, serviceName: self.data.serviceName,
serviceContent: self.data.serviceContent, serviceContent: self.data.serviceContent,
@ -179,27 +175,22 @@ Page({
photo: self.data.photo, photo: self.data.photo,
serviceRequirement: self.data.serviceRequirement serviceRequirement: self.data.serviceRequirement
}; };
wx.request({ app.restAjax.post(app.restAjax.path(app.volunteerUrl + 'wxminiapp/volunteerservice/savevolunteerservice', []),
url: self.data.baseUrl + 'wxminiapp/volunteerservice/savevolunteerservice', volunteerServiceVO, {
method: 'POST', headers: {
header: {
'token': self.data.token 'token': self.data.token
}, }
data: volunteerServiceVO, }, function(code, data) {
success(res) { if('200' == code) {
if(res.statusCode == 200) { app.dialog.msg('活动发布成功!');
wx.showToast({
title: '活动发布成功!',
icon: 'none',
duration: 1500
})
wx.navigateTo({ wx.navigateTo({
url: '../volunteer/volunteer', url: '../volunteer/volunteer',
}) })
}else {
console.log('登陆失败!' + res.errMsg);
}
} }
}, function(code, data) {
app.dialog.msg(data.msg);
}, function() {
}) })
}, },
/** /**

View File

@ -1,12 +1,11 @@
// pages/activityDetail/activityDetail.js // pages/activityDetail/activityDetail.js
var app = getApp();
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
baseUrl: 'http://192.168.0.111:8888/volunteer/',
imgUrl: 'http://192.168.0.111:8888/volunteer/route/file/downloadfile/true/',
dataMap: {}, dataMap: {},
token: '', token: '',
serviceId: '', serviceId: '',
@ -33,19 +32,22 @@ Page({
}, },
getDetail: function(id) { getDetail: function(id) {
var self = this; var self = this;
wx.request({ app.restAjax.get(app.restAjax.path(app.volunteerUrl + 'wxminiapp/volunteerservice/getvolunteerservicebyid/' + id, []),
url: self.data.baseUrl + 'wxminiapp/volunteerservice/getvolunteerservicebyid/' + id, {}, {
header: { headers: {
'token': self.data.token 'token': self.data.token
}, }
success: function(res) { }, function(code, data) {
if('200' == res.statusCode) { if('200' == code) {
res.data.photo = self.data.imgUrl + res.data.photo; data.photo = app.volunteerUrl + 'route/file/downloadfile/true/' + data.photo;
self.setData({ self.setData({
dataMap: res.data dataMap: data
}) })
} }
} }, function() {
}, function() {
}) })
}, },
/** /**
@ -128,25 +130,22 @@ Page({
*/ */
sendEnrollRequest: function(serviceMemberVO) { sendEnrollRequest: function(serviceMemberVO) {
var self = this; var self = this;
wx.request({ app.restAjax.post(app.restAjax.path(app.volunteerUrl + 'wxminiapp/servicemember/saveservicemember', []),
url: self.data.baseUrl + 'wxminiapp/servicemember/saveservicemember', serviceMemberVO, {
method: 'POST', headers: {
header: {
token: self.data.token token: self.data.token
}, }
data: serviceMemberVO, }, function(code, data) {
success(res) { if('200' == code) {
if(res.statusCode == 200) { app.dialog.msg('注册成功!');
wx.showToast({
title: '报名成功!',
icon: 'none',
duration: 1500
})
wx.navigateTo({ wx.navigateTo({
url: '../volunteer/volunteer', url: '../volunteer/volunteer',
}) })
} }
} }, function() {
}, function() {
}) })
}, },
/** /**
@ -156,30 +155,26 @@ Page({
var self = this; var self = this;
var url; var url;
if(self.data.teamArray.length > 0) { if(self.data.teamArray.length > 0) {
url = self.data.baseUrl + 'wxminiapp/servicemember/cancelapply/'+ self.data.type +'/'+ self.data.serviceId +'/' + self.data.team[self.data.teamIndex].teamId; url = app.volunteerUrl + 'wxminiapp/servicemember/cancelapply/'+ self.data.type +'/'+ self.data.serviceId +'/' + self.data.team[self.data.teamIndex].teamId;
}else { }else {
url = self.data.baseUrl + 'wxminiapp/servicemember/cancelapply/'+ self.data.type +'/'+ self.data.serviceId +'/null'; url = app.volunteerUrl + 'wxminiapp/servicemember/cancelapply/'+ self.data.type +'/'+ self.data.serviceId +'/null';
} }
wx.request({
url: url, app.restAjax.get(app.restAjax.path(url, []), {}, {
header: { headers: {
token: self.data.token token: self.data.token
}, }
success(res) { }, function(code, data) {
if(res.statusCode == 200) { if('200' == code) {
wx.showToast({ app.dialog.msg('取消报名成功!');
title: '取消报名成功!',
icon: 'none',
duration: 1500
})
wx.navigateTo({ wx.navigateTo({
url: '../volunteer/volunteer', url: '../volunteer/volunteer',
}) })
} }
}, }, function() {
fail(res) {
}, function() {
}
}) })
}, },
/** /**
@ -187,15 +182,16 @@ Page({
*/ */
getMyTeam: function() { getMyTeam: function() {
var self = this; var self = this;
wx.request({ console.log(self.data.token)
url: self.data.baseUrl + 'wxminiapp/team/myteamm', app.restAjax.get(app.restAjax.path(app.volunteerUrl + 'wxminiapp/team/myteamm', []),
header: { {}, {
headers: {
token: self.data.token token: self.data.token
}, }
success(res) { }, function(code, data) {
if('200' == res.statusCode) { if('200' == code) {
var array = []; var array = [];
for(var item of res.data.rows) { for(var item of data.rows) {
delete item.teamArea; delete item.teamArea;
delete item.teamAreaDictionaryName; delete item.teamAreaDictionaryName;
delete item.teamWatchword; delete item.teamWatchword;
@ -219,10 +215,13 @@ Page({
} }
self.setData({ self.setData({
teamArray: array, teamArray: array,
team: res.data.rows team: data.rows
}) })
} }
} }, function(code, data) {
app.dialog.msg(data.msg);
}, function() {
}) })
}, },
/** /**

View File

@ -1,4 +1,5 @@
// pages/volunteer/volunteer.js // pages/volunteer/volunteer.js
var app = getApp();
Page({ Page({
/** /**
@ -7,8 +8,6 @@ Page({
data: { data: {
indicatorDots: true, indicatorDots: true,
autoplay: true, autoplay: true,
baseUrl: 'http://192.168.0.111:8888/volunteer/',
imgUrl: 'http://192.168.0.111:8888/volunteer/route/file/downloadfile/true/',
serviceMap: [] serviceMap: []
}, },
goDetail: function (e) { goDetail: function (e) {
@ -37,22 +36,24 @@ Page({
*/ */
activityList: function() { activityList: function() {
var self = this; var self = this;
wx.request({ app.restAjax.get(app.restAjax.path(app.volunteerUrl + 'wxminiapp/volunteerservice/listpagevolunteerservicerelease', []),
url: self.data.baseUrl + 'wxminiapp/volunteerservice/listpagevolunteerservicerelease', {}, null, function(code, data) {
success: function(res) { if('200' == code) {
if('200' == res.statusCode) {
// 将活动照片,拼接为可访问地址 // 将活动照片,拼接为可访问地址
for(var item of res.data.rows) { for(var item of data.rows) {
if('' != item.photo) { if('' != item.photo) {
var photoArr = item.photo.split(","); var photoArr = item.photo.split(",");
item.photo = self.data.imgUrl + photoArr[0]; item.photo = app.volunteerUrl + 'route/file/downloadfile/true/' + photoArr[0];
} }
} }
self.setData({ self.setData({
serviceMap: res.data.rows serviceMap: data.rows
}) })
} }
} }, function() {
}, function() {
}) })
}, },
/** /**

View File

@ -1,11 +1,11 @@
// pages/volunteerRegister/volunteerRegister.js // pages/volunteerRegister/volunteerRegister.js
var app = getApp();
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
baseUrl: 'http://192.168.0.111:8888/volunteer/',
token: '', token: '',
isAgree: false, // 是否同意志愿者注册协议 isAgree: false, // 是否同意志愿者注册协议
openExperience: 0, openExperience: 0,
@ -103,6 +103,12 @@ Page({
} }
}) })
}, },
areaChange: function(e) {
var self = this;
self.setData({
teamAreaIndex: e.detail.value
})
},
changeOpen: function(e) { changeOpen: function(e) {
if(e.detail.value == ''){ if(e.detail.value == ''){
this.setData({ this.setData({
@ -197,27 +203,22 @@ Page({
agree: self.data.isAgree, agree: self.data.isAgree,
openExperience : self.data.openExperience openExperience : self.data.openExperience
}; };
wx.request({ app.restAjax.post(app.restAjax.path(app.volunteerUrl + 'wxminiapp/volunteer/savevolunteer', []),
url: self.data.baseUrl + 'wxminiapp/volunteer/savevolunteer', volunteerVO, {
method: 'POST', headers: {
header: {
'token': self.data.token 'token': self.data.token
}, }
data: volunteerVO, }, function(code, data) {
success(res) { if('200' == code) {
if(res.statusCode == 200) { app.dialog.msg('注册成功!');
wx.showToast({
title: '注册成功!',
icon: 'none',
duration: 1500
})
wx.navigateTo({ wx.navigateTo({
url: '../volunteer/volunteer', url: '../volunteer/volunteer',
}) })
}else {
console.log('登陆失败!' + res.errMsg);
}
} }
}, function(code, data) {
app.dialog.msg(data.msg);
}, function() {
}) })
}, },
/** /**
@ -226,16 +227,16 @@ Page({
getDataFromDict: function(dictId, type) { getDataFromDict: function(dictId, type) {
var self = this; var self = this;
return new Promise(resolve => { return new Promise(resolve => {
wx.request({ app.restAjax.get(app.restAjax.path(app.volunteerUrl + 'app/datadictionary/listdictionarybyparentid/' + dictId, []),
url: self.data.baseUrl + 'app/datadictionary/listdictionarybyparentid/' + dictId, {}, {
header: { headers: {
'token': self.data.token 'token': self.data.token
}, }
success: function(res) { }, function(code, data) {
if('200' == res.statusCode) { if('200' == code) {
if(res.data || type === 2) { if(data || type === 2) {
var array = []; var array = [];
for(var item of res.data) { for(var item of data) {
delete item.dictionaryParentId; delete item.dictionaryParentId;
delete item.dictionaryParentName; delete item.dictionaryParentName;
delete item.dictionarySummary; delete item.dictionarySummary;
@ -251,11 +252,14 @@ Page({
}) })
} }
self.setData({ self.setData({
tempObj: res.data tempObj: data
}) })
} }
return resolve(); return resolve();
} }, function() {
}, function() {
}) })
}) })
}, },

View File

@ -40,7 +40,7 @@
<view class="info-name">乡镇村:</view> <view class="info-name">乡镇村:</view>
<view class="info-text"> <view class="info-text">
<view class="section"> <view class="section">
<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>

View File

@ -1,11 +1,11 @@
// pages/volunteer/volunteer.js // pages/volunteer/volunteer.js
var app = getApp();
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
baseUrl: 'http://192.168.0.111:8888/volunteer/',
token: '', token: '',
otherTeamMap: {}, otherTeamMap: {},
type: '1', type: '1',
@ -37,27 +37,28 @@ Page({
type: e.currentTarget.dataset.type type: e.currentTarget.dataset.type
}) })
if(self.data.type === '1') { if(self.data.type === '1') {
self.otherTeam(self.data.baseUrl + 'wxminiapp/team/otherteamm?otherTeam=true'); self.otherTeam(app.volunteerUrl + 'wxminiapp/team/otherteamm?otherTeam=true');
}else { }else {
self.otherTeam(self.data.baseUrl + 'wxminiapp/team/myjointeam?myTeam=true'); self.otherTeam(app.volunteerUrl + 'wxminiapp/team/myjointeam?myTeam=true');
} }
}, },
otherTeam: function(url) { otherTeam: function(url) {
var self = this; var self = this;
wx.request({ app.restAjax.get(app.restAjax.path(url, []),
url: url, {}, {
header: { headers: {
token: self.data.token token: self.data.token
}, }
success(res) { }, function(code, data) {
if('200' == res.statusCode) { if('200' == code) {
self.setData({ self.setData({
otherTeamMap: res.data.rows otherTeamMap: data.rows
}) })
} }
console.log(res) }, function(code, data) {
console.log(self.data.otherTeamMap) app.dialog.msg(data.msg);
} }, function() {
}) })
}, },
/** /**
@ -73,45 +74,42 @@ Page({
var methodType; var methodType;
var title; var title;
if('1' == self.data.type) { if('1' == self.data.type) {
url = self.data.baseUrl + 'wxminiapp/teammember/saveteammember' url = app.volunteerUrl + 'wxminiapp/teammember/saveteammember'
teamMemberVO = { teamMemberVO = {
teamId: e.currentTarget.dataset.teamid teamId: e.currentTarget.dataset.teamid
} }
methodType = 'POST' methodType = app.restAjax.post
title = '申请成功!' title = '申请成功!'
}else { }else {
url = self.data.baseUrl + 'wxminiapp/teammember/quitTeam/' + self.data.teamId url = app.volunteerUrl + 'wxminiapp/teammember/quitTeam/' + self.data.teamId
methodType = 'GET' methodType = app.restAjax.get
title = '退出成功!' title = '退出成功!'
} }
wx.request({
url: url, methodType(app.restAjax.path(url, []),
data: teamMemberVO, teamMemberVO, {
method: methodType, headers: {
header: {
token: self.data.token token: self.data.token
}, }
success(res) { }, function(code, data) {
if('200' == res.statusCode) { if('200' == code) {
wx.showToast({ app.dialog.msg(title);
title: title,
icon: 'none',
duration: 2000
})
wx.navigateTo({ wx.navigateTo({
url: '../volunteer/volunteer', url: '../volunteer/volunteer',
}) })
} }
} }, function(code, data) {
app.dialog.msg(data.msg);
}, function() {
}) })
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
var self = this;
this.getToken().then(result => { this.getToken().then(result => {
this.otherTeam(self.data.baseUrl + 'wxminiapp/team/otherteamm?otherTeam=true'); this.otherTeam(app.volunteerUrl + 'wxminiapp/team/otherteamm?otherTeam=true');
}) })
}, },