From bbaaa2e8d28731040c4ea7db7d32e375c8fcaef2 Mon Sep 17 00:00:00 2001 From: tengge1 <930372551@qq.com> Date: Sun, 29 Mar 2020 14:57:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=AB=AF=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=9C=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E9=85=8D=E7=BD=AE=E7=9A=84=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E7=9A=84bug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + ShadowEditor.Web/src/Application.js | 2 +- ShadowEditor.Web/src/utils/Server.js | 10 ++++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4a14462c..bb58d0e1 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Supported Languages: 中文 / [繁體中文](README-tw.md) / [English](README-en 4. 修复`背景音乐组件`发布场景时,未导出音乐文件bug。 5. 修复了一个严重bug,由于多次调用`clock.getElapsedTime`,导致所有动画播放变慢bug。 6. 修复`视频贴图`发布场景后,视频地址不正确bug。 +7. 修复获取服务端配置,未使用配置的服务端地址的bug。 ## v0.4.5更新【[更新日志](docs-dev/update/UpdateLog.md)】 diff --git a/ShadowEditor.Web/src/Application.js b/ShadowEditor.Web/src/Application.js index ac98ce2a..37b758ec 100644 --- a/ShadowEditor.Web/src/Application.js +++ b/ShadowEditor.Web/src/Application.js @@ -38,7 +38,7 @@ function Application(container, options) { this.debug = this.storage.get('debug') || false; // 服务端配置 - this.server = new Server(); + this.server = new Server(this.options.server); // 包管理器 this.packageManager = new PackageManager(); diff --git a/ShadowEditor.Web/src/utils/Server.js b/ShadowEditor.Web/src/utils/Server.js index 9bf7c20e..d68d0d5f 100644 --- a/ShadowEditor.Web/src/utils/Server.js +++ b/ShadowEditor.Web/src/utils/Server.js @@ -3,7 +3,9 @@ * @author tengge / https://github.com/tengge1 */ class Server { - constructor() { + constructor(server) { + this.origin = server; + this.enableAuthority = false; // 是否开启权限 this.initialized = false; // 系统是否初始化 @@ -23,7 +25,7 @@ class Server { load() { return new Promise(resolve => { - fetch(`/api/Config/Get`).then(response => { + fetch(`${this.origin}/api/Config/Get`).then(response => { response.json().then(obj => { if (obj.Code !== 200) { app.toast(_t(obj.Msg), 'warn'); @@ -60,7 +62,7 @@ class Server { login(username, password) { return new Promise(resolve => { - fetch(`/api/Login/Login`, { + fetch(`${this.origin}/api/Login/Login`, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' @@ -94,7 +96,7 @@ class Server { logout() { return new Promise(resolve => { - fetch(`/api/Login/Logout`, { + fetch(`${this.origin}/api/Login/Logout`, { method: 'POST' }).then(response => { response.json().then(obj => {