diff --git a/src/api/login.js b/src/api/login.js
index 3829b0c..f9e34ba 100644
--- a/src/api/login.js
+++ b/src/api/login.js
@@ -59,3 +59,14 @@
timeout: 20000,
});
}
+// 单点登录方法
+export function codeLogin(code) {
+ return request({
+ url: "/auth/codeLogin",
+ headers: {
+ isToken: false,
+ },
+ method: "post",
+ data: { code },
+ });
+}
\ No newline at end of file
diff --git a/src/api/login.js b/src/api/login.js
index 3829b0c..f9e34ba 100644
--- a/src/api/login.js
+++ b/src/api/login.js
@@ -59,3 +59,14 @@
timeout: 20000,
});
}
+// 单点登录方法
+export function codeLogin(code) {
+ return request({
+ url: "/auth/codeLogin",
+ headers: {
+ isToken: false,
+ },
+ method: "post",
+ data: { code },
+ });
+}
\ No newline at end of file
diff --git a/src/permission.js b/src/permission.js
index 720e915..522b95d 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -22,6 +22,7 @@
next({ path: "/" });
NProgress.done();
} else {
+ // debugger
if (useUserStore().roles.length === 0) {
isRelogin.show = true;
// 判断当前用户是否已拉取完user_info信息
diff --git a/src/api/login.js b/src/api/login.js
index 3829b0c..f9e34ba 100644
--- a/src/api/login.js
+++ b/src/api/login.js
@@ -59,3 +59,14 @@
timeout: 20000,
});
}
+// 单点登录方法
+export function codeLogin(code) {
+ return request({
+ url: "/auth/codeLogin",
+ headers: {
+ isToken: false,
+ },
+ method: "post",
+ data: { code },
+ });
+}
\ No newline at end of file
diff --git a/src/permission.js b/src/permission.js
index 720e915..522b95d 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -22,6 +22,7 @@
next({ path: "/" });
NProgress.done();
} else {
+ // debugger
if (useUserStore().roles.length === 0) {
isRelogin.show = true;
// 判断当前用户是否已拉取完user_info信息
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 2ca7bcd..b3adbbc 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,4 +1,4 @@
-import { login, logout, getInfo } from "@/api/login";
+import { login, logout, getInfo, codeLogin } from "@/api/login";
import { getToken, setToken, removeToken } from "@/utils/auth";
import defAva from "@/assets/images/profile.jpg";
import Cookies from "js-cookie";
@@ -77,6 +77,22 @@
});
});
},
+ // 单点登录
+ codeLogin(code) {
+ return new Promise((resolve, reject) => {
+ // debugger
+ codeLogin(code)
+ .then((res) => {
+ let data = res.data;
+ setToken(data.access_token);
+ this.token = data.access_token;
+ resolve();
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
+ }
},
});
diff --git a/src/api/login.js b/src/api/login.js
index 3829b0c..f9e34ba 100644
--- a/src/api/login.js
+++ b/src/api/login.js
@@ -59,3 +59,14 @@
timeout: 20000,
});
}
+// 单点登录方法
+export function codeLogin(code) {
+ return request({
+ url: "/auth/codeLogin",
+ headers: {
+ isToken: false,
+ },
+ method: "post",
+ data: { code },
+ });
+}
\ No newline at end of file
diff --git a/src/permission.js b/src/permission.js
index 720e915..522b95d 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -22,6 +22,7 @@
next({ path: "/" });
NProgress.done();
} else {
+ // debugger
if (useUserStore().roles.length === 0) {
isRelogin.show = true;
// 判断当前用户是否已拉取完user_info信息
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 2ca7bcd..b3adbbc 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,4 +1,4 @@
-import { login, logout, getInfo } from "@/api/login";
+import { login, logout, getInfo, codeLogin } from "@/api/login";
import { getToken, setToken, removeToken } from "@/utils/auth";
import defAva from "@/assets/images/profile.jpg";
import Cookies from "js-cookie";
@@ -77,6 +77,22 @@
});
});
},
+ // 单点登录
+ codeLogin(code) {
+ return new Promise((resolve, reject) => {
+ // debugger
+ codeLogin(code)
+ .then((res) => {
+ let data = res.data;
+ setToken(data.access_token);
+ this.token = data.access_token;
+ resolve();
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
+ }
},
});
diff --git a/src/views/login.vue b/src/views/login.vue
index 27290af..3ae50cd 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -52,10 +52,18 @@
- 记住密码
+
+ 记住密码
+
-
+
登 录
@@ -69,42 +77,45 @@
-->
-
+