From 51d849ab8249c5a3dcac71e5ef4a2daea27b647b Mon Sep 17 00:00:00 2001 From: forever <2334528060@qq.com> Date: Fri, 19 Jan 2024 20:48:10 +0800 Subject: [PATCH] 11111 --- src/api/login/index.ts | 35 +++++++++++++++++++++++++++----- src/api/login/type.ts | 6 ++++++ src/views/HomeView.vue | 46 +++++++++++++++++++++++++++++++++++++----- 3 files changed, 77 insertions(+), 10 deletions(-) diff --git a/src/api/login/index.ts b/src/api/login/index.ts index b2a3ff5..88e0852 100644 --- a/src/api/login/index.ts +++ b/src/api/login/index.ts @@ -10,7 +10,8 @@ const apiPath = { code: '/captcha/sent', qr: '/login/qr/key', qrcreate: "/login/qr/create", - qrcheck: "/login/qr/check" + qrcheck: "/login/qr/check", + state:"/login/status", } /** @@ -79,10 +80,34 @@ export function qr() { method: "get" }) } -export function qrcreate(){ +/** + * 说明:调用此接口,生成登录二维码 + * @param params.key:二维码的key + * @param params.qrimg:传入后会返回二维码图片的base64编码 + */ +export function qrcreate(params: loginType.QrParams) { return request({ - url:apiPath.qrcheck, - method:"get" + url: apiPath.qrcreate, + method: "get", + params }) } -111 \ No newline at end of file +/** + * 说明:此接口用来检测二维码的扫描状态 + * @param params.key:有第一个接口生成 + * */ +export function qrcheck(params: loginType.QrParams) { + return request({ + url: apiPath.qrcheck, + method: "get", + params, + }) +} + + +export function state(){ + return request({ + url:apiPath.state, + method:"get", + }) +} \ No newline at end of file diff --git a/src/api/login/type.ts b/src/api/login/type.ts index a28ca63..d7db058 100644 --- a/src/api/login/type.ts +++ b/src/api/login/type.ts @@ -27,3 +27,9 @@ export interface LogoutParams { //昵称 nickname: string | number; } + +export interface QrParams{ + key: string, + qrimg?:string +} + diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 7a2cd9a..deebe56 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -264,10 +264,10 @@ @click="switchLogin = false">账号登录 | 验证码登录 + @click="switchLogin = true, qrkey()">扫码登录