| | |
| | | |
| | | # Ignore Gradle build output directory |
| | | build |
| | | |
| | | out |
| | |
| | | "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", |
| | | "dev": true |
| | | }, |
| | | "bindings": { |
| | | "version": "1.5.0", |
| | | "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", |
| | | "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "file-uri-to-path": "1.0.0" |
| | | } |
| | | }, |
| | | "bluebird": { |
| | | "version": "3.7.2", |
| | | "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", |
| | |
| | | "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", |
| | | "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", |
| | | "dev": true |
| | | }, |
| | | "cli-truncate": { |
| | | "version": "2.1.0", |
| | | "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", |
| | | "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "slice-ansi": "^3.0.0", |
| | | "string-width": "^4.2.0" |
| | | }, |
| | | "dependencies": { |
| | | "ansi-styles": { |
| | | "version": "4.3.0", |
| | | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", |
| | | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "color-convert": "^2.0.1" |
| | | } |
| | | }, |
| | | "astral-regex": { |
| | | "version": "2.0.0", |
| | | "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", |
| | | "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", |
| | | "dev": true, |
| | | "optional": true |
| | | }, |
| | | "color-convert": { |
| | | "version": "2.0.1", |
| | | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", |
| | | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "color-name": "~1.1.4" |
| | | } |
| | | }, |
| | | "color-name": { |
| | | "version": "1.1.4", |
| | | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", |
| | | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", |
| | | "dev": true, |
| | | "optional": true |
| | | }, |
| | | "slice-ansi": { |
| | | "version": "3.0.0", |
| | | "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", |
| | | "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "ansi-styles": "^4.0.0", |
| | | "astral-regex": "^2.0.0", |
| | | "is-fullwidth-code-point": "^3.0.0" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "cli-width": { |
| | | "version": "3.0.0", |
| | |
| | | "version": "4.9.0", |
| | | "resolved": "https://registry.npmjs.org/echarts/-/echarts-4.9.0.tgz", |
| | | "integrity": "sha512-+ugizgtJ+KmsJyyDPxaw2Br5FqzuBnyOWwcxPKO6y0gc5caYcfnEUIlNStx02necw8jmKmTafmpHhGo4XDtEIA==", |
| | | "dev": true, |
| | | "requires": { |
| | | "zrender": "4.3.2" |
| | | } |
| | |
| | | "echarts-liquidfill": { |
| | | "version": "2.0.6", |
| | | "resolved": "https://registry.npmjs.org/echarts-liquidfill/-/echarts-liquidfill-2.0.6.tgz", |
| | | "integrity": "sha512-p+AH0O9/BtwXMQQyhjJbMZo+GwRAgWG/DCyK5r27PQzpS0UWrgXu57MyEFc0A8Ub3sRuqEu08BuxwHICBkSWSQ==" |
| | | "integrity": "sha512-p+AH0O9/BtwXMQQyhjJbMZo+GwRAgWG/DCyK5r27PQzpS0UWrgXu57MyEFc0A8Ub3sRuqEu08BuxwHICBkSWSQ==", |
| | | "dev": true |
| | | }, |
| | | "ee-first": { |
| | | "version": "1.1.1", |
| | |
| | | "resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz", |
| | | "integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==", |
| | | "dev": true |
| | | }, |
| | | "file-uri-to-path": { |
| | | "version": "1.0.0", |
| | | "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", |
| | | "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", |
| | | "dev": true, |
| | | "optional": true |
| | | }, |
| | | "file-url": { |
| | | "version": "2.0.2", |
| | |
| | | "resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz", |
| | | "integrity": "sha512-T10qvkw0zz4wnm560lOEg0PovVqUXuOFhhHAkixw8/sycy7TJt7v/RrkEKEQnAw2viPSJu6iAkErxnzR0g8PpQ==", |
| | | "dev": true, |
| | | "optional": true |
| | | "optional": true, |
| | | "requires": { |
| | | "cli-truncate": "^2.1.0", |
| | | "node-addon-api": "^1.6.3" |
| | | } |
| | | }, |
| | | "iconv-lite": { |
| | | "version": "0.4.24", |
| | |
| | | } |
| | | } |
| | | }, |
| | | "minimal-request-promise": { |
| | | "version": "1.5.0", |
| | | "resolved": "https://registry.npmjs.org/minimal-request-promise/-/minimal-request-promise-1.5.0.tgz", |
| | | "integrity": "sha1-YPXX9VtAJtGXB04uFVYm1MxcLrw=" |
| | | }, |
| | | "minimalistic-assert": { |
| | | "version": "1.0.1", |
| | | "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", |
| | |
| | | "thenify-all": "^1.0.0" |
| | | } |
| | | }, |
| | | "nan": { |
| | | "version": "2.15.0", |
| | | "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", |
| | | "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", |
| | | "dev": true, |
| | | "optional": true |
| | | }, |
| | | "nanoid": { |
| | | "version": "3.3.1", |
| | | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", |
| | |
| | | "requires": { |
| | | "lower-case": "^1.1.1" |
| | | } |
| | | }, |
| | | "node-addon-api": { |
| | | "version": "1.7.2", |
| | | "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", |
| | | "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==", |
| | | "dev": true, |
| | | "optional": true |
| | | }, |
| | | "node-forge": { |
| | | "version": "0.10.0", |
| | |
| | | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", |
| | | "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", |
| | | "dev": true, |
| | | "optional": true |
| | | "optional": true, |
| | | "requires": { |
| | | "bindings": "^1.5.0", |
| | | "nan": "^2.12.1" |
| | | } |
| | | }, |
| | | "glob-parent": { |
| | | "version": "3.1.0", |
| | |
| | | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", |
| | | "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", |
| | | "dev": true, |
| | | "optional": true |
| | | "optional": true, |
| | | "requires": { |
| | | "bindings": "^1.5.0", |
| | | "nan": "^2.12.1" |
| | | } |
| | | }, |
| | | "glob-parent": { |
| | | "version": "3.1.0", |
| | |
| | | "zrender": { |
| | | "version": "4.3.2", |
| | | "resolved": "https://registry.npmjs.org/zrender/-/zrender-4.3.2.tgz", |
| | | "integrity": "sha512-bIusJLS8c4DkIcdiK+s13HiQ/zjQQVgpNohtd8d94Y2DnJqgM1yjh/jpDb8DoL6hd7r8Awagw8e3qK/oLaWr3g==" |
| | | "integrity": "sha512-bIusJLS8c4DkIcdiK+s13HiQ/zjQQVgpNohtd8d94Y2DnJqgM1yjh/jpDb8DoL6hd7r8Awagw8e3qK/oLaWr3g==", |
| | | "dev": true |
| | | } |
| | | } |
| | | } |
| | |
| | | "electron:serve": "vue-cli-service electron:serve", |
| | | "postinstall": "electron-builder install-app-deps", |
| | | "postuninstall": "electron-builder install-app-deps", |
| | | "debug:main": "electron --inspect=5858 ./src/background.js", |
| | | "electron:generate-icons": "electron-icon-builder --input=./public/icon/icon.png --output=build --flatten" |
| | | }, |
| | | "main": "background.js", |
| | | "dependencies": { |
| | | "core-js": "^3.6.5", |
| | | "minimal-request-promise": "^1.5.0", |
| | | "tree-kill": "^1.2.2", |
| | | "vue": "2.6.10", |
| | | "vue-router": "3.0.6", |
| | | "axios": "0.18.1", |
| | | "vue-layer": "^1.2.0", |
| | | "echarts": "^4.8.0", |
| | | "echarts-liquidfill": "^2.0.6", |
| | | "vue-template-compiler": "2.6.10" |
| | | }, |
| | | "devDependencies": { |
| | |
| | | "@vue/compiler-sfc": "^3.0.0", |
| | | "babel-eslint": "^10.1.0", |
| | | "electron": "^13.0.0", |
| | | "echarts": "^4.8.0", |
| | | "echarts-liquidfill": "^2.0.6", |
| | | "electron-devtools-installer": "^3.1.0", |
| | | "electron-icon-builder": "^2.0.1", |
| | | "element-ui": "^2.15.6", |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| | | <meta name="viewport" content="width=device-width,initial-scale=1.0"> |
| | | |
| | | |
| | | <style> |
| | | .main { |
| | | position: relative; |
| | | width: 200px; |
| | | height: 200px; |
| | | background: rgba(0, 0, 0, .4); |
| | | border-radius: 50%; |
| | | } |
| | | |
| | | ul { |
| | | position: absolute; |
| | | margin: -20px 0 0; |
| | | padding: 0; |
| | | left: 50%; |
| | | top: 50%; |
| | | transform: rotate(45deg) translate(-50%, -50%); |
| | | } |
| | | |
| | | li { |
| | | list-style-type: none; |
| | | position: absolute; |
| | | top: 0px; |
| | | left: 0px; |
| | | width: 20px; |
| | | height: 20px; |
| | | background: #00f7f9; |
| | | border-radius: 50%; |
| | | } |
| | | |
| | | #a { |
| | | animation: a 1s ease-in-out infinite; |
| | | top: -40px; |
| | | left: -40px; |
| | | } |
| | | |
| | | #b { |
| | | animation: b 1s ease-in-out infinite; |
| | | top: -40px; |
| | | left: 0px; |
| | | } |
| | | |
| | | #c { |
| | | animation: c 1s ease-in-out infinite; |
| | | top: -40px; |
| | | left: 40px; |
| | | } |
| | | |
| | | #d { |
| | | animation: d 1s ease-in-out infinite; |
| | | top: 0px; |
| | | left: -40px; |
| | | } |
| | | |
| | | #e { |
| | | animation: e 1s ease-in-out infinite; |
| | | top: 0px; |
| | | left: 0px; |
| | | } |
| | | |
| | | #f { |
| | | animation: f 1s ease-in-out infinite; |
| | | top: 0px; |
| | | left: 40px; |
| | | } |
| | | |
| | | #g { |
| | | animation: g 1s ease-in-out infinite; |
| | | top: 40px; |
| | | left: -40px; |
| | | } |
| | | |
| | | #h { |
| | | animation: h 1s ease-in-out infinite; |
| | | top: 40px; |
| | | left: 0px; |
| | | } |
| | | |
| | | #i { |
| | | animation: i 1s ease-in-out infinite; |
| | | top: 40px; |
| | | left: 40px; |
| | | } |
| | | |
| | | @keyframes a { |
| | | |
| | | 50%, |
| | | 100% { |
| | | top: 0px; |
| | | left: -40px; |
| | | } |
| | | } |
| | | |
| | | @keyframes b { |
| | | |
| | | 50%, |
| | | 100% { |
| | | top: -40px; |
| | | left: -40px; |
| | | } |
| | | } |
| | | |
| | | @keyframes c { |
| | | |
| | | 50%, |
| | | 100% { |
| | | top: -40px; |
| | | left: 0px; |
| | | } |
| | | } |
| | | |
| | | @keyframes d { |
| | | |
| | | 50%, |
| | | 100% { |
| | | top: 40px; |
| | | left: -40px; |
| | | } |
| | | } |
| | | |
| | | @keyframes f { |
| | | |
| | | 50%, |
| | | 100% { |
| | | top: -40px; |
| | | left: 40px; |
| | | } |
| | | } |
| | | |
| | | @keyframes g { |
| | | |
| | | 50%, |
| | | 100% { |
| | | top: 40px; |
| | | left: 0px; |
| | | } |
| | | } |
| | | |
| | | @keyframes h { |
| | | |
| | | 50%, |
| | | 100% { |
| | | top: 40px; |
| | | left: 40px; |
| | | } |
| | | } |
| | | |
| | | @keyframes i { |
| | | |
| | | 50%, |
| | | 100% { |
| | | top: 0px; |
| | | left: 40px; |
| | | } |
| | | } |
| | | </style> |
| | | |
| | | |
| | | |
| | | </head> |
| | | |
| | | <body> |
| | | <div class="main"> |
| | | <ul> |
| | | <li id='a'></li> |
| | | <li id='b'></li> |
| | | <li id='c'></li> |
| | | <li id='d'></li> |
| | | <li id='e'></li> |
| | | <li id='f'></li> |
| | | <li id='g'></li> |
| | | <li id='h'></li> |
| | | <li id='i'></li> |
| | | </ul> |
| | | </div> |
| | | |
| | | <script> |
| | | api.send('renderer-ready'); |
| | | </script> |
| | | |
| | | </body> |
| | | |
| | | </html> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import axios from '@/assets/js/axios'; |
| | | export default { |
| | | name: 'App' |
| | | name: 'App', |
| | | mounted () { |
| | | this.testConect(); |
| | | }, |
| | | methods: { |
| | | testConect () { |
| | | axios({ |
| | | url: 'hello', |
| | | method: 'GET', |
| | | }).then((res) => { |
| | | api.send('main-window-ready'); |
| | | }, (res) => { |
| | | setTimeout(() => { |
| | | this.testConect(); |
| | | }, 300); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | |
| | | 'use strict' |
| | | |
| | | import { app, protocol, BrowserWindow, Menu } from 'electron' |
| | | import { createProtocol } from 'vue-cli-plugin-electron-builder/lib' |
| | | const { app, protocol, BrowserWindow, Menu, ipcMain, ipcRenderer } = require('electron'); |
| | | const { createProtocol } = require('vue-cli-plugin-electron-builder/lib'); |
| | | const path = require('path'); |
| | | |
| | | const isDevelopment = process.env.NODE_ENV !== 'production' |
| | | let win = null; |
| | | let loadingWin = null; |
| | | |
| | | // 单例锁 |
| | | const gotTheLock = app.requestSingleInstanceLock() |
| | |
| | | { scheme: 'app', privileges: { secure: true, standard: true } } |
| | | ]) |
| | | |
| | | // loading 窗口 |
| | | const loadingURL = isDevelopment ? path.join(__dirname, './loading.html') : `file://${__dirname}/loading.html`; |
| | | const showLoading = (cb) => { |
| | | loadingWin = new BrowserWindow({ |
| | | // show: false, |
| | | frame: false, |
| | | width: 260, |
| | | height: 260, |
| | | resizable: false, |
| | | transparent: true, |
| | | webPreferences: { |
| | | preload: path.join(__dirname, './preload.js') |
| | | } |
| | | }); |
| | | // loadingWin.once('show', () => { |
| | | // cb(true); |
| | | // }); |
| | | // loadingWin.webContents.openDevTools(); |
| | | loadingWin.loadURL(loadingURL); |
| | | loadingWin.setSkipTaskbar(true); |
| | | // loadingWin.show(); |
| | | cb(true); |
| | | // 启动java程序 |
| | | if (isDevelopment) { |
| | | serverProcess = true; |
| | | } else { |
| | | if (platform === 'win32') { |
| | | ipcMain.once('renderer-ready', (event, data) => { |
| | | let dir = path.resolve(__dirname, '..'); |
| | | serverProcess = require('child_process').execFile(dir + '/app_x64.exe'); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | let appUrl = 'http://localhost:8099/test/hello'; |
| | | // let appUrl = 'http://localhost:8099/test/hello'; |
| | | const platform = process.platform |
| | | let appStarted = false |
| | | let serverProcess |
| | | if (isDevelopment) { |
| | | serverProcess = true |
| | | } else { |
| | | if (platform === 'win32') { |
| | | // let pathArr = app.getPath('exe').split('\\'); |
| | | // pathArr.length = pathArr.length - 1; |
| | | // let path = pathArr.join('\\'); |
| | | // require('child_process').spawn('cmd.exe', ['/c', 'echo '+app.getAppPath()+ '===========' + __dirname +'===========' + __filename +'===========' + __static + ' >> 123.txt']); |
| | | |
| | | // serverProcess = require('child_process').spawn('cmd.exe', ['/c', 'testElectronJ.bat'], { |
| | | // cwd: path + '/bundled/bin' |
| | | // }) |
| | | serverProcess = require('child_process').execFile(__dirname + '/app_x64.exe'); |
| | | // serverProcess = require('child_process').spawn('cmd.exe', ['/c', 'testElectronJ.bat'], { |
| | | // cwd: __dirname + '/bin' |
| | | // // cwd: app.getAppPath() + '/bin' |
| | | // }); |
| | | } |
| | | } |
| | | if (!isDevelopment) { |
| | | Menu.setApplicationMenu(null); |
| | | } |
| | | async function createWindow() { |
| | | async function createWindow(wait) { |
| | | // Create the browser window. |
| | | win = new BrowserWindow({ |
| | | show: !wait, |
| | | width: 1200, |
| | | height: 800, |
| | | icon: `${__static}/icon/icon.png`, |
| | | webPreferences: { |
| | | webSecurity: false, |
| | | // webSecurity: false, |
| | | // Use pluginOptions.nodeIntegration, leave this alone |
| | | // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info |
| | | nodeIntegration: true, |
| | | // nodeIntegration: true, |
| | | // contextIsolation: false |
| | | // nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION, |
| | | contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION |
| | | // contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION |
| | | nodeIntegration: false, |
| | | webSecurity: true, |
| | | allowEval: false, |
| | | allowRunningInsecureContent: false, |
| | | contextIsolation: true, |
| | | enableRemoteModule: false, |
| | | preload: path.join(__dirname, './preload.js') |
| | | // preload: `${__dirname}/preload.js` |
| | | } |
| | | }) |
| | | |
| | | win.webContents.on('new-window', (event, url, frameName, disposition, options, additionalFeatures) => { |
| | | // open window as modal |
| | | event.preventDefault() |
| | | Object.assign(options, { |
| | | parent: win, |
| | | center: true |
| | | }) |
| | | event.newGuest = new BrowserWindow(options) |
| | | event.newGuest.loadURL(url) |
| | | }) |
| | | }); |
| | | |
| | | if (process.env.WEBPACK_DEV_SERVER_URL) { |
| | | // Load the url of the dev server if in development mode |
| | |
| | | // Load the index.html when not in development |
| | | // win.webContents.openDevTools(); |
| | | win.loadURL('app://./index.html') |
| | | } |
| | | |
| | | if (wait) { |
| | | ipcMain.once("main-window-ready", () => { |
| | | loadingWin.hide(); |
| | | loadingWin.close(); |
| | | win.show(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | |
| | | // initialization and is ready to create browser windows. |
| | | // Some APIs can only be used after this event occurs. |
| | | |
| | | const startUp = function () { |
| | | const requestPromise = require('minimal-request-promise') |
| | | requestPromise.get(appUrl).then(function (response) { |
| | | // require('child_process').spawn('cmd.exe', ['/c', 'echo '+JSON.stringify(response)+' success >> 123.txt']) |
| | | console.log(response); |
| | | console.log('Server started!'); |
| | | createWindow(); |
| | | appStarted = true |
| | | }, function (response) { |
| | | console.log(response) |
| | | console.log('Waiting for the server start...'); |
| | | // require('child_process').spawn('cmd.exe', ['/c', 'echo '+JSON.stringify(response)+' error >> 123.txt']) |
| | | setTimeout(function () { |
| | | startUp() |
| | | }, 500) |
| | | }) |
| | | } |
| | | |
| | | // const startUp = function () { |
| | | // const requestPromise = require('minimal-request-promise') |
| | | // requestPromise.get(appUrl).then(function (response) { |
| | | // // require('child_process').spawn('cmd.exe', ['/c', 'echo '+JSON.stringify(response)+' success >> 123.txt']) |
| | | // console.log(response); |
| | | // console.log('Server started!'); |
| | | // ipcRenderer.sendSync('java-ready'); |
| | | // // createWindow(); |
| | | // appStarted = true |
| | | // }, function (response) { |
| | | // console.log(response) |
| | | // // console.log('Waiting for the server start...'); |
| | | // // require('child_process').spawn('cmd.exe', ['/c', 'echo '+JSON.stringify(response)+' error >> 123.txt']) |
| | | // setTimeout(function () { |
| | | // startUp() |
| | | // }, 500) |
| | | // }) |
| | | // } |
| | | // // 启动java程序 |
| | | // if (isDevelopment) { |
| | | // serverProcess = true; |
| | | // } else { |
| | | // if (platform === 'win32') { |
| | | // ipcMain.once('renderer-ready', (event, data) => { |
| | | // serverProcess = require('child_process').execFile(__dirname + '/app_x64.exe'); |
| | | // startUp(); |
| | | // }); |
| | | // } |
| | | // } |
| | | // 禁用本地缓存 |
| | | // app.commandLine.appendSwitch("--disable-http-cache"); |
| | | |
| | | app.on('ready', async () => { |
| | | // require('child_process').spawn('cmd.exe', ['/c', 'echo ready >> 123.txt']) |
| | | startUp() |
| | | // startUp(); |
| | | showLoading(createWindow); |
| | | }) |
| | | // Exit cleanly on request from parent process in development mode. |
| | | if (isDevelopment) { |
New file |
| | |
| | | const { |
| | | contextBridge, |
| | | ipcRenderer |
| | | } = require('electron'); |
| | | |
| | | const validChannels = ['renderer-ready', 'main-window-ready']; |
| | | |
| | | contextBridge.exposeInMainWorld('api', { |
| | | send: (channel, data) => { |
| | | if (validChannels.includes(channel)) { |
| | | ipcRenderer.send(channel, data); |
| | | } |
| | | }, |
| | | receive: (channel, func) => { |
| | | if (validChannels.includes(channel)) { |
| | | console.log('receive: ' + channel); |
| | | ipcRenderer.on(channel, (event, ...args) => func(...args)); |
| | | } |
| | | } |
| | | }); |
| | |
| | | const path = require('path'); |
| | | |
| | | function resolve (dir) { |
| | | function resolve(dir) { |
| | | return path.join(__dirname, dir); |
| | | } |
| | | |
| | |
| | | publicPath: './', |
| | | devServer: { |
| | | // can be overwritten by process.env.HOST |
| | | host: '0.0.0.0', |
| | | host: '0.0.0.0', |
| | | port: 8081 |
| | | }, |
| | | pluginOptions:{ |
| | | electronBuilder:{ |
| | | preload:'src/preload.js', |
| | | builderOptions: { |
| | | extraResources: [ |
| | | { |
| | | from: "./public/runtime", |
| | | to: "./runtime" |
| | | }, |
| | | { |
| | | from: "./public/app_x64.exe", |
| | | to: "./app_x64.exe" |
| | | } |
| | | ], |
| | | files: [ |
| | | '**/*', |
| | | '!**/runtime', |
| | | '!**/app_x64.exe' |
| | | ], |
| | | } |
| | | } |
| | | }, |
| | | chainWebpack: config => { |
| | | config.resolve.alias |
| | | .set('@', resolve('src')) |