Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-cr20g
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
dsk-cr20g
Commits
a2130fca
Commit
a2130fca
authored
Aug 28, 2023
by
huangjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
切换租户
parent
7daeddb5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
11 deletions
+23
-11
Navbar.vue
dsk-operate-ui/src/layout/components/Navbar.vue
+8
-6
user.js
dsk-operate-ui/src/store/modules/user.js
+2
-1
login.vue
dsk-operate-ui/src/views/login.vue
+13
-4
No files found.
dsk-operate-ui/src/layout/components/Navbar.vue
View file @
a2130fca
...
@@ -85,8 +85,8 @@ export default {
...
@@ -85,8 +85,8 @@ export default {
methods
:
{
methods
:
{
getTetant
(){
getTetant
(){
this
.
tenantId
=
getTenantid
()
this
.
tenantId
=
getTenantid
()
//
getTenants(localStorage.getItem('userphone')).then(res=>{
getTenants
(
localStorage
.
getItem
(
'userphone'
)).
then
(
res
=>
{
getTenants
(
'15823584612'
).
then
(
res
=>
{
//
getTenants('15823584612').then(res=>{
if
(
res
.
code
==
200
){
if
(
res
.
code
==
200
){
this
.
tenanlist
=
res
.
data
this
.
tenanlist
=
res
.
data
}
}
...
@@ -104,12 +104,14 @@ export default {
...
@@ -104,12 +104,14 @@ export default {
}).
catch
(()
=>
{});
}).
catch
(()
=>
{});
},
},
getorther
(
id
){
getorther
(
id
){
setTenantid
(
id
)
changeTenants
(
id
).
then
(
res
=>
{
changeTenants
(
id
).
then
(
res
=>
{
setToken
(
res
.
data
.
accessToken
)
if
(
res
.
code
==
200
){
setToken
(
res
.
data
.
accessToken
)
setTenantid
(
id
)
location
.
reload
();
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
}
})
})
location
.
reload
();
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
}
}
}
}
}
}
...
...
dsk-operate-ui/src/store/modules/user.js
View file @
a2130fca
import
{
login
,
logout
,
getInfo
}
from
'@/api/login'
import
{
login
,
logout
,
getInfo
}
from
'@/api/login'
import
{
getToken
,
setToken
,
removeToken
}
from
'@/utils/auth'
import
{
getToken
,
setToken
,
removeToken
,
setTenantid
}
from
'@/utils/auth'
const
user
=
{
const
user
=
{
state
:
{
state
:
{
...
@@ -47,6 +47,7 @@ const user = {
...
@@ -47,6 +47,7 @@ const user = {
login
(
username
,
password
,
code
,
uuid
).
then
(
res
=>
{
login
(
username
,
password
,
code
,
uuid
).
then
(
res
=>
{
setToken
(
res
.
data
.
token
)
setToken
(
res
.
data
.
token
)
commit
(
'SET_TOKEN'
,
res
.
data
.
token
)
commit
(
'SET_TOKEN'
,
res
.
data
.
token
)
setTenantid
(
res
.
data
.
tenantId
)
resolve
()
resolve
()
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
reject
(
error
)
reject
(
error
)
...
...
dsk-operate-ui/src/views/login.vue
View file @
a2130fca
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getCodeImg
,
getTenants
}
from
"@/api/login"
;
import
{
getCodeImg
,
getTenants
,
changeTenants
}
from
"@/api/login"
;
import
Cookies
from
"js-cookie"
;
import
Cookies
from
"js-cookie"
;
import
{
encrypt
,
decrypt
}
from
'@/utils/jsencrypt'
import
{
encrypt
,
decrypt
}
from
'@/utils/jsencrypt'
import
{
setTenantid
}
from
'@/utils/auth'
import
{
setTenantid
}
from
'@/utils/auth'
...
@@ -155,7 +155,9 @@ export default {
...
@@ -155,7 +155,9 @@ export default {
}
}
this
.
$store
.
dispatch
(
"Login"
,
this
.
loginForm
).
then
(()
=>
{
this
.
$store
.
dispatch
(
"Login"
,
this
.
loginForm
).
then
(()
=>
{
localStorage
.
setItem
(
'userphone'
,
this
.
loginForm
.
username
)
localStorage
.
setItem
(
'userphone'
,
this
.
loginForm
.
username
)
this
.
goin
()
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
// this.goin()
}).
catch
(()
=>
{
}).
catch
(()
=>
{
this
.
loading
=
false
;
this
.
loading
=
false
;
if
(
this
.
captchaEnabled
)
{
if
(
this
.
captchaEnabled
)
{
...
@@ -174,14 +176,21 @@ export default {
...
@@ -174,14 +176,21 @@ export default {
this
.
islog
=
true
this
.
islog
=
true
}
else
{
}
else
{
setTenantid
(
this
.
tenanlist
[
0
].
tenantId
)
setTenantid
(
this
.
tenanlist
[
0
].
tenantId
)
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
this
.
changeTenants
(
this
.
tenanlist
[
0
].
tenantId
)
}
}
}
}
})
})
},
},
tochose
(){
tochose
(){
setTenantid
(
this
.
tenantId
)
setTenantid
(
this
.
tenantId
)
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
this
.
changeTenants
(
this
.
tenantId
)
},
changeTenants
(
tenantId
){
changeTenants
(
tenantId
).
then
(
res
=>
{
if
(
res
.
code
==
200
){
this
.
$router
.
push
({
path
:
this
.
redirect
||
"/"
}).
catch
(()
=>
{});
}
})
},
},
}
}
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment