新版登录页与开单成功页:居中品牌卡片、演示身份卡片、纸单号与合计突出显示
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
700bc82609
commit
91bd9d662d
1 file changed
+36
-22
@@ -1,5 +1,8 @@
|
||||
import { useState } from 'react';
|
||||
import { Alert, Button, Card, Form, Input, Select, Space, Typography } from 'antd';
|
||||
import { Alert, Button, Card, Form, Input, Select, Typography } from 'antd';
|
||||
import { ArrowRightOutlined, LockOutlined, UserOutlined } from '@ant-design/icons';
|
||||
import { BrandMark } from '../../components/BrandMark';
|
||||
import { modeLabel } from '../../lib/format';
|
||||
import type { LedgerClient } from '../../lib/api';
|
||||
import { demoLogin, login, setup, shopName, type SetupInput } from '../../lib/session';
|
||||
import type { SessionInfo } from '../../shared';
|
||||
@@ -37,36 +40,39 @@ export function LoginPage({
|
||||
return (
|
||||
<div className="login-wrap">
|
||||
<Card className="login-card">
|
||||
<div className="brand-mark large" aria-hidden="true">
|
||||
{Array.from(name)[0] || '店'}
|
||||
</div>
|
||||
<Typography.Title level={3}>{name} · 新账系统</Typography.Title>
|
||||
<Typography.Paragraph type="secondary">
|
||||
<div className="login-head">
|
||||
<BrandMark name={name} size="lg" />
|
||||
<Typography.Title level={1} className="login-title">
|
||||
{name} · 新账系统
|
||||
</Typography.Title>
|
||||
<Typography.Paragraph type="secondary" className="login-intro">
|
||||
{session.setup || session.mode === 'demo' ? intro : '录入、收款与复核,从同一张订单开始。'}
|
||||
</Typography.Paragraph>
|
||||
<Typography.Paragraph type="secondary" className="small">
|
||||
新版界面(对照试用)·{' '}
|
||||
<a href="/" className="old-ui-link">
|
||||
返回旧版界面
|
||||
</a>
|
||||
</Typography.Paragraph>
|
||||
<span className="login-mode">{modeLabel(session.mode)}</span>
|
||||
</div>
|
||||
{error && <Alert type="error" showIcon message={error} className="login-error" role="alert" />}
|
||||
{session.mode === 'demo' ? (
|
||||
<Space direction="vertical" style={{ width: '100%' }}>
|
||||
<div className="role-cards" role="group" aria-label="选择演示身份">
|
||||
{options.map(row => (
|
||||
<Button
|
||||
key={row.member}
|
||||
block
|
||||
size="large"
|
||||
type={row.member === 'owner' ? 'primary' : 'default'}
|
||||
className={'role-card' + (row.member === 'owner' ? ' role-card-owner' : '')}
|
||||
aria-label={'以' + row.label + '身份进入演示'}
|
||||
loading={working === row.member}
|
||||
disabled={!!working && working !== row.member}
|
||||
onClick={() => run(row.member, () => demoLogin(client, row.member))}
|
||||
>
|
||||
{'以' + row.label + '身份进入演示'}
|
||||
<span className="role-avatar" aria-hidden="true">
|
||||
{Array.from(row.label)[0]}
|
||||
</span>
|
||||
<span className="role-text">
|
||||
<strong>{row.label}</strong>
|
||||
<small>{row.member === 'owner' ? '店主' : '店员'}</small>
|
||||
</span>
|
||||
<ArrowRightOutlined className="role-go" aria-hidden="true" />
|
||||
</Button>
|
||||
))}
|
||||
</Space>
|
||||
</div>
|
||||
) : session.setup ? (
|
||||
<SetupForm working={working === 'setup'} onSubmit={input => run('setup', () => setup(client, input))} />
|
||||
) : (
|
||||
@@ -76,10 +82,14 @@ export function LoginPage({
|
||||
onSubmit={(member, password) => run('login', () => login(client, member, password))}
|
||||
/>
|
||||
)}
|
||||
<Typography.Paragraph type="secondary" className="small login-foot">
|
||||
云端数据库和飞书同步的真实状态,会在系统内显示。
|
||||
</Typography.Paragraph>
|
||||
<div className="login-foot">
|
||||
<span className="small muted">新版界面(对照试用)</span>
|
||||
<a href="/" className="old-ui-link">
|
||||
返回旧版界面
|
||||
</a>
|
||||
</div>
|
||||
</Card>
|
||||
<p className="login-note small muted">云端数据库和飞书同步的真实状态,会在系统内显示。</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -107,6 +117,7 @@ function LoginForm({
|
||||
<Form.Item label="登录账号" required>
|
||||
<Select
|
||||
aria-label="登录账号"
|
||||
suffixIcon={<UserOutlined />}
|
||||
data-testid="login-member"
|
||||
value={member || undefined}
|
||||
placeholder="请选择账号"
|
||||
@@ -118,6 +129,7 @@ function LoginForm({
|
||||
<Input.Password
|
||||
name="password"
|
||||
aria-label="密码"
|
||||
prefix={<LockOutlined className="input-icon" />}
|
||||
autoComplete="current-password"
|
||||
value={password}
|
||||
onChange={event => setPassword(event.target.value)}
|
||||
@@ -168,7 +180,9 @@ function SetupForm({ working, onSubmit }: { working: boolean; onSubmit: (input:
|
||||
{...field('ownerPassword')}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Typography.Paragraph type="secondary">进入系统后,在设置 → 员工管理中添加员工。</Typography.Paragraph>
|
||||
<Typography.Paragraph type="secondary" className="small">
|
||||
进入系统后,在设置 → 员工管理中添加员工。
|
||||
</Typography.Paragraph>
|
||||
<Button type="primary" htmlType="submit" block size="large" loading={working}>
|
||||
建立试用账号
|
||||
</Button>
|
||||
|
||||
Reference in new issue
Block a user