/** * 检查手机号绑定状态 * 如果未绑定手机号,则跳转到登录页面进行绑定 * @returns {boolean} 是否已绑定手机号 */ export function checkPhoneBound() { // 获取用户信息 const userInfo = uni.getStorageSync('user_info') || {} console.log('[checkPhoneBound] 检查用户信息:', { mobile: userInfo.mobile, phone: userInfo.phone, phone_number: userInfo.phone_number, userInfoKeys: Object.keys(userInfo) }) const mobile = userInfo.mobile || userInfo.phone || userInfo.phone_number || '' // 如果已绑定手机号,直接返回 if (mobile) { console.log('[checkPhoneBound] 已检测到手机号,允许通过:', mobile) return true } // 未绑定手机号,显示提示并跳转 console.warn('[checkPhoneBound] 未检测到手机号,提示用户绑定') uni.showModal({ title: '需要绑定手机号', content: '为了账号安全,请先绑定手机号', showCancel: false, confirmText: '去绑定', success: () => { uni.navigateTo({ url: '/pages/login/index?mode=sms' }) } }) return false }