feat(admin,partner,shop,mini,domain): 联系电话脱敏支持座机 + 套餐表单多行输入

- maskPhone/maskContactPhone 支持座机(含区号/分机)脱敏展示,domain 补充单测
- 套餐「使用时间/其他说明」由单行 input 改为多行 textarea(admin/h5-partner/h5-shop)
- 后台「套餐审核」标签文字恒为白色(不受 Badge 角标影响)
- 新增 deploy/sync-prod-db-to-local.sh:线上库经 SSH 隧道同步至本地(含 @ 密码/base64 解析、--lock-tables=0 兼容受限账号)

Co-Authored-By: WorkBuddy <workbuddy@tencent.com>
This commit is contained in:
2026-08-16 08:51:43 +08:00
parent 0f48d7abda
commit 8de41796fb
9 changed files with 294 additions and 26 deletions
@@ -283,7 +283,8 @@ const AdminStorePackagesSection = forwardRef<AdminStorePackagesHandle, { storeId
</Form.Item>
<Form.Item label="使用时间" style={{ marginBottom: 12 }}>
<Input
<Input.TextArea
rows={2}
placeholder="节假日除外"
value={item.usableTime || ''}
onChange={(e) => updateAt(index, { usableTime: e.target.value })}
@@ -303,7 +304,8 @@ const AdminStorePackagesSection = forwardRef<AdminStorePackagesHandle, { storeId
</Form.Item>
<Form.Item label="其他说明" style={{ marginBottom: 0 }}>
<Input
<Input.TextArea
rows={2}
placeholder="不可叠加"
value={item.otherNotes || ''}
onChange={(e) => updateAt(index, { otherNotes: e.target.value })}
+1 -1
View File
@@ -259,7 +259,7 @@ function attachPackageAuditBadge(items: MenuProps['items'], pendingCount: number
...item,
label: (
<Badge count={pendingCount} size="small" offset={[8, 0]}>
<span style={{ color: '#ffffffa6' }}></span>
</Badge>
),
} as MenuItem;
+21 -2
View File
@@ -140,10 +140,29 @@ export function fmtTime(v?: string | null) {
return v ? new Date(v).toLocaleString('zh-CN') : '—';
}
/** 手机号脱敏展示:138****5678;空值返回 — */
/** 联系电话脱敏:手机 138****5678;座机 0379-****888;空值返回 — */
export function maskPhone(phone?: string | null): string {
const raw = String(phone ?? '').trim();
const raw = String(phone ?? '').trim().replace(/\s+/g, '');
if (!raw) return '—';
if (/^1[3-9]\d{9}$/.test(raw)) {
const digits = raw.replace(/\D/g, '');
return `${digits.slice(0, 3)}****${digits.slice(-4)}`;
}
if (/^0\d{2,3}-?\d{7,8}(-\d{1,6})?$/.test(raw)) {
const extMatch = raw.match(/-(\d{1,6})$/);
const hasExt = !!extMatch && raw.indexOf('-') !== raw.lastIndexOf('-');
const ext = hasExt ? extMatch![1] : '';
const main = hasExt ? raw.slice(0, -(ext.length + 1)) : raw;
const digits = main.replace(/\D/g, '');
const areaLen = digits.startsWith('01') || digits.startsWith('02') ? 3 : 4;
const area = digits.slice(0, areaLen);
const local = digits.slice(areaLen);
const keepTail = Math.min(4, Math.max(2, local.length - 4));
const maskedLocal =
local.length <= 4 ? '*'.repeat(local.length) : `${'*'.repeat(local.length - keepTail)}${local.slice(-keepTail)}`;
const joiner = main.includes('-') ? '-' : '';
return ext ? `${area}${joiner}${maskedLocal}-${ext}` : `${area}${joiner}${maskedLocal}`;
}
const digits = raw.replace(/\D/g, '');
if (digits.length >= 11) {
return `${digits.slice(0, 3)}****${digits.slice(-4)}`;
@@ -119,15 +119,13 @@ export default function StorePackagesForm({ items, onChange, disabled, embedded
<div className="partner-field">
<label>使</label>
<div className="partner-field-input">
<span className="material-symbols-outlined">schedule</span>
<input
placeholder="节假日除外"
value={item.usableTime || ''}
disabled={disabled}
onChange={(e) => updateAt(index, { usableTime: e.target.value })}
/>
</div>
<textarea
rows={2}
placeholder="节假日除外"
value={item.usableTime || ''}
disabled={disabled}
onChange={(e) => updateAt(index, { usableTime: e.target.value })}
/>
</div>
<div className="partner-field">
@@ -154,15 +152,13 @@ export default function StorePackagesForm({ items, onChange, disabled, embedded
<div className="partner-field">
<label></label>
<div className="partner-field-input">
<span className="material-symbols-outlined">info</span>
<input
placeholder="不可叠加"
value={item.otherNotes || ''}
disabled={disabled}
onChange={(e) => updateAt(index, { otherNotes: e.target.value })}
/>
</div>
<textarea
rows={2}
placeholder="不可叠加"
value={item.otherNotes || ''}
disabled={disabled}
onChange={(e) => updateAt(index, { otherNotes: e.target.value })}
/>
</div>
</>
) : null}
@@ -148,8 +148,9 @@ export default function ShopPackagesForm({ items, onChange, disabled }: Props) {
<label className="shop-packages-field">
<span className="shop-packages-label">使</span>
<input
<textarea
className="shop-packages-input"
rows={2}
placeholder="节假日除外"
value={item.usableTime || ''}
disabled={disabled}
@@ -213,8 +214,9 @@ export default function ShopPackagesForm({ items, onChange, disabled }: Props) {
<label className="shop-packages-field">
<span className="shop-packages-label"></span>
<input
<textarea
className="shop-packages-input"
rows={2}
placeholder="不可叠加"
value={item.otherNotes || ''}
disabled={disabled}
+33 -1
View File
@@ -1,4 +1,5 @@
const MOBILE_PHONE_RE = /^1[3-9]\d{9}$/;
const LANDLINE_PHONE_RE = /^0\d{2,3}-?\d{7,8}(-\d{1,6})?$/;
export function normalizePhoneInput(value: string): string {
return value.replace(/\D/g, '').slice(0, 11);
@@ -18,8 +19,39 @@ export function validateMobilePhone(phone: string): { ok: boolean; message?: str
return { ok: true };
}
function normalizeContactPhone(raw: string): string {
return String(raw ?? '')
.trim()
.replace(/\s+/g, '');
}
/**
* 脱敏展示:手机 138****8000;座机保留区号,如 0379-****888。
* 门店详情电话展示用(拨号仍走 toDialablePhone 明文)。
*/
export function maskPhone(phone: string) {
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
const normalized = normalizeContactPhone(phone);
if (!normalized) return '';
if (MOBILE_PHONE_RE.test(normalized)) {
const digits = normalized.replace(/\D/g, '');
return `${digits.slice(0, 3)}****${digits.slice(-4)}`;
}
if (LANDLINE_PHONE_RE.test(normalized)) {
const extMatch = normalized.match(/-(\d{1,6})$/);
const hasExt = !!extMatch && normalized.indexOf('-') !== normalized.lastIndexOf('-');
const ext = hasExt ? extMatch![1] : '';
const main = hasExt ? normalized.slice(0, -(ext.length + 1)) : normalized;
const digits = main.replace(/\D/g, '');
const areaLen = digits.startsWith('01') || digits.startsWith('02') ? 3 : 4;
const area = digits.slice(0, areaLen);
const local = digits.slice(areaLen);
const keepTail = Math.min(4, Math.max(2, local.length - 4));
const maskedLocal =
local.length <= 4 ? '*'.repeat(local.length) : `${'*'.repeat(local.length - keepTail)}${local.slice(-keepTail)}`;
const joiner = main.includes('-') ? '-' : '';
return ext ? `${area}${joiner}${maskedLocal}-${ext}` : `${area}${joiner}${maskedLocal}`;
}
return normalized.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
}
export function toDialablePhone(raw: string): string {