Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
admin-ci-test
Commits
49f9520f
提交
49f9520f
authored
7月 14, 2023
作者:
龚洪江
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能,路由权限
上级
4226fbe9
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
288 行增加
和
59 行删除
+288
-59
.env.production
env/.env.production
+2
-2
commonType.ts
src/api/interface/commonType.ts
+5
-0
systemManageType.ts
src/api/interface/systemManageType.ts
+7
-0
index.tsx
src/components/goods/commonAddOrEdit/stockSku/index.tsx
+1
-1
index.tsx
src/components/layout/menu/index.tsx
+4
-12
index.tsx
src/components/layout/title/index.tsx
+2
-0
index.tsx
src/pages/common/login/index.tsx
+9
-15
index.tsx
src/pages/orderManage/pilotTrainingOrder/index.tsx
+59
-0
index.tsx
...nation/addOrEditInstitution/components/baseInfo/index.tsx
+17
-0
index.tsx
...ning/ licensureExamination/addOrEditInstitution/index.tsx
+9
-0
index.tsx
...Training/ licensureExamination/institutionsList/index.tsx
+53
-0
index.tsx
...es/systemManage/accountManage/comp/addEditModal/index.tsx
+4
-2
index.tsx
src/pages/systemManage/accountManage/index.tsx
+13
-2
index.tsx
src/pages/systemManage/limitManage/limitInfo/index.tsx
+1
-1
index.ts
src/router/index.ts
+33
-10
privateRouter.tsx
src/router/privateRouter.tsx
+6
-13
router.tsx
src/router/router.tsx
+49
-0
index.ts
src/store/module/userInfo/index.ts
+14
-1
没有找到文件。
env/.env.production
浏览文件 @
49f9520f
#请求接口地址
#请求接口地址
VITE_REQUEST_BASE_URL='https://www.iuav.shop'
#
VITE_REQUEST_BASE_URL='https://www.iuav.shop'
#
VITE_REQUEST_BASE_URL='https://test.iuav.shop'
VITE_REQUEST_BASE_URL='https://test.iuav.shop'
#VITE_REQUEST_BASE_URL='/api'
#VITE_REQUEST_BASE_URL='/api'
#旧版接口地址
#旧版接口地址
#VITE_REQUEST_BASE_URL='https://iuav.mmcuav.cn'
#VITE_REQUEST_BASE_URL='https://iuav.mmcuav.cn'
...
...
src/api/interface/commonType.ts
浏览文件 @
49f9520f
...
@@ -24,6 +24,11 @@ export type BackEndLoginType = InterFunction<
...
@@ -24,6 +24,11 @@ export type BackEndLoginType = InterFunction<
phoneNum
:
string
;
phoneNum
:
string
;
remark
:
string
;
remark
:
string
;
};
};
roleInfo
:
{
id
:
number
;
roleName
:
string
;
roleNo
:
string
;
};
}
}
>
;
>
;
// 上传图片
// 上传图片
...
...
src/api/interface/systemManageType.ts
浏览文件 @
49f9520f
...
@@ -45,6 +45,11 @@ export type listBAccountPageType = InterListFunction<
...
@@ -45,6 +45,11 @@ export type listBAccountPageType = InterListFunction<
phoneNum
:
string
;
phoneNum
:
string
;
remark
:
string
;
remark
:
string
;
};
};
roleInfoDTO
:
{
id
:
number
;
roleName
:
string
;
roleNo
:
string
;
};
}
}
>
;
>
;
// 账号-新增
// 账号-新增
...
@@ -62,6 +67,8 @@ export type insertBAccountType = InterFunction<
...
@@ -62,6 +67,8 @@ export type insertBAccountType = InterFunction<
provinceCode
?:
number
;
provinceCode
?:
number
;
remark
?:
string
;
remark
?:
string
;
userName
:
string
;
userName
:
string
;
companyId
:
number
;
roleId
:
number
;
},
},
NonNullable
<
unknown
>
NonNullable
<
unknown
>
>
;
>
;
...
...
src/components/goods/commonAddOrEdit/stockSku/index.tsx
浏览文件 @
49f9520f
...
@@ -16,7 +16,7 @@ interface selfProps {
...
@@ -16,7 +16,7 @@ interface selfProps {
deleteSku
:
(
record
:
specEntity
)
=>
void
;
deleteSku
:
(
record
:
specEntity
)
=>
void
;
isDetail
:
boolean
;
isDetail
:
boolean
;
}
}
//机构列表
const
StockSku
:
React
.
FC
<
selfProps
>
=
({
const
StockSku
:
React
.
FC
<
selfProps
>
=
({
addOrEditSku
,
addOrEditSku
,
specData
,
specData
,
...
...
src/components/layout/menu/index.tsx
浏览文件 @
49f9520f
...
@@ -5,6 +5,7 @@ import { RouteObjectType, routerList } from '~/router/router';
...
@@ -5,6 +5,7 @@ import { RouteObjectType, routerList } from '~/router/router';
import
{
useLocation
,
useNavigate
}
from
'react-router-dom'
;
import
{
useLocation
,
useNavigate
}
from
'react-router-dom'
;
import
{
GetRouteByID
,
getRouteID
,
getRoutePid
}
from
'~/utils/router'
;
import
{
GetRouteByID
,
getRouteID
,
getRoutePid
}
from
'~/utils/router'
;
import
{
useSelector
}
from
'react-redux'
;
import
{
useSelector
}
from
'react-redux'
;
import
{
authRouterList
,
routerItem
}
from
'~/router'
;
type
MenuItem
=
Required
<
MenuProps
>
[
'items'
][
number
];
type
MenuItem
=
Required
<
MenuProps
>
[
'items'
][
number
];
...
@@ -30,11 +31,9 @@ export function MenuView() {
...
@@ -30,11 +31,9 @@ export function MenuView() {
// 点击侧边栏事件 onSelect改为onClick
// 点击侧边栏事件 onSelect改为onClick
const
onSelect
:
MenuProps
[
'onClick'
]
=
(
keys
)
=>
{
const
onSelect
:
MenuProps
[
'onClick'
]
=
(
keys
)
=>
{
setSelectedKeys
([
keys
.
key
]);
setSelectedKeys
([
keys
.
key
]);
// setSelectedKeys(keys.selectedKeys);
const
id
=
Number
(
keys
.
key
);
const
id
=
Number
(
keys
.
key
);
const
current
=
GetRouteByID
(
id
,
routerList
);
const
current
:
routerItem
|
undefined
=
GetRouteByID
(
id
,
routerList
);
// console.log(current?.path);
navigate
({
pathname
:
current
?.
path
});
if
(
current
)
navigate
(
current
?.
path
);
};
};
// 递归将路由转换为侧边栏数据
// 递归将路由转换为侧边栏数据
const
getItem
=
(
routerList
:
RouteObjectType
[])
=>
{
const
getItem
=
(
routerList
:
RouteObjectType
[])
=>
{
...
@@ -61,7 +60,7 @@ export function MenuView() {
...
@@ -61,7 +60,7 @@ export function MenuView() {
// 组件挂载
// 组件挂载
useEffect
(()
=>
{
useEffect
(()
=>
{
// 设置侧边栏数据
// 设置侧边栏数据
setItems
(
getItem
(
routerList
));
setItems
(
getItem
(
authRouterList
()
));
// 设置当前选中的项目
// 设置当前选中的项目
setOpenKeys
([
getRoutePid
(
routerList
,
location
.
pathname
).
toString
()]);
setOpenKeys
([
getRoutePid
(
routerList
,
location
.
pathname
).
toString
()]);
// 设置当前选中的项目的subMenu
// 设置当前选中的项目的subMenu
...
@@ -84,13 +83,6 @@ export function MenuView() {
...
@@ -84,13 +83,6 @@ export function MenuView() {
items=
{
items
}
items=
{
items
}
style=
{
{
backgroundColor
:
' #F3F6FF '
}
}
style=
{
{
backgroundColor
:
' #F3F6FF '
}
}
/>
/>
{
/* <div className="sider-collapsed" onClick={() => setCollapsed(!collapsed)}> */
}
{
/* <Button */
}
{
/* className="collapsed-icon" */
}
{
/* type="link" */
}
{
/* icon={collapsed ? <RightOutlined /> : <LeftOutlined />} */
}
{
/* /> */
}
{
/* </div> */
}
</
Sider
>
</
Sider
>
);
);
}
}
src/components/layout/title/index.tsx
浏览文件 @
49f9520f
...
@@ -5,6 +5,7 @@ import { Button, Dropdown, MenuProps, Modal } from 'antd';
...
@@ -5,6 +5,7 @@ import { Button, Dropdown, MenuProps, Modal } from 'antd';
import
Logo
from
'../../../assets/icon/logo_big.png'
;
import
Logo
from
'../../../assets/icon/logo_big.png'
;
import
'./index.scss'
;
import
'./index.scss'
;
import
{
REMOVE_MENU
,
REMOVE_MENU_ID
,
SET_COLLAPSE
}
from
'~/store/module/menu'
;
import
{
REMOVE_MENU
,
REMOVE_MENU_ID
,
SET_COLLAPSE
}
from
'~/store/module/menu'
;
import
{
REMOVE_ROLE_LIST
}
from
'~/store/module/userInfo'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
Cookies
from
'js-cookie'
;
import
Cookies
from
'js-cookie'
;
...
@@ -41,6 +42,7 @@ export function TitleView() {
...
@@ -41,6 +42,7 @@ export function TitleView() {
Cookies
.
remove
(
'SHAREFLY-TOKEN'
);
Cookies
.
remove
(
'SHAREFLY-TOKEN'
);
dispatch
(
REMOVE_MENU
());
dispatch
(
REMOVE_MENU
());
dispatch
(
REMOVE_MENU_ID
());
dispatch
(
REMOVE_MENU_ID
());
dispatch
(
REMOVE_ROLE_LIST
());
},
},
});
});
}
}
}
}
...
...
src/pages/common/login/index.tsx
浏览文件 @
49f9520f
...
@@ -6,15 +6,13 @@ import Cookies from 'js-cookie';
...
@@ -6,15 +6,13 @@ import Cookies from 'js-cookie';
import
'./index.scss'
;
import
'./index.scss'
;
import
{
InterReqType
}
from
'~/api/interface'
;
import
{
InterReqType
}
from
'~/api/interface'
;
import
{
BackEndLoginType
}
from
'~/api/interface/commonType'
;
import
{
BackEndLoginType
}
from
'~/api/interface/commonType'
;
import
{
CommonAPI
}
from
'~/api'
;
import
{
CommonAPI
,
SystemManageAPI
}
from
'~/api'
;
import
{
useDispatch
}
from
'react-redux'
;
import
{
useDispatch
}
from
'react-redux'
;
import
{
SET_USERINFO
}
from
'~/store/module/userInfo'
;
import
{
SET_USERINFO
,
SET_ROLE_LIST
}
from
'~/store/module/userInfo'
;
import
{
authRouterList
}
from
'~/router'
;
import
{
authRouterList
}
from
'~/router'
;
// 请求的类型
// 请求的类型
type
ReqType
=
InterReqType
<
BackEndLoginType
>
;
type
ReqType
=
InterReqType
<
BackEndLoginType
>
;
// 返回的类型
// type ResType = InterDataType<BackEndLoginType>;
function
LoginView
()
{
function
LoginView
()
{
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/ban-ts-comment
// eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/ban-ts-comment
...
@@ -39,21 +37,17 @@ function LoginView() {
...
@@ -39,21 +37,17 @@ function LoginView() {
Cookies
.
set
(
'remember'
,
String
(
values
?.
remember
));
Cookies
.
set
(
'remember'
,
String
(
values
?.
remember
));
// 存用户信息
// 存用户信息
dispatch
(
SET_USERINFO
(
res
.
result
));
dispatch
(
SET_USERINFO
(
res
.
result
));
// 获取用户的权限
SystemManageAPI
.
getListRoleMenuInfo
({
roleId
:
res
.
result
.
roleInfo
.
id
}).
then
(({
result
})
=>
{
await
getFirstRoute
();
dispatch
(
SET_ROLE_LIST
(
result
));
// console.log('SXTB_TOKEN --->', Cookies.get('SXTB-TOKEN'));
const
routeList
=
authRouterList
(
result
);
// 获取第一个路由
navigate
({
pathname
:
routeList
[
0
]?.
children
?.[
0
]?.
path
});
});
}
else
{
}
else
{
message
.
error
(
'登录失败,请检查账号信息'
);
message
.
error
(
'登录失败,请检查账号信息'
);
}
}
};
};
// 获取第一个路由
const
getFirstRoute
=
()
=>
{
// 获取可用的路由表
const
routeList
=
authRouterList
();
// 获取第一个路由
navigate
(
routeList
[
0
]?.
children
?.[
0
]?.
path
);
// console.log('获取第一个路由--->', routeList[0]?.children?.[0]?.path);
};
// componentDidMount
// componentDidMount
useEffect
(()
=>
{
useEffect
(()
=>
{
// 是否保存密码
// 是否保存密码
...
...
src/pages/orderManage/pilotTrainingOrder/index.tsx
0 → 100644
浏览文件 @
49f9520f
import
SearchBox
,
{
searchColumns
}
from
'~/components/search-box'
;
import
{
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
const
PilotTrainingOrder
=
()
=>
{
const
search
:
searchColumns
[]
=
[
{
label
:
'买家账号'
,
placeholder
:
'请输入买家账号'
,
name
:
''
,
type
:
'input'
},
{
label
:
'订单编号'
,
placeholder
:
'请输入买家账号'
,
name
:
''
,
type
:
'input'
},
];
const
tableColumns
:
ColumnsType
<
any
>
=
[
{
title
:
'序号'
,
align
:
'center'
,
},
{
title
:
'机构名称'
,
align
:
'center'
,
},
{
title
:
'商品名称'
,
align
:
'center'
,
},
{
title
:
'商品图片'
,
align
:
'center'
,
},
{
title
:
'订单金额'
,
align
:
'center'
,
},
{
title
:
'买家信息'
,
align
:
'center'
,
},
{
title
:
'订单状态'
,
align
:
'center'
,
},
{
title
:
'订单编号'
,
align
:
'center'
,
},
{
title
:
'备注'
,
align
:
'center'
,
},
{
title
:
'操作'
,
align
:
'center'
,
},
];
return
(
<
div
className=
'pilot-train-order'
>
<
SearchBox
search=
{
search
}
/>
<
Table
bordered
columns=
{
tableColumns
}
/>
</
div
>
);
};
export
default
PilotTrainingOrder
;
src/pages/pilotTraining/ licensureExamination/addOrEditInstitution/components/baseInfo/index.tsx
0 → 100644
浏览文件 @
49f9520f
import
{
Form
}
from
'antd'
;
const
BaseInfo
=
()
=>
{
return
(
<
Form
>
<
Form
.
Item
label=
'机构主图'
></
Form
.
Item
>
<
Form
.
Item
label=
'机构副图'
></
Form
.
Item
>
<
Form
.
Item
label=
'机构视频'
></
Form
.
Item
>
<
Form
.
Item
label=
'机构名称'
></
Form
.
Item
>
<
Form
.
Item
label=
'机构地区'
></
Form
.
Item
>
<
Form
.
Item
label=
'考点机构'
></
Form
.
Item
>
<
Form
.
Item
label=
'机构规模'
></
Form
.
Item
>
<
Form
.
Item
label=
'机构描述'
></
Form
.
Item
>
</
Form
>
);
};
export
default
BaseInfo
;
src/pages/pilotTraining/ licensureExamination/addOrEditInstitution/index.tsx
0 → 100644
浏览文件 @
49f9520f
import
BaseInfo
from
'./components/baseInfo'
;
const
AddOrEditInstitution
=
()
=>
{
return
(
<
div
className=
'institution-form'
>
<
BaseInfo
/>
</
div
>
);
};
export
default
AddOrEditInstitution
;
src/pages/pilotTraining/ licensureExamination/institutionsList/index.tsx
0 → 100644
浏览文件 @
49f9520f
import
SearchBox
,
{
searchColumns
}
from
'~/components/search-box'
;
import
{
Button
,
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
useNavigate
}
from
'react-router-dom'
;
const
InstitutionsList
=
()
=>
{
const
navigate
=
useNavigate
();
const
search
:
searchColumns
[]
=
[
{
label
:
'机构名称'
,
name
:
''
,
placeholder
:
'请输入机构名称'
,
type
:
'input'
},
{
label
:
'培训类型'
,
name
:
''
,
placeholder
:
'请选择培训类型'
,
type
:
'select'
,
options
:
[]
},
{
label
:
'选择日期'
,
name
:
''
,
placeholder
:
'请选择日期'
,
type
:
'rangePicker'
,
options
:
[]
},
];
const
tableColumns
:
ColumnsType
<
any
>
=
[
{
title
:
'序号'
,
align
:
'center'
,
},
{
title
:
'机构名称'
,
align
:
'center'
,
},
{
title
:
'培训类型'
,
align
:
'center'
,
},
{
title
:
'创建日期'
,
align
:
'center'
,
},
{
title
:
'操作'
,
align
:
'center'
,
},
];
const
toAddInstitutions
=
()
=>
{
navigate
(
'/pilotTraining/institutionsList/add'
);
};
return
(
<
div
className=
'institutions-list'
>
<
SearchBox
search=
{
search
}
child=
{
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
'primary'
onClick=
{
toAddInstitutions
}
>
新增
</
Button
>
}
/>
<
Table
bordered
columns=
{
tableColumns
}
/>
</
div
>
);
};
export
default
InstitutionsList
;
src/pages/systemManage/accountManage/comp/addEditModal/index.tsx
浏览文件 @
49f9520f
...
@@ -14,6 +14,7 @@ interface propType {
...
@@ -14,6 +14,7 @@ interface propType {
open
:
boolean
;
open
:
boolean
;
closed
:
any
;
closed
:
any
;
data
?:
TableType
[
0
];
data
?:
TableType
[
0
];
roleList
:
{
label
:
string
;
value
:
number
}[];
}
}
const
AddEditModal
:
React
.
FC
<
propType
>
=
(
props
)
=>
{
const
AddEditModal
:
React
.
FC
<
propType
>
=
(
props
)
=>
{
AddEditModal
.
defaultProps
=
{
AddEditModal
.
defaultProps
=
{
...
@@ -77,7 +78,8 @@ const AddEditModal: React.FC<propType> = (props) => {
...
@@ -77,7 +78,8 @@ const AddEditModal: React.FC<propType> = (props) => {
if
(
!
data
)
return
;
if
(
!
data
)
return
;
form
.
setFieldsValue
({
form
.
setFieldsValue
({
...
data
,
...
data
,
companyId
:
companyList
.
find
((
i
)
=>
i
.
label
===
data
.
companyName
)?.
value
||
undefined
,
companyId
:
companyList
.
find
((
i
)
=>
i
.
label
===
data
.
companyName
)?.
value
,
roleId
:
data
.
roleInfoDTO
.
id
,
});
});
},
[
companyList
]);
},
[
companyList
]);
return
(
return
(
...
@@ -147,7 +149,7 @@ const AddEditModal: React.FC<propType> = (props) => {
...
@@ -147,7 +149,7 @@ const AddEditModal: React.FC<propType> = (props) => {
<
Select
<
Select
placeholder=
{
'请选择角色'
}
placeholder=
{
'请选择角色'
}
style=
{
{
width
:
'168px'
}
}
style=
{
{
width
:
'168px'
}
}
options=
{
[{
value
:
1
,
label
:
'超级管理员'
}]
}
options=
{
props
.
roleList
}
/>
/>
</
Form
.
Item
>
</
Form
.
Item
>
</
Col
>
</
Col
>
...
...
src/pages/systemManage/accountManage/index.tsx
浏览文件 @
49f9520f
...
@@ -36,6 +36,8 @@ function AccountManageView() {
...
@@ -36,6 +36,8 @@ function AccountManageView() {
current
:
1
,
current
:
1
,
totalPage
:
0
,
totalPage
:
0
,
});
});
//角色列表
const
[
roleList
,
setRoleList
]
=
useState
<
{
label
:
string
;
value
:
number
}[]
>
([]);
// 加载列表
// 加载列表
const
getTableList
=
async
(
value
=
{})
=>
{
const
getTableList
=
async
(
value
=
{})
=>
{
// 只需要修改这个地方的接口即可
// 只需要修改这个地方的接口即可
...
@@ -87,10 +89,17 @@ function AccountManageView() {
...
@@ -87,10 +89,17 @@ function AccountManageView() {
const
getEditAuth
=
(
value
:
TableType
[
0
])
=>
{
const
getEditAuth
=
(
value
:
TableType
[
0
])
=>
{
return
value
.
companyInfoVO
.
id
!==
userInfo
.
companyInfoVO
.
id
&&
userInfo
.
companyInfoVO
.
id
!==
1
;
return
value
.
companyInfoVO
.
id
!==
userInfo
.
companyInfoVO
.
id
&&
userInfo
.
companyInfoVO
.
id
!==
1
;
};
};
//角色列表
const
getRoleList
=
()
=>
{
SystemManageAPI
.
getListRoleInfoPage
({
pageNo
:
1
,
pageSize
:
9999
}).
then
(({
result
})
=>
{
setRoleList
((
result
.
list
||
[]).
map
((
v
)
=>
({
value
:
v
.
id
,
label
:
v
.
roleName
})));
});
};
// componentDidMount
// componentDidMount
useEffect
(()
=>
{
useEffect
(()
=>
{
query
=
{};
query
=
{};
getTableList
().
then
();
getTableList
().
then
();
getRoleList
();
},
[]);
},
[]);
// 表格结构
// 表格结构
const
columns
:
ColumnsType
<
TableType
[
0
]
>
=
[
const
columns
:
ColumnsType
<
TableType
[
0
]
>
=
[
...
@@ -126,9 +135,10 @@ function AccountManageView() {
...
@@ -126,9 +135,10 @@ function AccountManageView() {
title
:
'角色'
,
title
:
'角色'
,
align
:
'center'
,
align
:
'center'
,
width
:
'10%'
,
width
:
'10%'
,
render
:
(
_text
:
string
,
record
)
=>
<
div
>
{
record
.
roleInfoDTO
.
roleName
}
</
div
>,
},
},
{
title
:
'手机号'
,
dataIndex
:
'phoneNum'
,
align
:
'center'
,
width
:
'150px'
},
{
title
:
'手机号'
,
dataIndex
:
'phoneNum'
,
align
:
'center'
,
width
:
'150px'
},
{
title
:
'邮箱'
,
align
:
'center'
,
width
:
'1
2
%'
,
dataIndex
:
'email'
},
{
title
:
'邮箱'
,
align
:
'center'
,
width
:
'1
8
%'
,
dataIndex
:
'email'
},
{
{
title
:
'备注'
,
title
:
'备注'
,
align
:
'center'
,
align
:
'center'
,
...
@@ -217,7 +227,7 @@ function AccountManageView() {
...
@@ -217,7 +227,7 @@ function AccountManageView() {
name
:
'roleId'
,
name
:
'roleId'
,
type
:
'Select'
,
type
:
'Select'
,
placeholder
:
'请选择账号角色'
,
placeholder
:
'请选择账号角色'
,
options
:
[]
,
options
:
roleList
,
},
},
{
{
label
:
'状态'
,
label
:
'状态'
,
...
@@ -271,6 +281,7 @@ function AccountManageView() {
...
@@ -271,6 +281,7 @@ function AccountManageView() {
setEditData
(
undefined
);
setEditData
(
undefined
);
paginationChange
(
pagination
.
current
,
pagination
.
pageSize
);
paginationChange
(
pagination
.
current
,
pagination
.
pageSize
);
}
}
}
}
roleList=
{
roleList
}
/>
/>
<
ChangeModal
<
ChangeModal
open=
{
changeModalVisible
}
open=
{
changeModalVisible
}
...
...
src/pages/systemManage/limitManage/limitInfo/index.tsx
浏览文件 @
49f9520f
...
@@ -45,7 +45,7 @@ const LimitInfo = () => {
...
@@ -45,7 +45,7 @@ const LimitInfo = () => {
return
data
.
reduce
((
pre
:
number
[],
cur
)
=>
{
return
data
.
reduce
((
pre
:
number
[],
cur
)
=>
{
pre
.
push
(
cur
.
id
);
pre
.
push
(
cur
.
id
);
if
(
cur
.
children
)
{
if
(
cur
.
children
)
{
pre
.
push
(...
get
Child
Keys
(
cur
.
children
));
pre
.
push
(...
get
All
Keys
(
cur
.
children
));
}
}
return
pre
;
return
pre
;
},
[]);
},
[]);
...
...
src/router/index.ts
浏览文件 @
49f9520f
import
{
createBrowserRouter
,
RouteObject
}
from
'react-router-dom'
;
import
{
RouteObject
}
from
'react-router-dom'
;
import
{
RouteObjectType
,
routerList
,
whiteRouterList
}
from
'~/router/router'
;
import
{
RouteObjectType
,
routerList
,
whiteRouterList
}
from
'~/router/router'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
listMenuInfoType
}
from
'~/api/interface/systemManageType'
;
//菜单类型
type
menuType
=
InterDataType
<
listMenuInfoType
>
;
// 获取用户权限路由列表
// 获取用户权限路由列表
export
const
authRouterList
=
()
=>
{
export
const
authRouterList
=
(
data
?:
menuType
)
=>
{
// TODO: 获取用户权限
const
roleObj
:
menuType
=
data
||
JSON
.
parse
(
localStorage
.
getItem
(
'roleObj'
)
as
string
);
// 模拟获取用户权限成功
if
(
roleObj
)
{
// 获取用户能使用的全部路由
const
ids
:
number
[]
=
getAllKeys
([
roleObj
]);
// TODO: 在此处对用户权限进行判断,返回不同的路由表
const
getRouteList
=
(
data
:
RouteObjectType
[])
=>
{
// 获取用户可用路由列表
return
data
.
reduce
((
pre
:
RouteObjectType
[],
cur
)
=>
{
return
[...
routerList
];
if
(
ids
.
includes
(
cur
.
meta
.
id
)
||
cur
.
meta
.
hidden
)
{
if
(
cur
.
children
)
{
cur
.
children
=
getRouteList
(
cur
.
children
);
}
pre
.
push
(
cur
);
}
return
pre
;
},
[]);
};
return
[...
getRouteList
(
routerList
)];
}
return
[];
};
//获取全部节点
const
getAllKeys
=
(
data
:
menuType
[])
=>
{
return
data
.
reduce
((
pre
:
number
[],
cur
)
=>
{
pre
.
push
(
cur
.
id
);
if
(
cur
.
children
)
{
pre
.
push
(...
getAllKeys
(
cur
.
children
));
}
return
pre
;
},
[]);
};
};
// 整合路由数据
// 整合路由数据
export
const
routes
=
[...
authRouterList
(),
...
whiteRouterList
];
export
const
routes
=
[...
authRouterList
(),
...
whiteRouterList
];
// 导出路由表
export
const
router
=
createBrowserRouter
(
routes
);
// 路由表类型
// 路由表类型
export
type
routerItem
=
RouteObject
&
RouteObjectType
;
export
type
routerItem
=
RouteObject
&
RouteObjectType
;
src/router/privateRouter.tsx
浏览文件 @
49f9520f
import
{
authRouterList
,
router
}
from
'~/router/index'
;
import
{
routes
}
from
'~/router/index'
;
import
{
RouterProvider
}
from
'react-router-dom'
;
import
{
createBrowserRouter
,
RouterProvider
}
from
'react-router-dom'
;
import
{
useEffect
}
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
Cookies
from
'js-cookie'
;
import
Cookies
from
'js-cookie'
;
import
{
message
}
from
'antd'
;
function
PrivateRouter
()
{
function
PrivateRouter
()
{
// 路由钩子
const
[
router
,
setRouter
]
=
useState
(
createBrowserRouter
(
routes
));
// const location = useLocation();
// 在切换路由之前判断
// 在切换路由之前判断
const
beforeEach
=
()
=>
{
const
beforeEach
=
()
=>
{
// TODO: 判断是否登录 (需要改为实时获取地址栏的路由)
// TODO: 判断是否登录 (需要改为实时获取地址栏的路由)
...
@@ -16,17 +14,12 @@ function PrivateRouter() {
...
@@ -16,17 +14,12 @@ function PrivateRouter() {
location
.
replace
(
'/login'
);
location
.
replace
(
'/login'
);
return
;
return
;
}
}
// 如果该用户没有权限,跳转到登录页
if
(
authRouterList
().
length
===
0
)
{
message
.
info
(
'请先配置权限!'
,
2000
).
then
(()
=>
{
location
.
replace
(
'/login'
);
});
return
;
}
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
beforeEach
();
beforeEach
();
setRouter
(
createBrowserRouter
(
routes
));
//不同账号登录时,重新更新路由(有瑕疵)
},
[
location
.
pathname
]);
},
[
location
.
pathname
]);
return
<
RouterProvider
router=
{
router
}
/>;
return
<
RouterProvider
router=
{
router
}
/>;
}
}
...
...
src/router/router.tsx
浏览文件 @
49f9520f
...
@@ -72,6 +72,7 @@ const ServiceOrderView = React.lazy(() => import('src/pages/orderManage/serviceO
...
@@ -72,6 +72,7 @@ const ServiceOrderView = React.lazy(() => import('src/pages/orderManage/serviceO
const
ProductOrderDetail
=
React
.
lazy
(()
=>
import
(
'~/pages/orderManage/productOrder/detail'
));
const
ProductOrderDetail
=
React
.
lazy
(()
=>
import
(
'~/pages/orderManage/productOrder/detail'
));
const
ServiceOrderDetail
=
React
.
lazy
(()
=>
import
(
'~/pages/orderManage/serviceOrder/detail'
));
const
ServiceOrderDetail
=
React
.
lazy
(()
=>
import
(
'~/pages/orderManage/serviceOrder/detail'
));
const
EquipmentOrderDetail
=
React
.
lazy
(()
=>
import
(
'~/pages/orderManage/equipmentOrder/detail'
));
const
EquipmentOrderDetail
=
React
.
lazy
(()
=>
import
(
'~/pages/orderManage/equipmentOrder/detail'
));
const
PilotTrainingOrderView
=
React
.
lazy
(()
=>
import
(
'~/pages/orderManage/pilotTrainingOrder'
));
//商品管理
//商品管理
import
CourseManageView
from
'~/pages/mallManage/courseManage'
;
//课程管理
import
CourseManageView
from
'~/pages/mallManage/courseManage'
;
//课程管理
...
@@ -101,6 +102,15 @@ const CategoryDetail = React.lazy(() => import('~/pages/categoryManage/category/
...
@@ -101,6 +102,15 @@ const CategoryDetail = React.lazy(() => import('~/pages/categoryManage/category/
// 目录管理
// 目录管理
const
DirectoryManage
=
React
.
lazy
(()
=>
import
(
'~/pages/categoryManage/directoryManage'
));
const
DirectoryManage
=
React
.
lazy
(()
=>
import
(
'~/pages/categoryManage/directoryManage'
));
//飞手培训
const
InstitutionsListView
=
React
.
lazy
(
()
=>
import
(
'~/pages/pilotTraining/ licensureExamination/institutionsList'
),
);
//机构上传
const
AddInstitutionsView
=
React
.
lazy
(
()
=>
import
(
'~/pages/pilotTraining/ licensureExamination/addOrEditInstitution'
),
);
// 系统管理
// 系统管理
import
AccountManageView
from
'~/pages/systemManage/accountManage'
;
import
AccountManageView
from
'~/pages/systemManage/accountManage'
;
import
TenderManageView
from
'~/pages/resourceManage/tenderManage'
;
import
TenderManageView
from
'~/pages/resourceManage/tenderManage'
;
...
@@ -411,6 +421,15 @@ export const routerList: Array<RouteObjectType> = [
...
@@ -411,6 +421,15 @@ export const routerList: Array<RouteObjectType> = [
hidden
:
true
,
hidden
:
true
,
},
},
},
},
{
path
:
'/orderManage/pilotTrainingOrder'
,
element
:
withLoadingComponent
(<
PilotTrainingOrderView
/>),
meta
:
{
id
:
10040
,
title
:
'培训订单'
,
icon
:
<
CreditCardOutlined
/>,
},
},
],
],
},
},
{
{
...
@@ -832,6 +851,36 @@ export const routerList: Array<RouteObjectType> = [
...
@@ -832,6 +851,36 @@ export const routerList: Array<RouteObjectType> = [
// ],
// ],
// },
// },
{
{
path
:
'/pilotTraining'
,
element
:
<
LayoutView
/>,
errorElement
:
<
ErrorPage
/>,
meta
:
{
id
:
1500
,
icon
:
<
SettingOutlined
/>,
title
:
'飞手培训'
,
},
children
:
[
{
path
:
'/pilotTraining/institutionsList'
,
element
:
withLoadingComponent
(<
InstitutionsListView
/>),
meta
:
{
id
:
1510
,
title
:
'执照考试'
,
icon
:
<
UserOutlined
/>,
},
},
{
path
:
'/pilotTraining/institutionsList/add'
,
element
:
withLoadingComponent
(<
AddInstitutionsView
/>),
meta
:
{
id
:
1520
,
title
:
'机构上传'
,
icon
:
<
UserOutlined
/>,
},
},
],
},
{
path
:
'/systemManage'
,
path
:
'/systemManage'
,
element
:
<
LayoutView
/>,
element
:
<
LayoutView
/>,
errorElement
:
<
ErrorPage
/>,
errorElement
:
<
ErrorPage
/>,
...
...
src/store/module/userInfo/index.ts
浏览文件 @
49f9520f
...
@@ -2,6 +2,8 @@ import { createSlice } from '@reduxjs/toolkit';
...
@@ -2,6 +2,8 @@ import { createSlice } from '@reduxjs/toolkit';
const
initialState
=
{
const
initialState
=
{
userInfo
:
JSON
.
parse
(
localStorage
.
getItem
(
'SXTB-ADMIN-USER-INFO'
)
as
string
)
||
[],
userInfo
:
JSON
.
parse
(
localStorage
.
getItem
(
'SXTB-ADMIN-USER-INFO'
)
as
string
)
||
[],
roleId
:
-
1
,
roleList
:
[],
};
};
export
const
userInfoSlice
=
createSlice
({
export
const
userInfoSlice
=
createSlice
({
...
@@ -12,9 +14,20 @@ export const userInfoSlice = createSlice({
...
@@ -12,9 +14,20 @@ export const userInfoSlice = createSlice({
state
.
userInfo
=
action
.
payload
;
state
.
userInfo
=
action
.
payload
;
localStorage
.
setItem
(
'SXTB-ADMIN-USER-INFO'
,
JSON
.
stringify
(
action
.
payload
));
localStorage
.
setItem
(
'SXTB-ADMIN-USER-INFO'
,
JSON
.
stringify
(
action
.
payload
));
},
},
SET_ROLE_ID
(
state
,
action
)
{
state
.
roleId
=
action
.
payload
;
localStorage
.
setItem
(
'roleId'
,
action
.
payload
);
},
SET_ROLE_LIST
(
state
,
action
)
{
state
.
roleList
=
action
.
payload
;
localStorage
.
setItem
(
'roleObj'
,
JSON
.
stringify
(
action
.
payload
));
},
REMOVE_ROLE_LIST
()
{
localStorage
.
removeItem
(
'roleObj'
);
},
},
},
});
});
export
const
{
SET_USERINFO
}
=
userInfoSlice
.
actions
;
export
const
{
SET_USERINFO
,
SET_ROLE_ID
,
SET_ROLE_LIST
,
REMOVE_ROLE_LIST
}
=
userInfoSlice
.
actions
;
export
const
UserInfo
=
userInfoSlice
.
reducer
;
export
const
UserInfo
=
userInfoSlice
.
reducer
;
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论