From ad1629e4f90490758dbd91c4d8a9bed4a8693dfc Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期三, 11 二月 2026 15:59:14 +0800
Subject: [PATCH] 合并
---
mini-program/utils/utils.js | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/mini-program/utils/utils.js b/mini-program/utils/utils.js
index feff5e3..7d9a5d4 100644
--- a/mini-program/utils/utils.js
+++ b/mini-program/utils/utils.js
@@ -19,4 +19,25 @@
} else {
return date
}
+}
+
+/**
+ * 灏嗘墜鏈哄彿涓棿鍥涗綅鏇挎崲涓�*
+ * @param {string} phone - 鎵嬫満鍙�
+ * @returns {string} 鏍煎紡鍖栧悗鐨勬墜鏈哄彿
+ */
+export const formatPhoneStar = (phone) => {
+ if (!phone) return ''
+
+ // 绉婚櫎闈炴暟瀛楀瓧绗�
+ const cleaned = phone.replace(/\D/g, '')
+
+ // 妫�鏌ユ槸鍚︿负11浣嶆墜鏈哄彿
+ if (cleaned.length !== 11) {
+ console.warn('鎵嬫満鍙烽暱搴︿笉姝g‘')
+ return phone // 鎴栬�呰繑鍥� cleaned锛屾牴鎹渶姹�
+ }
+
+ // 淇濈暀鍓�3浣嶅拰鍚�4浣嶏紝涓棿4浣嶇敤*浠f浛
+ return cleaned.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
}
\ No newline at end of file
--
Gitblit v1.9.3