Merge branch 'feature/tool_yjp' into release/v0.2.7

This commit is contained in:
yujiangping
2026-03-13 14:08:21 +08:00

View File

@@ -37,6 +37,7 @@ const MarketConfigModal = forwardRef<MarketConfigModalRef, MarketConfigModalProp
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [currentSource, setCurrentSource] = useState<MarketSource | null>(null); const [currentSource, setCurrentSource] = useState<MarketSource | null>(null);
const [showApiKey, setShowApiKey] = useState(false); const [showApiKey, setShowApiKey] = useState(false);
const formValues = Form.useWatch([], form);
const handleClose = () => { const handleClose = () => {
setVisible(false); setVisible(false);
@@ -101,6 +102,9 @@ const MarketConfigModal = forwardRef<MarketConfigModalRef, MarketConfigModalProp
} }
}; };
// 检查是否可以保存token 字段必须有值
const canSave = formValues?.token && formValues.token.trim().length > 0;
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
handleOpen, handleOpen,
handleClose handleClose
@@ -116,6 +120,7 @@ const MarketConfigModal = forwardRef<MarketConfigModalRef, MarketConfigModalProp
okText={t('tool.marketSaveAndConnect')} okText={t('tool.marketSaveAndConnect')}
onOk={handleSave} onOk={handleSave}
confirmLoading={loading} confirmLoading={loading}
okButtonProps={{ disabled: !canSave }}
width={600} width={600}
> >
<div> <div>
@@ -169,7 +174,7 @@ const MarketConfigModal = forwardRef<MarketConfigModalRef, MarketConfigModalProp
name="token" name="token"
label={ label={
<span> <span>
API Key <span className="rb:text-gray-400 rb:font-normal">({t('tool.marketApiKeyOptional')})</span> API Key
</span> </span>
} }
extra={<span style={{ display: 'inline-block', marginTop: 8 }}>{t('tool.marketApiKeyExtra')}</span>} extra={<span style={{ display: 'inline-block', marginTop: 8 }}>{t('tool.marketApiKeyExtra')}</span>}