WIP: user-zzy-dev #1
|
|
@ -11,7 +11,7 @@ export default {
|
|||
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
|
||||
'/tbg/api/v1': {
|
||||
// 要代理的地址
|
||||
target: 'http://192.168.1.226:9999',
|
||||
target: 'http://0.0.0.0:9999',
|
||||
// 配置了这个可以从 http 代理到 https
|
||||
// 依赖 origin 的功能可能需要这个,比如 cookie
|
||||
changeOrigin: true,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
@import '~antd/es/style/themes/default.less';
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
padding: 20px;
|
||||
overflow: auto;
|
||||
background: white;
|
||||
:global {
|
||||
.ant-pro-form-login-header {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.button {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.textarea {
|
||||
width: 600px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import { Button, Input } from 'antd';
|
||||
import styles from './index.less';
|
||||
import { createSecretKey, getSecretKey } from '@/services/System/secretKey';
|
||||
|
||||
const { TextArea } = Input;
|
||||
|
||||
const SecretKey: React.FC = () => {
|
||||
const [secretKey, setSecretKey] = useState('');
|
||||
|
||||
const create = async () => {
|
||||
await createSecretKey({});
|
||||
};
|
||||
|
||||
const getUserSecretKey = async () => {
|
||||
const data = await getSecretKey();
|
||||
setSecretKey(data + '');
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getUserSecretKey();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Button className={styles.button} type="primary" onClick={create}>
|
||||
创建密钥
|
||||
</Button>
|
||||
<TextArea className={styles.textarea} rows={16} value={secretKey} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SecretKey;
|
||||
|
|
@ -65,6 +65,11 @@ export default [
|
|||
path: RoutePath.PERMISSIONS.LIST,
|
||||
component: './System/Permissions/List',
|
||||
},
|
||||
{
|
||||
name: '密钥管理',
|
||||
path: RoutePath.SECRET_KEY,
|
||||
component: './System/SecretKey',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ const RoutePath = {
|
|||
PERMISSIONS: {
|
||||
LIST: `${SYSTEM}/permissions`,
|
||||
},
|
||||
SECRET_KEY: `${SYSTEM}/secret_key`,
|
||||
SETTING: SETTING,
|
||||
WORK: {
|
||||
LIST: `${SETTING}/work`,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
import request from '@/utils/request';
|
||||
|
||||
/**
|
||||
* 获取密钥
|
||||
* @param {object} params
|
||||
* @returns {array} data 密钥
|
||||
*/
|
||||
export const getSecretKey = () => {
|
||||
return request.request({
|
||||
url: '/key/get',
|
||||
method: 'get',
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 创建密钥
|
||||
* @param {object} data
|
||||
* @returns {array} data 密钥
|
||||
*/
|
||||
export const createSecretKey = (data) => {
|
||||
return request.request({
|
||||
url: '/key/create',
|
||||
method: 'post',
|
||||
data,
|
||||
});
|
||||
};
|
||||
Loading…
Reference in New Issue