fix(ui): 完善界面交互与开发配置
This commit is contained in:
@@ -166,6 +166,16 @@ const LoginForm = () => {
|
||||
const [githubButtonText, setGithubButtonText] = useState('');
|
||||
const [githubButtonDisabled, setGithubButtonDisabled] = useState(false);
|
||||
const githubTimeoutRef = useRef(null);
|
||||
// 微信验证码弹窗表单:确定前先做前端必填校验,通过后再走原提交逻辑
|
||||
const wechatFormApi = useRef(null);
|
||||
const submitWeChatCodeWithValidation = async () => {
|
||||
try {
|
||||
await wechatFormApi.current?.validate();
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
await onSubmitWeChatVerificationCode();
|
||||
};
|
||||
|
||||
const logo = getLogo();
|
||||
const systemName = getSystemName();
|
||||
@@ -826,14 +836,10 @@ const LoginForm = () => {
|
||||
<Form.Input
|
||||
field='username'
|
||||
className='auth-login-required-field'
|
||||
rules={[{ required: true, message: t('请输入用户名或邮箱') }]}
|
||||
rules={[{ required: true, message: t('请输入用户名/邮箱') }]}
|
||||
required
|
||||
aria-required='true'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('用户名/邮箱')}
|
||||
</span>
|
||||
}
|
||||
label={t('用户名/邮箱')}
|
||||
placeholder={t('请输入用户名或邮箱')}
|
||||
name='username'
|
||||
size='default'
|
||||
@@ -849,11 +855,7 @@ const LoginForm = () => {
|
||||
rules={[{ required: true, message: t('请输入密码') }]}
|
||||
required
|
||||
aria-required='true'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('密码')}
|
||||
</span>
|
||||
}
|
||||
label={t('密码')}
|
||||
placeholder={t('请输入密码')}
|
||||
name='password'
|
||||
mode='password'
|
||||
@@ -864,7 +866,7 @@ const LoginForm = () => {
|
||||
/>
|
||||
|
||||
{(hasUserAgreement || hasPrivacyPolicy) && (
|
||||
<div className='flex items-center'>
|
||||
<div className='auth-login-agree-row flex items-center'>
|
||||
<Checkbox
|
||||
checked={agreedToTerms}
|
||||
onChange={(e) => setAgreedToTerms(e.target.checked)}
|
||||
@@ -987,7 +989,7 @@ const LoginForm = () => {
|
||||
}
|
||||
visible={showWeChatLoginModal}
|
||||
maskClosable={true}
|
||||
onOk={onSubmitWeChatVerificationCode}
|
||||
onOk={submitWeChatCodeWithValidation}
|
||||
onCancel={() => setShowWeChatLoginModal(false)}
|
||||
okText={t('登录')}
|
||||
centered={true}
|
||||
@@ -1048,11 +1050,12 @@ const LoginForm = () => {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Form>
|
||||
<Form getFormApi={(api) => (wechatFormApi.current = api)}>
|
||||
<Form.Input
|
||||
field='wechat_verification_code'
|
||||
placeholder={t('请输入验证码')}
|
||||
label={t('验证码')}
|
||||
rules={[{ required: true, message: t('请输入验证码') }]}
|
||||
value={inputs.wechat_verification_code}
|
||||
onChange={(value) =>
|
||||
handleChange('wechat_verification_code', value)
|
||||
|
||||
@@ -121,10 +121,20 @@ const PasswordResetForm = () => {
|
||||
subtitle={t('密码重置')}
|
||||
/>
|
||||
|
||||
<Form className='auth-login-form'>
|
||||
{/* 前端校验(必填 + 邮箱格式)通过后才调用原 handleSubmit */}
|
||||
<Form className='auth-login-form' onSubmit={() => handleSubmit()}>
|
||||
<Form.Input
|
||||
field='email'
|
||||
label={t('邮箱')}
|
||||
rules={[
|
||||
{ required: true, message: t('请输入邮箱') },
|
||||
{
|
||||
type: 'email',
|
||||
transform: (v) => v?.trim(),
|
||||
message: t('邮箱格式不正确'),
|
||||
},
|
||||
]}
|
||||
trigger='blur'
|
||||
placeholder={t('请输入您的邮箱地址')}
|
||||
name='email'
|
||||
value={email}
|
||||
@@ -138,7 +148,6 @@ const PasswordResetForm = () => {
|
||||
block
|
||||
className='auth-login-submit'
|
||||
htmlType='submit'
|
||||
onClick={handleSubmit}
|
||||
loading={loading}
|
||||
disabled={disableButton}
|
||||
>
|
||||
|
||||
@@ -144,6 +144,26 @@ const RegisterForm = () => {
|
||||
const [githubButtonDisabled, setGithubButtonDisabled] = useState(false);
|
||||
const [showWeChatOpenTipModal, setShowWeChatOpenTipModal] = useState(false);
|
||||
const githubTimeoutRef = useRef(null);
|
||||
// 注册表单 / 微信验证码弹窗的表单实例:用于在原逻辑执行前做前端校验
|
||||
const registerFormApi = useRef(null);
|
||||
const wechatFormApi = useRef(null);
|
||||
// 获取验证码前先校验邮箱必填与格式,通过后走原发送逻辑
|
||||
const sendVerificationCodeWithValidation = async () => {
|
||||
try {
|
||||
await registerFormApi.current?.validate(['email']);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
await sendVerificationCode();
|
||||
};
|
||||
const submitWeChatCodeWithValidation = async () => {
|
||||
try {
|
||||
await wechatFormApi.current?.validate();
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
await onSubmitWeChatVerificationCode();
|
||||
};
|
||||
|
||||
const logo = getLogo();
|
||||
const systemName = getSystemName();
|
||||
@@ -665,14 +685,16 @@ const RegisterForm = () => {
|
||||
logoWrapperClassName='mb-2'
|
||||
/>
|
||||
|
||||
<Form className='auth-login-form'>
|
||||
{/* 前端校验通过后才调用原 handleSubmit;其内协议 / 长度 / 一致性判断原样保留 */}
|
||||
<Form
|
||||
className='auth-login-form'
|
||||
getFormApi={(api) => (registerFormApi.current = api)}
|
||||
onSubmit={() => handleSubmit()}
|
||||
>
|
||||
<Form.Input
|
||||
field='username'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('用户名')}
|
||||
</span>
|
||||
}
|
||||
label={t('用户名')}
|
||||
rules={[{ required: true, message: t('请输入用户名') }]}
|
||||
placeholder={t('请输入用户名')}
|
||||
name='username'
|
||||
autoComplete='username'
|
||||
@@ -680,14 +702,15 @@ const RegisterForm = () => {
|
||||
prefix={<IconUser size='small' />}
|
||||
/>
|
||||
|
||||
{/* 密码输入框 */}
|
||||
{/* 密码输入框:长度 8-20 与占位提示、后端约束一致 */}
|
||||
<Form.Input
|
||||
field='password'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('密码')}
|
||||
</span>
|
||||
}
|
||||
label={t('密码')}
|
||||
rules={[
|
||||
{ required: true, message: t('请输入密码') },
|
||||
{ min: 8, max: 20, message: t('密码长度需为 8-20 位') },
|
||||
]}
|
||||
trigger='blur'
|
||||
placeholder={t('输入密码,最短 8 位,最长 20 位')}
|
||||
name='password'
|
||||
mode='password'
|
||||
@@ -699,11 +722,14 @@ const RegisterForm = () => {
|
||||
{/* 确认密码输入框 */}
|
||||
<Form.Input
|
||||
field='password2'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('确认密码')}
|
||||
</span>
|
||||
}
|
||||
label={t('确认密码')}
|
||||
required
|
||||
validate={(value, values) => {
|
||||
if (!value) return t('请输入确认密码');
|
||||
if (value !== values.password) return t('两次输入的密码不一致');
|
||||
return '';
|
||||
}}
|
||||
trigger='blur'
|
||||
placeholder={t('确认密码')}
|
||||
name='password2'
|
||||
mode='password'
|
||||
@@ -716,11 +742,16 @@ const RegisterForm = () => {
|
||||
<>
|
||||
<Form.Input
|
||||
field='email'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('邮箱')}
|
||||
</span>
|
||||
}
|
||||
label={t('邮箱')}
|
||||
rules={[
|
||||
{ required: true, message: t('请输入邮箱') },
|
||||
{
|
||||
type: 'email',
|
||||
transform: (v) => v?.trim(),
|
||||
message: t('邮箱格式不正确'),
|
||||
},
|
||||
]}
|
||||
trigger='blur'
|
||||
placeholder={t('输入邮箱地址')}
|
||||
name='email'
|
||||
type='email'
|
||||
@@ -730,7 +761,7 @@ const RegisterForm = () => {
|
||||
suffix={
|
||||
<Button
|
||||
size='small'
|
||||
onClick={sendVerificationCode}
|
||||
onClick={sendVerificationCodeWithValidation}
|
||||
loading={verificationCodeLoading}
|
||||
disabled={disableButton || verificationCodeLoading}
|
||||
className='!rounded-lg'
|
||||
@@ -743,11 +774,8 @@ const RegisterForm = () => {
|
||||
/>
|
||||
<Form.Input
|
||||
field='verification_code'
|
||||
label={
|
||||
<span className='text-xs font-medium text-gray-600 dark:text-gray-300'>
|
||||
{t('验证码')}
|
||||
</span>
|
||||
}
|
||||
label={t('验证码')}
|
||||
rules={[{ required: true, message: t('请输入验证码') }]}
|
||||
placeholder={t('输入验证码')}
|
||||
name='verification_code'
|
||||
onChange={(value) => handleChange('verification_code', value)}
|
||||
@@ -757,7 +785,7 @@ const RegisterForm = () => {
|
||||
)}
|
||||
|
||||
{(hasUserAgreement || hasPrivacyPolicy) && (
|
||||
<div className='flex items-center'>
|
||||
<div className='auth-login-agree-row flex items-center'>
|
||||
<Checkbox
|
||||
checked={agreedToTerms}
|
||||
onChange={(e) => setAgreedToTerms(e.target.checked)}
|
||||
@@ -793,13 +821,12 @@ const RegisterForm = () => {
|
||||
)}
|
||||
|
||||
<div className='auth-login-actions'>
|
||||
{/* 注册按钮:与登录按钮同款实心主按钮(36px),保留原提交触发与禁用条件 */}
|
||||
{/* 注册按钮:提交经表单校验后调用原 handleSubmit,禁用条件不变 */}
|
||||
<Button
|
||||
theme='solid'
|
||||
htmlType='submit'
|
||||
block
|
||||
className='auth-login-submit'
|
||||
onClick={handleSubmit}
|
||||
loading={registerLoading}
|
||||
disabled={
|
||||
registerLoading ||
|
||||
@@ -870,7 +897,7 @@ const RegisterForm = () => {
|
||||
}
|
||||
visible={showWeChatLoginModal}
|
||||
maskClosable={true}
|
||||
onOk={onSubmitWeChatVerificationCode}
|
||||
onOk={submitWeChatCodeWithValidation}
|
||||
onCancel={() => setShowWeChatLoginModal(false)}
|
||||
okText={t('登录')}
|
||||
centered={true}
|
||||
@@ -931,11 +958,12 @@ const RegisterForm = () => {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Form>
|
||||
<Form getFormApi={(api) => (wechatFormApi.current = api)}>
|
||||
<Form.Input
|
||||
field='wechat_verification_code'
|
||||
placeholder={t('请输入验证码')}
|
||||
label={t('验证码')}
|
||||
rules={[{ required: true, message: t('请输入验证码') }]}
|
||||
value={inputs.wechat_verification_code}
|
||||
onChange={(value) =>
|
||||
handleChange('wechat_verification_code', value)
|
||||
|
||||
@@ -71,6 +71,21 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 前端校验:与 handleSubmit 内原有判断一致,改为在输入框下方就地提示
|
||||
const codeRules = [
|
||||
{
|
||||
required: true,
|
||||
message: useBackupCode ? t('请输入备用码') : t('请输入验证码'),
|
||||
},
|
||||
{
|
||||
validator: (_, value) => {
|
||||
if (!value) return true;
|
||||
if (useBackupCode) return value.length === 8 || t('备用码必须是8位');
|
||||
return /^\d{6}$/.test(value) || t('验证码必须是6位数字');
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
if (isModal) {
|
||||
return (
|
||||
<div className='space-y-4'>
|
||||
@@ -88,6 +103,8 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
|
||||
value={verificationCode}
|
||||
onChange={setVerificationCode}
|
||||
onKeyPress={handleKeyPress}
|
||||
rules={codeRules}
|
||||
trigger='blur'
|
||||
style={{ marginBottom: 16 }}
|
||||
autoFocus
|
||||
/>
|
||||
@@ -177,6 +194,8 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
|
||||
value={verificationCode}
|
||||
onChange={setVerificationCode}
|
||||
onKeyPress={handleKeyPress}
|
||||
rules={codeRules}
|
||||
trigger='blur'
|
||||
style={{ marginBottom: 16 }}
|
||||
autoFocus
|
||||
/>
|
||||
|
||||
@@ -130,7 +130,10 @@ export const ConsoleForm = forwardRef(function ConsoleForm(
|
||||
layout={isSettings ? 'vertical' : layout}
|
||||
labelCol={isSettings ? undefined : props.labelCol}
|
||||
wrapperCol={isSettings ? undefined : props.wrapperCol}
|
||||
labelAlign={isSettings ? 'left' : props.labelAlign}
|
||||
labelAlign={isSettings ? 'start' : props.labelAlign}
|
||||
autoComplete={
|
||||
isSettings ? (props.autoComplete ?? 'off') : props.autoComplete
|
||||
}
|
||||
className={classes(
|
||||
isSettings ? 'console-form settings-system-form' : 'console-form',
|
||||
className,
|
||||
|
||||
@@ -23,7 +23,8 @@ import {
|
||||
ChevronLeft as ActionChevronLeft,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import { consoleMenuPaths, getConsoleMenuKeys } from '../console/consoleRoutes';
|
||||
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
||||
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { revealActiveSidebarItem } from '../../helpers/sidebarScroll';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { getLucideIcon } from '../../helpers/render';
|
||||
@@ -97,6 +98,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
|
||||
const showSkeleton = useMinimumLoadingTime(sidebarLoading, 200);
|
||||
|
||||
const [selectedKeys, setSelectedKeys] = useState(['home']);
|
||||
const navigationRef = useRef(null);
|
||||
// 平台关闭智能路由后,仍有生效中出境同意的普通用户保留入口以便撤回(§9.5,与企业"仅授权模式"同口径)
|
||||
const [routerConsentGranted, setRouterConsentGranted] = useState(
|
||||
() => readPersonalConsentCache() === '1',
|
||||
@@ -493,6 +495,38 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
|
||||
}
|
||||
}, [location.pathname, location.search, routerMapState]);
|
||||
|
||||
useEffect(() => {
|
||||
const navigation = navigationRef.current;
|
||||
if (!navigation || showSkeleton) return;
|
||||
let frame;
|
||||
const scheduleReveal = () => {
|
||||
cancelAnimationFrame(frame);
|
||||
frame = requestAnimationFrame(() => revealActiveSidebarItem(navigation));
|
||||
};
|
||||
scheduleReveal();
|
||||
const resizeObserver = new ResizeObserver(scheduleReveal);
|
||||
resizeObserver.observe(navigation);
|
||||
const mutationObserver = new MutationObserver(scheduleReveal);
|
||||
mutationObserver.observe(navigation, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
attributes: true,
|
||||
attributeFilter: ['hidden'],
|
||||
});
|
||||
return () => {
|
||||
cancelAnimationFrame(frame);
|
||||
resizeObserver.disconnect();
|
||||
mutationObserver.disconnect();
|
||||
};
|
||||
}, [
|
||||
showSkeleton,
|
||||
selectedKeys,
|
||||
collapsed,
|
||||
forceExpanded,
|
||||
openedKeys,
|
||||
foldedGroups,
|
||||
]);
|
||||
|
||||
// 监控折叠状态变化以更新 body class(--sidebar-current-width 由它驱动)。
|
||||
// 抽屉态下跳过:body class 是全局的,抽屉临时展开不该顺手把桌面侧栏宽度也改掉。
|
||||
useEffect(() => {
|
||||
@@ -639,7 +673,7 @@ const SiderBar = ({ onNavigate = () => {}, forceExpanded = false }) => {
|
||||
collapsed={collapsed}
|
||||
showAdmin={isAdmin()}
|
||||
>
|
||||
<nav className='ui-center-sidebar-nav'>
|
||||
<nav ref={navigationRef} className='ui-center-sidebar-nav'>
|
||||
{/* 聊天区域 */}
|
||||
{hasSectionVisibleModules('chat') &&
|
||||
renderGroup(
|
||||
|
||||
@@ -44,7 +44,6 @@ const ActionButtons = ({
|
||||
userState,
|
||||
isLoading,
|
||||
isMobile,
|
||||
isSelfUseMode,
|
||||
headerNavModules,
|
||||
sidebarModulesAdmin,
|
||||
isOrgUser,
|
||||
@@ -235,7 +234,6 @@ const ActionButtons = ({
|
||||
userState={userState}
|
||||
isLoading={isLoading}
|
||||
isMobile={isMobile}
|
||||
isSelfUseMode={isSelfUseMode}
|
||||
headerNavModules={headerNavModules}
|
||||
rightActions={headerNavModules?.rightActions}
|
||||
sidebarModulesAdmin={sidebarModulesAdmin}
|
||||
|
||||
@@ -19,11 +19,9 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import { ChevronDown as ActionChevronDown } from '@/components/common/icons/ActionIcons';
|
||||
import React, { useState } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { Avatar, Button as AntButton, Dropdown as AntDropdown } from 'antd';
|
||||
import { Button } from '@/components/ui';
|
||||
import { UserRound, KeyRound, LogOut } from 'lucide-react';
|
||||
import { getUserAvatarUrl, isAuthPagePath } from '../../../helpers';
|
||||
import { getUserAvatarUrl } from '../../../helpers';
|
||||
import SkeletonWrapper from '../components/SkeletonWrapper';
|
||||
import { isHeaderModuleEnabled } from '../../../constants/headerNavModules';
|
||||
|
||||
@@ -46,7 +44,6 @@ const UserArea = ({
|
||||
userState,
|
||||
isLoading,
|
||||
isMobile,
|
||||
isSelfUseMode,
|
||||
headerNavModules,
|
||||
rightActions = {},
|
||||
sidebarModulesAdmin = {},
|
||||
@@ -55,7 +52,6 @@ const UserArea = ({
|
||||
navigate,
|
||||
t,
|
||||
}) => {
|
||||
const location = useLocation();
|
||||
const [open, setOpen] = useState(false);
|
||||
const isActionVisible = (key) => rightActions?.[key] !== false;
|
||||
const hasHeaderModuleConfig =
|
||||
@@ -68,9 +64,6 @@ const UserArea = ({
|
||||
return section.enabled !== false && section[moduleKey] !== false;
|
||||
};
|
||||
|
||||
// 在登录/注册/重置密码/企业登录页面时,未登录用户不显示登录注册按钮,避免重复
|
||||
const isAuthPage = isAuthPagePath(location.pathname);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<SkeletonWrapper
|
||||
@@ -193,64 +186,9 @@ const UserArea = ({
|
||||
</AntButton>
|
||||
</AntDropdown>
|
||||
);
|
||||
} else {
|
||||
if (isAuthPage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const showRegisterButton = !isSelfUseMode;
|
||||
|
||||
const commonSizingAndLayoutClass =
|
||||
'flex items-center justify-center !py-[10px] !px-1.5';
|
||||
|
||||
const loginButtonSpecificStyling =
|
||||
'!bg-transparent hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep !transition-all !duration-200';
|
||||
let loginButtonClasses = `${commonSizingAndLayoutClass} ${loginButtonSpecificStyling}`;
|
||||
|
||||
let registerButtonClasses = `${commonSizingAndLayoutClass}`;
|
||||
|
||||
const loginButtonTextSpanClass =
|
||||
'!text-xs !text-ui-color-text-1 dark:!text-gray-300 !p-1.5';
|
||||
const registerButtonTextSpanClass = '!text-xs !text-white !p-1.5';
|
||||
|
||||
if (showRegisterButton) {
|
||||
if (isMobile) {
|
||||
loginButtonClasses += ' !rounded-full';
|
||||
} else {
|
||||
loginButtonClasses += ' !rounded-l-full !rounded-r-none';
|
||||
}
|
||||
registerButtonClasses += ' !rounded-r-full !rounded-l-none';
|
||||
} else {
|
||||
loginButtonClasses += ' !rounded-full';
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='flex items-center'>
|
||||
<Link to='/org/login' className='flex'>
|
||||
<Button
|
||||
theme='borderless'
|
||||
type='tertiary'
|
||||
className={loginButtonClasses}
|
||||
>
|
||||
<span className={loginButtonTextSpanClass}>{t('登录')}</span>
|
||||
</Button>
|
||||
</Link>
|
||||
{showRegisterButton && (
|
||||
<div className='hidden md:block'>
|
||||
<Link to='/register' className='flex -ml-px'>
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
className={registerButtonClasses}
|
||||
>
|
||||
<span className={registerButtonTextSpanClass}>{t('注册')}</span>
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export default UserArea;
|
||||
|
||||
@@ -181,7 +181,6 @@ const HeaderBar = ({ onMobileMenuToggle, drawerOpen }) => {
|
||||
userState={userState}
|
||||
isLoading={isLoading}
|
||||
isMobile={isMobile}
|
||||
isSelfUseMode={isSelfUseMode}
|
||||
headerNavModules={headerNavModules}
|
||||
sidebarModulesAdmin={sidebarModulesAdmin}
|
||||
isOrgUser={isOrgUser}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/* 等级与模型访问(level_policy)局部布局覆盖,全部只改尺寸不改配色 */
|
||||
/* 等级与模型访问(level_policy)局部布局与图标样式 */
|
||||
|
||||
.level-policy-model-toggle.ant-btn .ant-btn-icon {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* 默认访问态 pureCard 单选:两张卡等分弹窗整行宽,避免随文案长短一宽一窄 */
|
||||
|
||||
@@ -1638,8 +1638,9 @@ const LevelPolicySetting = () => {
|
||||
const button = (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type={r.modelDiscountCount > 0 ? 'primary' : 'tertiary'}
|
||||
className='level-policy-model-toggle'
|
||||
theme={r.modelDiscountCount > 0 ? undefined : 'borderless'}
|
||||
type={r.modelDiscountCount > 0 ? 'link' : 'tertiary'}
|
||||
icon={
|
||||
expanded ? (
|
||||
<ActionChevronDown size={14} />
|
||||
|
||||
@@ -849,7 +849,7 @@ const SystemSetting = () => {
|
||||
|
||||
<Card>
|
||||
<Form.Section text={t('SSRF防护设置')}>
|
||||
<Text extraText={t('SSRF防护详细说明')}>
|
||||
<Text title={t('SSRF防护详细说明')}>
|
||||
{t('配置服务器端请求伪造(SSRF)防护,用于保护内网资源安全')}
|
||||
</Text>
|
||||
<Row
|
||||
|
||||
@@ -18,6 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { theme } from 'antd';
|
||||
import { Button, Progress, Tag, Timeline, Typography } from '@/components/ui';
|
||||
import {
|
||||
IconAlertTriangle,
|
||||
@@ -35,13 +36,14 @@ import './skill-components.css';
|
||||
|
||||
const { Text, Title, Paragraph } = Typography;
|
||||
|
||||
const SemanticTag = ({ value, fallback, className = '' }) => {
|
||||
const SemanticTag = ({ value, fallback, className = '', style }) => {
|
||||
const { t } = useTranslation();
|
||||
const token = getSkillTagToken(value);
|
||||
return (
|
||||
<Tag
|
||||
color={token.color}
|
||||
className={className}
|
||||
style={style}
|
||||
aria-label={t(fallback || token.label)}
|
||||
>
|
||||
{t(fallback || token.label)}
|
||||
@@ -62,20 +64,26 @@ export const ScopeSourceBadge = ({ source, detail }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const LicenseBadge = ({ expression, decision }) => (
|
||||
<span className='skill-license-badge'>
|
||||
<SemanticTag
|
||||
value={
|
||||
decision === 'blocked'
|
||||
? 'deny'
|
||||
: decision === 'approved'
|
||||
? 'allow'
|
||||
: 'license_pending'
|
||||
}
|
||||
fallback={expression || '许可证未知'}
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
export const LicenseBadge = ({ expression, decision }) => {
|
||||
const { token } = theme.useToken();
|
||||
const value =
|
||||
decision === 'blocked'
|
||||
? 'deny'
|
||||
: decision === 'approved'
|
||||
? 'allow'
|
||||
: 'license_pending';
|
||||
const { color } = getSkillTagToken(value);
|
||||
return (
|
||||
<span className='skill-license-badge'>
|
||||
<SemanticTag
|
||||
value={value}
|
||||
fallback={expression || '许可证未知'}
|
||||
// 第 9 档在浅色下更深、暗色下更亮,保证小字号许可证的对比度。
|
||||
style={{ color: token[`${color}-9`] }}
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export const RiskBadge = ({ conclusion }) => (
|
||||
<SemanticTag
|
||||
@@ -168,6 +176,7 @@ export const GrayscaleProgress = ({ percent = 0, label }) => (
|
||||
);
|
||||
|
||||
export const SkillDetailSideSheet = ({
|
||||
className,
|
||||
visible,
|
||||
onCancel,
|
||||
title,
|
||||
@@ -175,6 +184,7 @@ export const SkillDetailSideSheet = ({
|
||||
footer,
|
||||
}) => (
|
||||
<OrgSideSheet
|
||||
className={className}
|
||||
visible={visible}
|
||||
onCancel={onCancel}
|
||||
title={title}
|
||||
|
||||
@@ -19,7 +19,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
export const SKILL_TAG_TOKENS = Object.freeze({
|
||||
pending_import: { color: 'grey', label: '待导入' },
|
||||
license_pending: { color: 'amber', label: '许可证待审核' },
|
||||
license_pending: { color: 'gold', label: '许可证待审核' },
|
||||
scan_pending: { color: 'orange', label: '待云端化改写' },
|
||||
review_pending: { color: 'blue', label: '待审核' },
|
||||
published: { color: 'green', label: '已发布' },
|
||||
|
||||
@@ -19,7 +19,9 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Alert, Button, Empty, Table, Tag } from 'antd';
|
||||
import { Button, Empty, Tag } from 'antd';
|
||||
import { Table } from '@/components/ui';
|
||||
import { ConsoleAlert as Alert } from '../console/ConsolePrimitives';
|
||||
import { listDecisions } from './api';
|
||||
import { gateText, jevReasonText, srcText } from './labels';
|
||||
|
||||
@@ -138,14 +140,12 @@ const DecisionTable = ({ mode, orgId }) => {
|
||||
columns={columns}
|
||||
dataSource={data.items || []}
|
||||
scroll={{ x: 'max-content' }}
|
||||
locale={{
|
||||
emptyText: (
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={t('还没有智能路由请求')}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
empty={
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={t('还没有智能路由请求')}
|
||||
/>
|
||||
}
|
||||
pagination={{
|
||||
// 接口固定 page_size=20,不提供每页条数切换
|
||||
current: page,
|
||||
|
||||
@@ -20,7 +20,6 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Form,
|
||||
Input,
|
||||
@@ -33,6 +32,7 @@ import {
|
||||
Tag,
|
||||
Typography,
|
||||
} from 'antd';
|
||||
import { ConsoleAlert as Alert } from '../console/ConsolePrimitives';
|
||||
import { showError, showSuccess } from '../../helpers';
|
||||
import { getAdminStatus, loadOptions, saveOption, setJevKey } from './api';
|
||||
|
||||
@@ -333,7 +333,7 @@ const GlobalSettings = () => {
|
||||
case 'int':
|
||||
return (
|
||||
<InputNumber
|
||||
style={{ width: 200 }}
|
||||
className='smart-router-setting-control'
|
||||
min={f.min}
|
||||
max={f.max}
|
||||
value={Number(v) || 0}
|
||||
@@ -353,7 +353,7 @@ const GlobalSettings = () => {
|
||||
case 'select':
|
||||
return (
|
||||
<Select
|
||||
style={{ width: 200 }}
|
||||
className='smart-router-setting-control'
|
||||
value={v}
|
||||
options={f.options.map((o) => ({ label: o, value: o }))}
|
||||
onChange={set}
|
||||
@@ -371,7 +371,7 @@ const GlobalSettings = () => {
|
||||
default:
|
||||
return (
|
||||
<Input
|
||||
style={{ maxWidth: 360 }}
|
||||
className='smart-router-setting-control'
|
||||
value={v}
|
||||
onChange={(e) => set(e.target.value)}
|
||||
/>
|
||||
@@ -470,7 +470,12 @@ const GlobalSettings = () => {
|
||||
<div key={sec} className='smart-router-card'>
|
||||
<div className='smart-router-card-title'>{t(title)}</div>
|
||||
{/* 受控字段沿用 values 状态,Form 只提供竖排标签布局,不接管取值与提交 */}
|
||||
<Form layout='vertical' component='div' requiredMark={false}>
|
||||
<Form
|
||||
layout='vertical'
|
||||
component='div'
|
||||
requiredMark={false}
|
||||
className='smart-router-settings-form'
|
||||
>
|
||||
{FIELDS.filter((f) => f.section === sec).map((f) => (
|
||||
<Form.Item
|
||||
key={f.key}
|
||||
@@ -501,9 +506,9 @@ const GlobalSettings = () => {
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<Space size={8} wrap>
|
||||
<Space size={8} wrap className='smart-router-key-tools'>
|
||||
<Input.Password
|
||||
style={{ width: 320 }}
|
||||
className='smart-router-key-input'
|
||||
placeholder={t('输入新密钥;留空表示不修改')}
|
||||
value={keys[p]}
|
||||
onChange={(e) =>
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Collapse,
|
||||
Drawer,
|
||||
Form,
|
||||
Input,
|
||||
InputNumber,
|
||||
@@ -33,6 +32,7 @@ import {
|
||||
Switch,
|
||||
Typography,
|
||||
} from 'antd';
|
||||
import { ConsoleDrawer as Drawer } from '../console/ConsolePrimitives';
|
||||
import { Plus, Trash2 } from '../common/icons/ActionIcons';
|
||||
import { showError, showSuccess } from '../../helpers';
|
||||
import { saveProfile } from './api';
|
||||
|
||||
@@ -19,16 +19,9 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Empty,
|
||||
Popconfirm,
|
||||
Space,
|
||||
Table,
|
||||
Tag,
|
||||
Typography,
|
||||
} from 'antd';
|
||||
import { Button, Empty, Popconfirm, Space, Tag, Typography } from 'antd';
|
||||
import { Table } from '@/components/ui';
|
||||
import { ConsoleAlert as Alert } from '../console/ConsolePrimitives';
|
||||
import { Plus } from '../common/icons/ActionIcons';
|
||||
import { copy, showError, showSuccess } from '../../helpers';
|
||||
import { deleteProfile, listCandidateModels, listProfiles } from './api';
|
||||
@@ -230,20 +223,18 @@ const ProfileTable = ({ mode, orgId, canWrite = true, emptyHint }) => {
|
||||
dataSource={list}
|
||||
pagination={false}
|
||||
scroll={{ x: 'max-content' }}
|
||||
locale={{
|
||||
emptyText: (
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={t('还没有智能路由集合')}
|
||||
>
|
||||
{canWrite && (
|
||||
<Button type='primary' onClick={() => setEditing({})}>
|
||||
{t('新建集合')}
|
||||
</Button>
|
||||
)}
|
||||
</Empty>
|
||||
),
|
||||
}}
|
||||
empty={
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={t('还没有智能路由集合')}
|
||||
>
|
||||
{canWrite && (
|
||||
<Button type='primary' onClick={() => setEditing({})}>
|
||||
{t('新建集合')}
|
||||
</Button>
|
||||
)}
|
||||
</Empty>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<ProfileEditor
|
||||
|
||||
@@ -19,7 +19,11 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Alert, Button, Input, Modal, Progress, Tag, Typography } from 'antd';
|
||||
import { Button, Input, Progress, Tag, Typography } from 'antd';
|
||||
import {
|
||||
ConsoleAlert as Alert,
|
||||
ConsoleModal as Modal,
|
||||
} from '../console/ConsolePrimitives';
|
||||
import { simulateProfile } from './api';
|
||||
import { gateText, reasonText, srcText } from './labels';
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.smart-router-page .smart-router-intro.console-alert {
|
||||
margin-block: 0;
|
||||
}
|
||||
|
||||
.smart-router-alert {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
@@ -181,7 +185,7 @@
|
||||
.smart-router-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 0 16px;
|
||||
gap: 0 24px;
|
||||
}
|
||||
|
||||
.smart-router-grid-full {
|
||||
@@ -274,3 +278,67 @@
|
||||
min-width: 0;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.smart-router-settings-form {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
column-gap: 24px;
|
||||
}
|
||||
|
||||
.smart-router-setting-control.ant-input-number,
|
||||
.smart-router-setting-control.ant-select,
|
||||
.smart-router-setting-control.ant-input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.smart-router-key-tools {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.smart-router-key-input {
|
||||
width: min(320px, 100%);
|
||||
}
|
||||
|
||||
.smart-router-sheet .ant-drawer-body {
|
||||
padding: 24px;
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
|
||||
.smart-router-sheet .ant-modal {
|
||||
max-width: calc(100vw - 32px);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.smart-router-card,
|
||||
.smart-router-consent-row {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.smart-router-settings-form {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.smart-router-sheet .smart-router-inline > .ant-select,
|
||||
.smart-router-sheet .smart-router-inline > .ant-input-number {
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.smart-router-sheet .smart-router-model-select {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
.smart-router-key-tools > .ant-space-item,
|
||||
.smart-router-key-input {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.smart-router-kv {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.smart-router-kv dd {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ function renderModelName(record, copyText, t, isRootUser) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 使用记录(个人端)呈现:原型为 Ant Design 预设无边框标签与纯文本,不含渐变点、脉冲与悬停缩放 ----
|
||||
// ---- 使用记录(个人端)呈现 ----
|
||||
const RECORD_TYPE_COLORS = {
|
||||
1: 'cyan',
|
||||
2: 'green',
|
||||
@@ -312,19 +312,39 @@ function renderRecordType(type, t) {
|
||||
}
|
||||
|
||||
function renderRecordUseTime(record, t) {
|
||||
const useTime = `${parseInt(record.use_time)}s`;
|
||||
const useTime = parseInt(record.use_time, 10);
|
||||
const validUseTime = Number.isFinite(useTime) && useTime >= 0;
|
||||
const other = getLogOther(record.other);
|
||||
const firstTime =
|
||||
record.is_stream && other?.frt
|
||||
? ` / ${(parseFloat(other.frt) / 1000.0).toFixed(1)}s`
|
||||
: '';
|
||||
const firstMilliseconds = parseFloat(other?.frt);
|
||||
const validFirstTime =
|
||||
Number.isFinite(firstMilliseconds) && firstMilliseconds >= 0;
|
||||
// 首字耗时按实际显示的一位小数判色,避免显示 3.0s / 10.0s 却仍落在上一档。
|
||||
const firstTime = validFirstTime
|
||||
? (firstMilliseconds / 1000).toFixed(1)
|
||||
: null;
|
||||
const useTimeColor = !validUseTime
|
||||
? undefined
|
||||
: useTime < 101
|
||||
? 'green'
|
||||
: useTime < 300
|
||||
? 'gold'
|
||||
: 'magenta';
|
||||
const firstTimeColor = !validFirstTime
|
||||
? undefined
|
||||
: Number(firstTime) < 3
|
||||
? 'cyan'
|
||||
: Number(firstTime) < 10
|
||||
? 'orange'
|
||||
: 'red';
|
||||
return (
|
||||
<span className='usage-record-use-time'>
|
||||
<span>
|
||||
{useTime}
|
||||
{firstTime && <em>{firstTime}</em>}
|
||||
</span>
|
||||
<AntTag variant='filled' color={record.is_stream ? 'cyan' : undefined}>
|
||||
<span className='usage-record-use-time' aria-label={t('用时/首字')}>
|
||||
<AntTag color={useTimeColor}>{validUseTime ? `${useTime}s` : '—'}</AntTag>
|
||||
{record.is_stream && (
|
||||
<AntTag color={firstTimeColor}>
|
||||
{validFirstTime ? `${firstTime}s` : '—'}
|
||||
</AntTag>
|
||||
)}
|
||||
<AntTag color={record.is_stream ? 'blue' : undefined}>
|
||||
{record.is_stream ? t('流') : t('非流')}
|
||||
</AntTag>
|
||||
</span>
|
||||
@@ -336,7 +356,7 @@ const formatRecordNumber = (value) => {
|
||||
return Number.isFinite(number) ? number.toLocaleString('en-US') : value;
|
||||
};
|
||||
|
||||
// Both reference images show the same 2097px table at opposite scroll positions.
|
||||
// 固定列宽保持横向滚动时的对齐,耗时列预留三枚标签的空间。
|
||||
const RECORD_COLUMN_WIDTHS = {
|
||||
time: 152,
|
||||
channel: 85,
|
||||
@@ -345,7 +365,7 @@ const RECORD_COLUMN_WIDTHS = {
|
||||
group: 148,
|
||||
type: 110,
|
||||
model: 225,
|
||||
use_time: 126,
|
||||
use_time: 190,
|
||||
prompt: 110,
|
||||
completion: 110,
|
||||
cost: 136,
|
||||
|
||||
@@ -17,7 +17,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { forwardRef, useLayoutEffect, useRef, useState } from 'react';
|
||||
import React, {
|
||||
forwardRef,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { Table, theme } from 'antd';
|
||||
import { colord } from 'colord';
|
||||
import { isCenterTableScope, prepareCenterColumns } from './centerTablePolicy';
|
||||
@@ -56,8 +62,21 @@ const CenterTable = forwardRef(function CenterTable(
|
||||
const scroller = root.querySelector('.ant-table-content,.ant-table-body');
|
||||
const previousTabIndex = scroller?.getAttribute('tabindex');
|
||||
if (scroller && previousTabIndex === null) scroller.tabIndex = 0;
|
||||
const update = () => setWidth(root.clientWidth);
|
||||
update();
|
||||
const observer = new ResizeObserver(([entry]) => {
|
||||
// ResizeObserver already measured the box; avoid a synchronous layout read.
|
||||
setWidth(entry.contentRect.width);
|
||||
});
|
||||
observer.observe(root);
|
||||
return () => {
|
||||
observer.disconnect();
|
||||
if (scroller && previousTabIndex === null)
|
||||
scroller.removeAttribute('tabindex');
|
||||
};
|
||||
}, [enabled]);
|
||||
useEffect(() => {
|
||||
if (!enabled) return;
|
||||
const root = tableRef.current?.nativeElement;
|
||||
if (!root) return;
|
||||
const measureActionWidths = () => {
|
||||
const next = {};
|
||||
root.querySelectorAll('th.center-action-cell').forEach((header) => {
|
||||
@@ -69,9 +88,15 @@ const CenterTable = forwardRef(function CenterTable(
|
||||
(element) => element.getBoundingClientRect().width > 0,
|
||||
);
|
||||
const widths = cells.map((cell) => {
|
||||
const controls = [
|
||||
const controlsWithWidths = [
|
||||
...cell.querySelectorAll('button, a, [role="button"]'),
|
||||
].filter((element) => element.getBoundingClientRect().width > 0);
|
||||
]
|
||||
.map((element) => ({
|
||||
element,
|
||||
width: element.getBoundingClientRect().width,
|
||||
}))
|
||||
.filter(({ width }) => width > 0);
|
||||
const controls = controlsWithWidths.map(({ element }) => element);
|
||||
if (!controls.length) return 0;
|
||||
let group = controls[0].parentElement;
|
||||
while (
|
||||
@@ -85,10 +110,7 @@ const CenterTable = forwardRef(function CenterTable(
|
||||
(Number.parseFloat(cellStyle.paddingRight) || 0);
|
||||
const gap = Number.parseFloat(getComputedStyle(group).columnGap) || 8;
|
||||
return (
|
||||
controls.reduce(
|
||||
(total, element) => total + element.getBoundingClientRect().width,
|
||||
0,
|
||||
) +
|
||||
controlsWithWidths.reduce((total, { width }) => total + width, 0) +
|
||||
gap * Math.max(0, controls.length - 1) +
|
||||
padding
|
||||
);
|
||||
@@ -107,13 +129,8 @@ const CenterTable = forwardRef(function CenterTable(
|
||||
});
|
||||
};
|
||||
const frame = requestAnimationFrame(measureActionWidths);
|
||||
const observer = new ResizeObserver(update);
|
||||
observer.observe(root);
|
||||
return () => {
|
||||
observer.disconnect();
|
||||
cancelAnimationFrame(frame);
|
||||
if (scroller && previousTabIndex === null)
|
||||
scroller.removeAttribute('tabindex');
|
||||
};
|
||||
}, [enabled, width, columns, props.dataSource]);
|
||||
return (
|
||||
|
||||
@@ -36,7 +36,10 @@ import {
|
||||
Space as AntSpace,
|
||||
} from 'antd';
|
||||
import dayjs from 'dayjs';
|
||||
import { useConsoleControlSize } from '../console/ConsoleContext';
|
||||
import {
|
||||
useConsoleControlSize,
|
||||
useConsolePage,
|
||||
} from '../console/ConsoleContext';
|
||||
|
||||
export const controlSize = (size) => (size === 'default' ? 'middle' : size);
|
||||
export const placement = (position) =>
|
||||
@@ -53,6 +56,12 @@ export const placement = (position) =>
|
||||
const statusOf = (status) =>
|
||||
['error', 'warning'].includes(status) ? status : undefined;
|
||||
|
||||
function useSettingsInputId(id) {
|
||||
const generatedId = React.useId();
|
||||
const isSettings = useConsolePage()?.page.key === 'setting';
|
||||
return id ?? (isSettings ? generatedId : undefined);
|
||||
}
|
||||
|
||||
// Existing screens consume values; DOM events stay inside this view boundary.
|
||||
export const Input = forwardRef(function Input(
|
||||
{
|
||||
@@ -69,10 +78,20 @@ export const Input = forwardRef(function Input(
|
||||
},
|
||||
ref,
|
||||
) {
|
||||
const isSettings = useConsolePage()?.page.key === 'setting';
|
||||
const Component = mode === 'password' ? AntInput.Password : AntInput;
|
||||
return (
|
||||
<Component
|
||||
{...props}
|
||||
id={useSettingsInputId(props.id)}
|
||||
autoComplete={
|
||||
props.autoComplete ??
|
||||
(isSettings
|
||||
? mode === 'password' || props.type === 'password'
|
||||
? 'new-password'
|
||||
: 'off'
|
||||
: undefined)
|
||||
}
|
||||
ref={ref}
|
||||
size={useConsoleControlSize(size)}
|
||||
readOnly={readonly ?? props.readOnly}
|
||||
@@ -91,6 +110,7 @@ export const TextArea = forwardRef(function TextArea(
|
||||
return (
|
||||
<AntInput.TextArea
|
||||
{...props}
|
||||
id={useSettingsInputId(props.id)}
|
||||
ref={ref}
|
||||
autoSize={autosize}
|
||||
maxLength={props.maxLength ?? maxCount}
|
||||
@@ -152,6 +172,7 @@ export const InputNumber = forwardRef(function InputNumber(
|
||||
return (
|
||||
<AntInputNumber
|
||||
{...props}
|
||||
id={useSettingsInputId(props.id)}
|
||||
ref={ref}
|
||||
size={useConsoleControlSize(size)}
|
||||
controls={!hideButtons}
|
||||
|
||||
+62
-14
@@ -82,8 +82,12 @@ export const Form = forwardRef(function Form(
|
||||
const FormComponent = consolePage ? ConsoleForm : AntForm;
|
||||
const [form] = AntForm.useForm();
|
||||
const [, renderValues] = useReducer((value) => value + 1, 0);
|
||||
const callbacks = useRef({ getFormApi, onValueChange });
|
||||
callbacks.current = { getFormApi, onValueChange };
|
||||
const callbacks = useRef({});
|
||||
callbacks.current = {
|
||||
getFormApi,
|
||||
onValueChange,
|
||||
renderValues: typeof children === 'function' ? renderValues : () => {},
|
||||
};
|
||||
const api = useMemo(
|
||||
() => ({
|
||||
getValues: () => form.getFieldsValue(true),
|
||||
@@ -94,17 +98,17 @@ export const Form = forwardRef(function Form(
|
||||
callbacks.current.onValueChange?.(form.getFieldsValue(true), {
|
||||
[field]: value,
|
||||
});
|
||||
renderValues();
|
||||
callbacks.current.renderValues();
|
||||
},
|
||||
setValues: (next) => {
|
||||
form.setFieldsValue(next);
|
||||
callbacks.current.onValueChange?.(form.getFieldsValue(true), next);
|
||||
renderValues();
|
||||
callbacks.current.renderValues();
|
||||
},
|
||||
reset: (fields) => {
|
||||
form.resetFields(fields?.map?.(fieldPath));
|
||||
callbacks.current.onValueChange?.(form.getFieldsValue(true));
|
||||
renderValues();
|
||||
callbacks.current.renderValues();
|
||||
},
|
||||
validate: (fields) => form.validateFields(fields?.map?.(fieldPath)),
|
||||
submitForm: () => form.submit(),
|
||||
@@ -122,10 +126,13 @@ export const Form = forwardRef(function Form(
|
||||
useImperativeHandle(ref, () => ({ formApi: api, ...api }), [api]);
|
||||
useEffect(() => {
|
||||
callbacks.current.getFormApi?.(api);
|
||||
renderValues();
|
||||
callbacks.current.renderValues();
|
||||
}, [api]);
|
||||
useEffect(() => {
|
||||
if (values) form.setFieldsValue(values);
|
||||
if (values) {
|
||||
form.setFieldsValue(values);
|
||||
callbacks.current.renderValues();
|
||||
}
|
||||
}, [form, values]);
|
||||
return (
|
||||
<FormContext.Provider value={form}>
|
||||
@@ -151,7 +158,13 @@ export const Form = forwardRef(function Form(
|
||||
wrapperCol={
|
||||
props.wrapperCol ?? (labelWidth ? { flex: '1 1 0' } : undefined)
|
||||
}
|
||||
labelAlign={labelAlign}
|
||||
labelAlign={
|
||||
labelAlign === 'left'
|
||||
? 'start'
|
||||
: labelAlign === 'right'
|
||||
? 'end'
|
||||
: labelAlign
|
||||
}
|
||||
onFinish={onSubmit}
|
||||
onFinishFailed={
|
||||
consolePage && onSubmitFail
|
||||
@@ -168,7 +181,7 @@ export const Form = forwardRef(function Form(
|
||||
}
|
||||
onValuesChange={(_, all) => {
|
||||
callbacks.current.onValueChange?.(all);
|
||||
renderValues();
|
||||
callbacks.current.renderValues();
|
||||
}}
|
||||
>
|
||||
{typeof children === 'function' ? (
|
||||
@@ -198,15 +211,41 @@ function labelProps(label) {
|
||||
|
||||
// Legacy Form.RadioGroup reports the selected value; standalone RadioGroup reports an event.
|
||||
const FieldRadioGroup = forwardRef(function FieldRadioGroup(
|
||||
{ onChange, ...props },
|
||||
{ onChange, id, options, children, ...props },
|
||||
ref,
|
||||
) {
|
||||
// A label must target a radio input, rather than the group's non-labelable div.
|
||||
const optionIndex = options?.findIndex((option) => !option?.disabled);
|
||||
let childLabeled = false;
|
||||
return (
|
||||
<Controls.RadioGroup
|
||||
{...props}
|
||||
ref={ref}
|
||||
id={id ? `${id}-group` : undefined}
|
||||
options={options?.map((option, index) =>
|
||||
index === optionIndex && id
|
||||
? {
|
||||
...(typeof option === 'object'
|
||||
? option
|
||||
: { label: option, value: option }),
|
||||
id,
|
||||
}
|
||||
: option,
|
||||
)}
|
||||
onChange={(event) => onChange?.(event.target.value, event)}
|
||||
/>
|
||||
>
|
||||
{React.Children.map(children, (child) => {
|
||||
if (
|
||||
!id ||
|
||||
childLabeled ||
|
||||
!React.isValidElement(child) ||
|
||||
child.props.disabled
|
||||
)
|
||||
return child;
|
||||
childLabeled = true;
|
||||
return React.cloneElement(child, { id });
|
||||
})}
|
||||
</Controls.RadioGroup>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -284,6 +323,9 @@ export function withField(
|
||||
) : (
|
||||
<Component
|
||||
{...props}
|
||||
{...(Component === FieldRadioGroup && fieldLabel.label
|
||||
? { 'aria-label': props['aria-label'] ?? fieldLabel.label }
|
||||
: {})}
|
||||
id={props.id ?? fieldLabel.htmlFor}
|
||||
ref={ref}
|
||||
style={style}
|
||||
@@ -370,13 +412,19 @@ Form.Slot = function Slot({ label, error, children, ...props }) {
|
||||
</AntForm.Item>
|
||||
);
|
||||
};
|
||||
Form.Section = function Section({ text, extraText, children, ...props }) {
|
||||
Form.Section = function Section({
|
||||
text,
|
||||
extraText,
|
||||
children,
|
||||
component: Component = 'section',
|
||||
...props
|
||||
}) {
|
||||
return (
|
||||
<section {...props}>
|
||||
<Component {...props}>
|
||||
<h3 className='ui-form-section'>{text}</h3>
|
||||
{extraText && <p className='ui-field-help'>{extraText}</p>}
|
||||
{children}
|
||||
</section>
|
||||
</Component>
|
||||
);
|
||||
};
|
||||
Form.Label = function Label({ required, children, ...props }) {
|
||||
|
||||
@@ -383,12 +383,14 @@ function CenterPaginatedTable({
|
||||
{...props}
|
||||
pagination={{
|
||||
...centerPaginationOptions(config, isMobile),
|
||||
showSizeChanger: Boolean(
|
||||
local ||
|
||||
config.onPageSizeChange ||
|
||||
config.onShowSizeChange ||
|
||||
config.onChange,
|
||||
),
|
||||
showSizeChanger:
|
||||
config.showSizeChanger ??
|
||||
Boolean(
|
||||
local ||
|
||||
config.onPageSizeChange ||
|
||||
config.onShowSizeChange ||
|
||||
config.onChange,
|
||||
),
|
||||
current,
|
||||
pageSize,
|
||||
onShowSizeChange: undefined,
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
export function revealActiveSidebarItem(container) {
|
||||
if (!container || container.scrollHeight <= container.clientHeight) return;
|
||||
const active = container.querySelector('[aria-current="page"]');
|
||||
if (!active || !active.getClientRects().length) return;
|
||||
const viewport = container.getBoundingClientRect();
|
||||
const item = active.getBoundingClientRect();
|
||||
const top = viewport.top + container.clientTop;
|
||||
const bottom = top + container.clientHeight;
|
||||
// 只移动菜单自身的滚动区,避免 scrollIntoView 连带滚动正文或页面外壳。
|
||||
const offset =
|
||||
item.top < top
|
||||
? item.top - top
|
||||
: item.bottom > bottom
|
||||
? item.bottom - bottom
|
||||
: 0;
|
||||
if (offset) container.scrollTop += offset;
|
||||
}
|
||||
@@ -154,27 +154,6 @@ export const useNavigation = (
|
||||
to: '/user-center',
|
||||
requireAuth: getHeaderModuleRequireAuth(modules, 'userCenter'),
|
||||
},
|
||||
{
|
||||
text: t('控制台'),
|
||||
itemKey: 'console',
|
||||
to: '/console/analytics',
|
||||
activePrefix: '/console',
|
||||
adminOnly: true,
|
||||
requireAuth: true,
|
||||
},
|
||||
// WeyAi 网页端:外链到网关的 /sso/start(每次点击都重新走一遍免登录授权),
|
||||
// 需要登录;管理员可在「顶栏管理」里关闭
|
||||
...(weyaiVisible
|
||||
? [
|
||||
{
|
||||
text: t('WeyAi'),
|
||||
itemKey: 'weyai',
|
||||
isExternal: true,
|
||||
externalLink: weyaiUrl,
|
||||
requireAuth: true,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
// 企业中心:仅当用户属于某个企业时作为一级入口展示(不跟随 headerNavModules 配置,
|
||||
// 由 showOrgEntry 统一控制可见性,故标记 alwaysShow 跳过模块开关过滤)
|
||||
...(showOrgEntry
|
||||
@@ -189,6 +168,27 @@ export const useNavigation = (
|
||||
},
|
||||
]
|
||||
: []),
|
||||
// WeyAi 网页端:外链到网关的 /sso/start(每次点击都重新走一遍免登录授权),
|
||||
// 需要登录;管理员可在「顶栏管理」里关闭
|
||||
...(weyaiVisible
|
||||
? [
|
||||
{
|
||||
text: t('WeyAi'),
|
||||
itemKey: 'weyai',
|
||||
isExternal: true,
|
||||
externalLink: weyaiUrl,
|
||||
requireAuth: true,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
text: t('控制台'),
|
||||
itemKey: 'console',
|
||||
to: '/console/analytics',
|
||||
activePrefix: '/console',
|
||||
adminOnly: true,
|
||||
requireAuth: true,
|
||||
},
|
||||
];
|
||||
|
||||
return allLinks.filter((link) => {
|
||||
|
||||
@@ -4302,6 +4302,14 @@
|
||||
"请输入聊天应用名称": "Please enter chat application name",
|
||||
"请输入密钥名称": "Enter key name",
|
||||
"请输入密码": "Please enter password",
|
||||
"请输入用户名/邮箱": "Please enter username / email",
|
||||
"请输入企业名称/代码": "Please enter business name/code",
|
||||
"请输入企业内登录名": "Please enter enterprise login name",
|
||||
"请输入确认新密码": "Please confirm the new password",
|
||||
"请输入管理员登录名": "Please enter administrator login name",
|
||||
"请输入确认密码": "Please confirm the password",
|
||||
"请输入备用码": "Please enter backup code",
|
||||
"密码长度需为 8-20 位": "Password must be 8-20 characters long",
|
||||
"请输入密钥": "Please enter the key",
|
||||
"请输入密钥,一行一个": "Please enter the key, one per line",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "Enter keys one per line, format: AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -4124,6 +4124,14 @@
|
||||
"请输入聊天应用名称": "Veuillez saisir le nom de l'application de chat",
|
||||
"请输入密钥名称": "Saisir le nom de la clé",
|
||||
"请输入密码": "Veuillez saisir un mot de passe",
|
||||
"请输入用户名/邮箱": "Veuillez saisir le nom d'utilisateur ou l'e-mail",
|
||||
"请输入企业名称/代码": "Veuillez saisir le nom ou le code de l'entreprise",
|
||||
"请输入企业内登录名": "Veuillez saisir le login dans l'entreprise",
|
||||
"请输入确认新密码": "Veuillez confirmer le nouveau mot de passe",
|
||||
"请输入管理员登录名": "Veuillez saisir le login de l'administrateur",
|
||||
"请输入确认密码": "Veuillez confirmer le mot de passe",
|
||||
"请输入备用码": "Veuillez saisir le code de secours",
|
||||
"密码长度需为 8-20 位": "Le mot de passe doit contenir 8 à 20 caractères",
|
||||
"请输入密钥": "Veuillez saisir la clé",
|
||||
"请输入密钥,一行一个": "Veuillez saisir la clé, une par ligne",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "Saisissez les clés une par ligne, format : AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -4302,6 +4302,14 @@
|
||||
"请输入聊天应用名称": "チャットアプリ名を入力してください",
|
||||
"请输入密钥名称": "キー名を入力",
|
||||
"请输入密码": "パスワードを入力してください",
|
||||
"请输入用户名/邮箱": "ユーザー名/メールアドレスを入力してください",
|
||||
"请输入企业名称/代码": "会社名/コードを入力してください",
|
||||
"请输入企业内登录名": "企業内ログイン名を入力してください",
|
||||
"请输入确认新密码": "確認用の新しいパスワードを入力してください",
|
||||
"请输入管理员登录名": "管理者ログイン名を入力してください",
|
||||
"请输入确认密码": "パスワード(確認用)を入力してください",
|
||||
"请输入备用码": "バックアップコードを入力してください",
|
||||
"密码长度需为 8-20 位": "パスワードは8〜20文字である必要があります",
|
||||
"请输入密钥": "APIキーを入力してください",
|
||||
"请输入密钥,一行一个": "APIキーを入力してください(1行に1つずつ)",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "キーを1行に1つずつ入力してください。形式:AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -4302,6 +4302,14 @@
|
||||
"请输入聊天应用名称": "대화 앱 이름을 입력하세요",
|
||||
"请输入密钥名称": "키 이름 입력",
|
||||
"请输入密码": "비밀번호를 입력하세요",
|
||||
"请输入用户名/邮箱": "사용자명 / 이메일을 입력하세요",
|
||||
"请输入企业名称/代码": "비즈니스 이름/코드를 입력하세요",
|
||||
"请输入企业内登录名": "기업 내 로그인 이름을 입력하세요",
|
||||
"请输入确认新密码": "새 비밀번호 확인을 입력하세요",
|
||||
"请输入管理员登录名": "관리자 로그인 이름을 입력하세요",
|
||||
"请输入确认密码": "비밀번호 확인을 입력하세요",
|
||||
"请输入备用码": "백업 코드를 입력하세요",
|
||||
"密码长度需为 8-20 位": "비밀번호는 8~20자여야 합니다",
|
||||
"请输入密钥": "키를 입력하세요",
|
||||
"请输入密钥,一行一个": "키를 한 줄에 하나씩 입력하세요",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "키를 한 줄에 하나씩 입력하세요. 형식: AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -4156,6 +4156,14 @@
|
||||
"请输入聊天应用名称": "Пожалуйста, введите имя чат-приложения",
|
||||
"请输入密钥名称": "Введите имя ключа",
|
||||
"请输入密码": "Пожалуйста, введите пароль",
|
||||
"请输入用户名/邮箱": "Введите имя пользователя/email",
|
||||
"请输入企业名称/代码": "Введите название компании/код",
|
||||
"请输入企业内登录名": "Введите имя входа предприятия",
|
||||
"请输入确认新密码": "Подтвердите новый пароль",
|
||||
"请输入管理员登录名": "Введите имя администратора",
|
||||
"请输入确认密码": "Подтвердите пароль",
|
||||
"请输入备用码": "Введите резервный код",
|
||||
"密码长度需为 8-20 位": "Пароль должен иметь длину 8 - 20 символов",
|
||||
"请输入密钥": "Пожалуйста, введите ключ",
|
||||
"请输入密钥,一行一个": "Пожалуйста, введите ключи, по одному в строке",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "Введите ключи по одному в строке в формате: AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -4302,6 +4302,14 @@
|
||||
"请输入聊天应用名称": "โปรดกรอกชื่อแอปแชท",
|
||||
"请输入密钥名称": "กรอกชื่อคีย์",
|
||||
"请输入密码": "กรุณากรอกรหัสผ่าน",
|
||||
"请输入用户名/邮箱": "กรุณากรอกชื่อผู้ใช้ / อีเมล",
|
||||
"请输入企业名称/代码": "กรุณากรอกชื่อธุรกิจ / รหัส",
|
||||
"请输入企业内登录名": "กรุณากรอกชื่อผู้ใช้ภายในองค์กร",
|
||||
"请输入确认新密码": "กรุณากรอกยืนยันรหัสผ่านใหม่",
|
||||
"请输入管理员登录名": "กรุณากรอกชื่อผู้ใช้เข้าระบบของผู้ดูแล",
|
||||
"请输入确认密码": "กรุณากรอกยืนยันรหัสผ่าน",
|
||||
"请输入备用码": "กรุณากรอกรหัสสำรอง",
|
||||
"密码长度需为 8-20 位": "รหัสผ่านต้องมีความยาว 8-20 ตัวอักษร",
|
||||
"请输入密钥": "กรุณากรอกคีย์",
|
||||
"请输入密钥,一行一个": "กรุณากรอกคีย์ บรรทัดละหนึ่งรายการ",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "กรุณากรอกคีย์ บรรทัดละหนึ่งรายการ ในรูปแบบ: AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -4302,6 +4302,14 @@
|
||||
"请输入聊天应用名称": "Vui lòng nhập tên ứng dụng trò chuyện",
|
||||
"请输入密钥名称": "Nhập tên khóa",
|
||||
"请输入密码": "Vui lòng nhập mật khẩu",
|
||||
"请输入用户名/邮箱": "Vui lòng nhập tên người dùng / email",
|
||||
"请输入企业名称/代码": "Vui lòng nhập tên doanh nghiệp/mã",
|
||||
"请输入企业内登录名": "Vui lòng nhập tên đăng nhập trong doanh nghiệp",
|
||||
"请输入确认新密码": "Vui lòng nhập xác nhận mật khẩu mới",
|
||||
"请输入管理员登录名": "Vui lòng nhập tên đăng nhập quản trị viên",
|
||||
"请输入确认密码": "Vui lòng nhập xác nhận mật khẩu",
|
||||
"请输入备用码": "Vui lòng nhập mã dự phòng",
|
||||
"密码长度需为 8-20 位": "Mật khẩu phải dài 8-20 ký tự",
|
||||
"请输入密钥": "Vui lòng nhập khóa",
|
||||
"请输入密钥,一行一个": "Vui lòng nhập khóa, mỗi dòng một cái",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "Nhập khóa, mỗi dòng một khóa, định dạng: AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -4302,6 +4302,14 @@
|
||||
"请输入聊天应用名称": "請輸入聊天應用名稱",
|
||||
"请输入密钥名称": "請輸入金鑰名稱",
|
||||
"请输入密码": "請輸入密碼",
|
||||
"请输入用户名/邮箱": "請輸入使用者名稱/郵箱",
|
||||
"请输入企业名称/代码": "請輸入企業名稱/代碼",
|
||||
"请输入企业内登录名": "請輸入企業內登入名",
|
||||
"请输入确认新密码": "請輸入確認新密碼",
|
||||
"请输入管理员登录名": "請輸入管理員登入名",
|
||||
"请输入确认密码": "請輸入確認密碼",
|
||||
"请输入备用码": "請輸入備用碼",
|
||||
"密码长度需为 8-20 位": "密碼長度需為 8-20 位",
|
||||
"请输入密钥": "請輸入金鑰",
|
||||
"请输入密钥,一行一个": "請輸入金鑰,一行一個",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "請輸入金鑰,一行一個,格式:AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -4253,6 +4253,15 @@
|
||||
"请输入聊天应用名称": "请输入聊天应用名称",
|
||||
"请输入密钥名称": "请输入密钥名称",
|
||||
"请输入密码": "请输入密码",
|
||||
"请输入用户名/邮箱": "请输入用户名/邮箱",
|
||||
"请输入企业名称/代码": "请输入企业名称/代码",
|
||||
"请输入企业内登录名": "请输入企业内登录名",
|
||||
"请输入确认新密码": "请输入确认新密码",
|
||||
"请输入管理员登录名": "请输入管理员登录名",
|
||||
"请输入确认密码": "请输入确认密码",
|
||||
"请输入备用码": "请输入备用码",
|
||||
"密码长度需为 8-20 位": "密码长度需为 8-20 位",
|
||||
"请输入邮箱验证码": "请输入邮箱验证码",
|
||||
"请输入密钥": "请输入密钥",
|
||||
"请输入密钥,一行一个": "请输入密钥,一行一个",
|
||||
"请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region": "请输入密钥,一行一个,格式:AccessKey|SecretAccessKey|Region",
|
||||
|
||||
@@ -19,6 +19,13 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button, Tooltip } from 'antd';
|
||||
import {
|
||||
ChartNoAxesCombined,
|
||||
Network,
|
||||
ReceiptText,
|
||||
Wallet,
|
||||
} from 'lucide-react';
|
||||
import { API } from '../../helpers';
|
||||
import { shouldLoadHistoricalTrend } from './dashboardHistory';
|
||||
import './dashboard.css';
|
||||
@@ -90,7 +97,10 @@ export default function Dashboard({
|
||||
signal: controller.signal,
|
||||
},
|
||||
);
|
||||
if (!response.data?.success || (response.data.data != null && !Array.isArray(response.data.data))) {
|
||||
if (
|
||||
!response.data?.success ||
|
||||
(response.data.data != null && !Array.isArray(response.data.data))
|
||||
) {
|
||||
throw new Error('Invalid statement response');
|
||||
}
|
||||
return response.data.data || [];
|
||||
@@ -292,7 +302,14 @@ export default function Dashboard({
|
||||
failed: failedMonths.includes(key),
|
||||
estimated: index === 5,
|
||||
}));
|
||||
const chartMax = Math.max(1, ...chart.map((row) => Math.abs(row.value)));
|
||||
const chartMax =
|
||||
Math.max(0, ...chart.map((row) => Math.abs(row.value))) || 1e10;
|
||||
const axisFormat = new Intl.NumberFormat(i18n.language, {
|
||||
maximumFractionDigits: Math.min(
|
||||
6,
|
||||
Math.max(2, 2 - Math.floor(Math.log10(chartMax / 1e10))),
|
||||
),
|
||||
});
|
||||
|
||||
return (
|
||||
<div className='commission-dashboard'>
|
||||
@@ -300,20 +317,34 @@ export default function Dashboard({
|
||||
<h3 id='commission-month-overview'>{t('本月概览')}</h3>
|
||||
<div className='commission-dashboard-core'>
|
||||
<div className='commission-dashboard-stat'>
|
||||
<span>{t('预估有效销售额')}</span>
|
||||
<span>
|
||||
<Wallet size={16} aria-hidden />
|
||||
{t('预估有效销售额')}
|
||||
</span>
|
||||
<strong>{hasSales ? money(sales) : '—'}</strong>
|
||||
{!hasSales && <small>{t('暂无销售额数据')}</small>}
|
||||
</div>
|
||||
<div className='commission-dashboard-stat commission-dashboard-stat--featured'>
|
||||
<span>{t('预估应付提成')}</span>
|
||||
<span>
|
||||
<Wallet size={16} aria-hidden />
|
||||
{t('预估应付提成')}
|
||||
</span>
|
||||
<strong>{money(estimated)}</strong>
|
||||
</div>
|
||||
<div className='commission-dashboard-stat'>
|
||||
<span>{t('占销售额比例')}</span>
|
||||
<span>
|
||||
<ChartNoAxesCombined size={16} aria-hidden />
|
||||
{t('占销售额比例')}
|
||||
</span>
|
||||
<strong>
|
||||
{hasSales && sales > 0
|
||||
? `${numberFormat.format((estimated / sales) * 100)}%`
|
||||
: '—'}
|
||||
{hasSales && sales > 0 ? (
|
||||
<>
|
||||
{numberFormat.format((estimated / sales) * 100)}
|
||||
<small>%</small>
|
||||
</>
|
||||
) : (
|
||||
'—'
|
||||
)}
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
@@ -322,18 +353,26 @@ export default function Dashboard({
|
||||
[
|
||||
'生效合作伙伴',
|
||||
partners.filter((row) => row.status === 'active').length,
|
||||
'家',
|
||||
],
|
||||
[
|
||||
'正式归属客户',
|
||||
assignments.filter(
|
||||
(row) => row.status === 'formal' && !row.ended_at,
|
||||
).length,
|
||||
'个',
|
||||
],
|
||||
['保护期客户', protectedAssignments.length],
|
||||
].map(([label, count]) => (
|
||||
['保护期客户', protectedAssignments.length, '个'],
|
||||
].map(([label, count, unit]) => (
|
||||
<div className='commission-dashboard-stat' key={label}>
|
||||
<span>{t(label)}</span>
|
||||
<strong>{count}</strong>
|
||||
<span>
|
||||
<Network size={16} aria-hidden />
|
||||
{t(label)}
|
||||
</span>
|
||||
<strong>
|
||||
{count}
|
||||
<small>{t(unit)}</small>
|
||||
</strong>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -359,6 +398,15 @@ export default function Dashboard({
|
||||
<span>{t(todo.label)}</span>
|
||||
<strong className={`commission-dashboard-${todo.tone}`}>
|
||||
{todo.rows.length}
|
||||
<small>
|
||||
{t(
|
||||
todo.target === 'partners'
|
||||
? '家'
|
||||
: todo.target === 'exceptions'
|
||||
? '条'
|
||||
: '个',
|
||||
)}
|
||||
</small>
|
||||
</strong>
|
||||
</button>
|
||||
))}
|
||||
@@ -373,28 +421,30 @@ export default function Dashboard({
|
||||
{t(todo.label)}
|
||||
</span>
|
||||
<h4>
|
||||
{t('待处理 {{count}} 项', { count: todo.rows.length })}
|
||||
{todo.rows.length > 0
|
||||
? todo.rows
|
||||
.slice(0, 2)
|
||||
.map((row) =>
|
||||
t('{{partner}} · {{month}}', {
|
||||
partner:
|
||||
partnerById.get(String(row.partner_id))?.name ||
|
||||
t('伙伴 #{{id}}', { id: row.partner_id }),
|
||||
month: row.statement_month,
|
||||
}),
|
||||
)
|
||||
.join(' / ')
|
||||
: t('待处理 {{count}} 项', { count: todo.rows.length })}
|
||||
</h4>
|
||||
<p>{t(todo.description)}</p>
|
||||
{todo.rows.length > 0 && (
|
||||
<small>
|
||||
{todo.rows
|
||||
.slice(0, 2)
|
||||
.map((row) =>
|
||||
t('{{partner}} · {{month}}', {
|
||||
partner:
|
||||
partnerById.get(String(row.partner_id))?.name ||
|
||||
t('伙伴 #{{id}}', { id: row.partner_id }),
|
||||
month: row.statement_month,
|
||||
}),
|
||||
)
|
||||
.join(' / ')}
|
||||
{t('待处理 {{count}} 项', { count: todo.rows.length })}
|
||||
</small>
|
||||
)}
|
||||
</div>
|
||||
<button
|
||||
type='button'
|
||||
className={`commission-dashboard-button${todo.rows.length ? ' commission-dashboard-button--primary' : ''}`}
|
||||
<Button
|
||||
type={todo.rows.length ? 'primary' : 'default'}
|
||||
size='small'
|
||||
onClick={() => navigateTodo(todo)}
|
||||
aria-label={t('{{action}}:{{label}},{{count}} 项', {
|
||||
action: t(todo.action),
|
||||
@@ -403,7 +453,7 @@ export default function Dashboard({
|
||||
})}
|
||||
>
|
||||
{t(todo.action)}
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -427,7 +477,10 @@ export default function Dashboard({
|
||||
})
|
||||
}
|
||||
>
|
||||
<span>{t('未绑定档位渠道')}</span>
|
||||
<span>
|
||||
<ReceiptText size={16} aria-hidden />
|
||||
{t('未绑定档位渠道')}
|
||||
</span>
|
||||
<strong
|
||||
className={
|
||||
unboundChannels.length
|
||||
@@ -436,6 +489,7 @@ export default function Dashboard({
|
||||
}
|
||||
>
|
||||
{unboundChannels.length}
|
||||
<small>{t('条')}</small>
|
||||
</strong>
|
||||
<small>{t('查看渠道档位')} →</small>
|
||||
</button>
|
||||
@@ -450,7 +504,10 @@ export default function Dashboard({
|
||||
})
|
||||
}
|
||||
>
|
||||
<span>{t('未绑定档位等级')}</span>
|
||||
<span>
|
||||
<ReceiptText size={16} aria-hidden />
|
||||
{t('未绑定档位等级')}
|
||||
</span>
|
||||
<strong
|
||||
className={
|
||||
unboundLevels.length
|
||||
@@ -459,6 +516,7 @@ export default function Dashboard({
|
||||
}
|
||||
>
|
||||
{unboundLevels.length}
|
||||
<small>{t('个')}</small>
|
||||
</strong>
|
||||
<p>{t('不含跟随模型或渠道档位的默认等级')}</p>
|
||||
<small>{t('查看等级档位')} →</small>
|
||||
@@ -483,67 +541,85 @@ export default function Dashboard({
|
||||
months: failedMonths.join('、'),
|
||||
})}
|
||||
</span>
|
||||
<button
|
||||
type='button'
|
||||
className='commission-dashboard-button'
|
||||
onClick={() => setRetry((value) => value + 1)}
|
||||
>
|
||||
<Button size='small' onClick={() => setRetry((value) => value + 1)}>
|
||||
{t('重试')}
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<div className='commission-dashboard-chart' aria-busy={trendLoading}>
|
||||
{chart.map((row) => (
|
||||
<button
|
||||
type='button'
|
||||
key={row.month}
|
||||
className={`commission-dashboard-chart-column${row.estimated ? ' commission-dashboard-chart-column--current' : ''}`}
|
||||
onClick={() => onNavigate?.('bills', { month: row.month })}
|
||||
aria-label={t('{{month}}:{{amount}},{{status}}', {
|
||||
month: row.month,
|
||||
amount: money(row.value),
|
||||
status: t(
|
||||
row.failed
|
||||
? '加载失败'
|
||||
<div className='commission-dashboard-chart-frame'>
|
||||
<div className='commission-dashboard-chart-axis' aria-hidden>
|
||||
{[4, 3, 2, 1, 0].map((tick) => (
|
||||
<span key={tick}>
|
||||
{axisFormat.format((chartMax * tick) / 4e10)}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<div className='commission-dashboard-chart' aria-busy={trendLoading}>
|
||||
{chart.map((row) => {
|
||||
const pending = trendLoading && !row.estimated;
|
||||
const valueLabel = row.failed || pending ? '—' : money(row.value);
|
||||
const statusLabel = t(
|
||||
row.failed
|
||||
? '加载失败'
|
||||
: pending
|
||||
? '加载中'
|
||||
: row.estimated
|
||||
? '实时预估'
|
||||
: row.hasData
|
||||
? '账单应付'
|
||||
: '暂无数据',
|
||||
),
|
||||
})}
|
||||
>
|
||||
<span className='commission-dashboard-chart-plot'>
|
||||
<span
|
||||
className='commission-dashboard-chart-bar'
|
||||
style={{
|
||||
height: `${Math.max(row.value ? 2 : 0, (Math.abs(row.value) / chartMax) * 100)}%`,
|
||||
}}
|
||||
);
|
||||
return (
|
||||
<Tooltip
|
||||
key={row.month}
|
||||
trigger={['hover', 'focus']}
|
||||
title={`${row.month} · ${valueLabel} · ${statusLabel}`}
|
||||
>
|
||||
<span className='commission-dashboard-chart-value'>
|
||||
{row.failed || (trendLoading && !row.estimated)
|
||||
? '—'
|
||||
: numberFormat.format(row.value / 1e10)}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span className='commission-dashboard-chart-month'>
|
||||
{row.month.slice(5)}
|
||||
{t('月')}
|
||||
</span>
|
||||
<span className='commission-dashboard-chart-status'>
|
||||
{row.failed
|
||||
? t('加载失败')
|
||||
: row.estimated
|
||||
? t('预估')
|
||||
: trendLoading
|
||||
? t('加载中')
|
||||
: !row.hasData
|
||||
? t('暂无数据')
|
||||
: '\u00a0'}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
<button
|
||||
type='button'
|
||||
key={row.month}
|
||||
className={`commission-dashboard-chart-column${row.estimated ? ' commission-dashboard-chart-column--current' : ''}`}
|
||||
onClick={() => onNavigate?.('bills', { month: row.month })}
|
||||
aria-label={t('{{month}}:{{amount}},{{status}}', {
|
||||
month: row.month,
|
||||
amount: valueLabel,
|
||||
status: statusLabel,
|
||||
})}
|
||||
>
|
||||
<span className='commission-dashboard-chart-plot'>
|
||||
<span
|
||||
className='commission-dashboard-chart-bar'
|
||||
style={{
|
||||
height: `${Math.max(row.value ? 2 : 0, (Math.abs(row.value) / chartMax) * 100)}%`,
|
||||
}}
|
||||
>
|
||||
<span className='commission-dashboard-chart-value'>
|
||||
{row.failed || (trendLoading && !row.estimated)
|
||||
? '—'
|
||||
: numberFormat.format(row.value / 1e10)}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span className='commission-dashboard-chart-month'>
|
||||
{row.month.slice(5)}
|
||||
{t('月')}
|
||||
</span>
|
||||
<span className='commission-dashboard-chart-status'>
|
||||
{row.failed
|
||||
? t('加载失败')
|
||||
: row.estimated
|
||||
? t('预估')
|
||||
: trendLoading
|
||||
? t('加载中')
|
||||
: !row.hasData
|
||||
? t('暂无数据')
|
||||
: '\u00a0'}
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@@ -19,8 +19,15 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button, Card, Empty, Input, Select, Table } from 'antd';
|
||||
import { Search } from 'lucide-react';
|
||||
import { Button, Empty, Input, Select } from 'antd';
|
||||
import { Table } from '@/components/ui';
|
||||
import { Search } from '@/components/common/icons/ActionIcons';
|
||||
import {
|
||||
ConsoleCard,
|
||||
ConsoleSearchBar,
|
||||
ConsoleSearchActions,
|
||||
ConsoleTabs,
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import { filterCommissionRows, matchesStatus } from './listFilters';
|
||||
|
||||
export default function ListPanel({
|
||||
@@ -115,41 +122,43 @@ export default function ListPanel({
|
||||
setPage(1);
|
||||
server?.onChange({ ...draft, status, page: 1 });
|
||||
};
|
||||
const reset = () => {
|
||||
setDraft({ query: '', type: '', partner: '' });
|
||||
setFilters({});
|
||||
setStatus('all');
|
||||
server?.onChange({ status: 'all', page: 1 });
|
||||
setScopedIds(null);
|
||||
setPage(1);
|
||||
};
|
||||
const [filtersOpen, setFiltersOpen] = useState(false);
|
||||
return (
|
||||
<Card
|
||||
className={`commission-card commission-list commission-list--${section}`}
|
||||
>
|
||||
<div className={`commission-list commission-list--${section}`}>
|
||||
{tabSets[section] && (
|
||||
<div
|
||||
<ConsoleTabs
|
||||
className='commission-list-tabs'
|
||||
role='tablist'
|
||||
aria-label={t('状态筛选')}
|
||||
>
|
||||
{tabSets[section].map(([key, label]) => (
|
||||
<button
|
||||
key={key}
|
||||
type='button'
|
||||
role='tab'
|
||||
aria-selected={status === key}
|
||||
className={status === key ? 'is-active' : ''}
|
||||
onClick={() => {
|
||||
setStatus(key);
|
||||
setPage(1);
|
||||
server?.onChange({ ...filters, status: key, page: 1 });
|
||||
}}
|
||||
>
|
||||
{t(label)}
|
||||
activeKey={status}
|
||||
onChange={(key) => {
|
||||
setStatus(key);
|
||||
setPage(1);
|
||||
server?.onChange({ ...filters, status: key, page: 1 });
|
||||
}}
|
||||
items={tabSets[section].map(([key, label]) => ({
|
||||
key,
|
||||
label: (
|
||||
<span>
|
||||
{server
|
||||
? server.counts[
|
||||
{ enabled: 'active', scheduled: 'pending' }[key] || key
|
||||
] || 0
|
||||
: rows.filter((row) => matchesStatus(row, key, section))
|
||||
.length}
|
||||
{t(label)}{' '}
|
||||
<span className='commission-tab-count'>
|
||||
{server
|
||||
? server.counts[
|
||||
{ enabled: 'active', scheduled: 'pending' }[key] || key
|
||||
] || 0
|
||||
: rows.filter((row) => matchesStatus(row, key, section))
|
||||
.length}
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
),
|
||||
}))}
|
||||
/>
|
||||
)}
|
||||
{scopedIds && (
|
||||
<div className='commission-context-filter'>
|
||||
@@ -166,79 +175,109 @@ export default function ListPanel({
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<div className='commission-filter-bar'>
|
||||
<Input
|
||||
prefix={<Search size={16} aria-hidden />}
|
||||
value={draft.query}
|
||||
onChange={(event) => set('query', event.target.value)}
|
||||
onPressEnter={query}
|
||||
allowClear
|
||||
placeholder={t(placeholders[section])}
|
||||
aria-label={t(placeholders[section])}
|
||||
/>
|
||||
{typeOptions && (
|
||||
<Select
|
||||
aria-label={t('类型筛选')}
|
||||
value={draft.type}
|
||||
onChange={(value) => set('type', value)}
|
||||
options={[
|
||||
{
|
||||
value: '',
|
||||
label: t(
|
||||
section === 'assignments'
|
||||
? '全部客户类型'
|
||||
: section === 'tiers'
|
||||
? '全部来源'
|
||||
: '全部类型',
|
||||
),
|
||||
},
|
||||
...typeOptions.map(([value, label]) => ({
|
||||
value,
|
||||
label: t(label),
|
||||
})),
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
{section === 'partners' && (
|
||||
<Select
|
||||
aria-label={t('状态筛选')}
|
||||
value={draft.status || ''}
|
||||
onChange={(value) => set('status', value)}
|
||||
options={['', 'draft', 'active', 'suspended', 'terminated'].map(
|
||||
(value, i) => ({
|
||||
value,
|
||||
label: t(['全部状态', '草稿', '生效中', '已暂停', '已终止'][i]),
|
||||
}),
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
{['assignments', 'bills', 'adjustments'].includes(section) && (
|
||||
<Select
|
||||
aria-label={t('合作伙伴筛选')}
|
||||
showSearch={{ optionFilterProp: 'label' }}
|
||||
value={draft.partner}
|
||||
onChange={(value) => set('partner', value)}
|
||||
options={[
|
||||
{ value: '', label: t('全部合作伙伴') },
|
||||
...partners.map((row) => ({ value: row.id, label: row.name })),
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
<Button type='primary' onClick={query}>
|
||||
{t('查询')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
setDraft({ query: '', type: '', partner: '' });
|
||||
setFilters({});
|
||||
setStatus('all');
|
||||
server?.onChange({ status: 'all', page: 1 });
|
||||
setScopedIds(null);
|
||||
setPage(1);
|
||||
<Button
|
||||
className='commission-filter-toggle'
|
||||
aria-expanded={filtersOpen}
|
||||
onClick={() => setFiltersOpen((value) => !value)}
|
||||
>
|
||||
{t(filtersOpen ? '隐藏操作项' : '显示操作项')}
|
||||
</Button>
|
||||
<ConsoleSearchBar
|
||||
className={`commission-filter-card${filtersOpen ? ' is-open' : ''}`}
|
||||
>
|
||||
<form
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
query();
|
||||
}}
|
||||
>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
<div className='console-search-fields'>
|
||||
<label className='console-search-field commission-search-field'>
|
||||
<span>{t('搜索')}</span>
|
||||
<Input
|
||||
prefix={<Search size={16} aria-hidden />}
|
||||
value={draft.query}
|
||||
onChange={(event) => set('query', event.target.value)}
|
||||
allowClear
|
||||
placeholder={t(placeholders[section])}
|
||||
aria-label={t(placeholders[section])}
|
||||
/>
|
||||
</label>
|
||||
{typeOptions && (
|
||||
<label className='console-search-field commission-search-field'>
|
||||
<span>{t('类型筛选')}</span>
|
||||
<Select
|
||||
aria-label={t('类型筛选')}
|
||||
value={draft.type}
|
||||
onChange={(value) => set('type', value)}
|
||||
options={[
|
||||
{
|
||||
value: '',
|
||||
label: t(
|
||||
section === 'assignments'
|
||||
? '全部客户类型'
|
||||
: section === 'tiers'
|
||||
? '全部来源'
|
||||
: '全部类型',
|
||||
),
|
||||
},
|
||||
...typeOptions.map(([value, label]) => ({
|
||||
value,
|
||||
label: t(label),
|
||||
})),
|
||||
]}
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
{section === 'partners' && (
|
||||
<label className='console-search-field commission-search-field'>
|
||||
<span>{t('状态筛选')}</span>
|
||||
<Select
|
||||
aria-label={t('状态筛选')}
|
||||
value={draft.status || ''}
|
||||
onChange={(value) => set('status', value)}
|
||||
options={[
|
||||
'',
|
||||
'draft',
|
||||
'active',
|
||||
'suspended',
|
||||
'terminated',
|
||||
].map((value, i) => ({
|
||||
value,
|
||||
label: t(
|
||||
['全部状态', '草稿', '生效中', '已暂停', '已终止'][i],
|
||||
),
|
||||
}))}
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
{['assignments', 'bills', 'adjustments'].includes(section) && (
|
||||
<label className='console-search-field commission-search-field'>
|
||||
<span>{t('合作伙伴筛选')}</span>
|
||||
<Select
|
||||
aria-label={t('合作伙伴筛选')}
|
||||
showSearch={{ optionFilterProp: 'label' }}
|
||||
value={draft.partner}
|
||||
onChange={(value) => set('partner', value)}
|
||||
options={[
|
||||
{ value: '', label: t('全部合作伙伴') },
|
||||
...partners.map((row) => ({
|
||||
value: row.id,
|
||||
label: row.name,
|
||||
})),
|
||||
]}
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
<ConsoleSearchActions
|
||||
onReset={reset}
|
||||
searchLabel='查询'
|
||||
loading={server?.busy}
|
||||
/>
|
||||
</form>
|
||||
</ConsoleSearchBar>
|
||||
<ConsoleCard className='commission-card commission-list-card'>
|
||||
<div className='commission-filter-end'>
|
||||
<span>
|
||||
{t('共 {{count}} 条', {
|
||||
@@ -255,35 +294,41 @@ export default function ListPanel({
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<Table
|
||||
rowKey='id'
|
||||
loading={server?.busy}
|
||||
columns={columns}
|
||||
dataSource={filtered}
|
||||
size='middle'
|
||||
scroll={{ x: 'max-content' }}
|
||||
pagination={{
|
||||
size: 'small',
|
||||
pageSize: server ? 100 : 10,
|
||||
total: server ? server.total : filtered.length,
|
||||
current: server ? server.page : page,
|
||||
onChange: (next) => {
|
||||
setPage(next);
|
||||
server?.onChange({ ...filters, status, page: next });
|
||||
},
|
||||
showSizeChanger: false,
|
||||
showTotal: (total) => t('共 {{total}} 条', { total }),
|
||||
}}
|
||||
locale={{
|
||||
emptyText: (
|
||||
<Table
|
||||
rowKey='id'
|
||||
loading={server?.busy}
|
||||
columns={columns.map((column) => ({
|
||||
width: 160,
|
||||
...column,
|
||||
...(/(?:_uyuan|_yuan|_bps|amount|count|quantity)$/.test(
|
||||
column.dataIndex || '',
|
||||
)
|
||||
? { align: 'right' }
|
||||
: {}),
|
||||
}))}
|
||||
dataSource={filtered}
|
||||
size='middle'
|
||||
scroll={{ x: 'max-content' }}
|
||||
pagination={{
|
||||
size: 'small',
|
||||
pageSize: server ? 100 : 10,
|
||||
total: server ? server.total : filtered.length,
|
||||
current: server ? server.page : page,
|
||||
onChange: (next) => {
|
||||
setPage(next);
|
||||
server?.onChange({ ...filters, status, page: next });
|
||||
},
|
||||
showSizeChanger: false,
|
||||
showTotal: (total) => t('共 {{total}} 条', { total }),
|
||||
}}
|
||||
empty={
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={t('暂无数据')}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</Card>
|
||||
}
|
||||
/>
|
||||
</ConsoleCard>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,13 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Alert, Button, Descriptions, Drawer, Spin, Table, Tag } from 'antd';
|
||||
import { Button, Descriptions, Spin, Tag } from 'antd';
|
||||
import { Table } from '@/components/ui';
|
||||
import {
|
||||
ConsoleAlert as Alert,
|
||||
ConsoleDrawer as Drawer,
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import { useCommissionThemeStyle } from './commissionTheme';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { commissionActorName, commissionLabel, statusTagColor } from './labels';
|
||||
import { EvidenceLink } from './operations';
|
||||
@@ -31,6 +37,7 @@ export default function PartnerDetail({
|
||||
onClose,
|
||||
onEdit,
|
||||
}) {
|
||||
const themeStyle = useCommissionThemeStyle();
|
||||
const { t, i18n } = useTranslation();
|
||||
const [record, setRecord] = useState(null);
|
||||
const [error, setError] = useState('');
|
||||
@@ -65,6 +72,7 @@ export default function PartnerDetail({
|
||||
);
|
||||
return (
|
||||
<Drawer
|
||||
rootStyle={themeStyle}
|
||||
rootClassName='commission-profile-drawer commission-detail-drawer'
|
||||
title={
|
||||
<span>
|
||||
|
||||
@@ -58,6 +58,9 @@ import { BillingColumns, AdjustmentColumns } from './operations';
|
||||
import { commissionLabel } from './labels';
|
||||
import { PARTNER_NAVIGATION, partnerView } from './partnerNavigation';
|
||||
import './partnerPortal.css';
|
||||
import OrgPageHeader from '../Organization/components/OrgPageHeader';
|
||||
import OrgModal from '../Organization/components/OrgModal';
|
||||
import { useCommissionThemeStyle } from './commissionTheme';
|
||||
|
||||
const { Content } = Layout;
|
||||
const { Title, Text } = Typography;
|
||||
@@ -98,6 +101,8 @@ export default function PartnerPortal({
|
||||
tag,
|
||||
embedded = false,
|
||||
}) {
|
||||
const themeStyle = useCommissionThemeStyle();
|
||||
const PartnerModal = embedded ? OrgModal : Modal;
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
@@ -1194,7 +1199,7 @@ export default function PartnerPortal({
|
||||
</aside>
|
||||
)}
|
||||
<Layout>
|
||||
<header className='commission-workspace-bar'>
|
||||
<header className='commission-workspace-bar' hidden={embedded}>
|
||||
<div>
|
||||
{t(embedded ? '企业分佣' : '合作分佣')}
|
||||
<span className='commission-crumb-slash'>/</span>
|
||||
@@ -1210,7 +1215,9 @@ export default function PartnerPortal({
|
||||
<span className='commission-workspace-role'>{t('伙伴工作台')}</span>
|
||||
)}
|
||||
</header>
|
||||
<Content className='commission-v2-content'>
|
||||
<Content
|
||||
className={`commission-v2-content${embedded ? ' uc-page oc-page' : ''}`}
|
||||
>
|
||||
<div className='commission-page-header'>
|
||||
<div className='commission-page-heading'>
|
||||
{selected && (
|
||||
@@ -1224,17 +1231,38 @@ export default function PartnerPortal({
|
||||
{t('返回我的提成')}
|
||||
</Button>
|
||||
)}
|
||||
<Title level={4}>{t(pageTitle)}</Title>
|
||||
<Text type='secondary'>
|
||||
{selected
|
||||
? `${t('账单号')} #${selected.id} · ${selected.statement_month}`
|
||||
: t(subtitles[active])}
|
||||
{!selected &&
|
||||
['overview', 'estimate'].includes(active) &&
|
||||
summary.updated_at
|
||||
? ` · ${t('数据更新时间')}:${formatDateTime(summary.updated_at)}`
|
||||
: ''}
|
||||
</Text>
|
||||
{embedded ? (
|
||||
<OrgPageHeader
|
||||
title={t(pageTitle)}
|
||||
subtitle={
|
||||
selected ? (
|
||||
`${t('账单号')} #${selected.id} · ${selected.statement_month}`
|
||||
) : (
|
||||
<>
|
||||
{t(subtitles[active])}
|
||||
{['overview', 'estimate'].includes(active) &&
|
||||
summary.updated_at
|
||||
? ` · ${t('数据更新时间')}:${formatDateTime(summary.updated_at)}`
|
||||
: ''}
|
||||
</>
|
||||
)
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<Title level={4}>{t(pageTitle)}</Title>
|
||||
)}
|
||||
{!embedded && (
|
||||
<Text type='secondary'>
|
||||
{selected
|
||||
? `${t('账单号')} #${selected.id} · ${selected.statement_month}`
|
||||
: t(subtitles[active])}
|
||||
{!selected &&
|
||||
['overview', 'estimate'].includes(active) &&
|
||||
summary.updated_at
|
||||
? ` · ${t('数据更新时间')}:${formatDateTime(summary.updated_at)}`
|
||||
: ''}
|
||||
</Text>
|
||||
)}
|
||||
</div>
|
||||
<div className='commission-actions'>
|
||||
{selected && (
|
||||
@@ -1315,7 +1343,8 @@ export default function PartnerPortal({
|
||||
)}
|
||||
</Content>
|
||||
</Layout>
|
||||
<Modal
|
||||
<PartnerModal
|
||||
style={themeStyle}
|
||||
className='commission-modal partner-portal-modal'
|
||||
visible={!!action}
|
||||
title={`${t(action === 'reject' ? '驳回账单' : '确认账单')} · #${selected?.id || ''}`}
|
||||
@@ -1377,7 +1406,7 @@ export default function PartnerPortal({
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</Modal>
|
||||
</PartnerModal>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { theme } from 'antd';
|
||||
|
||||
// Portal overlays need the same semantic colors as the workspace root.
|
||||
export function useCommissionThemeStyle() {
|
||||
const { token } = theme.useToken();
|
||||
return {
|
||||
'--commission-primary': token.colorPrimary,
|
||||
'--commission-primary-hover': token.colorPrimaryHover,
|
||||
'--commission-primary-soft': token.colorPrimaryBg,
|
||||
'--commission-primary-readable': token.colorLink,
|
||||
'--commission-primary-solid': token.colorPrimary,
|
||||
'--commission-on-primary': token.colorTextLightSolid,
|
||||
'--commission-success': token.colorSuccessText,
|
||||
'--commission-success-soft': token.colorSuccessBg,
|
||||
'--commission-warning': token.colorWarningText,
|
||||
'--commission-warning-soft': token.colorWarningBg,
|
||||
'--commission-danger': token.colorErrorText,
|
||||
'--commission-danger-soft': token.colorErrorBg,
|
||||
'--commission-info': token.colorInfoText,
|
||||
'--commission-info-soft': token.colorInfoBg,
|
||||
'--commission-control-border': token.colorBorder,
|
||||
'--commission-font': token.fontFamily,
|
||||
};
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
);
|
||||
--dash-text: var(--text-primary, #1d2129);
|
||||
--dash-card: var(--surface-card, #fff);
|
||||
--dash-soft: color-mix(in srgb, var(--surface-bg-base) 52%, var(--dash-card));
|
||||
--dash-soft: var(--surface-bg-base);
|
||||
--dash-featured-bg: color-mix(
|
||||
in srgb,
|
||||
var(--commission-primary-soft, #e8f0ff) 62%,
|
||||
@@ -18,11 +18,11 @@
|
||||
var(--dash-primary) 24%,
|
||||
var(--dash-line)
|
||||
);
|
||||
--dash-warning: color-mix(in srgb, #f59e0b 78%, var(--dash-text));
|
||||
--dash-danger: color-mix(in srgb, #f56c7a 82%, var(--dash-text));
|
||||
--dash-success: color-mix(in srgb, #22c55e 78%, var(--dash-text));
|
||||
--dash-warning-bg: color-mix(in srgb, #f59e0b 12%, var(--dash-card));
|
||||
--dash-danger-bg: color-mix(in srgb, #f56c7a 12%, var(--dash-card));
|
||||
--dash-warning: var(--commission-warning);
|
||||
--dash-danger: var(--commission-danger);
|
||||
--dash-success: var(--commission-success);
|
||||
--dash-warning-bg: var(--commission-warning-soft);
|
||||
--dash-danger-bg: var(--commission-danger-soft);
|
||||
--dash-grid: color-mix(in srgb, var(--dash-text) 11%, transparent);
|
||||
--dash-muted-bar: color-mix(
|
||||
in srgb,
|
||||
@@ -70,7 +70,7 @@
|
||||
.commission-dashboard-period {
|
||||
flex-shrink: 0;
|
||||
border: 1px solid var(--dash-line);
|
||||
border-radius: 4px;
|
||||
border-radius: 8px;
|
||||
background: var(--dash-card);
|
||||
padding: 6px 12px;
|
||||
font-size: 12px;
|
||||
@@ -81,26 +81,29 @@
|
||||
.commission-dashboard-support {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.commission-dashboard-stat,
|
||||
.commission-dashboard-card {
|
||||
border: 1px solid var(--dash-line);
|
||||
border-radius: 6px;
|
||||
border-radius: 10px;
|
||||
background: var(--dash-card);
|
||||
box-shadow: none;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.commission-dashboard-stat {
|
||||
padding: 16px 20px;
|
||||
padding: 22px 24px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.commission-dashboard-stat > span,
|
||||
.commission-dashboard-summary-item > span,
|
||||
.commission-dashboard-health-item > span {
|
||||
display: block;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 9px;
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
color: var(--dash-muted);
|
||||
@@ -111,13 +114,27 @@
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.commission-dashboard-stat > span > svg,
|
||||
.commission-dashboard-health-item > span > svg {
|
||||
flex-shrink: 0;
|
||||
color: var(--dash-primary);
|
||||
}
|
||||
|
||||
.commission-dashboard strong > small {
|
||||
margin-inline-start: 6px;
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
letter-spacing: 0;
|
||||
color: var(--dash-muted);
|
||||
}
|
||||
|
||||
.commission-dashboard-stat > strong {
|
||||
display: block;
|
||||
margin-top: 8px;
|
||||
font-size: 28px;
|
||||
font-size: 30px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.7px;
|
||||
line-height: 1.3;
|
||||
line-height: 1.5;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
@@ -129,8 +146,12 @@
|
||||
}
|
||||
|
||||
.commission-dashboard-stat--featured {
|
||||
background: var(--dash-featured-bg);
|
||||
border-color: var(--dash-featured-line);
|
||||
background: linear-gradient(
|
||||
120deg,
|
||||
var(--dash-card),
|
||||
var(--commission-primary-soft)
|
||||
);
|
||||
border-color: var(--dash-line);
|
||||
}
|
||||
|
||||
.commission-dashboard-stat--featured > strong {
|
||||
@@ -138,7 +159,7 @@
|
||||
}
|
||||
|
||||
.commission-dashboard-support {
|
||||
margin-top: 12px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.commission-dashboard-support .commission-dashboard-stat {
|
||||
@@ -146,35 +167,35 @@
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding: 14px 20px;
|
||||
padding: 16px 22px;
|
||||
}
|
||||
|
||||
.commission-dashboard-support .commission-dashboard-stat > strong {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
font-size: 23px;
|
||||
}
|
||||
|
||||
.commission-dashboard p.commission-dashboard-note {
|
||||
margin-top: 12px;
|
||||
margin-top: 14px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.commission-dashboard-main {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr);
|
||||
gap: 16px;
|
||||
margin: 16px 0;
|
||||
grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr);
|
||||
gap: 20px;
|
||||
margin: 24px 0 20px;
|
||||
}
|
||||
|
||||
.commission-dashboard-card {
|
||||
padding: 18px 20px;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.commission-dashboard-todo-summary {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
gap: 12px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.commission-dashboard button {
|
||||
@@ -188,10 +209,10 @@
|
||||
}
|
||||
|
||||
.commission-dashboard-summary-item {
|
||||
padding: 10px 12px;
|
||||
padding: 14px;
|
||||
text-align: left;
|
||||
border: 1px solid var(--dash-line);
|
||||
border-radius: 4px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 8px;
|
||||
background: var(--dash-soft);
|
||||
min-width: 0;
|
||||
}
|
||||
@@ -203,7 +224,7 @@
|
||||
.commission-dashboard-summary-item > strong {
|
||||
display: block;
|
||||
margin-top: 6px;
|
||||
font-size: 22px;
|
||||
font-size: 23px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -229,7 +250,7 @@
|
||||
justify-content: space-between;
|
||||
gap: 14px;
|
||||
border-bottom: 1px solid var(--dash-line);
|
||||
padding: 15px 0;
|
||||
padding: 19px 0;
|
||||
}
|
||||
|
||||
.commission-dashboard-todo:last-child {
|
||||
@@ -241,9 +262,17 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.commission-dashboard-todo > .ant-btn {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.commission-dashboard-summary-item strong > small {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.commission-dashboard-tag {
|
||||
display: inline-block;
|
||||
border-radius: 4px;
|
||||
border-radius: 8px;
|
||||
padding: 1px 7px;
|
||||
font-size: 11px;
|
||||
line-height: 1.8;
|
||||
@@ -280,7 +309,7 @@
|
||||
.commission-dashboard-button {
|
||||
flex-shrink: 0;
|
||||
border: 1px solid var(--dash-line);
|
||||
border-radius: 4px;
|
||||
border-radius: 8px;
|
||||
padding: 6px 12px;
|
||||
color: var(--text-secondary);
|
||||
background: var(--dash-card);
|
||||
@@ -290,14 +319,19 @@
|
||||
|
||||
.commission-dashboard-button--primary {
|
||||
border-color: var(--dash-primary);
|
||||
color: #fff;
|
||||
color: var(--commission-on-primary);
|
||||
background: var(--dash-primary);
|
||||
}
|
||||
|
||||
.commission-dashboard-button:hover,
|
||||
.commission-dashboard-summary-item:hover,
|
||||
.commission-dashboard-health-item:hover {
|
||||
filter: brightness(0.97);
|
||||
border-color: var(--dash-primary);
|
||||
}
|
||||
|
||||
.commission-dashboard-chart-column:hover .commission-dashboard-chart-bar,
|
||||
.commission-dashboard-chart-column:focus-visible
|
||||
.commission-dashboard-chart-bar {
|
||||
background: var(--commission-primary-hover);
|
||||
}
|
||||
|
||||
.commission-dashboard-health h3 {
|
||||
@@ -306,11 +340,10 @@
|
||||
|
||||
.commission-dashboard-health-item {
|
||||
width: 100%;
|
||||
margin-top: 12px;
|
||||
border: 0;
|
||||
border: 1px solid var(--dash-line);
|
||||
border-radius: 4px;
|
||||
padding: 16px;
|
||||
margin-top: 18px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 8px;
|
||||
padding: 24px;
|
||||
text-align: left;
|
||||
background: var(--dash-soft);
|
||||
}
|
||||
@@ -318,7 +351,7 @@
|
||||
.commission-dashboard-health-item > strong {
|
||||
display: block;
|
||||
margin-top: 8px;
|
||||
font-size: 28px;
|
||||
font-size: 32px;
|
||||
line-height: 1.3;
|
||||
font-weight: 600;
|
||||
}
|
||||
@@ -356,7 +389,7 @@
|
||||
margin: 0 0 20px;
|
||||
border: 1px solid
|
||||
color-mix(in srgb, var(--dash-warning) 24%, var(--dash-line));
|
||||
border-radius: 4px;
|
||||
border-radius: 8px;
|
||||
padding: 10px 12px;
|
||||
background: var(--dash-warning-bg);
|
||||
color: var(--dash-warning);
|
||||
@@ -366,7 +399,30 @@
|
||||
.commission-dashboard-chart {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(6, minmax(0, 1fr));
|
||||
padding-top: 16px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.commission-dashboard-chart-frame {
|
||||
display: grid;
|
||||
grid-template-columns: max-content minmax(0, 1fr);
|
||||
gap: 16px;
|
||||
padding: 16px 16px 0;
|
||||
}
|
||||
|
||||
.commission-dashboard-chart-axis {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
height: 145px;
|
||||
color: var(--dash-muted);
|
||||
font-size: 11px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
text-align: end;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.commission-dashboard-chart-axis > span {
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.commission-dashboard-chart-column {
|
||||
@@ -384,22 +440,17 @@
|
||||
justify-content: center;
|
||||
height: 145px;
|
||||
border-bottom: 1px solid var(--dash-line);
|
||||
background: repeating-linear-gradient(
|
||||
to top,
|
||||
transparent 0,
|
||||
transparent 47px,
|
||||
var(--dash-grid) 47px,
|
||||
var(--dash-grid) 48px
|
||||
);
|
||||
background-image: linear-gradient(var(--dash-grid) 1px, transparent 1px);
|
||||
background-size: 100% 25%;
|
||||
}
|
||||
|
||||
.commission-dashboard-chart-bar {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 42%;
|
||||
max-width: 72px;
|
||||
max-width: 44px;
|
||||
min-height: 1px;
|
||||
border-radius: 2px 2px 0 0;
|
||||
border-radius: 4px 4px 0 0;
|
||||
background: var(--dash-muted-bar);
|
||||
}
|
||||
|
||||
@@ -430,7 +481,7 @@
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
@media (max-width: 1150px) {
|
||||
@media (max-width: 1300px) {
|
||||
.commission-dashboard-todo-summary {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
@@ -444,16 +495,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
@media (max-width: 1000px) {
|
||||
.commission-dashboard-main {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.commission-dashboard-core,
|
||||
.commission-dashboard-support {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.commission-dashboard-health-metrics {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
@@ -461,6 +507,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.commission-dashboard-core,
|
||||
.commission-dashboard-support {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.commission-dashboard-todo-summary {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.commission-dashboard-summary-item {
|
||||
padding: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 520px) {
|
||||
.commission-dashboard-heading,
|
||||
.commission-dashboard-trend-heading {
|
||||
@@ -489,4 +551,9 @@
|
||||
.commission-dashboard-chart-value {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.commission-dashboard-chart-frame {
|
||||
gap: 8px;
|
||||
padding-inline: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
}
|
||||
|
||||
.commission-form-section-grid .commission-form-field {
|
||||
gap: 6px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.commission-form-section-grid .ant-input-number,
|
||||
@@ -45,7 +45,7 @@
|
||||
}
|
||||
|
||||
.commission-partner-sheet {
|
||||
--commission-control-height: 32px;
|
||||
--commission-control-height: 34px;
|
||||
}
|
||||
|
||||
.commission-partner-sheet .ant-drawer-body {
|
||||
@@ -75,19 +75,19 @@
|
||||
.commission-partner-sheet-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 14px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.commission-partner-sheet .ant-radio-group {
|
||||
min-height: 32px;
|
||||
min-height: 34px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.commission-partner-sheet .commission-evidence-upload-button {
|
||||
height: 32px;
|
||||
border-radius: 4px;
|
||||
height: 34px;
|
||||
border-radius: var(--commission-radius);
|
||||
}
|
||||
|
||||
.commission-partner-sheet .commission-evidence-meta {
|
||||
@@ -97,7 +97,7 @@
|
||||
.commission-settlement-context {
|
||||
grid-column: 1 / -1;
|
||||
padding: 12px 16px;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: var(--surface-card);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,15 @@ import {
|
||||
partnerWorkspaceFallback,
|
||||
} from '../PartnerPortal/redirect';
|
||||
import Loading from '../../components/common/ui/Loading';
|
||||
import OrgPageHeader from '../Organization/components/OrgPageHeader';
|
||||
import { useCommissionThemeStyle } from './commissionTheme';
|
||||
import { Table } from '@/components/ui';
|
||||
import {
|
||||
ConsoleAlert as Alert,
|
||||
ConsoleCard as Card,
|
||||
ConsoleModal as Modal,
|
||||
ConsoleTabs as Tabs,
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import {
|
||||
Home,
|
||||
Users,
|
||||
@@ -57,17 +66,12 @@ import PartnerPortal from './PartnerPortal';
|
||||
import { partnerScope, createPartnerTransport } from './partnerScope';
|
||||
import { tierStatus } from './listFilters';
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Card,
|
||||
DatePicker,
|
||||
Dropdown,
|
||||
Empty,
|
||||
Modal,
|
||||
Select,
|
||||
Spin,
|
||||
Table,
|
||||
Tabs,
|
||||
Tag,
|
||||
Typography,
|
||||
} from 'antd';
|
||||
@@ -237,7 +241,7 @@ function PaymentTable({ payments, admin = false }) {
|
||||
rowKey='id'
|
||||
dataSource={payments}
|
||||
pagination={false}
|
||||
locale={{ emptyText: emptyState(t('暂无付款记录')) }}
|
||||
empty={emptyState(t('暂无付款记录'))}
|
||||
columns={[
|
||||
{ title: t('打款日期'), dataIndex: 'paid_at', render: formatDateTime },
|
||||
{ title: t('实付金额'), dataIndex: 'amount_uyuan', render: money },
|
||||
@@ -448,7 +452,7 @@ function AdminStatementDetail({
|
||||
pageSize: 10,
|
||||
}}
|
||||
scroll={{ x: 1800 }}
|
||||
locale={{ emptyText: emptyState(t('暂无计费明细')) }}
|
||||
empty={emptyState(t('暂无计费明细'))}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
@@ -463,7 +467,7 @@ function AdminStatementDetail({
|
||||
rowKey='id'
|
||||
dataSource={operations}
|
||||
pagination={false}
|
||||
locale={{ emptyText: emptyState(t('暂无操作记录')) }}
|
||||
empty={emptyState(t('暂无操作记录'))}
|
||||
columns={[
|
||||
{
|
||||
title: t('操作'),
|
||||
@@ -519,7 +523,7 @@ function AdminStatementDetail({
|
||||
rowKey='id'
|
||||
dataSource={adjustments}
|
||||
pagination={false}
|
||||
locale={{ emptyText: emptyState(t('暂无调整单')) }}
|
||||
empty={emptyState(t('暂无调整单'))}
|
||||
columns={[
|
||||
...AdjustmentColumns(t, money),
|
||||
{ title: t('状态'), dataIndex: 'status', render: tag },
|
||||
@@ -565,6 +569,7 @@ function AdminStatementDetail({
|
||||
);
|
||||
}
|
||||
function AdminPage() {
|
||||
const themeStyle = useCommissionThemeStyle();
|
||||
const [userState] = useContext(UserContext);
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
@@ -1531,7 +1536,10 @@ function AdminPage() {
|
||||
/>
|
||||
);
|
||||
return (
|
||||
<div className='commission-v2 commission-admin-workspace'>
|
||||
<div
|
||||
className='commission-v2 commission-admin-workspace'
|
||||
style={themeStyle}
|
||||
>
|
||||
<div className='commission-admin-main'>
|
||||
<header className='commission-workspace-bar'>
|
||||
<span>
|
||||
@@ -1849,6 +1857,7 @@ export function PartnerWorkspace({ organizationId = null }) {
|
||||
}
|
||||
|
||||
function ScopedPartnerWorkspace({ scope, isCurrent }) {
|
||||
const themeStyle = useCommissionThemeStyle();
|
||||
const [userState] = useContext(UserContext);
|
||||
const { t } = useTranslation();
|
||||
const { status, partnerType, retry } = usePartnerWorkspaceAccess(
|
||||
@@ -1874,11 +1883,13 @@ function ScopedPartnerWorkspace({ scope, isCurrent }) {
|
||||
return <Navigate to={COMPANY_PARTNER_WORKSPACE_PATH} replace />;
|
||||
if (status === 'denied')
|
||||
return scope.enterprise ? (
|
||||
<Alert
|
||||
type='warning'
|
||||
showIcon
|
||||
title={t('当前企业没有可用的分佣访问权限')}
|
||||
/>
|
||||
<div
|
||||
className='uc-page oc-page commission-access-state'
|
||||
style={themeStyle}
|
||||
>
|
||||
<OrgPageHeader title={t('企业分佣')} />
|
||||
<Alert type='warning' title={t('当前企业没有可用的分佣访问权限')} />
|
||||
</div>
|
||||
) : (
|
||||
<Navigate to={partnerWorkspaceFallback(userState?.user?.role)} replace />
|
||||
);
|
||||
@@ -1904,6 +1915,7 @@ function ScopedPartnerWorkspace({ scope, isCurrent }) {
|
||||
return (
|
||||
<div
|
||||
data-partner-scope={scope.key}
|
||||
style={themeStyle}
|
||||
className={
|
||||
scope.enterprise ? 'partner-portal-scope--embedded' : undefined
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ import { API } from '../../helpers';
|
||||
import RemoteIdentitySelect from './RemoteIdentitySelect';
|
||||
import { fetchAllLatestTiers } from './latestTiers';
|
||||
import './formSections.css';
|
||||
import { useCommissionThemeStyle } from './commissionTheme';
|
||||
|
||||
const time = (value) => (value ? new Date(value * 1000).toLocaleString() : '—');
|
||||
export function Field({ label, children, required = false }) {
|
||||
@@ -203,6 +204,7 @@ export function OperationsDialog({
|
||||
onClose,
|
||||
onSaved,
|
||||
}) {
|
||||
const themeStyle = useCommissionThemeStyle();
|
||||
const { t } = useTranslation();
|
||||
const [form, setForm] = useState({});
|
||||
const [error, setError] = useState('');
|
||||
@@ -474,6 +476,7 @@ export function OperationsDialog({
|
||||
};
|
||||
return (
|
||||
<Dialog
|
||||
style={themeStyle}
|
||||
className={partnerProfile ? 'commission-partner-sheet' : modalClassName}
|
||||
width={modalWidth}
|
||||
title={t(title || '详情')}
|
||||
@@ -1201,6 +1204,7 @@ export function SettlementDialog({
|
||||
onClose,
|
||||
onSaved,
|
||||
}) {
|
||||
const themeStyle = useCommissionThemeStyle();
|
||||
const { t } = useTranslation();
|
||||
const [form, setForm] = useState({});
|
||||
const [busy, setBusy] = useState(false);
|
||||
@@ -1298,6 +1302,7 @@ export function SettlementDialog({
|
||||
};
|
||||
return (
|
||||
<Modal
|
||||
style={themeStyle}
|
||||
className='commission-modal commission-modal--form commission-modal--settlement'
|
||||
width={720}
|
||||
title={t(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.partner-portal .commission-v2-sider {
|
||||
width: 220px !important;
|
||||
flex-basis: 220px !important;
|
||||
width: 220px;
|
||||
flex-basis: 220px;
|
||||
}
|
||||
|
||||
/* Organization owns the global header, sidebar and scroll container. */
|
||||
@@ -42,10 +42,23 @@
|
||||
}
|
||||
|
||||
.partner-portal--embedded .commission-v2-content {
|
||||
padding: 24px var(--uc-page-pad-x) var(--uc-page-pad-bottom);
|
||||
padding: var(--uc-page-pad-top) var(--uc-page-pad-x) var(--uc-page-pad-bottom);
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.partner-portal--embedded .commission-workspace-bar[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.partner-portal--embedded .commission-page-header {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.partner-portal--embedded .commission-page-heading {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.partner-portal--embedded .commission-page-header {
|
||||
align-items: flex-end;
|
||||
margin-bottom: 18px;
|
||||
@@ -131,7 +144,7 @@
|
||||
padding: 10px 14px;
|
||||
border: 1px solid
|
||||
color-mix(in srgb, var(--commission-primary) 24%, transparent);
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: var(--commission-primary-soft);
|
||||
color: var(--text-primary);
|
||||
font-size: 13px;
|
||||
@@ -145,8 +158,8 @@
|
||||
.partner-portal-metrics {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
margin-top: 12px;
|
||||
gap: 18px;
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.partner-portal-metrics-three {
|
||||
@@ -158,7 +171,7 @@
|
||||
min-height: 118px;
|
||||
padding: 16px 20px;
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: var(--commission-surface-raised);
|
||||
}
|
||||
|
||||
@@ -249,7 +262,7 @@
|
||||
}
|
||||
|
||||
.partner-portal-chart-bar.is-negative {
|
||||
background: #f76560;
|
||||
background: var(--commission-danger);
|
||||
}
|
||||
|
||||
.partner-portal-chart-label {
|
||||
@@ -309,7 +322,7 @@ button.partner-portal-reminder:hover {
|
||||
flex-shrink: 0;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: var(--commission-primary-soft);
|
||||
color: var(--commission-primary-readable);
|
||||
}
|
||||
@@ -351,7 +364,7 @@ button.partner-portal-reminder:hover {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
white-space: nowrap;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.partner-portal .partner-portal-row-actions .ant-btn-link {
|
||||
@@ -468,8 +481,8 @@ button.partner-portal-reminder:hover {
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.partner-portal .commission-v2-sider {
|
||||
width: 168px !important;
|
||||
flex-basis: 168px !important;
|
||||
width: 168px;
|
||||
flex-basis: 168px;
|
||||
}
|
||||
|
||||
.partner-portal .commission-brand {
|
||||
@@ -503,8 +516,8 @@ button.partner-portal-reminder:hover {
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.partner-portal .commission-v2-sider {
|
||||
width: 100% !important;
|
||||
flex-basis: auto !important;
|
||||
width: 100%;
|
||||
flex-basis: auto;
|
||||
}
|
||||
|
||||
.partner-portal .partner-portal-card.ant-card > .ant-card-body {
|
||||
|
||||
+132
-123
@@ -3,60 +3,17 @@
|
||||
.commission-modal,
|
||||
.commission-profile-drawer,
|
||||
.commission-partner-sheet {
|
||||
/* 新版分佣只消费全局主题 token,主题色和明暗模式由控制台统一驱动。 */
|
||||
--commission-primary: var(--brand-primary);
|
||||
--commission-primary-hover: var(--brand-primary-hover);
|
||||
--commission-primary-soft: var(--brand-primary-soft);
|
||||
/* Links on dark surfaces need a lighter reading color than the brand swatch. */
|
||||
--commission-primary-readable: color-mix(
|
||||
in srgb,
|
||||
var(--commission-primary) 58%,
|
||||
var(--text-primary)
|
||||
);
|
||||
/* White text on the default brand blue is below AA contrast; deepen solid fills. */
|
||||
--commission-primary-solid: color-mix(
|
||||
in srgb,
|
||||
var(--commission-primary) 78%,
|
||||
#000
|
||||
);
|
||||
--commission-success: color-mix(in srgb, #22c55e 78%, var(--text-primary));
|
||||
--commission-success-soft: color-mix(
|
||||
in srgb,
|
||||
#22c55e 12%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--commission-warning: color-mix(in srgb, #f59e0b 82%, var(--text-primary));
|
||||
--commission-warning-soft: color-mix(
|
||||
in srgb,
|
||||
#f59e0b 12%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--commission-danger: color-mix(in srgb, #f56c7a 82%, var(--text-primary));
|
||||
--commission-danger-soft: color-mix(
|
||||
in srgb,
|
||||
#f56c7a 12%,
|
||||
var(--surface-card)
|
||||
);
|
||||
--commission-info: color-mix(in srgb, #22d3ee 78%, var(--text-primary));
|
||||
--commission-info-soft: color-mix(in srgb, #22d3ee 12%, var(--surface-card));
|
||||
--commission-primary-readable: var(--commission-primary);
|
||||
--commission-primary-solid: var(--commission-primary);
|
||||
--text-tertiary: var(--text-secondary);
|
||||
--commission-radius: 4px;
|
||||
--commission-control-height: 32px;
|
||||
--commission-surface-raised: color-mix(
|
||||
in srgb,
|
||||
var(--surface-card) 94%,
|
||||
var(--text-primary)
|
||||
);
|
||||
--commission-surface-toolbar: color-mix(
|
||||
in srgb,
|
||||
var(--surface-card) 86%,
|
||||
var(--surface-bg-base)
|
||||
);
|
||||
--commission-surface-control: color-mix(
|
||||
in srgb,
|
||||
var(--surface-card) 78%,
|
||||
var(--surface-bg-base)
|
||||
);
|
||||
--commission-radius: 8px;
|
||||
--commission-control-height: 34px;
|
||||
--commission-surface-raised: var(--surface-card);
|
||||
--commission-surface-toolbar: var(--surface-card);
|
||||
--commission-surface-control: var(--surface-card);
|
||||
--commission-border-strong: color-mix(
|
||||
in srgb,
|
||||
var(--border-subtle) 78%,
|
||||
@@ -77,9 +34,7 @@
|
||||
transparent
|
||||
);
|
||||
color: var(--text-primary);
|
||||
font-family:
|
||||
-apple-system, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial,
|
||||
sans-serif;
|
||||
font-family: var(--commission-font, inherit);
|
||||
font-size: 14px;
|
||||
line-height: 1.5715;
|
||||
}
|
||||
@@ -175,7 +130,7 @@
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
flex-shrink: 0;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: var(--commission-primary-solid);
|
||||
}
|
||||
.commission-navigation {
|
||||
@@ -195,7 +150,7 @@
|
||||
margin: 2px 0;
|
||||
padding: 0 12px;
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: transparent;
|
||||
color: var(--text-secondary);
|
||||
font: inherit;
|
||||
@@ -225,8 +180,8 @@
|
||||
margin-left: auto;
|
||||
padding: 0 6px;
|
||||
border-radius: 8px;
|
||||
color: #fff;
|
||||
background: #f53f3f;
|
||||
color: var(--commission-on-primary);
|
||||
background: var(--commission-danger);
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
}
|
||||
@@ -248,7 +203,7 @@
|
||||
}
|
||||
.commission-crumb-slash {
|
||||
padding: 0 8px;
|
||||
color: #c9cdd4;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
.commission-workspace-role {
|
||||
padding: 3px 12px;
|
||||
@@ -296,7 +251,7 @@
|
||||
width: 138px;
|
||||
}
|
||||
.commission-card {
|
||||
margin-top: 12px;
|
||||
margin-top: 18px;
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 10px;
|
||||
background: var(--commission-surface-raised);
|
||||
@@ -314,8 +269,7 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.commission-row-actions .commission-more-actions {
|
||||
position: relative;
|
||||
@@ -347,7 +301,7 @@
|
||||
.commission-v2 .commission-status {
|
||||
height: 22px;
|
||||
padding: 0 8px;
|
||||
border-radius: 2px;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -360,52 +314,13 @@
|
||||
font-weight: 500;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.commission-list-tabs {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 4px;
|
||||
overflow-x: auto;
|
||||
border-bottom: 1px solid var(--commission-border-strong);
|
||||
padding: 0 4px;
|
||||
margin-bottom: 12px;
|
||||
.commission-list-tabs .ant-tabs-nav {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.commission-list-tabs > button {
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
padding: 10px 16px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
font: inherit;
|
||||
.commission-tab-count {
|
||||
margin-inline-start: 6px;
|
||||
color: var(--text-secondary);
|
||||
cursor: pointer;
|
||||
}
|
||||
.commission-list-tabs > button:hover {
|
||||
color: var(--commission-primary-readable);
|
||||
}
|
||||
.commission-list-tabs > button.is-active {
|
||||
color: var(--commission-primary-readable);
|
||||
font-weight: 500;
|
||||
}
|
||||
.commission-list-tabs > button.is-active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 12px;
|
||||
right: 12px;
|
||||
height: 2px;
|
||||
background: var(--commission-primary);
|
||||
}
|
||||
.commission-list-tabs > button > span {
|
||||
margin-left: 6px;
|
||||
padding: 0 6px;
|
||||
border-radius: 8px;
|
||||
background: var(--surface-bg-base);
|
||||
color: var(--text-tertiary);
|
||||
font-size: 12px;
|
||||
}
|
||||
.commission-list-tabs > button.is-active > span {
|
||||
color: var(--commission-primary-readable);
|
||||
background: var(--commission-primary-soft);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.commission-filter-bar {
|
||||
display: flex;
|
||||
@@ -414,7 +329,7 @@
|
||||
flex-wrap: wrap;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: var(--commission-surface-toolbar);
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
@@ -485,7 +400,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
gap: 6px;
|
||||
gap: 8px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
}
|
||||
@@ -500,7 +415,7 @@
|
||||
}
|
||||
.commission-tier-targets .ant-select {
|
||||
height: auto;
|
||||
min-height: 32px;
|
||||
min-height: var(--commission-control-height);
|
||||
}
|
||||
.commission-field-hint {
|
||||
color: var(--text-tertiary);
|
||||
@@ -513,7 +428,7 @@
|
||||
gap: 12px;
|
||||
padding: 12px 14px;
|
||||
grid-column: 1/-1;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: var(--surface-bg-base);
|
||||
}
|
||||
.commission-checklist .ant-checkbox-wrapper {
|
||||
@@ -541,8 +456,7 @@
|
||||
}
|
||||
.commission-history-table .ant-table-thead > tr > th {
|
||||
padding: 10px 14px;
|
||||
background: var(--surface-bg-base);
|
||||
color: var(--text-primary);
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
@@ -564,7 +478,7 @@
|
||||
}
|
||||
.commission-exception-content .ant-descriptions {
|
||||
padding: 12px;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: var(--surface-bg-base);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
@@ -586,11 +500,11 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 108px;
|
||||
height: 32px;
|
||||
height: var(--commission-control-height);
|
||||
gap: 7px;
|
||||
padding: 0 14px;
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: var(--surface-card);
|
||||
color: var(--commission-primary-readable);
|
||||
cursor: pointer;
|
||||
@@ -663,7 +577,7 @@
|
||||
gap: 6px;
|
||||
padding: 16px 20px;
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: var(--surface-card);
|
||||
}
|
||||
.statement-summary-values > div:last-child {
|
||||
@@ -685,7 +599,7 @@
|
||||
.commission-detail-tabs {
|
||||
margin-top: 12px;
|
||||
padding: 0 20px 16px;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: var(--surface-card);
|
||||
}
|
||||
.commission-tier-summary {
|
||||
@@ -740,7 +654,7 @@
|
||||
.commission-bill-step.is-current > span,
|
||||
.commission-bill-step.is-done > span {
|
||||
background: var(--commission-primary);
|
||||
color: #fff;
|
||||
color: var(--commission-on-primary);
|
||||
}
|
||||
.commission-bill-step.is-done::after {
|
||||
background: var(--commission-primary);
|
||||
@@ -758,12 +672,12 @@
|
||||
.commission-drawer-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 14px;
|
||||
gap: 8px;
|
||||
}
|
||||
.commission-profile-section {
|
||||
margin-bottom: 12px;
|
||||
padding: 16px 20px;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
background: var(--surface-card);
|
||||
}
|
||||
.commission-profile-section h3 {
|
||||
@@ -889,7 +803,7 @@
|
||||
min-width: 120px;
|
||||
}
|
||||
.commission-list > .ant-card-body {
|
||||
padding: 12px !important;
|
||||
padding: 16px;
|
||||
}
|
||||
.commission-list-tabs > button {
|
||||
padding: 10px 12px;
|
||||
@@ -904,7 +818,7 @@
|
||||
width: 100%;
|
||||
}
|
||||
.commission-modal {
|
||||
max-width: calc(100vw - 24px);
|
||||
max-width: calc(100vw - 32px);
|
||||
}
|
||||
.commission-detail-toolbar {
|
||||
align-items: flex-start;
|
||||
@@ -962,7 +876,7 @@
|
||||
margin: 12px 0 20px;
|
||||
padding: 16px;
|
||||
background: var(--surface-bg-base);
|
||||
border-radius: 4px;
|
||||
border-radius: var(--commission-radius);
|
||||
}
|
||||
.commission-deduction-summary > div {
|
||||
display: flex;
|
||||
@@ -976,3 +890,98 @@
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.commission-card > .ant-card-body {
|
||||
padding: 24px;
|
||||
}
|
||||
.commission-card > .ant-card-body > h5.ant-typography {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.commission-list {
|
||||
min-width: 0;
|
||||
}
|
||||
.commission-list-card.commission-card {
|
||||
margin-top: 18px;
|
||||
}
|
||||
.commission-filter-end {
|
||||
justify-content: flex-end;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.commission-search-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
.commission-search-field .ant-select {
|
||||
width: 100%;
|
||||
}
|
||||
.commission-filter-card .console-search-fields {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
.commission-filter-card .console-search-actions {
|
||||
margin-top: 16px;
|
||||
}
|
||||
.commission-filter-toggle.ant-btn {
|
||||
display: none;
|
||||
}
|
||||
.commission-detail-tabs {
|
||||
margin-top: 18px;
|
||||
padding: 8px 24px 24px;
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 10px;
|
||||
}
|
||||
.commission-access-state {
|
||||
min-width: 0;
|
||||
}
|
||||
.commission-nav-item:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.commission-evidence-upload-button:focus-within {
|
||||
outline: 2px solid var(--commission-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.commission-filter-card .console-search-fields {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
.commission-card > .ant-card-body {
|
||||
padding: 16px;
|
||||
}
|
||||
.commission-filter-toggle.ant-btn {
|
||||
display: inline-flex;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.commission-filter-card:not(.is-open) {
|
||||
display: none;
|
||||
}
|
||||
.commission-page-header {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
.commission-actions {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
.commission-detail-tabs {
|
||||
padding: 8px 16px 16px;
|
||||
}
|
||||
.commission-operation-form {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
.commission-bill-steps {
|
||||
overflow-x: auto;
|
||||
gap: 16px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
.commission-bill-step {
|
||||
min-width: 96px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,12 @@ const OrgLogin = () => {
|
||||
const [pendingLoginName, setPendingLoginName] = useState(loginParam);
|
||||
// 实际生效模式:系统未开直登则始终走企业标识
|
||||
const effectiveMode = directLoginEnabled ? loginMode : 'identifier';
|
||||
// Step1 受控输入的前端必填提示:失焦后仍为空时在框下提示(不改变按钮禁用与提交逻辑)
|
||||
const [blurred, setBlurred] = useState({});
|
||||
const markBlurred = (key) =>
|
||||
setBlurred((prev) => (prev[key] ? prev : { ...prev, [key]: true }));
|
||||
const emptyHelp = (key, empty, message) =>
|
||||
blurred[key] && empty ? { validateStatus: 'error', help: message } : {};
|
||||
|
||||
const logo = getLogo();
|
||||
const systemName = getSystemName();
|
||||
@@ -497,6 +503,11 @@ const OrgLogin = () => {
|
||||
label={t('登录名')}
|
||||
htmlFor='org-direct-login-name'
|
||||
required
|
||||
{...emptyHelp(
|
||||
'login_name',
|
||||
!directForm.login_name.trim(),
|
||||
t('请输入登录名'),
|
||||
)}
|
||||
>
|
||||
<Input
|
||||
id='org-direct-login-name'
|
||||
@@ -505,6 +516,7 @@ const OrgLogin = () => {
|
||||
onChange={(v) =>
|
||||
setDirectForm({ ...directForm, login_name: v })
|
||||
}
|
||||
onBlur={() => markBlurred('login_name')}
|
||||
placeholder={t('请输入登录名')}
|
||||
size='default'
|
||||
autoFocus
|
||||
@@ -514,6 +526,11 @@ const OrgLogin = () => {
|
||||
label={t('密码')}
|
||||
htmlFor='org-direct-password'
|
||||
required
|
||||
{...emptyHelp(
|
||||
'password',
|
||||
!directForm.password,
|
||||
t('请输入密码'),
|
||||
)}
|
||||
>
|
||||
<Input
|
||||
id='org-direct-password'
|
||||
@@ -522,6 +539,7 @@ const OrgLogin = () => {
|
||||
onChange={(v) =>
|
||||
setDirectForm({ ...directForm, password: v })
|
||||
}
|
||||
onBlur={() => markBlurred('password')}
|
||||
mode='password'
|
||||
placeholder={t('请输入密码')}
|
||||
size='default'
|
||||
@@ -563,6 +581,11 @@ const OrgLogin = () => {
|
||||
label={t('企业名称/代码')}
|
||||
htmlFor='org-login-identifier'
|
||||
required
|
||||
{...emptyHelp(
|
||||
'identifier',
|
||||
!identifier.trim(),
|
||||
t('请输入企业名称/代码'),
|
||||
)}
|
||||
>
|
||||
<AutoComplete
|
||||
id='org-login-identifier'
|
||||
@@ -572,6 +595,7 @@ const OrgLogin = () => {
|
||||
onChange={(v) =>
|
||||
setIdentifier(typeof v === 'string' ? v : '')
|
||||
}
|
||||
onBlur={() => markBlurred('identifier')}
|
||||
onSearch={handleSuggestSearch}
|
||||
onSelect={(code) => {
|
||||
setIdentifier(code);
|
||||
@@ -656,7 +680,9 @@ const OrgLogin = () => {
|
||||
size='default'
|
||||
autoFocus={!prefilledLoginName}
|
||||
autoComplete='username'
|
||||
rules={[{ required: true, message: t('请输入登录名') }]}
|
||||
rules={[
|
||||
{ required: true, message: t('请输入企业内登录名') },
|
||||
]}
|
||||
/>
|
||||
<Form.Input
|
||||
field='password'
|
||||
@@ -730,6 +756,7 @@ const OrgLogin = () => {
|
||||
placeholder={t('请输入新密码')}
|
||||
mode='password'
|
||||
size='default'
|
||||
required
|
||||
autoFocus
|
||||
autoComplete='new-password'
|
||||
onKeyDown={handleCapsLock}
|
||||
@@ -747,11 +774,12 @@ const OrgLogin = () => {
|
||||
placeholder={t('请再次输入新密码')}
|
||||
mode='password'
|
||||
size='default'
|
||||
required
|
||||
autoComplete='new-password'
|
||||
onKeyDown={handleCapsLock}
|
||||
onKeyUp={handleCapsLock}
|
||||
validate={(value, values) => {
|
||||
if (!value) return t('请再次输入新密码');
|
||||
if (!value) return t('请输入确认新密码');
|
||||
if (value !== values.new_password)
|
||||
return t('两次输入的新密码不一致');
|
||||
return '';
|
||||
|
||||
@@ -79,6 +79,12 @@ const OrgRegister = () => {
|
||||
};
|
||||
|
||||
const sendCode = async () => {
|
||||
// 先就地校验联系邮箱(必填 + 格式),未通过时由输入框下方提示
|
||||
try {
|
||||
await formApi.current?.validate(['contact_email']);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
const email = (values.contact_email || '').trim();
|
||||
if (!email) {
|
||||
Toast.warning(t('请先输入联系邮箱'));
|
||||
@@ -224,7 +230,7 @@ const OrgRegister = () => {
|
||||
'登录企业空间使用的管理员账号名,注册后不可修改;请勿使用 admin、root 等通用名',
|
||||
)}
|
||||
rules={[
|
||||
{ required: true, message: t('请设置管理员登录名') },
|
||||
{ required: true, message: t('请输入管理员登录名') },
|
||||
{
|
||||
pattern: LOGIN_NAME_PATTERN,
|
||||
message: t(
|
||||
@@ -251,11 +257,18 @@ const OrgRegister = () => {
|
||||
field='contact_email'
|
||||
label={t('联系邮箱')}
|
||||
placeholder={t('用于接收通知')}
|
||||
rules={
|
||||
emailVerifyEnabled
|
||||
rules={[
|
||||
...(emailVerifyEnabled
|
||||
? [{ required: true, message: t('请输入联系邮箱') }]
|
||||
: []
|
||||
}
|
||||
: []),
|
||||
// 格式校验:选填时为空不报错,有值时需为合法邮箱
|
||||
{
|
||||
type: 'email',
|
||||
transform: (v) => v?.trim(),
|
||||
message: t('邮箱格式不正确'),
|
||||
},
|
||||
]}
|
||||
trigger='blur'
|
||||
suffix={
|
||||
emailVerifyEnabled ? (
|
||||
<Button
|
||||
@@ -276,7 +289,7 @@ const OrgRegister = () => {
|
||||
field='verify_code'
|
||||
label={t('邮箱验证码')}
|
||||
placeholder={t('请输入验证码')}
|
||||
rules={[{ required: true, message: t('请输入验证码') }]}
|
||||
rules={[{ required: true, message: t('请输入邮箱验证码') }]}
|
||||
/>
|
||||
)}
|
||||
<Form.Input
|
||||
|
||||
@@ -46,6 +46,7 @@ const orgPageTitles = {
|
||||
audit: '审计日志',
|
||||
'personal-settings': '个人设置',
|
||||
settings: '企业设置',
|
||||
commission: '企业分佣',
|
||||
};
|
||||
|
||||
// 分组页显示“分组 / 当前页面”,其他页面保留“企业中心 / 当前页面”。
|
||||
@@ -63,6 +64,7 @@ const orgPageGroups = {
|
||||
recharge: '财务与日志',
|
||||
logs: '财务与日志',
|
||||
audit: '财务与日志',
|
||||
commission: '财务与日志',
|
||||
'agent-audit': '财务与日志',
|
||||
'personal-settings': '系统设置',
|
||||
settings: '系统设置',
|
||||
|
||||
@@ -344,9 +344,13 @@ export default function GeneralSettings(props) {
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} sm={12} md={8} lg={8} xl={8}>
|
||||
<Form.Slot label={t('站点额度展示类型及汇率')}>
|
||||
<Form.Slot
|
||||
label={t('站点额度展示类型及汇率')}
|
||||
htmlFor='settings-quota-display-rate'
|
||||
>
|
||||
<InputGroup style={{ width: '100%' }}>
|
||||
<Input
|
||||
id='settings-quota-display-rate'
|
||||
prefix={'1 USD = '}
|
||||
style={{ width: '50%' }}
|
||||
value={combinedRate}
|
||||
@@ -354,6 +358,7 @@ export default function GeneralSettings(props) {
|
||||
disabled={inputs.QuotaDisplayType === 'USD'}
|
||||
/>
|
||||
<Select
|
||||
aria-label={t('站点额度展示类型及汇率')}
|
||||
style={{ width: '50%' }}
|
||||
value={inputs.QuotaDisplayType}
|
||||
onChange={handleFieldChange('QuotaDisplayType')}
|
||||
|
||||
@@ -204,7 +204,7 @@ export default function SettingsOrgUserNavModules(props) {
|
||||
description={t(
|
||||
'仅对 org_only(仅企业资源)模式的员工账号生效。已默认隐藏 C 端入口(密钥/模型超市/用户中心/充值/推广等),开箱即生效;如需放开某项,打开对应开关并保存。',
|
||||
)}
|
||||
style={{ marginBottom: '16px' }}
|
||||
style={{ marginBlock: '16px' }}
|
||||
/>
|
||||
|
||||
<div style={{ fontWeight: 600, marginBottom: '12px' }}>
|
||||
|
||||
@@ -119,7 +119,7 @@ const SettingsPaymentAlipay = ({ options, refresh }) => {
|
||||
|
||||
<Form
|
||||
labelPosition='left'
|
||||
labelAlign='right'
|
||||
labelAlign='end'
|
||||
labelWidth={180}
|
||||
onSubmit={onSubmit}
|
||||
initValues={{
|
||||
|
||||
@@ -145,7 +145,7 @@ const SettingsPaymentWechat = ({ options, refresh }) => {
|
||||
|
||||
<Form
|
||||
labelPosition='left'
|
||||
labelAlign='right'
|
||||
labelAlign='end'
|
||||
labelWidth={180}
|
||||
onSubmit={onSubmit}
|
||||
initValues={{
|
||||
|
||||
@@ -486,6 +486,7 @@ export default function ModelSettingsVisualEditor(props) {
|
||||
</Checkbox>
|
||||
</Space>
|
||||
<Table
|
||||
rowKey='name'
|
||||
columns={columns}
|
||||
dataSource={pagedData}
|
||||
pagination={{
|
||||
|
||||
@@ -860,11 +860,14 @@ export default function SettingsWeyAi() {
|
||||
return (
|
||||
<Card>
|
||||
<Form.Section
|
||||
component='form'
|
||||
onSubmit={(event) => event.preventDefault()}
|
||||
autoComplete='off'
|
||||
text={t('WeyAi')}
|
||||
extraText={t('WeyAi 桌面端与网页端的账号接入配置,仅超级管理员可见')}
|
||||
>
|
||||
{/* 保存期间也盖住表单:三批串行提交加回读有一两秒,这期间的输入会被
|
||||
成功后的回读冲掉 */}
|
||||
成功后的回读冲掉 */}
|
||||
<Spin spinning={loading || saving}>
|
||||
<div className='weyai-settings flex flex-col gap-4'>
|
||||
{groupLoadFailed && (
|
||||
@@ -917,6 +920,7 @@ export default function SettingsWeyAi() {
|
||||
<Text className='block mb-1'>{t('网页端客户端密钥')}</Text>
|
||||
<Input
|
||||
mode='password'
|
||||
autoComplete='new-password'
|
||||
value={secretInput}
|
||||
onChange={setSecretInput}
|
||||
aria-label={t('网页端客户端密钥')}
|
||||
@@ -979,6 +983,7 @@ export default function SettingsWeyAi() {
|
||||
<Text className='block mb-1'>{t('公网访问客户端密钥')}</Text>
|
||||
<Input
|
||||
mode='password'
|
||||
autoComplete='new-password'
|
||||
value={remoteSecretInput}
|
||||
onChange={setRemoteSecretInput}
|
||||
aria-label={t('公网访问客户端密钥')}
|
||||
@@ -1052,15 +1057,15 @@ export default function SettingsWeyAi() {
|
||||
{t('黑名单优先于开放范围;收回权限只禁止访问,不删除数据')}
|
||||
</Text>
|
||||
{/* 后端只在登录、密钥刷新、密钥轮换时重算开放范围,普通请求
|
||||
走 60 秒的账号状态缓存但不重算范围,已登录会话要等访问
|
||||
密钥到期(2 小时)才被挡下。不写出来,管理员会以为收紧立刻生效 */}
|
||||
走 60 秒的账号状态缓存但不重算范围,已登录会话要等访问
|
||||
密钥到期(2 小时)才被挡下。不写出来,管理员会以为收紧立刻生效 */}
|
||||
<Text type='tertiary' size='small' className='block'>
|
||||
{t(
|
||||
'收紧范围或加入黑名单后,已登录的网页端会话最长到访问密钥到期(2 小时)或重新登录时才会重新校验',
|
||||
)}
|
||||
</Text>
|
||||
{/* 开放范围与黑名单只管网页端登录;登录时下发的 WeyAi 密钥是普通
|
||||
密钥,没有失效时点。管理员若靠黑名单止损会误以为用量已停 */}
|
||||
密钥,没有失效时点。管理员若靠黑名单止损会误以为用量已停 */}
|
||||
<Text type='tertiary' size='small' className='block'>
|
||||
{t(
|
||||
'已下发的 WeyAi 密钥不受开放范围和黑名单影响,仍可直接调用模型;要停用请到密钥管理或企业密钥页禁用该密钥,或禁用该用户。桌面端登录不受开放范围限制',
|
||||
@@ -1098,8 +1103,8 @@ export default function SettingsWeyAi() {
|
||||
placeholder={t('选择用户分组')}
|
||||
/>
|
||||
{/* 企业托管账号的用户分组一律是 default,与普通注册用户相同:
|
||||
这一项若对企业范围也生效,选了 default 就等于放开所有企业,
|
||||
企业卡的名单形同虚设。后端只在个人范围匹配它 */}
|
||||
这一项若对企业范围也生效,选了 default 就等于放开所有企业,
|
||||
企业卡的名单形同虚设。后端只在个人范围匹配它 */}
|
||||
<Text type='tertiary' size='small'>
|
||||
{t(
|
||||
'按用户所在分组判断,只对个人范围登录生效;以企业范围登录时不看这一项',
|
||||
@@ -1107,8 +1112,8 @@ export default function SettingsWeyAi() {
|
||||
</Text>
|
||||
</div>
|
||||
{/* ID 输入框开 addOnBlur:Semi TagInput 默认只在回车时把输入
|
||||
提交成标签,管理员输完直接点「保存」会先失焦,没提交的输入
|
||||
被丢掉,看起来就是"配置不生效、刷新后也不回显"。 */}
|
||||
提交成标签,管理员输完直接点「保存」会先失焦,没提交的输入
|
||||
被丢掉,看起来就是"配置不生效、刷新后也不回显"。 */}
|
||||
<div className='mb-4'>
|
||||
<Text className='block mb-1'>{t('开放用户 ID')}</Text>
|
||||
<TagInput
|
||||
@@ -1184,7 +1189,7 @@ export default function SettingsWeyAi() {
|
||||
)}
|
||||
</Text>
|
||||
{/* 自助注册(免激活时)出来的企业可用分组就是自助注册默认分组,
|
||||
把它选进来等于把"指定范围"变成人人可自助获得 */}
|
||||
把它选进来等于把"指定范围"变成人人可自助获得 */}
|
||||
<Text type='tertiary' size='small' className='block'>
|
||||
{t(
|
||||
'若包含企业自助注册的默认分组,自助注册且已激活的企业也会一并开放',
|
||||
|
||||
@@ -237,6 +237,9 @@ const SettingsWeyAiContentStorage = () => {
|
||||
return (
|
||||
<Card>
|
||||
<Form.Section
|
||||
component='form'
|
||||
onSubmit={(event) => event.preventDefault()}
|
||||
autoComplete='off'
|
||||
text={t('内容存储')}
|
||||
extraText={t(
|
||||
'WeyAi 展示内容(作品视频、封面、模板包)专用的腾讯云 COS 存储桶,和系统 COS 桶分开;没有配置时内容功能不可用,不会改用系统桶',
|
||||
@@ -305,6 +308,7 @@ const SettingsWeyAiContentStorage = () => {
|
||||
<Text className='block mb-1'>SecretKey</Text>
|
||||
<Input
|
||||
mode='password'
|
||||
autoComplete='new-password'
|
||||
value={secretKeyInput}
|
||||
onChange={setSecretKeyInput}
|
||||
aria-label='SecretKey'
|
||||
|
||||
@@ -75,6 +75,7 @@ const SkillPlatform = () => {
|
||||
const [total, setTotal] = useState(0);
|
||||
const pageSize = 50;
|
||||
const [selected, setSelected] = useState(null);
|
||||
const [detailTab, setDetailTab] = useState('review');
|
||||
const [detail, setDetail] = useState(null);
|
||||
const [importVisible, setImportVisible] = useState(false);
|
||||
const [importing, setImporting] = useState(false);
|
||||
@@ -269,6 +270,7 @@ const SkillPlatform = () => {
|
||||
|
||||
const loadDetail = useCallback(
|
||||
async (skill) => {
|
||||
setDetailTab('review');
|
||||
setSelected(skill);
|
||||
try {
|
||||
const response = await API.get(
|
||||
@@ -868,11 +870,81 @@ const SkillPlatform = () => {
|
||||
|
||||
<SkillDetailSideSheet
|
||||
visible={!!selected}
|
||||
className='skill-platform-review-drawer'
|
||||
onCancel={() => {
|
||||
setSelected(null);
|
||||
setDetail(null);
|
||||
}}
|
||||
title={detail?.definition?.canonical_id || t('Skill 详情')}
|
||||
footer={
|
||||
detail && currentVersion && detailTab === 'review' ? (
|
||||
<div className='skill-review-actions'>
|
||||
<Button
|
||||
onClick={() =>
|
||||
execute(
|
||||
`/api/skill-platform/versions/${currentVersion.id}/rescan`,
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('重新扫描')}
|
||||
</Button>
|
||||
<Button onClick={openModelTest}>{t('模型实测')}</Button>
|
||||
{currentVersion.reviews?.[0]?.status === 'pending' && (
|
||||
<Button
|
||||
onClick={() =>
|
||||
execute(
|
||||
`/api/skill-platform/versions/${currentVersion.id}/review/start`,
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('开始审核')}
|
||||
</Button>
|
||||
)}
|
||||
{currentVersion.reviews?.[0]?.status === 'reviewing' && (
|
||||
<>
|
||||
<Button
|
||||
type='primary'
|
||||
onClick={() => {
|
||||
// 逐项勾选替代一键 hardcode:默认全不勾,
|
||||
// 强制审核人对四个维度逐项作出确认。
|
||||
setReviewChecklist({
|
||||
value: false,
|
||||
localization: false,
|
||||
safety: false,
|
||||
quality: false,
|
||||
});
|
||||
setReviewDecision({ approved: true });
|
||||
}}
|
||||
>
|
||||
{t('审核通过')}
|
||||
</Button>
|
||||
<Button
|
||||
type='danger'
|
||||
onClick={() => {
|
||||
setReviewReason('');
|
||||
setReviewDecision({ approved: false });
|
||||
}}
|
||||
>
|
||||
{t('驳回')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{currentVersion.reviews?.[0]?.status === 'approved' && (
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
onClick={() =>
|
||||
execute(
|
||||
`/api/skill-platform/versions/${currentVersion.id}/publish`,
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('发布此版本')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
) : null
|
||||
}
|
||||
>
|
||||
{detail && (
|
||||
<div className='skill-platform-detail'>
|
||||
@@ -900,7 +972,7 @@ const SkillPlatform = () => {
|
||||
{t('紧急停用')}
|
||||
</Button>
|
||||
</div>
|
||||
<Tabs type='line'>
|
||||
<Tabs type='line' activeKey={detailTab} onChange={setDetailTab}>
|
||||
<TabPane tab={t('审核工作台')} itemKey='review'>
|
||||
{currentVersion && (
|
||||
<div className='skill-review-workbench'>
|
||||
@@ -926,71 +998,6 @@ const SkillPlatform = () => {
|
||||
/>
|
||||
</section>
|
||||
<pre>{currentVersion.body}</pre>
|
||||
<div className='skill-review-actions'>
|
||||
<Button
|
||||
onClick={() =>
|
||||
execute(
|
||||
`/api/skill-platform/versions/${currentVersion.id}/rescan`,
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('重新扫描')}
|
||||
</Button>
|
||||
<Button onClick={openModelTest}>{t('模型实测')}</Button>
|
||||
{currentVersion.reviews?.[0]?.status === 'pending' && (
|
||||
<Button
|
||||
onClick={() =>
|
||||
execute(
|
||||
`/api/skill-platform/versions/${currentVersion.id}/review/start`,
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('开始审核')}
|
||||
</Button>
|
||||
)}
|
||||
{currentVersion.reviews?.[0]?.status === 'reviewing' && (
|
||||
<>
|
||||
<Button
|
||||
type='primary'
|
||||
onClick={() => {
|
||||
// 逐项勾选替代一键 hardcode:默认全不勾,
|
||||
// 强制审核人对四个维度逐项作出确认。
|
||||
setReviewChecklist({
|
||||
value: false,
|
||||
localization: false,
|
||||
safety: false,
|
||||
quality: false,
|
||||
});
|
||||
setReviewDecision({ approved: true });
|
||||
}}
|
||||
>
|
||||
{t('审核通过')}
|
||||
</Button>
|
||||
<Button
|
||||
type='danger'
|
||||
onClick={() => {
|
||||
setReviewReason('');
|
||||
setReviewDecision({ approved: false });
|
||||
}}
|
||||
>
|
||||
{t('驳回')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{currentVersion.reviews?.[0]?.status === 'approved' && (
|
||||
<Button
|
||||
theme='solid'
|
||||
type='primary'
|
||||
onClick={() =>
|
||||
execute(
|
||||
`/api/skill-platform/versions/${currentVersion.id}/publish`,
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('发布此版本')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</TabPane>
|
||||
|
||||
@@ -169,8 +169,8 @@
|
||||
}
|
||||
|
||||
.skill-review-workbench pre {
|
||||
max-height: 440px;
|
||||
overflow: auto;
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
padding: 16px;
|
||||
border-radius: 12px;
|
||||
background: var(--ui-color-fill-0);
|
||||
@@ -178,6 +178,15 @@
|
||||
font-family: 'IBM Plex Mono', 'Cascadia Code', monospace;
|
||||
}
|
||||
|
||||
.skill-review-actions {
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.skill-platform-review-drawer .ant-drawer-body {
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.skill-derive-grid {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import React, { useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
ConsoleCard,
|
||||
ConsoleAlert,
|
||||
ConsoleTabs,
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import ProfileTable from '../../components/smart-router/ProfileTable';
|
||||
@@ -68,15 +69,12 @@ const SmartRouterPage = () => {
|
||||
|
||||
return (
|
||||
<div className='smart-router-page'>
|
||||
<div className='smart-router-hero'>
|
||||
<div className='smart-router-eyebrow'>{t('Smart Router')}</div>
|
||||
<h1>{t('智能路由')}</h1>
|
||||
<p>
|
||||
{t(
|
||||
'一个虚拟模型名背后挂多个候选模型,按请求自动选择合适的模型。调用时把模型名写成 router/短名 即可。',
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
<ConsoleAlert
|
||||
className='smart-router-intro'
|
||||
title={t(
|
||||
'一个虚拟模型名背后挂多个候选模型,按请求自动选择合适的模型。调用时把模型名写成 router/短名 即可。',
|
||||
)}
|
||||
/>
|
||||
<ConsoleCard className='smart-router-tabs-card'>
|
||||
<ConsoleTabs
|
||||
activeKey={activeKey}
|
||||
|
||||
@@ -231,9 +231,6 @@ html.dark .usage-record-consume-card {
|
||||
.usage-logs-table.usage-record-table .usage-record-time span {
|
||||
color: var(--ur-time-date);
|
||||
}
|
||||
.usage-logs-table.usage-record-table .usage-record-use-time em {
|
||||
color: var(--ur-consume-first-time);
|
||||
}
|
||||
.usage-logs-table.usage-record-table .ant-tag {
|
||||
padding: 0 7px;
|
||||
border-radius: 6px;
|
||||
@@ -247,9 +244,12 @@ html.dark .usage-record-consume-card {
|
||||
color: var(--ur-text);
|
||||
}
|
||||
.usage-logs-table.usage-record-table .usage-record-use-time .ant-tag {
|
||||
margin-inline-end: 0;
|
||||
padding: 0 6px;
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
font-variant-numeric: tabular-nums;
|
||||
line-height: 22px;
|
||||
}
|
||||
.usage-logs-table.usage-record-table .usage-record-cost {
|
||||
color: var(--ur-cost);
|
||||
@@ -309,13 +309,9 @@ html.dark .usage-record-consume-card {
|
||||
.usage-record-use-time {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
gap: 6px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.usage-record-use-time em {
|
||||
color: var(--ur-time-date);
|
||||
font-style: normal;
|
||||
}
|
||||
.usage-record-cost {
|
||||
color: var(--ur-cost);
|
||||
font-weight: 600;
|
||||
|
||||
+43
-22
@@ -365,41 +365,51 @@ body[data-ui-scope='admin'] .auth-layout-header header {
|
||||
transform: none;
|
||||
transition: none;
|
||||
}
|
||||
/* 字段节奏统一 24px:与必填字段预留的一行报错高度一致,报错出现时布局不跳动 */
|
||||
.auth-login-page .ant-form-item {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
/* Zero margin avoids Ant Form's error compensation; control height reserves one error line. */
|
||||
/*
|
||||
* 表单项节奏(必填 / 非必填一致):表单项无下边距,输入框下方固定预留一行报错位,
|
||||
* 报错出现 / 消失时布局不跳动。下边距为 0 同时避开 Ant Form 的报错高度补偿。
|
||||
*/
|
||||
.auth-login-page .ant-form-item,
|
||||
.auth-login-page .auth-login-required-field {
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
.auth-login-page .auth-login-required-field .ant-form-item-control {
|
||||
min-height: calc(var(--auth-control-height) + 24px);
|
||||
.auth-login-page .ant-form-item .ant-form-item-control {
|
||||
min-height: calc(var(--auth-control-height) + var(--auth-error-line));
|
||||
}
|
||||
.auth-login-page .ant-form-item-label {
|
||||
padding-bottom: 6px;
|
||||
/* label 与输入框间距 7px(原 10px 统一减少 3px);需高于 antd 竖排表单自带的 8px 内边距优先级 */
|
||||
.auth-login-page .ant-form .ant-form-item .ant-form-item-label,
|
||||
.auth-login-modal .ant-form .ant-form-item .ant-form-item-label {
|
||||
padding: 0 0 7px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.auth-login-page .ant-form-item-label > label {
|
||||
.auth-login-page .ant-form-item-label > label,
|
||||
.auth-login-modal .ant-form-item-label > label {
|
||||
height: auto;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
/* 报错与补充说明:12px,紧贴输入框,不额外占下边距 */
|
||||
.auth-login-page .ant-form-item-explain,
|
||||
.auth-login-page .ant-form-item-extra,
|
||||
.auth-login-modal .ant-form-item-explain,
|
||||
.auth-login-modal .ant-form-item-extra {
|
||||
min-height: 0;
|
||||
padding-top: 2px;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
/* 补充说明可能多行并超出预留报错位,与下一项 label 留 4px */
|
||||
.auth-login-page .ant-form-item-extra {
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
.auth-login-fields {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
.auth-login-fields .ant-form-item {
|
||||
/* 与 gap 12px 叠加后字段节奏同为 24px,和其他认证表单一致 */
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.auth-login-page .auth-login-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding-top: 4px;
|
||||
/* 字段后的按钮直接落在预留报错位之下;按钮之间 8px */
|
||||
.auth-login-fields > .ant-btn + .ant-btn {
|
||||
margin-top: 8px;
|
||||
}
|
||||
.auth-login-page .auth-login-forgot {
|
||||
height: auto;
|
||||
@@ -441,6 +451,17 @@ body[data-ui-scope='admin'] .auth-layout-header header {
|
||||
.auth-login-page,
|
||||
.auth-login-modal {
|
||||
--auth-control-height: 36px;
|
||||
--auth-error-line: 22px;
|
||||
}
|
||||
.auth-login-page .auth-login-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
/* 协议勾选行与其后的主按钮 */
|
||||
.auth-login-page .auth-login-agree-row {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.auth-login-page .login-card-glow,
|
||||
.auth-login-page .login-card-halo,
|
||||
@@ -531,7 +552,7 @@ body[data-ui-scope='admin'] .auth-layout-header header {
|
||||
background: var(--ui-color-border-light);
|
||||
}
|
||||
.auth-login-fields .auth-divider {
|
||||
margin-block: 4px 0;
|
||||
margin-block: 16px 4px;
|
||||
}
|
||||
.auth-login-page .auth-login-agreement {
|
||||
margin-top: 16px;
|
||||
|
||||
Reference in New Issue
Block a user