From 1910e9f27373b8b4da75f076762025ceb3419965 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期四, 12 六月 2025 15:40:50 +0800
Subject: [PATCH] fix: 暂时隐藏电信充值通道
---
apps/h5/src/utils/validator.ts | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/apps/h5/src/utils/validator.ts b/apps/h5/src/utils/validator.ts
new file mode 100644
index 0000000..970a9c8
--- /dev/null
+++ b/apps/h5/src/utils/validator.ts
@@ -0,0 +1,46 @@
+import { EditorType } from '@/constants';
+import _ from 'lodash';
+
+export class FormValidator {
+ /**
+ * 楠岃瘉琛ㄥ崟input-number 涓嶄负0
+ */
+ static validatorNumberNotNull(rule: any, value: any, callback: any) {
+ // eslint-disable-next-line eqeqeq
+ if (!value) {
+ return callback(new Error(rule.message));
+ }
+ callback();
+ }
+
+ static validatorRichEditor(rule: any, value: API.IntroInfo[], callback: any) {
+ // eslint-disable-next-line eqeqeq
+ const textEditorItem = value.filter((x) => x.type === EditorType.Text);
+ if (textEditorItem.some((x) => !x.content)) {
+ return callback(new Error(rule.message));
+ }
+ callback();
+ }
+ static validatorWeMap(rule: any, value: WeMapModel, callback: any) {
+ // eslint-disable-next-line eqeqeq
+ if (_.isEmpty(value) || Object.values(value).some((x) => !x)) {
+ return callback(new Error(rule.message));
+ }
+ callback();
+ }
+}
+
+export async function validateFormList(refs: any) {
+ try {
+ const validateList = Object.values(refs).map((x) => {
+ const ref = x as any;
+ if (Array.isArray(ref)) {
+ return ref[0].validate();
+ }
+ return ref.validate();
+ });
+
+ let res = await Promise.allSettled(validateList);
+ return res.every((x) => x.status === 'fulfilled');
+ } catch (error) {}
+}
--
Gitblit v1.9.1