增加 demo 环境变量

This commit is contained in:
whyour 2023-06-10 22:20:19 +08:00
parent 4ce01c5f0e
commit 4cf64e7af0
3 changed files with 11 additions and 3 deletions

View File

@ -5,7 +5,7 @@ let pickedEnv: Record<string, string>;
function getPickedEnv() {
if (pickedEnv) return pickedEnv;
const picked = pick(process.env, ['QlBaseUrl']);
const picked = pick(process.env, ['QlBaseUrl', 'DeployEnv']);
pickedEnv = picked as Record<string, string>;
return picked;
}

View File

@ -18,6 +18,7 @@ import { SharedContext } from '@/layouts';
const FormItem = Form.Item;
const { Countdown } = Statistic;
const isDemoEnv = window.__ENV__DeployEnv === 'demo';
const Login = () => {
const { reloadUser } = useOutletContext<SharedContext>();
@ -169,10 +170,16 @@ const Login = () => {
) : (
<Form layout="vertical" onFinish={handleOk}>
<FormItem name="username" label="用户名" hasFeedback>
<Input placeholder="用户名" autoFocus />
<Input
placeholder={`用户名${isDemoEnv ? ': admin' : ''}`}
autoFocus
/>
</FormItem>
<FormItem name="password" label="密码" hasFeedback>
<Input type="password" placeholder="密码" />
<Input
type="password"
placeholder={`密码${isDemoEnv ? ': 123' : ''}`}
/>
</FormItem>
<Row>
{waitTime ? (

1
typings.d.ts vendored
View File

@ -13,4 +13,5 @@ declare module 'pstree.remy';
interface Window {
__ENV__QlBaseUrl: string;
__ENV__DeployEnv: string;
}