Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
attendance-performance-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
attendance-performance-platform
Commits
481aa828
Commit
481aa828
authored
Aug 24, 2023
by
姬鋆屾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tui
parent
d261530c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
127 additions
and
93 deletions
+127
-93
attendance-performance-manager-ui/admin/src/components/Header.vue
...ce-performance-manager-ui/admin/src/components/Header.vue
+7
-1
attendance-performance-manager-ui/admin/src/store.js
attendance-performance-manager-ui/admin/src/store.js
+84
-66
attendance-performance-manager-ui/admin/src/views/Home.vue
attendance-performance-manager-ui/admin/src/views/Home.vue
+7
-6
attendance-performance-manager-ui/admin/src/views/login/authentication.vue
...mance-manager-ui/admin/src/views/login/authentication.vue
+27
-18
attendance-performance-manager-ui/admin/src/views/login/login.vue
...ce-performance-manager-ui/admin/src/views/login/login.vue
+2
-2
No files found.
attendance-performance-manager-ui/admin/src/components/Header.vue
View file @
481aa828
...
...
@@ -128,6 +128,10 @@ export default {
.
then
(()
=>
{
this
.
$message
.
success
(
"
已退出登录
"
);
this
.
$store
.
commit
(
"
logout
"
);
process
.
env
.
NODE_ENV
==
"
development
"
?
this
.
$router
.
replace
(
"
/login
"
)
:
(
window
.
location
.
href
=
this
.
portal
);
return
;
this
.
$router
.
replace
(
"
/login
"
);
});
},
...
...
@@ -135,7 +139,9 @@ export default {
beforeDestroy
()
{
console
.
log
(
"
beforeDestroy
"
);
},
mounted
()
{},
mounted
()
{
this
.
$forceUpdate
(
this
.
userData
);
},
computed
:
{
group
()
{
const
relativeGroup
=
this
.
$store
.
state
.
group
;
...
...
attendance-performance-manager-ui/admin/src/store.js
View file @
481aa828
import
Vue
from
'
vue
'
import
Vuex
from
'
vuex
'
import
{
normalCallPost
}
from
'
./assets/utils
'
;
import
Vue
from
"
vue
"
;
import
Vuex
from
"
vuex
"
;
import
{
normalCallPost
}
from
"
./assets/utils
"
;
Vue
.
use
(
Vuex
)
Vue
.
use
(
Vuex
)
;
let
userData
=
{};
let
currentParentName
=
''
let
headBar
=
[]
let
CurrentThirdArr
=
[]
let
ThirdPath
=
''
let
CurrentSecondPath
=
''
let
currentParentName
=
""
;
let
headBar
=
[]
;
let
CurrentThirdArr
=
[]
;
let
ThirdPath
=
""
;
let
CurrentSecondPath
=
""
;
try
{
userData
=
JSON
.
parse
(
window
.
sessionStorage
.
userData
||
'
{}
'
);
currentParentName
=
window
.
sessionStorage
.
currentParentName
||
''
headBar
=
JSON
.
parse
(
window
.
sessionStorage
.
headBar
||
'
{}
'
)
CurrentThirdArr
=
JSON
.
parse
(
window
.
sessionStorage
.
CurrentThirdArr
||
'
{}
'
)
ThirdPath
=
window
.
sessionStorage
.
ThirdPath
||
''
CurrentSecondPath
=
window
.
sessionStorage
.
CurrentSecondPath
||
''
userData
=
JSON
.
parse
(
window
.
sessionStorage
.
userData
||
"
{}
"
);
currentParentName
=
window
.
sessionStorage
.
currentParentName
||
""
;
headBar
=
JSON
.
parse
(
window
.
sessionStorage
.
headBar
||
"
{}
"
);
CurrentThirdArr
=
JSON
.
parse
(
window
.
sessionStorage
.
CurrentThirdArr
||
"
{}
"
);
ThirdPath
=
window
.
sessionStorage
.
ThirdPath
||
""
;
CurrentSecondPath
=
window
.
sessionStorage
.
CurrentSecondPath
||
""
;
}
catch
(
error
)
{
console
.
log
(
'
未从session中获取到userData
'
)
console
.
log
(
'
未从session中获取到currentParentName
'
)
console
.
log
(
'
未从session中获取到headBar
'
)
console
.
log
(
'
未从session中获取到CurrentThirdArr
'
)
console
.
log
(
'
未从session中获取到ThirdPath
'
)
console
.
log
(
'
未从session中获取到CurrentSecondPath
'
)
console
.
log
(
"
未从session中获取到userData
"
);
console
.
log
(
"
未从session中获取到currentParentName
"
);
console
.
log
(
"
未从session中获取到headBar
"
);
console
.
log
(
"
未从session中获取到CurrentThirdArr
"
);
console
.
log
(
"
未从session中获取到ThirdPath
"
);
console
.
log
(
"
未从session中获取到CurrentSecondPath
"
);
}
function
convertTreeToList
(
root
,
array
)
{
if
(
!
root
||
!
root
.
length
)
return
array
;
root
.
forEach
(
item
=>
{
if
(
!
root
||
!
root
.
length
)
return
array
;
root
.
forEach
(
(
item
)
=>
{
let
data
=
JSON
.
parse
(
JSON
.
stringify
(
item
));
const
url
=
data
.
url
?
data
.
url
:
(
item
.
childList
[
0
]
?
(
item
.
childList
[
0
].
url
||
''
)
:
''
);
const
url
=
data
.
url
?
data
.
url
:
item
.
childList
[
0
]
?
item
.
childList
[
0
].
url
||
""
:
""
;
delete
data
.
childList
;
array
.
push
({
name
:
data
.
name
,
...
...
@@ -39,20 +43,30 @@ function convertTreeToList(root, array) {
parentId
:
data
.
parentId
,
icon
:
data
.
imgPath
,
});
if
(
item
.
childList
)
{
if
(
item
.
childList
)
{
convertTreeToList
(
item
.
childList
,
array
);
}
})
})
;
return
array
;
}
function
isPc
()
{
var
userAgentInfo
=
navigator
.
userAgent
;
var
Agents
=
new
Array
(
"
Android
"
,
"
iPhone
"
,
"
SymbianOS
"
,
"
Windows Phone
"
,
"
iPad
"
,
"
iPod
"
);
var
flag
=
true
;
for
(
var
v
=
0
;
v
<
Agents
.
length
;
v
++
)
{
if
(
userAgentInfo
.
indexOf
(
Agents
[
v
])
>
0
)
{
flag
=
false
;
break
;
}
}
var
userAgentInfo
=
navigator
.
userAgent
;
var
Agents
=
new
Array
(
"
Android
"
,
"
iPhone
"
,
"
SymbianOS
"
,
"
Windows Phone
"
,
"
iPad
"
,
"
iPod
"
);
var
flag
=
true
;
for
(
var
v
=
0
;
v
<
Agents
.
length
;
v
++
)
{
if
(
userAgentInfo
.
indexOf
(
Agents
[
v
])
>
0
)
{
flag
=
false
;
break
;
}
}
return
flag
;
}
...
...
@@ -60,27 +74,28 @@ export default new Vuex.Store({
state
:
{
isLogin
:
false
,
isMobile
:
!
isPc
(),
userData
,
//用户数据
group
:
''
,
userData
,
//用户数据
group
:
""
,
headBar
,
currentParentName
,
//当前选择一级菜单
CurrentSecondPath
,
//当前二级菜单路径
currentParentName
,
//当前选择一级菜单
CurrentSecondPath
,
//当前二级菜单路径
CurrentThirdArr
,
ThirdPath
ThirdPath
,
},
// 同步存储数据
mutations
:
{
setUserData
(
state
,
data
)
{
data
.
flat
=
convertTreeToList
(
data
.
barList
,
[]);
state
.
userData
=
{};
state
.
userData
=
Object
.
assign
({},
state
.
userData
,
data
);
state
.
isLogin
=
true
;
window
.
sessionStorage
.
userData
=
JSON
.
stringify
(
data
);
window
.
sessionStorage
.
token
=
data
.
token
;
},
// 头部导航栏数据
setHeadBar
(
state
,
data
)
{
state
.
headBar
=
data
window
.
sessionStorage
.
headBar
=
JSON
.
stringify
(
data
)
setHeadBar
(
state
,
data
)
{
state
.
headBar
=
data
;
window
.
sessionStorage
.
headBar
=
JSON
.
stringify
(
data
)
;
},
logout
(
state
)
{
state
.
userData
=
{};
...
...
@@ -91,44 +106,47 @@ export default new Vuex.Store({
// window.sessionStorage.currentParentName = ''
// window.sessionStorage.CurrentSecondPath = ''
// window.sessionStorage.CurrentThirdArr = ''
window
.
sessionStorage
.
clear
()
window
.
sessionStorage
.
clear
()
;
},
setGroup
(
state
,
data
)
{
state
.
group
=
data
;
},
// 当前以及导航名
setCurrentParentName
(
state
,
data
)
{
state
.
currentParentName
=
data
window
.
sessionStorage
.
currentParentName
=
data
setCurrentParentName
(
state
,
data
)
{
state
.
currentParentName
=
data
;
window
.
sessionStorage
.
currentParentName
=
data
;
},
setCurrentSecondPath
(
state
,
data
)
{
state
.
CurrentSecondPath
=
data
window
.
sessionStorage
.
CurrentSecondPath
=
data
setCurrentSecondPath
(
state
,
data
)
{
state
.
CurrentSecondPath
=
data
;
window
.
sessionStorage
.
CurrentSecondPath
=
data
;
},
// 当前三级导航栏
setCurrentThirdArr
(
state
,
data
)
{
state
.
CurrentThirdArr
=
data
window
.
sessionStorage
.
CurrentThirdArr
=
JSON
.
stringify
(
data
)
setCurrentThirdArr
(
state
,
data
)
{
state
.
CurrentThirdArr
=
data
;
window
.
sessionStorage
.
CurrentThirdArr
=
JSON
.
stringify
(
data
)
;
},
// 当前三级导航栏路径
setThirdPath
(
state
,
data
)
{
state
.
ThirdPath
=
data
window
.
sessionStorage
.
ThirdPath
=
data
setThirdPath
(
state
,
data
)
{
state
.
ThirdPath
=
data
;
window
.
sessionStorage
.
ThirdPath
=
data
;
},
},
// 异步任务
actions
:
{
login
({
commit
})
{
normalCallPost
(
'
/login/index
'
).
then
(({
data
})
=>
{
commit
(
'
setUserData
'
,
data
)
}).
catch
(
error
=>
{
})
login
({
commit
})
{
normalCallPost
(
"
/login/index
"
)
.
then
(({
data
})
=>
{
commit
(
"
setUserData
"
,
data
);
})
.
catch
((
error
)
=>
{});
},
logout
({
commit
})
{
normalCallPost
(
'
/login/logout
'
).
then
(
data
=>
{}).
catch
(
error
=>
{}).
then
(()
=>
{
commit
(
'
logout
'
)
})
}
}
})
logout
({
commit
})
{
normalCallPost
(
"
/login/logout
"
)
.
then
((
data
)
=>
{})
.
catch
((
error
)
=>
{})
.
then
(()
=>
{
commit
(
"
logout
"
);
});
},
},
});
attendance-performance-manager-ui/admin/src/views/Home.vue
View file @
481aa828
...
...
@@ -159,16 +159,16 @@ export default {
this.$store.commit("setCurrentThirdArr", []);
this.$store.commit("setCurrentSecondPath", "");
this.$store.commit("setThirdPath", "");
this.homeNum();
this.$nextTick(() => {
this.homeNum();
});
},
methods: {
tabChildren(name) {
console.log("name:" + name);
this.$store.commit("setCurrentParentName", name); //存储选择路由
let result = this.menu.find((item) => item.name === name);
this.$store.commit("setHeadBar", result);
console.log("result:", result);
if (result) {
// 路由跳转
if (result.children.length > 0) {
...
...
@@ -184,6 +184,7 @@ export default {
}
},
mapMenu(arr) {
console.log(arr);
if (arr.length === 0) return [];
let result = arr.map((item) => {
const url = item.url
...
...
@@ -203,12 +204,12 @@ export default {
return result;
},
// 查询统计数据
homeNum() {
this.$post("/login/index").then((res) => {
async
homeNum() {
await
this.$post("/login/index").then((res) => {
const { code, data } = res;
if (code == 1) {
this.homeStat = Object.assign({}, this.homeStat, data.homeStat);
console.log(data, "####"
);
this.$store.commit("setUserData", data
);
}
});
},
...
...
attendance-performance-manager-ui/admin/src/views/login/authentication.vue
View file @
481aa828
...
...
@@ -6,45 +6,54 @@
<
script
>
export
default
{
name
:
'
authentication
'
,
created
()
{
name
:
"
authentication
"
,
created
()
{
this
.
login
();
},
methods
:
{
login
()
{
this
.
$post
(
'
/login/index
'
).
then
(
this
.
loginSuccess
).
catch
(
this
.
loginFail
)
async
login
()
{
await
this
.
$post
(
"
/login/index
"
)
.
then
(
this
.
loginSuccess
)
.
catch
(
this
.
loginFail
);
},
loginSuccess
({
data
})
{
this
.
$store
.
commit
(
'
setUserData
'
,
data
);
loginSuccess
({
data
})
{
this
.
$store
.
commit
(
"
setUserData
"
,
data
);
this
.
$router
.
replace
({
path
:
this
.
redirect
,
});
},
loginFail
(
error
)
{
this
.
$message
.
error
(
error
.
message
||
'
请登录
'
);
this
.
$message
.
error
(
error
.
message
||
"
请登录
"
);
console
.
log
(
"
href:
"
+
process
.
env
.
VUE_APP_PORTAL_URL
)
//window.location.href=process.env.VUE_APP_PORTAL_URL=='undefined'?'http://192.168.0.98:11072':process.env.VUE_APP_PORTAL_URL
window
.
location
.
href
=
process
.
env
.
VUE_APP_PORTAL_URL
/* this.$router.replace({
console
.
log
(
"
href:
"
+
process
.
env
.
VUE_APP_PORTAL_URL
);
//window.location.href=process.env.VUE_APP_PORTAL_URL=='undefined'?'http://192.168.0.98:11072':process.env.VUE_APP_PORTAL_URL
console
.
log
(
process
.
env
);
process
.
env
.
NODE_ENV
==
"
development
"
?
this
.
$router
.
replace
({
path
:
"
/login
"
,
query
:
{
redirect
:
this
.
redirect
,
},
})
:
(
window
.
location
.
href
=
process
.
env
.
VUE_APP_PORTAL_URL
);
/* this.$router.replace({
path: '/login',
query: {
redirect: this.redirect,
}
});*/
}
}
,
},
computed
:
{
isLogin
()
{
return
this
.
$store
.
state
.
isLogin
}
return
this
.
$store
.
state
.
isLogin
;
}
,
},
data
()
{
return
{
redirect
:
this
.
$route
.
query
.
redirect
,
loading
:
true
,
}
}
}
}
;
}
,
}
;
</
script
>
attendance-performance-manager-ui/admin/src/views/login/login.vue
View file @
481aa828
...
...
@@ -68,9 +68,9 @@ export default {
:
""
;
},
methods
:
{
login
()
{
async
login
()
{
this
.
loading
=
true
;
this
.
$post
(
"
/login/login
"
,
this
.
form
)
await
this
.
$post
(
"
/login/login
"
,
this
.
form
)
.
then
(
this
.
loginSuccess
)
.
catch
(
this
.
loginFail
);
},
...
...
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