From 89380e6260a75d1d3b94de687ebcc2f50d50659d Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 03 Feb 2026 15:44:33 +0800
Subject: [PATCH] feat:环境变量配置调整
---
packages/utils/common/index.js | 29 +++++++++++++++++++++++++----
1 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/packages/utils/common/index.js b/packages/utils/common/index.js
index 4b4a9a3..2fe1b9c 100644
--- a/packages/utils/common/index.js
+++ b/packages/utils/common/index.js
@@ -4,8 +4,8 @@
* @LastEditors : yuan
* @LastEditTime : 2026-01-20 17:20:21
* @FilePath : \packages\utils\common\index.js
- * @Description :
- * Copyright 2026 OBKoro1, All Rights Reserved.
+ * @Description :
+ * Copyright 2026 OBKoro1, All Rights Reserved.
* 2026-01-20 17:01:20
*/
export function fieldRules(required,max) {
@@ -22,9 +22,30 @@
return rules
}
+const isContactPhone = value => {
+ const mobile = /^1[3-9]\d{9}$/
+ const landline = /^0\d{2,3}-?\d{7,8}$/
+ return mobile.test(value) || landline.test(value)
+}
-export function getDictLabel(value, dictList) {
- return dictList.filter(item => String(value).includes(String(item.dictKey))).map(item => item.dictValue).join(',')
+export const contactPhoneRules = (required = true, max = 50) => {
+ const validateContactPhone = (rule, value, callback) => {
+ const nextValue = String(value || '').trim()
+ if (!nextValue) return callback()
+ if (isContactPhone(nextValue)) return callback()
+ return callback(new Error('联系电话格式不正确'))
+ }
+
+ return [...fieldRules(required, max), { validator: validateContactPhone, trigger: ['blur', 'change'] }]
+}
+
+export function getDictLabel(value, dictList = []) {
+ if (value === null || value === undefined || value === '') return '';
+ const values = String(value).split(',');
+ return dictList
+ .filter(item => values.includes(String(item.dictKey)))
+ .map(item => item.dictValue)
+ .join(',');
}
export function blobDownload(res) {
--
Gitblit v1.9.3