Commit 95d72f74 by biao

11

parent 5f165f64
...@@ -370,7 +370,7 @@ CREATE TABLE IF NOT EXISTS volunteer_event_member_dat( ...@@ -370,7 +370,7 @@ CREATE TABLE IF NOT EXISTS volunteer_event_member_dat(
position_longitude text, position_longitude text,
position_latitude text, position_latitude text,
role int8 NOT NULL DEFAULT '0', role int8 NOT NULL DEFAULT '0',
time_length float(6,2) NOT NULL DEFAULT '0', time_length float(6,2) NOT NULL DEFAULT '0.00',
finish_time timestamp, finish_time timestamp,
status varchar(64) NOT NULL DEFAULT 'NEW', status varchar(64) NOT NULL DEFAULT 'NEW',
delete_flg tinyint(1) NOT NULL DEFAULT '0' delete_flg tinyint(1) NOT NULL DEFAULT '0'
......
...@@ -12,7 +12,7 @@ $eventId = ParamUtil::getRequestNumber("eventId", 0); ...@@ -12,7 +12,7 @@ $eventId = ParamUtil::getRequestNumber("eventId", 0);
$result = array(); $result = array();
//参数检查 //参数检查
if(empty($unionId)) { if(empty($unionId) || empty($eventId)) {
$result["message"] = "参数错误!"; $result["message"] = "参数错误!";
responseNG($result); responseNG($result);
} }
...@@ -38,7 +38,7 @@ $userMst = $userList[0]; ...@@ -38,7 +38,7 @@ $userMst = $userList[0];
//是否已经报名 //是否已经报名
$param = array(); $param = array();
$param['volunteer_event_id'] = $userMst->id; $param['volunteer_event_id'] = $eventId;
$param['user_id'] = $userMst->id; $param['user_id'] = $userMst->id;
$param['delete_flg'] = false; $param['delete_flg'] = false;
$tmpList = VolunteerEventMemberDat::getList($param, "id", "desc", 0, 1); $tmpList = VolunteerEventMemberDat::getList($param, "id", "desc", 0, 1);
...@@ -80,18 +80,18 @@ $param = array(); ...@@ -80,18 +80,18 @@ $param = array();
$param['circle_id'] = $circleDat->id; $param['circle_id'] = $circleDat->id;
$param['user_id_NOT'] = $userMst->id;//不包含自己 $param['user_id_NOT'] = $userMst->id;//不包含自己
$param['delete_flg'] = false; $param['delete_flg'] = false;
$tmpCircleMemberList = CircleMemberDat::getListCount($param); $tmpCircleMemberList = CircleMemberDat::getList($param);
if(!empty($tmpCircleMemberList)) { if(!empty($tmpCircleMemberList)) {
foreach(tmpCircleMemberList as $tmpCircleMember) { foreach($tmpCircleMemberList as $tmpCircleMember) {
$userMessageDat = new UserMessageDat(); $userMessageDat = new UserMessageDat();
$userMessageDat->user_id = $tmpCircleMember->user_id; $userMessageDat->user_id = $tmpCircleMember->user_id;
$userMessageDat->title = "活动参加邀请通知"; $userMessageDat->title = "活动参加邀请通知";
$userMessageDat->comment = "嘀嘀嘀!圈主邀请您参加活动,快点击进入,参加报名吧!"; $userMessageDat->comment = "嘀嘀嘀!圈主邀请您参加活动,快点击参加报名吧!";
//添加附件附件 //添加附件附件
$userMessageDat->attach_dat_type = "VOLUNTEER"; $userMessageDat->attach_dat_type = "VOLUNTEER";
$userMessageDat->attach_dat_id = $circleDat->id; $userMessageDat->attach_dat_id = $circleDat->id;
$userMessageDat->attach_dat_path = "pages/volunteersEventDetail/volunteersEventDetail?volunteersEventId={$volunteerDat->id}&circleId={$circleDat->id}"; $userMessageDat->attach_dat_path = "pages/volunteersEventDetail/volunteersEventDetail?eventId={$volunteerDat->id}&circleId={$circleDat->id}";
} }
} }
......
...@@ -13,7 +13,7 @@ $circleId = ParamUtil::getRequestNumber("circleId", 0);//受邀请参加的时 ...@@ -13,7 +13,7 @@ $circleId = ParamUtil::getRequestNumber("circleId", 0);//受邀请参加的时
$result = array(); $result = array();
//参数检查 //参数检查
if(empty($unionId)) { if(empty($unionId) || empty($eventId)) {
$result["message"] = "参数错误!"; $result["message"] = "参数错误!";
responseNG($result); responseNG($result);
} }
...@@ -39,7 +39,7 @@ $userMst = $userList[0]; ...@@ -39,7 +39,7 @@ $userMst = $userList[0];
//是否已经报名参加 //是否已经报名参加
$param = array(); $param = array();
$param['volunteer_event_id'] = $userMst->id; $param['volunteer_event_id'] = $eventId;
$param['user_id'] = $userMst->id; $param['user_id'] = $userMst->id;
$param['delete_flg'] = false; $param['delete_flg'] = false;
$tmpList = VolunteerEventMemberDat::getList($param, "id", "desc", 0, 1); $tmpList = VolunteerEventMemberDat::getList($param, "id", "desc", 0, 1);
......
...@@ -40,7 +40,7 @@ $userMst = $userList[0]; ...@@ -40,7 +40,7 @@ $userMst = $userList[0];
$isMember = false; $isMember = false;
$isComplete = false; $isComplete = false;
$param = array(); $param = array();
$param['volunteer_event_id'] = $userMst->id; $param['volunteer_event_id'] = $eventId;
$param['user_id'] = $userMst->id; $param['user_id'] = $userMst->id;
$param['delete_flg'] = false; $param['delete_flg'] = false;
$tmpList = VolunteerEventMemberDat::getList($param, "id", "desc", 0, 1); $tmpList = VolunteerEventMemberDat::getList($param, "id", "desc", 0, 1);
...@@ -63,7 +63,7 @@ if($tmpCount > 0) { ...@@ -63,7 +63,7 @@ if($tmpCount > 0) {
//报名是否已经结束 //报名是否已经结束
$isEnrollFinish = false; $isEnrollFinish = false;
if(date("Y-m-d H:i:s") <= $volunteerDat->enroll_time) { if(date("Y-m-d H:i:s") >= $volunteerDat->enroll_time) {
$isEnrollFinish = true; $isEnrollFinish = true;
} }
......
...@@ -8,6 +8,7 @@ Page({ ...@@ -8,6 +8,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
circleId: 0,
eventId:0, eventId:0,
active: 0, active: 0,
...@@ -27,9 +28,12 @@ Page({ ...@@ -27,9 +28,12 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
var that=this; var that=this;
if (options != null) {
that.setData({ that.setData({
circleId: options.circleId,
eventId: options.eventId eventId: options.eventId
}) })
}
var config = wx.getStorageSync('config'); var config = wx.getStorageSync('config');
wx.request({ wx.request({
url: app.url + 'ajax_get_volunteer_event_detail.php', url: app.url + 'ajax_get_volunteer_event_detail.php',
...@@ -53,20 +57,20 @@ Page({ ...@@ -53,20 +57,20 @@ Page({
circleMemberList: res.data.result.circleMemberList circleMemberList: res.data.result.circleMemberList
}) })
//按钮文字控制 //按钮文字控制
if(res.data.result.isMember==false){ if (res.data.result.isMember == false && res.data.result.isEnrollFinish==false){
that.setData({ that.setData({
menuText:'报名参加' menuText:'报名参加'
}) })
}else{ }
if(res.data.result.isEnrollFinish==false){ if (res.data.result.isMember == true && res.data.result.isEnrollFinish == false) {
that.setData({
menuText: '上传凭证'
})
}else{
that.setData({ that.setData({
menuText: '取消报名' menuText: '取消报名'
}) })
} }
if (res.data.result.isMember == true && res.data.result.isEnrollFinish == true && res.data.result.isComplete ==false) {
that.setData({
menuText: '上传凭证'
})
} }
} }
}, },
...@@ -93,14 +97,155 @@ Page({ ...@@ -93,14 +97,155 @@ Page({
onShareAppMessage: function () { onShareAppMessage: function () {
}, },
//点击切换
onChange(event) { onChange(event) {
}, },
//报名参加 //报名参加
btnBaoming(){ userAction(e){
var that = this;
var config = wx.getStorageSync('config'); var config = wx.getStorageSync('config');
//获取按钮上面的文字.
if (that.data.isCircleOwner && that.data.menuText =="报名参加") {
//圈主身份的时候报名处理,弹出选择对话框
Dialog.confirm({
title: '',
message: '检测到您为圈主,是否团队报名?',
confirmButtonText:'是',
cancelButtonText:'否'
}).then(() => {
//调用团队报名接口
wx.request({
url: app.url + 'ajax_attend_volunteer_event_circle.php',
data: {
unionId: config.unionId,
eventId: that.data.eventId,
circleId: that.data.circleId
},
header: { 'content-type': 'application/json' },
method: 'GET',
dataType: 'json',
success: function (res) {
console.log(res)
if (res.statusCode == 200) {
Notify({ type: 'success', message: res.data.result.message });
//如果报名成功则刷新本页面
if (res.data.status == "OK") {
that.onLoad();
}
}
},
fail: function (res) {
Notify({ type: 'danger', message: res.data.result.message });
},
complete: function (res) { },
})
}).catch(() => {
//调用个人报名接口
wx.request({
url: app.url + 'ajax_attend_volunteer_event_personal.php',
data: {
unionId: config.unionId,
eventId: that.data.eventId,
circleId: that.data.circleId
},
header: { 'content-type': 'application/json' },
method: 'GET',
dataType: 'json',
success: function (res) {
console.log(res)
if (res.statusCode == 200) {
Notify({ type: 'success', message: res.data.result.message });
//如果报名成功则刷新本页面
if (res.data.status == "OK") {
that.onLoad();
}
}
},
fail: function (res) {
Notify({ type: 'danger', message: res.data.result.message });
},
complete: function (res) { },
})
});
}
if (!that.data.isCircleOwner && that.data.menuText == "报名参加") {
//非圈主身份的时候个人报名处理
wx.request({
url: app.url +'ajax_attend_volunteer_event_personal.php',
data: {
unionId: config.unionId,
eventId: that.data.eventId,
circleId: that.data.circleId
},
header: { 'content-type': 'application/json'},
method: 'GET',
dataType: 'json',
success: function(res) {
console.log(res)
if(res.statusCode==200){
Notify({ type: 'success', message: res.data.result.message });
//如果报名成功则刷新本页面
if (res.data.status == "OK") {
that.onLoad();
}
}
},
fail: function(res) {
Notify({ type: 'danger', message: res.data.result.message });
},
complete: function(res) {},
})
}
if (that.data.menuText == "取消报名") {
//取消报名
wx.request({
url: app.url + 'ajax_cancel_volunteer_event.php',
data: {
unionId: config.unionId,
eventId: that.data.eventId
},
header: { 'content-type': 'application/json' },
method: 'GET',
dataType: 'json',
success: function (res) {
console.log(res)
if (res.statusCode == 200) {
Notify({ type: 'success', message: res.data.result.message });
//如果取消成功,跳转到活动首页
if (res.data.status =="OK") {
wx.redirectTo({
url: '../volunteers/volunteers?',
})
}
}
},
fail: function (res) {
Notify({ type: 'danger', message: res.data.result.message });
},
complete: function (res) { },
})
}
if (that.data.menuText == "上传凭证") {
//跳转到上传凭证页面
Dialog.confirm({
title: '标题',
message: '是否上传凭证?'
}).then(() => {
wx.navigateTo({
url: '../uploadDocuments/uploadDocuments',
})
}).catch(() => {
// on cancel
Notify({ type: 'danger', message: '取消报名' });
});
}
// if(this.data.zhuangtai=='报名参加'){ // if(this.data.zhuangtai=='报名参加'){
// if(this.data.isOwner==true){ // if(this.data.isOwner==true){
// Dialog.confirm({ // Dialog.confirm({
...@@ -157,17 +302,8 @@ Page({ ...@@ -157,17 +302,8 @@ Page({
// }); // });
// } // }
// } // }
Dialog.confirm({
title: '标题',
message: '是否上传凭证?'
}).then(() => {
wx.navigateTo({
url: '../uploadDocuments/uploadDocuments',
})
}).catch(() => {
// on cancel
Notify({ type: 'danger', message: '取消报名' });
});
// wx: wx.request({ // wx: wx.request({
// url: app.url + 'ajax_cancel_volunteer_event_personal.php', // url: app.url + 'ajax_cancel_volunteer_event_personal.php',
// header: { 'content-type': 'application/json' }, // header: { 'content-type': 'application/json' },
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</view> </view>
</van-tab> </van-tab>
</van-tabs> </van-tabs>
<view class='btnBaoming' bindtap='btnBaoming'>{{menuText}}</view> <view class='actionBtn' bindtap='userAction'>{{menuText}}</view>
</view> </view>
</view> </view>
<van-dialog id="van-dialog" /> <van-dialog id="van-dialog" />
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.btnBaoming{ .actionBtn{
width: 75%; width: 75%;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment