浏览代码

加入electron

wuxiang 2 年之前
父节点
当前提交
29e9ba9732
共有 6 个文件被更改,包括 607 次插入165 次删除
  1. 3 1
      .gitignore
  2. 506 159
      package-lock.json
  3. 9 1
      package.json
  4. 81 0
      src/background.js
  5. 2 2
      src/views/taskManagement/index.vue
  6. 6 2
      src/views/thaadInvestigation/index.vue

+ 3 - 1
.gitignore

@@ -1,4 +1,6 @@
 vue/dist
 vue/node_modules
 dist
-node_modules
+node_modules
+#Electron-builder output
+/dist_electron

文件差异内容过多而无法显示
+ 506 - 159
package-lock.json


+ 9 - 1
package.json

@@ -5,8 +5,13 @@
   "scripts": {
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
-    "lint": "vue-cli-service lint"
+    "lint": "vue-cli-service lint",
+    "electron:build": "vue-cli-service electron:build",
+    "electron:serve": "vue-cli-service electron:serve",
+    "postinstall": "electron-builder install-app-deps",
+    "postuninstall": "electron-builder install-app-deps"
   },
+  "main": "background.js",
   "dependencies": {
     "cesium": "1.93",
     "copy-webpack-plugin": "5.0",
@@ -23,11 +28,14 @@
     "@vue/cli-plugin-eslint": "~4.5.9",
     "@vue/cli-service": "~4.5.9",
     "babel-eslint": "^10.1.0",
+    "electron": "^13.0.0",
+    "electron-devtools-installer": "^3.1.0",
     "eslint": "^6.7.2",
     "eslint-plugin-vue": "^6.2.2",
     "sass": "^1.26.8",
     "sass-loader": "^8.0.2",
     "svg-sprite-loader": "^3.8.0",
+    "vue-cli-plugin-electron-builder": "~2.1.1",
     "vue-template-compiler": "^2.6.11"
   },
   "eslintConfig": {

+ 81 - 0
src/background.js

@@ -0,0 +1,81 @@
+'use strict'
+
+import { app, protocol, BrowserWindow } from 'electron'
+import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
+import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
+const isDevelopment = process.env.NODE_ENV !== 'production'
+
+// Scheme must be registered before the app is ready
+protocol.registerSchemesAsPrivileged([
+  { scheme: 'app', privileges: { secure: true, standard: true } }
+])
+
+async function createWindow() {
+  // Create the browser window.
+  const win = new BrowserWindow({
+    width: 1600,
+    height: 900,
+    webPreferences: {
+      
+      // Use pluginOptions.nodeIntegration, leave this alone
+      // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
+      nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
+      contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION
+    }
+  })
+
+  if (process.env.WEBPACK_DEV_SERVER_URL) {
+    // Load the url of the dev server if in development mode
+    await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
+    if (!process.env.IS_TEST) win.webContents.openDevTools()
+  } else {
+    createProtocol('app')
+    // Load the index.html when not in development
+    win.loadURL('app://./index.html')
+  }
+}
+
+// Quit when all windows are closed.
+app.on('window-all-closed', () => {
+  // On macOS it is common for applications and their menu bar
+  // to stay active until the user quits explicitly with Cmd + Q
+  if (process.platform !== 'darwin') {
+    app.quit()
+  }
+})
+
+app.on('activate', () => {
+  // On macOS it's common to re-create a window in the app when the
+  // dock icon is clicked and there are no other windows open.
+  if (BrowserWindow.getAllWindows().length === 0) createWindow()
+})
+
+// This method will be called when Electron has finished
+// initialization and is ready to create browser windows.
+// Some APIs can only be used after this event occurs.
+app.on('ready', async () => {
+  if (isDevelopment && !process.env.IS_TEST) {
+    // Install Vue Devtools
+    try {
+      await installExtension(VUEJS_DEVTOOLS)
+    } catch (e) {
+      console.error('Vue Devtools failed to install:', e.toString())
+    }
+  }
+  createWindow()
+})
+
+// Exit cleanly on request from parent process in development mode.
+if (isDevelopment) {
+  if (process.platform === 'win32') {
+    process.on('message', (data) => {
+      if (data === 'graceful-exit') {
+        app.quit()
+      }
+    })
+  } else {
+    process.on('SIGTERM', () => {
+      app.quit()
+    })
+  }
+}

+ 2 - 2
src/views/taskManagement/index.vue

@@ -2,7 +2,7 @@
   <el-row :gutter="6">
     <el-col :span="12">
       <el-card class="box-card">
-        <div class="card-header">
+        <div slot="header" class="clearfix">
           <span>指挥电文管理</span>
         </div>
         <el-table :data="leadPost">
@@ -203,7 +203,7 @@ export default {
         url: "getLeadPost",
         data: { platformID: this.platformID },
       });
-    };
+    }
     this.optionsCoopPlatform = platforms;
   },
   

+ 6 - 2
src/views/thaadInvestigation/index.vue

@@ -178,9 +178,13 @@ export default {
                 },
                 angleAxis: {
                     type: 'value',
-                    startAngle: 0
+                    startAngle: 0,
+                    
+                    
                 },
                 radiusAxis: {
+                    max: 10,
+                    min: 0,
                     splitArea: {
                         show: true,
                         areaStyle: {
@@ -206,7 +210,7 @@ export default {
     mounted() {
         for (let i = 0; i <= 7;i++) {
             let theta = (i/100)*360;
-            let r = 10;
+            let r = 5;
             // let theta = (i/100)*180 + Math.random()*90;
             // let r = 5 * (1 + Math.sin((theta / 180) * Math.PI));
             this.data.push([r, theta]);

部分文件因为文件数量过多而无法显示