merge: 同步 origin/ui-optimization(d224d5b6),保留 weiyuan 功能与 Semi 迁移
- 冲突以 weiyuan 功能(小程序登录、i18n 文案)为准,并保留远端 lint 重构与依赖收敛 - 删除 weiyuan 已移除、远端仅做 lint 修正的 3 个图片相关文件 - 适配远端零警告 ESLint:Monitoring/Subscription 改用 useEffectEvent,EditChannelModal 注明 t 依赖 - effect-events 单测补充 react-i18next mock - 对合并后仍不符合 Prettier 的文件做纯格式化
This commit is contained in:
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import { API, getSystemName, showError } from '../../helpers';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
@@ -55,9 +56,10 @@ const About = () => {
|
||||
setAboutLoaded(true);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
displayAbout().then();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
const emptyStyle = {
|
||||
padding: '24px',
|
||||
|
||||
@@ -99,7 +99,7 @@ const AdminInvoice = () => {
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [page, pageSize, searchKeyword, statusFilter]);
|
||||
}, [page, pageSize, searchKeyword, statusFilter, t]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchInvoices();
|
||||
|
||||
@@ -144,12 +144,12 @@ const AdminOrder = () => {
|
||||
dateRange,
|
||||
appliedMinMoney,
|
||||
appliedMaxMoney,
|
||||
queryVersion,
|
||||
t,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchOrders();
|
||||
}, [fetchOrders]);
|
||||
}, [fetchOrders, queryVersion]);
|
||||
|
||||
const handleSearch = () => {
|
||||
const trimmedKeyword = keyword.trim();
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import { ConsolePageActions } from '../../components/console/ConsolePageContainer';
|
||||
import React, {
|
||||
useState,
|
||||
@@ -135,7 +136,7 @@ const Analytics = () => {
|
||||
const [banLogsOpen, setBanLogsOpen] = useState(true);
|
||||
const [activeTab, setActiveTab] = useState(readTabFromURL);
|
||||
|
||||
useEffect(() => {
|
||||
const onScopeChange = useEffectEvent(() => {
|
||||
if (!firstVisibleTab) return;
|
||||
if (!isAnalyticsTabVisible(activeTab)) {
|
||||
setActiveTab(firstVisibleTab);
|
||||
@@ -144,7 +145,11 @@ const Analytics = () => {
|
||||
else url.searchParams.set('tab', firstVisibleTab);
|
||||
window.history.replaceState(null, '', url.toString());
|
||||
}
|
||||
}, [activeTab, firstVisibleTab, analyticsConfig]);
|
||||
});
|
||||
useEffect(
|
||||
() => onScopeChange(),
|
||||
[onScopeChange, activeTab, firstVisibleTab, analyticsConfig],
|
||||
);
|
||||
|
||||
// 浏览器前进/后退切到不同 ?tab= 时同步 UI(我们用 replaceState 改 URL,所以正常切换不会
|
||||
// 产生 history 条目;这里主要兜底浏览器返回到带 ?tab= 的旧条目、或扩展直接改 URL 的情况)
|
||||
|
||||
@@ -67,8 +67,7 @@
|
||||
align-items: center;
|
||||
height: 19px;
|
||||
padding: 0 7px;
|
||||
border: 1px solid
|
||||
color-mix(in srgb, var(--ui-color-warning) 40%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--ui-color-warning) 40%, transparent);
|
||||
border-radius: 999px;
|
||||
background: color-mix(in srgb, var(--ui-color-warning) 12%, transparent);
|
||||
color: var(--ui-color-warning);
|
||||
@@ -335,11 +334,7 @@
|
||||
gap: 7px;
|
||||
padding: 13px;
|
||||
border-radius: 14px;
|
||||
background: color-mix(
|
||||
in srgb,
|
||||
var(--brain-sage) 7%,
|
||||
var(--ui-color-fill-0)
|
||||
);
|
||||
background: color-mix(in srgb, var(--brain-sage) 7%, var(--ui-color-fill-0));
|
||||
}
|
||||
|
||||
.brain-project-field label {
|
||||
@@ -401,8 +396,7 @@
|
||||
gap: 15px;
|
||||
margin: 18px 0;
|
||||
padding: 20px;
|
||||
border: 1px solid
|
||||
color-mix(in srgb, var(--ui-color-danger) 40%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--ui-color-danger) 40%, transparent);
|
||||
border-left: 4px solid var(--ui-color-danger);
|
||||
border-radius: 12px;
|
||||
background: color-mix(
|
||||
@@ -439,8 +433,7 @@
|
||||
line-height: 1.55;
|
||||
}
|
||||
.brain-confirm-card details {
|
||||
border: 1px solid
|
||||
color-mix(in srgb, var(--ui-color-danger) 16%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--ui-color-danger) 16%, transparent);
|
||||
border-radius: 10px;
|
||||
background: var(--surface-card);
|
||||
}
|
||||
|
||||
@@ -131,8 +131,8 @@ const IS_MAC =
|
||||
const hasImageTaskType = (dataTransfer) =>
|
||||
Boolean(
|
||||
dataTransfer &&
|
||||
dataTransfer.types &&
|
||||
Array.from(dataTransfer.types).includes('application/x-image-task'),
|
||||
dataTransfer.types &&
|
||||
Array.from(dataTransfer.types).includes('application/x-image-task'),
|
||||
);
|
||||
|
||||
const Section = ({ title, extra, children, className = '' }) => (
|
||||
|
||||
@@ -118,31 +118,31 @@ const VideoModelPanel = ({
|
||||
|
||||
{/* 模型价格 —— 单价为 0(含管理员隐藏价格场景)时不展示,避免误导性的 0.00 */}
|
||||
{Number(modelInfo?.price) > 0 && (
|
||||
<Card
|
||||
title={
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
|
||||
<IconCreditCard />
|
||||
<span>{t('模型价格')}</span>
|
||||
</div>
|
||||
}
|
||||
bodyStyle={{ padding: '12px' }}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
}}
|
||||
<Card
|
||||
title={
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
|
||||
<IconCreditCard />
|
||||
<span>{t('模型价格')}</span>
|
||||
</div>
|
||||
}
|
||||
bodyStyle={{ padding: '12px' }}
|
||||
>
|
||||
<Text type='tertiary'>{t('单价')}</Text>
|
||||
<Text
|
||||
strong
|
||||
style={{ fontSize: '18px', color: 'var(--ui-color-primary)' }}
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
{convertUSDToCurrency(Number(modelInfo?.price || 0), 6)}
|
||||
</Text>
|
||||
</div>
|
||||
</Card>
|
||||
<Text type='tertiary'>{t('单价')}</Text>
|
||||
<Text
|
||||
strong
|
||||
style={{ fontSize: '18px', color: 'var(--ui-color-primary)' }}
|
||||
>
|
||||
{convertUSDToCurrency(Number(modelInfo?.price || 0), 6)}
|
||||
</Text>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -257,7 +257,10 @@ export const ExperienceCenterAuditPanel = () => {
|
||||
{
|
||||
key: (d) => d?.type,
|
||||
value: (d) =>
|
||||
t('{{n}} 次', { n: (d?.value || 0).toLocaleString(), count: d?.value || 0 }),
|
||||
t('{{n}} 次', {
|
||||
n: (d?.value || 0).toLocaleString(),
|
||||
count: d?.value || 0,
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -335,7 +338,10 @@ export const ExperienceCenterAuditPanel = () => {
|
||||
const filename = `experience_center_upload_audit_${new Date().toISOString().slice(0, 10)}.csv`;
|
||||
exportToCsv(cols, recent.items, filename);
|
||||
Toast.success({
|
||||
content: t('已导出 {{n}} 条', { n: recent.items.length, count: recent.items.length }),
|
||||
content: t('已导出 {{n}} 条', {
|
||||
n: recent.items.length,
|
||||
count: recent.items.length,
|
||||
}),
|
||||
duration: 2,
|
||||
});
|
||||
}, [recent.items, t]);
|
||||
|
||||
+16
-12
@@ -17,6 +17,19 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import {
|
||||
MoonshotMono as Moonshot,
|
||||
OpenAIMono as OpenAI,
|
||||
ZhipuColor as Zhipu,
|
||||
ClaudeColor as Claude,
|
||||
GeminiColor as Gemini,
|
||||
WenxinColor as Wenxin,
|
||||
SparkColor as Spark,
|
||||
DeepSeekColor as DeepSeek,
|
||||
QwenColor as Qwen,
|
||||
MidjourneyMono as Midjourney,
|
||||
} from '@/assets/brand-icons/primitives';
|
||||
import React, {
|
||||
useContext,
|
||||
useEffect,
|
||||
@@ -31,16 +44,6 @@ import { useActualTheme } from '../../context/Theme';
|
||||
import { marked } from 'marked';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import Moonshot from '@lobehub/icons/es/Moonshot/components/Mono';
|
||||
import OpenAI from '@lobehub/icons/es/OpenAI/components/Mono';
|
||||
import Zhipu from '@lobehub/icons/es/Zhipu/components/Color';
|
||||
import Claude from '@lobehub/icons/es/Claude/components/Color';
|
||||
import Gemini from '@lobehub/icons/es/Gemini/components/Color';
|
||||
import Wenxin from '@lobehub/icons/es/Wenxin/components/Color';
|
||||
import Spark from '@lobehub/icons/es/Spark/components/Color';
|
||||
import DeepSeek from '@lobehub/icons/es/DeepSeek/components/Color';
|
||||
import Qwen from '@lobehub/icons/es/Qwen/components/Color';
|
||||
import Midjourney from '@lobehub/icons/es/Midjourney/components/Mono';
|
||||
import {
|
||||
Cpu,
|
||||
Server,
|
||||
@@ -246,9 +249,10 @@ const Home = () => {
|
||||
};
|
||||
}, [navigate, homePageContent]);
|
||||
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
displayHomePageContent().then();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
// 核心能力数据 - 全方位 (8 items)
|
||||
const capabilities = [
|
||||
|
||||
@@ -490,9 +490,7 @@ const AdminMonitor = () => {
|
||||
<span style={{ color: 'var(--ui-color-text-1)' }}>
|
||||
{t(item.type)}
|
||||
</span>
|
||||
<span
|
||||
style={{ fontWeight: 600, color: 'var(--ui-color-text-0)' }}
|
||||
>
|
||||
<span style={{ fontWeight: 600, color: 'var(--ui-color-text-0)' }}>
|
||||
{item.count}
|
||||
</span>
|
||||
</div>
|
||||
@@ -543,9 +541,7 @@ const AdminMonitor = () => {
|
||||
<span
|
||||
style={{
|
||||
color:
|
||||
text > 500
|
||||
? 'var(--ui-color-danger)'
|
||||
: 'var(--ui-color-success)',
|
||||
text > 500 ? 'var(--ui-color-danger)' : 'var(--ui-color-success)',
|
||||
}}
|
||||
>
|
||||
{text}
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import {
|
||||
Layout,
|
||||
Tabs,
|
||||
@@ -25,11 +26,7 @@ import {
|
||||
Spin,
|
||||
Toast,
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
IconActivity,
|
||||
IconLineChart,
|
||||
IconPulse,
|
||||
} from '@/components/ui/icons';
|
||||
import { IconActivity, IconLineChart, IconPulse } from '@/components/ui/icons';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API } from '../../helpers';
|
||||
import ChannelMonitorView from './components/ChannelMonitorView';
|
||||
@@ -69,12 +66,13 @@ const Monitoring = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const refreshChannelStatus = useEffectEvent(fetchChannelStatus);
|
||||
useEffect(() => {
|
||||
fetchChannelStatus();
|
||||
refreshChannelStatus();
|
||||
// 每30秒刷新一次
|
||||
const interval = setInterval(fetchChannelStatus, 30000);
|
||||
const interval = setInterval(refreshChannelStatus, 30000);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
}, [refreshChannelStatus]);
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
|
||||
+127
-129
@@ -188,30 +188,28 @@ const OrgRegister = () => {
|
||||
<GlassCard>
|
||||
{/* key 随表单/凭证两态切换,触发与企业登录页一致的步骤过渡动画 */}
|
||||
<div key={result ? 'result' : 'form'} className='org-step-enter'>
|
||||
<AuthCardHeader
|
||||
wrapperClassName='mb-6'
|
||||
logo={logo}
|
||||
title={result ? t('企业注册成功') : t('注册企业')}
|
||||
subtitle={
|
||||
result
|
||||
? t('请妥善保存以下凭证')
|
||||
: t('为你的团队开通企业空间')
|
||||
}
|
||||
/>
|
||||
|
||||
{result ? (
|
||||
<OrgCredentialResult
|
||||
creds={result}
|
||||
onLogin={() =>
|
||||
// 带上企业代码与登录名直达登录第二步,用户只需输入初始密码
|
||||
navigate(
|
||||
`/org/login?org=${encodeURIComponent(result.org_code)}&login=${encodeURIComponent(result.owner_login_name || '')}`,
|
||||
)
|
||||
<AuthCardHeader
|
||||
wrapperClassName='mb-6'
|
||||
logo={logo}
|
||||
title={result ? t('企业注册成功') : t('注册企业')}
|
||||
subtitle={
|
||||
result ? t('请妥善保存以下凭证') : t('为你的团队开通企业空间')
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<style>{`
|
||||
|
||||
{result ? (
|
||||
<OrgCredentialResult
|
||||
creds={result}
|
||||
onLogin={() =>
|
||||
// 带上企业代码与登录名直达登录第二步,用户只需输入初始密码
|
||||
navigate(
|
||||
`/org/login?org=${encodeURIComponent(result.org_code)}&login=${encodeURIComponent(result.owner_login_name || '')}`,
|
||||
)
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<style>{`
|
||||
.org-register-form .ant-form-item {
|
||||
margin-bottom: 14px !important;
|
||||
padding: 0 !important;
|
||||
@@ -220,122 +218,122 @@ const OrgRegister = () => {
|
||||
margin-bottom: 6px !important;
|
||||
}
|
||||
`}</style>
|
||||
<Form
|
||||
className='org-register-form auth-glass-form'
|
||||
getFormApi={(api) => (formApi.current = api)}
|
||||
onValueChange={(v) => setValues(v)}
|
||||
>
|
||||
<Form.Input
|
||||
field='name'
|
||||
size='large'
|
||||
label={t('企业名称')}
|
||||
placeholder={t('请输入企业名称(登录时可用于搜索定位)')}
|
||||
rules={[{ required: true, message: t('请输入企业名称') }]}
|
||||
/>
|
||||
<Form.Input
|
||||
field='owner_login_name'
|
||||
size='large'
|
||||
label={t('管理员登录名')}
|
||||
placeholder={t('请设置管理员登录名,如 zhang.san')}
|
||||
extraText={t(
|
||||
'登录企业空间使用的管理员账号名,注册后不可修改;请勿使用 admin、root 等通用名',
|
||||
)}
|
||||
rules={[
|
||||
{ required: true, message: t('请设置管理员登录名') },
|
||||
{
|
||||
pattern: LOGIN_NAME_PATTERN,
|
||||
message: t(
|
||||
'登录名需为 3-32 位,以字母开头,仅可包含字母、数字、下划线、点或短横线',
|
||||
),
|
||||
},
|
||||
{
|
||||
validator: (rule, value) => !isReservedLoginName(value),
|
||||
message: t('该登录名为系统保留名称,请换一个登录名'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<Form.Input
|
||||
field='owner_display_name'
|
||||
size='large'
|
||||
label={t('管理员显示名')}
|
||||
placeholder={t('选填')}
|
||||
/>
|
||||
<Form.Input
|
||||
field='contact_name'
|
||||
size='large'
|
||||
label={t('联系人')}
|
||||
placeholder={t('选填')}
|
||||
/>
|
||||
<Form.Input
|
||||
field='contact_email'
|
||||
size='large'
|
||||
label={t('联系邮箱')}
|
||||
placeholder={t('用于接收通知')}
|
||||
rules={
|
||||
emailVerifyEnabled
|
||||
? [{ required: true, message: t('请输入联系邮箱') }]
|
||||
: []
|
||||
}
|
||||
suffix={
|
||||
emailVerifyEnabled ? (
|
||||
<Button
|
||||
size='small'
|
||||
onClick={sendCode}
|
||||
loading={codeLoading}
|
||||
disabled={countdown > 0}
|
||||
>
|
||||
{countdown > 0
|
||||
? `${t('重新发送')} (${countdown})`
|
||||
: t('获取验证码')}
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
{emailVerifyEnabled && (
|
||||
<Form
|
||||
className='org-register-form auth-glass-form'
|
||||
getFormApi={(api) => (formApi.current = api)}
|
||||
onValueChange={(v) => setValues(v)}
|
||||
>
|
||||
<Form.Input
|
||||
field='verify_code'
|
||||
field='name'
|
||||
size='large'
|
||||
label={t('邮箱验证码')}
|
||||
placeholder={t('请输入验证码')}
|
||||
rules={[{ required: true, message: t('请输入验证码') }]}
|
||||
label={t('企业名称')}
|
||||
placeholder={t('请输入企业名称(登录时可用于搜索定位)')}
|
||||
rules={[{ required: true, message: t('请输入企业名称') }]}
|
||||
/>
|
||||
)}
|
||||
<Form.Input
|
||||
field='contact_phone'
|
||||
size='large'
|
||||
label={t('联系电话')}
|
||||
placeholder={t('选填')}
|
||||
/>
|
||||
</Form>
|
||||
<Form.Input
|
||||
field='owner_login_name'
|
||||
size='large'
|
||||
label={t('管理员登录名')}
|
||||
placeholder={t('请设置管理员登录名,如 zhang.san')}
|
||||
extraText={t(
|
||||
'登录企业空间使用的管理员账号名,注册后不可修改;请勿使用 admin、root 等通用名',
|
||||
)}
|
||||
rules={[
|
||||
{ required: true, message: t('请设置管理员登录名') },
|
||||
{
|
||||
pattern: LOGIN_NAME_PATTERN,
|
||||
message: t(
|
||||
'登录名需为 3-32 位,以字母开头,仅可包含字母、数字、下划线、点或短横线',
|
||||
),
|
||||
},
|
||||
{
|
||||
validator: (rule, value) => !isReservedLoginName(value),
|
||||
message: t('该登录名为系统保留名称,请换一个登录名'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<Form.Input
|
||||
field='owner_display_name'
|
||||
size='large'
|
||||
label={t('管理员显示名')}
|
||||
placeholder={t('选填')}
|
||||
/>
|
||||
<Form.Input
|
||||
field='contact_name'
|
||||
size='large'
|
||||
label={t('联系人')}
|
||||
placeholder={t('选填')}
|
||||
/>
|
||||
<Form.Input
|
||||
field='contact_email'
|
||||
size='large'
|
||||
label={t('联系邮箱')}
|
||||
placeholder={t('用于接收通知')}
|
||||
rules={
|
||||
emailVerifyEnabled
|
||||
? [{ required: true, message: t('请输入联系邮箱') }]
|
||||
: []
|
||||
}
|
||||
suffix={
|
||||
emailVerifyEnabled ? (
|
||||
<Button
|
||||
size='small'
|
||||
onClick={sendCode}
|
||||
loading={codeLoading}
|
||||
disabled={countdown > 0}
|
||||
>
|
||||
{countdown > 0
|
||||
? `${t('重新发送')} (${countdown})`
|
||||
: t('获取验证码')}
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
{emailVerifyEnabled && (
|
||||
<Form.Input
|
||||
field='verify_code'
|
||||
size='large'
|
||||
label={t('邮箱验证码')}
|
||||
placeholder={t('请输入验证码')}
|
||||
rules={[{ required: true, message: t('请输入验证码') }]}
|
||||
/>
|
||||
)}
|
||||
<Form.Input
|
||||
field='contact_phone'
|
||||
size='large'
|
||||
label={t('联系电话')}
|
||||
placeholder={t('选填')}
|
||||
/>
|
||||
</Form>
|
||||
|
||||
<div className='mt-5'>
|
||||
<div className='mt-5'>
|
||||
<Button
|
||||
theme='solid'
|
||||
size='large'
|
||||
block
|
||||
loading={submitting}
|
||||
onClick={handleSubmit}
|
||||
>
|
||||
{t('提交注册')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className='mt-4 flex items-center gap-3 text-xs text-gray-400'>
|
||||
<span className='h-px flex-1 bg-gray-200 dark:bg-white/10' />
|
||||
<span>{t('已有企业?')}</span>
|
||||
<span className='h-px flex-1 bg-gray-200 dark:bg-white/10' />
|
||||
</div>
|
||||
<Button
|
||||
theme='solid'
|
||||
theme='borderless'
|
||||
size='large'
|
||||
block
|
||||
loading={submitting}
|
||||
onClick={handleSubmit}
|
||||
className='!text-brand'
|
||||
onClick={() => navigate('/org/login')}
|
||||
>
|
||||
{t('提交注册')}
|
||||
{t('去登录')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className='mt-4 flex items-center gap-3 text-xs text-gray-400'>
|
||||
<span className='h-px flex-1 bg-gray-200 dark:bg-white/10' />
|
||||
<span>{t('已有企业?')}</span>
|
||||
<span className='h-px flex-1 bg-gray-200 dark:bg-white/10' />
|
||||
</div>
|
||||
<Button
|
||||
theme='borderless'
|
||||
size='large'
|
||||
block
|
||||
className='!text-brand'
|
||||
onClick={() => navigate('/org/login')}
|
||||
>
|
||||
{t('去登录')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</GlassCard>
|
||||
);
|
||||
|
||||
@@ -1918,7 +1918,10 @@ const OrgKnowledge = ({ orgId, canAuditContent = false }) => {
|
||||
{searchSummary && !searching && (
|
||||
<div className='knowledge-hit-summary'>
|
||||
<span>
|
||||
{t('命中 {{n}} 条片段', { n: searchHits.length, count: searchHits.length })}
|
||||
{t('命中 {{n}} 条片段', {
|
||||
n: searchHits.length,
|
||||
count: searchHits.length,
|
||||
})}
|
||||
</span>
|
||||
<Tag
|
||||
color={searchSummary.full ? 'amber' : 'grey'}
|
||||
|
||||
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
@@ -153,7 +154,7 @@ const OrgPersonalSettings = ({ orgId }) => {
|
||||
}, [fetchSummary, fetchNotifySetting]);
|
||||
|
||||
// 从 user.setting 初始化头像(与个人中心 PersonalSetting 同款逻辑)
|
||||
useEffect(() => {
|
||||
const onScopeChange = useEffectEvent(() => {
|
||||
if (userState?.user?.setting) {
|
||||
const settings = parseUserSetting(userState.user.setting);
|
||||
setAvatarSettings({
|
||||
@@ -174,7 +175,11 @@ const OrgPersonalSettings = ({ orgId }) => {
|
||||
prev.avatarPreset || getDefaultAvatarPresetId(userState.user),
|
||||
}));
|
||||
}
|
||||
}, [userState?.user?.id, userState?.user?.setting]);
|
||||
});
|
||||
useEffect(
|
||||
() => onScopeChange(),
|
||||
[onScopeChange, userState?.user?.id, userState?.user?.setting],
|
||||
);
|
||||
|
||||
const handleAvatarSettingChange = (type, value) => {
|
||||
setAvatarSettings((prev) => ({ ...prev, [type]: value }));
|
||||
|
||||
@@ -127,7 +127,7 @@ const OrgRecharge = ({ orgId }) => {
|
||||
const [historyLoading, setHistoryLoading] = useState(false);
|
||||
const [refreshHistory, setRefreshHistory] = useState(0);
|
||||
|
||||
const orgHeaders = { 'X-Org-Id': String(orgId) };
|
||||
const orgHeaders = useMemo(() => ({ 'X-Org-Id': String(orgId) }), [orgId]);
|
||||
|
||||
// 获取企业配额
|
||||
const fetchOrgQuota = useCallback(async () => {
|
||||
@@ -141,7 +141,7 @@ const OrgRecharge = ({ orgId }) => {
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
}, [orgId]);
|
||||
}, [orgHeaders]);
|
||||
|
||||
// 获取充值配置
|
||||
const fetchTopUpInfo = useCallback(async () => {
|
||||
@@ -180,7 +180,7 @@ const OrgRecharge = ({ orgId }) => {
|
||||
} finally {
|
||||
setInfoLoading(false);
|
||||
}
|
||||
}, [orgId]);
|
||||
}, [orgHeaders, t]);
|
||||
|
||||
// 获取充值记录
|
||||
const fetchHistory = useCallback(
|
||||
@@ -206,7 +206,7 @@ const OrgRecharge = ({ orgId }) => {
|
||||
setHistoryLoading(false);
|
||||
}
|
||||
},
|
||||
[orgId, historyPageSize],
|
||||
[historyPageSize, orgHeaders],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -646,13 +646,11 @@ const OrgSettings = ({ orgId, orgRole }) => {
|
||||
<AntForm.Item
|
||||
label={t('预警阈值')}
|
||||
extra={
|
||||
Number(alertYuan) >= 0.005 ? (
|
||||
t('当企业剩余额度低于 {{amount}} 时触发预警', {
|
||||
amount: `${getCurrencySymbol()}${Number(alertYuan).toFixed(2)}`,
|
||||
})
|
||||
) : (
|
||||
t('当前为 0:已关闭余额预警')
|
||||
)
|
||||
Number(alertYuan) >= 0.005
|
||||
? t('当企业剩余额度低于 {{amount}} 时触发预警', {
|
||||
amount: `${getCurrencySymbol()}${Number(alertYuan).toFixed(2)}`,
|
||||
})
|
||||
: t('当前为 0:已关闭余额预警')
|
||||
}
|
||||
>
|
||||
<InputNumber
|
||||
|
||||
@@ -23,18 +23,11 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
.dept-flow-cinema {
|
||||
--dfc-glow: color-mix(in srgb, var(--ui-color-primary) 16%, transparent);
|
||||
--dfc-glow-soft: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-primary) 9%,
|
||||
transparent
|
||||
);
|
||||
--dfc-glow-soft: color-mix(in srgb, var(--ui-color-primary) 9%, transparent);
|
||||
/* 不支持 color-mix 的旧内核退化为纯渐变底 */
|
||||
background: linear-gradient(180deg, #f7f9fd 0%, #edf1f8 100%);
|
||||
background: radial-gradient(
|
||||
1100px 520px at 50% -8%,
|
||||
var(--dfc-glow),
|
||||
transparent 62%
|
||||
),
|
||||
background:
|
||||
radial-gradient(1100px 520px at 50% -8%, var(--dfc-glow), transparent 62%),
|
||||
radial-gradient(
|
||||
900px 480px at 88% 110%,
|
||||
var(--dfc-glow-soft),
|
||||
@@ -45,7 +38,8 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
.dept-flow-cinema.dark {
|
||||
background: linear-gradient(180deg, #0b1020 0%, #0d1329 55%, #090e1c 100%);
|
||||
background: radial-gradient(
|
||||
background:
|
||||
radial-gradient(
|
||||
1100px 520px at 50% -8%,
|
||||
color-mix(in srgb, var(--ui-color-primary) 24%, transparent),
|
||||
transparent 62%
|
||||
|
||||
@@ -44,7 +44,10 @@ const OrgPanel = ({
|
||||
}) => {
|
||||
const hasHeader = title || actions;
|
||||
return (
|
||||
<Card className={`org-panel ${className}`} styles={{ body: { padding: 24 } }}>
|
||||
<Card
|
||||
className={`org-panel ${className}`}
|
||||
styles={{ body: { padding: 24 } }}
|
||||
>
|
||||
{hasHeader && (
|
||||
<div className='flex items-start justify-between gap-3 flex-wrap border-b border-[var(--border-subtle)] px-5 py-3.5'>
|
||||
<div className='flex items-center gap-2.5 min-w-0'>
|
||||
|
||||
@@ -82,9 +82,13 @@ const OrgScopedLimitButtons = ({
|
||||
setModelModalVisible(true);
|
||||
setLoadingModels(true);
|
||||
try {
|
||||
const res = await API.get('/api/org/models', { headers: getOrgHeaders(orgId) });
|
||||
const res = await API.get('/api/org/models', {
|
||||
headers: getOrgHeaders(orgId),
|
||||
});
|
||||
if (res.data.success) {
|
||||
setOrgModels((res.data.data || []).map((m) => ({ label: m, value: m })));
|
||||
setOrgModels(
|
||||
(res.data.data || []).map((m) => ({ label: m, value: m })),
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
/* ignore */
|
||||
@@ -96,7 +100,9 @@ const OrgScopedLimitButtons = ({
|
||||
setSelectedGroups(parseGroups(record?.groups));
|
||||
setGroupsModalVisible(true);
|
||||
try {
|
||||
const res = await API.get('/api/org/info', { headers: getOrgHeaders(orgId) });
|
||||
const res = await API.get('/api/org/info', {
|
||||
headers: getOrgHeaders(orgId),
|
||||
});
|
||||
if (res.data.success) {
|
||||
const org = res.data.data?.organization || {};
|
||||
let groups = [];
|
||||
@@ -122,7 +128,10 @@ const OrgScopedLimitButtons = ({
|
||||
try {
|
||||
const res = await API.put(
|
||||
`${apiBase}/${record.id}/models`,
|
||||
{ model_limits_enabled: enabled, model_limits: selectedModels.join(',') },
|
||||
{
|
||||
model_limits_enabled: enabled,
|
||||
model_limits: selectedModels.join(','),
|
||||
},
|
||||
{ headers: getOrgHeaders(orgId) },
|
||||
);
|
||||
if (res.data.success) {
|
||||
@@ -161,7 +170,12 @@ const OrgScopedLimitButtons = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tooltip content={t('设置该{{scope}}成员默认可用的模型范围(与成员/项目/部门限制取交集)', { scope: t(scopeLabel) })}>
|
||||
<Tooltip
|
||||
content={t(
|
||||
'设置该{{scope}}成员默认可用的模型范围(与成员/项目/部门限制取交集)',
|
||||
{ scope: t(scopeLabel) },
|
||||
)}
|
||||
>
|
||||
<Button
|
||||
{...(variant === 'link'
|
||||
? { type: 'link' }
|
||||
@@ -176,7 +190,12 @@ const OrgScopedLimitButtons = ({
|
||||
{t('模型')}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip content={t('设置该{{scope}}成员默认可调用的分组(与成员/项目/部门限制取交集)', { scope: t(scopeLabel) })}>
|
||||
<Tooltip
|
||||
content={t(
|
||||
'设置该{{scope}}成员默认可调用的分组(与成员/项目/部门限制取交集)',
|
||||
{ scope: t(scopeLabel) },
|
||||
)}
|
||||
>
|
||||
<Button
|
||||
{...(variant === 'link'
|
||||
? { type: 'link' }
|
||||
|
||||
@@ -42,9 +42,7 @@ const OrgStateBlock = ({
|
||||
}) => {
|
||||
if (loading) {
|
||||
return (
|
||||
<div
|
||||
className={`flex items-center justify-center py-16 ${className}`}
|
||||
>
|
||||
<div className={`flex items-center justify-center py-16 ${className}`}>
|
||||
<Spin size='large' />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -61,8 +61,7 @@
|
||||
|
||||
.knowledge-beta {
|
||||
padding: 2px 7px;
|
||||
border: 1px solid
|
||||
color-mix(in srgb, var(--ui-color-primary) 30%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--ui-color-primary) 30%, transparent);
|
||||
border-radius: 999px;
|
||||
background: var(--knowledge-mint);
|
||||
font-size: 9px;
|
||||
@@ -616,15 +615,13 @@
|
||||
}
|
||||
|
||||
.knowledge-doc-error.is-failed {
|
||||
border: 1px solid
|
||||
color-mix(in srgb, var(--ui-color-danger) 30%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--ui-color-danger) 30%, transparent);
|
||||
color: var(--ui-color-danger);
|
||||
background: color-mix(in srgb, var(--ui-color-danger) 7%, transparent);
|
||||
}
|
||||
|
||||
.knowledge-doc-error.is-waiting {
|
||||
border: 1px solid
|
||||
color-mix(in srgb, var(--ui-color-warning) 35%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--ui-color-warning) 35%, transparent);
|
||||
color: var(--ui-color-warning);
|
||||
background: color-mix(in srgb, var(--ui-color-warning) 8%, transparent);
|
||||
}
|
||||
@@ -660,8 +657,7 @@
|
||||
}
|
||||
|
||||
.knowledge-reindex-status.is-failed {
|
||||
border: 1px solid
|
||||
color-mix(in srgb, var(--ui-color-danger) 30%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--ui-color-danger) 30%, transparent);
|
||||
color: var(--ui-color-danger);
|
||||
background: color-mix(in srgb, var(--ui-color-danger) 7%, transparent);
|
||||
}
|
||||
@@ -812,8 +808,7 @@
|
||||
|
||||
.knowledge-hit-flag {
|
||||
padding: 1px 8px;
|
||||
border: 1px solid
|
||||
color-mix(in srgb, var(--ui-color-warning) 40%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--ui-color-warning) 40%, transparent);
|
||||
border-radius: 999px;
|
||||
color: var(--ui-color-warning);
|
||||
}
|
||||
@@ -929,8 +924,7 @@
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 11px 12px;
|
||||
border: 1px solid
|
||||
color-mix(in srgb, var(--ui-color-danger) 30%, transparent);
|
||||
border: 1px solid color-mix(in srgb, var(--ui-color-danger) 30%, transparent);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,10 @@ const Playground = ({ isExperienceMode = false }) => {
|
||||
// 用的是那一个;这里把全局应用 status 单独命名 appStatus 以避免遮蔽。
|
||||
const appStatus = statusState?.status;
|
||||
const isMobile = useIsMobile();
|
||||
const styleState = { isMobile, isExperienceMode };
|
||||
const styleState = useMemo(
|
||||
() => ({ isMobile, isExperienceMode }),
|
||||
[isMobile, isExperienceMode],
|
||||
);
|
||||
const [searchParams] = useSearchParams();
|
||||
|
||||
const state = usePlaygroundState({ experienceMode: isExperienceMode });
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import React, { useState, useEffect, useMemo } from 'react';
|
||||
import { Button as AntButton, Empty as AntEmpty, Tag as AntTag } from 'antd';
|
||||
import {
|
||||
@@ -76,9 +77,13 @@ const HistoryPanel = ({ t, refreshTrigger }) => {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const onScopeChange = useEffectEvent(() => {
|
||||
loadTopups(page, pageSize);
|
||||
}, [page, pageSize, keyword, refreshTrigger]);
|
||||
});
|
||||
useEffect(
|
||||
() => onScopeChange(),
|
||||
[onScopeChange, page, pageSize, keyword, refreshTrigger],
|
||||
);
|
||||
|
||||
// 管理员补单
|
||||
const handleAdminComplete = async (tradeNo) => {
|
||||
@@ -120,7 +125,7 @@ const HistoryPanel = ({ t, refreshTrigger }) => {
|
||||
};
|
||||
|
||||
// 表格列定义
|
||||
const columns = useMemo(() => {
|
||||
const columns = (() => {
|
||||
const baseColumns = [
|
||||
{
|
||||
title: t('订单号'),
|
||||
@@ -191,7 +196,7 @@ const HistoryPanel = ({ t, refreshTrigger }) => {
|
||||
}
|
||||
|
||||
return baseColumns;
|
||||
}, [t, userIsAdmin]);
|
||||
})();
|
||||
|
||||
return (
|
||||
<div className='rc-history'>
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import React, { useState, useEffect, useContext } from 'react';
|
||||
import {
|
||||
Card,
|
||||
@@ -55,16 +56,18 @@ const RechargeV2 = () => {
|
||||
const [wechatOrderData, setWechatOrderData] = useState(null);
|
||||
|
||||
// 加载支付配置
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
loadPaymentConfig();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
// 当选择档位时自动计算
|
||||
useEffect(() => {
|
||||
const onScopeChange2 = useEffectEvent(() => {
|
||||
if (selectedAmountOption) {
|
||||
calculateAmount();
|
||||
}
|
||||
}, [selectedAmountOption]);
|
||||
});
|
||||
useEffect(() => onScopeChange2(), [onScopeChange2, selectedAmountOption]);
|
||||
|
||||
const loadPaymentConfig = async () => {
|
||||
try {
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useContext } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { Segmented, Tabs } from 'antd';
|
||||
@@ -708,13 +709,15 @@ const Recharge = ({ embedded = false }) => {
|
||||
|
||||
// 页面加载时始终刷新用户余额,确保显示最新数据
|
||||
// (用户可能在其他页面消费或在其他设备充值,localStorage缓存的余额可能过期)
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
getUserQuota();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
useEffect(() => {
|
||||
const onMount2 = useEffectEvent(() => {
|
||||
getTopupInfo();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount2(), [onMount2]);
|
||||
|
||||
useEffect(() => {
|
||||
const result = getPayPalReturnState(window.location.search);
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import {
|
||||
Form,
|
||||
@@ -45,9 +46,10 @@ const AmountOptionsManager = ({
|
||||
const [editModal, setEditModal] = useState({ visible: false, data: null });
|
||||
const [, setFormApi] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
const onScopeChange = useEffectEvent(() => {
|
||||
loadOptions();
|
||||
}, [apiPath]);
|
||||
});
|
||||
useEffect(() => onScopeChange(), [onScopeChange, apiPath]);
|
||||
|
||||
const loadOptions = async () => {
|
||||
try {
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import {
|
||||
Banner,
|
||||
@@ -154,7 +155,7 @@ export default function SettingsChats(props) {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -175,13 +176,15 @@ export default function SettingsChats(props) {
|
||||
// 同步到可视化配置
|
||||
const configs = jsonToConfigs(currentInputs.Chats || '[]');
|
||||
setChatConfigs(configs);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
|
||||
useEffect(() => {
|
||||
const onScopeChange2 = useEffectEvent(() => {
|
||||
if (editMode === 'visual') {
|
||||
syncJsonToConfigs();
|
||||
}
|
||||
}, [inputs.Chats, editMode]);
|
||||
});
|
||||
useEffect(() => onScopeChange2(), [onScopeChange2, inputs.Chats, editMode]);
|
||||
|
||||
useEffect(() => {
|
||||
if (refForm.current && editMode === 'json') {
|
||||
|
||||
@@ -203,21 +203,23 @@ const SettingsAPIInfo = ({ options, refresh }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const apiInfoOption = options['console_setting.api_info'] ?? options.ApiInfo;
|
||||
useEffect(() => {
|
||||
const apiInfoStr = options['console_setting.api_info'] ?? options.ApiInfo;
|
||||
const apiInfoStr = apiInfoOption;
|
||||
if (apiInfoStr !== undefined) {
|
||||
parseApiInfo(apiInfoStr);
|
||||
}
|
||||
}, [options['console_setting.api_info'], options.ApiInfo]);
|
||||
}, [apiInfoOption]);
|
||||
|
||||
const panelEnabledOption = options['console_setting.api_info_enabled'];
|
||||
useEffect(() => {
|
||||
const enabledStr = options['console_setting.api_info_enabled'];
|
||||
const enabledStr = panelEnabledOption;
|
||||
setPanelEnabled(
|
||||
enabledStr === undefined
|
||||
? true
|
||||
: enabledStr === 'true' || enabledStr === true,
|
||||
);
|
||||
}, [options['console_setting.api_info_enabled']]);
|
||||
}, [panelEnabledOption]);
|
||||
|
||||
const handleToggleEnabled = async (checked) => {
|
||||
const newValue = checked ? 'true' : 'false';
|
||||
|
||||
@@ -333,22 +333,24 @@ const SettingsAnnouncements = ({ options, refresh }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const announcementsOption =
|
||||
options['console_setting.announcements'] ?? options.Announcements;
|
||||
useEffect(() => {
|
||||
const annStr =
|
||||
options['console_setting.announcements'] ?? options.Announcements;
|
||||
const annStr = announcementsOption;
|
||||
if (annStr !== undefined) {
|
||||
parseAnnouncements(annStr);
|
||||
}
|
||||
}, [options['console_setting.announcements'], options.Announcements]);
|
||||
}, [announcementsOption]);
|
||||
|
||||
const panelEnabledOption = options['console_setting.announcements_enabled'];
|
||||
useEffect(() => {
|
||||
const enabledStr = options['console_setting.announcements_enabled'];
|
||||
const enabledStr = panelEnabledOption;
|
||||
setPanelEnabled(
|
||||
enabledStr === undefined
|
||||
? true
|
||||
: enabledStr === 'true' || enabledStr === true,
|
||||
);
|
||||
}, [options['console_setting.announcements_enabled']]);
|
||||
}, [panelEnabledOption]);
|
||||
|
||||
const handleToggleEnabled = async (checked) => {
|
||||
const newValue = checked ? 'true' : 'false';
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import { Button, Col, Form, Row, Spin } from '@/components/ui';
|
||||
import {
|
||||
@@ -80,7 +81,7 @@ export default function DataDashboard(props) {
|
||||
});
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -94,7 +95,8 @@ export default function DataDashboard(props) {
|
||||
'data_export_default_time',
|
||||
String(inputs.DataExportDefaultTime),
|
||||
);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -254,20 +254,22 @@ const SettingsFAQ = ({ options, refresh }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const faqOption = options['console_setting.faq'];
|
||||
useEffect(() => {
|
||||
if (options['console_setting.faq'] !== undefined) {
|
||||
parseFAQ(options['console_setting.faq']);
|
||||
if (faqOption !== undefined) {
|
||||
parseFAQ(faqOption);
|
||||
}
|
||||
}, [options['console_setting.faq']]);
|
||||
}, [faqOption]);
|
||||
|
||||
const panelEnabledOption = options['console_setting.faq_enabled'];
|
||||
useEffect(() => {
|
||||
const enabledStr = options['console_setting.faq_enabled'];
|
||||
const enabledStr = panelEnabledOption;
|
||||
setPanelEnabled(
|
||||
enabledStr === undefined
|
||||
? true
|
||||
: enabledStr === 'true' || enabledStr === true,
|
||||
);
|
||||
}, [options['console_setting.faq_enabled']]);
|
||||
}, [panelEnabledOption]);
|
||||
|
||||
const handleToggleEnabled = async (checked) => {
|
||||
const newValue = checked ? 'true' : 'false';
|
||||
|
||||
@@ -275,21 +275,23 @@ const SettingsUptimeKuma = ({ options, refresh }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const uptimeGroupsOption = options['console_setting.uptime_kuma_groups'];
|
||||
useEffect(() => {
|
||||
const groupsStr = options['console_setting.uptime_kuma_groups'];
|
||||
const groupsStr = uptimeGroupsOption;
|
||||
if (groupsStr !== undefined) {
|
||||
parseUptimeGroups(groupsStr);
|
||||
}
|
||||
}, [options['console_setting.uptime_kuma_groups']]);
|
||||
}, [uptimeGroupsOption]);
|
||||
|
||||
const panelEnabledOption = options['console_setting.uptime_kuma_enabled'];
|
||||
useEffect(() => {
|
||||
const enabledStr = options['console_setting.uptime_kuma_enabled'];
|
||||
const enabledStr = panelEnabledOption;
|
||||
setPanelEnabled(
|
||||
enabledStr === undefined
|
||||
? true
|
||||
: enabledStr === 'true' || enabledStr === true,
|
||||
);
|
||||
}, [options['console_setting.uptime_kuma_enabled']]);
|
||||
}, [panelEnabledOption]);
|
||||
|
||||
const handleToggleEnabled = async (checked) => {
|
||||
const newValue = checked ? 'true' : 'false';
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import { Button, Col, Form, Row, Spin, Tag } from '@/components/ui';
|
||||
import {
|
||||
@@ -77,7 +78,7 @@ export default function SettingsDrawing(props) {
|
||||
});
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -88,7 +89,8 @@ export default function SettingsDrawing(props) {
|
||||
setInputsRow(structuredClone(currentInputs));
|
||||
refForm.current.setValues(currentInputs);
|
||||
localStorage.setItem('mj_notify_enabled', String(inputs.MjNotifyEnabled));
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import { Button, Col, Form, Row, Spin } from '@/components/ui';
|
||||
import {
|
||||
@@ -100,7 +101,7 @@ export default function SettingClaudeModel(props) {
|
||||
});
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -110,7 +111,8 @@ export default function SettingClaudeModel(props) {
|
||||
setInputs(currentInputs);
|
||||
setInputsRow(structuredClone(currentInputs));
|
||||
refForm.current.setValues(currentInputs);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
Button,
|
||||
@@ -85,9 +86,10 @@ const SettingModelCategory = () => {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
loadCategories();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
// 选择一级分类时更新二级分类列表
|
||||
const handleLevel1Select = (value) => {
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef, useMemo } from 'react';
|
||||
import {
|
||||
Button,
|
||||
@@ -172,10 +173,11 @@ export default function SettingsDashboardMonitor() {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
loadConfig();
|
||||
loadGroupChannelTree();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
// 渲染已选择的排除渠道标签
|
||||
const renderSelectedTags = useMemo(() => {
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
Card,
|
||||
@@ -277,10 +278,11 @@ export default function SettingsExperienceCenter({ options, refresh }) {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
loadAllModels();
|
||||
loadAllGroups();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
// 批量保存所有配置
|
||||
const handleSave = async () => {
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import { Button, Col, Form, Row, Spin, Banner } from '@/components/ui';
|
||||
import {
|
||||
@@ -98,7 +99,7 @@ export default function SettingsFallback(props) {
|
||||
});
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -110,7 +111,8 @@ export default function SettingsFallback(props) {
|
||||
setInputs(merged);
|
||||
setInputsRow(structuredClone(merged));
|
||||
refForm.current?.setValues(merged);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
|
||||
return (
|
||||
<Spin spinning={loading}>
|
||||
|
||||
@@ -184,9 +184,7 @@ export default function GeneralSettings(props) {
|
||||
showError(res.data.message || t('COS连接测试失败'));
|
||||
}
|
||||
} catch (error) {
|
||||
showError(
|
||||
t('COS连接测试失败') + ': ' + (error.message || t('未知错误')),
|
||||
);
|
||||
showError(t('COS连接测试失败') + ': ' + (error.message || t('未知错误')));
|
||||
} finally {
|
||||
setTestingCos(false);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useContext } from 'react';
|
||||
import {
|
||||
Button,
|
||||
@@ -265,7 +266,7 @@ export default function SettingsHeaderNavModules(props) {
|
||||
loadAllGroups();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
if (props.options && props.options.HeaderNavModules) {
|
||||
try {
|
||||
const modules = JSON.parse(props.options.HeaderNavModules);
|
||||
@@ -298,7 +299,8 @@ export default function SettingsHeaderNavModules(props) {
|
||||
} else {
|
||||
setActionButtons(defaultButtons);
|
||||
}
|
||||
}, [props.options, t]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options, t]);
|
||||
|
||||
// home/about 在顶栏导航中无对应消费点(导航不渲染这两项链接),
|
||||
// 属于死开关,不再在 UI 展示;保存结构仍保留 key 以兼容旧配置。
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import {
|
||||
Button,
|
||||
@@ -178,7 +179,7 @@ export default function SettingsLog(props) {
|
||||
});
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -191,7 +192,8 @@ export default function SettingsLog(props) {
|
||||
setInputs({ ...inputs, ...currentInputs });
|
||||
setInputsRow(structuredClone(currentInputs));
|
||||
refForm.current.setValues(currentInputs);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
return (
|
||||
<>
|
||||
<Spin spinning={loading}>
|
||||
|
||||
@@ -16,6 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import { Banner, Button, Col, Form, Row, Spin } from '@/components/ui';
|
||||
import { API, showError, showSuccess, showWarning } from '../../../helpers';
|
||||
@@ -79,7 +80,7 @@ export default function SettingsMarquee(props) {
|
||||
});
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = { ...inputs };
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(currentInputs).includes(key)) {
|
||||
@@ -89,7 +90,8 @@ export default function SettingsMarquee(props) {
|
||||
setInputs(currentInputs);
|
||||
setInputsRow(structuredClone(currentInputs));
|
||||
refForm.current?.setValues(currentInputs);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
|
||||
return (
|
||||
<Spin spinning={loading}>
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import { Button, Col, Form, Row, Spin } from '@/components/ui';
|
||||
import {
|
||||
@@ -91,7 +92,7 @@ export default function SettingsMonitoring(props) {
|
||||
});
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -101,7 +102,8 @@ export default function SettingsMonitoring(props) {
|
||||
setInputs(currentInputs);
|
||||
setInputsRow(structuredClone(currentInputs));
|
||||
refForm.current.setValues(currentInputs);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import { Button, Col, Form, Row, Spin } from '@/components/ui';
|
||||
import {
|
||||
@@ -74,7 +75,7 @@ export default function SettingsSensitiveWords(props) {
|
||||
});
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -84,7 +85,8 @@ export default function SettingsSensitiveWords(props) {
|
||||
setInputs(currentInputs);
|
||||
setInputsRow(structuredClone(currentInputs));
|
||||
refForm.current.setValues(currentInputs);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
return (
|
||||
<>
|
||||
<Spin spinning={loading}>
|
||||
|
||||
@@ -274,14 +274,14 @@ export default function SettingsTheme(props) {
|
||||
|
||||
// 当前生效的 token(生效预设 + 自定义覆盖),用于预览
|
||||
// 依赖 presetOverridesState:管理员编辑预设模板后重算
|
||||
const effectiveLight = useMemo(
|
||||
() => ({ ...getEffectivePreset(selectedPreset).light, ...customLight }),
|
||||
[selectedPreset, customLight, presetOverridesState],
|
||||
);
|
||||
const effectiveDark = useMemo(
|
||||
() => ({ ...getEffectivePreset(selectedPreset).dark, ...customDark }),
|
||||
[selectedPreset, customDark, presetOverridesState],
|
||||
);
|
||||
const effectiveLight = {
|
||||
...getEffectivePreset(selectedPreset).light,
|
||||
...customLight,
|
||||
};
|
||||
const effectiveDark = {
|
||||
...getEffectivePreset(selectedPreset).dark,
|
||||
...customDark,
|
||||
};
|
||||
const effectivePalette =
|
||||
colorMode === 'light' ? effectiveLight : effectiveDark;
|
||||
|
||||
@@ -431,10 +431,10 @@ export default function SettingsTheme(props) {
|
||||
|
||||
/* ============ 编辑预设模板 ============ */
|
||||
// 当前编辑预设的浅色 effective(生效预设浅色 ∪ 草稿)
|
||||
const presetEditLight = useMemo(() => {
|
||||
const presetEditLight = (() => {
|
||||
const base = getEffectivePreset(editingPresetKey).light;
|
||||
return { ...base, ...presetDraft };
|
||||
}, [editingPresetKey, presetDraft, presetOverridesState]);
|
||||
})();
|
||||
|
||||
// 切换正在编辑的预设:载入其 effective 浅色作为草稿起点
|
||||
const handleSelectEditingPreset = (key) => {
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
Button,
|
||||
@@ -184,10 +185,11 @@ export default function SettingsMembership() {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
fetchPlans();
|
||||
fetchSetting();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
// 表格列定义
|
||||
const columns = [
|
||||
|
||||
@@ -17,13 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Form,
|
||||
Button,
|
||||
Typography,
|
||||
Space,
|
||||
Divider,
|
||||
} from '@/components/ui';
|
||||
import { Form, Button, Typography, Space, Divider } from '@/components/ui';
|
||||
import { API, showError, showSuccess } from '../../../helpers';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@@ -110,7 +104,9 @@ const SettingsPaymentAlipay = ({ options, refresh }) => {
|
||||
href='https://open.alipay.com'
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
>{t('支付宝开放平台')}</a>{' '}
|
||||
>
|
||||
{t('支付宝开放平台')}
|
||||
</a>{' '}
|
||||
{t('获取相关配置信息。')}
|
||||
</Text>
|
||||
|
||||
@@ -156,7 +152,9 @@ const SettingsPaymentAlipay = ({ options, refresh }) => {
|
||||
placeholder={
|
||||
options.AlipayPrivateKey === '***ALREADY_SET***'
|
||||
? t('已设置(留空不修改,填写新内容则更新)')
|
||||
: t('请粘贴完整的 RSA2 私钥内容(包含 -----BEGIN PRIVATE KEY----- 等)')
|
||||
: t(
|
||||
'请粘贴完整的 RSA2 私钥内容(包含 -----BEGIN PRIVATE KEY----- 等)',
|
||||
)
|
||||
}
|
||||
rows={6}
|
||||
extraText={
|
||||
@@ -240,7 +238,9 @@ const SettingsPaymentAlipay = ({ options, refresh }) => {
|
||||
/>
|
||||
|
||||
<Space style={{ marginTop: 20 }}>
|
||||
<Button type='primary' htmlType='submit' loading={loading}>{t('保存配置')}</Button>
|
||||
<Button type='primary' htmlType='submit' loading={loading}>
|
||||
{t('保存配置')}
|
||||
</Button>
|
||||
</Space>
|
||||
</Form>
|
||||
</>
|
||||
|
||||
@@ -750,7 +750,9 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
operations
|
||||
? t(
|
||||
operations.can_change_config
|
||||
? t('配置切换预检:{{n}} 笔 PayPal pending 订单;可以切换环境或应用配置')
|
||||
? t(
|
||||
'配置切换预检:{{n}} 笔 PayPal pending 订单;可以切换环境或应用配置',
|
||||
)
|
||||
: '配置切换预检:{{n}} 笔 PayPal pending 订单;请先隐藏新订单并完成历史订单排空',
|
||||
{ n: operations.pending_count || 0 },
|
||||
)
|
||||
@@ -951,7 +953,9 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
</Form>
|
||||
<Modal
|
||||
title={
|
||||
forceExpire ? t('确认强制过期 PayPal 订单') : t('确认 PayPal 订单过期')
|
||||
forceExpire
|
||||
? t('确认强制过期 PayPal 订单')
|
||||
: t('确认 PayPal 订单过期')
|
||||
}
|
||||
visible={Boolean(expireOrder)}
|
||||
onCancel={() => setExpireOrder(null)}
|
||||
@@ -968,8 +972,12 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
type={forceExpire ? 'danger' : 'warning'}
|
||||
description={
|
||||
forceExpire
|
||||
? t('强制过期会绕过远端查询失败或仍可支付状态,可能导致 PayPal 后续付款无法入账。已确认完成支付的订单仍会被拒绝。')
|
||||
: t('系统会再次查询 PayPal 远端状态;如果已完成支付,将拒绝过期操作。请确认未付款后再提交。')
|
||||
? t(
|
||||
'强制过期会绕过远端查询失败或仍可支付状态,可能导致 PayPal 后续付款无法入账。已确认完成支付的订单仍会被拒绝。',
|
||||
)
|
||||
: t(
|
||||
'系统会再次查询 PayPal 远端状态;如果已完成支付,将拒绝过期操作。请确认未付款后再提交。',
|
||||
)
|
||||
}
|
||||
/>
|
||||
{forceExpire && (
|
||||
@@ -1022,8 +1030,12 @@ export default function SettingsPaymentGatewayPayPal(props) {
|
||||
type={batchExpire.force ? 'danger' : 'warning'}
|
||||
description={
|
||||
batchExpire.force
|
||||
? t('批量强制过期会绕过远端查询失败或仍可支付状态;已确认完成支付的订单仍会逐笔拒绝。')
|
||||
: t('系统会逐笔查询 PayPal 远端状态,已完成或仍可支付的订单会逐笔失败并返回原因。')
|
||||
? t(
|
||||
'批量强制过期会绕过远端查询失败或仍可支付状态;已确认完成支付的订单仍会逐笔拒绝。',
|
||||
)
|
||||
: t(
|
||||
'系统会逐笔查询 PayPal 远端状态,已完成或仍可支付的订单会逐笔失败并返回原因。',
|
||||
)
|
||||
}
|
||||
/>
|
||||
{batchExpire.force && (
|
||||
|
||||
@@ -172,11 +172,19 @@ export default function SettingsPaymentGateway(props) {
|
||||
href='https://dashboard.stripe.com/developers'
|
||||
target='_blank'
|
||||
rel='noreferrer'
|
||||
>{t('点击此处')}</a>{t('进行设置,最好先在')}<a
|
||||
>
|
||||
{t('点击此处')}
|
||||
</a>
|
||||
{t('进行设置,最好先在')}
|
||||
<a
|
||||
href='https://dashboard.stripe.com/test/developers'
|
||||
target='_blank'
|
||||
rel='noreferrer'
|
||||
>{t('测试环境')}</a>{t('进行测试。')}<br />
|
||||
>
|
||||
{t('测试环境')}
|
||||
</a>
|
||||
{t('进行测试。')}
|
||||
<br />
|
||||
</Text>
|
||||
<Banner
|
||||
type='info'
|
||||
|
||||
@@ -17,13 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Form,
|
||||
Button,
|
||||
Typography,
|
||||
Space,
|
||||
Divider,
|
||||
} from '@/components/ui';
|
||||
import { Form, Button, Typography, Space, Divider } from '@/components/ui';
|
||||
import { API, showError, showSuccess } from '../../../helpers';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@@ -136,7 +130,9 @@ const SettingsPaymentWechat = ({ options, refresh }) => {
|
||||
href='https://pay.weixin.qq.com'
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
>{t('微信支付商户平台')}</a>{' '}
|
||||
>
|
||||
{t('微信支付商户平台')}
|
||||
</a>{' '}
|
||||
{t('获取相关配置信息。')}
|
||||
</Text>
|
||||
|
||||
@@ -227,7 +223,9 @@ const SettingsPaymentWechat = ({ options, refresh }) => {
|
||||
placeholder={
|
||||
options.WechatPrivateKey === '***ALREADY_SET***'
|
||||
? t('已设置(留空不修改,填写新内容则更新)')
|
||||
: t('请粘贴完整的 PEM 格式私钥内容(包含 -----BEGIN PRIVATE KEY----- 等)')
|
||||
: t(
|
||||
'请粘贴完整的 PEM 格式私钥内容(包含 -----BEGIN PRIVATE KEY----- 等)',
|
||||
)
|
||||
}
|
||||
rows={6}
|
||||
extraText={
|
||||
@@ -239,7 +237,9 @@ const SettingsPaymentWechat = ({ options, refresh }) => {
|
||||
|
||||
<Divider margin='12px' />
|
||||
|
||||
<Title heading={6} style={{ marginTop: 16, marginBottom: 8 }}>{t('公钥模式(2024年新商户必选)')}</Title>
|
||||
<Title heading={6} style={{ marginTop: 16, marginBottom: 8 }}>
|
||||
{t('公钥模式(2024年新商户必选)')}
|
||||
</Title>
|
||||
<Text type='tertiary' style={{ display: 'block', marginBottom: 12 }}>
|
||||
{t(
|
||||
'2024年后注册的微信支付商户默认使用公钥模式。如果初始化失败提示"无可用的平台证书",请从商户平台下载微信支付公钥并启用此模式。',
|
||||
@@ -256,7 +256,9 @@ const SettingsPaymentWechat = ({ options, refresh }) => {
|
||||
field='WechatPublicKeyID'
|
||||
label={t('微信支付公钥 ID')}
|
||||
placeholder='PUB_KEY_ID_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
|
||||
extraText={t('从商户平台【API安全】→【微信支付公钥】获取,格式如 PUB_KEY_ID_xxx')}
|
||||
extraText={t(
|
||||
'从商户平台【API安全】→【微信支付公钥】获取,格式如 PUB_KEY_ID_xxx',
|
||||
)}
|
||||
/>
|
||||
|
||||
<Form.TextArea
|
||||
@@ -265,7 +267,9 @@ const SettingsPaymentWechat = ({ options, refresh }) => {
|
||||
placeholder={
|
||||
options.WechatPublicKeyPEM === '***ALREADY_SET***'
|
||||
? t('已设置(留空不修改,填写新内容则更新)')
|
||||
: t('请粘贴完整的微信支付公钥 PEM 内容(包含 -----BEGIN PUBLIC KEY----- 等)')
|
||||
: t(
|
||||
'请粘贴完整的微信支付公钥 PEM 内容(包含 -----BEGIN PUBLIC KEY----- 等)',
|
||||
)
|
||||
}
|
||||
rows={6}
|
||||
extraText={
|
||||
@@ -277,13 +281,21 @@ const SettingsPaymentWechat = ({ options, refresh }) => {
|
||||
|
||||
<Divider margin='12px' />
|
||||
|
||||
<Title heading={6} style={{ marginTop: 16, marginBottom: 8 }}>{t('高级配置:手动平台证书模式(可选)')}</Title>
|
||||
<Text type='tertiary' style={{ display: 'block', marginBottom: 12 }}>{t('默认情况下,SDK 会自动下载微信平台证书,无需手动配置。仅在离线环境或网络受限时启用此选项。')}</Text>
|
||||
<Title heading={6} style={{ marginTop: 16, marginBottom: 8 }}>
|
||||
{t('高级配置:手动平台证书模式(可选)')}
|
||||
</Title>
|
||||
<Text type='tertiary' style={{ display: 'block', marginBottom: 12 }}>
|
||||
{t(
|
||||
'默认情况下,SDK 会自动下载微信平台证书,无需手动配置。仅在离线环境或网络受限时启用此选项。',
|
||||
)}
|
||||
</Text>
|
||||
|
||||
<Form.Switch
|
||||
field='WechatUseManualCert'
|
||||
label={t('启用手动证书模式')}
|
||||
extraText={t('开启后需要手动配置平台证书,关闭则使用自动下载模式(推荐)')}
|
||||
extraText={t(
|
||||
'开启后需要手动配置平台证书,关闭则使用自动下载模式(推荐)',
|
||||
)}
|
||||
/>
|
||||
|
||||
<Form.Input
|
||||
@@ -299,7 +311,9 @@ const SettingsPaymentWechat = ({ options, refresh }) => {
|
||||
placeholder={
|
||||
options.WechatPlatformCertPEM === '***ALREADY_SET***'
|
||||
? t('已设置(留空不修改,填写新内容则更新)')
|
||||
: t('请粘贴完整的平台证书 PEM 内容(包含 -----BEGIN CERTIFICATE----- 等)')
|
||||
: t(
|
||||
'请粘贴完整的平台证书 PEM 内容(包含 -----BEGIN CERTIFICATE----- 等)',
|
||||
)
|
||||
}
|
||||
rows={6}
|
||||
extraText={
|
||||
@@ -348,7 +362,9 @@ const SettingsPaymentWechat = ({ options, refresh }) => {
|
||||
/>
|
||||
|
||||
<Space style={{ marginTop: 20 }}>
|
||||
<Button type='primary' htmlType='submit' loading={loading}>{t('保存配置')}</Button>
|
||||
<Button type='primary' htmlType='submit' loading={loading}>
|
||||
{t('保存配置')}
|
||||
</Button>
|
||||
</Space>
|
||||
</Form>
|
||||
</>
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import { useState, useEffect, useContext } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
@@ -187,7 +188,7 @@ export default function SettingsSidebarModulesUser() {
|
||||
}
|
||||
|
||||
// 统一的配置加载逻辑
|
||||
useEffect(() => {
|
||||
const onScopeChange = useEffectEvent(() => {
|
||||
const loadConfigs = async () => {
|
||||
try {
|
||||
// 获取管理员全局配置
|
||||
@@ -245,13 +246,18 @@ export default function SettingsSidebarModulesUser() {
|
||||
if (!permissionsLoading && hasSidebarSettingsPermission()) {
|
||||
loadConfigs();
|
||||
}
|
||||
}, [
|
||||
statusState,
|
||||
permissionsLoading,
|
||||
hasSidebarSettingsPermission,
|
||||
isSidebarSectionAllowed,
|
||||
isSidebarModuleAllowed,
|
||||
]);
|
||||
});
|
||||
useEffect(
|
||||
() => onScopeChange(),
|
||||
[
|
||||
onScopeChange,
|
||||
statusState,
|
||||
permissionsLoading,
|
||||
hasSidebarSettingsPermission,
|
||||
isSidebarSectionAllowed,
|
||||
isSidebarModuleAllowed,
|
||||
],
|
||||
);
|
||||
|
||||
// 检查功能是否被管理员允许
|
||||
const isAllowedByAdmin = (sectionKey, moduleKey = null) => {
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import { Button, Col, Form, Row, Spin } from '@/components/ui';
|
||||
import {
|
||||
@@ -85,7 +86,7 @@ export default function RequestRateLimit(props) {
|
||||
});
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -95,7 +96,8 @@ export default function RequestRateLimit(props) {
|
||||
setInputs(currentInputs);
|
||||
setInputsRow(structuredClone(currentInputs));
|
||||
refForm.current.setValues(currentInputs);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import { Banner, Button, Col, Form, Row, Spin } from '@/components/ui';
|
||||
import {
|
||||
@@ -87,7 +88,7 @@ export default function GroupRatioSettings(props) {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -97,7 +98,8 @@ export default function GroupRatioSettings(props) {
|
||||
setInputs(currentInputs);
|
||||
setInputsRow(structuredClone(currentInputs));
|
||||
refForm.current.setValues(currentInputs);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
|
||||
return (
|
||||
<Spin spinning={loading}>
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState, useRef } from 'react';
|
||||
import {
|
||||
Button,
|
||||
@@ -121,7 +122,7 @@ export default function ModelRatioSettings(props) {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange = useEffectEvent(() => {
|
||||
const currentInputs = {};
|
||||
for (let key in props.options) {
|
||||
if (Object.keys(inputs).includes(key)) {
|
||||
@@ -131,7 +132,8 @@ export default function ModelRatioSettings(props) {
|
||||
setInputs(currentInputs);
|
||||
setInputsRow(structuredClone(currentInputs));
|
||||
refForm.current.setValues(currentInputs);
|
||||
}, [props.options]);
|
||||
});
|
||||
useEffect(() => onOptionsChange(), [onOptionsChange, props.options]);
|
||||
|
||||
return (
|
||||
<Spin spinning={loading}>
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
Table,
|
||||
@@ -74,12 +75,13 @@ export default function ModelRatioNotSetEditor(props) {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
// 获取所有启用的模型
|
||||
getAllEnabledModels();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
useEffect(() => {
|
||||
const onOptionsChange2 = useEffectEvent(() => {
|
||||
try {
|
||||
const modelPrice = JSON.parse(props.options.ModelPrice || '{}');
|
||||
const modelRatio = JSON.parse(props.options.ModelRatio || '{}');
|
||||
@@ -108,7 +110,11 @@ export default function ModelRatioNotSetEditor(props) {
|
||||
} catch (error) {
|
||||
console.error(t('JSON解析错误:'), error);
|
||||
}
|
||||
}, [props.options, enabledModels]);
|
||||
});
|
||||
useEffect(
|
||||
() => onOptionsChange2(),
|
||||
[onOptionsChange2, props.options, enabledModels],
|
||||
);
|
||||
|
||||
// 首先声明分页相关的工具函数
|
||||
const getPagedData = (data, currentPage, pageSize) => {
|
||||
|
||||
@@ -89,6 +89,7 @@ function ConflictConfirmModal({ t, visible, items, onOk, onCancel }) {
|
||||
}
|
||||
|
||||
export default function UpstreamRatioSync(props) {
|
||||
const { refresh } = props;
|
||||
const { t } = useTranslation();
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -383,7 +384,7 @@ export default function UpstreamRatioSync(props) {
|
||||
|
||||
if (results.every((res) => res.data.success)) {
|
||||
showSuccess(t('同步成功'));
|
||||
props.refresh();
|
||||
refresh();
|
||||
|
||||
setDifferences((prevDifferences) => {
|
||||
const newDifferences = { ...prevDifferences };
|
||||
@@ -413,7 +414,7 @@ export default function UpstreamRatioSync(props) {
|
||||
setLoading(false);
|
||||
}
|
||||
},
|
||||
[resolutions, props.options, props.refresh],
|
||||
[resolutions, refresh, t],
|
||||
);
|
||||
|
||||
const getCurrentPageData = (dataSource) => {
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import { Layout, TabPane, Tabs } from '@/components/ui';
|
||||
import { useNavigate, useLocation } from 'react-router-dom';
|
||||
@@ -299,7 +300,7 @@ const Setting = () => {
|
||||
setTabActiveKey(key);
|
||||
navigate(`?tab=${key}`);
|
||||
};
|
||||
useEffect(() => {
|
||||
const onScopeChange = useEffectEvent(() => {
|
||||
// 非 root 的可见 tab 依赖 status 中的下放配置;status 未加载前不要急于重定向,
|
||||
// 否则深链到「被下放 tab」会因 panes 尚未包含它而被错误重定向走。
|
||||
if (!isRoot() && !statusState?.status) {
|
||||
@@ -319,7 +320,15 @@ const Setting = () => {
|
||||
if (tab !== nextTab) {
|
||||
navigate(`?tab=${nextTab}`, { replace: true });
|
||||
}
|
||||
}, [location.search, statusState?.status?.AdminDelegatedSettingTabs]);
|
||||
});
|
||||
useEffect(
|
||||
() => onScopeChange(),
|
||||
[
|
||||
onScopeChange,
|
||||
location.search,
|
||||
statusState?.status?.AdminDelegatedSettingTabs,
|
||||
],
|
||||
);
|
||||
return (
|
||||
<div
|
||||
className='settings-page app-scrollbar'
|
||||
|
||||
@@ -91,7 +91,9 @@ const SkillCatalog = ({
|
||||
<div className='sm-result-bar'>
|
||||
<div>
|
||||
<h2>{t(scope === 'mine' ? '我的技能' : '全部技能')}</h2>
|
||||
{showTotal ? <span>{t('{{total}} 个技能', { total, count: total })}</span> : null}
|
||||
{showTotal ? (
|
||||
<span>{t('{{total}} 个技能', { total, count: total })}</span>
|
||||
) : null}
|
||||
{selectedTagCount > 0 && (
|
||||
<span className='sm-selected-count'>
|
||||
{t('已选 {{count}} 个标签', { count: selectedTagCount })}
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
否则 hero 标题会被跑马灯压住(与 Channel 页 mt-[60px] 同理)。
|
||||
本类同时服务 /console/skill-platform 与 /console/expert-platform。 */
|
||||
padding: 68px clamp(16px, 3vw, 42px) 56px;
|
||||
background: radial-gradient(
|
||||
background:
|
||||
radial-gradient(
|
||||
circle at 92% 2%,
|
||||
color-mix(in srgb, var(--ui-color-success) 14%, transparent),
|
||||
transparent 29rem
|
||||
|
||||
@@ -108,14 +108,22 @@ const Status = () => {
|
||||
height: 8,
|
||||
borderRadius: '50%',
|
||||
backgroundColor:
|
||||
status === 1 ? 'var(--ui-color-success)' : status === 2 ? 'var(--ui-color-warning)' : 'var(--ui-color-danger)',
|
||||
status === 1
|
||||
? 'var(--ui-color-success)'
|
||||
: status === 2
|
||||
? 'var(--ui-color-warning)'
|
||||
: 'var(--ui-color-danger)',
|
||||
boxShadow: `0 0 4px ${status === 1 ? 'var(--ui-color-success)' : status === 2 ? 'var(--ui-color-warning)' : 'var(--ui-color-danger)'}`,
|
||||
}}
|
||||
/>
|
||||
<Text
|
||||
style={{
|
||||
color:
|
||||
status === 1 ? 'var(--ui-color-success)' : status === 2 ? 'var(--ui-color-warning)' : 'var(--ui-color-danger)',
|
||||
status === 1
|
||||
? 'var(--ui-color-success)'
|
||||
: status === 2
|
||||
? 'var(--ui-color-warning)'
|
||||
: 'var(--ui-color-danger)',
|
||||
}}
|
||||
>
|
||||
{text}
|
||||
@@ -132,9 +140,7 @@ const Status = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<Layout
|
||||
style={{ minHeight: '100vh', background: 'var(--ui-color-bg-0)' }}
|
||||
>
|
||||
<Layout style={{ minHeight: '100vh', background: 'var(--ui-color-bg-0)' }}>
|
||||
<Content style={{ padding: '24px' }}>
|
||||
<div style={{ maxWidth: 1200, margin: '0 auto' }}>
|
||||
<div style={{ marginBottom: 24, textAlign: 'center' }}>
|
||||
|
||||
+145
-147
@@ -24,6 +24,7 @@ import {
|
||||
} from '../../components/console/ConsolePrimitives';
|
||||
import { ConsolePageActions } from '../../components/console/ConsolePageContainer';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
@@ -117,7 +118,9 @@ const RemainingTag = ({ endDate, status, t }) => {
|
||||
let cls = 'text-xs text-gray-500';
|
||||
if (days <= 3) cls = 'text-xs text-red-500 font-semibold';
|
||||
else if (days <= 7) cls = 'text-xs text-amber-500 font-medium';
|
||||
return <span className={cls}>{t('剩余 {{n}} 天', { n: days, count: days })}</span>;
|
||||
return (
|
||||
<span className={cls}>{t('剩余 {{n}} 天', { n: days, count: days })}</span>
|
||||
);
|
||||
};
|
||||
|
||||
const Subscription = () => {
|
||||
@@ -342,158 +345,152 @@ const Subscription = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{ title: 'ID', dataIndex: 'id', width: 70 },
|
||||
{
|
||||
title: t('用户'),
|
||||
width: 180,
|
||||
render: (_, r) => {
|
||||
const display = r.display_name || '';
|
||||
const username = r.username || '';
|
||||
return (
|
||||
<div className='flex flex-col'>
|
||||
<span className='font-medium'>
|
||||
{display || username || `User#${r.user_id}`}
|
||||
</span>
|
||||
<span className='text-xs text-gray-400'>
|
||||
#{r.user_id}
|
||||
{username ? ` @${username}` : ''}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t('套餐'),
|
||||
width: 180,
|
||||
render: (_, r) => (
|
||||
<Space spacing={4} wrap>
|
||||
<Tag color={planTypeColorMap[r.plan_type] || 'grey'} size='small'>
|
||||
{r.plan_name || r.plan_type}
|
||||
</Tag>
|
||||
{r.tier ? (
|
||||
<Tag
|
||||
color={tierColorMap[r.tier] || 'grey'}
|
||||
size='small'
|
||||
type='ghost'
|
||||
>
|
||||
{r.tier}
|
||||
</Tag>
|
||||
) : null}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'status',
|
||||
width: 90,
|
||||
render: (s) => (
|
||||
<Tag color={statusColorMap[s] || 'grey'}>{t(s || '未知')}</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('起始时间'),
|
||||
dataIndex: 'start_date',
|
||||
width: 110,
|
||||
render: formatDateOnly,
|
||||
},
|
||||
{
|
||||
title: t('到期时间'),
|
||||
width: 160,
|
||||
render: (_, r) => (
|
||||
const columns = [
|
||||
{ title: 'ID', dataIndex: 'id', width: 70 },
|
||||
{
|
||||
title: t('用户'),
|
||||
width: 180,
|
||||
render: (_, r) => {
|
||||
const display = r.display_name || '';
|
||||
const username = r.username || '';
|
||||
return (
|
||||
<div className='flex flex-col'>
|
||||
<span>{formatDateOnly(r.end_date)}</span>
|
||||
<RemainingTag endDate={r.end_date} status={r.status} t={t} />
|
||||
<span className='font-medium'>
|
||||
{display || username || `User#${r.user_id}`}
|
||||
</span>
|
||||
<span className='text-xs text-gray-400'>
|
||||
#{r.user_id}
|
||||
{username ? ` @${username}` : ''}
|
||||
</span>
|
||||
</div>
|
||||
),
|
||||
);
|
||||
},
|
||||
{
|
||||
title: t('每日额度'),
|
||||
dataIndex: 'daily_quota',
|
||||
width: 110,
|
||||
render: (v) => renderQuota(v, 2),
|
||||
},
|
||||
{
|
||||
title: t('支付金额'),
|
||||
dataIndex: 'price_paid',
|
||||
width: 100,
|
||||
render: (v) => (v != null ? `¥${Number(v).toFixed(2)}` : '-'),
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
width: 300,
|
||||
fixed: 'right',
|
||||
render: (_, r) => (
|
||||
<Space spacing={4} wrap>
|
||||
},
|
||||
{
|
||||
title: t('套餐'),
|
||||
width: 180,
|
||||
render: (_, r) => (
|
||||
<Space spacing={4} wrap>
|
||||
<Tag color={planTypeColorMap[r.plan_type] || 'grey'} size='small'>
|
||||
{r.plan_name || r.plan_type}
|
||||
</Tag>
|
||||
{r.tier ? (
|
||||
<Tag
|
||||
color={tierColorMap[r.tier] || 'grey'}
|
||||
size='small'
|
||||
type='ghost'
|
||||
>
|
||||
{r.tier}
|
||||
</Tag>
|
||||
) : null}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'status',
|
||||
width: 90,
|
||||
render: (s) => (
|
||||
<Tag color={statusColorMap[s] || 'grey'}>{t(s || '未知')}</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('起始时间'),
|
||||
dataIndex: 'start_date',
|
||||
width: 110,
|
||||
render: formatDateOnly,
|
||||
},
|
||||
{
|
||||
title: t('到期时间'),
|
||||
width: 160,
|
||||
render: (_, r) => (
|
||||
<div className='flex flex-col'>
|
||||
<span>{formatDateOnly(r.end_date)}</span>
|
||||
<RemainingTag endDate={r.end_date} status={r.status} t={t} />
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('每日额度'),
|
||||
dataIndex: 'daily_quota',
|
||||
width: 110,
|
||||
render: (v) => renderQuota(v, 2),
|
||||
},
|
||||
{
|
||||
title: t('支付金额'),
|
||||
dataIndex: 'price_paid',
|
||||
width: 100,
|
||||
render: (v) => (v != null ? `¥${Number(v).toFixed(2)}` : '-'),
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
width: 300,
|
||||
fixed: 'right',
|
||||
render: (_, r) => (
|
||||
<Space spacing={4} wrap>
|
||||
<Button size='small' theme='borderless' onClick={() => openDetail(r)}>
|
||||
{t('详情')}
|
||||
</Button>
|
||||
{admin && r.status !== 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
onClick={() => openDetail(r)}
|
||||
type='danger'
|
||||
icon={<Ban size={12} />}
|
||||
onClick={() => openBan(r)}
|
||||
>
|
||||
{t('详情')}
|
||||
{t('封禁')}
|
||||
</Button>
|
||||
{admin && r.status !== 'banned' && (
|
||||
)}
|
||||
{admin && r.status === 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='primary'
|
||||
icon={<ShieldCheck size={12} />}
|
||||
onClick={() => openUnban(r)}
|
||||
>
|
||||
{t('解封')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status !== 'canceled' && r.status !== 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<CalendarClock size={12} />}
|
||||
onClick={() => openExtend(r)}
|
||||
>
|
||||
{t('延长')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<Pencil size={12} />}
|
||||
onClick={() => openEdit(r)}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status === 'active' && (
|
||||
<Popconfirm
|
||||
title={t('确认手动补发今日额度?')}
|
||||
onConfirm={() => doGrant(r)}
|
||||
>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='danger'
|
||||
icon={<Ban size={12} />}
|
||||
onClick={() => openBan(r)}
|
||||
icon={<Sparkles size={12} />}
|
||||
>
|
||||
{t('封禁')}
|
||||
{t('补发')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status === 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='primary'
|
||||
icon={<ShieldCheck size={12} />}
|
||||
onClick={() => openUnban(r)}
|
||||
>
|
||||
{t('解封')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status !== 'canceled' && r.status !== 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<CalendarClock size={12} />}
|
||||
onClick={() => openExtend(r)}
|
||||
>
|
||||
{t('延长')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<Pencil size={12} />}
|
||||
onClick={() => openEdit(r)}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status === 'active' && (
|
||||
<Popconfirm
|
||||
title={t('确认手动补发今日额度?')}
|
||||
onConfirm={() => doGrant(r)}
|
||||
>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<Sparkles size={12} />}
|
||||
>
|
||||
{t('补发')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
}, [t, admin]);
|
||||
</Popconfirm>
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className='console-content'>
|
||||
@@ -760,14 +757,15 @@ const CreateMembershipModal = ({
|
||||
const [reason, setReason] = useState(() => t('管理员手动开通会员'));
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
|
||||
const resetForm = useEffectEvent(() => {
|
||||
setUserId(undefined);
|
||||
setPlanId(undefined);
|
||||
setDays(30);
|
||||
setReason(t('管理员手动开通会员'));
|
||||
});
|
||||
useEffect(() => {
|
||||
if (visible) {
|
||||
setUserId(undefined);
|
||||
setPlanId(undefined);
|
||||
setDays(30);
|
||||
setReason(t('管理员手动开通会员'));
|
||||
}
|
||||
}, [visible]);
|
||||
if (visible) resetForm();
|
||||
}, [visible, resetForm]);
|
||||
|
||||
const enabledPlans = useMemo(
|
||||
() => plans.filter((plan) => plan.is_enabled),
|
||||
|
||||
@@ -123,7 +123,11 @@ Video Tutorial Component Styles
|
||||
|
||||
.video-retry-btn {
|
||||
padding: 12px 32px;
|
||||
background: linear-gradient(135deg, var(--brand-primary), var(--brand-gradient-via));
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
var(--brand-primary),
|
||||
var(--brand-gradient-via)
|
||||
);
|
||||
border: none;
|
||||
border-radius: 14px;
|
||||
color: white;
|
||||
@@ -157,7 +161,8 @@ Video Tutorial Component Styles
|
||||
|
||||
.video-retry-btn:hover {
|
||||
transform: translateY(-3px) scale(1.02);
|
||||
box-shadow: 0 12px 28px color-mix(in srgb, var(--brand-primary) 50%, transparent);
|
||||
box-shadow: 0 12px 28px
|
||||
color-mix(in srgb, var(--brand-primary) 50%, transparent);
|
||||
}
|
||||
|
||||
/* 视频信息 */
|
||||
@@ -240,7 +245,11 @@ Video Tutorial Component Styles
|
||||
content: '';
|
||||
width: 4px;
|
||||
height: 20px;
|
||||
background: linear-gradient(135deg, var(--brand-primary), var(--brand-gradient-via));
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
var(--brand-primary),
|
||||
var(--brand-gradient-via)
|
||||
);
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
@@ -276,7 +285,11 @@ Video Tutorial Component Styles
|
||||
left: 0;
|
||||
width: 4px;
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, var(--brand-primary), var(--brand-gradient-via));
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
var(--brand-primary),
|
||||
var(--brand-gradient-via)
|
||||
);
|
||||
transform: scaleY(0);
|
||||
transition: transform 0.3s ease;
|
||||
border-radius: 0 4px 4px 0;
|
||||
@@ -324,7 +337,11 @@ Video Tutorial Component Styles
|
||||
right: 8px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
background: linear-gradient(135deg, var(--brand-primary), var(--brand-gradient-via));
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
var(--brand-primary),
|
||||
var(--brand-gradient-via)
|
||||
);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -396,7 +413,8 @@ Video Tutorial Component Styles
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
box-shadow: 0 2px 8px color-mix(in srgb, var(--brand-primary) 40%, transparent);
|
||||
box-shadow: 0 2px 8px
|
||||
color-mix(in srgb, var(--brand-primary) 40%, transparent);
|
||||
}
|
||||
|
||||
.video-list-duration {
|
||||
@@ -461,9 +479,14 @@ Video Tutorial Component Styles
|
||||
}
|
||||
|
||||
.video-tips-card:hover {
|
||||
border-color: color-mix(in srgb, var(--brand-primary) 25%, transparent) !important;
|
||||
border-color: color-mix(
|
||||
in srgb,
|
||||
var(--brand-primary) 25%,
|
||||
transparent
|
||||
) !important;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 24px color-mix(in srgb, var(--brand-primary) 10%, transparent);
|
||||
box-shadow: 0 8px 24px
|
||||
color-mix(in srgb, var(--brand-primary) 10%, transparent);
|
||||
}
|
||||
|
||||
.video-tips-card::before {
|
||||
@@ -571,7 +594,11 @@ html.dark .video-tutorial-empty {
|
||||
|
||||
html.dark .video-player-card {
|
||||
background: var(--ui-color-bg-1);
|
||||
border-color: color-mix(in srgb, var(--brand-primary) 20%, transparent) !important;
|
||||
border-color: color-mix(
|
||||
in srgb,
|
||||
var(--brand-primary) 20%,
|
||||
transparent
|
||||
) !important;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
@@ -634,7 +661,11 @@ html.dark .video-tips-card {
|
||||
color-mix(in srgb, var(--brand-primary) 10%, transparent),
|
||||
color-mix(in srgb, var(--brand-gradient-via) 10%, transparent)
|
||||
) !important;
|
||||
border-color: color-mix(in srgb, var(--brand-primary) 25%, transparent) !important;
|
||||
border-color: color-mix(
|
||||
in srgb,
|
||||
var(--brand-primary) 25%,
|
||||
transparent
|
||||
) !important;
|
||||
}
|
||||
|
||||
html.dark .video-tips-content strong {
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../../hooks/common/useEffectEvent';
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Typography, Card, Empty, Spin, Toast } from '@/components/ui';
|
||||
@@ -35,9 +36,10 @@ const VideoTutorial = () => {
|
||||
const videoRef = useRef(null);
|
||||
|
||||
// 获取视频列表
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
loadVideos();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
const loadVideos = async () => {
|
||||
setLoading(true);
|
||||
|
||||
@@ -23,7 +23,8 @@ License, or (at your option) any later version.
|
||||
left: -50%;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
background: radial-gradient(
|
||||
background:
|
||||
radial-gradient(
|
||||
circle at 50% 50%,
|
||||
color-mix(in srgb, var(--brand-primary) 5%, transparent) 0%,
|
||||
transparent 50%
|
||||
@@ -1600,7 +1601,8 @@ html.dark .tutorial-card-animated:hover {
|
||||
left: -50%;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
background: radial-gradient(
|
||||
background:
|
||||
radial-gradient(
|
||||
circle at 30% 50%,
|
||||
color-mix(in srgb, var(--brand-primary) 5%, transparent) 0%,
|
||||
transparent 50%
|
||||
|
||||
@@ -32,13 +32,7 @@ import {
|
||||
Empty,
|
||||
Spin,
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
Receipt,
|
||||
Plus,
|
||||
Download,
|
||||
Eye,
|
||||
X,
|
||||
} from 'lucide-react';
|
||||
import { Receipt, Plus, Download, Eye, X } from 'lucide-react';
|
||||
import UserCenterPageHeader from '../../components/common/UserCenterPageHeader';
|
||||
import { API, showError, showSuccess } from '../../helpers';
|
||||
import {
|
||||
|
||||
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { useEffectEvent } from '../../hooks/common/useEffectEvent';
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import { Select } from 'antd';
|
||||
import UserCenterPageHeader from '../../components/common/UserCenterPageHeader';
|
||||
@@ -124,9 +125,10 @@ const UserDashboard = () => {
|
||||
};
|
||||
|
||||
// ========== Effects ==========
|
||||
useEffect(() => {
|
||||
const onMount = useEffectEvent(() => {
|
||||
initChart();
|
||||
}, []);
|
||||
});
|
||||
useEffect(() => onMount(), [onMount]);
|
||||
|
||||
// ========== 公告弹窗检查 ==========
|
||||
useEffect(() => {
|
||||
|
||||
@@ -19,11 +19,7 @@
|
||||
transparent
|
||||
);
|
||||
--wd-danger: var(--ui-color-danger);
|
||||
--wd-danger-tint: color-mix(
|
||||
in srgb,
|
||||
var(--ui-color-danger) 8%,
|
||||
transparent
|
||||
);
|
||||
--wd-danger-tint: color-mix(in srgb, var(--ui-color-danger) 8%, transparent);
|
||||
position: relative;
|
||||
color: var(--wd-ink);
|
||||
}
|
||||
@@ -155,11 +151,8 @@
|
||||
overflow: hidden;
|
||||
padding: 20px;
|
||||
border-color: var(--wd-accent-line);
|
||||
background: radial-gradient(
|
||||
120% 160% at 100% 0%,
|
||||
var(--wd-tint) 0%,
|
||||
transparent 55%
|
||||
),
|
||||
background:
|
||||
radial-gradient(120% 160% at 100% 0%, var(--wd-tint) 0%, transparent 55%),
|
||||
var(--wd-card);
|
||||
}
|
||||
@media (min-width: 640px) {
|
||||
|
||||
Reference in New Issue
Block a user