Commit f06833f6 by zhuzhequan

取消显示屏2

parent b6aa61fb
......@@ -2,7 +2,7 @@
"name": "JomallProductionAssistant",
"productName": "JomallProductionAssistant",
"description": "",
"version": "1.0.2",
"version": "1.0.3",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
......
......@@ -14,7 +14,7 @@ createServer();
const isDevelopment = process.env.NODE_ENV !== "production";
let win;
let otherWindow;
let newWindow;
protocol.registerSchemesAsPrivileged([
{ scheme: "app", privileges: { secure: true, standard: true } }
]);
......@@ -33,36 +33,25 @@ async function createWindow() {
nodeIntegration: true
}
});
let displays = screen.getAllDisplays();
//寻找副屏幕
let externalDisplay = displays.find(display => {
return display.bounds.x !== 0 || display.bounds.y !== 0;
let newWindow = new BrowserWindow({
fullscreen: false,
width: 1000,
height: 1000,
webPreferences: {
nodeIntegration: true
//配置预加载脚本文件(preload),此处起名为preloadOther
//p.s.路径为绝对路径
// preload: path.join(__dirname, "./preloadOther.js")
}
});
console.log(winURL + "#" + `/design-detail`);
//指定副屏幕打开的网页
await newWindow.loadURL(winURL + "#" + `/design-detail`);
win.on("closed", () => {
//这一段放外面的话,如果你电脑没双屏会报错。
win = null;
});
if (externalDisplay) {
otherWindow = new BrowserWindow({
fullscreen: false,
width: externalDisplay.bounds.width,
height: externalDisplay.bounds.height,
x: externalDisplay.bounds.x,
y: externalDisplay.bounds.y,
webPreferences: {
nodeIntegration: true
//配置预加载脚本文件(preload),此处起名为preloadOther
//p.s.路径为绝对路径
// preload: path.join(__dirname, "./preloadOther.js")
}
});
console.log(winURL + "#" + `/design-detail`);
//指定副屏幕打开的网页
await otherWindow.loadURL(winURL + "#" + `/design-detail`);
otherWindow.on("closed", () => {
//这一段放外面的话,如果你电脑没双屏会报错。
otherWindow = null;
});
}
ipcMain.on("allPrint", () => {
// 获取到打印机列表
......@@ -72,7 +61,7 @@ async function createWindow() {
});
ipcMain.on("win-subScreen", (data, v) => {
if (otherWindow) otherWindow.webContents.send("getProductionNoInfo", v);
if (newWindow) newWindow.webContents.send("getProductionNoInfo", v);
});
if (process.env.WEBPACK_DEV_SERVER_URL) {
......@@ -90,7 +79,7 @@ async function createWindow() {
win.on("closed", () => {
win.removeAllListeners();
win = null;
otherWindow = null;
newWindow = null;
});
// 自动更新逻辑开始
......
......@@ -6,8 +6,11 @@ const path = require("path");
export function returnLogFilePath() {
const today = moment(new Date()).format("YYYY-MM-DD");
const low_path = process.cwd();
let log_dir = path.join(low_path, "logs")
if (!fs.existsSync(log_dir)) {
fs.mkdirSync(log_dir) // 创建日志文件夹
}
const dir = path.join(low_path, `/logs/${today}`);
console.log(dir);
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
......@@ -39,8 +42,8 @@ const addFormatLog = function(req, res, data) {
const now = new Date();
const resTime = now - req._startTime;
const token = req.headers["jwt-token"]
const company = req.headers["company"]
const token = req.headers["jwt-token"];
const company = req.headers["company"];
const {
ip,
headers,
......@@ -75,15 +78,14 @@ const addFormatLog = function(req, res, data) {
响应时间 : ${logInfo.resTime / 1000} s
method :${logInfo.method}
url :${logInfo.url}
客户 :${logInfo.company || ''}
token :${logInfo.token || ''}
客户 :${logInfo.company || ""}
token :${logInfo.token || ""}
body :${JSON.stringify(logInfo.body)}
状态码 :${logInfo.statusCode}
data :${JSON.stringify(logInfo.data)}
`
);
};
......
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