feat: 修复企业凭证复制并优化弹窗底部间距
This commit is contained in:
@@ -21,6 +21,7 @@ import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button, Toast, Banner } from '@douyinfe/semi-ui';
|
||||
import { Copy } from 'lucide-react';
|
||||
import { copy as copyText } from '../../helpers/utils';
|
||||
|
||||
/**
|
||||
* 企业建号一次性凭证展示面板(注册自助建号 / 管理员建号复用)。
|
||||
@@ -34,11 +35,12 @@ const OrgCredentialResult = ({ creds, onLogin }) => {
|
||||
|
||||
const isPending = creds.status === 'pending';
|
||||
|
||||
const copy = (val) => {
|
||||
navigator.clipboard
|
||||
.writeText(val)
|
||||
.then(() => Toast.success(t('已复制到剪贴板')))
|
||||
.catch(() => Toast.error(t('复制失败,请手动复制')));
|
||||
const copy = async (val) => {
|
||||
if (await copyText(val)) {
|
||||
Toast.success(t('已复制到剪贴板'));
|
||||
} else {
|
||||
Toast.error(t('复制失败,请手动复制'));
|
||||
}
|
||||
};
|
||||
|
||||
// 四项凭证拼成带标签的文本块一次复制,避免逐项复制的遗漏(如只记了密码没记企业代码)
|
||||
@@ -96,12 +98,7 @@ const OrgCredentialResult = ({ creds, onLogin }) => {
|
||||
<Row label={t('登录名')} value={creds.owner_login_name} mono />
|
||||
<Row label={t('初始密码')} value={creds.initial_password} mono />
|
||||
</div>
|
||||
<Button
|
||||
size='large'
|
||||
block
|
||||
icon={<Copy size={14} />}
|
||||
onClick={copyAll}
|
||||
>
|
||||
<Button size='large' block icon={<Copy size={14} />} onClick={copyAll}>
|
||||
{t('复制全部凭证')}
|
||||
</Button>
|
||||
{onLogin && (
|
||||
|
||||
Reference in New Issue
Block a user