update 优化 !pr382 修复一些问题 完事流程逻辑
This commit is contained in:
parent
4cf836055a
commit
cc69786fd1
@ -2,7 +2,9 @@ import request from '@/utils/request';
|
|||||||
import { AxiosPromise } from 'axios';
|
import { AxiosPromise } from 'axios';
|
||||||
import { LoginData, LoginResult, VerifyCodeResult, TenantInfo } from './types';
|
import { LoginData, LoginResult, VerifyCodeResult, TenantInfo } from './types';
|
||||||
import { UserInfo } from '@/api/system/user/types';
|
import { UserInfo } from '@/api/system/user/types';
|
||||||
import { da } from 'element-plus/es/locale';
|
|
||||||
|
// pc端固定客户端授权id
|
||||||
|
const clientId = 'e5cd7e4891bf95d1d19206ce24a7b32e';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param data {LoginData}
|
* @param data {LoginData}
|
||||||
@ -11,7 +13,7 @@ import { da } from 'element-plus/es/locale';
|
|||||||
export function login(data: LoginData): AxiosPromise<LoginResult> {
|
export function login(data: LoginData): AxiosPromise<LoginResult> {
|
||||||
const params = {
|
const params = {
|
||||||
...data,
|
...data,
|
||||||
clientId: data.clientId || 'e5cd7e4891bf95d1d19206ce24a7b32e',
|
clientId: data.clientId || clientId,
|
||||||
grantType: data.grantType || 'password'
|
grantType: data.grantType || 'password'
|
||||||
};
|
};
|
||||||
return request({
|
return request({
|
||||||
@ -59,14 +61,14 @@ export function getCodeImg(): AxiosPromise<VerifyCodeResult> {
|
|||||||
timeout: 20000
|
timeout: 20000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 第三方登录
|
* 第三方登录
|
||||||
* @param source 第三方登录类型
|
*/
|
||||||
* */
|
|
||||||
export function callback(data: LoginData): AxiosPromise<any> {
|
export function callback(data: LoginData): AxiosPromise<any> {
|
||||||
const LoginData = {
|
const LoginData = {
|
||||||
...data,
|
...data,
|
||||||
clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e',
|
clientId: clientId,
|
||||||
grantType: 'social'
|
grantType: 'social'
|
||||||
};
|
};
|
||||||
return request({
|
return request({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-loading="loading" class="social-login"></div>
|
<div v-loading="loading" class="social-callback"></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
@ -10,7 +10,7 @@ import useSettingsStore from '@/store/modules/settings';
|
|||||||
import usePermissionStore from '@/store/modules/permission';
|
import usePermissionStore from '@/store/modules/permission';
|
||||||
|
|
||||||
NProgress.configure({ showSpinner: false });
|
NProgress.configure({ showSpinner: false });
|
||||||
const whiteList = ['/login', '/register', '/social-login'];
|
const whiteList = ['/login', '/register', '/social-callback'];
|
||||||
|
|
||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
NProgress.start();
|
NProgress.start();
|
||||||
|
@ -38,9 +38,9 @@ export const constantRoutes: RouteOption[] = [
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/social-login',
|
path: '/social-callback',
|
||||||
hidden: true,
|
hidden: true,
|
||||||
component: () => import('@/layout/components/SocialLogin/index.vue')
|
component: () => import('@/layout/components/SocialCallback/index.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
<h3 class="title">RuoYi-Vue-Plus多租户管理系统</h3>
|
<h3 class="title">RuoYi-Vue-Plus多租户管理系统</h3>
|
||||||
<el-form-item prop="tenantId" v-if="tenantEnabled">
|
<el-form-item prop="tenantId" v-if="tenantEnabled">
|
||||||
<el-select v-model="loginForm.tenantId" filterable placeholder="请选择/输入公司名称" style="width: 100%">
|
<el-select v-model="loginForm.tenantId" filterable placeholder="请选择/输入公司名称" style="width: 100%">
|
||||||
<el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName"
|
<el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"></el-option>
|
||||||
:value="item.tenantId"></el-option>
|
|
||||||
<template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -15,14 +14,12 @@
|
|||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="password">
|
<el-form-item prop="password">
|
||||||
<el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码"
|
<el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码" @keyup.enter="handleLogin">
|
||||||
@keyup.enter="handleLogin">
|
|
||||||
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="code" v-if="captchaEnabled">
|
<el-form-item prop="code" v-if="captchaEnabled">
|
||||||
<el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="验证码" style="width: 63%"
|
<el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="验证码" style="width: 63%" @keyup.enter="handleLogin">
|
||||||
@keyup.enter="handleLogin">
|
|
||||||
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<div class="login-code">
|
<div class="login-code">
|
||||||
@ -193,7 +190,8 @@ watch(() => loginForm.value.tenantId, (val: string) => {
|
|||||||
const doSocialLogin = (type: string) => {
|
const doSocialLogin = (type: string) => {
|
||||||
authBinding(type).then((res: any) => {
|
authBinding(type).then((res: any) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
window.location.href = res.msg;
|
// 获取授权地址跳转
|
||||||
|
window.location.href = res.data;
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(res.msg);
|
ElMessage.error(res.msg);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ const unlockAuth = (row: any) => {
|
|||||||
const authUrl = (source: string) => {
|
const authUrl = (source: string) => {
|
||||||
authBinding(source).then((res: any) => {
|
authBinding(source).then((res: any) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
window.location.href = res.msg;
|
window.location.href = res.data;
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(res.msg);
|
ElMessage.error(res.msg);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user