Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
swx_weapp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2022-11-11 15:32:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e756ad746105e1d54cea43d5870c6f9b599f3f46
e756ad74
1 parent
a23af3f1
处理用户审核状态问题
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
35 deletions
src/pages/joinList/index.vue
src/pages/joinVolunteerInfo/index.vue
src/pages/joinList/index.vue
View file @
e756ad7
...
...
@@ -63,6 +63,8 @@
<van-tag @tap="changeStatus('apply', item.id)" v-if="item.status === 'apply'" :round="true" color="#D7F3FF" text-color="#0091FD" size="large">已报名</van-tag>
<van-tag @tap="changeStatus('enable', item.id)" v-if="item.status === 'enable'" :round="true" color="#D7FFD7" text-color="#019200" size="large">已签到</van-tag>
<van-tag @tap="changeStatus('absent', item.id)" v-if="item.status === 'absent'" :round="true" color="#FFF5E4" text-color="#FF7300" size="large">未出席</van-tag>
<van-tag @tap="changeStatus('request', item.id)" v-if="item.status === 'request'" :round="true" color="#FFF5E4" text-color="#FF7300" size="large">待审核</van-tag>
<van-tag @tap="changeStatus('reject', item.id)" v-if="item.status === 'reject'" :round="true" color="#FFF5E4" text-color="#FF7300" size="large">已拒绝</van-tag>
</van-col>
</van-row>
</view>
...
...
@@ -72,7 +74,7 @@
</view>
<!-- 切换状态弹出框 -->
<van-popup :show="show_status_popup" position="bottom" custom-style="height:
45
%;" :lock-scroll="true">
<van-popup :show="show_status_popup" position="bottom" custom-style="height:
50
%;" :lock-scroll="true">
<van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="status_type_columns"
toolbar-class="picker-toolbar" @confirm="onStatusTypeConfirm" @cancel="onStatusTypeCancel" />
</van-popup>
...
...
@@ -104,16 +106,6 @@ const goToUserInfo = (member_id) => {
})
}
// 处理过滤条件
const status_type_columns = ref([])
const internalInstance = getCurrentInstance();
setTimeout(() => {
if (internalInstance.data.absent) {
status_type_columns.value = ['全部', '已签到', '未出席']
} else {
status_type_columns.value = ['全部', '已签到', '已报名']
}
}, 500);
</script>
<script>
...
...
@@ -153,13 +145,14 @@ export default {
activated: 1,
show_status_popup: false,
status_type: '',
status_type_columns: [],
}
},
async onShow () {
const info = await activityInfoAPI({ i: getCurrentPageParam().id });
if (info.code) {
// 判断是否超过活动时间
if (
+new Date(info.data.activity.activity_time) > +new Date(info.data.server_time)
) {
if (
info.data.activity.activity_time > info.data.server_time
) {
this.absent = true;
}
}
...
...
@@ -173,7 +166,10 @@ export default {
// 活动超时翻状态
this.reg_list.forEach(item => {
item.status = item.status === 'apply' ? 'absent' : item.status;
})
});
this.status_type_columns = ['全部', '已签到', '未出席']
} else {
this.status_type_columns = ['全部', '已签到', '已报名']
}
}
},
...
...
@@ -206,11 +202,23 @@ export default {
if (type === 'activity') { // 活动报名
this.member_type = 'player';
this.activated = 1;
if (this.absent) {
this.status_type_columns = ['全部', '已签到', '未出席']
} else {
this.status_type_columns = ['全部', '已签到', '已报名']
}
} else { // 岗位报名
this.member_type = 'volunteer';
this.activated = 2;
if (this.absent) {
this.status_type_columns = ['全部', '已签到', '未出席', '待审核', '已拒绝']
} else {
this.status_type_columns = ['全部', '已签到', '已报名', '待审核', '已拒绝']
}
}
// 重置条件
this.status_type = '';
this.status = '';
this.page = 0;
this.reg_list = [];
this.flag = false;
...
...
@@ -229,6 +237,12 @@ export default {
if (this.status_type === '未出席' || this.status_type === '已报名') {
this.status = 'apply';
}
if (this.status_type === '待审核') {
this.status = 'request';
}
if (this.status_type === '已拒绝') {
this.status = 'reject';
}
// 重置条件
this.page = 0;
this.reg_list = [];
...
...
@@ -238,6 +252,30 @@ export default {
onStatusTypeCancel (event) {
this.show_status_popup = false;
},
async handleStatusReg (id, status) {
// 改变状态操作接口请求及后续更新
const { code, data } = await statusRegAPI({ i: id, status });
if (code) {
Taro.showToast({
title: '修改成功',
icon: 'success',
duration: 2000
});
// 手动翻状态-显示
this.reg_list.forEach(item => {
if (item.id === id) {
item.status = status;
}
});
// 更新用户统计
const { code, data } = await listRegAPI({ activity_id: getCurrentPageParam().id, type: this.member_type, page: this.page, limit: this.limit });
if (code) {
this.reg_count = data.reg_count;
this.volunteer_count = data.volunteer_count;
this.sign_count = data.sign_count;
}
}
},
changeStatus (status, id) {
// 已签到不能修改状态
if (status === 'enable') {
...
...
@@ -252,32 +290,29 @@ export default {
})
.then(async () => {
// on confirm
const { code, data } = await statusRegAPI({ i: id, status: 'enable' });
if (code) {
Taro.showToast({
title: '修改成功',
icon: 'success',
duration: 2000
});
// 手动翻状态-显示
this.reg_list.forEach(item => {
if (item.id === id) {
item.status = 'enable';
}
});
// 更新用户统计
const { code, data } = await listRegAPI({ activity_id: getCurrentPageParam().id, type: this.member_type, page: this.page, limit: this.limit });
if (code) {
this.reg_count = data.reg_count;
this.volunteer_count = data.volunteer_count;
this.sign_count = data.sign_count;
}
}
this.handleStatusReg(id, 'enable');
})
.catch(() => {
// on cancel
});
}
if (status === 'request') {
Dialog.confirm({
title: '温馨提示',
message: '是否审核通过,报名者成为义工?',
confirmButtonColor: '#199a74',
confirmButtonText: '同意',
cancelButtonText: '不同意',
})
.then(async () => {
// on confirm
this.handleStatusReg(id, 'apply');
})
.catch(async () => {
// on cancel
this.handleStatusReg(id, 'reject');
});
}
}
}
};
...
...
src/pages/joinVolunteerInfo/index.vue
View file @
e756ad7
<!--
* @Date: 2022-09-27 17:13:05
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-1
0-27 18:37:45
* @LastEditTime: 2022-1
1-11 15:25:20
* @FilePath: /swx/src/pages/joinVolunteerInfo/index.vue
* @Description: 义工报名
-->
...
...
@@ -36,6 +36,12 @@
<input class="h5-input at-input__input" placeholder-class="placeholder" :value="user_sex" placeholder="" :disabled="true"/>
</view>
</view>
<view class="at-input">
<view class="at-input__container">
<label class="h5-label at-input__title at-input__title">状态</label>
<input class="h5-input at-input__input" placeholder-class="placeholder" :value="status" placeholder="" :disabled="true"/>
</view>
</view>
</view>
<view class="confirm-wrapper-page">
...
...
@@ -98,6 +104,8 @@ export default {
phone: '',
user_sex: '',
post: '',
status: '',
absent: false,
}
},
async onShow () {
...
...
@@ -107,6 +115,23 @@ export default {
this.phone = data.phone;
this.post = data.post;
this.user_sex = data.gender === 'man' ? '男士' : '女士';
this.absent = data.activity_time > data.server_time ? true : false;
if (data.status === 'apply') {
if (this.absent) { // 活动开始前显示为已报名,开始后显示为未出席
this.status = '未出席'
} else {
this.status = '已报名'
}
}
if (data.status === 'enable') {
this.status = '已签到'
}
if (data.status === 'request') {
this.status = '已申请报名义工'
}
if (data.status === 'reject') {
this.status = '管理员拒绝义工申请'
}
}
}
};
...
...
Please
register
or
login
to post a comment