diff --git a/spug_web/src/pages/system/setting/OpenService.js b/spug_web/src/pages/system/setting/OpenService.js new file mode 100644 index 0000000..45eeb17 --- /dev/null +++ b/spug_web/src/pages/system/setting/OpenService.js @@ -0,0 +1,37 @@ +import React from 'react'; +import {observer} from 'mobx-react'; +import {Button, Form, Input, message} from 'antd'; +import styles from './index.module.css'; +import http from 'libs/http'; +import store from './store'; +import lds from 'lodash'; + + +export default observer(function () { + function handleSubmit() { + store.loading = true; + const value = lds.get(store.settings, 'api_key.value'); + http.post('/api/setting/', {data: [{key: 'api_key', value}]}) + .then(() => { + message.success('保存成功'); + store.fetchSettings() + }) + .finally(() => store.loading = false) + } + + + return ( + +
开放服务设置
+
+ + lds.set(store.settings, 'api_key.value', e.target.value)} + placeholder="请输入"/> + + +
+
+ ) +}) \ No newline at end of file diff --git a/spug_web/src/pages/system/setting/index.js b/spug_web/src/pages/system/setting/index.js index a821686..e490d75 100644 --- a/spug_web/src/pages/system/setting/index.js +++ b/spug_web/src/pages/system/setting/index.js @@ -3,6 +3,7 @@ import { Menu } from 'antd'; import BasicSetting from './BasicSetting'; import AlarmSetting from './AlarmSetting'; import MailServer from './MailServer'; +import OpenService from './OpenService'; import styles from './index.module.css'; import store from './store'; @@ -32,12 +33,14 @@ class Index extends React.Component { 基本设置 报警服务设置 邮件服务设置 + 开放服务设置
{selectedKeys[0] === 'basic' && } {selectedKeys[0] === 'mail' && } {selectedKeys[0] === 'alarm' && } + {selectedKeys[0] === 'service' && }
) diff --git a/spug_web/src/pages/system/setting/store.js b/spug_web/src/pages/system/setting/store.js index 39cd360..3501aee 100644 --- a/spug_web/src/pages/system/setting/store.js +++ b/spug_web/src/pages/system/setting/store.js @@ -5,6 +5,7 @@ import http from 'libs/http'; class Store { @observable settings = {}; @observable isFetching = false; + @observable loading = false; fetchSettings = () => { this.isFetching = true;