调试打包
This commit is contained in:
parent
4983ae1664
commit
0d04bfc3d2
|
|
@ -8,6 +8,8 @@ pnpm-debug.log*
|
|||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
release
|
||||
dist-electron
|
||||
|
||||
dist
|
||||
dist-ssr
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"use strict";
|
||||
const electron = require("electron");
|
||||
const path = require("path");
|
||||
const path$1 = require("path");
|
||||
function printUtils(params) {
|
||||
return new Promise(async (resolvePrint, rejectPrint) => {
|
||||
let subMainWindow = new electron.BrowserWindow({
|
||||
|
|
@ -13,7 +13,7 @@ function printUtils(params) {
|
|||
enableRemoteModule: true
|
||||
}
|
||||
});
|
||||
subMainWindow.loadFile(path.join(__dirname, "../public/print.html"));
|
||||
subMainWindow.loadFile(path$1.join(__dirname, "../public/print.html"));
|
||||
subMainWindow.webContents.on("did-finish-load", async (res) => {
|
||||
subMainWindow.webContents.openDevTools();
|
||||
console.log("网页加载完成", res);
|
||||
|
|
@ -28,9 +28,10 @@ function printUtils(params) {
|
|||
});
|
||||
});
|
||||
}
|
||||
const NODE_ENV = process.env.NODE_ENV;
|
||||
electron.app.whenReady().then(() => {
|
||||
const win = new electron.BrowserWindow({
|
||||
title: "Main window",
|
||||
title: "银收客",
|
||||
width: 1200,
|
||||
height: 800,
|
||||
fullscreenable: true,
|
||||
|
|
@ -46,7 +47,10 @@ electron.app.whenReady().then(() => {
|
|||
if (process.env.VITE_DEV_SERVER_URL) {
|
||||
win.loadURL(process.env.VITE_DEV_SERVER_URL);
|
||||
} else {
|
||||
win.loadFile("dist/index.html");
|
||||
win.loadFile(path.join(__dirname, "../dist/index.html"));
|
||||
}
|
||||
if (NODE_ENV == "development") {
|
||||
win.webContents.openDevTools();
|
||||
}
|
||||
electron.app.on("activate", () => {
|
||||
if (electron.BrowserWindow.getAllWindows().length === 0) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import { app, BrowserWindow, ipcMain } from "electron";
|
||||
import { printUtils } from './printUtils'
|
||||
|
||||
const NODE_ENV = process.env.NODE_ENV
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const win = new BrowserWindow({
|
||||
title: "Main window",
|
||||
title: "银收客",
|
||||
width: 1200,
|
||||
height: 800,
|
||||
fullscreenable: true,
|
||||
|
|
@ -19,12 +21,15 @@ app.whenReady().then(() => {
|
|||
|
||||
// You can use `process.env.VITE_DEV_SERVER_URL` when the vite command is called `serve`
|
||||
if (process.env.VITE_DEV_SERVER_URL) {
|
||||
win.loadURL(process.env.VITE_DEV_SERVER_URL);
|
||||
win.loadURL(process.env.VITE_DEV_SERVER_URL); // 使用vite开发服务的url路径访问应用
|
||||
} else {
|
||||
// Load your file
|
||||
win.loadFile("dist/index.html");
|
||||
win.loadFile(path.join(__dirname, '../dist/index.html')); // 打包后使用文件路径访问应用
|
||||
}
|
||||
// win.webContents.openDevTools();
|
||||
|
||||
if (NODE_ENV == 'development') {
|
||||
win.webContents.openDevTools();
|
||||
}
|
||||
|
||||
app.on("activate", () => {
|
||||
// 在 macOS 系统内, 如果没有已开启的应用窗口
|
||||
// 点击托盘图标时通常会重新创建一个新窗口
|
||||
|
|
|
|||
28
package.json
28
package.json
|
|
@ -5,14 +5,13 @@
|
|||
"main": "dist-electron/main.js",
|
||||
"scripts": {
|
||||
"dev": "chcp 65001 && vite",
|
||||
"build": "vite build",
|
||||
"build": "vite build && electron-builder",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"axios": "^1.6.2",
|
||||
"dayjs": "^1.11.10",
|
||||
"electron": "^29.0.1",
|
||||
"element-plus": "^2.4.3",
|
||||
"lodash": "^4.17.21",
|
||||
"pinia": "^2.1.7",
|
||||
|
|
@ -22,6 +21,7 @@
|
|||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^4.5.0",
|
||||
"electron": "^28.2.3",
|
||||
"electron-builder": "^24.13.3",
|
||||
"path": "^0.12.7",
|
||||
"sass": "^1.69.5",
|
||||
"sass-loader": "^13.3.2",
|
||||
|
|
@ -29,5 +29,29 @@
|
|||
"vite": "^5.0.0",
|
||||
"vite-plugin-electron": "^0.15.4",
|
||||
"vite-plugin-electron-renderer": "^0.14.5"
|
||||
},
|
||||
"build": {
|
||||
"appId": "com.example.app",
|
||||
"productName": "cashier_desktop",
|
||||
"asar": true,
|
||||
"directories": {
|
||||
"buildResources": "build",
|
||||
"output": "release"
|
||||
},
|
||||
"win": {
|
||||
"icon": "./src/assets/logo.ico",
|
||||
"target": "nsis"
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": false,
|
||||
"allowElevation": true,
|
||||
"allowToChangeInstallationDirectory": true,
|
||||
"installerIcon": "./src/assets/logo.ico",
|
||||
"uninstallerIcon": "./src/assets/logo.ico",
|
||||
"installerHeaderIcon": "./src/assets/logo.ico",
|
||||
"createDesktopShortcut": true,
|
||||
"createStartMenuShortcut": true,
|
||||
"license": "LICENSE.txt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
|
|
@ -107,7 +107,6 @@ function printHandle() {
|
|||
// 订单已支付
|
||||
function paySuccess() {
|
||||
dialogVisible.value = false
|
||||
printHandle()
|
||||
emit('paySuccess')
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue