Merge commit 'fcf1d45522e3ba6e6faf2590b60f2db1ef90e73c' into dev_jacy

This commit is contained in:
2026-07-07 13:55:10 +08:00
85 changed files with 11210 additions and 164 deletions
+3
View File
@@ -4,6 +4,8 @@ export interface AppConfig {
mockPay: boolean;
mockDeliveryAuto: boolean;
autoApproveStore: boolean;
/** preV1 Mock 微信授权登录:点击授权按钮走 Mock 流程直接登录,不接真实微信 */
mockWechat: boolean;
wechatAuthEnabled: boolean;
wechatPayEnabled: boolean;
wxAppId: string;
@@ -32,6 +34,7 @@ export function loadAppConfig(env?: Record<string, string | undefined>): AppConf
mockPay: e.MOCK_PAY !== 'false',
mockDeliveryAuto: e.MOCK_DELIVERY_AUTO !== 'false',
autoApproveStore: e.AUTO_APPROVE_STORE !== 'false',
mockWechat: e.MOCK_WECHAT === 'true',
wechatAuthEnabled: e.WECHAT_AUTH_ENABLED === 'true',
wechatPayEnabled: e.WECHAT_PAY_ENABLED === 'true' || e.MOCK_PAY === 'false',
wxAppId: e.WX_APP_ID ?? '',
+1
View File
@@ -11,3 +11,4 @@ export * from './ops';
export * from './ticket';
export * from './user-log';
export * from './store-log';
export * from './promo';
+24
View File
@@ -0,0 +1,24 @@
export type PromoCodeStatus = 'ACTIVE' | 'DISABLED';
export type PromoCodeItem = {
id: string;
code: string;
name: string;
status: PromoCodeStatus;
scanCount: number;
orderCount: number;
landingUrl: string;
createdAt: string;
};
export type PromoCodeStats = {
scanCount: number;
orderCount: number;
conversionRate: number;
};
export type PromoTouchResult = {
promoCode: string;
channelName: string;
attributed: boolean;
};
+1 -2
View File
@@ -374,11 +374,10 @@ button, input, select, textarea { font: inherit; }
border-radius: 8px;
color: var(--color-subtle-gray);
text-decoration: none;
transition: transform 0.1s;
transition: color 0.15s;
}
.app-tabbar-item.active { color: var(--color-heritage-red); }
.app-tabbar-item:active { transform: scale(0.9); }
.app-tabbar-icon { font-size: 24px; line-height: 1; }
+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);
}
+1
View File
@@ -20,6 +20,7 @@ export {
bindWechatPhone,
getWechatPhoneNumber,
wechatLogin,
WECHAT_INAPP_REQUIRED_MSG,
} from './auth';
export type { WeixinSdkConfig, WxApi, MiniProgramWx } from './types';
export { DEFAULT_JS_API_LIST } from './types';