🐛 修复窗口适配异常

This commit is contained in:
BTMuli
2025-11-20 18:02:53 +08:00
parent 5298ecdd0a
commit 999ddc708c
2 changed files with 35 additions and 46 deletions

View File

@@ -5,11 +5,8 @@
declare namespace TGApp.BBS.Geetest {
/**
* @description 创建验证的响应
* 创建验证的响应
* @since Beta v0.7.1
* @interface CreateResp
* @extends TGApp.BBS.Response.BaseWithData
* @property {CreateRes} data - 极验验证数据
*/
type CreateResp = TGApp.BBS.Response.BaseWithData<CreateRes>;
@@ -54,45 +51,45 @@ declare namespace TGApp.BBS.Geetest {
};
/**
* @description 验证极验验证的响应
* 验证极验验证的响应
* @since Beta v0.7.1
* @interface VerifyResp
* @extends TGApp.BBS.Response.Base
* @property {VerifyRes} data - 极验验证数据
*/
type VerifyResp = TGApp.BBS.Response.BaseWithData<VerifyRes>;
/**
* @description 极验验证的请求数据
* 极验验证的请求数据
* @since Beta v0.7.1
* @interface VerifyRes
* @property {string} challenge - 极验验证 challenge
* @property {string} validate - 极验验证 validate
*/
type VerifyRes = { challenge: string };
type VerifyRes = {
/* 极验验证 challenge */
challenge: string;
};
/**
* @description 极验验证的请求方法-请求参数
* 极验验证的请求方法-请求参数
* @since Beta v0.7.1
* @interface InitGeetestParams
* @property {string} gt - 极验验证 gt
* @property {string} challenge - 极验验证 challenge
* @property {boolean} offline - 极验验证 offline
* @property {boolean} new_captcha - 极验验证 new_captcha
* @property {string} product - 极验验证 product
* @property {string} width - 极验验证 width
* @property {string} area - 极验验证 area
*/
type InitGeetestParams = {
/* gt */
gt: string;
/* challenge */
challenge: string;
/* 是否离线 */
offline: boolean;
/* 是否是新验证码 */
new_captcha: boolean;
/* 验证形式 */
product: string;
/* 宽度 */
width: string;
/* 覆盖区域 */
area: string;
};
/**
* 初始化 Gt4 验证的请求参数
* @since Beta v0.8.7
*/
type InitGeetest4Params = {
/* 验证ID */
captchaId: string;
@@ -109,33 +106,26 @@ declare namespace TGApp.BBS.Geetest {
};
/**
* @description Geetest 插件 captchaObj
* @since Beta v0.8.3
* @interface GeetestCaptcha
* @property {Function} appendTo
* @property {Function} getValidate
* @property {Function} onClose
* @property {Function} onReady
* GeetestCaptcha 对象
* @since Beta v0.8.7
*/
type GeetestCaptcha = {
/* 将验证码添加到指定的选择器中 */
appendTo: (selector: string) => void;
/* 获取验证结果 */
getValidate: () => Promise<GeetestVerifyRes>;
/* 关闭回调 */
onClose: (callback: () => void) => boolean;
/* 准备就绪回调 */
onReady: (callback: () => void) => void;
/* 成功回调 */
onSuccess: (callback: () => void) => void;
};
/**
* @description Geetest 插件 validate
* @since Beta v0.7.1
* @interface GeetestVerifyRes
* @property {string} geetest_challenge
* @property {string} geetest_validate
* @property {string} geetest_seccode
* 验证成功返回数据
* @since Beta v0.8.7
* @remarks 由于目前都是直接转 base64 字符串返回,故类型定义为 unknown
*/
type GeetestVerifyRes = {
geetest_challenge: string;
geetest_validate: string;
geetest_seccode: string;
};
type GeetestVerifyRes = unknown;
}

View File

@@ -1,7 +1,6 @@
/**
* @file utils/TGWindow.ts
* @description 窗口创建相关工具函数
* @since Beta v0.7.9
* 窗口创建相关工具
* @since Beta v0.8.7
*/
import type { RenderCard } from "@comp/app/t-postcard.vue";
@@ -101,8 +100,8 @@ export function getWindowSize(label: string): PhysicalSize {
}
/**
* @description 窗口适配
* @since Beta v0.7.9
* 窗口适配
* @since Beta v0.8.7
* @returns Promise<void>
*/
export async function resizeWindow(): Promise<void> {
@@ -119,7 +118,7 @@ export async function resizeWindow(): Promise<void> {
const targetWidth = Math.round(designSize.width * widthScale);
const targetHeight = Math.round(designSize.height * heightScale);
await windowCur.setSize(new PhysicalSize(targetWidth, targetHeight));
const targetZoom = Math.min(widthScale, heightScale) / screen.scaleFactor;
const targetZoom = Math.min(widthScale, heightScale);
await windowCur.setZoom(targetZoom);
await windowCur.setFocus();
}