哆啦好梦 il y a 2 ans
Parent
commit
6e66a0b420

+ 1 - 1
electron/config/config.default.js

@@ -126,7 +126,7 @@ module.exports = (appInfo) => {
    * 主进程
    */     
   config.mainServer = {
-    host: '127.0.0.1',
+    host: 'localhost',
     port: 7072,
   }; 
 

+ 29 - 5
electron/jobs/example.js

@@ -1,11 +1,35 @@
+// const Exception = require('ee-core/module/exception');
+// Exception.start();
+const Job = require('ee-core/module/jobs/baseJobClass');
 const Loader = require('ee-core/module/loader');
 const Log = require('ee-core/module/log');
 const Ps = require('ee-core/module/utils/ps');
 const test = Loader.requireJobsModule('./test');
 
-// logger.info("[renderer] process: ", process);
-Log.info("[child-process] process type: ", Ps.processType());
-Log.info("[child-process] process cwd: ", process.cwd());
+//tests.hello();
 
-test.hello();
-//test.utilsMod();
+/**
+ * 示例服务
+ * @class
+ */
+class ExampleJob extends Job {
+
+  constructor(params) {
+    super();
+  }
+
+  /**
+   * Execute the job
+   */
+  async handle () {
+    // logger.info("[renderer] process: ", process);
+    Log.info("[child-process] process type: ", Ps.processType());
+    Log.info("[child-process] process cwd: ", process.cwd());
+
+    tests.hello();
+    //test.utilsMod();
+  }   
+}
+
+ExampleJob.toString = () => '[class ExampleJob]';
+module.exports = ExampleJob;

+ 13 - 0
electron/jobs/hello.js

@@ -0,0 +1,13 @@
+const Loader = require('ee-core/module/loader');
+const Log = require('ee-core/module/log');
+const Ps = require('ee-core/module/utils/ps');
+const test = Loader.requireJobsModule('./test');
+
+
+module.exports = () => {
+  Log.info("[child-process] process type: ", Ps.processType());
+  Log.info("[child-process] process cwd: ", process.cwd());
+
+  test.hello();
+  //test.utilsMod();
+};

+ 2 - 2
electron/preload/index.js

@@ -3,7 +3,6 @@
  *************************************************/
 
 const ChildJob = require('ee-core/module/jobs/child');
-// const OriginJob = require('ee-core/module/jobs/unification');
 const UtilsPs = require('ee-core/module/utils/ps');
 const Log = require('ee-core/module/log');
 const test = require('./test');
@@ -31,7 +30,8 @@ module.exports = async (app) => {
   test();
 
   let myJob = new ChildJob();
-  myJob.run('exampleJob', './jobs/example.js');
+  //myJob.run('exampleJob', './jobs/example.js');
+  myJob.run('exampleJob', './jobs/hello.js');
 
   // let opt2 = {
   //   dev: true,

+ 1 - 1
frontend/src/api/main.js

@@ -52,7 +52,7 @@ const specialIpcRoute = {
 const requestHttp = (uri, parameter) => {
   // url转换
   const config = storage.get('httpServiceConfig');
-  const host = config.server || 'http://127.0.0.1:7071';
+  const host = config.server || 'http://localhost:7071';
   let url = uri.split('.').join('/');
   url = host + '/' + url;
   console.log('url:', url);

+ 1 - 1
frontend/src/views/base/file/Index.vue

@@ -117,7 +117,7 @@ export default {
           storage.set('httpServiceConfig', r);
 
           // url转换
-          const host = r.server || 'http://127.0.0.1:7071';
+          const host = r.server || 'http://localhost:7071';
           let uri = ipcApiRoute.uploadFile;
           let url = uri.split('.').join('/');
           this.action_url = host + '/' + url;

+ 1 - 1
frontend/src/views/base/socket/SocketServer.vue

@@ -31,7 +31,7 @@ export default {
   data() {
     return {
       currentStatus: '关闭',
-      servicAddress: 'ws://127.0.0.1:7070'
+      servicAddress: 'ws://localhost:7070'
     };
   },
   mounted () {