Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
precision-effect
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
耿迪迪
precision-effect
Commits
b6b0768b
Commit
b6b0768b
authored
Jun 21, 2023
by
耿迪迪
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://111.61.77.35:9999/gengdidi/precision-effect
parents
acd69670
8b7949d5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
34 deletions
+61
-34
pom.xml
precision-effect-admin/pom.xml
+15
-1
Message.vue
...sion-effect-web/src/layout/components/Message/Message.vue
+1
-1
permission.js
precision-effect-web/src/permission.js
+43
-30
login.vue
precision-effect-web/src/views/login.vue
+2
-2
No files found.
precision-effect-admin/pom.xml
View file @
b6b0768b
...
@@ -192,8 +192,22 @@
...
@@ -192,8 +192,22 @@
</execution>
</execution>
</executions>
</executions>
</plugin>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
2.1.3.RELEASE
</version>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</plugins>
</build>
</build>
</project>
</project>
\ No newline at end of file
precision-effect-web/src/layout/components/Message/Message.vue
View file @
b6b0768b
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
},
},
created
(){
created
(){
//登录成功后创建websocket
//登录成功后创建websocket
this
.
$websocket
.
initWebSocket
(
"ws://
localhost
:8668/precisionEffect/webSocket/"
+
this
.
$store
.
state
.
user
.
roles
.
join
(
","
)
+
"/"
+
this
.
$store
.
state
.
user
.
userId
);
this
.
$websocket
.
initWebSocket
(
"ws://
36.139.131.221
:8668/precisionEffect/webSocket/"
+
this
.
$store
.
state
.
user
.
roles
.
join
(
","
)
+
"/"
+
this
.
$store
.
state
.
user
.
userId
);
this
.
$websocket
.
addEvent
(
"onmessage"
,(
msg
)
=>
{
this
.
$websocket
.
addEvent
(
"onmessage"
,(
msg
)
=>
{
if
(
msg
.
data
){
if
(
msg
.
data
){
console
.
log
(
"您有新的消息请注意接收:"
,
JSON
.
parse
(
msg
.
data
));
console
.
log
(
"您有新的消息请注意接收:"
,
JSON
.
parse
(
msg
.
data
));
...
...
precision-effect-web/src/permission.js
View file @
b6b0768b
import
router
from
'./router'
import
router
from
"./router"
;
import
store
from
'./store'
import
store
from
"./store"
;
import
{
Message
}
from
'element-ui'
import
{
Message
}
from
"element-ui"
;
import
NProgress
from
'nprogress'
import
NProgress
from
"nprogress"
;
import
'nprogress/nprogress.css'
import
"nprogress/nprogress.css"
;
import
{
getToken
}
from
'@/utils/auth'
import
{
getToken
}
from
"@/utils/auth"
;
NProgress
.
configure
({
showSpinner
:
false
})
NProgress
.
configure
({
showSpinner
:
false
})
;
const
whiteList
=
[
'/login'
,
'/auth-redirect'
,
'/bind'
,
'/register'
]
const
whiteList
=
[
"/login"
,
"/auth-redirect"
,
"/bind"
,
"/register"
];
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
NProgress
.
start
()
NProgress
.
start
()
;
if
(
getToken
())
{
if
(
getToken
())
{
/* has token*/
/* has token*/
if
(
to
.
path
===
'/login'
)
{
if
(
to
.
path
===
"/login"
)
{
next
({
path
:
'/'
})
next
({
path
:
"/"
});
NProgress
.
done
()
NProgress
.
done
()
;
}
else
{
}
else
{
if
(
store
.
getters
.
roles
.
length
===
0
)
{
if
(
store
.
getters
.
roles
.
length
===
0
)
{
// 判断当前用户是否已拉取完user_info信息
// 判断当前用户是否已拉取完user_info信息
store
.
dispatch
(
'GetInfo'
).
then
(()
=>
{
store
store
.
dispatch
(
'GenerateRoutes'
).
then
(
accessRoutes
=>
{
.
dispatch
(
"GetInfo"
)
// 根据roles权限生成可访问的路由表
.
then
(()
=>
{
router
.
addRoutes
(
accessRoutes
)
// 动态添加可访问路由表
store
.
dispatch
(
"GenerateRoutes"
).
then
((
accessRoutes
)
=>
{
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
// 根据roles权限生成可访问的路由表
})
router
.
addRoutes
(
accessRoutes
);
// 动态添加可访问路由表
}).
catch
(
err
=>
{
// next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
store
.
dispatch
(
'LogOut'
).
then
(()
=>
{
const
origin
=
router
.
options
.
routes
.
find
((
item
)
=>
{
Message
.
error
(
err
)
return
item
.
redirect
===
"index"
;
next
({
path
:
'/'
})
});
})
// 隐藏
origin
.
children
[
0
].
hidden
=
true
;
// 挑战
if
(
accessRoutes
[
0
].
children
)
{
next
({
...
accessRoutes
[
0
].
children
[
0
]
});
}
// console.log('accessRoutes[0].children',accessRoutes)
});
})
})
.
catch
((
err
)
=>
{
store
.
dispatch
(
"LogOut"
).
then
(()
=>
{
Message
.
error
(
err
);
next
({
path
:
"/"
});
});
});
}
else
{
}
else
{
next
()
next
()
;
}
}
}
}
}
else
{
}
else
{
// 没有token
// 没有token
if
(
whiteList
.
indexOf
(
to
.
path
)
!==
-
1
)
{
if
(
whiteList
.
indexOf
(
to
.
path
)
!==
-
1
)
{
// 在免登录白名单,直接进入
// 在免登录白名单,直接进入
next
()
next
()
;
}
else
{
}
else
{
next
(
`/login?redirect=
${
to
.
fullPath
}
`
)
// 否则全部重定向到登录页
next
(
`/login?redirect=
${
to
.
fullPath
}
`
)
;
// 否则全部重定向到登录页
NProgress
.
done
()
NProgress
.
done
()
;
}
}
}
}
})
})
;
router
.
afterEach
(()
=>
{
router
.
afterEach
(()
=>
{
NProgress
.
done
()
NProgress
.
done
()
;
})
})
;
precision-effect-web/src/views/login.vue
View file @
b6b0768b
...
@@ -65,8 +65,8 @@ export default {
...
@@ -65,8 +65,8 @@ export default {
codeUrl
:
""
,
codeUrl
:
""
,
cookiePassword
:
""
,
cookiePassword
:
""
,
loginForm
:
{
loginForm
:
{
username
:
"
admin
"
,
username
:
""
,
password
:
"
admin123
"
,
password
:
""
,
rememberMe
:
false
,
rememberMe
:
false
,
code
:
""
,
code
:
""
,
uuid
:
""
uuid
:
""
...
...
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