gsx 2 år sedan
förälder
incheckning
20ca08bd2a
32 ändrade filer med 550 tillägg och 0 borttagningar
  1. 42 0
      electron/controller/effect.js
  2. 42 0
      electron/controller/framework.js
  3. 42 0
      electron/controller/hardware.js
  4. 42 0
      electron/controller/os.js
  5. 30 0
      electron/service/effect.js
  6. 30 0
      electron/service/framework.js
  7. 30 0
      electron/service/hardware.js
  8. 30 0
      electron/service/os.js
  9. 94 0
      frontend/src/views/effect/video/Index.vue
  10. 0 0
      frontend/src/views/framework/db/Index.vue
  11. 0 0
      frontend/src/views/framework/java/Index.vue
  12. 0 0
      frontend/src/views/framework/jobs/Index.vue
  13. 0 0
      frontend/src/views/framework/socket/HttpServer.vue
  14. 0 0
      frontend/src/views/framework/socket/Ipc.vue
  15. 0 0
      frontend/src/views/framework/socket/SocketServer.vue
  16. 0 0
      frontend/src/views/framework/software/Index.vue
  17. 0 0
      frontend/src/views/framework/sqlitedb/Index.vue
  18. 0 0
      frontend/src/views/framework/test/Index.vue
  19. 0 0
      frontend/src/views/framework/testapi/Index.vue
  20. 0 0
      frontend/src/views/framework/updater/Index.vue
  21. 99 0
      frontend/src/views/hardware/printer/Index.vue
  22. 0 0
      frontend/src/views/os/extension/Index.vue
  23. 0 0
      frontend/src/views/os/file/Index.vue
  24. 69 0
      frontend/src/views/os/launch/Index.vue
  25. 0 0
      frontend/src/views/os/notification/Index.vue
  26. 0 0
      frontend/src/views/os/powermonitor/Index.vue
  27. 0 0
      frontend/src/views/os/screen/Index.vue
  28. 0 0
      frontend/src/views/os/subwindow/Ipc.vue
  29. 0 0
      frontend/src/views/os/system/Index.vue
  30. 0 0
      frontend/src/views/os/theme/Index.vue
  31. 0 0
      frontend/src/views/os/window/Index.vue
  32. 0 0
      frontend/src/views/os/windowview/Index.vue

+ 42 - 0
electron/controller/effect.js

@@ -0,0 +1,42 @@
+'use strict';
+
+
+/**
+ * 特效 - 功能demo
+ * @class
+ */
+class EffectController extends Controller {
+
+  constructor(ctx) {
+    super(ctx);
+  }
+
+  /**
+   * 所有方法接收两个参数
+   * @param args 前端传的参数
+   * @param event - ipc通信时才有值。详情见:控制器文档
+   */
+
+  /**
+   * test
+   */
+  async test () {
+    const result = await this.service.example.test('electron');
+
+    // let tmpDir = Ps.getLogDir();
+    // Log.info('tmpDir:', tmpDir);
+
+    let mid = await Utils.machineIdSync(true);
+    Log.info('mid 11111111:', mid);
+
+    Utils.machineId().then((id) => {
+      Log.info('mid 222222222:', id);
+    });
+
+    return result;
+  }
+
+}
+
+EffectController.toString = () => '[class EffectController]';
+module.exports = EffectController;  

+ 42 - 0
electron/controller/framework.js

@@ -0,0 +1,42 @@
+'use strict';
+
+
+/**
+ * electron-egg framework - 功能demo
+ * @class
+ */
+class FrameworkController extends Controller {
+
+  constructor(ctx) {
+    super(ctx);
+  }
+
+  /**
+   * 所有方法接收两个参数
+   * @param args 前端传的参数
+   * @param event - ipc通信时才有值。详情见:控制器文档
+   */
+
+  /**
+   * test
+   */
+  async test () {
+    const result = await this.service.example.test('electron');
+
+    // let tmpDir = Ps.getLogDir();
+    // Log.info('tmpDir:', tmpDir);
+
+    let mid = await Utils.machineIdSync(true);
+    Log.info('mid 11111111:', mid);
+
+    Utils.machineId().then((id) => {
+      Log.info('mid 222222222:', id);
+    });
+
+    return result;
+  }
+
+}
+
+FrameworkController.toString = () => '[class FrameworkController]';
+module.exports = FrameworkController;  

+ 42 - 0
electron/controller/hardware.js

@@ -0,0 +1,42 @@
+'use strict';
+
+
+/**
+ * 硬件设备 - 功能demo
+ * @class
+ */
+class HardwareController extends Controller {
+
+  constructor(ctx) {
+    super(ctx);
+  }
+
+  /**
+   * 所有方法接收两个参数
+   * @param args 前端传的参数
+   * @param event - ipc通信时才有值。详情见:控制器文档
+   */
+
+  /**
+   * test
+   */
+  async test () {
+    const result = await this.service.example.test('electron');
+
+    // let tmpDir = Ps.getLogDir();
+    // Log.info('tmpDir:', tmpDir);
+
+    let mid = await Utils.machineIdSync(true);
+    Log.info('mid 11111111:', mid);
+
+    Utils.machineId().then((id) => {
+      Log.info('mid 222222222:', id);
+    });
+
+    return result;
+  }
+
+}
+
+HardwareController.toString = () => '[class HardwareController]';
+module.exports = HardwareController;  

+ 42 - 0
electron/controller/os.js

@@ -0,0 +1,42 @@
+'use strict';
+
+
+/**
+ * 操作系统 - 功能demo
+ * @class
+ */
+class OsController extends Controller {
+
+  constructor(ctx) {
+    super(ctx);
+  }
+
+  /**
+   * 所有方法接收两个参数
+   * @param args 前端传的参数
+   * @param event - ipc通信时才有值。详情见:控制器文档
+   */
+
+  /**
+   * test
+   */
+  async test () {
+    const result = await this.service.example.test('electron');
+
+    // let tmpDir = Ps.getLogDir();
+    // Log.info('tmpDir:', tmpDir);
+
+    let mid = await Utils.machineIdSync(true);
+    Log.info('mid 11111111:', mid);
+
+    Utils.machineId().then((id) => {
+      Log.info('mid 222222222:', id);
+    });
+
+    return result;
+  }
+
+}
+
+OsController.toString = () => '[class OsController]';
+module.exports = OsController;  

+ 30 - 0
electron/service/effect.js

@@ -0,0 +1,30 @@
+'use strict';
+
+const { Service } = require('ee-core');
+
+/**
+ * effect(service层为单例)
+ * @class
+ */
+class EffectService extends Service {
+
+  constructor(ctx) {
+    super(ctx);
+  }
+
+  /**
+   * test
+   */
+  async test(args) {
+    let obj = {
+      status:'ok',
+      params: args
+    }
+
+    return obj;
+  }
+
+}
+
+EffectService.toString = () => '[class EffectService]';
+module.exports = EffectService;  

+ 30 - 0
electron/service/framework.js

@@ -0,0 +1,30 @@
+'use strict';
+
+const { Service } = require('ee-core');
+
+/**
+ * framework
+ * @class
+ */
+class FrameworkService extends Service {
+
+  constructor(ctx) {
+    super(ctx);
+  }
+
+  /**
+   * test
+   */
+  async test(args) {
+    let obj = {
+      status:'ok',
+      params: args
+    }
+
+    return obj;
+  }
+
+}
+
+FrameworkService.toString = () => '[class FrameworkService]';
+module.exports = FrameworkService;  

+ 30 - 0
electron/service/hardware.js

@@ -0,0 +1,30 @@
+'use strict';
+
+const { Service } = require('ee-core');
+
+/**
+ * hardware(service层为单例)
+ * @class
+ */
+class HardwareService extends Service {
+
+  constructor(ctx) {
+    super(ctx);
+  }
+
+  /**
+   * test
+   */
+  async test(args) {
+    let obj = {
+      status:'ok',
+      params: args
+    }
+
+    return obj;
+  }
+
+}
+
+HardwareService.toString = () => '[class HardwareService]';
+module.exports = HardwareService;  

+ 30 - 0
electron/service/os.js

@@ -0,0 +1,30 @@
+'use strict';
+
+const { Service } = require('ee-core');
+
+/**
+ * os(service层为单例)
+ * @class
+ */
+class OsService extends Service {
+
+  constructor(ctx) {
+    super(ctx);
+  }
+
+  /**
+   * test
+   */
+  async test(args) {
+    let obj = {
+      status:'ok',
+      params: args
+    }
+
+    return obj;
+  }
+
+}
+
+OsService.toString = () => '[class OsService]';
+module.exports = OsService;  

+ 94 - 0
frontend/src/views/effect/video/Index.vue

