Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
2e8055f7
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,发现更多精彩内容 >>
提交
2e8055f7
编写于
2月 28, 2020
作者:
C
Captain.B
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use localStorage
上级
85e3556a
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
15 addition
and
23 deletion
+15
-23
frontend/package.json
frontend/package.json
+1
-2
frontend/src/login/Login.vue
frontend/src/login/Login.vue
+1
-2
frontend/src/performance/components/HeaderUser.vue
frontend/src/performance/components/HeaderUser.vue
+5
-6
frontend/src/performance/components/settings/CurrentUser.vue
frontend/src/performance/components/settings/CurrentUser.vue
+1
-2
frontend/src/performance/components/settings/Member.vue
frontend/src/performance/components/settings/Member.vue
+1
-2
frontend/src/performance/components/settings/OrganizationMember.vue
...rc/performance/components/settings/OrganizationMember.vue
+2
-2
frontend/src/performance/components/settings/OrganizationWorkspace.vue
...performance/components/settings/OrganizationWorkspace.vue
+1
-2
frontend/src/performance/components/settings/PersonSetting.vue
...end/src/performance/components/settings/PersonSetting.vue
+2
-3
frontend/src/performance/permission.js
frontend/src/performance/permission.js
+1
-2
未找到文件。
frontend/package.json
浏览文件 @
2e8055f7
...
...
@@ -18,8 +18,7 @@
"vue"
:
"^2.6.10"
,
"vue-i18n"
:
"^8.15.3"
,
"vue-router"
:
"^3.1.3"
,
"vuex"
:
"^3.1.2"
,
"js-cookie"
:
"^2.2.0"
"vuex"
:
"^3.1.2"
},
"devDependencies"
:
{
"@vue/cli-plugin-babel"
:
"^4.1.0"
,
...
...
frontend/src/login/Login.vue
浏览文件 @
2e8055f7
...
...
@@ -43,7 +43,6 @@
</
template
>
<
script
>
import
Cookies
from
'
js-cookie
'
;
import
{
TokenKey
}
from
'
../common/constants
'
;
...
...
@@ -109,7 +108,7 @@
if
(
valid
)
{
this
.
$post
(
"
signin
"
,
this
.
form
,
(
response
)
=>
{
// 登录信息保存 cookie
Cookies
.
set
(
TokenKey
,
response
.
data
);
localStorage
.
setItem
(
TokenKey
,
JSON
.
stringify
(
response
.
data
)
);
let
rolesArray
=
response
.
data
.
roles
;
let
roles
=
rolesArray
.
map
(
r
=>
r
.
id
);
// 保存角色
...
...
frontend/src/performance/components/HeaderUser.vue
浏览文件 @
2e8055f7
...
...
@@ -42,7 +42,6 @@
</template>
<
script
>
import
Cookies
from
'
js-cookie
'
;
import
{
ROLE_ORG_ADMIN
,
ROLE_TEST_MANAGER
,
ROLE_TEST_USER
,
ROLE_TEST_VIEWER
,
TokenKey
}
from
'
../../common/constants
'
;
export
default
{
...
...
@@ -60,7 +59,7 @@
{
index
:
'
2-1
'
,
name
:
'
无工作空间
'
},
],
currentUserInfo
:
{},
currentUserId
:
JSON
.
parse
(
Cookies
.
get
(
TokenKey
)).
id
,
currentUserId
:
JSON
.
parse
(
localStorage
.
getItem
(
TokenKey
)).
id
,
workspaceIds
:
[],
currentOrganizationName
:
'
选择组织
'
,
currentWorkspaceName
:
'
选择工作空间
'
...
...
@@ -68,7 +67,7 @@
},
computed
:
{
currentUser
:
()
=>
{
let
user
=
Cookies
.
get
(
TokenKey
);
let
user
=
localStorage
.
getItem
(
TokenKey
);
// window.console.log(user);
return
JSON
.
parse
(
user
);
}
...
...
@@ -81,7 +80,7 @@
break
;
case
"
logout
"
:
this
.
$get
(
"
/signout
"
,
function
()
{
Cookies
.
remove
(
TokenKey
);
localStorage
.
removeItem
(
TokenKey
);
window
.
location
.
href
=
"
/login
"
;
});
break
;
...
...
@@ -129,7 +128,7 @@
let
orgId
=
data
.
id
;
let
sign
=
"
organization
"
;
this
.
$post
(
"
/user/switch/source/
"
+
sign
+
"
/
"
+
orgId
,
{},
response
=>
{
Cookies
.
set
(
TokenKey
,
response
.
data
);
localStorage
.
setItem
(
TokenKey
,
JSON
.
stringify
(
response
.
data
)
);
window
.
location
.
reload
();
})
},
...
...
@@ -141,7 +140,7 @@
return
false
;
}
this
.
$post
(
"
/user/switch/source/
"
+
sign
+
"
/
"
+
workspaceId
,
{},
response
=>
{
Cookies
.
set
(
TokenKey
,
response
.
data
);
localStorage
.
setItem
(
TokenKey
,
JSON
.
stringify
(
response
.
data
)
);
window
.
location
.
reload
();
})
}
...
...
frontend/src/performance/components/settings/CurrentUser.vue
浏览文件 @
2e8055f7
...
...
@@ -21,7 +21,6 @@
</
template
>
<
script
>
import
Cookies
from
'
js-cookie
'
;
import
{
TokenKey
}
from
"
../../../common/constants
"
;
export
default
{
...
...
@@ -46,7 +45,7 @@
},
computed
:
{
currentUser
:
()
=>
{
let
user
=
Cookies
.
get
(
TokenKey
);
let
user
=
localStorage
.
getItem
(
TokenKey
);
return
JSON
.
parse
(
user
);
}
}
...
...
frontend/src/performance/components/settings/Member.vue
浏览文件 @
2e8055f7
...
...
@@ -114,7 +114,6 @@
<
script
>
import
MsCreateBox
from
"
./CreateBox
"
;
import
Cookies
from
'
js-cookie
'
;
import
{
TokenKey
}
from
"
../../../common/constants
"
;
export
default
{
...
...
@@ -149,7 +148,7 @@
},
methods
:
{
currentUser
:
()
=>
{
let
user
=
Cookies
.
get
(
TokenKey
);
let
user
=
localStorage
.
getItem
(
TokenKey
);
return
JSON
.
parse
(
user
);
},
initTableData
()
{
...
...
frontend/src/performance/components/settings/OrganizationMember.vue
浏览文件 @
2e8055f7
...
...
@@ -113,8 +113,8 @@
<
script
>
import
MsCreateBox
from
"
./CreateBox
"
;
import
Cookies
from
'
js-cookie
'
;
import
{
TokenKey
}
from
"
../../../common/constants
"
;
export
default
{
name
:
"
MsOrganizationMember
"
,
components
:
{
MsCreateBox
},
...
...
@@ -147,7 +147,7 @@
},
methods
:
{
currentUser
:
()
=>
{
let
user
=
Cookies
.
get
(
TokenKey
);
let
user
=
localStorage
.
getItem
(
TokenKey
);
return
JSON
.
parse
(
user
);
},
initTableData
()
{
...
...
frontend/src/performance/components/settings/OrganizationWorkspace.vue
浏览文件 @
2e8055f7
...
...
@@ -60,7 +60,6 @@
<
script
>
import
MsCreateBox
from
"
./CreateBox
"
;
import
Cookies
from
'
js-cookie
'
;
import
{
Message
}
from
"
element-ui
"
;
import
{
TokenKey
}
from
"
../../../common/constants
"
;
...
...
@@ -72,7 +71,7 @@
},
computed
:
{
currentUser
:
()
=>
{
let
user
=
Cookies
.
get
(
TokenKey
);
let
user
=
localStorage
.
getItem
(
TokenKey
);
window
.
console
.
log
(
user
);
return
JSON
.
parse
(
user
);
}
...
...
frontend/src/performance/components/settings/PersonSetting.vue
浏览文件 @
2e8055f7
...
...
@@ -50,7 +50,6 @@
</template>
<
script
>
import
Cookies
from
'
js-cookie
'
;
import
{
TokenKey
}
from
"
../../../common/constants
"
;
export
default
{
...
...
@@ -98,7 +97,7 @@
},
methods
:
{
currentUser
:
()
=>
{
let
user
=
Cookies
.
get
(
TokenKey
);
let
user
=
localStorage
.
getItem
(
TokenKey
);
return
JSON
.
parse
(
user
);
},
edit
(
row
)
{
...
...
@@ -113,7 +112,7 @@
type
:
'
success
'
,
message
:
'
修改成功!
'
});
Cookies
.
set
(
TokenKey
,
response
.
data
);
localStorage
.
setItem
(
TokenKey
,
JSON
.
stringify
(
response
.
data
)
);
this
.
updateVisible
=
false
;
this
.
initTableData
();
window
.
location
.
reload
();
...
...
frontend/src/performance/permission.js
浏览文件 @
2e8055f7
import
router
from
'
./components/router/router
'
import
Cookies
from
'
js-cookie
'
// get token from cookie
import
{
TokenKey
}
from
'
../common/constants
'
;
const
whiteList
=
[
'
/login
'
];
// no redirect whitelist
...
...
@@ -26,7 +25,7 @@ export const permission = {
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
// determine whether the user has logged in
const
user
=
JSON
.
parse
(
Cookies
.
get
(
TokenKey
));
const
user
=
JSON
.
parse
(
localStorage
.
getItem
(
TokenKey
));
if
(
user
)
{
if
(
to
.
path
===
'
/login
'
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录