This commit is contained in:
Silent YANG 2024-02-05 04:04:55 +08:00
parent e15eca6cc0
commit eaf8c8ae15
9 changed files with 8892 additions and 47 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ node_modules
dist
dist-ssr
*.local
out

View File

@ -11,6 +11,7 @@ import { TDesignResolver } from 'unplugin-vue-components/resolvers';
import { ArcoResolver } from 'unplugin-vue-components/resolvers';
export default defineConfig({
base: './',
plugins: [
vue(),
vueJsx(),

41
forge.config.js Normal file
View File

@ -0,0 +1,41 @@
module.exports = {
packagerConfig: {
asar: true,
},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
{
name: '@rabbitholesyndrome/electron-forge-maker-portable',
config: {
appId: 'com.vicicode.k5web',
productName: 'K5Web',
icon: 'icon.ico'
},
portable: {
artifactName: 'k5web.exe'
}
}
],
plugins: [
{
name: '@electron-forge/plugin-auto-unpack-natives',
config: {},
},
],
};

BIN
icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

64
main.js Normal file
View File

@ -0,0 +1,64 @@
const { app, BrowserWindow } = require('electron/main')
function createWindow () {
const mainWindow = new BrowserWindow({
width: 1280,
height: 760,
autoHideMenuBar: true
})
mainWindow.webContents.session.on('select-serial-port', (event, portList, webContents, callback) => {
// Add listeners to handle ports being added or removed before the callback for `select-serial-port`
// is called.
mainWindow.webContents.session.on('serial-port-added', (event, port) => {
console.log('serial-port-added FIRED WITH', port)
// Optionally update portList to add the new port
})
mainWindow.webContents.session.on('serial-port-removed', (event, port) => {
console.log('serial-port-removed FIRED WITH', port)
// Optionally update portList to remove the port
})
event.preventDefault()
if (portList && portList.length > 0) {
console.log(portList[portList.length - 1])
callback(portList[portList.length - 1].portId)
} else {
// eslint-disable-next-line n/no-callback-literal
callback('') // Could not find any matching devices
}
})
mainWindow.webContents.session.setPermissionCheckHandler((webContents, permission, requestingOrigin, details) => {
if (permission === 'serial' && details.securityOrigin === 'file:///') {
return true
}
return false
})
mainWindow.webContents.session.setDevicePermissionHandler((details) => {
if (details.deviceType === 'serial' && details.origin === 'file://') {
return true
}
return false
})
mainWindow.loadFile('./dist/index.html')
// mainWindow.webContents.openDevTools()
}
app.whenReady().then(() => {
createWindow()
app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})

6403
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,11 +5,15 @@
"private": true,
"author": "ArcoDesign Team",
"license": "MIT",
"main": "main.js",
"scripts": {
"dev": "vite --config ./config/vite.config.dev.ts",
"build": "vite build --config ./config/vite.config.prod.ts",
"report": "cross-env REPORT=true npm run build",
"preview": "npm run build && vite preview --host"
"preview": "npm run build && vite preview --host",
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
},
"dependencies": {
"@arco-design/web-vue": "^2.44.7",
@ -19,6 +23,7 @@
"axios": "^0.24.0",
"dayjs": "^1.11.5",
"echarts": "^5.4.0",
"electron-squirrel-startup": "^1.0.0",
"lodash": "^4.17.21",
"mitt": "^3.0.0",
"nprogress": "^0.2.0",
@ -35,6 +40,13 @@
"@arco-plugins/vite-vue": "^1.4.5",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@electron-forge/cli": "^7.2.0",
"@electron-forge/maker-deb": "^7.2.0",
"@electron-forge/maker-rpm": "^7.2.0",
"@electron-forge/maker-squirrel": "^7.2.0",
"@electron-forge/maker-zip": "^7.2.0",
"@electron-forge/plugin-auto-unpack-natives": "^7.2.0",
"@rabbitholesyndrome/electron-forge-maker-portable": "^0.2.0",
"@types/lodash": "^4.14.186",
"@types/mockjs": "^1.0.7",
"@types/nprogress": "^0.2.0",
@ -46,6 +58,7 @@
"@vue/babel-plugin-jsx": "^1.1.1",
"consola": "^2.15.3",
"cross-env": "^7.0.3",
"electron": "^28.2.1",
"less": "^4.1.3",
"mockjs": "^1.1.0",
"postcss-html": "^1.5.0",

View File

@ -2,10 +2,6 @@
<div class="navbar">
<div class="left-side">
<a-space>
<img
alt="logo"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/dfdba5317c0c20ce20e64fac803d52bc.svg~tplv-49unhts6dw-image.image"
/>
<a-typography-title
:style="{ margin: 0, fontSize: '18px' }"
:heading="5"

2410
yarn.lock

File diff suppressed because it is too large Load Diff