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