style(mpuniapp): 移动浏览器全量页面UI/UX审视与瑞士国际主义排版优化
这个提交包含在:
@@ -11,6 +11,8 @@ export type SocialProvider = 'google' | 'apple';
|
||||
|
||||
export type LoginCopyKey =
|
||||
| 'title'
|
||||
| 'brandTag'
|
||||
| 'subtitle'
|
||||
| 'desc'
|
||||
| 'tabPhone'
|
||||
| 'tabEmail'
|
||||
@@ -21,12 +23,18 @@ export type LoginCopyKey =
|
||||
| 'login'
|
||||
| 'magicLink'
|
||||
| 'emailPlaceholder'
|
||||
| 'orContinueWith'
|
||||
| 'google'
|
||||
| 'apple'
|
||||
| 'comingSoon'
|
||||
| 'phoneRequired'
|
||||
| 'emailRequired'
|
||||
| 'codeRequired'
|
||||
| 'termsNotice'
|
||||
| 'termsOfService'
|
||||
| 'privacyPolicy'
|
||||
| 'and'
|
||||
| 'countdownSuffix'
|
||||
| 'loginSuccess';
|
||||
|
||||
export type LoginState = {
|
||||
@@ -37,6 +45,7 @@ export type LoginState = {
|
||||
email: string;
|
||||
submitting: boolean;
|
||||
errorMessage: string;
|
||||
countdown: number;
|
||||
};
|
||||
|
||||
function isZhLocale(): boolean {
|
||||
@@ -46,7 +55,7 @@ function isZhLocale(): boolean {
|
||||
/**
|
||||
* 登录文案:能复用 locale.uts 的走词典,缺 key 时中英简单分支
|
||||
*/
|
||||
export function resolveLoginText(key: LoginCopyKey): string {
|
||||
export function resolveLoginText(key: LoginCopyKey | string): string {
|
||||
if (key === 'loginSuccess') {
|
||||
return getOmniText(getCurrentLocale(), 'common.success');
|
||||
}
|
||||
@@ -55,6 +64,12 @@ export function resolveLoginText(key: LoginCopyKey): string {
|
||||
if (key === 'title') {
|
||||
return zh ? '登录 OmniCard' : 'Sign in to OmniCard';
|
||||
}
|
||||
if (key === 'brandTag') {
|
||||
return zh ? '全球智能数字名片' : 'Global Digital Identity';
|
||||
}
|
||||
if (key === 'subtitle') {
|
||||
return zh ? '极简出海商务,连接全球商机' : 'Minimalist global commerce & identity';
|
||||
}
|
||||
if (key === 'tabPhone') {
|
||||
return zh ? '手机号' : 'Phone';
|
||||
}
|
||||
@@ -85,11 +100,14 @@ export function resolveLoginText(key: LoginCopyKey): string {
|
||||
if (key === 'emailPlaceholder') {
|
||||
return zh ? '工作邮箱' : 'Work email';
|
||||
}
|
||||
if (key === 'orContinueWith') {
|
||||
return zh ? '或通过以下方式继续' : 'Or continue with';
|
||||
}
|
||||
if (key === 'google') {
|
||||
return zh ? '使用 Google 继续' : 'Continue with Google';
|
||||
return zh ? 'Google' : 'Google';
|
||||
}
|
||||
if (key === 'apple') {
|
||||
return zh ? '使用 Apple 继续' : 'Continue with Apple';
|
||||
return zh ? 'Apple' : 'Apple';
|
||||
}
|
||||
if (key === 'comingSoon') {
|
||||
return zh ? '即将开放' : 'Coming soon';
|
||||
@@ -103,6 +121,21 @@ export function resolveLoginText(key: LoginCopyKey): string {
|
||||
if (key === 'codeRequired') {
|
||||
return zh ? '请填写验证码' : 'Enter the verification code';
|
||||
}
|
||||
if (key === 'termsNotice') {
|
||||
return zh ? '登录即代表您已同意' : 'By continuing, you agree to our';
|
||||
}
|
||||
if (key === 'termsOfService') {
|
||||
return zh ? '服务条款' : 'Terms of Service';
|
||||
}
|
||||
if (key === 'privacyPolicy') {
|
||||
return zh ? '隐私政策' : 'Privacy Policy';
|
||||
}
|
||||
if (key === 'and') {
|
||||
return zh ? '与' : 'and';
|
||||
}
|
||||
if (key === 'countdownSuffix') {
|
||||
return zh ? '秒后重发' : 's';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -113,21 +146,16 @@ function toastNone(title: string): void {
|
||||
});
|
||||
}
|
||||
|
||||
function canNavigateBack(): boolean {
|
||||
try {
|
||||
const pages = getCurrentPages();
|
||||
return pages != null && pages.length > 1;
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function finishAfterLogin(): void {
|
||||
if (canNavigateBack()) {
|
||||
uni.navigateBack();
|
||||
return;
|
||||
if (typeof uni.switchTab === 'function') {
|
||||
uni.switchTab({
|
||||
url: '/pages/owner/card/index',
|
||||
});
|
||||
} else if (typeof uni.reLaunch === 'function') {
|
||||
uni.reLaunch({
|
||||
url: '/pages/owner/card/index',
|
||||
});
|
||||
}
|
||||
toastNone(resolveLoginText('loginSuccess'));
|
||||
}
|
||||
|
||||
export function createLoginState(): LoginState {
|
||||
@@ -139,6 +167,7 @@ export function createLoginState(): LoginState {
|
||||
email: '',
|
||||
submitting: false,
|
||||
errorMessage: '',
|
||||
countdown: 0,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -147,6 +176,15 @@ export function switchLoginTab(state: LoginState, tab: LoginTab): void {
|
||||
state.errorMessage = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 倒计时推进函数
|
||||
*/
|
||||
export function tickCountdown(state: LoginState): void {
|
||||
if (state.countdown > 0) {
|
||||
state.countdown -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录成功路径:写入 token / 可选 tenantId,再返回上一页或 toast
|
||||
*/
|
||||
@@ -168,6 +206,10 @@ export function completeLogin(token: string, tenantId?: string): boolean {
|
||||
}
|
||||
|
||||
export function sendSmsCode(state: LoginState): boolean {
|
||||
if (state.countdown > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const phone = state.phone != null ? state.phone.trim() : '';
|
||||
if (phone === '') {
|
||||
state.errorMessage = resolveLoginText('phoneRequired');
|
||||
@@ -176,8 +218,9 @@ export function sendSmsCode(state: LoginState): boolean {
|
||||
}
|
||||
|
||||
state.errorMessage = '';
|
||||
state.countdown = 60;
|
||||
toastNone(resolveLoginText('comingSoon'));
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
在新工单中引用
屏蔽一个用户