From da86294fdeace4643ec7118a4974fbfae53148e4 Mon Sep 17 00:00:00 2001 From: ozh Date: Mon, 28 Sep 2026 16:18:45 +0800 Subject: [PATCH] =?UTF-8?q?chore(log):=20=E6=B8=85=E7=90=86=E8=81=94?= =?UTF-8?q?=E8=B0=83=E6=8E=92=E9=9A=9C=E6=97=A5=E5=BF=97=EF=BC=8C=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E9=9D=99=E9=BB=98=E5=8C=96=20http=20=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - http/client.ts 响应日志仅在 development 打印,移除 Message/token 两条 console.log - 登录流程(wxLoginFlow/登录页)移除全部 [login] 调试日志 - 设备图标未匹配的 [ICON] 核对日志已确认完毕,移除 - 家庭圈添加关爱对象卡达上限改整卡隐藏,上限信息由"关爱对象 n/N" 标题计数表达,删除灰化态样式 --- src/http/client.ts | 7 ++--- src/pages/device/index.tsx | 7 ----- src/pages/family/detail.module.scss | 40 ++++++++++++++++------------- src/pages/family/detail.tsx | 35 +++++++++++++------------ src/pages/login/index.tsx | 2 -- src/pages/login/wxLoginFlow.ts | 4 --- 6 files changed, 44 insertions(+), 51 deletions(-) diff --git a/src/http/client.ts b/src/http/client.ts index 0fd37c5..96d4c6e 100644 --- a/src/http/client.ts +++ b/src/http/client.ts @@ -94,7 +94,10 @@ export async function request( throw new ApiError(raw || '网络异常') } - console.log(`[http] ${method} ${url} ←`, res.statusCode, res.data) + // 开发期联调日志:dev 才打印响应体,生产静默(网络失败/踢登录仍走 console.error 保留) + if (process.env.NODE_ENV === 'development') { + console.log(`[http] ${method} ${url} ←`, res.statusCode, res.data) + } if (res.statusCode !== 200) { if (res.statusCode === 401) { @@ -121,13 +124,11 @@ export async function request( // 200 成功内的子状态(Message 携带,如 needUserInfo/noMobile),附到返回值供调用方分支处理 const subState = body.Message if (subState && subState !== '') { - console.log(`[http] ${url} 响应 Message=${subState}`, body.Content) ;(body.Content as Record).message = subState } // 后端把登录 token 放响应头 Token(仅登录接口返回;Content.code 恒为 null)——附到返回值供登录流程落地 const resToken = pickResponseToken(res.header) if (resToken) { - console.log(`[http] ${url} 响应头携带 token`) ;(body.Content as Record).token = resToken } return body.Content diff --git a/src/pages/device/index.tsx b/src/pages/device/index.tsx index 8700242..45f687e 100644 --- a/src/pages/device/index.tsx +++ b/src/pages/device/index.tsx @@ -27,13 +27,6 @@ const pickDeviceIcon = (device: HomeDevice): string | null => { if (model === 'EB15') return eb15Icon if (model === 'ED713') return ed713Icon if (model === 'ED719') return ed719Icon - // 调试:未匹配时打印设备型号字段,方便核对后端实际值(确认后移除) - console.log('[ICON] no match', { - installId: device.installId, - deviceModel: device.deviceModel, - subDeviceType: device.subDeviceType, - name: device.name - }) return null } diff --git a/src/pages/family/detail.module.scss b/src/pages/family/detail.module.scss index 358de08..584ae2d 100644 --- a/src/pages/family/detail.module.scss +++ b/src/pages/family/detail.module.scss @@ -15,7 +15,7 @@ padding: 24px; } -// 添加关爱对象虚线卡:与列表页底部加号卡同款式 +// 添加关爱对象虚线卡:与列表页底部加号卡同款式(达上限时整卡隐藏,不渲染灰化态) .addCared { margin-top: 0; padding: 48px 32px; @@ -27,11 +27,6 @@ align-items: center; } -// 达上限态:灰化降级,明确"不可点" -.addCaredDisabled { - border-color: $color-border; -} - .addCaredIcon { width: 96px; height: 96px; @@ -43,29 +38,17 @@ margin-bottom: 16px; } -.addCaredIconDisabled { - background: $color-bg-disabled; -} - .addCaredIconText { font-size: 48px; font-weight: 300; color: #ffffff; } -.addCaredIconTextDisabled { - color: $color-text-tertiary; -} - .addCaredText { font-size: 26px; color: $color-text-secondary; } -.addCaredTextDisabled { - color: $color-text-tertiary; -} - .addCaredPressed { opacity: 0.85; } @@ -118,6 +101,27 @@ margin: 8px 8px 16px; } +// 标题行:左标题 + n/N 计数(满员时由计数表达上限,替代灰化占位卡) +.sectionTitleRow { + display: flex; + align-items: center; + margin: 8px 8px 16px; +} + +.sectionTitleRow .sectionTitle { + margin: 0; +} + +.sectionCount { + margin-left: 12px; + padding: 2px 16px; + background: $color-primary-light-bg; + border-radius: $radius-pill; + font-size: 22px; + font-weight: 500; + color: $color-primary-deep; +} + .sectionEmpty { display: block; padding: 32px 8px; diff --git a/src/pages/family/detail.tsx b/src/pages/family/detail.tsx index 536a3db..bdccb22 100644 --- a/src/pages/family/detail.tsx +++ b/src/pages/family/detail.tsx @@ -224,26 +224,27 @@ export default function FamilyDetail() { - {/* 添加关爱对象卡:达上限后灰化静态 */} - - - - + - + {/* 添加关爱对象卡:达上限后整卡隐藏(占位无意义),上限信息改由标题计数表达 */} + {canAdd && ( + + + + + + + 最多可添加 {MAX_CARED_PER_FAMILY} 人 - - {canAdd ? `+ 最多可添加 ${MAX_CARED_PER_FAMILY} 人` : '已达上限'} - - + )} - 关爱对象 + + 关爱对象 + + {caredCount}/{MAX_CARED_PER_FAMILY} + + {caredCount === 0 ? ( 暂无关爱对象,点击上方卡片添加 ) : ( diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index dd7ffd0..1110373 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -51,7 +51,6 @@ export default function Login() { const applyResult = async (result: Awaited>) => { const state = getLoginSubState(result) if (state !== 'complete') { - console.log('[login-page] 注册未完成,推进到', state) if (state === 'noMobile') { // 手机号授权暂缓(后端字段未定):提示并保持当前态,等后端确认后接续 throw new Error('后端要求绑定手机号,该流程暂未开通') @@ -68,7 +67,6 @@ export default function Login() { // token 优先取响应头落地(http 层附到 token 字段);Content.code 后端恒返 null 仅作兼容 const token = result.token ?? result.code if (!token || !result.userInfo) throw new Error('登录响应缺少凭证') - console.log('[login-page] 登录完成,token 已落地') setNeedAuth(false) dispatch(setAuth({ token, userInfo: result.userInfo })) await reLaunch(afterLoginUrl()) diff --git a/src/pages/login/wxLoginFlow.ts b/src/pages/login/wxLoginFlow.ts index b6bfa84..8547ad2 100644 --- a/src/pages/login/wxLoginFlow.ts +++ b/src/pages/login/wxLoginFlow.ts @@ -35,10 +35,8 @@ export async function performWxLogin(): Promise { } if (!code) throw new Error('获取微信登录凭证失败') const openId = storage.get(WX_OPENID_STORAGE_KEY) ?? undefined - console.log('[login] performWxLogin 请求', { appId: resolveAppId(), code, openId }) const result = await wxMiniappLogin({ appId: resolveAppId(), code, openId }) if (result.openId) storage.set(WX_OPENID_STORAGE_KEY, result.openId) - console.log('[login] performWxLogin 结果', getLoginSubState(result), result) return result } @@ -55,10 +53,8 @@ async function reloginWith( throw new Error('获取微信登录凭证失败,请重试') } const params = { appId: resolveAppId(), code, openId, ...extra } - console.log('[login] 重调登录接口', params) const result = await wxMiniappLogin(params) if (result.openId) storage.set(WX_OPENID_STORAGE_KEY, result.openId) - console.log('[login] 重调结果', getLoginSubState(result), result) return result }