feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面
This commit is contained in:
+14
-33
@@ -102,35 +102,7 @@ export function getUserIdFromLocalStorage() {
|
||||
return user.id;
|
||||
}
|
||||
|
||||
export async function copy(text) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
return true;
|
||||
} catch {
|
||||
let textarea;
|
||||
const activeElement = document.activeElement;
|
||||
try {
|
||||
// 构建 textarea 执行复制命令,保留多行文本格式
|
||||
textarea = window.document.createElement('textarea');
|
||||
textarea.value = text;
|
||||
textarea.setAttribute('readonly', '');
|
||||
textarea.style.position = 'fixed';
|
||||
textarea.style.left = '-9999px';
|
||||
textarea.style.top = '-9999px';
|
||||
// Keep the selection inside a modal's focus trap when copying credentials.
|
||||
const container =
|
||||
activeElement?.closest('[role="dialog"]') || document.body;
|
||||
container.appendChild(textarea);
|
||||
textarea.select();
|
||||
return window.document.execCommand('copy');
|
||||
} catch {
|
||||
return false;
|
||||
} finally {
|
||||
textarea?.remove();
|
||||
activeElement?.focus({ preventScroll: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
export { copyText as copy } from './clipboard';
|
||||
|
||||
// isMobile 函数已移除,请改用 useIsMobile Hook
|
||||
|
||||
@@ -218,7 +190,10 @@ export function showInfo(message) {
|
||||
|
||||
export function showNotice(message, isHTML = false) {
|
||||
if (isHTML) {
|
||||
Toast.info({ content: <HTMLToastContent htmlContent={message} />, duration: 0 });
|
||||
Toast.info({
|
||||
content: <HTMLToastContent htmlContent={message} />,
|
||||
duration: 0,
|
||||
});
|
||||
} else {
|
||||
Toast.info(message);
|
||||
}
|
||||
@@ -1091,11 +1066,16 @@ export const createCardProPagination = ({
|
||||
isMobile = false,
|
||||
pageSizeOpts = [10, 20, 50, 100],
|
||||
showSizeChanger = true,
|
||||
showRange = true,
|
||||
preventPageChangeOnPageSizeChange = false,
|
||||
t = (key) => key,
|
||||
}) => {
|
||||
if (!total || total <= 0) return null;
|
||||
|
||||
const unified =
|
||||
typeof window !== 'undefined' &&
|
||||
/^\/(console|org)(\/|$)/.test(window.location?.pathname || '');
|
||||
|
||||
const start = (currentPage - 1) * pageSize + 1;
|
||||
const end = Math.min(currentPage * pageSize, total);
|
||||
const totalText = `${t('显示第')} ${start} ${t('条 - 第')} ${end} ${t('条,共')} ${total} ${t('条')}`;
|
||||
@@ -1103,7 +1083,7 @@ export const createCardProPagination = ({
|
||||
return (
|
||||
<>
|
||||
{/* 桌面端左侧总数信息 */}
|
||||
{!isMobile && (
|
||||
{!unified && !isMobile && showRange && (
|
||||
<span
|
||||
className='text-sm select-none'
|
||||
style={{ color: 'var(--ui-color-text-2)' }}
|
||||
@@ -1114,6 +1094,7 @@ export const createCardProPagination = ({
|
||||
|
||||
{/* 右侧分页控件 */}
|
||||
<Pagination
|
||||
className={!isMobile && (unified || !showRange) ? 'ml-auto' : undefined}
|
||||
currentPage={currentPage}
|
||||
pageSize={pageSize}
|
||||
total={total}
|
||||
@@ -1122,9 +1103,9 @@ export const createCardProPagination = ({
|
||||
onPageSizeChange={onPageSizeChange}
|
||||
onPageChange={onPageChange}
|
||||
preventPageChangeOnPageSizeChange={preventPageChangeOnPageSizeChange}
|
||||
size={isMobile ? 'small' : 'default'}
|
||||
size={unified || isMobile ? 'small' : 'default'}
|
||||
showQuickJumper={isMobile}
|
||||
showTotal
|
||||
showTotal={unified ? (total) => t('共 {{total}} 条', { total }) : true}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user