diff --git a/ruoyi-ui/src/api/login.js b/ruoyi-ui/src/api/login.js
index af2a88c..53de8a9 100644
--- a/ruoyi-ui/src/api/login.js
+++ b/ruoyi-ui/src/api/login.js
@@ -19,6 +19,18 @@ export function login(username, password, code, uuid) {
})
}
+export function singleSign(username, password) {
+ return request({
+ url: '/singleSign',
+ headers: {
+ isToken: false,
+ repeatSubmit: false
+ },
+ method: 'post',
+ data: { username, password }
+ })
+}
+
// 注册方法
export function register(data) {
return request({
diff --git a/ruoyi-ui/src/permission.js b/ruoyi-ui/src/permission.js
index 228d79d..23ba4a3 100644
--- a/ruoyi-ui/src/permission.js
+++ b/ruoyi-ui/src/permission.js
@@ -8,7 +8,7 @@ import { isRelogin } from '@/utils/request'
NProgress.configure({ showSpinner: false })
-const whiteList = ['/login', '/register', '/LoginSso', '/LoginRedirect']
+const whiteList = ['/login', '/register', '/LoginSso', '/LoginRedirect', '/SingleSign']
router.beforeEach((to, from, next) => {
NProgress.start()
diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js
index 0e16abd..7fe43c1 100644
--- a/ruoyi-ui/src/router/index.js
+++ b/ruoyi-ui/src/router/index.js
@@ -51,6 +51,11 @@ export const constantRoutes = [
component: () => import('@/views/login-sso'),
hidden: true
},
+ {
+ path: '/SingleSign',
+ component: () => import('@/views/single-sign'),
+ hidden: true
+ },
{
path: '/LoginRedirect',
component: () => import('@/views/login-redirect'),
diff --git a/ruoyi-ui/src/store/modules/user.js b/ruoyi-ui/src/store/modules/user.js
index d24810a..b32e9ef 100644
--- a/ruoyi-ui/src/store/modules/user.js
+++ b/ruoyi-ui/src/store/modules/user.js
@@ -1,4 +1,4 @@
-import { login, logout, getInfo, getAccountName } from '@/api/login'
+import { login, logout, getInfo, getAccountName, singleSign } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import {encrypt, decrypt} from '@/utils/secret'
const user = {
@@ -51,6 +51,21 @@ const user = {
})
},
+ SingleSign({ commit }, userInfo) {
+ const username = userInfo.username.trim();
+ const password = userInfo.password;
+ let encodePs = encrypt(password)//加密
+ return new Promise((resolve, reject) => {
+ singleSign(username, encodePs).then(res => {
+ setToken(res.token)
+ commit('SET_TOKEN', res.token)
+ resolve()
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ },
+
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
diff --git a/ruoyi-ui/src/views/single-sign.vue b/ruoyi-ui/src/views/single-sign.vue
new file mode 100644
index 0000000..0a973ea
--- /dev/null
+++ b/ruoyi-ui/src/views/single-sign.vue
@@ -0,0 +1,27 @@
+
+
+
+
+