From d2352053a7b263a75790f6846840d424e2256b2d Mon Sep 17 00:00:00 2001 From: dgflash Date: Thu, 4 Aug 2022 18:30:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=84=9F=E8=B0=A2Bz=E4=BF=AE=E5=A4=8DUrlParse?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E8=A7=A3=E6=9E=90=E8=85=BE=E8=AE=AF=E6=B8=B8?= =?UTF-8?q?=E6=88=8F=E5=A4=A7=E5=8E=85=E7=9A=84=E5=9C=B0=E5=9D=80=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=8F=82=E6=95=B0=E6=95=B0=E6=8D=AE=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + assets/script/Main.ts | 2 +- .../script/game/common/config/GameConfig.ts | 2 +- assets/script/game/common/config/UrlParse.ts | 21 +++++++++++-------- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 88dc9bc..fdecfab 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ Oops Framework 基于 Cocos Creato 3.x 开发的一款游戏框架 #### 贡献榜 | 时间 | 开发者 | 贡献内容 | | ---------- | -------- | ------------------------------------------------------------------------------------------- | +| 2022-08-04 | Bz | 修复UrlParse对象解析腾讯游戏大厅的地址查询参数数据错误问题 | | 2022-06-02 | 羽毛先生 | 修复 UI 框架中界面无法不销毁移除的问题; 修复UI框架中从缓存获取界面时,传递新参数不更新问题 | | 2022-04-15 | Hess | 建议优化 ecs 框架所有生命周期事件在处理多实体时,将批处理逻辑移到框架层实现,减小业务代码量 | | 2021-10-13 | laret | 修复 Dialog 类型的 UI 不能连续触发 | diff --git a/assets/script/Main.ts b/assets/script/Main.ts index 86f2a78..1c8ce5d 100644 --- a/assets/script/Main.ts +++ b/assets/script/Main.ts @@ -2,7 +2,7 @@ * @Author: dgflash * @Date: 2021-07-03 16:13:17 * @LastEditors: dgflash - * @LastEditTime: 2022-07-26 15:20:27 + * @LastEditTime: 2022-08-04 18:28:51 */ import { dynamicAtlasManager, macro, profiler, _decorator } from 'cc'; import { DEBUG, JSB } from 'cc/env'; diff --git a/assets/script/game/common/config/GameConfig.ts b/assets/script/game/common/config/GameConfig.ts index 4127150..cf28f20 100644 --- a/assets/script/game/common/config/GameConfig.ts +++ b/assets/script/game/common/config/GameConfig.ts @@ -2,7 +2,7 @@ * @Author: dgflash * @Date: 2021-07-03 16:13:17 * @LastEditors: dgflash - * @LastEditTime: 2022-08-02 14:25:50 + * @LastEditTime: 2022-08-04 13:51:36 */ import { Logger } from "../../../../../extensions/oops-plugin-framework/assets/core/common/log/Logger"; diff --git a/assets/script/game/common/config/UrlParse.ts b/assets/script/game/common/config/UrlParse.ts index 9b57920..654c5c6 100644 --- a/assets/script/game/common/config/UrlParse.ts +++ b/assets/script/game/common/config/UrlParse.ts @@ -2,7 +2,7 @@ * @Author: dgflash * @Date: 2022-07-26 15:27:57 * @LastEditors: dgflash - * @LastEditTime: 2022-08-02 14:26:06 + * @LastEditTime: 2022-08-04 18:21:41 */ import { sys } from "cc"; @@ -24,20 +24,23 @@ export class UrlParse { } private parseUrl() { - if (typeof window !== "object") { - return {}; - } - if (!window.document) { - return {}; - } + if (typeof window !== "object") return {}; + if (!window.document) return {}; + let url = window.document.location.href.toString(); let u = url.split("?"); if (typeof (u[1]) == "string") { u = u[1].split("&"); let get: any = {}; for (let i = 0, l = u.length; i < l; ++i) { - let j = u[i].split("="); - get[j[0]] = j[1]; + let j = u[i]; + let x = j.indexOf("="); + if (x < 0) { + continue; + } + let key = j.substring(0, x); + let value = j.substring(x + 1); + get[decodeURIComponent(key)] = value && decodeURIComponent(value); } return get; }