@@ -0,0 +1,94 @@
+<template>
+  <div id="app-effect-video">
+    <div class="one-block-1">
+      <span>
+        1. 视频播放
+      </span>
+    </div>  
+    <!-- <div class="one-block-2">
+      <a-button @click="selectFile()"> 打开 / 浏览 </a-button>
+    </div> -->
+    <div class="one-block-2">
+      <div id="video-player"></div>
+    </div>    
+  </div>
+</template>
+<script>
+import Player from 'xgplayer'
+import { ipcApiRoute } from '@/api/main'
+
+export default {
+  data() {
+    return {
+      fileUrl: '',
+      p: {},
+      op: {
+        id: 'video-player',
+        volume: 0.3,
+        url:'//sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-360p.mp4',
+        poster: "//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/byted-player-videos/1.0.0/poster.jpg",
+        playsinline: false,
+        danmu: {
+          comments: [
+            {
+              duration: 15000,
+              id: '1',
+              start: 3000,
+              txt: '这是一个弹幕',
+              style: {  //弹幕自定义样式
+                color: '#ff9500',
+                fontSize: '20px',
+                border: 'solid 1px #ff9500',
+                borderRadius: '50px',
+                padding: '5px 11px',
+                backgroundColor: 'rgba(255, 255, 255, 0.1)'
+              }
+            }
+          ],
+          area: {
+            start: 0,
+            end: 1
+          }
+        },
+      },
+    };
+  },
+  mounted () {
+    this.init();
+  },    
+  methods: {
+    init () {
+      //require('E:/video/nos_mp4_2021_05_30_sga9a3cj7_shd.mp4')
+      this.p = new Player(this.op);
+    },    
+    selectFile () {
+      // todo
+      const self = this;
+      const params = {}
+      this.$ipcInvoke(ipcApiRoute.effect.selectFile, params).then(res => {
+        console.log('res:', res)
+        if (res) {
+          self.fileUrl = res;
+          this.p.start(self.fileUrl);
+        } else {
+          self.$message.warning('请选择视频');
+        }
+      }) 
+    },
+  }
+};
+</script>
+<style lang="less" scoped>
+#app-effect-video {
+  padding: 0px 10px;
+  text-align: left;
+  width: 100%;
+  .one-block-1 {
+    font-size: 16px;
+    padding-top: 10px;
+  }
+  .one-block-2 {
+    padding-top: 10px;
+  }
+}
+</style>

+ 0 - 0
frontend/src/views/base/db/Index.vue → frontend/src/views/framework/db/Index.vue


+ 0 - 0
frontend/src/views/other/java/Index.vue → frontend/src/views/framework/java/Index.vue


+ 0 - 0
frontend/src/views/base/jobs/Index.vue → frontend/src/views/framework/jobs/Index.vue


+ 0 - 0
frontend/src/views/base/socket/HttpServer.vue → frontend/src/views/framework/socket/HttpServer.vue


+ 0 - 0
frontend/src/views/base/socket/Ipc.vue → frontend/src/views/framework/socket/Ipc.vue


+ 0 - 0
frontend/src/views/base/socket/SocketServer.vue → frontend/src/views/framework/socket/SocketServer.vue


+ 0 - 0
frontend/src/views/base/software/Index.vue → frontend/src/views/framework/software/Index.vue


+ 0 - 0
frontend/src/views/base/sqlitedb/Index.vue → frontend/src/views/framework/sqlitedb/Index.vue


+ 0 - 0
frontend/src/views/other/test/Index.vue → frontend/src/views/framework/test/Index.vue


+ 0 - 0
frontend/src/views/base/testapi/Index.vue → frontend/src/views/framework/testapi/Index.vue


+ 0 - 0
frontend/src/views/base/updater/Index.vue → frontend/src/views/framework/updater/Index.vue


+ 99 - 0
frontend/src/views/hardware/printer/Index.vue

