chore: reformat code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { Col, Row , Form, Button, Banner } from '@douyinfe/semi-ui';
|
||||
import { Banner, Button, Col, Form, Row } from '@douyinfe/semi-ui';
|
||||
import { API, showError, showSuccess } from '../helpers';
|
||||
import { marked } from 'marked';
|
||||
|
||||
@@ -57,8 +57,8 @@ const OtherSetting = () => {
|
||||
await updateOption('Notice', inputs.Notice);
|
||||
showSuccess('公告已更新');
|
||||
} catch (error) {
|
||||
console.error("公告更新失败", error);
|
||||
showError("公告更新失败")
|
||||
console.error('公告更新失败', error);
|
||||
showError('公告更新失败');
|
||||
} finally {
|
||||
setLoadingInput((loadingInput) => ({ ...loadingInput, Notice: false }));
|
||||
}
|
||||
@@ -72,8 +72,8 @@ const OtherSetting = () => {
|
||||
await updateOption('SystemName', inputs.SystemName);
|
||||
showSuccess('系统名称已更新');
|
||||
} catch (error) {
|
||||
console.error("系统名称更新失败", error);
|
||||
showError("系统名称更新失败")
|
||||
console.error('系统名称更新失败', error);
|
||||
showError('系统名称更新失败');
|
||||
} finally {
|
||||
setLoadingInput((loadingInput) => ({ ...loadingInput, SystemName: false }));
|
||||
}
|
||||
@@ -86,8 +86,8 @@ const OtherSetting = () => {
|
||||
await updateOption('Logo', inputs.Logo);
|
||||
showSuccess('Logo 已更新');
|
||||
} catch (error) {
|
||||
console.error("Logo 更新失败", error);
|
||||
showError("Logo 更新失败")
|
||||
console.error('Logo 更新失败', error);
|
||||
showError('Logo 更新失败');
|
||||
} finally {
|
||||
setLoadingInput((loadingInput) => ({ ...loadingInput, Logo: false }));
|
||||
}
|
||||
@@ -99,8 +99,8 @@ const OtherSetting = () => {
|
||||
await updateOption(key, inputs[key]);
|
||||
showSuccess('首页内容已更新');
|
||||
} catch (error) {
|
||||
console.error("首页内容更新失败", error);
|
||||
showError("首页内容更新失败")
|
||||
console.error('首页内容更新失败', error);
|
||||
showError('首页内容更新失败');
|
||||
} finally {
|
||||
setLoadingInput((loadingInput) => ({ ...loadingInput, HomePageContent: false }));
|
||||
}
|
||||
@@ -112,8 +112,8 @@ const OtherSetting = () => {
|
||||
await updateOption('About', inputs.About);
|
||||
showSuccess('关于内容已更新');
|
||||
} catch (error) {
|
||||
console.error("关于内容更新失败", error);
|
||||
showError("关于内容更新失败");
|
||||
console.error('关于内容更新失败', error);
|
||||
showError('关于内容更新失败');
|
||||
} finally {
|
||||
setLoadingInput((loadingInput) => ({ ...loadingInput, About: false }));
|
||||
}
|
||||
@@ -125,16 +125,14 @@ const OtherSetting = () => {
|
||||
await updateOption('Footer', inputs.Footer);
|
||||
showSuccess('页脚内容已更新');
|
||||
} catch (error) {
|
||||
console.error("页脚内容更新失败", error);
|
||||
showError("页脚内容更新失败");
|
||||
console.error('页脚内容更新失败', error);
|
||||
showError('页脚内容更新失败');
|
||||
} finally {
|
||||
setLoadingInput((loadingInput) => ({ ...loadingInput, Footer: false }));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
const openGitHubRelease = () => {
|
||||
window.location =
|
||||
'https://github.com/songquanpeng/one-api/releases/latest';
|
||||
@@ -173,16 +171,17 @@ const OtherSetting = () => {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect( () => {
|
||||
useEffect(() => {
|
||||
getOptions();
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
<Row >
|
||||
<Row>
|
||||
<Col span={24}>
|
||||
{/* 通用设置 */}
|
||||
<Form values={inputs} getFormApi={formAPI => formAPISettingGeneral.current = formAPI} style={{marginBottom: 15}}>
|
||||
<Form values={inputs} getFormApi={formAPI => formAPISettingGeneral.current = formAPI}
|
||||
style={{ marginBottom: 15 }}>
|
||||
<Form.Section text={'通用设置'}>
|
||||
<Form.TextArea
|
||||
label={'公告'}
|
||||
@@ -191,26 +190,27 @@ const OtherSetting = () => {
|
||||
onChange={handleInputChange}
|
||||
style={{ fontFamily: 'JetBrains Mono, Consolas' }}
|
||||
autosize={{ minRows: 6, maxRows: 12 }}
|
||||
/>
|
||||
/>
|
||||
<Button onClick={submitNotice} loading={loadingInput['Notice']}>设置公告</Button>
|
||||
</Form.Section>
|
||||
</Form>
|
||||
{/* 个性化设置 */}
|
||||
<Form values={inputs} getFormApi={formAPI => formAPIPersonalization.current = formAPI} style={{marginBottom: 15}}>
|
||||
<Form values={inputs} getFormApi={formAPI => formAPIPersonalization.current = formAPI}
|
||||
style={{ marginBottom: 15 }}>
|
||||
<Form.Section text={'个性化设置'}>
|
||||
<Form.Input
|
||||
label={'系统名称'}
|
||||
placeholder={'在此输入系统名称'}
|
||||
field={'SystemName'}
|
||||
onChange={handleInputChange}
|
||||
/>
|
||||
/>
|
||||
<Button onClick={submitSystemName} loading={loadingInput['SystemName']}>设置系统名称</Button>
|
||||
<Form.Input
|
||||
label={'Logo 图片地址'}
|
||||
placeholder={'在此输入 Logo 图片地址'}
|
||||
field={'Logo'}
|
||||
onChange={handleInputChange}
|
||||
/>
|
||||
/>
|
||||
<Button onClick={submitLogo} loading={loadingInput['Logo']}>设置 Logo</Button>
|
||||
<Form.TextArea
|
||||
label={'首页内容'}
|
||||
@@ -219,8 +219,9 @@ const OtherSetting = () => {
|
||||
onChange={handleInputChange}
|
||||
style={{ fontFamily: 'JetBrains Mono, Consolas' }}
|
||||
autosize={{ minRows: 6, maxRows: 12 }}
|
||||
/>
|
||||
<Button onClick={() => submitOption('HomePageContent')} loading={loadingInput['HomePageContent']}>设置首页内容</Button>
|
||||
/>
|
||||
<Button onClick={() => submitOption('HomePageContent')}
|
||||
loading={loadingInput['HomePageContent']}>设置首页内容</Button>
|
||||
<Form.TextArea
|
||||
label={'关于'}
|
||||
placeholder={'在此输入新的关于内容,支持 Markdown & HTML 代码。如果输入的是一个链接,则会使用该链接作为 iframe 的 src 属性,这允许你设置任意网页作为关于页面。'}
|
||||
@@ -228,7 +229,7 @@ const OtherSetting = () => {
|
||||
onChange={handleInputChange}
|
||||
style={{ fontFamily: 'JetBrains Mono, Consolas' }}
|
||||
autosize={{ minRows: 6, maxRows: 12 }}
|
||||
/>
|
||||
/>
|
||||
<Button onClick={submitAbout} loading={loadingInput['About']}>设置关于</Button>
|
||||
{/* */}
|
||||
<Banner
|
||||
@@ -236,14 +237,14 @@ const OtherSetting = () => {
|
||||
type="info"
|
||||
description="移除 One API 的版权标识必须首先获得授权,项目维护需要花费大量精力,如果本项目对你有意义,请主动支持本项目。"
|
||||
closeIcon={null}
|
||||
style={{ marginTop: 15 }}
|
||||
style={{ marginTop: 15 }}
|
||||
/>
|
||||
<Form.Input
|
||||
label={'页脚'}
|
||||
placeholder={'在此输入新的页脚,留空则使用默认页脚,支持 HTML 代码'}
|
||||
field={'Footer'}
|
||||
onChange={handleInputChange}
|
||||
/>
|
||||
/>
|
||||
<Button onClick={submitFooter} loading={loadingInput['Footer']}>设置页脚</Button>
|
||||
</Form.Section>
|
||||
</Form>
|
||||
@@ -270,7 +271,7 @@ const OtherSetting = () => {
|
||||
{/* />*/}
|
||||
{/* </Modal.Actions>*/}
|
||||
{/*</Modal>*/}
|
||||
</Row>
|
||||
</Row>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user