Commit 95d72f74 by biao

11

parent 5f165f64
......@@ -370,7 +370,7 @@ CREATE TABLE IF NOT EXISTS volunteer_event_member_dat(
position_longitude text,
position_latitude text,
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,
status varchar(64) NOT NULL DEFAULT 'NEW',
delete_flg tinyint(1) NOT NULL DEFAULT '0'
......
......@@ -12,7 +12,7 @@ $eventId = ParamUtil::getRequestNumber("eventId", 0);
$result = array();
//参数检查
if(empty($unionId)) {
if(empty($unionId) || empty($eventId)) {
$result["message"] = "参数错误!";
responseNG($result);
}
......@@ -38,7 +38,7 @@ $userMst = $userList[0];
//是否已经报名
$param = array();
$param['volunteer_event_id'] = $userMst->id;
$param['volunteer_event_id'] = $eventId;
$param['user_id'] = $userMst->id;
$param['delete_flg'] = false;
$tmpList = VolunteerEventMemberDat::getList($param, "id", "desc", 0, 1);
......@@ -80,18 +80,18 @@ $param = array();
$param['circle_id'] = $circleDat->id;
$param['user_id_NOT'] = $userMst->id;//不包含自己
$param['delete_flg'] = false;
$tmpCircleMemberList = CircleMemberDat::getListCount($param);
$tmpCircleMemberList = CircleMemberDat::getList($param);
if(!empty($tmpCircleMemberList)) {
foreach(tmpCircleMemberList as $tmpCircleMember) {
foreach($tmpCircleMemberList as $tmpCircleMember) {
$userMessageDat = new UserMessageDat();
$userMessageDat->user_id = $tmpCircleMember->user_id;
$userMessageDat->title = "活动参加邀请通知";
$userMessageDat->comment = "嘀嘀嘀!圈主邀请您参加活动,快点击进入,参加报名吧!";
$userMessageDat->comment = "嘀嘀嘀!圈主邀请您参加活动,快点击参加报名吧!";
//添加附件附件
$userMessageDat->attach_dat_type = "VOLUNTEER";
$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);//受邀请参加的时
$result = array();
//参数检查
if(empty($unionId)) {
if(empty($unionId) || empty($eventId)) {
$result["message"] = "参数错误!";
responseNG($result);
}
......@@ -39,7 +39,7 @@ $userMst = $userList[0];
//是否已经报名参加
$param = array();
$param['volunteer_event_id'] = $userMst->id;
$param['volunteer_event_id'] = $eventId;
$param['user_id'] = $userMst->id;
$param['delete_flg'] = false;
$tmpList = VolunteerEventMemberDat::getList($param, "id", "desc", 0, 1);
......
......@@ -40,7 +40,7 @@ $userMst = $userList[0];
$isMember = false;
$isComplete = false;
$param = array();
$param['volunteer_event_id'] = $userMst->id;
$param['volunteer_event_id'] = $eventId;
$param['user_id'] = $userMst->id;
$param['delete_flg'] = false;
$tmpList = VolunteerEventMemberDat::getList($param, "id", "desc", 0, 1);
......@@ -63,7 +63,7 @@ if($tmpCount > 0) {
//报名是否已经结束
$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;
}
......
......@@ -8,6 +8,7 @@ Page({
* 页面的初始数据
*/
data: {
circleId: 0,
eventId:0,
active: 0,
......@@ -27,9 +28,12 @@ Page({
*/
onLoad: function (options) {
var that=this;
if (options != null) {
that.setData({
circleId: options.circleId,
eventId: options.eventId
})
}
var config = wx.getStorageSync('config');
wx.request({
url: app.url + 'ajax_get_volunteer_event_detail.php',
......@@ -53,20 +57,20 @@ Page({
circleMemberList: res.data.result.circleMemberList
})
//按钮文字控制
if(res.data.result.isMember==false){
if (res.data.result.isMember == false && res.data.result.isEnrollFinish==false){
that.setData({
menuText:'报名参加'
})
}else{
if(res.data.result.isEnrollFinish==false){
that.setData({
menuText: '上传凭证'
})
}else{
}
if (res.data.result.isMember == true && res.data.result.isEnrollFinish == false) {
that.setData({
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({
onShareAppMessage: function () {
},
//点击切换
onChange(event) {
},
//报名参加
btnBaoming(){
userAction(e){
var that = this;
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.isOwner==true){
// Dialog.confirm({
......@@ -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({
// url: app.url + 'ajax_cancel_volunteer_event_personal.php',
// header: { 'content-type': 'application/json' },
......
......@@ -55,7 +55,7 @@
</view>
</van-tab>
</van-tabs>
<view class='btnBaoming' bindtap='btnBaoming'>{{menuText}}</view>
<view class='actionBtn' bindtap='userAction'>{{menuText}}</view>
</view>
</view>
<van-dialog id="van-dialog" />
......
......@@ -77,7 +77,7 @@
justify-content: center;
align-items: center;
}
.btnBaoming{
.actionBtn{
width: 75%;
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