From cc69786fd18c67f829acc75a2e5b58e3a9f02300 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期日, 02 七月 2023 16:48:57 +0800
Subject: [PATCH] update 优化 !pr382 修复一些问题 完事流程逻辑
---
src/views/login.vue | 12 +++++-------
src/layout/components/SocialCallback/index.vue | 2 +-
src/api/login.ts | 12 +++++++-----
src/router/index.ts | 4 ++--
src/views/system/user/profile/thirdParty.vue | 2 +-
src/permission.ts | 2 +-
6 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/api/login.ts b/src/api/login.ts
index d4ceb49..e85ce3e 100644
--- a/src/api/login.ts
+++ b/src/api/login.ts
@@ -2,7 +2,9 @@
import { AxiosPromise } from 'axios';
import { LoginData, LoginResult, VerifyCodeResult, TenantInfo } from './types';
import { UserInfo } from '@/api/system/user/types';
-import { da } from 'element-plus/es/locale';
+
+// pc绔浐瀹氬鎴风鎺堟潈id
+const clientId = 'e5cd7e4891bf95d1d19206ce24a7b32e';
/**
* @param data {LoginData}
@@ -11,7 +13,7 @@
export function login(data: LoginData): AxiosPromise<LoginResult> {
const params = {
...data,
- clientId: data.clientId || 'e5cd7e4891bf95d1d19206ce24a7b32e',
+ clientId: data.clientId || clientId,
grantType: data.grantType || 'password'
};
return request({
@@ -59,14 +61,14 @@
timeout: 20000
});
}
+
/**
* 绗笁鏂圭櫥褰�
- * @param source 绗笁鏂圭櫥褰曠被鍨�
- * */
+ */
export function callback(data: LoginData): AxiosPromise<any> {
const LoginData = {
...data,
- clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e',
+ clientId: clientId,
grantType: 'social'
};
return request({
diff --git a/src/layout/components/SocialLogin/index.vue b/src/layout/components/SocialCallback/index.vue
similarity index 96%
rename from src/layout/components/SocialLogin/index.vue
rename to src/layout/components/SocialCallback/index.vue
index 7656673..faf7d50 100644
--- a/src/layout/components/SocialLogin/index.vue
+++ b/src/layout/components/SocialCallback/index.vue
@@ -1,5 +1,5 @@
<template>
- <div v-loading="loading" class="social-login"></div>
+ <div v-loading="loading" class="social-callback"></div>
</template>
<script setup lang="ts">
diff --git a/src/permission.ts b/src/permission.ts
index c2743eb..4543d08 100644
--- a/src/permission.ts
+++ b/src/permission.ts
@@ -10,7 +10,7 @@
import usePermissionStore from '@/store/modules/permission';
NProgress.configure({ showSpinner: false });
-const whiteList = ['/login', '/register', '/social-login'];
+const whiteList = ['/login', '/register', '/social-callback'];
router.beforeEach(async (to, from, next) => {
NProgress.start();
diff --git a/src/router/index.ts b/src/router/index.ts
index dfd0547..d6aefe9 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -38,9 +38,9 @@
]
},
{
- path: '/social-login',
+ path: '/social-callback',
hidden: true,
- component: () => import('@/layout/components/SocialLogin/index.vue')
+ component: () => import('@/layout/components/SocialCallback/index.vue')
},
{
path: '/login',
diff --git a/src/views/login.vue b/src/views/login.vue
index 3234864..0ac655c 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -4,8 +4,7 @@
<h3 class="title">RuoYi-Vue-Plus澶氱鎴风鐞嗙郴缁�</h3>
<el-form-item prop="tenantId" v-if="tenantEnabled">
<el-select v-model="loginForm.tenantId" filterable placeholder="璇烽�夋嫨/杈撳叆鍏徃鍚嶇О" style="width: 100%">
- <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName"
- :value="item.tenantId"></el-option>
+ <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"></el-option>
<template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
</el-select>
</el-form-item>
@@ -15,14 +14,12 @@
</el-input>
</el-form-item>
<el-form-item prop="password">
- <el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="瀵嗙爜"
- @keyup.enter="handleLogin">
+ <el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="瀵嗙爜" @keyup.enter="handleLogin">
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
- <el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="楠岃瘉鐮�" style="width: 63%"
- @keyup.enter="handleLogin">
+ <el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="楠岃瘉鐮�" style="width: 63%" @keyup.enter="handleLogin">
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
</el-input>
<div class="login-code">
@@ -193,7 +190,8 @@
const doSocialLogin = (type: string) => {
authBinding(type).then((res: any) => {
if (res.code === 200) {
- window.location.href = res.msg;
+ // 鑾峰彇鎺堟潈鍦板潃璺宠浆
+ window.location.href = res.data;
} else {
ElMessage.error(res.msg);
}
diff --git a/src/views/system/user/profile/thirdParty.vue b/src/views/system/user/profile/thirdParty.vue
index e5791ef..2e4e722 100644
--- a/src/views/system/user/profile/thirdParty.vue
+++ b/src/views/system/user/profile/thirdParty.vue
@@ -80,7 +80,7 @@
const authUrl = (source: string) => {
authBinding(source).then((res: any) => {
if (res.code === 200) {
- window.location.href = res.msg;
+ window.location.href = res.data;
} else {
ElMessage.error(res.msg);
}
--
Gitblit v1.9.3