Commit f06833f6 by zhuzhequan

取消显示屏2

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