mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-14 09:38:13 +08:00
✅ 验证码登录测试成功 #118
This commit is contained in:
@@ -15,21 +15,7 @@
|
|||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
|
|
||||||
interface GeetestProps {
|
|
||||||
gt: string;
|
|
||||||
challenge: string;
|
|
||||||
new_captcha: number;
|
|
||||||
success: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<GeetestProps>(), {
|
|
||||||
gt: "",
|
|
||||||
challenge: "",
|
|
||||||
new_captcha: 0,
|
|
||||||
success: 0,
|
|
||||||
});
|
|
||||||
|
|
||||||
const show = ref<boolean>(false);
|
const show = ref<boolean>(false);
|
||||||
const showOuter = ref<boolean>(false);
|
const showOuter = ref<boolean>(false);
|
||||||
@@ -53,14 +39,9 @@ watch(show, () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
await displayBox(props);
|
|
||||||
});
|
|
||||||
|
|
||||||
async function displayBox(
|
async function displayBox(
|
||||||
props: TGApp.Plugins.Mys.Geetest.reqResp,
|
props: TGApp.Plugins.Mys.Geetest.reqResp,
|
||||||
): Promise<TGApp.Plugins.Mys.Geetest.validateResp | false> {
|
): Promise<TGApp.Plugins.Mys.Geetest.validateResp | false> {
|
||||||
if (!props.gt || !props.challenge) return false;
|
|
||||||
show.value = true;
|
show.value = true;
|
||||||
return await new Promise<TGApp.Plugins.Mys.Geetest.validateResp>((resolve) => {
|
return await new Promise<TGApp.Plugins.Mys.Geetest.validateResp>((resolve) => {
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
@@ -80,10 +61,10 @@ async function displayBox(
|
|||||||
captchaObj.onSuccess(async () => {
|
captchaObj.onSuccess(async () => {
|
||||||
const validate = captchaObj.getValidate();
|
const validate = captchaObj.getValidate();
|
||||||
resolve(validate);
|
resolve(validate);
|
||||||
|
});
|
||||||
captchaObj.onClose(() => {
|
captchaObj.onClose(() => {
|
||||||
show.value = false;
|
show.value = false;
|
||||||
});
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -68,8 +68,6 @@ export async function getCaptcha(
|
|||||||
referer: "https://user.miyoushe.com/",
|
referer: "https://user.miyoushe.com/",
|
||||||
"x-rpc-game_biz": TGConstant.Utils.GAME_BIZ,
|
"x-rpc-game_biz": TGConstant.Utils.GAME_BIZ,
|
||||||
};
|
};
|
||||||
console.log("getCaptcha header: ", header);
|
|
||||||
console.log("getCaptcha body: ", body);
|
|
||||||
const resp = await TGHttp<
|
const resp = await TGHttp<
|
||||||
TGApp.Plugins.Mys.CaptchaLogin.CaptchaResponse | TGApp.BBS.Response.Base
|
TGApp.Plugins.Mys.CaptchaLogin.CaptchaResponse | TGApp.BBS.Response.Base
|
||||||
>(
|
>(
|
||||||
@@ -129,8 +127,6 @@ export async function doCaptchaLogin(
|
|||||||
"x-rpc-device_model": device_model,
|
"x-rpc-device_model": device_model,
|
||||||
"user-agent": TGConstant.BBS.UA_MOBILE,
|
"user-agent": TGConstant.BBS.UA_MOBILE,
|
||||||
};
|
};
|
||||||
console.log("doCaptchaLogin header: ", header);
|
|
||||||
console.log("doCaptchaLogin body: ", body);
|
|
||||||
const resp = await TGHttp<TGApp.Plugins.Mys.CaptchaLogin.LoginResponse | TGApp.BBS.Response.Base>(
|
const resp = await TGHttp<TGApp.Plugins.Mys.CaptchaLogin.LoginResponse | TGApp.BBS.Response.Base>(
|
||||||
url,
|
url,
|
||||||
{
|
{
|
||||||
|
|||||||
5
src/plugins/Mys/types/CaptchaLogin.d.ts
vendored
5
src/plugins/Mys/types/CaptchaLogin.d.ts
vendored
@@ -44,13 +44,14 @@ declare namespace TGApp.Plugins.Mys.CaptchaLogin {
|
|||||||
* @interface CaptchaAigis
|
* @interface CaptchaAigis
|
||||||
* @property {string} session_id 会话 id
|
* @property {string} session_id 会话 id
|
||||||
* @property {number} mmt_type mmt 类型
|
* @property {number} mmt_type mmt 类型
|
||||||
* @property {TGApp.Plugins.Mys.Geetest.getData} data 数据
|
* @see TGApp.Plugins.Mys.Geetest.validateResp
|
||||||
|
* @property {string} data 数据,为上面的序列化数据
|
||||||
* @return CaptchaBody
|
* @return CaptchaBody
|
||||||
*/
|
*/
|
||||||
interface CaptchaAigis {
|
interface CaptchaAigis {
|
||||||
session_id: string;
|
session_id: string;
|
||||||
mmt_type: number;
|
mmt_type: number;
|
||||||
data: TGApp.Plugins.Mys.Geetest.reqResp;
|
data: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user