diff --git a/apps/mini-user/src/lib/api.ts b/apps/mini-user/src/lib/api.ts index 59c294b..807c93a 100644 --- a/apps/mini-user/src/lib/api.ts +++ b/apps/mini-user/src/lib/api.ts @@ -18,7 +18,9 @@ function resolveApiBase(): string { export const API_BASE = resolveApiBase(); const TOKEN_KEY = 'user_access_token'; const REFRESH_KEY = 'user_refresh_token'; -export const CLIENT_APP = ClientApp.USER_MINI; +/** H5 产物走公众号体系(USER_H5);小程序原生走 USER_MINI。勿混用,否则 JSAPI 会出现 appid 与 openid 不匹配 */ +export const CLIENT_APP = + process.env.TARO_ENV === 'h5' ? ClientApp.USER_H5 : ClientApp.USER_MINI; export function getToken(): string { try { diff --git a/apps/mini-user/src/lib/weixin.ts b/apps/mini-user/src/lib/weixin.ts index 5253acf..e138e45 100644 --- a/apps/mini-user/src/lib/weixin.ts +++ b/apps/mini-user/src/lib/weixin.ts @@ -2,11 +2,10 @@ import { createWeixinSdk, isWechatEnv } from '@dukang/weixin-sdk'; import { API_BASE, CLIENT_APP, getToken } from './api'; /** - * H5 公众号内 JSSDK(分享 / OAuth / 支付)须与业务 API 使用同一 X-Client-App。 - * mini-user 全端(含 H5 产物)统一为 USER_MINI,否则 OAuth 登录签发的 JWT - * 与本地请求头 USER_MINI 不匹配 → 401 清登录 → 反复拉起微信授权。 - * - * (历史 h5-user 仍用 USER_H5;公众号能力由后端凭证配置,不依赖该 ClientApp 标签。) + * H5 与业务 API 共用 CLIENT_APP: + * - H5 → USER_H5(公众号 OAuth openId + 公众号支付 appId) + * - 小程序 → USER_MINI + * 须与 JWT 签发一致,才能同时避免「反复授权」与「appid/openid 不匹配」。 */ export const weixinSdk = createWeixinSdk({ apiBase: API_BASE, diff --git a/apps/mini-user/src/styles/login.css b/apps/mini-user/src/styles/login.css index 3ffef27..30d18f9 100644 --- a/apps/mini-user/src/styles/login.css +++ b/apps/mini-user/src/styles/login.css @@ -102,11 +102,13 @@ border-bottom: 1px solid var(--color-surface-variant, #e8e4de); padding-bottom: 8px; margin-bottom: 16px; + min-height: 40px; } .login-field-prefix { font-size: 16px; font-weight: 500; + line-height: 32px; color: var(--color-on-surface); margin-right: 12px; flex-shrink: 0; @@ -119,9 +121,28 @@ padding: 0; height: 32px; font-size: 16px; - line-height: 24px; + line-height: 32px; color: var(--color-on-surface); min-width: 0; + box-sizing: border-box; + display: flex; + align-items: center; +} + +.login-field-input input, +.login-field-input .taro-input, +.login-field-input .weui-input { + width: 100% !important; + height: 100% !important; + min-height: 0 !important; + padding: 0 !important; + margin: 0 !important; + border: none !important; + background: transparent !important; + box-sizing: border-box !important; + font-size: 16px !important; + line-height: normal !important; + color: inherit; } .login-get-code {