ee-core 2.2.3-beta.1 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ee/eeApp.js +19 -11
- package/package.json +1 -1
package/ee/eeApp.js
CHANGED
|
@@ -128,7 +128,7 @@ class EeApp extends BaseApp {
|
|
|
128
128
|
const mainServer = this.config.mainServer;
|
|
129
129
|
if (Conf.isFileProtocol(mainServer)) {
|
|
130
130
|
url = path.join(this.config.homeDir, mainServer.indexPath);
|
|
131
|
-
this.loadMainUrl('spa', url);
|
|
131
|
+
this.loadMainUrl('spa', url, 'file');
|
|
132
132
|
} else {
|
|
133
133
|
this.loadLocalWeb('spa');
|
|
134
134
|
}
|
|
@@ -138,7 +138,6 @@ class EeApp extends BaseApp {
|
|
|
138
138
|
* 加载本地前端资源
|
|
139
139
|
*/
|
|
140
140
|
loadLocalWeb(mode, staticDir, hostInfo) {
|
|
141
|
-
const self = this;
|
|
142
141
|
if (!staticDir) {
|
|
143
142
|
staticDir = path.join(this.config.homeDir, 'public', 'dist')
|
|
144
143
|
}
|
|
@@ -168,27 +167,36 @@ class EeApp extends BaseApp {
|
|
|
168
167
|
Log.coreLogger.info('[ee-core] [lib/eeApp] createServer error: ', err);
|
|
169
168
|
return
|
|
170
169
|
}
|
|
171
|
-
|
|
170
|
+
this.loadMainUrl(mode, url);
|
|
172
171
|
});
|
|
173
172
|
} else {
|
|
174
173
|
koaApp.listen(mainServer.port, () => {
|
|
175
|
-
|
|
174
|
+
this.loadMainUrl(mode, url);
|
|
176
175
|
});
|
|
177
176
|
}
|
|
178
177
|
}
|
|
179
178
|
|
|
180
179
|
/**
|
|
181
|
-
*
|
|
180
|
+
* 主服务
|
|
181
|
+
* @params load <string> value: "url" 、 "file"
|
|
182
182
|
*/
|
|
183
|
-
loadMainUrl(type, url) {
|
|
183
|
+
loadMainUrl(type, url, load = 'url') {
|
|
184
184
|
const mainServer = this.config.mainServer;
|
|
185
185
|
Log.coreLogger.info('[ee-core] Env: %s, Type: %s', this.config.env, type);
|
|
186
186
|
Log.coreLogger.info('[ee-core] App running at: %s', url);
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
if (load == 'file') {
|
|
188
|
+
this.mainWindow.loadFile(url, mainServer.options)
|
|
189
|
+
.then()
|
|
190
|
+
.catch((err)=>{
|
|
191
|
+
Log.coreLogger.error(`[ee-core] Please check the ${url} !`);
|
|
192
|
+
});
|
|
193
|
+
} else {
|
|
194
|
+
this.mainWindow.loadURL(url, mainServer.options)
|
|
195
|
+
.then()
|
|
196
|
+
.catch((err)=>{
|
|
197
|
+
Log.coreLogger.error(`[ee-core] Please check the ${url} !`);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
192
200
|
}
|
|
193
201
|
|
|
194
202
|
/**
|