mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🐛 修复分享功能异常
This commit is contained in:
@@ -115,14 +115,11 @@ class TGClient {
|
||||
defaultPath: saveDefault,
|
||||
});
|
||||
if(savePath !== null) {
|
||||
var resBlob = await window.__TAURI_PLUGIN_HTTP__.fetch('${url}',{
|
||||
var resp = await window.__TAURI_PLUGIN_HTTP__.fetch('${url}',{
|
||||
method: 'GET'
|
||||
}).then(res => res.blob());
|
||||
var buffer = new Uint8Array(await resBlob.arrayBuffer());
|
||||
await window.__TAURI_PLUGIN_FS__.writeBinaryFile({
|
||||
contents: buffer,
|
||||
path: savePath
|
||||
});
|
||||
}).then(res => res.arrayBuffer());
|
||||
var buffer = new Uint8Array(resp);
|
||||
await window.__TAURI_PLUGIN_FS__.writeFile(savePath, buffer);
|
||||
alert('保存成功');
|
||||
}
|
||||
})();`;
|
||||
@@ -819,8 +816,7 @@ class TGClient {
|
||||
* @returns {Promise<void>} - 无返回值
|
||||
*/
|
||||
async share(arg: TGApp.Plugins.JSBridge.Arg<TGApp.Plugins.JSBridge.SharePayload>): Promise<void> {
|
||||
// 如果有数据
|
||||
if (arg.payload.type === "image" && arg.payload.content?.image_url !== undefined) {
|
||||
if (arg.payload.type === "default") {
|
||||
const image = arg.payload.content.image_url;
|
||||
const format = image.split(".").pop();
|
||||
const executeJS = this.getSaveImgJS(image, format ?? "png");
|
||||
@@ -902,6 +898,14 @@ class TGClient {
|
||||
return;
|
||||
}
|
||||
if (arg.payload.type === "image") {
|
||||
if (arg.payload.content?.image_url !== undefined) {
|
||||
const image = arg.payload.content.image_url;
|
||||
const format = image.split(".").pop();
|
||||
const executeJS = this.getSaveImgJS(image, format ?? "png");
|
||||
await core.invoke("execute_js", { label: "mhy_client", js: executeJS });
|
||||
await this.callback(arg.callback, {});
|
||||
return;
|
||||
}
|
||||
if (arg.payload.content?.image_base64 !== undefined) {
|
||||
let image = arg.payload.content.image_base64;
|
||||
image = `data:image/png;base64,${image}`;
|
||||
|
||||
19
src/vite-env.d.ts
vendored
19
src/vite-env.d.ts
vendored
@@ -1,10 +1,12 @@
|
||||
/**
|
||||
* @file vite-env.d.ts
|
||||
* @description vite-env.d.ts
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Beta v0.3.3
|
||||
* @description 全局类型定义文件
|
||||
* @since Beta v0.5.1
|
||||
*/
|
||||
|
||||
/**
|
||||
* @description vue 文件类型声明
|
||||
*/
|
||||
declare module "*.vue" {
|
||||
import type { DefineComponent } from "vue";
|
||||
const component: DefineComponent<object, object, any>;
|
||||
@@ -48,3 +50,14 @@ interface ImportMetaEnv {
|
||||
declare interface ImportMeta {
|
||||
readonly env: ImportMetaEnv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 极验验证的请求方法-请求参数
|
||||
* @param {TGApp.BBS.Geetest.InitGeetestParams} params
|
||||
* @param {(captchaObj: TGApp.BBS.Geetest.GeetestCaptcha) => void} callback
|
||||
* @return void
|
||||
*/
|
||||
declare function initGeetest(
|
||||
params: TGApp.Plugins.Mys.Geetest.InitGeetestParams,
|
||||
callback: (captchaObj: TGApp.Plugins.Mys.Geetest.GeetestCaptcha) => void,
|
||||
): void;
|
||||
|
||||
Reference in New Issue
Block a user