|
@@ -1,19 +1,20 @@
|
1
|
1
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
2
|
2
|
import Home from '../components/UeVideo.vue'
|
3
|
3
|
import Login from '../components/Login.vue'
|
|
4
|
+import { getvalidateLogin } from '../request/api'
|
4
|
5
|
|
5
|
6
|
const routes = [
|
6
|
|
-
|
7
|
|
- {
|
8
|
|
- path: '/',
|
9
|
|
- name: 'Home',
|
10
|
|
- component: Home
|
11
|
|
- },
|
12
|
|
- {
|
13
|
|
- path: '/login',
|
14
|
|
- name: 'Login',
|
15
|
|
- component: Login
|
16
|
|
- }
|
|
7
|
+
|
|
8
|
+ {
|
|
9
|
+ path: '/',
|
|
10
|
+ name: 'Home',
|
|
11
|
+ component: Home
|
|
12
|
+ },
|
|
13
|
+ {
|
|
14
|
+ path: '/login',
|
|
15
|
+ name: 'Login',
|
|
16
|
+ component: Login
|
|
17
|
+ }
|
17
|
18
|
]
|
18
|
19
|
|
19
|
20
|
const router = createRouter({
|
|
@@ -22,13 +23,30 @@ const router = createRouter({
|
22
|
23
|
})
|
23
|
24
|
|
24
|
25
|
|
25
|
|
-router.beforeEach(function(to, from, next) {
|
|
26
|
+router.beforeEach(function (to, from, next) {
|
26
|
27
|
|
27
|
28
|
let urlA = location.href.indexOf('ticket')
|
28
|
|
- if (urlA==-1) {
|
29
|
|
- if (to.path == '/') {
|
30
|
|
- return next('/login')
|
|
29
|
+ if (urlA == -1) {
|
|
30
|
+ if (to.path == '/') {
|
|
31
|
+ return next('/login')
|
|
32
|
+ }
|
|
33
|
+ } else {
|
|
34
|
+ const url = window.location.href;
|
|
35
|
+ const paramStr = url.split("?")[1].split("#")[0];
|
|
36
|
+ console.log('sadasd' ,paramStr);
|
|
37
|
+ let query = {
|
|
38
|
+ casLoginUrl: "https://cas.huanghuai.edu.cn/cas/serviceValidate?ticket=" + paramStr + '&service=weizhi.huanghuai.edu.cn/xyyzioc/#/'
|
|
39
|
+ }
|
|
40
|
+ console.log('aslddddd',query);
|
|
41
|
+ getvalidateLogin(query).then(res => {
|
|
42
|
+ console.log('yzzzzzzz',res);
|
|
43
|
+
|
|
44
|
+ if (res.code == -1) {
|
|
45
|
+ window.location.href='https://weizhi.huanghuai.edu.cn/xyyzioc/#/login'
|
31
|
46
|
}
|
|
47
|
+
|
|
48
|
+ })
|
|
49
|
+
|
32
|
50
|
}
|
33
|
51
|
next()
|
34
|
52
|
})
|