From c77e8878fa1c5addd738385064122d5cf782ca13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=85=88=E7=91=9E?= <1490493387@qq.com> Date: Sun, 20 Mar 2022 23:44:39 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=99=BB=E5=BD=95=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=95=B0=E6=8D=AE=E7=B1=BB=E5=9E=8B=E5=A3=B0=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/login/index.ts | 4 ++-- src/types/api/system/login.d.ts | 2 +- src/views/login/index.vue | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/api/login/index.ts b/src/api/login/index.ts index 9d9c7dc1..77e48567 100644 --- a/src/api/login/index.ts +++ b/src/api/login/index.ts @@ -1,4 +1,4 @@ -import { Captcha, LoginRequestParam, LoginResponseData } from "@/types"; +import { Captcha, LoginFormData, LoginResponseData } from "@/types"; import request from "@/utils/request"; import { AxiosPromise } from "axios"; @@ -6,7 +6,7 @@ import { AxiosPromise } from "axios"; * 登录 * @param data */ -export function login(data: LoginRequestParam): AxiosPromise { +export function login(data: LoginFormData): AxiosPromise { return request({ url: '/youlai-auth/oauth/token', method: 'post', diff --git a/src/types/api/system/login.d.ts b/src/types/api/system/login.d.ts index 21b3213a..24ab7547 100644 --- a/src/types/api/system/login.d.ts +++ b/src/types/api/system/login.d.ts @@ -1,7 +1,7 @@ /** * 登录请求参数类型声明 */ -export interface LoginRequestParam { +export interface LoginFormData { username: string, password: string, grant_type: string, diff --git a/src/views/login/index.vue b/src/views/login/index.vue index fd22dd30..eebaf084 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -119,6 +119,7 @@ import useStore from "@/store"; // API依赖 import { getCaptcha } from "@/api/login"; import { useRoute } from "vue-router"; +import { LoginFormData } from "@/types"; const { user } = useStore(); const route = useRoute(); @@ -132,7 +133,7 @@ const state = reactive({ password: "123456", code: "", uuid: "", - }, + } as LoginFormData, loginRules: { username: [{ required: true, trigger: "blur" }], password: [