小程序修改

This commit is contained in:
2026-07-12 19:44:36 +08:00
parent 3b4833b51a
commit e2dfb08de3
45 changed files with 2028 additions and 347 deletions
+22
View File
@@ -0,0 +1,22 @@
import Taro from '@tarojs/taro';
const USER_PHONE_KEY = 'user_phone';
export function saveUserPhone(phone: string) {
const normalized = phone.replace(/\D/g, '').slice(0, 11);
if (!/^1[3-9]\d{9}$/.test(normalized)) return;
try {
Taro.setStorageSync(USER_PHONE_KEY, normalized);
} catch {
/* ignore */
}
}
export function getStoredUserPhone(): string {
try {
const value = Taro.getStorageSync(USER_PHONE_KEY);
return typeof value === 'string' ? value : '';
} catch {
return '';
}
}