添加登录code
This commit is contained in:
parent
278c4cbd8f
commit
389fe17b18
|
|
@ -376,7 +376,15 @@ export const secondAuthLoginService = (Data) => {
|
|||
'Content-Type': 'application/json' // 设置请求头为 JSON 格式
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const SetTokenCodeStatusService = (code, token) => {
|
||||
let url = '/user/set_client_token_status' + "?code=" + code
|
||||
return request.get(url, {
|
||||
headers: {
|
||||
'token': token,
|
||||
}
|
||||
})
|
||||
}
|
||||
export const fetchUserData = () => {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ import { UserToken } from "@/types/user";
|
|||
import { getBrowserFingerprint, getStoredFingerprint } from "@/utils/fingerprint";
|
||||
import { usePermissStore } from "@/store/permiss";
|
||||
import Cookies from 'js-cookie';
|
||||
import { getThirdPartyUUID, getThirdPartyLoginStatus, getThirdPartyLoginUrl, sendLoginCode, loginByCode, secondAuthLoginService } from "@/api/user";
|
||||
import { getThirdPartyUUID, getThirdPartyLoginStatus, getThirdPartyLoginUrl, sendLoginCode, loginByCode, secondAuthLoginService,SetTokenCodeStatusService } from "@/api/user";
|
||||
import { log, time } from "console";
|
||||
import { pa } from "element-plus/es/locale";
|
||||
import { state } from "mermaid/dist/rendering-util/rendering-elements/shapes/state";
|
||||
|
|
@ -192,6 +192,8 @@ const maxLoginRepeatRequest = 60; //最大请求次数
|
|||
const currentLoginRequest = ref(0); //当前请求次数
|
||||
const timer = ref(null); //定时器
|
||||
|
||||
const code = ref('');
|
||||
|
||||
const secondAuthLogin = async () => {
|
||||
if (!second_auth_method.value) {
|
||||
ElMessage.error("请选择认证方式");
|
||||
|
|
@ -302,6 +304,9 @@ onMounted(async () => {
|
|||
if (queryParams.site) {
|
||||
querySite.value = queryParams.site as string;
|
||||
}
|
||||
if (queryParams.code){
|
||||
code.value = queryParams.code as string;
|
||||
}
|
||||
});
|
||||
|
||||
const thirdLogin = async (type) => {
|
||||
|
|
@ -517,6 +522,10 @@ const onLogin = async () => {
|
|||
let now = new Date();
|
||||
localStorage.setItem("end_time", (now.setDate(now.getHours())).toString()); //过期时间
|
||||
await getMyUserInfo(userTokenInfo.user_id);
|
||||
if (code.value !== ''){
|
||||
//设置token code状态为已使用
|
||||
await SetTokenCodeStatusService(code.value, userTokenInfo.access_token);
|
||||
}
|
||||
//token.value= result.data;
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue