diff --git a/pages/heartNew/heartNew.js b/pages/heartNew/heartNew.js index ecdd023..dafce99 100644 --- a/pages/heartNew/heartNew.js +++ b/pages/heartNew/heartNew.js @@ -62,6 +62,8 @@ Page({ scanBtn: {}, // 扫码签到改为可配置 shouye: {}, applyBtn: {}, // 申请发单改为可配置 + searchActive: '', // + searchJingcai: '', }, /** @@ -164,6 +166,8 @@ Page({ loadMoreVisible: false, loadMoreType: "none", indexPage: 1, + searchActive: '', + searchJingcai: '' }) if (e.currentTarget.dataset.tab == "tab0") { this.setData({ @@ -328,18 +332,43 @@ Page({ } this.volunteerlist(parms) }, - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { + bindInputValueActive (e) { + if ((this.data.selectedTab === "tab0")) { + this.setData({ + searchActive: e.detail.value.trim('') + }) + } else if (this.data.selectedTab === "tab2") { + this.setData({ + searchJingcai: e.detail.value.trim('') + }) + } }, - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - + searchActive () { + if ((this.data.selectedTab === "tab0")) { + let params = { + pageIndex: 1, + pageSize: 10, + timestamp: getTimestamp(), + actType: 0, + qkdat: true, + sponsor: this.data.searchActive, + selectedTab:this.data.selectedTab + } + this.selectComponent("#state-0").getActivityList(params) + } else if (this.data.selectedTab === "tab2") { + let params = { + pageIndex: 1, + pageSize: 10, + timestamp: getTimestamp(), + actType: 1, + qkdat: true, + sponsor: this.data.searchJingcai, + selectedTab:this.data.selectedTab + } + this.selectComponent("#state-2").getActivityList(params) + } }, /** diff --git a/pages/heartNew/heartNew.wxml b/pages/heartNew/heartNew.wxml index 3b3c3db..5e3560e 100644 --- a/pages/heartNew/heartNew.wxml +++ b/pages/heartNew/heartNew.wxml @@ -85,6 +85,20 @@ @@ -92,13 +106,15 @@ 志愿者注册数:{{volunteerCount}} - - - - - + + + + + + + + - @@ -115,6 +131,20 @@ res.data.actEndTime.substring(0, 16) ? true : false, - preloadVisible: false + preloadVisible: false, + sponsor: res.data.sponsor }) } }).catch(err => { @@ -106,7 +113,8 @@ Page({ url: `../clockIn/clockIn?id=${id}¤tUserStatus=${currentUserStatus}` }) }, - goVolunteer (e) { //我要报名 用户认证志愿者标识(0-未认证,1-已认证) + goVolunteer (e) { + // 我要报名 用户认证志愿者标识(0-未认证,1-已认证) // 0-待审核 提醒用户志愿者身份认证审核中,不能报名也不用去认证 // 1 - 认证通过 直接报名 // 2 - 待认证 提示用户去认证 @@ -124,7 +132,9 @@ Page({ // dialogCancelText: '' // }) this.setData({ - dialogVisible: !this.data.dialogVisible, + // dialogVisible: !this.data.dialogVisible, + showPeriodDialog: !this.data.showPeriodDialog, + dialogTips: `报名时间截止之前可取消,缺席活动扣除${this.data.detail.punishmentPoints}积分,是否确定报名`, dialogTitle: "报名提醒", dialogContent: ["报名时间截止之前可取消", `缺席活动扣除${this.data.detail.punishmentPoints}积分,是否确定报名`], dialogConfirmText: "是", @@ -132,7 +142,9 @@ Page({ }) } else if (uservolunteerflag == 1) { this.setData({ - dialogVisible: !this.data.dialogVisible, + // dialogVisible: !this.data.dialogVisible, + showPeriodDialog: !this.data.showPeriodDialog, + dialogTips: `报名时间截止之前可取消,缺席活动扣除${this.data.detail.punishmentPoints}积分,是否确定报名`, dialogTitle: "报名提醒", dialogContent: ["报名时间截止之前可取消", `缺席活动扣除${this.data.detail.punishmentPoints}积分,是否确定报名`], dialogConfirmText: "是", @@ -204,8 +216,11 @@ Page({ console.log("::::::" + this.data.uservolunteerflag.length) if (this.data.uservolunteerflag.length > 0) { if (this.data.uservolunteerflag == 0 || this.data.uservolunteerflag == 1) { - let id = this.data.id - api.signup(id).then(res => { + let param = { + actId: this.data.id, + actPeriodId: this.data.actPeriodId + } + api.signup(param).then(res => { if (res.code == 0) { this.setData({ dialogVisible: !this.data.dialogVisible, @@ -277,5 +292,68 @@ Page({ title: "活动详情", path: `/pages/heartNew/heartNew?shareType=heartDetail&id=${this.data.id}&defaultGridId=${this.data.defaultGridId}` } + }, + + checkboxChange (e) { + console.log(e.detail.value) + // let actPeriodId = [] + // if (e.detail.value.length > 0) { + // e.detail.value.forEach(item => { + // let ob = { + // id: item + // } + // actPeriodId.push(ob) + // }) + // } + this.setData({ + actPeriodId: e.detail.value + }) + }, + onCancelPeriod () { + this.setData({ + showPeriodDialog: false, + actPeriodId: [] + }) + }, + onConfirmPeriod () { + console.log("::::::" + this.data.uservolunteerflag.length) + if (this.data.uservolunteerflag.length > 0) { + if (this.data.uservolunteerflag == 0 || this.data.uservolunteerflag == 1) { + let param = { + actId: this.data.id, + actPeriodId: this.data.actPeriodId + } + api.signup(param).then(res => { + if (res.code == 0) { + this.setData({ + showPeriodDialog: !this.data.showPeriodDialog, + dialogVisible: !this.data.dialogVisible, + dialogTitle: "报名成功", + dialogContent: ["正在审核中", "请耐心等待消息通知!"], + dialogConfirmText: "确定", + dialogCancelText: "", + uservolunteerflag: "" + }) + this.getDetail() + } else { //点击我要报名,刚好已经报满,此时弹出已报满的提示框,点击确定后,我要报名按钮变成已报满按钮(置灰) + this.getDetail() + } + }) + } else if (this.data.uservolunteerflag == 2) { + wx.navigateTo({ + url: "/subpages/heart/pages/volunteer/volunteer" + }) + } + } else { + console.log("报名成功以后不进行操作") + } + }, + getActPeriods () { + api.getActPeriods(this.data.id).then(res => { + console.log(res.data) + this.setData({ + periodList: res.data + }) + }) } }) \ No newline at end of file diff --git a/subpages/heart/pages/heartDetail/heartDetail.wxml b/subpages/heart/pages/heartDetail/heartDetail.wxml index 0f3bef4..5bebd74 100644 --- a/subpages/heart/pages/heartDetail/heartDetail.wxml +++ b/subpages/heart/pages/heartDetail/heartDetail.wxml @@ -32,6 +32,15 @@ + + + + 主办方 + + + {{sponsor}} + + @@ -361,4 +370,30 @@ - \ No newline at end of file + + + + + 请选择时间段 + + + + + + + {{dialogTips}} + + + 取消 + 确定 + + + \ No newline at end of file diff --git a/subpages/heart/pages/heartDetail/heartDetail.wxss b/subpages/heart/pages/heartDetail/heartDetail.wxss index e09217f..0188c98 100644 --- a/subpages/heart/pages/heartDetail/heartDetail.wxss +++ b/subpages/heart/pages/heartDetail/heartDetail.wxss @@ -364,3 +364,75 @@ page{ rich-text{ line-height: 75rpx; } + +/* 时间段start */ +.period { + width: 100%; + height: 100%; + position: fixed; + left: 0; + top: 0; + z-index: 1000; + background-color: rgba(0, 0, 0, 0.6); + display: flex; + align-items: center; + justify-content: center; +} +.period .period-dialog { + width: 600rpx; + background-color: #fff; + border-radius: 10rpx; +} +.period-dialog .period-title { + height: 80rpx; + line-height: 80rpx; + text-align: center; + font-size: 36rpx; +} +.period-dialog .period-content { + height: 400rpx; + padding: 20rpx 30rpx; + box-sizing: border-box; +} +.period-dialog .period-content .checkbox-group { + height: 100%; + /* overflow: auto; */ +} +.checkbox-group .checkbox-item { + display: flex; + width: 100%; + height: 120rpx; + align-items: center; + justify-content: space-around; +} +.checkbox-item .item-labels { + display: flex; + flex-direction: column; +} +.checkbox-item .item-label { + width: 370rpx; +} +.period-dialog .tips { + padding: 0rpx 60rpx; +} +.period-dialog .period-footer { + height: 100rpx; + width: 100%; + display: flex; + align-items: center; + justify-content: space-around; +} +.period-footer .footer-cancel { + width: 200rpx; + height: 80rpx; + line-height: 80rpx; + text-align: center; + color: #aaa; +} +.period-footer .footer-confirm { + width: 200rpx; + height: 80rpx; + line-height: 80rpx; + text-align: center; + color: #04BCA0; +} diff --git a/utils/api.js b/utils/api.js index 4510977..3869def 100644 --- a/utils/api.js +++ b/utils/api.js @@ -73,7 +73,9 @@ module.exports = { suggestDictList: suggestDictList, suggestDetail: suggestDetail, getVolunteerDepts: getVolunteerDepts, - getCharityPoints: getCharityPoints + getCharityPoints: getCharityPoints, + // + getActPeriods } function getToken (wxCode) { @@ -435,8 +437,8 @@ function authenticate (data) { * 活动报名 */ -function signup (actId) { - return fly.post(`heart/act/signup?actId=${actId}`) + function signup (param) { + return fly.post(`heart/act/signup`, param) } /** @@ -637,4 +639,8 @@ function getVolunteerDepts () { //志愿者银行-公益积分记录 function getCharityPoints (para) { return fly.get(`points/charityPoints`, para) +} +// 活动参与时间段列表接口 +function getActPeriods (actId) { + return fly.get(`heart/act/getActPeriods`, {actId: actId}) } \ No newline at end of file