2
0

fix: 登录接口补充wifi参数

This commit is contained in:
caiyuchao
2025-01-17 14:45:41 +08:00
parent 5bd35af13a
commit d242ac1b80

View File

@@ -6,6 +6,7 @@ import { useAntdForm, useFormRules } from '@/hooks/common/form';
import { useAuthStore } from '@/store/modules/auth';
import { useI18n } from "vue-i18n";
import { sessionStg } from '@/utils/storage';
import { getQueryParams } from "@/utils/common";
// Add interface for check code response
interface CheckCodeResponse {
@@ -54,6 +55,19 @@ const rules = {
async function handleSubmit() {
await validate();
const redirectParams = sessionStg.get('wanfiRedirectParams');
if (!redirectParams) {
// 如果sessionStg取不到wifi参数,从url上获取
if (import.meta.env.VITE_ROUTER_HISTORY_MODE === 'hash') {
queryParams = getQueryParams(window.location.search);
} else if (import.meta.env.VITE_ROUTER_HISTORY_MODE === 'history') {
let search = window.location.search;
const index = search.indexOf("?", 2);
if (index !== -1) {
search = search.slice(index);
}
redirectParams = getQueryParams(decodeURIComponent(search));
}
}
model.wanfiRedirectParams = redirectParams
? (typeof redirectParams === 'string' ? JSON.parse(redirectParams) : redirectParams)
: {};