diff --git a/public/assets/O1CN01yz6fEl1MwaRtkJyvf_!!6000000001499-55-tps-70-70.svg b/public/assets/O1CN01yz6fEl1MwaRtkJyvf_!!6000000001499-55-tps-70-70.svg
new file mode 100644
index 0000000..a7b3b75
--- /dev/null
+++ b/public/assets/O1CN01yz6fEl1MwaRtkJyvf_!!6000000001499-55-tps-70-70.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/api/passport/qrLogin/index.ts b/src/api/passport/qrLogin/index.ts
index 8e307e5..0f662d8 100644
--- a/src/api/passport/qrLogin/index.ts
+++ b/src/api/passport/qrLogin/index.ts
@@ -19,6 +19,7 @@ export interface QrCodeStatusResponse {
accessToken?: string; // 登录成功时返回的JWT token
userInfo?: any; // 用户信息
expiresIn?: number; // 剩余过期时间(秒)
+ tenantId?: string; // 租户ID
}
/**
@@ -69,7 +70,7 @@ export async function confirmQrLogin(requestData: QrLoginConfirmRequest): Promis
SERVER_API_URL + '/qr-login/confirm',
requestData
);
-
+ console.log(res,'>>>89898989')
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
diff --git a/src/components/QrLogin/index.vue b/src/components/QrLogin/index.vue
index 15bcbbd..f0d8397 100644
--- a/src/components/QrLogin/index.vue
+++ b/src/components/QrLogin/index.vue
@@ -7,8 +7,8 @@
正在生成二维码...
-
-
+
+
请使用手机APP或小程序扫码登录
二维码有效期:{{ formatTime(expireTime) }}
@@ -55,11 +55,11 @@ import {
ExclamationCircleOutlined,
ReloadOutlined
} from '@ant-design/icons-vue';
-import { generateQrCode, checkQrCodeStatus, type QrCodeResponse } from '@/api/passport/qrLogin';
+import {generateQrCode, checkQrCodeStatus, type QrCodeResponse, QrCodeStatusResponse} from '@/api/passport/qrLogin';
// 定义组件事件
const emit = defineEmits<{
- (e: 'loginSuccess', token: string): void;
+ (e: 'loginSuccess', data: QrCodeStatusResponse): void;
(e: 'loginError', error: string): void;
}>();
@@ -131,9 +131,12 @@ const startStatusCheck = () => {
break;
case 'confirmed':
// 登录成功
+ if(status.tenantId){
+ localStorage.setItem('TenantId', `${status.tenantId}`)
+ }
qrCodeStatus.value = 'active';
stopAllTimers();
- emit('loginSuccess', status.accessToken || '');
+ emit('loginSuccess', status);
break;
case 'expired':
qrCodeStatus.value = 'expired';
diff --git a/src/router/routes.ts b/src/router/routes.ts
index c75678b..eca468f 100644
--- a/src/router/routes.ts
+++ b/src/router/routes.ts
@@ -45,11 +45,6 @@ export const routes = [
component: () => import('@/components/QrLogin/demo.vue'),
meta: { title: '二维码登录演示' }
},
- {
- path: '/qr-test',
- component: () => import('@/views/test/qrLoginTest.vue'),
- meta: { title: '二维码登录接口测试' }
- },
// {
// path: '/forget',
// component: () => import('@/views/passport/forget/index.vue'),
diff --git a/src/views/passport/login/index.vue b/src/views/passport/login/index.vue
index d2b140d..9bdbdd6 100644
--- a/src/views/passport/login/index.vue
+++ b/src/views/passport/login/index.vue
@@ -53,11 +53,12 @@
-
-
@@ -266,6 +267,7 @@ import {
LockOutlined,
UserOutlined,
QrcodeOutlined,
+ MobileOutlined,
SafetyCertificateOutlined
} from '@ant-design/icons-vue';
import {goHomeRoute, cleanPageTabs} from '@/utils/page-tab-util';
@@ -283,6 +285,7 @@ import {phoneReg} from 'ele-admin-pro';
import router from "@/router";
import {listAdminsByPhoneAll} from "@/api/system/user";
import {getUserInfo} from "@/api/layout";
+import {QrCodeStatusResponse} from "@/api/passport/qrLogin";
const useForm = Form.useForm;
const {currentRoute} = useRouter();
@@ -523,15 +526,13 @@ const onScan = () => {
}
/* 二维码登录成功处理 */
-const onQrLoginSuccess = async (token: string) => {
+const onQrLoginSuccess = async (item: QrCodeStatusResponse) => {
// 设置token到localStorage或其他存储
- localStorage.setItem('access_token', token);
+ localStorage.setItem('access_token', item.accessToken || '');
message.success('扫码登录成功');
- const data = await getUserInfo();
- if (data) {
- localStorage.setItem('access_token', token);
- localStorage.setItem('TenantId', String(data.tenantId));
- localStorage.setItem('UserId', String(data.userId));
+ if (item) {
+ localStorage.setItem('access_token', `${item.accessToken}`);
+ localStorage.setItem('TenantId', `${item.tenantId}`);
cleanPageTabs();
goHome();
}
diff --git a/src/views/test/qrLoginTest.vue b/src/views/test/qrLoginTest.vue
deleted file mode 100644
index fc0e80a..0000000
--- a/src/views/test/qrLoginTest.vue
+++ /dev/null
@@ -1,323 +0,0 @@
-
-
-
-
-
-
-
-
- 生成二维码
-
-
-
- {{ qrCodeData.token }}
- {{ qrCodeData.qrCode }}
- {{ qrCodeData.expiresIn }}秒
-
-
-
-
-
-
-
-
-
-
-
- 检查状态
-
-
-
-
-
-
-
- {{ getStatusText(statusData.status) }}
-
-
-
- {{ statusData.expiresIn }}秒
-
-
- {{ statusData.accessToken.substring(0, 50) }}...
-
-
-
-
-
-
-
-
- 模拟扫码
-
-
-
-
-
-
-
-
- 确认登录
-
-
-
-
-
-
-
-
- {{ log.time }}
- {{ log.message }}
-
-
-
-
-
-
-
-
-
-
-
-