Commit b83558c0 by linjinhong

测试提交

parent baa95bb6
......@@ -670,3 +670,15 @@
状态码 :304
data :{"code":200,"data":{"id":14,"version":"1.0.7","title":"新版本更新!","content":"1.修复打印机数据传输错误问题","fullUpdate":0,"forcedUpdate":0,"businessType":"production_assistant","createTime":"2025-04-14T09:29:49","updateTime":"2025-04-14T09:29:49","fileList":[{"id":56,"storageType":"local","businessType":"production_assistant","businessId":14,"fileUrl":"/data/upload/erp//app/productionAssistant/1.0.7/css.zip","versionPath":"/data/upload/erp//app/productionAssistant/1.0.7","fileUrlCrc":0,"createTime":"2025-04-14T09:29:49","updateTime":"2025-04-14T09:29:49"}]},"message":"操作成功"}
[2025-04-16T17:46:12.713] [INFO] log -
时间:2025-04-16 17:46:12
ip : ::1
host : localhost:3000
响应时间 : 0.341 s
method :GET
url :/checkUpdate?version=1.0.6
token :eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzeXNVc2VyIjp7ImlkIjo0NiwiYWNjb3VudCI6IjEyMzQ1NiIsInBhc3N3b3JkIjoiZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2UiLCJzdXBwZXJNYXJrIjoxLCJmYWN0b3J5SWQiOjMzLCJmYWN0b3J5Q29kZSI6IlQzNCIsInN0YXR1cyI6MSwiZmFjdG9yeSI6eyJpZCI6MzMsImJpYW5tYSI6IlQzNCIsInRpdGxlIjoiVDM0IiwidHlwZUlkIjoxNiwibmFtZSI6IjEyMyIsIm1vYmlsZSI6IjEyMzQ1NiIsImdvb2RzTnVtYmVyIjo0OSwiYXV0aG9yaXplTnVtYmVyIjowLCJzdGF0dXMiOjF9fSwiZXhwIjoxNzQ0NzkyNzU4fQ.SeKoGM-D_IvyduvM3fFAoGlZ2gnW6yiuq47Z1Qcs0o6UQpjE-V-_B8pAmnRmIcwYG_zr9nBET2_GbyDMq6E4Qw
body :{}
状态码 :304
data :{"code":200,"data":{"id":14,"version":"1.0.7","title":"新版本更新!","content":"1.修复打印机数据传输错误问题","fullUpdate":0,"forcedUpdate":0,"businessType":"production_assistant","createTime":"2025-04-14T09:29:49","updateTime":"2025-04-14T09:29:49","fileList":[{"id":56,"storageType":"local","businessType":"production_assistant","businessId":14,"fileUrl":"/data/upload/erp//app/productionAssistant/1.0.7/css.zip","versionPath":"/data/upload/erp//app/productionAssistant/1.0.7","fileUrlCrc":0,"createTime":"2025-04-14T09:29:49","updateTime":"2025-04-14T09:29:49"}]},"message":"操作成功"}
......@@ -44,13 +44,15 @@ async function createWindow() {
// preload: path.join(__dirname, "./preloadOther.js")
},
});
console.log(winURL + "#" + `/design-detail`);
//指定副屏幕打开的网页
await newWindow.loadURL(winURL + "#" + `/design-detail`);
win.on("closed", () => {
//这一段放外面的话,如果你电脑没双屏会报错。
win = null;
});
newWindow.reload();
// win.on("closed", () => {
// //这一段放外面的话,如果你电脑没双屏会报错。
// win = null;
// });
ipcMain.on("allPrint", () => {
// 获取到打印机列表
......@@ -75,10 +77,21 @@ async function createWindow() {
});
win.on("closed", () => {
win && win.removeAllListeners();
// win && win.removeAllListeners();
// win = null;
// newWindow && newWindow.close();
// newWindow = null;
// 确保窗口还未销毁,才执行清理操作
if (win && !win.isDestroyed()) {
win.removeAllListeners();
win = null;
newWindow && newWindow.close();
}
// 确保 newWindow 还未销毁,才执行关闭操作
if (newWindow && !newWindow.isDestroyed()) {
newWindow.close();
newWindow = null;
}
});
// 自动更新逻辑开始
......
import express from "express";
import router from "./routes/index.js";
import { logMiddleWare } from "./utils/log";
const { app } = require("electron");
import path from "path"; // 引入 path 模块
// const { app } = require("electron");
// import path from "path"; // 引入 path 模块
const PORT = 3000;
const printPORT = 3030;
// 获取应用程序的安装目录
let exePath = path.dirname(app.getPath("exe"));
// const printPORT = 3030;
// // 获取应用程序的安装目录
// let exePath = path.dirname(app.getPath("exe"));
export const createServer = () => {
const webApp = express();
const printApp = express();
// const printApp = express();
//webApp.use(logger("./logs"));
webApp.use(logMiddleWare());
webApp.use(express.json());
......@@ -39,33 +39,28 @@ export const createServer = () => {
webApp.set("port", PORT);
webApp.listen(PORT, () => console.log(`App listening on port ${PORT}`));
console.log("__dirname", __dirname);
// 判断环境变量来决定使用哪种路径
console.log(48, process.env.NODE_ENV);
if (process.env.NODE_ENV === "development") {
// 在开发环境中,假设静态文件存放在本地的 "print/input" 目录中
printApp.use(express.static(path.join(__dirname, "..", "print", "input")));
} else {
// 在生产环境中,静态文件会存放在应用安装目录中
printApp.use(express.static(path.join(exePath, "print", "input")));
}
// printApp 的 404 错误处理(如果需要)
printApp.use((req, res) => {
res.status(404).send("Sorry! 404 Error.");
});
// printApp 错误处理中间件(如果需要)
printApp.use((err, req, res) => {
res.locals.message = err.message;
res.locals.error = req.app.get("env") === "development" ? err : {};
res.status(err.status || 500);
res.json({
message: err.message,
error: err,
});
});
// 启动服务器
printApp.listen(printPORT, () => {
console.log(`Express server running at http://localhost:${printPORT}`);
});
// if (process.env.NODE_ENV === "development") {
// printApp.use(express.static(path.join(__dirname, "..", "print", "input")));
// } else {
// printApp.use(express.static(path.join(exePath, "print", "input")));
// }
// // printApp 的 404 错误处理
// printApp.use((req, res) => {
// res.status(404).send("Sorry! 404 Error.");
// });
// // printApp 错误处理中间件
// printApp.use((err, req, res) => {
// res.locals.message = err.message;
// res.locals.error = req.app.get("env") === "development" ? err : {};
// res.status(err.status || 500);
// res.json({
// message: err.message,
// error: err,
// });
// });
// // 启动服务器
// printApp.listen(printPORT, () => {
// console.log(`Express server running at http://localhost:${printPORT}`);
// });
};
<script>
import bus from "@/bus";
import PrintDialog from "./printDialog.vue";
import { ipcRenderer } from "electron";
import { ipcRenderer, app, shell } from "electron";
import { grid } from "../data";
import pkg from "../../../../package.json";
const { shell } = require("electron");
import UpdateDialog from "@/views/design/updateDialog.vue";
import path from "path"; // 引入 path 模块
export default {
components: { PrintDialog, UpdateDialog },
......@@ -225,12 +225,6 @@ export default {
res.data.forEach((el) => {
this.imgList = this.imgList.concat(el.list || []);
});
console.log(228, this.imgList);
if (this.desktopDevice !== 1) {
this.imgList.forEach((el) =>
shell.openExternal(`http://localhost:3030/${el.fileName}`)
);
}
this.$dataStore.set("production_no", this.productionNo);
if (res.data.length === 0)
......@@ -254,6 +248,15 @@ export default {
this.productionNo = "";
this.$refs.searchRef.focus();
console.log(228, this.imgList);
if (this.desktopDevice !== 1) {
if (this.imgList.length) {
let pathUrl = this.imgList[0].productionFile;
console.log(236, pathUrl);
shell.showItemInFolder(pathUrl);
}
}
} catch (err) {
this.productionNo = "";
this.$refs.searchRef.focus();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment