fix: 手机绑定状态
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m24s

This commit is contained in:
luo
2026-09-20 16:19:48 +08:00
parent c0cc1ae6dd
commit a81b403cce
3 changed files with 38 additions and 3 deletions

25
utils/phone-bind.js Normal file
View File

@@ -0,0 +1,25 @@
const PHONE_BIND_STATUS_KEY = 'phoneBindStatus';
const readStatuses = () => {
const statuses = uni.getStorageSync(PHONE_BIND_STATUS_KEY);
return statuses && typeof statuses === 'object' && !Array.isArray(statuses) ? statuses : {};
};
export const getPhoneBindStatus = (identifier) => {
if (!identifier) return null;
const status = readStatuses()[identifier];
return status && status.bound ? status : null;
};
export const setPhoneBindStatus = (identifier, phone) => {
if (!identifier) return;
const statuses = readStatuses();
statuses[identifier] = {
bound: true,
phone: phone || '',
updatedAt: Date.now()
};
uni.setStorageSync(PHONE_BIND_STATUS_KEY, statuses);
};