添加密钥管理
This commit is contained in:
parent
31198544d7
commit
2d06115a4e
|
|
@ -11,7 +11,7 @@ export default {
|
||||||
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
|
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
|
||||||
'/tbg/api/v1': {
|
'/tbg/api/v1': {
|
||||||
// 要代理的地址
|
// 要代理的地址
|
||||||
target: 'http://192.168.1.226:9999',
|
target: 'http://0.0.0.0:9999',
|
||||||
// 配置了这个可以从 http 代理到 https
|
// 配置了这个可以从 http 代理到 https
|
||||||
// 依赖 origin 的功能可能需要这个,比如 cookie
|
// 依赖 origin 的功能可能需要这个,比如 cookie
|
||||||
changeOrigin: true,
|
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,
|
path: RoutePath.PERMISSIONS.LIST,
|
||||||
component: './System/Permissions/List',
|
component: './System/Permissions/List',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: '密钥管理',
|
||||||
|
path: RoutePath.SECRET_KEY,
|
||||||
|
component: './System/SecretKey',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ const RoutePath = {
|
||||||
PERMISSIONS: {
|
PERMISSIONS: {
|
||||||
LIST: `${SYSTEM}/permissions`,
|
LIST: `${SYSTEM}/permissions`,
|
||||||
},
|
},
|
||||||
|
SECRET_KEY: `${SYSTEM}/secret_key`,
|
||||||
SETTING: SETTING,
|
SETTING: SETTING,
|
||||||
WORK: {
|
WORK: {
|
||||||
LIST: `${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