From e5b166415fe9dc840df2389ff2cd26f3ff6b90ee Mon Sep 17 00:00:00 2001 From: JianMiau Date: Mon, 29 Aug 2022 09:54:55 +0800 Subject: [PATCH] =?UTF-8?q?[mod]=20=E7=9B=A3=E8=81=BD=E6=99=82=E6=A9=9F?= =?UTF-8?q?=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Script/Manager.ts | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/assets/Script/Manager.ts b/assets/Script/Manager.ts index 7a6093e..4126073 100644 --- a/assets/Script/Manager.ts +++ b/assets/Script/Manager.ts @@ -31,6 +31,22 @@ export default class Manager extends cc.Component { let self: this = this; // this._text_to_Speech = new Text_to_Speech(); + let href: string = window.location.href; + + // let url: string = `http://220.134.195.1/public/bonus_casino/html5/jianmiau/Test/?host=${href}&v=${Date.now()}`; + // let url: string = `https://karolchang.github.io/jm-expense-vue-ts/?host=${href}&ignore=${Date.now()}`; + // let url: string = `http://karol.jianmiau.cf/jm-expense-vue-ts/?v=${Date.now()}`; + let url: string = `https://jm-expense-2022.firebaseapp.com/login?host=${href}&v=${Date.now()}`; + this.webview.url = url; + this.webview.node.active = true; + + cc.view.setResizeCallback(this._resize.bind(this)); + this._resize(); + + const FCMToken: string = NativeClass.Instance.GetFCMToken(); + console.log(`FCMToken ${FCMToken}`); + + // Set EventListener window.addEventListener("message", function (e: MessageEvent): void { let data: any = e.data; let method: string = data.method; @@ -47,7 +63,7 @@ export default class Manager extends cc.Component { } let scheme: string = "jmka"; this.webview.setJavascriptInterfaceScheme(scheme); - this.webview.setOnJSCallback((sender, url) => { + this.webview.setOnJSCallback((sender: any, url: any) => { let data: JSON = JSON.parse(decodeURI(url.split(`${scheme}://`)[1])); let method: any = data["method"]; let value: any = data["value"]; @@ -55,20 +71,6 @@ export default class Manager extends cc.Component { self.Birdge(method, ...value); } }); - let href: string = window.location.href; - - // let url: string = `http://220.134.195.1/public/bonus_casino/html5/jianmiau/Test/?host=${href}&v=${Date.now()}`; - // let url: string = `https://karolchang.github.io/jm-expense-vue-ts/?host=${href}&ignore=${Date.now()}`; - // let url: string = `http://karol.jianmiau.cf/jm-expense-vue-ts/?v=${Date.now()}`; - let url: string = `https://jm-expense-2022.firebaseapp.com/login?host=${href}&v=${Date.now()}`; - this.webview.url = url; - this.webview.node.active = true; - - cc.view.setResizeCallback(this._resize.bind(this)); - this._resize(); - - const FCMToken: string = NativeClass.Instance.GetFCMToken(); - console.log(`FCMToken ${FCMToken}`); } /** 跨版本溝通