fix:完善门店和总部管理端

This commit is contained in:
ljy
2026-07-06 20:58:38 +08:00
parent 67b5a580c5
commit fcf1d45522
25 changed files with 1273 additions and 118 deletions
+5 -2
View File
@@ -2,6 +2,9 @@ import type { WechatLoginPlatform, WechatLoginResult } from '@dukang/shared-type
import { getRuntimePlatform, isWechatBrowser } from './env';
import type { WeixinSdkConfig } from './types';
/** 非微信内置浏览器时提示(与 C 端 LoginPage 文案一致) */
export const WECHAT_INAPP_REQUIRED_MSG = '请在微信内打开以使用微信一键授权';
const OAUTH_STATE_KEY = 'dukang_wx_oauth_state';
function randomState() {
@@ -43,7 +46,7 @@ export async function getWechatOAuthUrl(
/** 发起微信 OAuth 登录(H5 公众号内跳转授权) */
export async function startWechatOAuthLogin(config: WeixinSdkConfig, redirectUri?: string): Promise<void> {
if (!isWechatBrowser()) {
throw new Error('请在微信内打开');
throw new Error(WECHAT_INAPP_REQUIRED_MSG);
}
const uri = redirectUri ?? window.location.href.split('#')[0];
const url = await getWechatOAuthUrl(config, uri);
@@ -142,5 +145,5 @@ export async function wechatLogin(config: WeixinSdkConfig): Promise<WechatLoginR
await startWechatOAuthLogin(config);
return;
}
throw new Error('请在微信内打开以使用微信登录');
throw new Error(WECHAT_INAPP_REQUIRED_MSG);
}