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 ''; } }