sync: 同步 monkey-ai@weiyuan(ddc5b9443) 的 web/ 到 ui-optimization
- 合入 weiyuan 新功能前端:分佣 V2 / 伙伴工作台、智能路由、企业资金与分析、官网设置与预约演示等, semi-ui 已全部迁移到 antd 6 / @/components/ui,不重新引入 Semi - 分佣二级菜单与页头去重、伙伴入口探测(企业伙伴走企业中心「企业分佣」)、超管侧栏入口恢复 - 适配层 DatePicker / TimePicker 统一 onChange(Date|Date[]|null, 文本) 契约;生产构建剔除调试日志 - 图片链接刷新:同任务请求复用、后台刷新不弹全局错误、离页停止批量请求 - 恢复 bun.lock(与 package-lock.json 共存);docs 规范与 CHANGELOG 更新 - 停止跟踪 .env.playwright.local(本地登录凭据,已加入 .gitignore)
This commit is contained in:
@@ -17,7 +17,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState, useRef, useMemo } from 'react';
|
||||
import React, { useContext, useEffect, useState, useRef, useMemo } from 'react';
|
||||
import { StatusContext } from '../../../context/Status';
|
||||
import {
|
||||
Banner,
|
||||
Button,
|
||||
@@ -30,7 +31,13 @@ import {
|
||||
InputGroup,
|
||||
Input,
|
||||
} from '@/components/ui';
|
||||
import { API, showError, showSuccess, showWarning } from '../../../helpers';
|
||||
import {
|
||||
API,
|
||||
isRoot,
|
||||
showError,
|
||||
showSuccess,
|
||||
showWarning,
|
||||
} from '../../../helpers';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const API_MAPPING = {
|
||||
@@ -54,6 +61,7 @@ const DEFAULT_INPUTS = {
|
||||
DemoSiteEnabled: false,
|
||||
SelfUseModeEnabled: false,
|
||||
LanguageSwitchEnabled: true,
|
||||
CommissionEnabled: true,
|
||||
CosEnabled: false,
|
||||
CosSecretId: '',
|
||||
CosSecretKey: '',
|
||||
@@ -70,6 +78,7 @@ export default function GeneralSettings(props) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [showQuotaWarning, setShowQuotaWarning] = useState(false);
|
||||
const [testingCos, setTestingCos] = useState(false);
|
||||
const [statusState, statusDispatch] = useContext(StatusContext);
|
||||
|
||||
const [inputs, setInputs] = useState(DEFAULT_INPUTS);
|
||||
const refForm = useRef();
|
||||
@@ -163,6 +172,24 @@ export default function GeneralSettings(props) {
|
||||
return showError(t('部分保存失败,请重试'));
|
||||
}
|
||||
showSuccess(t('保存成功'));
|
||||
// 分佣总开关决定侧栏/顶栏的分佣入口,保存成功后同步到全局 status,
|
||||
// 否则要整页刷新菜单才会跟着变。
|
||||
const commissionIndex = updateArray.findIndex(
|
||||
(item) => item.key === 'CommissionEnabled',
|
||||
);
|
||||
if (
|
||||
commissionIndex >= 0 &&
|
||||
res[commissionIndex]?.data?.success &&
|
||||
statusState?.status
|
||||
) {
|
||||
statusDispatch({
|
||||
type: 'set',
|
||||
payload: {
|
||||
...statusState.status,
|
||||
commission_enabled: updateArray[commissionIndex].newValue,
|
||||
},
|
||||
});
|
||||
}
|
||||
// 刷新数据
|
||||
props.refresh();
|
||||
})
|
||||
@@ -405,6 +432,22 @@ export default function GeneralSettings(props) {
|
||||
onChange={handleFieldChange('LanguageSwitchEnabled')}
|
||||
/>
|
||||
</Col>
|
||||
{/* 分佣总开关仅超级管理员可改(后端未登记到下放清单,默认 root-only) */}
|
||||
{isRoot() && (
|
||||
<Col xs={24} sm={12} md={8} lg={8} xl={8}>
|
||||
<Form.Switch
|
||||
field={'CommissionEnabled'}
|
||||
label={t('启用分佣功能')}
|
||||
extraText={t(
|
||||
'关闭后停止全部分佣计提、后台任务与分佣/伙伴接口,不再产生任何分佣相关的数据库读写',
|
||||
)}
|
||||
size='default'
|
||||
checkedText='|'
|
||||
uncheckedText='〇'
|
||||
onChange={handleFieldChange('CommissionEnabled')}
|
||||
/>
|
||||
</Col>
|
||||
)}
|
||||
</Row>
|
||||
<Row>
|
||||
<Button size='default' onClick={onSubmit}>
|
||||
|
||||
Reference in New Issue
Block a user