mirror of https://github.com/openspug/spug
fix issues
parent
da0f608ec2
commit
78b5f42afd
|
@ -85,7 +85,7 @@ export default function () {
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div className={styles.titleContainer}>
|
<div className={styles.titleContainer}>
|
||||||
<div><img className={styles.logo} src={logo} alt="logo"/></div>
|
<div><img className={styles.logo} src={logo} alt="logo"/></div>
|
||||||
<div className={styles.desc}>灵活、强大、功能全面的开源运维平台</div>
|
<div className={styles.desc}>灵活、强大、易用的开源运维平台</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.formContainer}>
|
<div className={styles.formContainer}>
|
||||||
<Tabs className={styles.tabs} onTabClick={v => setLoginType(v)}>
|
<Tabs className={styles.tabs} onTabClick={v => setLoginType(v)}>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Copyright (c) <spug.dev@gmail.com>
|
* Copyright (c) <spug.dev@gmail.com>
|
||||||
* Released under the AGPL-3.0 License.
|
* Released under the AGPL-3.0 License.
|
||||||
*/
|
*/
|
||||||
import React, { useState } from 'react';
|
import React from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { Form, Popover, Input, Button, message } from 'antd';
|
import { Form, Popover, Input, Button, message } from 'antd';
|
||||||
import styles from './index.module.css';
|
import styles from './index.module.css';
|
||||||
|
@ -11,9 +11,8 @@ import { http } from 'libs';
|
||||||
import store from './store';
|
import store from './store';
|
||||||
|
|
||||||
export default observer(function () {
|
export default observer(function () {
|
||||||
const [spug_key, setSpugKey] = useState(store.settings.spug_key);
|
|
||||||
|
|
||||||
function handleSubmit() {
|
function handleSubmit() {
|
||||||
|
const spug_key = store.settings.spug_key;
|
||||||
if (!spug_key) return message.error('请输入调用凭据');
|
if (!spug_key) return message.error('请输入调用凭据');
|
||||||
store.loading = true;
|
store.loading = true;
|
||||||
http.post('/api/setting/', {data: [{key: 'spug_key', value: spug_key}]})
|
http.post('/api/setting/', {data: [{key: 'spug_key', value: spug_key}]})
|
||||||
|
@ -24,7 +23,7 @@ export default observer(function () {
|
||||||
.finally(() => store.loading = false)
|
.finally(() => store.loading = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
const spugWx = <img src="http://image.qbangmang.com/spug-weixin.jpeg" alt='spug'/>;
|
const spugWx = <img src="https://cdn.spug.cc/img/spug-weixin.jpeg" alt='spug'/>;
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<div className={styles.title}>基本设置</div>
|
<div className={styles.title}>基本设置</div>
|
||||||
|
@ -32,7 +31,7 @@ export default observer(function () {
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="调用凭据"
|
label="调用凭据"
|
||||||
labelCol={{span: 24}}
|
labelCol={{span: 24}}
|
||||||
help={<span>如需要使用Spug的邮件、微信和短信等内置服务,请关注公众号
|
help={<span>如需要使用Spug的邮件、微信和MFA等内置服务,请关注公众号
|
||||||
<span style={{color: '#008dff', cursor: 'pointer'}}>
|
<span style={{color: '#008dff', cursor: 'pointer'}}>
|
||||||
<Popover content={spugWx}>
|
<Popover content={spugWx}>
|
||||||
<span>Spug运维</span>
|
<span>Spug运维</span>
|
||||||
|
@ -40,8 +39,8 @@ export default observer(function () {
|
||||||
</span>
|
</span>
|
||||||
在【我的】页面获取调用凭据,否则请留空。</span>}>
|
在【我的】页面获取调用凭据,否则请留空。</span>}>
|
||||||
<Input
|
<Input
|
||||||
value={spug_key}
|
value={store.settings.spug_key}
|
||||||
onChange={e => setSpugKey(e.target.value)}
|
onChange={e => store.update('spug_key', e.target.value)}
|
||||||
placeholder="请输入Spug微信公众号获取到的Token"/>
|
placeholder="请输入Spug微信公众号获取到的Token"/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item style={{marginTop: 24}}>
|
<Form.Item style={{marginTop: 24}}>
|
||||||
|
|
|
@ -49,7 +49,7 @@ export default observer(function () {
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="登录MFA认证"
|
label="登录MFA认证"
|
||||||
style={{marginTop: 24}}
|
style={{marginTop: 24}}
|
||||||
help="建议开启,登录时额外使用短信验证码进行身份验证。">
|
help="建议开启,登录时额外使用验证码进行身份验证。">
|
||||||
<Switch
|
<Switch
|
||||||
checkedChildren="开启"
|
checkedChildren="开启"
|
||||||
unCheckedChildren="关闭"
|
unCheckedChildren="关闭"
|
||||||
|
|
|
@ -21,6 +21,10 @@ class Store {
|
||||||
})
|
})
|
||||||
.finally(() => this.isFetching = false)
|
.finally(() => this.isFetching = false)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
update = (key, value) => {
|
||||||
|
this.settings[key] = value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new Store()
|
export default new Store()
|
||||||
|
|
Loading…
Reference in New Issue