Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
admin-ci-test
Commits
a972921a
提交
a972921a
authored
7月 31, 2023
作者:
龚洪江
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复:路由缓存,加盟入驻地址可选
上级
e79e1c55
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
90 行增加
和
50 行删除
+90
-50
systemManageType.ts
src/api/interface/systemManageType.ts
+6
-0
index.tsx
src/components/layout/title/index.tsx
+2
-4
index.tsx
...age/companyManage/companyList/comp/addEditModal/index.tsx
+69
-13
index.ts
src/router/index.ts
+5
-5
privateRouter.tsx
src/router/privateRouter.tsx
+1
-1
index.ts
src/store/module/menu/index.ts
+6
-9
index.ts
src/store/module/userInfo/index.ts
+1
-18
没有找到文件。
src/api/interface/systemManageType.ts
浏览文件 @
a972921a
...
...
@@ -130,6 +130,8 @@ export type listCompanyPage = InterListFunction<
phoneNum
:
string
;
province
:
string
;
remark
:
string
;
lat
:
number
;
lon
:
number
;
}
>
;
// 单位-新增
...
...
@@ -147,6 +149,8 @@ export type listCompanyAdd = InterFunction<
province
?:
string
;
remark
?:
string
;
area
?:
string
[];
lat
:
number
;
lon
:
number
;
},
NonNullable
<
unknown
>
>
;
...
...
@@ -165,6 +169,8 @@ export type listCompanyUpdate = InterFunction<
province
?:
string
;
remark
?:
string
;
area
?:
string
[];
lat
:
number
;
lon
:
number
;
},
NonNullable
<
unknown
>
>
;
...
...
src/components/layout/title/index.tsx
浏览文件 @
a972921a
...
...
@@ -5,7 +5,6 @@ import { Button, Dropdown, MenuProps, Modal } from 'antd';
import
Logo
from
'../../../assets/icon/logo_big.png'
;
import
'./index.scss'
;
import
{
REMOVE_MENU
,
REMOVE_MENU_ID
,
SET_COLLAPSE
}
from
'~/store/module/menu'
;
import
{
REMOVE_ROLE_ID
}
from
'~/store/module/userInfo'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
Cookies
from
'js-cookie'
;
...
...
@@ -42,7 +41,6 @@ export function TitleView() {
Cookies
.
remove
(
'SHAREFLY-TOKEN'
);
dispatch
(
REMOVE_MENU
());
dispatch
(
REMOVE_MENU_ID
());
dispatch
(
REMOVE_ROLE_ID
());
},
});
}
}
...
...
@@ -62,8 +60,8 @@ export function TitleView() {
}
}
>
<
div
className=
'layout-logo'
>
<
img
className=
'logo-img'
src=
{
Logo
}
alt=
'云享飞'
/>
<
div
className=
'logo-text'
>
云享飞后台管理
</
div
>
<
img
src=
{
userInfo
.
companyInfoVO
.
brandLogo
||
Logo
}
className=
'logo-img'
alt=
'云享飞'
/>
<
div
className=
'logo-text'
>
{
userInfo
.
companyInfoVO
.
brandName
||
'云享飞管理后台'
}
</
div
>
<
div
onClick=
{
setMenuCollapsed
}
>
<
svg
className=
{
`hamburger ${isActive ? 'is-active' : ''}`
}
...
...
src/pages/systemManage/companyManage/companyList/comp/addEditModal/index.tsx
浏览文件 @
a972921a
import
React
,
{
useEffect
}
from
'react'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
InterListType
,
InterReqType
}
from
'~/api/interface'
;
import
{
listCompanyAdd
,
listCompanyPage
}
from
'~/api/interface/systemManageType'
;
import
{
Form
,
Input
,
message
,
Modal
}
from
'antd'
;
import
{
Button
,
Col
,
Form
,
Input
,
message
,
Modal
,
Row
}
from
'antd'
;
import
{
SystemManageAPI
}
from
'~/api'
;
import
{
EnvironmentOutlined
}
from
'@ant-design/icons'
;
import
SelectMap
from
'~/components/select-map'
;
// 列表的类型
type
TableType
=
InterListType
<
listCompanyPage
>
;
// 请求的表单类型
type
ReqType
=
InterReqType
<
listCompanyAd
d
>
;
type
ReqType
=
Exclude
<
InterReqType
<
listCompanyAdd
>
,
undefine
d
>
;
// 传参类型
interface
propType
{
title
:
string
;
...
...
@@ -20,6 +22,15 @@ const AddEditModal: React.FC<propType> = (props) => {
const
{
title
,
open
,
closed
,
data
}
=
props
;
/// 表单钩子
const
[
form
]
=
Form
.
useForm
<
ReqType
>
();
//选点信息
const
[
position
,
setPosition
]
=
useState
<
{
lat
:
number
;
lon
:
number
;
address
:
string
;
}
>
();
//地图选点弹窗
const
[
selectMapShow
,
setSelectMapShow
]
=
useState
<
boolean
>
(
false
);
// 关闭弹窗
const
handleCancel
=
()
=>
{
form
.
resetFields
();
...
...
@@ -30,13 +41,14 @@ const AddEditModal: React.FC<propType> = (props) => {
form
.
validateFields
()
.
then
(
async
(
values
)
=>
{
await
handleSubmit
({
...
values
,
province
:
values
?.
area
?.
at
(
0
),
city
:
values
?.
area
?.
at
(
1
),
district
:
values
?.
area
?.
at
(
2
),
companyType
:
data
?.
id
===
1
?
0
:
1
,
});
if
(
position
)
{
await
handleSubmit
({
...
values
,
lat
:
position
.
lat
,
lon
:
position
.
lon
,
companyType
:
data
?.
id
===
1
?
0
:
1
,
});
}
})
.
catch
((
err
)
=>
{
message
...
...
@@ -57,6 +69,26 @@ const AddEditModal: React.FC<propType> = (props) => {
handleCancel
();
}
};
const
selectMapShowClick
=
()
=>
{
setSelectMapShow
(
true
);
};
const
selectMapClose
=
()
=>
{
setSelectMapShow
(
false
);
};
const
selectMapSubmit
=
(
value
:
{
lat
:
number
;
lon
:
number
;
address
:
string
})
=>
{
form
.
setFieldValue
(
'address'
,
value
.
address
);
setPosition
(
value
);
setSelectMapShow
(
false
);
};
const
addressInputEvent
=
(
e
:
any
)
=>
{
if
(
position
)
{
position
.
address
=
e
.
target
.
value
;
form
.
setFieldValue
(
'address'
,
e
.
target
.
value
||
undefined
);
setPosition
({
...
position
});
}
};
// componentDidMount
useEffect
(()
=>
{
if
(
!
open
)
return
;
...
...
@@ -65,9 +97,12 @@ const AddEditModal: React.FC<propType> = (props) => {
// @ts-ignore
form
.
setFieldsValue
({
...
data
,
area
:
[
data
?.
province
,
data
?.
city
,
data
?.
district
],
});
// console.log('data --->', data);
setPosition
({
address
:
data
.
address
,
lat
:
data
.
lat
,
lon
:
data
.
lon
,
});
},
[
open
]);
return
(
<
Modal
...
...
@@ -114,7 +149,27 @@ const AddEditModal: React.FC<propType> = (props) => {
name=
'address'
rules=
{
[{
required
:
true
,
message
:
'请输入详细地址'
}]
}
>
<
Input
.
TextArea
placeholder=
'请输入详细地址'
maxLength=
{
50
}
showCount
/>
{
/*<Input.TextArea placeholder='请输入详细地址' maxLength={50} showCount />*/
}
<
Row
justify=
'space-between'
>
{
position
?
(
<
Col
span=
{
21
}
>
<
Input
placeholder=
'请输入详细地址'
value=
{
position
.
address
}
onChange=
{
addressInputEvent
}
/>
</
Col
>
)
:
(
''
)
}
<
Col
span=
{
2
}
>
<
Button
icon=
{
<
EnvironmentOutlined
/>
}
type=
'primary'
onClick=
{
selectMapShowClick
}
></
Button
>
</
Col
>
</
Row
>
</
Form
.
Item
>
<
Form
.
Item
label=
'联系人'
name=
'companyUserName'
>
<
Input
placeholder=
'请输入联系人'
maxLength=
{
15
}
/>
...
...
@@ -138,6 +193,7 @@ const AddEditModal: React.FC<propType> = (props) => {
<
Form
.
Item
label=
'备注'
name=
'remark'
>
<
Input
.
TextArea
placeholder=
'请输入备注'
maxLength=
{
50
}
showCount
/>
</
Form
.
Item
>
<
SelectMap
open=
{
selectMapShow
}
closed=
{
selectMapClose
}
submit=
{
selectMapSubmit
}
/>
</
Form
>
</
Modal
>
);
...
...
src/router/index.ts
浏览文件 @
a972921a
...
...
@@ -3,15 +3,15 @@ import { RouteObjectType, routerList } from '~/router/router';
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
listMenuInfoType
}
from
'~/api/interface/systemManageType'
;
import
{
SystemManageAPI
}
from
'~/api'
;
import
{
store
}
from
'~/store'
;
import
{
SET_MENU
}
from
'~/store/module/menu'
;
//菜单类型
type
menuType
=
InterDataType
<
listMenuInfoType
>
;
// 缓存路由列表
let
routerListStore
:
any
[]
=
[];
// 获取用户权限路由列表
export
const
authRouterList
=
async
()
=>
{
// 如果缓存中没有数据
if
(
routerListStore
.
length
===
0
)
{
if
(
store
.
getState
().
Menu
.
menuList
.
length
===
0
)
{
// 加载路由数据
const
{
result
}
=
await
SystemManageAPI
.
getListRoleMenuInfo
({
roleId
:
Number
(
localStorage
.
getItem
(
'roleId'
)),
...
...
@@ -31,11 +31,11 @@ export const authRouterList = async () => {
};
const
arr
=
[...
getRouteList
(
routerList
)];
// 将路由数据存到store中
routerListStore
=
arr
;
store
.
dispatch
(
SET_MENU
(
arr
))
;
// 完成后返回路由数据
return
Promise
.
resolve
(
arr
);
}
else
{
return
Promise
.
resolve
(
routerListStore
);
return
Promise
.
resolve
(
store
.
getState
().
Menu
.
menuList
);
}
};
//获取全部节点
...
...
src/router/privateRouter.tsx
浏览文件 @
a972921a
...
...
@@ -26,7 +26,7 @@ function PrivateRouter() {
const
routes
=
[...
value
,
...
whiteRouterList
];
setRouter
(
routes
);
if
(
path
===
'/'
)
{
navigate
({
pathname
:
value
[
0
].
children
.
find
((
v
:
any
)
=>
!
v
.
meta
.
hidden
)?.
path
});
navigate
({
pathname
:
value
[
0
].
children
?
.
find
((
v
:
any
)
=>
!
v
.
meta
.
hidden
)?.
path
});
}
}
else
{
message
.
warning
(
'该账号暂无权限'
);
...
...
src/store/module/menu/index.ts
浏览文件 @
a972921a
import
{
createSlice
}
from
'@reduxjs/toolkit'
;
const
initialState
=
{
menuList
:
JSON
.
parse
(
localStorage
.
getItem
(
'SXTB-ADMIN-MENU-LIST'
)
as
string
)
||
[],
menuList
:
[],
collapsedActive
:
false
,
menuId
:
JSON
.
parse
(
localStorage
.
getItem
(
'SXTB-ADMIN-MENU-ID'
)
as
string
)
||
null
,
roleId
:
localStorage
.
getItem
(
'roleId'
)
||
-
1
,
};
export
const
menuSlice
=
createSlice
({
...
...
@@ -12,22 +12,19 @@ export const menuSlice = createSlice({
reducers
:
{
SET_MENU
(
state
,
action
)
{
state
.
menuList
=
action
.
payload
;
localStorage
.
setItem
(
'SXTB-ADMIN-MENU-LIST'
,
JSON
.
stringify
(
action
.
payload
));
},
SET_COLLAPSE
(
state
,
action
)
{
state
.
collapsedActive
=
action
.
payload
;
},
REMOVE_MENU
(
state
)
{
localStorage
.
setItem
(
'SXTB-ADMIN-MENU-LIST'
,
JSON
.
stringify
([]));
state
.
menuList
=
[];
},
SET_MENU_ID
(
state
,
action
)
{
localStorage
.
setItem
(
'SXTB-ADMIN-MENU-ID'
,
JSON
.
stringify
(
action
.
payload
))
;
state
.
menuId
=
action
.
payload
;
state
.
roleId
=
action
.
payload
;
localStorage
.
setItem
(
'roleId'
,
action
.
payload
)
;
},
REMOVE_MENU_ID
(
state
)
{
localStorage
.
setItem
(
'SXTB-ADMIN-MENU-ID'
,
JSON
.
stringify
(
null
));
state
.
menuId
=
null
;
REMOVE_MENU_ID
()
{
localStorage
.
removeItem
(
'roleId'
);
},
},
});
...
...
src/store/module/userInfo/index.ts
浏览文件 @
a972921a
...
...
@@ -2,8 +2,6 @@ import { createSlice } from '@reduxjs/toolkit';
const
initialState
=
{
userInfo
:
JSON
.
parse
(
localStorage
.
getItem
(
'SXTB-ADMIN-USER-INFO'
)
as
string
)
||
[],
roleId
:
-
1
,
roleList
:
[],
};
export
const
userInfoSlice
=
createSlice
({
...
...
@@ -14,24 +12,9 @@ export const userInfoSlice = createSlice({
state
.
userInfo
=
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
);
},
REMOVE_ROLE_ID
()
{
localStorage
.
removeItem
(
'roleId'
);
},
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
,
SET_ROLE_ID
,
SET_ROLE_LIST
,
REMOVE_ROLE_LIST
,
REMOVE_ROLE_ID
}
=
userInfoSlice
.
actions
;
export
const
{
SET_USERINFO
}
=
userInfoSlice
.
actions
;
export
const
UserInfo
=
userInfoSlice
.
reducer
;
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论