Showing
3 changed files
with
201 additions
and
107 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2022-10-20 13:15:00 | 2 | * @Date: 2022-10-20 13:15:00 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-20 21:42:18 | 4 | + * @LastEditTime: 2022-10-21 16:54:03 |
| 5 | * @FilePath: /swx/src/api/Reg/index.js | 5 | * @FilePath: /swx/src/api/Reg/index.js |
| 6 | * @Description: 报名信息 | 6 | * @Description: 报名信息 |
| 7 | */ | 7 | */ |
| ... | @@ -12,6 +12,8 @@ const Api = { | ... | @@ -12,6 +12,8 @@ const Api = { |
| 12 | REG_ADD: '/srv/?a=reg_add', | 12 | REG_ADD: '/srv/?a=reg_add', |
| 13 | REG_EDIT: '/srv/?a=reg_edit', | 13 | REG_EDIT: '/srv/?a=reg_edit', |
| 14 | REG_CANCEL: '/srv/?a=reg_cancel', | 14 | REG_CANCEL: '/srv/?a=reg_cancel', |
| 15 | + REG_LIST: '/srv/?a=reg_list', | ||
| 16 | + REG_STATUS: '/srv/?a=reg_set_status', | ||
| 15 | } | 17 | } |
| 16 | 18 | ||
| 17 | /** | 19 | /** |
| ... | @@ -37,3 +39,15 @@ export const editRegAPI = (params) => fn(fetch.post(Api.REG_EDIT, params)); | ... | @@ -37,3 +39,15 @@ export const editRegAPI = (params) => fn(fetch.post(Api.REG_EDIT, params)); |
| 37 | * @returns | 39 | * @returns |
| 38 | */ | 40 | */ |
| 39 | export const cancelRegAPI = (params) => fn(fetch.post(Api.REG_CANCEL, params)); | 41 | export const cancelRegAPI = (params) => fn(fetch.post(Api.REG_CANCEL, params)); |
| 42 | + | ||
| 43 | +/** | ||
| 44 | + * @description: 活动报名列表 | ||
| 45 | + * @returns | ||
| 46 | + */ | ||
| 47 | +export const listRegAPI = (params) => fn(fetch.post(Api.REG_LIST, params)); | ||
| 48 | + | ||
| 49 | +/** | ||
| 50 | + * @description: 修改活动状态 | ||
| 51 | + * @returns | ||
| 52 | + */ | ||
| 53 | +export const statusRegAPI = (params) => fn(fetch.post(Api.REG_STATUS, params)); | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-26 16:10:35 | 2 | * @Date: 2022-09-26 16:10:35 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-20 18:27:46 | 4 | + * @LastEditTime: 2022-10-21 13:37:32 |
| 5 | * @FilePath: /swx/src/components/activity-bar.vue | 5 | * @FilePath: /swx/src/components/activity-bar.vue |
| 6 | * @Description: 活动详情页底部导航栏 | 6 | * @Description: 活动详情页底部导航栏 |
| 7 | --> | 7 | --> |
| ... | @@ -81,7 +81,7 @@ const goTo = (type) => { | ... | @@ -81,7 +81,7 @@ const goTo = (type) => { |
| 81 | } | 81 | } |
| 82 | } else if (type === 'list') { // 报名列表 | 82 | } else if (type === 'list') { // 报名列表 |
| 83 | Taro.navigateTo({ | 83 | Taro.navigateTo({ |
| 84 | - url: '../joinList/index?id=' | 84 | + url: '../joinList/index?id=' + getCurrentPageParam().id |
| 85 | }) | 85 | }) |
| 86 | } else if (type === 'edit') { // 修改活动 | 86 | } else if (type === 'edit') { // 修改活动 |
| 87 | const id = getCurrentPageParam().id; | 87 | const id = getCurrentPageParam().id; |
| ... | @@ -93,6 +93,7 @@ const goTo = (type) => { | ... | @@ -93,6 +93,7 @@ const goTo = (type) => { |
| 93 | 93 | ||
| 94 | </script> | 94 | </script> |
| 95 | 95 | ||
| 96 | + | ||
| 96 | <style lang="less"> | 97 | <style lang="less"> |
| 97 | @import '@/assets/styles/base.less'; | 98 | @import '@/assets/styles/base.less'; |
| 98 | 99 | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <view class="join-list-page"> | 2 | <view class="join-list-page"> |
| 3 | - <view class="join-list-header"> | 3 | + <view id="page-header" class="join-list-header"> |
| 4 | <view class="activity-title"> | 4 | <view class="activity-title"> |
| 5 | <view class="box"> | 5 | <view class="box"> |
| 6 | <text class="bg-gradient" style="font-size: 1.15rem;">报名统计</text> | 6 | <text class="bg-gradient" style="font-size: 1.15rem;">报名统计</text> |
| ... | @@ -8,21 +8,21 @@ | ... | @@ -8,21 +8,21 @@ |
| 8 | </view> | 8 | </view> |
| 9 | <view class="header-info"> | 9 | <view class="header-info"> |
| 10 | <view class="activity"> | 10 | <view class="activity"> |
| 11 | - <view><text style="font-size: 1.25rem;">5</text>人</view> | 11 | + <view><text style="font-size: 1.25rem;">{{ reg_count }}</text>人</view> |
| 12 | <view> | 12 | <view> |
| 13 | <van-icon :name="icon_join" size="1.5rem" color="" style="vertical-align: sub;" /> | 13 | <van-icon :name="icon_join" size="1.5rem" color="" style="vertical-align: sub;" /> |
| 14 | <text style="font-size: 0.9rem; color: #999999;">活动报名</text> | 14 | <text style="font-size: 0.9rem; color: #999999;">活动报名</text> |
| 15 | </view> | 15 | </view> |
| 16 | </view> | 16 | </view> |
| 17 | <view class="job"> | 17 | <view class="job"> |
| 18 | - <text style="font-size: 1.25rem;">2</text>人 | 18 | + <text style="font-size: 1.25rem;">{{ volunteer_count }}</text>人 |
| 19 | <view> | 19 | <view> |
| 20 | <van-icon :name="icon_job" size="1.25rem" color="" style="vertical-align: sub;" /> | 20 | <van-icon :name="icon_job" size="1.25rem" color="" style="vertical-align: sub;" /> |
| 21 | <text style="font-size: 0.9rem; color: #999999;">岗位报名</text> | 21 | <text style="font-size: 0.9rem; color: #999999;">岗位报名</text> |
| 22 | </view> | 22 | </view> |
| 23 | </view> | 23 | </view> |
| 24 | <view class="sign"> | 24 | <view class="sign"> |
| 25 | - <view><text style="font-size: 1.25rem;">3</text>人</view> | 25 | + <view><text style="font-size: 1.25rem;">{{ sign_count }}</text>人</view> |
| 26 | <view> | 26 | <view> |
| 27 | <van-icon :name="icon_sign" size="1.25rem" color="" style="vertical-align: sub;" /> | 27 | <van-icon :name="icon_sign" size="1.25rem" color="" style="vertical-align: sub;" /> |
| 28 | <text style="font-size: 0.9rem; color: #999999;">用户签到</text> | 28 | <text style="font-size: 0.9rem; color: #999999;">用户签到</text> |
| ... | @@ -31,7 +31,7 @@ | ... | @@ -31,7 +31,7 @@ |
| 31 | </view> | 31 | </view> |
| 32 | </view> | 32 | </view> |
| 33 | <view class="list-wrapper" style="margin: 1rem;"> | 33 | <view class="list-wrapper" style="margin: 1rem;"> |
| 34 | - <view style="background-color: white; border-radius: 0.65rem; padding: 1rem;overflow: auto; margin-bottom: 1px;"> | 34 | + <view id="page-filter" style="background-color: white; border-radius: 0.65rem; padding: 1rem;overflow: auto; margin-bottom: 1px;"> |
| 35 | <view style="display: inline-block; margin-right: 1rem; line-height: 60rpx;"> | 35 | <view style="display: inline-block; margin-right: 1rem; line-height: 60rpx;"> |
| 36 | <view @tap="toggleColum('activity')" :class="[activated === 1 ? 'bg-gradient' : 'inactivate']" style="font-size: 1rem;">活动报名</view> | 36 | <view @tap="toggleColum('activity')" :class="[activated === 1 ? 'bg-gradient' : 'inactivate']" style="font-size: 1rem;">活动报名</view> |
| 37 | </view> | 37 | </view> |
| ... | @@ -43,11 +43,12 @@ | ... | @@ -43,11 +43,12 @@ |
| 43 | <van-icon :name="icon_sel2" size="0.8rem" color="" style="vertical-align: middle;" /> | 43 | <van-icon :name="icon_sel2" size="0.8rem" color="" style="vertical-align: middle;" /> |
| 44 | </view> | 44 | </view> |
| 45 | </view> | 45 | </view> |
| 46 | - <view> | 46 | + <scroll-view :scroll-y="true" :style="scrollStyle" @scrolltolower="onScrollToLower"> |
| 47 | - <view v-for="(item, index) in activityList" :key="index" class="list-item"> | 47 | + <view v-for="(item, index) in reg_list" :key="index" class="list-item"> |
| 48 | <van-row> | 48 | <van-row> |
| 49 | <van-col span="6"> | 49 | <van-col span="6"> |
| 50 | - <view @tap="goToUserInfo()" class="avatar" :style="{ backgroundImage: `url(${item.avatar})` }"></view> | 50 | + <view v-if="item.avatar" @tap="goToUserInfo()" class="avatar" :style="{ backgroundImage: `url(${item.avatar})` }"></view> |
| 51 | + <view v-else @tap="goToUserInfo()" class="avatar" :style="{ backgroundImage: `url('https://img.yzcdn.cn/vant/cat.jpeg')` }"></view> | ||
| 51 | </van-col> | 52 | </van-col> |
| 52 | <van-col span="14"> | 53 | <van-col span="14"> |
| 53 | <view class="content"> | 54 | <view class="content"> |
| ... | @@ -59,64 +60,37 @@ | ... | @@ -59,64 +60,37 @@ |
| 59 | </view> | 60 | </view> |
| 60 | </van-col> | 61 | </van-col> |
| 61 | <van-col span="4"> | 62 | <van-col span="4"> |
| 62 | - <van-tag v-if="item.status === '1'" :round="true" color="#D7F3FF" text-color="#0091FD" size="large">已报名</van-tag> | 63 | + <van-tag @tap="changeStatus('apply', item.id)" v-if="item.status === 'apply'" :round="true" color="#D7F3FF" text-color="#0091FD" size="large">已报名</van-tag> |
| 63 | - <van-tag v-if="item.status === '2'" :round="true" color="#D7FFD7" text-color="#019200" size="large">已签到</van-tag> | 64 | + <van-tag @tap="changeStatus('enable', item.id)" v-if="item.status === 'enable'" :round="true" color="#D7FFD7" text-color="#019200" size="large">已签到</van-tag> |
| 64 | - <van-tag v-if="item.status === '3'" :round="true" color="#FFF5E4" text-color="#FF7300" size="large">未出席</van-tag> | 65 | + <van-tag @tap="changeStatus('absent', item.id)" v-if="item.status === 'absent'" :round="true" color="#FFF5E4" text-color="#FF7300" size="large">未出席</van-tag> |
| 65 | </van-col> | 66 | </van-col> |
| 66 | </van-row> | 67 | </van-row> |
| 67 | </view> | 68 | </view> |
| 68 | - </view> | 69 | + </scroll-view> |
| 69 | </view> | 70 | </view> |
| 70 | <view style="height: 2rem;"></view> | 71 | <view style="height: 2rem;"></view> |
| 71 | </view> | 72 | </view> |
| 72 | 73 | ||
| 73 | <!-- 切换状态弹出框 --> | 74 | <!-- 切换状态弹出框 --> |
| 74 | - <van-popup :show="show_status_popup" position="bottom" custom-style="height: 40%;" :lock-scroll="true"> | 75 | + <van-popup :show="show_status_popup" position="bottom" custom-style="height: 45%;" :lock-scroll="true"> |
| 75 | <van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="status_type_columns" | 76 | <van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="status_type_columns" |
| 76 | - toolbar-class="picker-toolbar" @confirm="onStatusTypeConfirm" @cancel="onStatusTypeCancel" @change="onStatusTypeChange" /> | 77 | + toolbar-class="picker-toolbar" @confirm="onStatusTypeConfirm" @cancel="onStatusTypeCancel" /> |
| 77 | </van-popup> | 78 | </van-popup> |
| 79 | + | ||
| 80 | + <van-toast id="van-toast" /> | ||
| 81 | + <van-dialog id="van-dialog" /> | ||
| 78 | </template> | 82 | </template> |
| 79 | 83 | ||
| 80 | <script setup> | 84 | <script setup> |
| 81 | -import { ref } from "vue"; | 85 | +import { ref, getCurrentInstance } from "vue"; |
| 82 | import icon_join from '@/images/icon/baoming@2x.png' | 86 | import icon_join from '@/images/icon/baoming@2x.png' |
| 83 | import icon_job from '@/images/icon/yigong@2x.png' | 87 | import icon_job from '@/images/icon/yigong@2x.png' |
| 84 | import icon_sign from '@/images/icon/qiandao@2x.png' | 88 | import icon_sign from '@/images/icon/qiandao@2x.png' |
| 85 | import icon_sel2 from '@/images/icon/sel02@2x.png' | 89 | import icon_sel2 from '@/images/icon/sel02@2x.png' |
| 86 | import icon_tel from '@/images/icon/tel@2x.png' | 90 | import icon_tel from '@/images/icon/tel@2x.png' |
| 87 | import Taro from '@tarojs/taro' | 91 | import Taro from '@tarojs/taro' |
| 88 | - | 92 | +import { getCurrentPageParam } from "@/utils/weapp"; |
| 89 | -const activityList = ref([{ | 93 | +import Toast from '@/components/vant-weapp/toast/toast'; |
| 90 | - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg', | ||
| 91 | - name: '净妙', | ||
| 92 | - phone: '18789800786', | ||
| 93 | - status: '1', | ||
| 94 | -}, { | ||
| 95 | - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg', | ||
| 96 | - name: '人在路途', | ||
| 97 | - phone: '18789800786', | ||
| 98 | - status: '2', | ||
| 99 | -}, { | ||
| 100 | - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg', | ||
| 101 | - name: '寒潭秋月心如洗', | ||
| 102 | - phone: '18789800786', | ||
| 103 | - status: '3', | ||
| 104 | -}, { | ||
| 105 | - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg', | ||
| 106 | - name: '净妙', | ||
| 107 | - phone: '18789800786', | ||
| 108 | - status: '1', | ||
| 109 | -}, { | ||
| 110 | - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg', | ||
| 111 | - name: '人在路途', | ||
| 112 | - phone: '18789800786', | ||
| 113 | - status: '2', | ||
| 114 | -}, { | ||
| 115 | - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg', | ||
| 116 | - name: '寒潭秋月心如洗', | ||
| 117 | - phone: '18789800786', | ||
| 118 | - status: '3', | ||
| 119 | -}]) | ||
| 120 | 94 | ||
| 121 | const onPhoneClick = (number) => { | 95 | const onPhoneClick = (number) => { |
| 122 | Taro.makePhoneCall({ | 96 | Taro.makePhoneCall({ |
| ... | @@ -124,74 +98,179 @@ const onPhoneClick = (number) => { | ... | @@ -124,74 +98,179 @@ const onPhoneClick = (number) => { |
| 124 | }) | 98 | }) |
| 125 | } | 99 | } |
| 126 | 100 | ||
| 127 | -const show_status_popup = ref(false); | ||
| 128 | -const status_type = ref(''); | ||
| 129 | -const status_type_columns = ref(['已报名', '未出席', '已签到']); | ||
| 130 | -const onStatusTypeChange = (event) => { | ||
| 131 | - const { picker, value, index } = event.detail; | ||
| 132 | -} | ||
| 133 | -const onStatusTypeConfirm = (event) => { | ||
| 134 | - const { picker, value, index } = event.detail; | ||
| 135 | - show_status_popup.value = false; | ||
| 136 | - status_type.value = value; | ||
| 137 | - console.warn('查询新数据'); | ||
| 138 | -} | ||
| 139 | -const onStatusTypeCancel = (event) => { | ||
| 140 | - show_status_popup.value = false; | ||
| 141 | -} | ||
| 142 | - | ||
| 143 | -const activated = ref(1); | ||
| 144 | -const toggleColum = (type) => { | ||
| 145 | - if (type === 'activity') { | ||
| 146 | - activityList.value = [{ | ||
| 147 | - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg', | ||
| 148 | - name: '净妙', | ||
| 149 | - phone: '18789800786', | ||
| 150 | - status: '1', | ||
| 151 | - }, { | ||
| 152 | - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg', | ||
| 153 | - name: '人在路途', | ||
| 154 | - phone: '18789800786', | ||
| 155 | - status: '2', | ||
| 156 | - }, { | ||
| 157 | - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg', | ||
| 158 | - name: '寒潭秋月心如洗', | ||
| 159 | - phone: '18789800786', | ||
| 160 | - status: '3', | ||
| 161 | - }, { | ||
| 162 | - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg', | ||
| 163 | - name: '净妙', | ||
| 164 | - phone: '18789800786', | ||
| 165 | - status: '1', | ||
| 166 | - }, { | ||
| 167 | - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg', | ||
| 168 | - name: '人在路途', | ||
| 169 | - phone: '18789800786', | ||
| 170 | - status: '2', | ||
| 171 | - }, { | ||
| 172 | - avatar: 'https://img.yzcdn.cn/vant/cat.jpeg', | ||
| 173 | - name: '寒潭秋月心如洗', | ||
| 174 | - phone: '18789800786', | ||
| 175 | - status: '3', | ||
| 176 | - }]; | ||
| 177 | - activated.value = 1 | ||
| 178 | - } else { | ||
| 179 | - activityList.value = []; | ||
| 180 | - activated.value = 2 | ||
| 181 | - } | ||
| 182 | -} | ||
| 183 | - | ||
| 184 | const goToUserInfo = () => { | 101 | const goToUserInfo = () => { |
| 185 | Taro.navigateTo({ | 102 | Taro.navigateTo({ |
| 186 | url: '../userInfo/index' | 103 | url: '../userInfo/index' |
| 187 | }) | 104 | }) |
| 188 | } | 105 | } |
| 106 | + | ||
| 107 | +// 处理过滤条件 | ||
| 108 | +const status_type_columns = ref([]) | ||
| 109 | +const internalInstance = getCurrentInstance(); | ||
| 110 | +setTimeout(() => { | ||
| 111 | + if (internalInstance.data.absent) { | ||
| 112 | + status_type_columns.value = ['全部', '已签到', '未出席'] | ||
| 113 | + } else { | ||
| 114 | + status_type_columns.value = ['全部', '已签到', '已报名'] | ||
| 115 | + } | ||
| 116 | +}, 500); | ||
| 189 | </script> | 117 | </script> |
| 190 | 118 | ||
| 191 | <script> | 119 | <script> |
| 192 | import "./index.less"; | 120 | import "./index.less"; |
| 121 | +import { listRegAPI, statusRegAPI } from '@/api/Reg/index'; | ||
| 122 | +import * as dayjs from 'dayjs' | ||
| 123 | +import { activityInfoAPI } from '@/api/Host/index'; | ||
| 124 | +import { $ } from '@tarojs/extend' | ||
| 125 | +import Dialog from '@/components/vant-weapp/dialog/dialog'; | ||
| 193 | 126 | ||
| 194 | export default { | 127 | export default { |
| 195 | name: "joinListPage", | 128 | name: "joinListPage", |
| 129 | + mounted () { | ||
| 130 | + // 设置滚动列表可视高度 | ||
| 131 | + const windowHeight = wx.getSystemInfoSync().windowHeight; | ||
| 132 | + setTimeout(async () => { | ||
| 133 | + const headerHeight = await $('#page-header').height(); | ||
| 134 | + const navHeight = await $('#page-filter').height(); | ||
| 135 | + this.scrollStyle = { | ||
| 136 | + height: windowHeight - headerHeight - navHeight - 70 + 'px' | ||
| 137 | + } | ||
| 138 | + }, 500); | ||
| 139 | + }, | ||
| 140 | + data () { | ||
| 141 | + return { | ||
| 142 | + reg_count: 0, | ||
| 143 | + volunteer_count: 0, | ||
| 144 | + sign_count: 0, | ||
| 145 | + reg_list: [], | ||
| 146 | + absent: false, // 超时标识 | ||
| 147 | + flag: true, | ||
| 148 | + status: '', | ||
| 149 | + page: 0, | ||
| 150 | + limit: 10, | ||
| 151 | + member_type: 'player', | ||
| 152 | + scrollStyle: { height: '1000rpx' }, | ||
| 153 | + activated: 1, | ||
| 154 | + show_status_popup: false, | ||
| 155 | + status_type: '', | ||
| 156 | + } | ||
| 157 | + }, | ||
| 158 | + async onShow () { | ||
| 159 | + const info = await activityInfoAPI({ i: getCurrentPageParam().id }); | ||
| 160 | + if (info.code) { | ||
| 161 | + // 判断是否超过活动时间 | ||
| 162 | + if (dayjs(info.data.activity.activity_time).isBefore(dayjs(info.data.server_time))) { | ||
| 163 | + this.absent = true; | ||
| 164 | + } | ||
| 165 | + } | ||
| 166 | + const { code, data } = await listRegAPI({ activity_id: getCurrentPageParam().id, type: this.member_type, page: this.page, limit: this.limit }); | ||
| 167 | + if (code) { | ||
| 168 | + this.reg_count = data.reg_count; | ||
| 169 | + this.volunteer_count = data.volunteer_count; | ||
| 170 | + this.sign_count = data.sign_count; | ||
| 171 | + this.reg_list = data.reg_list; | ||
| 172 | + if (this.absent) { | ||
| 173 | + // 活动超时翻状态 | ||
| 174 | + this.reg_list.forEach(item => { | ||
| 175 | + item.status = item.status === 'apply' ? 'absent' : item.status; | ||
| 176 | + }) | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + }, | ||
| 180 | + methods: { | ||
| 181 | + onScrollToLower () { | ||
| 182 | + if(!this.flag){ | ||
| 183 | + return | ||
| 184 | + } | ||
| 185 | + this.flag = false; | ||
| 186 | + this.getList(); | ||
| 187 | + }, | ||
| 188 | + async getList () { | ||
| 189 | + Taro.showLoading({ | ||
| 190 | + title: '加载中' | ||
| 191 | + }) | ||
| 192 | + // 获取推荐活动列表 | ||
| 193 | + const { code, data } = await listRegAPI({ activity_id: getCurrentPageParam().id, type: this.member_type, status: this.status, page: this.page, limit: this.limit }); | ||
| 194 | + if (code) { | ||
| 195 | + if (data.reg_list.length) { | ||
| 196 | + this.reg_list = this.reg_list.concat(data.reg_list); | ||
| 197 | + this.page = this.page + 1; | ||
| 198 | + this.flag = true; | ||
| 199 | + } else { | ||
| 200 | + Toast('没有数据') | ||
| 201 | + } | ||
| 202 | + Taro.hideLoading() | ||
| 203 | + } | ||
| 204 | + }, | ||
| 205 | + toggleColum (type) { | ||
| 206 | + if (type === 'activity') { // 活动报名 | ||
| 207 | + this.member_type = 'player'; | ||
| 208 | + this.activated = 1; | ||
| 209 | + } else { // 岗位报名 | ||
| 210 | + this.member_type = 'volunteer'; | ||
| 211 | + this.activated = 2; | ||
| 212 | + } | ||
| 213 | + // 重置条件 | ||
| 214 | + this.page = 0; | ||
| 215 | + this.reg_list = []; | ||
| 216 | + this.flag = false; | ||
| 217 | + this.getList(); | ||
| 218 | + }, | ||
| 219 | + onStatusTypeConfirm (event) { | ||
| 220 | + const { picker, value, index } = event.detail; | ||
| 221 | + this.show_status_popup = false; | ||
| 222 | + this.status_type = value; | ||
| 223 | + if (this.status_type === '全部') { | ||
| 224 | + this.status = ''; | ||
| 225 | + } | ||
| 226 | + if (this.status_type === '已签到') { | ||
| 227 | + this.status = 'enable'; | ||
| 228 | + } | ||
| 229 | + if (this.status_type === '未出席' || this.status_type === '已报名') { | ||
| 230 | + this.status = 'apply'; | ||
| 231 | + } | ||
| 232 | + // 重置条件 | ||
| 233 | + this.page = 0; | ||
| 234 | + this.reg_list = []; | ||
| 235 | + this.flag = false; | ||
| 236 | + this.getList(); | ||
| 237 | + }, | ||
| 238 | + onStatusTypeCancel (event) { | ||
| 239 | + this.show_status_popup = false; | ||
| 240 | + }, | ||
| 241 | + changeStatus (status, id) { | ||
| 242 | + // 已签到和未出席不能修改状态 | ||
| 243 | + if (status === 'absent' || status === 'enable') { | ||
| 244 | + Toast('无需修改状态') | ||
| 245 | + } | ||
| 246 | + if (status === 'apply') { | ||
| 247 | + Dialog.confirm({ | ||
| 248 | + title: '温馨提示', | ||
| 249 | + message: '是否确认修改状态为已签到?', | ||
| 250 | + confirmButtonColor: '#199a74' | ||
| 251 | + }) | ||
| 252 | + .then(async () => { | ||
| 253 | + // on confirm | ||
| 254 | + const { code, data } = await statusRegAPI({ i: id, status: 'enable' }); | ||
| 255 | + if (code) { | ||
| 256 | + Taro.showToast({ | ||
| 257 | + title: '修改成功', | ||
| 258 | + icon: 'success', | ||
| 259 | + duration: 2000 | ||
| 260 | + }); | ||
| 261 | + // 手动翻状态-显示 | ||
| 262 | + this.reg_list.forEach(item => { | ||
| 263 | + if (item.id === id) { | ||
| 264 | + item.status = 'enable'; | ||
| 265 | + } | ||
| 266 | + }) | ||
| 267 | + } | ||
| 268 | + }) | ||
| 269 | + .catch(() => { | ||
| 270 | + // on cancel | ||
| 271 | + }); | ||
| 272 | + } | ||
| 273 | + } | ||
| 274 | + } | ||
| 196 | }; | 275 | }; |
| 197 | </script> | 276 | </script> | ... | ... |
-
Please register or login to post a comment