Commit 88c50f9d by 周志凯

feat: add other api

1 parent c9673388
import request from './request';
const SystemApiUrl = '/oauthSystems/';
interface queryParameter {
page?: number
pageSize?: number
}
interface createData {
name: string
description: string
}
/**
* 获取系统列表
*/
export const getSystemList = (query?: queryParameter) => {
return request({
url: SystemApiUrl,
method: 'get',
params: query
})
}
/**
* 添加系统列表
*/
export const createSystem = (data: createData) => {
return request({
url: SystemApiUrl,
method: 'post',
data
})
}
/**
* 删除系统
*/
export const deleteSystem = (id: string) => {
return request({
url: SystemApiUrl,
method: 'delete'
})
}
import request from './request';
const MenuApiUrl = '/oauthMenus/';
interface SystemQueryProp {
systemId: string
}
interface AppQueryProp {
serviceId: string
}
interface UserQueryProp {}
interface createData {
systemId: string
parentId?: string
name: string
note: string
path: string
icon: string
type: number
}
/**
* 获取系统菜单列表
*/
export const getSystemMenuList = (query: SystemQueryProp) => {
return request({
url: `${MenuApiUrl}/getMenusBySystemId`,
method: 'get',
params: query
})
}
/**
* 获取应用菜单列表
*/
export const getAppMenuList = (query: AppQueryProp) => {
return request({
url: `${MenuApiUrl}/getMenusByServiceId`,
method: 'get',
params: query
})
}
/**
* 获取用户菜单列表
*/
export const getUserMenuList = (query: UserQueryProp) => {
return request({
url: `${MenuApiUrl}/getMenusByUser`,
method: 'get',
params: query
})
}
/**
* 添加菜单
*/
export const createMenu = (data: createData) => {
return request({
url: MenuApiUrl,
method: 'post',
data
})
}
/**
* 删除系统
*/
export const deleteMenu = (id: string) => {
return request({
url: `${MenuApiUrl}/${id}`,
method: 'delete'
})
}
import React, { FC } from 'react'; import React, { FC } from 'react';
import { Layout, Menu, Breadcrumb } from 'antd'; import { Layout, Menu } from 'antd';
import { import {
Link, Link,
Switch, Switch,
...@@ -36,12 +36,12 @@ const PageLayout:FC<PageLayoutProp & RouteComponentProps> = () => ( ...@@ -36,12 +36,12 @@ const PageLayout:FC<PageLayoutProp & RouteComponentProps> = () => (
))} ))}
</Menu> </Menu>
</Sider> </Sider>
<Layout style={{ padding: '0 24px 24px' }}> <Layout style={{ padding: '24px 24px' }}>
<Breadcrumb style={{ margin: '16px 0' }}> {/* <Breadcrumb style={{ margin: '16px 0' }}>
<Breadcrumb.Item>Home</Breadcrumb.Item> <Breadcrumb.Item>Home</Breadcrumb.Item>
<Breadcrumb.Item>List</Breadcrumb.Item> <Breadcrumb.Item>List</Breadcrumb.Item>
<Breadcrumb.Item>App</Breadcrumb.Item> <Breadcrumb.Item>App</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb> */}
<Content <Content
className="site-layout-background" className="site-layout-background"
style={{ style={{
......
...@@ -58,8 +58,8 @@ interface SystemSettingProp {} ...@@ -58,8 +58,8 @@ interface SystemSettingProp {}
const SystemSetting: FC<SystemSettingProp> = () => { const SystemSetting: FC<SystemSettingProp> = () => {
const initData = useCallback(async () => { const initData = useCallback(async () => {
try { try {
const data = await getSystemList() const result = await getSystemList()
console.log('initData', data) console.log('initData', result)
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} }
......
const { createProxyMiddleware } = require('http-proxy-middleware'); const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = (app) => { module.exports = function(app) {
app.use( app.use(
createProxyMiddleware('/api', { createProxyMiddleware('/api', {
target: `http://192.168.9.115:8080`, target: `http://192.168.9.115:8080`,
changeOrigin: true changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}) })
) )
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!