Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
electron-printer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhuzhequan
electron-printer
Commits
3d7e6157
Commit
3d7e6157
authored
Mar 12, 2026
by
linjinhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修复前端代码和后端服务得代码文件
parent
dc9031c5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
61 deletions
+15
-61
src/server/utils/setImage.js
+1
-1
src/views/design/head/index.vue
+3
-53
src/views/design/main/index.vue
+11
-7
No files found.
src/server/utils/setImage.js
View file @
3d7e6157
...
...
@@ -176,7 +176,7 @@ async function processImages(inputPath, outputPath, options = {}) {
console
.
log
(
`处理失败:
${
results
.
filter
((
r
)
=>
r
.
status
===
"error"
).
length
}
张图片`
,
);
fs
.
unlinkSync
(
inputPath
);
return
results
;
}
catch
(
error
)
{
console
.
error
(
"处理图片过程中出错:"
,
error
);
...
...
src/views/design/head/index.vue
View file @
3d7e6157
...
...
@@ -13,12 +13,11 @@ import path from "path"; // 引入 path 模块
import
axios
from
"axios"
;
import
{
extractValue
}
from
"@/utils/index.js"
;
const
uuid
=
require
(
"uuid"
);
const
fs
=
require
(
"fs"
);
import
{
mapState
}
from
"vuex"
;
const
{
getVersion
,
getHostApi
,
setApi
,
setDesktopDevice
,
getDesktopDevice
,
getOrderInfoMap
,
...
...
@@ -738,20 +737,7 @@ export default {
this.isFirst = false;
}
},
// // 聚焦资源管理器窗口(Windows)
focusExplorerWindow(path) {
const { exec } = require("
child_process
");
const fs = require("
fs
");
const command = `start explorer /select, "
$
{
path
}
"`;
// 检查路径是否存在
if (fs.existsSync(path)) {
exec(`cmd /c "
$
{
command
}
"`, (err) => {
if (err) console.error("
激活窗口失败
:
", err);
});
} else {
console.error("
路径不存在
:
", path);
}
},
classifyField(field) {
// 第一类:以"
AAAF
-
CNPSC
"开头
if (field.includes("
CN
")) {
...
...
@@ -875,7 +861,7 @@ export default {
outputPath: outputPath,
};
const res = await this.$api.post("
/
processImage
", params);
fs.unlinkSync(el.productionFile);
return {
fileName: outputFileName,
productionFile: res.msg[0]?.outputPath,
...
...
@@ -916,42 +902,6 @@ export default {
return "";
},
changeApi(v) {
const configPath = getHostApi()?.configPath;
console.log(692, this.config);
fs.readFile(configPath, "
utf
-
8
", (err, data) => {
if (err) {
console.error("
读取配置文件失败
:
", err);
return;
}
try {
let configObj = JSON.parse(data);
console.log(700, configObj);
configObj.apiApiHost = `https://${v}/api`;
configObj.fileApiUrl = `https://${v}/upload/factory`;
configObj.configPath = configPath;
const newData = JSON.stringify(configObj); // 使用2个空格缩进
// console.log("
修改后的数据
:
", newData);
// 4. 写回文件
fs.writeFile(configPath, newData, "
utf
-
8
", (writeErr) => {
if (writeErr) {
console.error("
写入配置文件失败
:
", writeErr);
this.$message.error(`写入配置文件失败: ${writeErr.message}`);
return;
}
console.log("
配置文件更新成功
", configObj);
setApi(configObj);
});
} catch (parseError) {
console.error("
解析
JSON
失败
:
", parseError);
this.$message.error(`配置文件格式错误: ${parseError.message}`);
}
});
},
getDomainFromUrl(url) {
try {
return new URL(url).host;
...
...
src/views/design/main/index.vue
View file @
3d7e6157
...
...
@@ -5,9 +5,10 @@ import ImgSetting from "./imgSetting.vue";
import
bus
from
"@/bus"
;
import
PrintDialog
from
"@/views/design/head/printDialog.vue"
;
import
{
mmToPx
,
extractValue
}
from
"@/utils"
;
const
{
pathMap
}
=
require
(
"@/config/index.js"
);
const
path
=
require
(
"path"
);
const
fs
=
require
(
"fs"
);
const
uuid
=
require
(
"uuid"
);
import
{
mapState
}
from
"vuex"
;
...
...
@@ -985,7 +986,7 @@ export default {
outputPath
:
outputPath
,
};
const
res
=
await
this
.
$api
.
post
(
"/processImage"
,
params
);
fs
.
unlinkSync
(
el
.
productionFile
);
return
{
fileName
:
outputFileName
,
productionFile
:
res
.
msg
[
0
]?.
outputPath
,
...
...
@@ -1049,11 +1050,14 @@ export default {
this
.
$store
.
commit
(
"setIsPreView"
,
this
.
isView
);
},
async
downloadImg
(
type
)
{
let
res
=
await
this
.
$api
.
post
(
"/downloadBySubOrderNumber"
,
{
ids
:
[
this
.
detail
.
id
],
device
:
this
.
newDesktopDevice
,
orderType
:
this
.
orderType
,
});
let
res
=
await
this
.
$api
.
post
(
pathMap
[
"downloadBySubOrderNumber"
][
this
.
orderType
],
{
ids
:
[
this
.
detail
.
id
],
device
:
this
.
newDesktopDevice
,
orderType
:
this
.
orderType
,
},
);
if
(
res
.
data
.
length
===
0
)
return
this
.
$message
.
warning
(
"未找到素材图!"
);
let
imgList
=
[];
res
.
data
.
forEach
((
el
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment