修复获取服务端配置,未使用配置的服务端地址的bug。

This commit is contained in:
tengge1 2020-03-29 14:57:19 +08:00
parent 276092dfea
commit bbaaa2e8d2
3 changed files with 8 additions and 5 deletions

View File

@ -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)】

View File

@ -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();

View File

@ -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 => {