Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
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
ops
luna
Commits
fea3b651
Unverified
Commit
fea3b651
authored
Jan 11, 2018
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: auto login
parent
022e66bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
26 deletions
+45
-26
cleftbar.component.ts
src/app/ControlPage/cleftbar/cleftbar.component.ts
+45
-26
No files found.
src/app/ControlPage/cleftbar/cleftbar.component.ts
View file @
fea3b651
...
...
@@ -120,34 +120,39 @@ export class CleftbarComponent implements OnInit {
const
that
=
this
;
if
(
host
.
system_users_granted
.
length
>
1
)
{
let
options
=
''
;
for
(
let
u
of
host
.
system_users_granted
)
{
options
+=
'<option value="'
+
u
.
id
+
'">'
+
u
.
username
+
'</option>'
;
}
layer
.
open
({
title
:
'Please Choose a User'
,
scrollbar
:
false
,
moveOut
:
true
,
moveType
:
1
,
btn
:
[
'确定'
,
'取消'
],
content
:
'<select id="selectuser">'
+
options
+
'</select>'
,
yes
:
function
(
index
,
layero
)
{
let
userid
=
jQuery
(
'#selectuser'
).
val
();
for
(
let
i
of
host
.
system_users_granted
)
{
if
(
i
.
id
.
toString
()
===
userid
.
toString
())
{
user
=
i
;
break
;
user
=
this
.
checkPriority
(
host
.
system_users_granted
);
if
(
user
)
{
this
.
login
(
host
,
user
);
}
else
{
for
(
let
u
of
host
.
system_users_granted
)
{
options
+=
'<option value="'
+
u
.
id
+
'">'
+
u
.
username
+
'</option>'
;
}
layer
.
open
({
title
:
'Please Choose a User'
,
scrollbar
:
false
,
moveOut
:
true
,
moveType
:
1
,
btn
:
[
'确定'
,
'取消'
],
content
:
'<select id="selectuser">'
+
options
+
'</select>'
,
yes
:
function
(
index
,
layero
)
{
const
userid
=
jQuery
(
'#selectuser'
).
val
();
for
(
let
i
of
host
.
system_users_granted
)
{
if
(
i
.
id
.
toString
()
===
userid
.
toString
())
{
user
=
i
;
break
;
}
}
that
.
login
(
host
,
user
);
layer
.
close
(
index
);
},
btn2
:
function
(
index
,
layero
)
{
},
cancel
:
function
()
{
// 右上角关闭回调
// return false 开启该代码可禁止点击该按钮关闭
}
that
.
login
(
host
,
user
);
layer
.
close
(
index
);
},
btn2
:
function
(
index
,
layero
)
{
},
cancel
:
function
()
{
// 右上角关闭回调
// return false 开启该代码可禁止点击该按钮关闭
}
});
});
}
}
else
if
(
host
.
system_users_granted
.
length
===
1
)
{
user
=
host
.
system_users_granted
[
0
];
this
.
login
(
host
,
user
);
...
...
@@ -183,6 +188,20 @@ export class CleftbarComponent implements OnInit {
// }
}
checkPriority
(
sysUsers
)
{
let
priority
:
number
=
-
1
;
let
user
:
any
;
for
(
let
u
of
sysUsers
)
{
if
(
u
.
priority
>
priority
)
{
user
=
u
;
priority
=
u
.
priority
;
}
else
if
(
u
.
priority
===
priority
)
{
return
null
;
}
}
return
user
;
}
Search
(
q
)
{
this
.
_search
.
Search
(
q
);
}
...
...
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