feat:h5会员入会是否已是会员校验、操作栏按钮取消隐藏;h5体检模块:体检项目、我的体检界面卡片样式优化;
This commit is contained in:
+3
@@ -84,6 +84,7 @@ public class H5HealthCheckupController {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
*,
|
||||
(select count(*) from health_checkup_project_subject subject where subject.projectId=p.id) as subjectCount,
|
||||
(select count(*) from health_checkup_user_selection s where s.projectId=p.id and s.selectUserId=@userId) as selectCount
|
||||
from
|
||||
health_checkup_project p
|
||||
@@ -121,6 +122,8 @@ public class H5HealthCheckupController {
|
||||
p.choiceTimeStart,
|
||||
p.choiceTimeEnd,
|
||||
p.cover,
|
||||
p.healthCheckupType,
|
||||
(select count(*) from health_checkup_project_subject subject where subject.projectId=p.id) as subjectCount,
|
||||
sub.optionName
|
||||
FROM
|
||||
health_checkup_user_selection us
|
||||
|
||||
+92
-8
@@ -12,6 +12,8 @@ import com.budwk.app.flow.engine.FlowEngine;
|
||||
import com.budwk.app.flow.entity.ProcessInstance;
|
||||
import com.budwk.app.flow.entity.ProcessTask;
|
||||
import com.budwk.app.flow.enums.ProcessSubmitTypeEnum;
|
||||
import com.budwk.app.flow.enums.ProcessInstanceStateEnum;
|
||||
import com.budwk.app.flow.enums.ProcessTaskStateEnum;
|
||||
import com.budwk.app.flow.service.FlowCommonService;
|
||||
import com.budwk.app.sys.models.Sys_union_group;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
@@ -31,6 +33,7 @@ import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
@@ -87,9 +90,12 @@ public class MemberApplyController {
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
@SLog(tag = "会员入会申请", msg = "提交申请,申请人: ${args[0].username}")
|
||||
public Result submit(@Param("data") MemberApplyRecord memberApplyRecord){
|
||||
if (StrUtil.isBlank(memberApplyRecord.getId())) {
|
||||
memberCommonService.validateApplyOrChangeIsDoing(null, "apply");
|
||||
lockApplicant();
|
||||
String blockMessage = getApplyBlockMessage(currentUser(), memberApplyRecord.getId(), null);
|
||||
if (StrUtil.isNotBlank(blockMessage)) {
|
||||
return Result.error(blockMessage);
|
||||
}
|
||||
memberApplyRecord.setUserId(SecurityUtil.getUserId());
|
||||
// 开启流程实例
|
||||
Dict args = Dict.create();
|
||||
// 设置流程变量
|
||||
@@ -126,9 +132,15 @@ public class MemberApplyController {
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
@SLog(tag = "会员入会申请", msg = "重新提交申请,申请人: ${args[0].username}")
|
||||
public Result submitAgain(@Param("data") MemberApplyRecord memberApplyRecord, @Param("taskId") Long taskId) {
|
||||
if (StrUtil.isBlank(memberApplyRecord.getId())) {
|
||||
memberCommonService.validateApplyOrChangeIsDoing(null, "apply");
|
||||
lockApplicant();
|
||||
String blockMessage = getApplyBlockMessage(currentUser(), memberApplyRecord.getId(), taskId);
|
||||
if (StrUtil.isNotBlank(blockMessage)) {
|
||||
return Result.error(blockMessage);
|
||||
}
|
||||
if (taskId == null) {
|
||||
return Result.error("申请任务不存在或已处理,请勿重复提交");
|
||||
}
|
||||
memberApplyRecord.setUserId(SecurityUtil.getUserId());
|
||||
Dict dict = Dict.create();
|
||||
// 设置流程变量
|
||||
if ("HMC".equals(Globals.SchoolCode)) {
|
||||
@@ -190,14 +202,86 @@ public class MemberApplyController {
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前登录用户信息,是用来判断当前用户是否是会员
|
||||
* @return
|
||||
* 获取当前登录用户信息及入会申请限制,供页面进入时提示。
|
||||
*
|
||||
* @param id 当前编辑的申请ID,新申请可为空
|
||||
* @param taskId 重新提交的申请任务ID,新申请可为空
|
||||
* @return 用户资料及禁止提交的原因;合法退回重提不视为重复申请
|
||||
*/
|
||||
@At
|
||||
@ApiOperation("获取当前登录用户信息")
|
||||
@SaCheckPermission("member.apply.submit")
|
||||
public Result getSelfUserInfo() {
|
||||
return Result.success(dao.fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId())));
|
||||
public Result getSelfUserInfo(String id, Long taskId) {
|
||||
View_user user = currentUser();
|
||||
if (user == null) {
|
||||
return Result.error("无法获取当前用户信息");
|
||||
}
|
||||
NutMap data = Lang.obj2map(user, NutMap.class);
|
||||
data.setv("applicationBlockMessage", getApplyBlockMessage(user, id, taskId));
|
||||
return Result.success(data);
|
||||
}
|
||||
|
||||
private View_user currentUser() {
|
||||
return dao.fetch(View_user.class, Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
}
|
||||
|
||||
// 在提交事务中锁定申请人,避免并发请求同时通过检查并开启多个流程。
|
||||
private void lockApplicant() {
|
||||
Sql sql = Sqls.create("SELECT id FROM sys_user WHERE id=@userId FOR UPDATE");
|
||||
sql.setParam("userId", SecurityUtil.getUserId());
|
||||
sql.setCallback(Sqls.callback.records());
|
||||
dao.execute(sql);
|
||||
}
|
||||
|
||||
// 页面提示与提交接口共用实时校验;只放行本人退回或撤回后仍待处理的申请节点。
|
||||
private String getApplyBlockMessage(View_user user, String id, Long taskId) {
|
||||
if (user == null) {
|
||||
return "无法获取当前用户信息";
|
||||
}
|
||||
if (user.getMember() != null && user.getMember() != 0) {
|
||||
return "您已是工会会员,无需重复提交入会申请";
|
||||
}
|
||||
if (StrUtil.isNotBlank(id)) {
|
||||
MemberApplyRecord record = dao.fetch(MemberApplyRecord.class, id);
|
||||
if (record == null || !SecurityUtil.getUserId().equals(record.getUserId())) {
|
||||
return "申请记录不存在或不属于当前用户";
|
||||
}
|
||||
}
|
||||
Long excludedInstanceId = -1L;
|
||||
if (taskId != null) {
|
||||
ProcessTask task = dao.fetch(ProcessTask.class, taskId);
|
||||
ProcessInstance instance = task == null ? null : dao.fetch(ProcessInstance.class, task.getProcessInstanceId());
|
||||
if (StrUtil.isBlank(id) || task == null || instance == null
|
||||
|| !"startTask".equals(task.getTaskName())
|
||||
|| !ProcessTaskStateEnum.DOING.getCode().equals(task.getTaskState())
|
||||
|| !ProcessInstanceStateEnum.DOING.getCode().equals(instance.getState())
|
||||
|| !id.equals(instance.getBusinessNo())) {
|
||||
return "申请任务不存在或已处理,请勿重复提交";
|
||||
}
|
||||
excludedInstanceId = instance.getId();
|
||||
}
|
||||
// 检查全部申请,避免较新的草稿遮蔽仍在审批中的旧申请。
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT COUNT(*)
|
||||
FROM member_apply_record r
|
||||
INNER JOIN wf_process_instance p ON p.businessNo = r.id
|
||||
WHERE r.userId = @userId AND p.state IN (@doing, @pending)
|
||||
AND p.id <> @excludedInstanceId
|
||||
""");
|
||||
sql.setParam("userId", SecurityUtil.getUserId());
|
||||
sql.setParam("doing", ProcessInstanceStateEnum.DOING.getCode());
|
||||
sql.setParam("pending", ProcessInstanceStateEnum.PENDING.getCode());
|
||||
sql.setParam("excludedInstanceId", excludedInstanceId);
|
||||
sql.setCallback(Sqls.callback.integer());
|
||||
dao.execute(sql);
|
||||
if (sql.getInt() > 0) {
|
||||
return "您已有入会申请正在处理中,请勿重复提交";
|
||||
}
|
||||
if (taskId == null && StrUtil.isNotBlank(id)
|
||||
&& dao.count(ProcessInstance.class, Cnd.where("businessNo", "=", id)) > 0) {
|
||||
return "该申请已提交,请勿重复提交";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+58
-9
@@ -3,8 +3,45 @@ layout("/layouts/platform_h5.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
/* 仅调整体检卡片,避免窄屏下时间和标签被通用图片区域高度截断。 */
|
||||
.health-checkup-cards .table-list-content {
|
||||
max-height: none !important;
|
||||
overflow: visible !important;
|
||||
}
|
||||
.health-checkup-card-title {
|
||||
margin-bottom: 10px;
|
||||
font-size: 15px;
|
||||
line-height: 22px;
|
||||
font-weight: 600;
|
||||
color: #263548;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.health-checkup-card-details {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
.health-checkup-card-time {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin-bottom: 6px;
|
||||
color: #56657a;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.health-checkup-card-time > span:first-child {
|
||||
flex-shrink: 0;
|
||||
color: #98a3b3;
|
||||
}
|
||||
.health-checkup-card-time > span:last-child {
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.health-checkup-card-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app">
|
||||
@@ -26,15 +63,27 @@ layout("/layouts/platform_h5.html"){
|
||||
</van-tabs>
|
||||
</van-sticky>
|
||||
|
||||
<table-list api="/platform/healthCheckup/h5/pageData" :page_form.sync="pageForm" ref="tableListRef"
|
||||
<table-list class="health-checkup-cards" api="/platform/healthCheckup/h5/pageData" :page_form.sync="pageForm" ref="tableListRef"
|
||||
@ready="doSearch" img="cover">
|
||||
<template #header>
|
||||
<div></div>
|
||||
</template>
|
||||
<template v-slot="{index,row}">
|
||||
<table-column label="开始时间">
|
||||
{{$moment(row.choiceTimeStart).format('MM/DD HH:mm')}}
|
||||
</table-column>
|
||||
<table-column label="结束时间">
|
||||
{{$moment(row.choiceTimeEnd).format('MM/DD HH:mm')}}
|
||||
</table-column>
|
||||
<div class="health-checkup-card-details">
|
||||
<div class="health-checkup-card-title">{{row.name}}</div>
|
||||
<div class="health-checkup-card-time">
|
||||
<span>开始时间</span>
|
||||
<span>{{row.choiceTimeStart ? $moment(row.choiceTimeStart).format('YYYY-MM-DD HH:mm') : '—'}}</span>
|
||||
</div>
|
||||
<div class="health-checkup-card-time">
|
||||
<span>结束时间</span>
|
||||
<span>{{row.choiceTimeEnd ? $moment(row.choiceTimeEnd).format('YYYY-MM-DD HH:mm') : '—'}}</span>
|
||||
</div>
|
||||
<div class="health-checkup-card-tags">
|
||||
<van-tag plain type="primary">{{row.healthCheckupType === 'jzg' ? '教职工' : row.healthCheckupType === 'js' ? '家属' : (row.healthCheckupType || '未设置对象类型')}}</van-tag>
|
||||
<van-tag plain type="success">{{row.subjectCount}} 个体检套餐</van-tag>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #actions="{index,row}">
|
||||
<template v-if="$moment().isBefore($moment(row.choiceTimeEnd))">
|
||||
|
||||
+62
-7
@@ -2,6 +2,48 @@
|
||||
layout("/layouts/platform_h5.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
/* 仅调整体检卡片,避免窄屏下时间和标签被通用图片区域高度截断。 */
|
||||
.health-checkup-cards .table-list-content {
|
||||
max-height: none !important;
|
||||
overflow: visible !important;
|
||||
}
|
||||
.health-checkup-card-title {
|
||||
margin-bottom: 10px;
|
||||
font-size: 15px;
|
||||
line-height: 22px;
|
||||
font-weight: 600;
|
||||
color: #263548;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.health-checkup-card-details {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
.health-checkup-card-time {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin-bottom: 6px;
|
||||
color: #56657a;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.health-checkup-card-time > span:first-child {
|
||||
flex-shrink: 0;
|
||||
color: #98a3b3;
|
||||
}
|
||||
.health-checkup-card-time > span:last-child {
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.health-checkup-card-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app">
|
||||
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="我的体检" placeholder fixed></van-nav-bar>
|
||||
<van-sticky offset-top="46px">
|
||||
@@ -13,14 +55,27 @@ layout("/layouts/platform_h5.html"){
|
||||
</van-sticky>
|
||||
|
||||
|
||||
<table-list api="/platform/healthCheckup/h5/mineData" :page_form.sync="pageForm" ref="tableListRef"
|
||||
@ready="doSearch" title="healthCheckupName">
|
||||
<table-list class="health-checkup-cards" api="/platform/healthCheckup/h5/mineData" :page_form.sync="pageForm" ref="tableListRef"
|
||||
@ready="doSearch" img="cover">
|
||||
<template #header>
|
||||
<div></div>
|
||||
</template>
|
||||
<template v-slot="{index,row}">
|
||||
<table-column label="项目名称">{{row.name}}</table-column>
|
||||
<table-column label="开始时间">{{row.choiceTimeStart}}</table-column>
|
||||
<table-column label="结束时间">{{row.choiceTimeEnd}}</table-column>
|
||||
<table-column label="选择医院">{{row.optionName}}</table-column>
|
||||
<table-column label="邮寄地址">{{row.receiveAddress}}</table-column>
|
||||
<div class="health-checkup-card-details">
|
||||
<div class="health-checkup-card-title">{{row.name}}</div>
|
||||
<div class="health-checkup-card-time">
|
||||
<span>开始时间</span>
|
||||
<span>{{row.choiceTimeStart ? $moment(row.choiceTimeStart).format('YYYY-MM-DD HH:mm') : '—'}}</span>
|
||||
</div>
|
||||
<div class="health-checkup-card-time">
|
||||
<span>结束时间</span>
|
||||
<span>{{row.choiceTimeEnd ? $moment(row.choiceTimeEnd).format('YYYY-MM-DD HH:mm') : '—'}}</span>
|
||||
</div>
|
||||
<div class="health-checkup-card-tags">
|
||||
<van-tag plain type="primary">{{row.healthCheckupType === 'jzg' ? '教职工' : row.healthCheckupType === 'js' ? '家属' : (row.healthCheckupType || '未设置对象类型')}}</van-tag>
|
||||
<van-tag plain type="success">{{row.subjectCount}} 个体检套餐</van-tag>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #actions="{index,row}">
|
||||
<div class="action-btn" @click="edit(row)" v-if="new Date().getTime() < new Date(row.choiceTimeEnd).getTime()">
|
||||
|
||||
+191
-36
@@ -54,6 +54,54 @@ layout("/layouts/platform_h5.html"){
|
||||
.member-voluntary__paragraph + .member-voluntary__paragraph {
|
||||
margin-top: 6px;
|
||||
}
|
||||
.member-h5-page.has-fixed-actions {
|
||||
padding-bottom: calc(120px + env(safe-area-inset-bottom));
|
||||
}
|
||||
.member-form-actions {
|
||||
flex-direction: column;
|
||||
}
|
||||
.member-action-buttons,
|
||||
.member-notice-actions {
|
||||
display: flex;
|
||||
gap: 9px;
|
||||
}
|
||||
.member-notice-actions .van-button {
|
||||
height: 42px;
|
||||
border-radius: 14px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.member-notice-consent {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 5px;
|
||||
color: #596779;
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.member-notice-link {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #1989fa;
|
||||
font-size: inherit;
|
||||
}
|
||||
.member-notice-popup {
|
||||
box-sizing: border-box;
|
||||
max-height: 80vh;
|
||||
padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
|
||||
}
|
||||
.member-notice-title {
|
||||
margin: 0 0 12px;
|
||||
text-align: center;
|
||||
font-size: 18px;
|
||||
color: #263548;
|
||||
}
|
||||
.member-notice-content {
|
||||
max-height: 50vh;
|
||||
overflow-y: auto;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
</style>
|
||||
<div id="app" v-cloak>
|
||||
<div class="member-h5-page" :class="{'has-fixed-actions': showActionButtons}">
|
||||
@@ -341,29 +389,36 @@ layout("/layouts/platform_h5.html"){
|
||||
</van-cell-group>
|
||||
</section>
|
||||
|
||||
<section class="form-section">
|
||||
<h2 class="member-form-section__title">入会意愿</h2>
|
||||
<van-cell-group :border="false">
|
||||
<van-checkbox class="member-voluntary" icon-size="22px"
|
||||
v-model="formData.isVoluntary" shape="square">
|
||||
<div class="member-voluntary__paragraph">
|
||||
<span :style="'color:' + (formData.isVoluntary ? '#1989fa' : '#F56C6C') ">
|
||||
我自愿申请加入学校工会,并委托学校按规定代为扣缴工会会员会费。
|
||||
</span>
|
||||
</div>
|
||||
<div class="member-voluntary__paragraph">
|
||||
<span :style="'color:' + (formData.isVoluntary ? '#1989fa' : '#F56C6C') ">
|
||||
我将严格遵守工会章程,认真执行工会决议,积极参与工会活动,主动融入“学校健康幸福家”建设,为营造温暖、和谐、奋进的校园氛围贡献力量,以实际行动助力学校各项事业发展。
|
||||
</span>
|
||||
</div>
|
||||
</van-checkbox>
|
||||
</van-cell-group>
|
||||
</section>
|
||||
<div v-if="showActionButtons" class="member-form-actions">
|
||||
<van-button block plain class="member-save-button" :loading="formLoading && loadingAction === 'save'" :disabled="formLoading" @click.submit="onSave">保存草稿</van-button>
|
||||
<van-button v-if="!taskId" block type="primary" class="member-submit-button" :loading="formLoading && loadingAction === 'submit'" :disabled="formLoading" @click.submit="onSubmit">提交申请</van-button>
|
||||
<van-button v-else block type="primary" class="member-submit-button" :loading="formLoading && loadingAction === 'submitAgain'" :disabled="formLoading" @click.submit="onFinishTask">重新提交</van-button>
|
||||
<div class="member-notice-consent">
|
||||
<van-checkbox :value="hasReadNotice" :disabled="formLoading" shape="square" icon-size="18px"
|
||||
aria-label="同意入会意愿" @input="onNoticeCheckChange"></van-checkbox>
|
||||
<span>我已阅读并同意</span>
|
||||
<button type="button" class="member-notice-link" :disabled="formLoading" @click="openMembershipNotice">《入会意愿》</button>
|
||||
</div>
|
||||
<div class="member-action-buttons">
|
||||
<van-button block plain native-type="button" class="member-save-button" :loading="formLoading && loadingAction === 'save'" :disabled="formLoading" @click="onSave">保存草稿</van-button>
|
||||
<van-button v-if="!taskId" block type="primary" native-type="button" class="member-submit-button" :loading="formLoading && loadingAction === 'submit'" :disabled="formLoading || !hasReadNotice" @click="onSubmit">提交申请</van-button>
|
||||
<van-button v-else block type="primary" native-type="button" class="member-submit-button" :loading="formLoading && loadingAction === 'submitAgain'" :disabled="formLoading || !hasReadNotice" @click="onFinishTask">重新提交</van-button>
|
||||
</div>
|
||||
</div>
|
||||
<van-popup :value="showMembershipNotice" position="bottom" round class="member-notice-popup"
|
||||
:close-on-click-overlay="false" :close-on-popstate="false">
|
||||
<h2 class="member-notice-title">入会意愿</h2>
|
||||
<div class="member-voluntary member-notice-content">
|
||||
<div class="member-voluntary__paragraph">
|
||||
我自愿申请加入学校工会,并委托学校按规定代为扣缴工会会员会费。
|
||||
</div>
|
||||
<div class="member-voluntary__paragraph">
|
||||
我将严格遵守工会章程,认真执行工会决议,积极参与工会活动,主动融入“学校健康幸福家”建设,为营造温暖、和谐、奋进的校园氛围贡献力量,以实际行动助力学校各项事业发展。
|
||||
</div>
|
||||
</div>
|
||||
<div class="member-notice-actions">
|
||||
<van-button block native-type="button" @click="cancelMembershipNotice">取消</van-button>
|
||||
<van-button block native-type="button" type="primary" :disabled="noticeCountdown > 0"
|
||||
@click="confirmMembershipNotice">{{noticeCountdown > 0 ? '我已知晓(' + noticeCountdown + '秒)' : '我已知晓'}}</van-button>
|
||||
</div>
|
||||
</van-popup>
|
||||
</van-form>
|
||||
</main>
|
||||
</div>
|
||||
@@ -377,12 +432,18 @@ layout("/layouts/platform_h5.html"){
|
||||
return {
|
||||
id: GetQueryString("bizId"),
|
||||
taskId: GetQueryString("taskId"),
|
||||
// 当前登录人已是会员时,不显示保存和提交按钮。
|
||||
showActionButtons: true,
|
||||
// 已是会员仍显示操作栏,提交限制由申请状态单独控制。
|
||||
showActionButtons: false,
|
||||
applicationBlockMessage: "",
|
||||
pageLoading: true,
|
||||
formLoading: false,
|
||||
loadingAction: "",
|
||||
historyLayerPageKey: "member-apply-submit",
|
||||
showMembershipNotice: false,
|
||||
noticeAcknowledged: false,
|
||||
noticeCloseRequested: false,
|
||||
noticeCountdown: 5,
|
||||
noticeTimer: null,
|
||||
formData: {
|
||||
families: []
|
||||
},
|
||||
@@ -404,7 +465,51 @@ layout("/layouts/platform_h5.html"){
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openMembershipNotice() {
|
||||
if (this.formLoading || this.showMembershipNotice) return
|
||||
window.h5HistoryLayerManager.open("membership-notice")
|
||||
},
|
||||
onNoticeCheckChange(checked) {
|
||||
if (checked) {
|
||||
this.openMembershipNotice()
|
||||
} else {
|
||||
this.noticeAcknowledged = false
|
||||
this.$set(this.formData, "isVoluntary", false)
|
||||
}
|
||||
},
|
||||
// 每次打开都重新计时,只有本次阅读确认后才能勾选,旧草稿不能跳过确认。
|
||||
startNoticeCountdown() {
|
||||
this.clearNoticeTimer()
|
||||
this.noticeAcknowledged = false
|
||||
this.$set(this.formData, "isVoluntary", false)
|
||||
this.noticeCountdown = 5
|
||||
this.noticeTimer = setInterval(() => {
|
||||
this.noticeCountdown = Math.max(0, this.noticeCountdown - 1)
|
||||
if (this.noticeCountdown === 0) this.clearNoticeTimer()
|
||||
}, 1000)
|
||||
},
|
||||
clearNoticeTimer() {
|
||||
if (this.noticeTimer !== null) {
|
||||
clearInterval(this.noticeTimer)
|
||||
this.noticeTimer = null
|
||||
}
|
||||
},
|
||||
confirmMembershipNotice() {
|
||||
if (!this.showMembershipNotice || this.noticeCountdown > 0) return
|
||||
this.noticeAcknowledged = true
|
||||
this.$set(this.formData, "isVoluntary", true)
|
||||
this.noticeCloseRequested = true
|
||||
window.h5HistoryLayerManager.close("membership-notice")
|
||||
},
|
||||
cancelMembershipNotice() {
|
||||
if (!this.showMembershipNotice) return
|
||||
this.noticeAcknowledged = false
|
||||
this.$set(this.formData, "isVoluntary", false)
|
||||
this.noticeCloseRequested = true
|
||||
window.h5HistoryLayerManager.close("membership-notice")
|
||||
},
|
||||
handlePageBack() {
|
||||
if (this.showMembershipNotice) return
|
||||
if (window.h5HistoryLayerManager.stack.length) {
|
||||
window.h5HistoryLayerManager.close()
|
||||
return
|
||||
@@ -433,7 +538,7 @@ layout("/layouts/platform_h5.html"){
|
||||
},
|
||||
|
||||
registerHistoryLayers() {
|
||||
// 六个选择器共用页面级历史栈,手机返回键只关闭当前最上层选择器。
|
||||
// 入会意愿仅允许通过底部按钮关闭;其他选择器沿用原返回栈行为。
|
||||
window.h5HistoryLayerManager.register(this.historyLayerPageKey, (stack) => {
|
||||
this.$set(this, "showNationPicker", stack.includes("nation-picker"))
|
||||
this.$set(this, "showDatePicker", stack.includes("birthday-picker"))
|
||||
@@ -441,6 +546,21 @@ layout("/layouts/platform_h5.html"){
|
||||
this.$set(this, "showEducationPicker", stack.includes("education-picker"))
|
||||
this.$set(this, "showAcademicDegreePicker", stack.includes("degree-picker"))
|
||||
this.$set(this, "showMarriagePicker", stack.includes("marriage-picker"))
|
||||
const noticeVisible = stack.includes("membership-notice")
|
||||
// 系统返回时恢复当前弹层历史,保留阅读状态及倒计时,须由底部按钮关闭。
|
||||
if (!noticeVisible && this.showMembershipNotice && !this.noticeCloseRequested) {
|
||||
window.h5HistoryLayerManager.open("membership-notice")
|
||||
return
|
||||
}
|
||||
if (noticeVisible && !this.showMembershipNotice) {
|
||||
this.noticeCloseRequested = false
|
||||
this.startNoticeCountdown()
|
||||
} else if (!noticeVisible && this.showMembershipNotice) {
|
||||
this.clearNoticeTimer()
|
||||
this.noticeCloseRequested = false
|
||||
if (!this.noticeAcknowledged) this.$set(this.formData, "isVoluntary", false)
|
||||
}
|
||||
this.$set(this, "showMembershipNotice", noticeVisible)
|
||||
})
|
||||
},
|
||||
|
||||
@@ -479,7 +599,11 @@ layout("/layouts/platform_h5.html"){
|
||||
},
|
||||
|
||||
onSave() {
|
||||
if (this.formLoading) return
|
||||
if (this.formLoading || !this.showActionButtons) return
|
||||
if (this.applicationBlockMessage) {
|
||||
this.$dialog.alert({ title: "提示", message: this.applicationBlockMessage })
|
||||
return
|
||||
}
|
||||
this.$dialog.confirm({
|
||||
title: "提示",
|
||||
message: "您确定要保存吗?",
|
||||
@@ -504,7 +628,15 @@ layout("/layouts/platform_h5.html"){
|
||||
},
|
||||
|
||||
onSubmit() {
|
||||
if (this.formLoading) return
|
||||
if (this.formLoading || !this.showActionButtons) return
|
||||
if (this.applicationBlockMessage) {
|
||||
this.$dialog.alert({ title: "提示", message: this.applicationBlockMessage })
|
||||
return
|
||||
}
|
||||
if (!this.hasReadNotice) {
|
||||
this.$toast.fail("请阅读并勾选入会意愿")
|
||||
return
|
||||
}
|
||||
this.$refs.formRef.validate().then(() => {
|
||||
if (!this.formData.personalData) {
|
||||
this.$toast.fail("请填写个人学习及工作经历")
|
||||
@@ -527,8 +659,7 @@ layout("/layouts/platform_h5.html"){
|
||||
this.$toast.success(res.msg)
|
||||
this.$pjaxReplace("/platform/member/apply/mine/h5")
|
||||
} else {
|
||||
this.$toast.fail("操作失败")
|
||||
console.log(res.msg)
|
||||
this.$dialog.alert({ title: "提示", message: res.msg || "操作失败" })
|
||||
}
|
||||
}).finally(() => {
|
||||
this.formLoading = false
|
||||
@@ -539,7 +670,15 @@ layout("/layouts/platform_h5.html"){
|
||||
},
|
||||
|
||||
onFinishTask() {
|
||||
if (this.formLoading) return
|
||||
if (this.formLoading || !this.showActionButtons) return
|
||||
if (this.applicationBlockMessage) {
|
||||
this.$dialog.alert({ title: "提示", message: this.applicationBlockMessage })
|
||||
return
|
||||
}
|
||||
if (!this.hasReadNotice) {
|
||||
this.$toast.fail("请阅读并勾选入会意愿")
|
||||
return
|
||||
}
|
||||
this.$refs.formRef.validate().then(() => {
|
||||
if (!this.formData.personalData) {
|
||||
this.$toast.fail("请填写个人学习及工作经历")
|
||||
@@ -563,8 +702,7 @@ layout("/layouts/platform_h5.html"){
|
||||
this.$toast.success(res.msg)
|
||||
this.$pjaxReplace("/platform/member/apply/mine/h5")
|
||||
} else {
|
||||
this.$toast.fail("操作失败")
|
||||
console.log(res.msg)
|
||||
this.$dialog.alert({ title: "提示", message: res.msg || "操作失败" })
|
||||
}
|
||||
}).finally(() => {
|
||||
this.formLoading = false
|
||||
@@ -580,12 +718,21 @@ layout("/layouts/platform_h5.html"){
|
||||
},
|
||||
|
||||
init() {
|
||||
// 无参数获取当前登录人资料;有 id 时改查已有申请,接口均返回对应的用户/申请对象。
|
||||
return this.$axios.post("/platform/member/apply/submit/getSelfUserInfo", {}, {h5SkeletonLoading: true})
|
||||
// 使用服务端实时状态,已有申请携带任务信息以保留合法重新提交。
|
||||
return this.$axios.post("/platform/member/apply/submit/getSelfUserInfo", {
|
||||
id: this.id || null,
|
||||
taskId: this.taskId || null
|
||||
}, {h5SkeletonLoading: true})
|
||||
.then((resp) => {
|
||||
const user = resp.code === 0 && resp.data ? resp.data : this.$store.state.user
|
||||
// 页面按钮是否展示,以当前登录人的会员状态为准。
|
||||
this.showActionButtons = !(user && user.member)
|
||||
if (resp.code !== 0 || !resp.data) {
|
||||
return this.$dialog.alert({ title: "提示", message: resp.msg || "无法获取申请状态,请稍后重试" })
|
||||
}
|
||||
const user = resp.data
|
||||
this.applicationBlockMessage = user.applicationBlockMessage || ""
|
||||
this.showActionButtons = !!user.member || !this.applicationBlockMessage
|
||||
if (user.applicationBlockMessage) {
|
||||
this.$dialog.alert({ title: "提示", message: user.applicationBlockMessage })
|
||||
}
|
||||
|
||||
if (this.id) {
|
||||
return this.$axios.post("/platform/member/apply/submit/findApplyById", { id: this.id }, {h5SkeletonLoading: true})
|
||||
@@ -666,6 +813,10 @@ layout("/layouts/platform_h5.html"){
|
||||
this.$set(this.formData, "campusName", "")
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.showActionButtons = false
|
||||
this.$dialog.alert({ title: "提示", message: "无法获取申请状态,请稍后重试" })
|
||||
})
|
||||
},
|
||||
toChinesNum(num) {
|
||||
let changeNum = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"]
|
||||
@@ -708,6 +859,9 @@ layout("/layouts/platform_h5.html"){
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
hasReadNotice() {
|
||||
return this.noticeAcknowledged && this.formData.isVoluntary === true
|
||||
},
|
||||
|
||||
nationColumns() {
|
||||
if (this.dict && this.dict.type && this.dict.type.USER_NATION) {
|
||||
@@ -749,6 +903,7 @@ layout("/layouts/platform_h5.html"){
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.clearNoticeTimer()
|
||||
window.h5HistoryLayerManager.unregister(this.historyLayerPageKey)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user