fix: 登录接口补充wifi参数
This commit is contained in:
@@ -6,6 +6,7 @@ import { useAntdForm, useFormRules } from '@/hooks/common/form';
|
|||||||
import { useAuthStore } from '@/store/modules/auth';
|
import { useAuthStore } from '@/store/modules/auth';
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { sessionStg } from '@/utils/storage';
|
import { sessionStg } from '@/utils/storage';
|
||||||
|
import { getQueryParams } from "@/utils/common";
|
||||||
|
|
||||||
// Add interface for check code response
|
// Add interface for check code response
|
||||||
interface CheckCodeResponse {
|
interface CheckCodeResponse {
|
||||||
@@ -54,6 +55,19 @@ const rules = {
|
|||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
await validate();
|
await validate();
|
||||||
const redirectParams = sessionStg.get('wanfiRedirectParams');
|
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
|
model.wanfiRedirectParams = redirectParams
|
||||||
? (typeof redirectParams === 'string' ? JSON.parse(redirectParams) : redirectParams)
|
? (typeof redirectParams === 'string' ? JSON.parse(redirectParams) : redirectParams)
|
||||||
: {};
|
: {};
|
||||||
|
|||||||
Reference in New Issue
Block a user