Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
5abece2d
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 大约 3 年
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5abece2d
编写于
5月 11, 2020
作者:
S
shiziyuan9527
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化工作空间和组织相关部分
上级
c1e60626
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
128 addition
and
19 deletion
+128
-19
backend/src/main/java/io/metersphere/controller/OrganizationController.java
...ava/io/metersphere/controller/OrganizationController.java
+4
-0
backend/src/main/java/io/metersphere/controller/UserController.java
...c/main/java/io/metersphere/controller/UserController.java
+19
-11
backend/src/main/java/io/metersphere/controller/WorkspaceController.java
...n/java/io/metersphere/controller/WorkspaceController.java
+5
-1
backend/src/main/java/io/metersphere/service/UserService.java
...end/src/main/java/io/metersphere/service/UserService.java
+19
-0
frontend/src/business/components/settings/organization/OrganizationWorkspace.vue
...omponents/settings/organization/OrganizationWorkspace.vue
+8
-1
frontend/src/business/components/settings/system/Organization.vue
.../src/business/components/settings/system/Organization.vue
+18
-0
frontend/src/business/components/settings/system/SystemWorkspace.vue
...c/business/components/settings/system/SystemWorkspace.vue
+15
-0
frontend/src/common/js/constants.js
frontend/src/common/js/constants.js
+5
-0
frontend/src/common/js/utils.js
frontend/src/common/js/utils.js
+35
-6
未找到文件。
backend/src/main/java/io/metersphere/controller/OrganizationController.java
浏览文件 @
5abece2d
...
...
@@ -9,6 +9,7 @@ import io.metersphere.commons.utils.Pager;
import
io.metersphere.controller.request.OrganizationRequest
;
import
io.metersphere.dto.OrganizationMemberDTO
;
import
io.metersphere.service.OrganizationService
;
import
io.metersphere.service.UserService
;
import
org.apache.shiro.authz.annotation.Logical
;
import
org.apache.shiro.authz.annotation.RequiresRoles
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -22,6 +23,8 @@ public class OrganizationController {
@Resource
private
OrganizationService
organizationService
;
@Resource
private
UserService
userService
;
@PostMapping
(
"/add"
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
...
...
@@ -45,6 +48,7 @@ public class OrganizationController {
@GetMapping
(
"/delete/{organizationId}"
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
public
void
deleteOrganization
(
@PathVariable
(
value
=
"organizationId"
)
String
organizationId
)
{
userService
.
refreshSessionUser
(
"organization"
,
organizationId
);
organizationService
.
deleteOrganization
(
organizationId
);
}
...
...
backend/src/main/java/io/metersphere/controller/UserController.java
浏览文件 @
5abece2d
...
...
@@ -23,6 +23,7 @@ import org.apache.shiro.authz.annotation.Logical;
import
org.apache.shiro.authz.annotation.RequiresRoles
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
...
...
@@ -115,7 +116,7 @@ public class UserController {
// admin api
@GetMapping
(
"/list"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ADMIN
,
RoleConstants
.
ORG_ADMIN
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ADMIN
,
RoleConstants
.
ORG_ADMIN
},
logical
=
Logical
.
OR
)
public
List
<
User
>
getUserList
()
{
return
userService
.
getUserList
();
}
...
...
@@ -132,17 +133,24 @@ public class UserController {
@PostMapping
(
"/switch/source/org/{sourceId}"
)
@RequiresRoles
(
RoleConstants
.
ORG_ADMIN
)
public
UserDTO
switchOrganization
(
@PathVariable
(
value
=
"sourceId"
)
String
sourceId
)
{
userService
.
switchUserRole
(
"organization"
,
sourceId
);
userService
.
switchUserRole
(
"organization"
,
sourceId
);
return
SessionUtils
.
getUser
();
}
@PostMapping
(
"/switch/source/ws/{sourceId}"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
TEST_MANAGER
,
RoleConstants
.
TEST_VIEWER
,
RoleConstants
.
TEST_USER
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
RoleConstants
.
TEST_MANAGER
,
RoleConstants
.
TEST_VIEWER
,
RoleConstants
.
TEST_USER
},
logical
=
Logical
.
OR
)
public
UserDTO
switchWorkspace
(
@PathVariable
(
value
=
"sourceId"
)
String
sourceId
)
{
userService
.
switchUserRole
(
"workspace"
,
sourceId
);
return
SessionUtils
.
getUser
();
}
@PostMapping
(
"/refresh/{sign}/{sourceId}"
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
public
UserDTO
refreshSessionUser
(
@PathVariable
String
sign
,
@PathVariable
String
sourceId
)
{
userService
.
refreshSessionUser
(
sign
,
sourceId
);
return
SessionUtils
.
getUser
();
}
@GetMapping
(
"/info/{userId}"
)
public
User
getUserInfo
(
@PathVariable
(
value
=
"userId"
)
String
userId
)
{
return
userService
.
getUserInfo
(
userId
);
...
...
@@ -152,8 +160,8 @@ public class UserController {
* 获取工作空间成员用户
*/
@PostMapping
(
"/ws/member/list/{goPage}/{pageSize}"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ORG_ADMIN
,
RoleConstants
.
TEST_MANAGER
,
RoleConstants
.
TEST_USER
,
RoleConstants
.
TEST_VIEWER
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ORG_ADMIN
,
RoleConstants
.
TEST_MANAGER
,
RoleConstants
.
TEST_USER
,
RoleConstants
.
TEST_VIEWER
},
logical
=
Logical
.
OR
)
public
Pager
<
List
<
User
>>
getMemberList
(
@PathVariable
int
goPage
,
@PathVariable
int
pageSize
,
@RequestBody
QueryMemberRequest
request
)
{
Page
<
Object
>
page
=
PageHelper
.
startPage
(
goPage
,
pageSize
,
true
);
return
PageUtils
.
setPageInfo
(
page
,
userService
.
getMemberList
(
request
));
...
...
@@ -163,8 +171,8 @@ public class UserController {
* 获取工作空间成员用户 不分页
*/
@PostMapping
(
"/ws/member/list/all"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ORG_ADMIN
,
RoleConstants
.
TEST_MANAGER
,
RoleConstants
.
TEST_USER
,
RoleConstants
.
TEST_VIEWER
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ORG_ADMIN
,
RoleConstants
.
TEST_MANAGER
,
RoleConstants
.
TEST_USER
,
RoleConstants
.
TEST_VIEWER
},
logical
=
Logical
.
OR
)
public
List
<
User
>
getMemberList
(
@RequestBody
QueryMemberRequest
request
)
{
return
userService
.
getMemberList
(
request
);
}
...
...
@@ -173,7 +181,7 @@ public class UserController {
* 添加工作空间成员
*/
@PostMapping
(
"/ws/member/add"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
TEST_MANAGER
,
RoleConstants
.
ORG_ADMIN
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
RoleConstants
.
TEST_MANAGER
,
RoleConstants
.
ORG_ADMIN
},
logical
=
Logical
.
OR
)
public
void
addMember
(
@RequestBody
AddMemberRequest
request
)
{
String
wsId
=
request
.
getWorkspaceId
();
workspaceService
.
checkWorkspaceOwner
(
wsId
);
...
...
@@ -184,7 +192,7 @@ public class UserController {
* 删除工作空间成员
*/
@GetMapping
(
"/ws/member/delete/{workspaceId}/{userId}"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
TEST_MANAGER
,
RoleConstants
.
ORG_ADMIN
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
RoleConstants
.
TEST_MANAGER
,
RoleConstants
.
ORG_ADMIN
},
logical
=
Logical
.
OR
)
public
void
deleteMember
(
@PathVariable
String
workspaceId
,
@PathVariable
String
userId
)
{
workspaceService
.
checkWorkspaceOwner
(
workspaceId
);
String
currentUserId
=
SessionUtils
.
getUser
().
getId
();
...
...
@@ -222,7 +230,7 @@ public class UserController {
* 查询组织成员列表
*/
@PostMapping
(
"/org/member/list/{goPage}/{pageSize}"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ORG_ADMIN
,
RoleConstants
.
TEST_MANAGER
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ORG_ADMIN
,
RoleConstants
.
TEST_MANAGER
},
logical
=
Logical
.
OR
)
public
Pager
<
List
<
User
>>
getOrgMemberList
(
@PathVariable
int
goPage
,
@PathVariable
int
pageSize
,
@RequestBody
QueryOrgMemberRequest
request
)
{
Page
<
Object
>
page
=
PageHelper
.
startPage
(
goPage
,
pageSize
,
true
);
return
PageUtils
.
setPageInfo
(
page
,
userService
.
getOrgMemberList
(
request
));
...
...
@@ -232,7 +240,7 @@ public class UserController {
* 组织成员列表不分页
*/
@PostMapping
(
"/org/member/list/all"
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ORG_ADMIN
,
RoleConstants
.
TEST_MANAGER
},
logical
=
Logical
.
OR
)
@RequiresRoles
(
value
=
{
RoleConstants
.
ORG_ADMIN
,
RoleConstants
.
TEST_MANAGER
},
logical
=
Logical
.
OR
)
public
List
<
User
>
getOrgMemberList
(
@RequestBody
QueryOrgMemberRequest
request
)
{
return
userService
.
getOrgMemberList
(
request
);
}
...
...
backend/src/main/java/io/metersphere/controller/WorkspaceController.java
浏览文件 @
5abece2d
...
...
@@ -10,12 +10,12 @@ import io.metersphere.controller.request.WorkspaceRequest;
import
io.metersphere.dto.WorkspaceDTO
;
import
io.metersphere.dto.WorkspaceMemberDTO
;
import
io.metersphere.service.OrganizationService
;
import
io.metersphere.service.UserService
;
import
io.metersphere.service.WorkspaceService
;
import
io.metersphere.user.SessionUtils
;
import
org.apache.shiro.authz.annotation.Logical
;
import
org.apache.shiro.authz.annotation.RequiresRoles
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
...
...
@@ -26,6 +26,8 @@ public class WorkspaceController {
private
WorkspaceService
workspaceService
;
@Resource
private
OrganizationService
organizationService
;
@Resource
private
UserService
userService
;
@PostMapping
(
"add"
)
@RequiresRoles
(
RoleConstants
.
ORG_ADMIN
)
...
...
@@ -57,6 +59,7 @@ public class WorkspaceController {
@GetMapping
(
"special/delete/{workspaceId}"
)
@RequiresRoles
(
RoleConstants
.
ADMIN
)
public
void
deleteWorkspaceByAdmin
(
@PathVariable
String
workspaceId
)
{
userService
.
refreshSessionUser
(
"workspace"
,
workspaceId
);
workspaceService
.
deleteWorkspace
(
workspaceId
);
}
...
...
@@ -64,6 +67,7 @@ public class WorkspaceController {
@RequiresRoles
(
RoleConstants
.
ORG_ADMIN
)
public
void
deleteWorkspace
(
@PathVariable
String
workspaceId
)
{
workspaceService
.
checkWorkspaceOwnerByOrgAdmin
(
workspaceId
);
userService
.
refreshSessionUser
(
"workspace"
,
workspaceId
);
workspaceService
.
deleteWorkspace
(
workspaceId
);
}
...
...
backend/src/main/java/io/metersphere/service/UserService.java
浏览文件 @
5abece2d
...
...
@@ -256,4 +256,23 @@ public class UserService {
SessionUtils
.
getUser
().
setLanguage
(
lang
);
}
}
public
void
refreshSessionUser
(
String
sign
,
String
sourceId
)
{
SessionUser
sessionUser
=
SessionUtils
.
getUser
();
// 获取最新UserDTO
UserDTO
user
=
getUserDTO
(
sessionUser
.
getId
());
User
newUser
=
new
User
();
if
(
StringUtils
.
equals
(
"organization"
,
sign
)
&&
StringUtils
.
equals
(
sourceId
,
user
.
getLastOrganizationId
()))
{
user
.
setLastOrganizationId
(
""
);
user
.
setLastWorkspaceId
(
""
);
}
if
(
StringUtils
.
equals
(
"workspace"
,
sign
)
&&
StringUtils
.
equals
(
sourceId
,
user
.
getLastWorkspaceId
()))
{
user
.
setLastWorkspaceId
(
""
);
}
BeanUtils
.
copyProperties
(
user
,
newUser
);
SessionUtils
.
putUser
(
SessionUser
.
fromUser
(
user
));
userMapper
.
updateByPrimaryKeySelective
(
newUser
);
}
}
frontend/src/business/components/settings/organization/OrganizationWorkspace.vue
浏览文件 @
5abece2d
...
...
@@ -145,12 +145,13 @@
<
script
>
import
MsCreateBox
from
"
../CreateBox
"
;
import
{
Message
}
from
"
element-ui
"
;
import
{
TokenKey
}
from
"
../../../../common/js/constants
"
;
import
{
DEFAULT
,
TokenKey
}
from
"
../../../../common/js/constants
"
;
import
MsTablePagination
from
"
../../common/pagination/TablePagination
"
;
import
MsTableHeader
from
"
../../common/components/MsTableHeader
"
;
import
MsRolesTag
from
"
../../common/components/MsRolesTag
"
;
import
MsTableOperator
from
"
../../common/components/MsTableOperator
"
;
import
MsDialogFooter
from
"
../../common/components/MsDialogFooter
"
;
import
{
getCurrentWorkspaceId
,
refreshSessionAndCookies
}
from
"
../../../../common/js/utils
"
;
export
default
{
name
:
"
MsOrganizationWorkspace
"
,
...
...
@@ -197,6 +198,12 @@
type
:
'
warning
'
}).
then
(()
=>
{
this
.
$get
(
'
/workspace/delete/
'
+
row
.
id
,
()
=>
{
let
lastWorkspaceId
=
getCurrentWorkspaceId
();
let
sourceId
=
row
.
id
;
if
(
lastWorkspaceId
===
sourceId
)
{
let
sign
=
DEFAULT
;
refreshSessionAndCookies
(
sign
,
sourceId
);
}
this
.
$success
(
this
.
$t
(
'
commons.delete_success
'
));
this
.
list
();
});
...
...
frontend/src/business/components/settings/system/Organization.vue
浏览文件 @
5abece2d
...
...
@@ -175,6 +175,8 @@
import
MsRolesTag
from
"
../../common/components/MsRolesTag
"
;
import
MsTableOperator
from
"
../../common/components/MsTableOperator
"
;
import
MsDialogFooter
from
"
../../common/components/MsDialogFooter
"
;
import
{
getCurrentOrganizationId
,
getCurrentUser
,
refreshSessionAndCookies
}
from
"
../../../../common/js/utils
"
;
import
{
DEFAULT
,
ORGANIZATION
}
from
"
../../../../common/js/constants
"
;
export
default
{
name
:
"
MsOrganization
"
,
...
...
@@ -311,6 +313,12 @@
type
:
'
warning
'
}).
then
(()
=>
{
this
.
result
=
this
.
$get
(
this
.
deletePath
+
row
.
id
,
()
=>
{
let
lastOrganizationId
=
getCurrentOrganizationId
();
let
sourceId
=
row
.
id
;
if
(
lastOrganizationId
===
sourceId
)
{
let
sign
=
DEFAULT
;
refreshSessionAndCookies
(
sign
,
sourceId
);
}
this
.
$success
(
this
.
$t
(
'
commons.delete_success
'
));
this
.
initTableData
();
});
...
...
@@ -325,6 +333,13 @@
type
:
'
warning
'
}).
then
(()
=>
{
this
.
result
=
this
.
$get
(
'
/user/special/org/member/delete/
'
+
this
.
currentRow
.
id
+
'
/
'
+
row
.
id
,
()
=>
{
let
sourceId
=
this
.
currentRow
.
id
;
let
currentUser
=
getCurrentUser
();
let
userId
=
row
.
id
;
if
(
currentUser
.
id
===
userId
)
{
let
sign
=
ORGANIZATION
;
refreshSessionAndCookies
(
sign
,
sourceId
);
}
this
.
$success
(
this
.
$t
(
'
commons.delete_success
'
))
this
.
cellClick
(
this
.
currentRow
);
});
...
...
@@ -395,6 +410,9 @@
organizationId
:
this
.
currentRow
.
id
};
this
.
result
=
this
.
$post
(
"
user/special/org/member/add
"
,
param
,
()
=>
{
let
sign
=
"
other
"
;
let
sourceId
=
this
.
currentRow
.
id
;
refreshSessionAndCookies
(
sign
,
sourceId
);
this
.
cellClick
(
this
.
currentRow
);
this
.
dialogOrgMemberAddVisible
=
false
;
})
...
...
frontend/src/business/components/settings/system/SystemWorkspace.vue
浏览文件 @
5abece2d
...
...
@@ -195,6 +195,8 @@
import
MsRolesTag
from
"
../../common/components/MsRolesTag
"
;
import
MsTableOperator
from
"
../../common/components/MsTableOperator
"
;
import
MsDialogFooter
from
"
../../common/components/MsDialogFooter
"
;
import
{
getCurrentUser
,
getCurrentWorkspaceId
,
refreshSessionAndCookies
}
from
"
../../../../common/js/utils
"
;
import
{
DEFAULT
,
WORKSPACE
}
from
"
../../../../common/js/constants
"
;
export
default
{
name
:
"
MsSystemWorkspace
"
,
...
...
@@ -307,6 +309,12 @@
type
:
'
warning
'
}).
then
(()
=>
{
this
.
$get
(
'
/workspace/special/delete/
'
+
row
.
id
,
()
=>
{
let
lastWorkspaceId
=
getCurrentWorkspaceId
();
let
sourceId
=
row
.
id
;
if
(
lastWorkspaceId
===
sourceId
)
{
let
sign
=
DEFAULT
;
refreshSessionAndCookies
(
sign
,
sourceId
);
}
Message
.
success
(
this
.
$t
(
'
commons.delete_success
'
));
this
.
list
();
});
...
...
@@ -374,6 +382,13 @@
type
:
'
warning
'
}).
then
(()
=>
{
this
.
result
=
this
.
$get
(
'
/user/special/ws/member/delete/
'
+
this
.
currentWorkspaceRow
.
id
+
'
/
'
+
row
.
id
,
()
=>
{
let
sourceId
=
this
.
currentWorkspaceRow
.
id
;
let
userId
=
row
.
id
;
let
user
=
getCurrentUser
();
if
(
user
.
id
===
userId
)
{
let
sign
=
WORKSPACE
;
refreshSessionAndCookies
(
sign
,
sourceId
);
}
this
.
$success
(
this
.
$t
(
'
commons.delete_success
'
));
this
.
cellClick
(
this
.
currentWorkspaceRow
);
});
...
...
frontend/src/common/js/constants.js
浏览文件 @
5abece2d
...
...
@@ -8,3 +8,8 @@ export const ROLE_TEST_VIEWER = 'test_viewer';
export
const
WORKSPACE_ID
=
'
workspace_id
'
;
export
const
CURRENT_PROJECT
=
'
current_project
'
;
export
const
REFRESH_SESSION_USER_URL
=
'
user/refresh
'
;
export
const
WORKSPACE
=
'
workspace
'
;
export
const
ORGANIZATION
=
'
organization
'
;
export
const
DEFAULT
=
'
default
'
;
frontend/src/common/js/utils.js
浏览文件 @
5abece2d
import
{
ROLE_ORG_ADMIN
,
ROLE_TEST_MANAGER
,
ROLE_TEST_USER
,
ROLE_TEST_VIEWER
,
TokenKey
}
from
"
./constants
"
;
import
{
REFRESH_SESSION_USER_URL
,
ROLE_ORG_ADMIN
,
ROLE_TEST_MANAGER
,
ROLE_TEST_USER
,
ROLE_TEST_VIEWER
,
TokenKey
}
from
"
./constants
"
;
import
axios
from
"
axios
"
;
export
function
hasRole
(
role
)
{
let
user
=
JSON
.
parse
(
localStorage
.
getItem
(
TokenKey
));
...
...
@@ -29,6 +37,20 @@ export function checkoutCurrentWorkspace() {
return
user
.
userRoles
.
filter
(
ur
=>
hasRoles
(
ROLE_TEST_MANAGER
,
ROLE_TEST_USER
,
ROLE_TEST_VIEWER
)
&&
user
.
lastWorkspaceId
===
ur
.
sourceId
).
length
>
0
;
}
export
function
getCurrentOrganizationId
()
{
let
user
=
JSON
.
parse
(
localStorage
.
getItem
(
TokenKey
));
return
user
.
lastOrganizationId
;
}
export
function
getCurrentWorkspaceId
()
{
let
user
=
JSON
.
parse
(
localStorage
.
getItem
(
TokenKey
));
return
user
.
lastWorkspaceId
;
}
export
function
getCurrentUser
()
{
return
JSON
.
parse
(
localStorage
.
getItem
(
TokenKey
));
}
export
function
saveLocalStorage
(
response
)
{
// 登录信息保存 cookie
localStorage
.
setItem
(
TokenKey
,
JSON
.
stringify
(
response
.
data
));
...
...
@@ -38,19 +60,26 @@ export function saveLocalStorage(response) {
localStorage
.
setItem
(
"
roles
"
,
roles
);
}
export
function
refreshSessionAndCookies
(
sign
,
sourceId
)
{
axios
.
post
(
REFRESH_SESSION_USER_URL
+
"
/
"
+
sign
+
"
/
"
+
sourceId
).
then
(
r
=>
{
saveLocalStorage
(
r
.
data
);
window
.
location
.
reload
();
})
}
export
function
jsonToMap
(
jsonStr
)
{
let
obj
=
JSON
.
parse
(
jsonStr
);
let
strMap
=
new
Map
();
for
(
let
k
of
Object
.
keys
(
obj
))
{
strMap
.
set
(
k
,
obj
[
k
]);
strMap
.
set
(
k
,
obj
[
k
]);
}
return
strMap
;
}
export
function
mapToJson
(
strMap
){
let
obj
=
Object
.
create
(
null
);
for
(
let
[
k
,
v
]
of
strMap
)
{
export
function
mapToJson
(
strMap
)
{
let
obj
=
Object
.
create
(
null
);
for
(
let
[
k
,
v
]
of
strMap
)
{
obj
[
k
]
=
v
;
}
return
JSON
.
stringify
(
obj
);
...
...
@@ -58,5 +87,5 @@ export function mapToJson(strMap){
// 驼峰转换下划线
export
function
humpToLine
(
name
)
{
return
name
.
replace
(
/
([
A-Z
])
/g
,
"
_$1
"
).
toLowerCase
();
return
name
.
replace
(
/
([
A-Z
])
/g
,
"
_$1
"
).
toLowerCase
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录