@@ -0,0 +1,99 @@
+<template>
+  <div id="app-hw-bluetooth">
+    <div class="one-block-1">
+      <span>
+        1. 打印机设备
+      </span>
+    </div>  
+    <div class="one-block-2">
+      <a-button @click="getPrinter()"> 获取打印机列表 </a-button>
+    </div>
+    <div class="one-block-2">
+      <a-list size="small" bordered :data-source="printerList">
+        <a-list-item slot="renderItem" slot-scope="item">
+          {{ item.displayName }} {{ defaultDevice(item) }}
+        </a-list-item>
+        <div slot="header">
+          设备列表
+        </div>
+      </a-list>
+    </div>
+    <div class="one-block-1">
+      <span>
+        2. 打印内容
+      </span>
+    </div>  
+    <div class="one-block-2">
+      <a-button @click="doPrint(0)"> 打印一个页面 </a-button>
+    </div>      
+  </div>
+</template>
+<script>
+import { ipcApiRoute } from '@/api/main'
+
+export default {
+  data() {
+    return {
+      defaultDeviceName: '',
+      printerList: [],
+      views: [
+        {
+          type: 'html',
+          content: '/public/html/view_example.html'
+        },        
+      ],
+    };
+  },
+  mounted () {
+    this.init();
+  },  
+  methods: {
+    init () {
+      const self = this;
+      // 避免重复监听,或者将 on 功能写到一个统一的地方,只加载一次
+      this.$ipc.removeAllListeners(ipcApiRoute.hardware.printStatus);
+      this.$ipc.on(ipcApiRoute.hardware.printStatus, (event, result) => {
+        console.log('result', result);
+        self.$message.info('打印中...');
+      })
+    },    
+    getPrinter () {
+      this.$ipcInvoke(ipcApiRoute.hardware.getPrinterList, {}).then(res => {
+        this.printerList = res;
+      }) 
+    },
+    doPrint (index) {
+      console.log('defaultDeviceName:', this.defaultDeviceName)
+      const params = {
+        view: this.views[index],
+        deviceName: this.defaultDeviceName
+      };
+      this.$ipc.send(ipcApiRoute.hardware.print, params)
+
+    },
+    defaultDevice (item) {
+      let desc = "";
+      if (item.isDefault) {
+        desc = "- 默认";
+        this.defaultDeviceName = item.name;
+      }
+      
+      return desc;
+    } 
+  }
+};
+</script>
+<style lang="less" scoped>
+#app-hw-bluetooth {
+  padding: 0px 10px;
+  text-align: left;
+  width: 100%;
+  .one-block-1 {
+    font-size: 16px;
+    padding-top: 10px;
+  }
+  .one-block-2 {
+    padding-top: 10px;
+  }
+}
+</style>

+ 0 - 0
frontend/src/views/base/extension/Index.vue → frontend/src/views/os/extension/Index.vue


+ 0 - 0
frontend/src/views/base/file/Index.vue → frontend/src/views/os/file/Index.vue


+ 69 - 0
frontend/src/views/os/launch/Index.vue

@@ -0,0 +1,69 @@
+<template>
+  <div id="app-base-system-launch">
+    <div class="one-block-2">
+      <a-list class="set-auto" itemLayout="horizontal">
+        <a-list-item style="text-align: left;">
+          <a-list-item-meta>
+            <template v-slot:title>
+              <a>启动</a>
+            </template>
+            <template v-slot:description>
+              <span>
+                开机自动启动
+              </span>
+            </template>
+          </a-list-item-meta>
+          <template v-slot:actions>
+            <a-switch v-model="autoLaunchChecked" checkedChildren="开" unCheckedChildren="关" @change="autoLaunchChange()" />
+          </template>
+        </a-list-item>
+      </a-list>
+    </div>
+  </div>
+</template>
+<script>
+import { ipcApiRoute } from '@/api/main'
+
+export default {
+  data () {
+    return {
+      autoLaunchChecked: false
+    }
+  },
+  mounted () {
+    this.init();
+  },
+  methods: {
+    init () {
+      // todo .....
+      const self = this;
+      self.$ipcInvoke(ipcApiRoute.os.autoLaunch, 'check').then(result => {
+        console.log('[ipcRenderer] [autoLaunch] result:', result)
+        this.autoLaunchChecked = result.status;
+      })      
+    },
+    autoLaunchChange (checkStatus) {
+      console.log('[ipcRenderer] [autoLaunch] self.autoLaunchChecked:', this.autoLaunchChecked)
+    },
+  }
+}
+</script>
+<style lang="less" scoped>
+#app-base-system-launch {
+  padding: 0px 10px;
+  text-align: left;
+  width: 100%;
+  .one-block-1 {
+    font-size: 16px;
+    padding-top: 10px;
+  }
+  .one-block-2 {
+    padding-top: 10px;
+  }
+  .set-auto {
+    .ant-list-item:last-child {
+      border-bottom: 1px solid #e8e8e8;
+    }
+  }
+}  
+</style>  

+ 0 - 0
frontend/src/views/base/notification/Index.vue → frontend/src/views/os/notification/Index.vue


+ 0 - 0
frontend/src/views/base/powermonitor/Index.vue → frontend/src/views/os/powermonitor/Index.vue


+ 0 - 0
frontend/src/views/base/screen/Index.vue → frontend/src/views/os/screen/Index.vue


+ 0 - 0
frontend/src/views/base/subwindow/Ipc.vue → frontend/src/views/os/subwindow/Ipc.vue


+ 0 - 0
frontend/src/views/base/system/Index.vue → frontend/src/views/os/system/Index.vue


+ 0 - 0
frontend/src/views/base/theme/Index.vue → frontend/src/views/os/theme/Index.vue


+ 0 - 0
frontend/src/views/base/window/Index.vue → frontend/src/views/os/window/Index.vue


+ 0 - 0
frontend/src/views/base/windowview/Index.vue → frontend/src/views/os/windowview/Index.vue