Browse Source

remove egg

gaoshuaixing 3 years ago
parent
commit
1d1029f52c
75 changed files with 113 additions and 522 deletions
  1. 0 0
      app/common/constants.js
  2. 0 57
      app/controller/base.js
  3. 0 123
      app/controller/example.js
  4. 0 21
      app/controller/home.js
  5. 0 22
      app/extend/context.js
  6. 0 8
      app/middleware/auth.js
  7. 0 1
      app/public/css/app.5db0c334.css
  8. 0 1
      app/public/css/chunk-0cf38b6e.6a9bab8f.css
  9. 0 1
      app/public/css/chunk-25a0809c.f5788196.css
  10. 0 1
      app/public/css/chunk-26360310.4b14b6bb.css
  11. 0 1
      app/public/css/chunk-26fcacb7.6c177387.css
  12. 0 1
      app/public/css/chunk-2f42023a.64a5cb0d.css
  13. 0 1
      app/public/css/chunk-30d91a2c.fc17c30a.css
  14. 0 1
      app/public/css/chunk-4557c3f4.69d9af12.css
  15. 0 1
      app/public/css/chunk-490df4c2.11e2850e.css
  16. 0 1
      app/public/css/chunk-4d0be246.94e812c5.css
  17. 0 1
      app/public/css/chunk-5d9adce2.c38e352c.css
  18. 0 1
      app/public/css/chunk-72d90f2a.ffa3e4f4.css
  19. 0 1
      app/public/css/chunk-9234b1da.0f3904b9.css
  20. 0 1
      app/public/css/chunk-94d99d1e.8159476a.css
  21. 0 1
      app/public/css/chunk-b67071c4.a4424700.css
  22. 0 1
      app/public/css/chunk-b8ab1f0c.9e732e2f.css
  23. 0 0
      app/public/css/chunk-vendors.9ca8efee.css
  24. BIN
      app/public/img/logo.18776b4e.png
  25. 0 6
      app/public/index.html
  26. 0 0
      app/public/js/app.886b57a8.js
  27. 0 0
      app/public/js/app.886b57a8.js.map
  28. 0 2
      app/public/js/chunk-0cf38b6e.73befe57.js
  29. 0 0
      app/public/js/chunk-0cf38b6e.73befe57.js.map
  30. 0 0
      app/public/js/chunk-25a0809c.02387fee.js
  31. 0 0
      app/public/js/chunk-25a0809c.02387fee.js.map
  32. 0 0
      app/public/js/chunk-26360310.90f0183a.js
  33. 0 0
      app/public/js/chunk-26360310.90f0183a.js.map
  34. 0 0
      app/public/js/chunk-26fcacb7.ea9d617c.js
  35. 0 0
      app/public/js/chunk-26fcacb7.ea9d617c.js.map
  36. 0 0
      app/public/js/chunk-2f42023a.248fc31f.js
  37. 0 0
      app/public/js/chunk-2f42023a.248fc31f.js.map
  38. 0 2
      app/public/js/chunk-30d91a2c.75899154.js
  39. 0 0
      app/public/js/chunk-30d91a2c.75899154.js.map
  40. 0 0
      app/public/js/chunk-4557c3f4.1b432690.js
  41. 0 0
      app/public/js/chunk-4557c3f4.1b432690.js.map
  42. 0 0
      app/public/js/chunk-490df4c2.c8a48363.js
  43. 0 0
      app/public/js/chunk-490df4c2.c8a48363.js.map
  44. 0 0
      app/public/js/chunk-4d0be246.c4270f08.js
  45. 0 0
      app/public/js/chunk-4d0be246.c4270f08.js.map
  46. 0 0
      app/public/js/chunk-5d9adce2.1c2491c7.js
  47. 0 0
      app/public/js/chunk-5d9adce2.1c2491c7.js.map
  48. 0 0
      app/public/js/chunk-72d90f2a.bd6dc740.js
  49. 0 0
      app/public/js/chunk-72d90f2a.bd6dc740.js.map
  50. 0 0
      app/public/js/chunk-9234b1da.fc4b38c0.js
  51. 0 0
      app/public/js/chunk-9234b1da.fc4b38c0.js.map
  52. 0 0
      app/public/js/chunk-94d99d1e.e7d74208.js
  53. 0 0
      app/public/js/chunk-94d99d1e.e7d74208.js.map
  54. 0 0
      app/public/js/chunk-b67071c4.2a87e101.js
  55. 0 0
      app/public/js/chunk-b67071c4.2a87e101.js.map
  56. 0 0
      app/public/js/chunk-b8ab1f0c.0f41b54b.js
  57. 0 0
      app/public/js/chunk-b8ab1f0c.0f41b54b.js.map
  58. 0 4
      app/public/js/chunk-vendors.23b80c7c.js
  59. 0 0
      app/public/js/chunk-vendors.23b80c7c.js.map
  60. 0 21
      app/router/example.js
  61. 0 16
      app/router/index.js
  62. 0 22
      app/schedule/example.js
  63. 0 72
      app/service/example.js
  64. 0 7
      app/utils/index.js
  65. 0 11
      app/view/hello.ejs
  66. 0 6
      app/view/index.ejs
  67. 3 7
      electron/config/config.default.js
  68. 54 2
      electron/controller/example.js
  69. 5 1
      electron/service/storage.js
  70. 2 0
      frontend/src/api/main.js
  71. 0 5
      frontend/src/config/router.config.js
  72. 0 6
      frontend/src/layouts/Menu.vue
  73. 43 20
      frontend/src/views/base/db/Index.vue
  74. 4 54
      frontend/src/views/base/file/Index.vue
  75. 2 11
      package.json

+ 0 - 0
app/common/constants.js


+ 0 - 57
app/controller/base.js

@@ -1,57 +0,0 @@
-'use strict';
-
-const Controller = require('egg').Controller;
-
-class BaseController extends Controller {
-  constructor(ctx) {
-    super(ctx);
-  }
-
-  /*
-   * return success
-   * @params: object data
-   * @params: string msg
-   * @return: object { success, code, msg, data }
-   */
-  sendSuccess(data, msg) {
-    const { ctx } = this;
-    ctx.body = {
-      success: true,
-      code: 0,
-      msg,
-      data,
-    };
-    ctx.status = 200;
-  }
-
-  /*
-   * return fail
-   * @params: object data
-   * @params: string msg
-   * @return: object { success, code, msg, data }
-   */
-  sendFail(data, msg, code) {
-    const { ctx } = this;
-    ctx.body = {
-      success: false,
-      code,
-      msg,
-      data,
-    };
-    ctx.status = 200;
-  }
-
-  /*
-   * return sendData
-   * @params: object data
-   * @params: string msg
-   * @return: object { success, code, msg, data }
-   */
-  sendData(data) {
-    const { ctx } = this;
-    ctx.body = data;
-    ctx.status = 200;
-  }
-}
-
-module.exports = BaseController;

+ 0 - 123
app/controller/example.js

@@ -1,123 +0,0 @@
-'use strict';
-
-const BaseController = require('./base');
-const fs = require('fs');
-const path = require('path');
-const Utils = require('ee-core').Utils;
-
-class ExampleController extends BaseController {
-
-  /**
-   * test electron api
-   */
-  async test1() {
-    const { ctx, service } = this;
-    const body = ctx.request.body;
-    const id = body.id;
-    const data = {};
-
-    await service.example.test1(id);
-
-    this.sendSuccess(data);
-  }
-
-  /**
-   * 上传文件
-   */  
-  async uploadFile() {
-    const self = this;
-    const { ctx, service } = this;
-    let tmpDir = Utils.getLogDir();
-    const file = ctx.request.files[0];
-
-    try {
-      let tmpFile = fs.readFileSync(file.filepath)
-      fs.writeFileSync(path.join(tmpDir, file.filename), tmpFile)
-    } finally {
-      await fs.unlink(file.filepath, function(){});
-    }
-    const fileStream = fs.createReadStream(path.join(tmpDir, file.filename))
-    const uploadRes = await service.example.uploadFileToSMMS(fileStream);
-
-    self.sendData(uploadRes);
-  }
-
-  async uploadExtension() {
-    const self = this;
-    const { ctx, service } = this;
-    const data = {};
-    let tmpDir = Utils.getLogDir();
-
-    const file = ctx.request.files[0];
-    this.app.logger.info('file:', file);
-
-    try {
-      let tmpFile = fs.readFileSync(file.filepath)
-      fs.writeFileSync(path.join(tmpDir, file.filename), tmpFile)
-    } finally {
-      await fs.unlink(file.filepath, function(){});
-    }
-    
-    const filePath = path.join(tmpDir, file.filename);
-    await service.example.loadExtension(filePath);
-
-    self.sendData(data);
-  }
-
-  /**
-   * json数据库操作
-   */   
-  async dbOperation() {
-    const self = this;
-    const { ctx, service } = this;
-    const paramsObj = ctx.request.body;
-    const data = {
-      action: paramsObj.action,
-      result: null,
-      all_list: []
-    };
-    
-    switch (paramsObj.action) {
-      case 'add' :
-        data.result = await service.storage.addTestData(paramsObj.info);;
-        break;
-      case 'del' :
-        data.result = await service.storage.delTestData(paramsObj.delete_name);;
-        break;
-      case 'update' :
-        data.result = await service.storage.updateTestData(paramsObj.update_name, paramsObj.update_age);
-        break;
-      case 'get' :
-        data.result = await service.storage.getTestData(paramsObj.search_age);
-        break;
-    }
-
-    data.all_list = await service.storage.getAllTestData();
-
-    self.sendSuccess(data);
-  }
-
-  /**
-   * 显示消息对话框
-   */
-  async messageShow() {
-    const { service } = this;
-    const data = {};
-    await service.example.messageShow();
-
-    this.sendSuccess(data);
-  }
-
-  /**
-   * 显示消息对话框和确认
-   */
-  async messageShowConfirm() {
-    const { service } = this;
-    const data = {};
-    await service.example.messageShowConfirm();
-
-    this.sendSuccess(data);
-  }
-}
-
-module.exports = ExampleController;

+ 0 - 21
app/controller/home.js

@@ -1,21 +0,0 @@
-'use strict';
-
-const BaseController = require('./base');
-
-class HomeController extends BaseController {
-
-  /**
-   * 单页应用入口(vue、react等)
-   */
-  async index() {
-    const { ctx } = this;
-
-    const data = {
-      title: 'hello ee'
-    };
-
-    await ctx.render('index.ejs', data);
-  }
-}
-
-module.exports = HomeController;

+ 0 - 22
app/extend/context.js

@@ -1,22 +0,0 @@
-/**
- *
- * @type {{foo(*)}}
- */
-'use strict';
-module.exports = {
-  success(msg, data, total) {
-    this.body = {
-      success: true,
-      msg,
-      result: data,
-      total,
-    };
-  },
-  failure(msg, data) {
-    this.body = {
-      success: false,
-      msg,
-      result: data,
-    };
-  }
-};

+ 0 - 8
app/middleware/auth.js

@@ -1,8 +0,0 @@
-'use strict';
-
-module.exports = () => {
-  return async function auth(ctx, next) {
-
-    await next();
-  };
-};

+ 0 - 1
app/public/css/app.5db0c334.css

@@ -1 +0,0 @@
-#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50}#app,#app-layout-sider[data-v-9dbf58d6]{height:100%}#app-layout-sider .logo[data-v-9dbf58d6]{border-bottom:1px solid #e8e8e8}#app-layout-sider .pic-logo[data-v-9dbf58d6]{height:32px;margin:10px}#app-layout-sider .layout-sider[data-v-9dbf58d6]{border-top:1px solid #e8e8e8;border-right:1px solid #e8e8e8}#app-layout-sider .menu-item .ant-menu-item[data-v-9dbf58d6]{background-color:#fff;margin-top:0;margin-bottom:0;padding:0 0!important}#app-menu[data-v-6f147216]{height:100%;text-align:center}#app-menu .layout-sider[data-v-6f147216]{border-top:1px solid #e8e8e8;border-right:1px solid #e8e8e8;background-color:#fafafa;overflow:auto}

+ 0 - 1
app/public/css/chunk-0cf38b6e.6a9bab8f.css

@@ -1 +0,0 @@
-#app-other[data-v-041b2204]{padding:0 10px;text-align:left;width:100%}#app-other .one-block-1[data-v-041b2204]{font-size:16px;padding-top:10px}#app-other .one-block-2[data-v-041b2204]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-25a0809c.f5788196.css

@@ -1 +0,0 @@
-#app-base-test-api[data-v-48ca31fa]{padding:0 10px;text-align:left;width:100%}#app-base-test-api .one-block-1[data-v-48ca31fa]{font-size:16px;padding-top:10px}#app-base-test-api .one-block-2[data-v-48ca31fa]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-26360310.4b14b6bb.css

@@ -1 +0,0 @@
-#app-demo-window[data-v-cae527a6]{padding:0 10px;text-align:left;width:100%}#app-demo-window .one-block-1[data-v-cae527a6]{font-size:16px;padding-top:10px}#app-demo-window .one-block-2[data-v-cae527a6]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-26fcacb7.6c177387.css

@@ -1 +0,0 @@
-#app-base-system-launch[data-v-59a6529a]{padding:0 10px;text-align:left;width:100%}#app-base-system-launch .one-block-1[data-v-59a6529a]{font-size:16px;padding-top:10px}#app-base-system-launch .one-block-2[data-v-59a6529a]{padding-top:10px}#app-base-system-launch .set-auto .ant-list-item[data-v-59a6529a]:last-child{border-bottom:1px solid #e8e8e8}

+ 0 - 1
app/public/css/chunk-2f42023a.64a5cb0d.css

@@ -1 +0,0 @@
-#app-base-socket-ipc[data-v-19858933]{padding:0 10px;text-align:left;width:100%}#app-base-socket-ipc .one-block-1[data-v-19858933]{font-size:16px;padding-top:10px}#app-base-socket-ipc .one-block-2[data-v-19858933]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-30d91a2c.fc17c30a.css

@@ -1 +0,0 @@
-#app-base-extension[data-v-3d9f484a]{padding:0 10px;text-align:left;width:100%}#app-base-extension .one-block-1[data-v-3d9f484a]{font-size:16px;padding-top:10px}#app-base-extension .one-block-2[data-v-3d9f484a]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-4557c3f4.69d9af12.css

@@ -1 +0,0 @@
-#app-base-db[data-v-69dfc928]{padding:0 10px;text-align:left;width:100%}#app-base-db .one-block-1[data-v-69dfc928]{font-size:16px;padding-top:10px}#app-base-db .one-block-2[data-v-69dfc928]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-490df4c2.11e2850e.css

@@ -1 +0,0 @@
-#app-base-window[data-v-a421017e]{padding:0 10px;text-align:left;width:100%}#app-base-window .one-block-1[data-v-a421017e]{font-size:16px;padding-top:10px}#app-base-window .one-block-2[data-v-a421017e]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-4d0be246.94e812c5.css

@@ -1 +0,0 @@
-#app-base-window-view[data-v-5946c2ed]{padding:0 10px;text-align:left;width:100%}#app-base-window-view .one-block-1[data-v-5946c2ed]{font-size:16px;padding-top:10px}#app-base-window-view .one-block-2[data-v-5946c2ed]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-5d9adce2.c38e352c.css

@@ -1 +0,0 @@
-#app-base-file[data-v-928df296]{padding:0 10px;text-align:left;width:100%}#app-base-file .one-block-1[data-v-928df296]{font-size:16px;padding-top:10px}#app-base-file .footer[data-v-928df296],#app-base-file .one-block-2[data-v-928df296]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-72d90f2a.ffa3e4f4.css

@@ -1 +0,0 @@
-#app-base-screen[data-v-452151ab]{padding:0 10px;text-align:left;width:100%}#app-base-screen .one-block-1[data-v-452151ab]{font-size:16px;padding-top:10px}#app-base-screen .one-block-2[data-v-452151ab]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-9234b1da.0f3904b9.css

@@ -1 +0,0 @@
-#app-base-notification[data-v-eb783aa2]{padding:0 10px;text-align:left;width:100%}#app-base-notification .one-block-1[data-v-eb783aa2]{font-size:16px;padding-top:10px}#app-base-notification .one-block-2[data-v-eb783aa2]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-94d99d1e.8159476a.css

@@ -1 +0,0 @@
-#app-base-software-open[data-v-a899c27c]{padding:0 10px;text-align:left;width:100%}#app-base-software-open .one-block-1[data-v-a899c27c]{font-size:16px;padding-top:10px}#app-base-software-open .one-block-1 .sub-content[data-v-a899c27c]{font-size:14px}#app-base-software-open .one-block-2[data-v-a899c27c]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-b67071c4.a4424700.css

@@ -1 +0,0 @@
-#app-base-screen[data-v-716fa21e]{padding:0 10px;text-align:left;width:100%}#app-base-screen .one-block-1[data-v-716fa21e]{font-size:16px;padding-top:10px}#app-base-screen .one-block-2[data-v-716fa21e]{padding-top:10px}

+ 0 - 1
app/public/css/chunk-b8ab1f0c.9e732e2f.css

@@ -1 +0,0 @@
-#app-base-powermonitor[data-v-7dfd9413]{padding:0 10px;text-align:left;width:100%}#app-base-powermonitor .one-block-1[data-v-7dfd9413]{font-size:16px;padding-top:10px}#app-base-powermonitor .one-block-2[data-v-7dfd9413]{padding-top:10px}

File diff suppressed because it is too large
+ 0 - 0
app/public/css/chunk-vendors.9ca8efee.css


BIN
app/public/img/logo.18776b4e.png


File diff suppressed because it is too large
+ 0 - 6
app/public/index.html


File diff suppressed because it is too large
+ 0 - 0
app/public/js/app.886b57a8.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/app.886b57a8.js.map


+ 0 - 2
app/public/js/chunk-0cf38b6e.73befe57.js

@@ -1,2 +0,0 @@
-(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0cf38b6e"],{"0f0d":function(t,n,e){},2034:function(t,n,e){"use strict";e.r(n);var c=function(){var t=this,n=t.$createElement;t._self._c;return t._m(0)},s=[function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("div",{attrs:{id:"app-other"}},[e("div",{staticClass:"one-block-1"},[e("span",[t._v(" 待开发... ")])]),e("div",{staticClass:"one-block-2"})])}],a={data:function(){return{}},methods:{test:function(){}}},i=a,o=(e("dfa9"),e("2877")),r=Object(o["a"])(i,c,s,!1,null,"041b2204",null);n["default"]=r.exports},dfa9:function(t,n,e){"use strict";e("0f0d")}}]);
-//# sourceMappingURL=chunk-0cf38b6e.73befe57.js.map

File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-0cf38b6e.73befe57.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-25a0809c.02387fee.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-25a0809c.02387fee.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-26360310.90f0183a.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-26360310.90f0183a.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-26fcacb7.ea9d617c.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-26fcacb7.ea9d617c.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-2f42023a.248fc31f.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-2f42023a.248fc31f.js.map


+ 0 - 2
app/public/js/chunk-30d91a2c.75899154.js

@@ -1,2 +0,0 @@
-(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-30d91a2c"],{"105d":function(t,n,a){},"1cf8":function(t,n,a){"use strict";a.r(n);var e=function(){var t=this,n=t.$createElement,a=t._self._c||n;return a("div",{attrs:{id:"app-base-extension"}},[t._m(0),a("div",{staticClass:"one-block-2"},[a("a-upload-dragger",{attrs:{name:"file",multiple:!0,action:t.action_url},on:{change:t.handleChange}},[a("p",{staticClass:"ant-upload-drag-icon"},[a("a-icon",{attrs:{type:"inbox"}})],1),a("p",{staticClass:"ant-upload-text"},[t._v(" 上传 ")]),a("p",{staticClass:"ant-upload-hint"})])],1),a("div",{staticClass:"one-block-1"},[t._v(" 2. chrome扩展商店(crx下载) ")]),a("div",{staticClass:"one-block-2"},[a("a-space",[t._v(" 极简插件:https://chrome.zzzmh.cn/ ")])],1)])},i=[function(){var t=this,n=t.$createElement,a=t._self._c||n;return a("div",{staticClass:"one-block-1"},[a("span",[t._v(" 1. 上传扩展程序(crx文件格式) ")])])}],o=(a("b0c0"),{data:function(){return{action_url:"/api/example/uploadExtension"}},mounted:function(){this.init()},methods:{init:function(){},handleChange:function(t){var n=t.file.status;if("uploading"!==n&&console.log(t.file),"done"===n){var a=t.file.response;console.log("uploadRes:",a)}else"error"===n&&this.$message.error("".concat(t.file.name," file upload failed."))}}}),c=o,s=(a("e42d"),a("2877")),l=Object(s["a"])(c,e,i,!1,null,"3d9f484a",null);n["default"]=l.exports},b0c0:function(t,n,a){var e=a("83ab"),i=a("9bf2").f,o=Function.prototype,c=o.toString,s=/^\s*function ([^ (]*)/,l="name";e&&!(l in o)&&i(o,l,{configurable:!0,get:function(){try{return c.call(this).match(s)[1]}catch(t){return""}}})},e42d:function(t,n,a){"use strict";a("105d")}}]);
-//# sourceMappingURL=chunk-30d91a2c.75899154.js.map

File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-30d91a2c.75899154.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-4557c3f4.1b432690.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-4557c3f4.1b432690.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-490df4c2.c8a48363.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-490df4c2.c8a48363.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-4d0be246.c4270f08.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-4d0be246.c4270f08.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-5d9adce2.1c2491c7.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-5d9adce2.1c2491c7.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-72d90f2a.bd6dc740.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-72d90f2a.bd6dc740.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-9234b1da.fc4b38c0.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-9234b1da.fc4b38c0.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-94d99d1e.e7d74208.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-94d99d1e.e7d74208.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-b67071c4.2a87e101.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-b67071c4.2a87e101.js.map


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-b8ab1f0c.0f41b54b.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-b8ab1f0c.0f41b54b.js.map


File diff suppressed because it is too large
+ 0 - 4
app/public/js/chunk-vendors.23b80c7c.js


File diff suppressed because it is too large
+ 0 - 0
app/public/js/chunk-vendors.23b80c7c.js.map


+ 0 - 21
app/router/example.js

@@ -1,21 +0,0 @@
-'use strict';
-
-/**
- * @param {Egg.Application} app - egg application
- */
-module.exports = app => {
-  const { router, controller } = app;
-
-  // upload file
-  router.post('/api/example/uploadFile', controller.example.uploadFile);
-  // test some electron api
-  router.post('/api/example/test1', controller.example.test1);
-  // message show
-  router.post('/api/example/messageShow', controller.example.messageShow);
-  // message show confirm
-  router.post('/api/example/messageShowConfirm', controller.example.messageShowConfirm);
-  // upload chrome extension
-  router.post('/api/example/uploadExtension', controller.example.uploadExtension);
-  // db operation
-  router.post('/api/example/dbOperation', controller.example.dbOperation);
-};

+ 0 - 16
app/router/index.js

@@ -1,16 +0,0 @@
-'use strict';
-
-/**
- * @param {Egg.Application} app - egg application
- */
-module.exports = app => {
-  const { router, controller } = app;
-  // home
-  router.get('/', controller.home.index);
-
-  // html
-  router.get('/home', controller.home.index);
-
-  // 引入其他路由
-  require('./example')(app);
-};

+ 0 - 22
app/schedule/example.js

@@ -1,22 +0,0 @@
-'use strict';
-
-const Subscription = require('egg').Subscription;
-
-/**
- * test
- */
-
-class Test extends Subscription {
-  static get schedule() {
-    return {
-      interval: '360m',
-      type: 'worker',
-      immediate: false,
-      disable: true,
-    };
-  }
-
-  async subscribe() {}
-}
-
-module.exports = Test;

+ 0 - 72
app/service/example.js

@@ -1,72 +0,0 @@
-'use strict';
-
-const Service = require('egg').Service;
-const EeSocket = require('ee-core').Socket.EeSocket;
-const socketClient = EeSocket.getClient();
-
-class ExampleService extends Service {
-
-  async test1(id = 0) {
-    const res = await socketClient.call('controller.example.test', {name:"gsx"}, {age:12});
-
-    return null;
-  }
-
-  async uploadFileToSMMS(tmpFile) {
-    const res = {
-      code: 1000,
-      message: 'unknown error',
-    };
-
-    try {
-      //throw new Error('Sync Error');
-      const headersObj = {
-        'Content-Type': 'multipart/form-data',
-        'Authorization': 'pHVaIfVX8kgxsEL2THTYMVzJDYY3MMZU'
-      };
-      const url = 'https://sm.ms/api/v2/upload';
-      const response = await this.app.curl(url, {
-        method: 'POST',
-        headers: headersObj,
-        files: {
-          smfile: tmpFile,
-        },
-        dataType: 'json',
-        timeout: 15000,
-      });
-      const result = response.data;
-      if (this.app.config.env === 'local') {
-        this.app.logger.info('[ExampleService] [uploadFileToSMMS]: info result:%j', result);
-      }
-      if (result.code !== 'success') {
-        this.app.logger.error('[ExampleService] [uploadFileToSMMS]: res error result:%j', result);
-      }
-      return result;
-    } catch (e) {
-      this.app.logger.error('[ExampleService] [uploadFileToSMMS]:  ERROR ', e);
-    }
-
-    return res;
-  }
-
-  async messageShow() {
-    await socketClient.call('controller.example.messageShow');
-
-    return true;
-  } 
-
-  async messageShowConfirm() {
-    await socketClient.call('controller.example.messageShowConfirm');
-
-    return true;
-  }   
-
-  async loadExtension(filePath) {
-
-    await socketClient.call('controller.example.loadExtension', filePath);
-
-    return true;
-  }
-}
-
-module.exports = ExampleService;

+ 0 - 7
app/utils/index.js

@@ -1,7 +0,0 @@
-'use strict';
-
-// 生成两数之间随机数
-exports.randomNums = (min, max) => {
-  return Math.round(Math.random() * (max - min) + min);
-};
-

+ 0 - 11
app/view/hello.ejs

@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title><%= title %></title>
-    <link rel='stylesheet' href='/stylesheets/style.css' />
-  </head>
-  <body>
-    <h1><%= title %></h1>
-    <p>Welcome to ee</p>
-  </body>
-</html>

File diff suppressed because it is too large
+ 0 - 6
app/view/index.ejs


+ 3 - 7
electron/config/config.default.js

@@ -67,13 +67,9 @@ module.exports = (appInfo) => {
     url: 'https://discuz.chat/' // Any web url
   };
 
-  /* egg服务 (可选) */
-  config.egg = {
-    enable: false, // 是否启用
-    title: 'ee', // 进程的title属性标识(默认你的应用名称-英文)
-    port: 7068,
-    hostname: '127.0.0.1',
-    workers: 1 // 工作进程数据
+  /* web渲染服务 */
+  config.webServer = {
+    port: 7068
   };
 
   /* 应用自动升级 (可选) */

+ 54 - 2
electron/controller/example.js

@@ -7,6 +7,7 @@ const is = require('electron-is');
 const { exec } = require('child_process');
 const unzip = require("unzip-crx-3");
 const Controller = require('ee-core').Controller;
+const Utils = require('ee-core').Utils;
 const electronApp = require('electron').app;
 const {dialog, webContents, shell, BrowserWindow, BrowserView, Notification, powerMonitor, screen, nativeTheme} = require('electron');
 const chromeExtension = require('../library/chromeExtension');
@@ -38,13 +39,44 @@ class ExampleController extends Controller {
   async test () {
     const result = await this.service.example.test('electron');
 
-    // 调用egg的某个api
-    // const result = await this.app.curlEgg('post', '/api/example/test2', {name: 'electron'});
 
     return result;
   }
 
   /**
+   * json数据库操作
+   */   
+  async dbOperation(args) {
+    const { service } = this;
+    const paramsObj = args;
+    //console.log('eeeee paramsObj:', paramsObj);
+    const data = {
+      action: paramsObj.action,
+      result: null,
+      all_list: []
+    };
+    
+    switch (paramsObj.action) {
+      case 'add' :
+        data.result = await service.storage.addTestData(paramsObj.info);;
+        break;
+      case 'del' :
+        data.result = await service.storage.delTestData(paramsObj.delete_name);;
+        break;
+      case 'update' :
+        data.result = await service.storage.updateTestData(paramsObj.update_name, paramsObj.update_age);
+        break;
+      case 'get' :
+        data.result = await service.storage.getTestData(paramsObj.search_age);
+        break;
+    }
+
+    data.all_list = await service.storage.getAllTestData();
+
+    return data;
+  }
+
+  /**
    * hello
    */
   hello (args) {
@@ -477,6 +509,26 @@ class ExampleController extends Controller {
     return;
   }
 
+  /**
+   * 上传文件
+   */  
+  async uploadFile() {
+    // const self = this;
+    // const { ctx, service } = this;
+    // let tmpDir = Utils.getLogDir();
+    // const file = ctx.request.files[0];
+
+    // try {
+    //   let tmpFile = fs.readFileSync(file.filepath)
+    //   fs.writeFileSync(path.join(tmpDir, file.filename), tmpFile)
+    // } finally {
+    //   await fs.unlink(file.filepath, function(){});
+    // }
+    // const fileStream = fs.createReadStream(path.join(tmpDir, file.filename))
+    // const uploadRes = await service.example.uploadFileToSMMS(fileStream);
+
+    // return uploadRes;
+  }
 }
 
 module.exports = ExampleController;

+ 5 - 1
app/service/storage.js → electron/service/storage.js

@@ -1,9 +1,13 @@
 'use strict';
 
+const Service = require('ee-core').Service;
 const Storage = require('ee-core').Storage;
-const Service = require('egg').Service;
 const _ = require('lodash');
 
+/**
+ * 数据存储
+ * @class
+ */
 class StorageService extends Service {
 
   constructor (ctx) {

+ 2 - 0
frontend/src/api/main.js

@@ -30,6 +30,8 @@ const ipcApiRoute = {
   getTheme: 'controller.example.getTheme',
   checkForUpdater: 'controller.example.checkForUpdater',
   downloadApp: 'controller.example.downloadApp',
+  dbOperation: 'controller.example.dbOperation',
+  uploadFile: 'controller.example.uploadFile',
 }
 
 const specialIpcRoute = {

+ 0 - 5
frontend/src/config/router.config.js

@@ -49,11 +49,6 @@ export const constantRouterMap = [
             component: () => import('@/views/base/window/Index')
           },
           {
-            path: '/base/extension/index',
-            name: 'BaseExtensionIndex',
-            component: () => import('@/views/base/extension/Index')
-          },
-          {
             path: '/base/notification/index',
             name: 'BaseNotificationIndex',
             component: () => import('@/views/base/notification/Index')

+ 0 - 6
frontend/src/layouts/Menu.vue

@@ -54,12 +54,6 @@ export default {
           pageName: 'BaseWindowIndex',
           params: {}
         },
-        'menu_403' : {
-          icon: 'profile',
-          title: '扩展程序',
-          pageName: 'BaseExtensionIndex',
-          params: {}
-        },
         'menu_405' : {
           icon: 'profile',
           title: '桌面通知',

+ 43 - 20
frontend/src/views/base/db/Index.vue

@@ -132,7 +132,7 @@
   </div>
 </template>
 <script>
-import { requestEggApi } from '@/api/main'
+import { ipcApiRoute } from '@/api/main'
 
 export default {
   data() {
@@ -156,17 +156,24 @@ export default {
       const params = {
         action: 'all',
       }
-      requestEggApi('dbOperation', params).then(res => {
-        if (res.code !== 0) {
-          return false
-        }
-        if (res.data.all_list.length == 0) {
+      this.$ipcCall(ipcApiRoute.dbOperation, params).then(res => {
+        console.log('res:', res);
+        if (res.all_list.length == 0) {
           return false;
         }
         self.all_list = res.data.all_list;
-      }).catch(err => {
-        console.log('err:', err)
-      })
+      }) 
+      // requestEggApi('dbOperation', params).then(res => {
+      //   if (res.code !== 0) {
+      //     return false
+      //   }
+      //   if (res.data.all_list.length == 0) {
+      //     return false;
+      //   }
+      //   self.all_list = res.data.all_list;
+      // }).catch(err => {
+      //   console.log('err:', err)
+      // })
     },
     dbOperation (ac) {
       const self = this;
@@ -184,25 +191,41 @@ export default {
       if (ac == 'add' && this.name.length == 0) {
         self.$message.error(`请填写数据`);
       }
-      requestEggApi('dbOperation', params).then(res => {
-        if (res.code !== 0) {
-          return false
-        }
+      // requestEggApi('dbOperation', params).then(res => {
+      //   if (res.code !== 0) {
+      //     return false
+      //   }
+      //   if (ac == 'get') {
+      //     if (res.data.result.length == 0) {
+      //       self.$message.error(`没有数据`);
+      //       return;
+      //     }
+      //     self.userList = res.data.result;
+      //   }
+      //   if (res.data.all_list.length == 0) {
+      //     return;
+      //   }
+      //   self.all_list = res.data.all_list;
+      //   self.$message.success(`success`);
+      // }).catch(err => {
+      //   console.log('err:', err)
+      // })
+
+      this.$ipcCall(ipcApiRoute.dbOperation, params).then(res => {
+        console.log('res:', res);
         if (ac == 'get') {
-          if (res.data.result.length == 0) {
+          if (res.result.length == 0) {
             self.$message.error(`没有数据`);
             return;
           }
-          self.userList = res.data.result;
+          self.userList = res.result;
         }
-        if (res.data.all_list.length == 0) {
+        if (res.all_list.length == 0) {
           return;
         }
-        self.all_list = res.data.all_list;
+        self.all_list = res.all_list;
         self.$message.success(`success`);
-      }).catch(err => {
-        console.log('err:', err)
-      })
+      }) 
     },
   }
 };

+ 4 - 54
frontend/src/views/base/file/Index.vue

@@ -1,28 +1,5 @@
 <template>
   <div id="app-base-file">
-    <div class="one-block-1">
-      <span>
-        1. 上传文件到sm图床
-      </span>
-    </div>  
-    <div class="one-block-2">
-      <!-- dev调试时,action参数:请填写你本地完整的api地址,如:http://localhost:7068/api/example/uploadFile -->
-      <a-upload-dragger
-        name="file"
-        :multiple="true"
-        :action="action_url"
-        @change="uploadStatus"
-      >
-        <p class="ant-upload-drag-icon">
-          <a-icon type="inbox" />
-        </p>
-        <p class="ant-upload-text">
-          点击 或 拖动到此处
-        </p>
-        <p class="ant-upload-hint">
-        </p>
-      </a-upload-dragger>
-    </div>
     <div class="one-block-2">
       <a-list v-if="image_info.length !== 0" size="small" bordered :data-source="image_info">
         <a-list-item slot="renderItem" slot-scope="item" style="text-align:left;">
@@ -33,20 +10,18 @@
     </div>
     <div class="one-block-1">
       <span>
-        2. 系统原生对话框
+        1. 系统原生对话框
       </span>
     </div>  
     <div class="one-block-2">
       <a-space>
         <a-button @click="messageShow('ipc')">消息提示(ipc)</a-button>
         <a-button @click="messageShowConfirm('ipc')">消息提示与确认(ipc)</a-button>
-        <a-button @click="messageShow('http')">消息提示(egg http服务)</a-button>
-        <a-button @click="messageShowConfirm('http')">消息提示与确认(egg http服务)</a-button>
       </a-space>
     </div>
     <div class="one-block-1">
       <span>
-        3. 选择保存目录
+        2. 选择保存目录
       </span>
     </div>  
     <div class="one-block-2">
@@ -107,7 +82,6 @@ export default {
   data() {
     return {
       file_list: fileList,
-      action_url: process.env.VUE_APP_API_BASE_URL + '/api/example/uploadFile',
       image_info: [],
       num: 0,
 			dir_path: "D:\\www\\ee",
@@ -115,34 +89,10 @@ export default {
   },
   methods: {
     openDirectry (id) {
-      this.$ipcCall(ipcApiRoute.openDirectory, {id: id}).then(r => {
-        //console.log('r:', r)
+      this.$ipcCall(ipcApiRoute.openDirectory, {id: id}).then(res => {
+        //console.log('res:', res)
       })      
     },
-		uploadStatus(info) {
-      const status = info.file.status;
-      if (status !== 'uploading') {
-        console.log(info.file);
-      }
-      if (status === 'done') {
-        // 去除list列表
-        //info.fileList = [];
-        const uploadRes = info.file.response;
-        console.log('uploadRes:', uploadRes)
-        if (uploadRes.code !== 'success') {
-          this.$message.error(`file upload failed ${uploadRes.code} .`);
-          return false;
-        }
-        this.num++;
-        const picInfo = uploadRes.data;
-        picInfo.id = this.num;
-        picInfo.imageUrlText = 'image url';
-        this.image_info.push(picInfo);
-        this.$message.success(`${info.file.name} file uploaded successfully.`);
-      } else if (status === 'error') {
-        this.$message.error(`${info.file.name} file upload failed.`);
-      }
-    },
     selectDir() {
       const self = this;
       self.$ipcCall(ipcApiRoute.selectFolder, '').then(r => {

+ 2 - 11
package.json

@@ -12,9 +12,6 @@
     "build-m": "electron-builder -m",
     "build-m-arm64": "electron-builder -m --arm64",
     "build-l": "electron-builder -l deb tar.xz",
-    "web-start": "egg-scripts start --daemon --title=ee --ignore-stderr --env=prod --workers=1",
-    "web-stop": "egg-scripts stop --title=ee",
-    "web-dev": "egg-bin dev",
     "rd": "node ./node_modules/ee-core/bin/tools rd --dist_dir=./frontend/dist",
     "compress": "node ./node_modules/ee-core/bin/tools compress",
     "restore": "node ./node_modules/ee-core/bin/tools restore"
@@ -85,13 +82,11 @@
   },
   "repository": "https://github.com/wallace5303/ee.git",
   "keywords": [
-    "Electron",
-    "Egg"
+    "Electron"
   ],
   "author": "wallace5303, Inc <530353222@qq.com>",
   "license": "Apache",
   "devDependencies": {
-    "egg-bin": "^4.12.3",
     "electron": "^12.2.3",
     "electron-builder": "22.10.4",
     "eslint": "^5.13.0",
@@ -100,11 +95,7 @@
   },
   "dependencies": {
     "dayjs": "^1.10.7",
-    "ee-core": "^1.1.3",
-    "egg": "^2.33.1",
-    "egg-cluster": "^1.27.1",
-    "egg-scripts": "^2.15.2",
-    "egg-view-ejs": "^2.0.1",
+    "ee-core": "^1.1.5",
     "electron-is": "^3.0.0",
     "lodash": "^4.17.21",
     "unzip-crx-3": "^0.2.0"

Some files were not shown because too many files changed in this diff