diff --git a/src/main/resources/static/assets/platform/js/util/h5AutoShowError.js b/src/main/resources/static/assets/platform/js/util/h5AutoShowError.js
new file mode 100644
index 00000000..c6041bbb
--- /dev/null
+++ b/src/main/resources/static/assets/platform/js/util/h5AutoShowError.js
@@ -0,0 +1,50 @@
+// 劫持 validate:失败时先提示 + 滚动,再抛出异常(保持原有行为)
+if (typeof Vue !== 'undefined') {
+ Vue.mixin({
+ mounted() {
+ this.$nextTick(() => {
+ const formRefs = Object.keys(this.$refs).filter(ref => {
+ const comp = this.$refs[ref];
+ return comp &&
+ comp.$options &&
+ comp.$options._componentTag === 'van-form';
+ });
+
+ formRefs.forEach(refName => {
+ const form = this.$refs[refName];
+ if (!form || form._validatedEnhanced) return;
+
+ const originalValidate = form.validate;
+
+ form.validate = function () {
+ // 保留原 validate 的返回值(Promise)
+ const promise = originalValidate.call(this);
+
+ return promise.catch(errorInfo => {
+ if (errorInfo?.length > 0) {
+ const firstError = errorInfo[0];
+ if(firstError.message) {
+ Vue.prototype.$toast?.fail(firstError.message);
+ } else {
+ const fieldName = firstError.name;
+
+ // 滚动到字段
+ this.scrollToField(fieldName);
+
+ // 获取 label
+ const field = this.fields?.find(f => f.name === fieldName);
+ const label = field?.label;
+
+ // 提示用户
+ Vue.prototype.$toast?.fail(`${label} 必填`);
+ }
+ }
+ return new Promise(() => {});
+ });
+ };
+ form._validatedEnhanced = true;
+ });
+ });
+ }
+ });
+}
diff --git a/src/main/resources/views/layouts/platform_h5.html b/src/main/resources/views/layouts/platform_h5.html
index 3d143391..da18e799 100644
--- a/src/main/resources/views/layouts/platform_h5.html
+++ b/src/main/resources/views/layouts/platform_h5.html
@@ -44,6 +44,7 @@
+
diff --git a/src/main/resources/views/platform/zhgh/club/join/apply/index.html b/src/main/resources/views/platform/zhgh/club/join/apply/index.html
index 4f9a84ff..7f949f4f 100644
--- a/src/main/resources/views/platform/zhgh/club/join/apply/index.html
+++ b/src/main/resources/views/platform/zhgh/club/join/apply/index.html
@@ -195,14 +195,16 @@ layout("/layouts/platform.html"){
this.$message.warning("请先阅读并同意协议")
return
}
- this.$axios.post('/platform/club/join/apply/submitAgain', {
- data: JSON.stringify(this.formData),
- taskId: GetQueryString("taskId")
- }).then(res => {
- if (res.code === 0) {
- this.$message.success(res.msg)
- location.href = '/platform/club/join/mine'
- }
+ this.$confirm("您确定要提交申请吗?", "提示", { type: "warning" }).then(() => {
+ this.$axios.post('/platform/club/join/apply/submitAgain', {
+ data: JSON.stringify(this.formData),
+ taskId: GetQueryString("taskId")
+ }).then(res => {
+ if (res.code === 0) {
+ this.$message.success(res.msg)
+ location.href = '/platform/club/join/mine'
+ }
+ })
})
}
})
diff --git a/src/main/resources/views/platform/zhgh/club/join/mine/index.html b/src/main/resources/views/platform/zhgh/club/join/mine/index.html
index 42da0497..f51bd3b7 100644
--- a/src/main/resources/views/platform/zhgh/club/join/mine/index.html
+++ b/src/main/resources/views/platform/zhgh/club/join/mine/index.html
@@ -92,7 +92,7 @@ layout("/layouts/platform.html"){
})
},
onEdit(row) {
- location.href = '/platform/club/join/apply?taskId=' + (row.startTaskId || '') + "&bizId=" + row.id
+ location.href = '/platform/club/join/apply?taskId=' + (row.startTaskId || '') + "&bizId=" + row.id + '&clubId=' + row.clubId
},
onDelete(id) {
this.$confirm("确定要删除此申请吗?", "提示", {
diff --git a/src/main/resources/views/platform/zhghh5/club/apply/index.html b/src/main/resources/views/platform/zhghh5/club/apply/index.html
index 90c36fc4..5aaf24a7 100644
--- a/src/main/resources/views/platform/zhghh5/club/apply/index.html
+++ b/src/main/resources/views/platform/zhghh5/club/apply/index.html
@@ -8,6 +8,7 @@ layout("/layouts/platform_h5.html"){
height: 100vh;
overflow-y: auto;
}
+
/* 同意条款样式 */
.agree-section {
padding: 16px;
@@ -15,6 +16,7 @@ layout("/layouts/platform_h5.html"){
border-radius: 12px;
margin-top: 16px;
}
+
.agree-section .van-checkbox__label {
font-size: 13px;
line-height: 1.5;
@@ -27,38 +29,40 @@ layout("/layouts/platform_h5.html"){
-
+
-
-
+
+
-
+
@@ -66,31 +70,34 @@ layout("/layouts/platform_h5.html"){
-
-
+
+
-
+
@@ -99,13 +106,13 @@ layout("/layouts/platform_h5.html"){
@@ -128,10 +135,10 @@ layout("/layouts/platform_h5.html"){
-
-
保存申请
-
提交申请
-
提交申请
+
+ 保存申请
+ 提交申请
+ 提交申请
@@ -176,74 +183,77 @@ layout("/layouts/platform_h5.html"){
title: "提示",
message: "您确定保存吗?"
}).then(() => {
- this.$axios.post('/platform/club/join/apply/save', {data: JSON.stringify(this.formData)}).then(res => {
+ this.$axios.post("/platform/club/join/apply/save", { data: JSON.stringify(this.formData) }).then(res => {
if (res.code === 0) {
- this.$toast(res.msg);
+ this.$toast(res.msg)
this.$pjaxReplace("/platform/h5/club/mine")
}
})
})
},
async onSubmit() {
- if (!this.isAgree) {
- this.$toast.fail("请先阅读并同意协议");
- return;
- }
await this.$refs.formRef.validate()
+ if (!this.isAgree) {
+ this.$message.warning("请先阅读并同意协议")
+ return
+ }
this.$dialog.confirm({
title: "提示",
message: "您确定要提交申请吗?"
}).then(() => {
this.$axios.post("/platform/club/join/apply/submit", this.formData).then(res => {
if (res.code === 0) {
- this.$toast(res.msg);
+ this.$toast(res.msg)
this.$pjaxReplace("/platform/h5/club/mine")
}
- });
- });
+ })
+ })
},
- onFinishTask() {
- this.$refs.formRef.validate((valid) => {
- if (valid) {
- if (!this.isAgree) {
- this.$message.warning("请先阅读并同意协议")
- return
- }
- this.$axios.post('/platform/club/join/apply/submitAgain', {
+ async onFinishTask() {
+ this.$refs.formRef.validate().then(() => {
+ if (!this.isAgree) {
+ this.$message.warning("请先阅读并同意协议")
+ return
+ }
+ this.$dialog.confirm({
+ title: "提示",
+ message: "您确定要提交申请吗?"
+ }).then(() => {
+ this.$axios.post("/platform/club/join/apply/submitAgain", {
data: JSON.stringify(this.formData),
taskId: GetQueryString("taskId")
}).then(res => {
if (res.code === 0) {
- this.$toast(res.msg);
+ this.$toast(res.msg)
this.$pjaxReplace("/platform/h5/club/mine")
}
})
- }
- })
+ })
+ }).catch()
},
checkApplyClub(clubId) {
this.$axios.post("/platform/club/join/apply/checkApplyClub", { clubId }).then(res => {
if (res.code === 0 && res.data) {
- this.$toast.warning("您已申请加入该协会,请勿重复申请");
- this.formData.clubId = "";
- this.formData.clubName = "";
+ this.$toast.warning("您已申请加入该协会,请勿重复申请")
+ this.formData.clubId = ""
+ this.formData.clubName = ""
}
- });
+ })
},
onClubConfirm(value, index) {
- this.formData.clubId = this.clubOptions[index].id;
- this.formData.clubName = value;
- this.showClubPopup = false;
+ this.formData.clubId = this.clubOptions[index].id
+ this.formData.clubName = value
+ this.showClubPopup = false
// 检查是否已申请该协会
- this.checkApplyClub(this.formData.clubId);
+ this.checkApplyClub(this.formData.clubId)
},
listClub() {
this.$axios.post("/platform/club/common/listClub").then(res => {
if (res.code === 0) {
- this.clubOptions = res.data;
+ this.clubOptions = res.data
}
- });
+ })
},
init() {
this.bizId = GetQueryString("bizId")
@@ -275,11 +285,11 @@ layout("/layouts/platform_h5.html"){
this.$set(this.formData, "position", user.position)
this.$set(this.formData, "academicDegree", user.academicDegree)
}
- },
+ }
},
created() {
- this.listClub();
- this.init();
+ this.listClub()
+ this.init()
}
})
diff --git a/src/main/resources/views/platform/zhghh5/club/common/clubUserJoin.js b/src/main/resources/views/platform/zhghh5/club/common/clubUserJoin.js
index 7d0f43d8..f436ca0e 100644
--- a/src/main/resources/views/platform/zhghh5/club/common/clubUserJoin.js
+++ b/src/main/resources/views/platform/zhghh5/club/common/clubUserJoin.js
@@ -2,13 +2,8 @@ const clubUserJoin = {
template:
/*language=HTML*/
`
-