chore(log): 清理联调排障日志,生产静默化 http 响应打印
- http/client.ts 响应日志仅在 development 打印,移除 Message/token 两条 console.log - 登录流程(wxLoginFlow/登录页)移除全部 [login] 调试日志 - 设备图标未匹配的 [ICON] 核对日志已确认完毕,移除 - 家庭圈添加关爱对象卡达上限改整卡隐藏,上限信息由"关爱对象 n/N" 标题计数表达,删除灰化态样式
This commit is contained in:
parent
82aa7d6925
commit
da86294fde
|
|
@ -94,7 +94,10 @@ export async function request<T>(
|
|||
throw new ApiError(raw || '网络异常')
|
||||
}
|
||||
|
||||
// 开发期联调日志: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<T>(
|
|||
// 200 成功内的子状态(Message 携带,如 needUserInfo/noMobile),附到返回值供调用方分支处理
|
||||
const subState = body.Message
|
||||
if (subState && subState !== '') {
|
||||
console.log(`[http] ${url} 响应 Message=${subState}`, body.Content)
|
||||
;(body.Content as Record<string, unknown>).message = subState
|
||||
}
|
||||
// 后端把登录 token 放响应头 Token(仅登录接口返回;Content.code 恒为 null)——附到返回值供登录流程落地
|
||||
const resToken = pickResponseToken(res.header)
|
||||
if (resToken) {
|
||||
console.log(`[http] ${url} 响应头携带 token`)
|
||||
;(body.Content as Record<string, unknown>).token = resToken
|
||||
}
|
||||
return body.Content
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -224,26 +224,27 @@ export default function FamilyDetail() {
|
|||
<View className={styles.body}>
|
||||
<FamilyCard family={family} />
|
||||
|
||||
{/* 添加关爱对象卡:达上限后灰化静态 */}
|
||||
{/* 添加关爱对象卡:达上限后整卡隐藏(占位无意义),上限信息改由标题计数表达 */}
|
||||
{canAdd && (
|
||||
<View
|
||||
className={`${styles.addCared} ${canAdd ? '' : styles.addCaredDisabled}`}
|
||||
hoverClass={canAdd ? styles.addCaredPressed : 'none'}
|
||||
onClick={canAdd ? addCared : undefined}
|
||||
className={styles.addCared}
|
||||
hoverClass={styles.addCaredPressed}
|
||||
onClick={addCared}
|
||||
>
|
||||
<View className={`${styles.addCaredIcon} ${canAdd ? '' : styles.addCaredIconDisabled}`}>
|
||||
<Text
|
||||
className={`${styles.addCaredIconText} ${canAdd ? '' : styles.addCaredIconTextDisabled}`}
|
||||
>
|
||||
+
|
||||
</Text>
|
||||
<View className={styles.addCaredIcon}>
|
||||
<Text className={styles.addCaredIconText}>+</Text>
|
||||
</View>
|
||||
<Text className={`${styles.addCaredText} ${canAdd ? '' : styles.addCaredTextDisabled}`}>
|
||||
{canAdd ? `+ 最多可添加 ${MAX_CARED_PER_FAMILY} 人` : '已达上限'}
|
||||
</Text>
|
||||
<Text className={styles.addCaredText}>+ 最多可添加 {MAX_CARED_PER_FAMILY} 人</Text>
|
||||
</View>
|
||||
)}
|
||||
|
||||
<View className={styles.section}>
|
||||
<View className={styles.sectionTitleRow}>
|
||||
<Text className={styles.sectionTitle}>关爱对象</Text>
|
||||
<Text className={styles.sectionCount}>
|
||||
{caredCount}/{MAX_CARED_PER_FAMILY}
|
||||
</Text>
|
||||
</View>
|
||||
{caredCount === 0 ? (
|
||||
<Text className={styles.sectionEmpty}>暂无关爱对象,点击上方卡片添加</Text>
|
||||
) : (
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ export default function Login() {
|
|||
const applyResult = async (result: Awaited<ReturnType<typeof performWxLogin>>) => {
|
||||
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())
|
||||
|
|
|
|||
|
|
@ -35,10 +35,8 @@ export async function performWxLogin(): Promise<WxMiniappLoginResponse> {
|
|||
}
|
||||
if (!code) throw new Error('获取微信登录凭证失败')
|
||||
const openId = storage.get<string>(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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue