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
2d90bc5b
Commit
2d90bc5b
authored
Feb 09, 2026
by
linjinhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:修改网络捕获错误
parent
8ef3db90
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
41 deletions
+26
-41
src/server/entity/function.js
+23
-16
src/utils/axios.js
+1
-24
src/views/design/main/index.vue
+2
-1
No files found.
src/server/entity/function.js
View file @
2d90bc5b
...
...
@@ -39,31 +39,38 @@ function getCurrentDesktopDevice() {
return
version
;
}
async
function
readEnv
()
{
function
readEnv
()
{
// 不需要async了
let
exePath
,
configPath
;
if
(
process
.
env
.
NODE_ENV
===
"development"
)
{
configPath
=
path
.
join
(
__dirname
,
"../config/env.json"
);
}
else
{
exePath
=
path
.
dirname
(
app
.
getPath
(
"exe"
)).
replace
(
/
\\
/g
,
"/"
);
console
.
log
(
"exePath"
,
exePath
);
configPath
=
`
${
exePath
}
/config/env.json`
;
}
console
.
log
(
"configPath"
,
configPath
);
await
fs
.
readFile
(
configPath
,
"utf-8"
,
async
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
"读取配置文件失败:"
,
err
);
return
;
try
{
if
(
process
.
env
.
NODE_ENV
===
"development"
)
{
configPath
=
path
.
join
(
__dirname
,
"../config/env.json"
);
}
else
{
exePath
=
path
.
dirname
(
app
.
getPath
(
"exe"
)).
replace
(
/
\\
/g
,
"/"
);
configPath
=
`
${
exePath
}
/config/env.json`
;
}
console
.
log
(
"configPath"
,
configPath
);
// ✅ 改用同步读取,确保配置加载完成
const
data
=
fs
.
readFileSync
(
configPath
,
"utf-8"
);
const
config
=
JSON
.
parse
(
data
);
config
.
configPath
=
configPath
;
await
setApi
(
config
);
setApi
(
config
);
// 如果setApi是异步的,这里需要改成同步,或用await(但readEnv要加async)
console
.
log
(
53
,
config
);
// 此时赋值一定完成
fileEnv
=
config
.
fileApiUrl
;
env
=
config
.
apiApiHost
;
visionUrl
=
config
.
visionUrl
;
});
console
.
log
(
"配置加载完成:"
,
{
fileEnv
,
env
,
visionUrl
});
}
catch
(
err
)
{
console
.
error
(
"读取配置文件失败:"
,
err
);
// 配置加载失败时,可设置默认值或抛出错误
fileEnv
=
"https://factory.jomalls.com/upload/factory"
;
env
=
"https://factory.jomalls.com/api"
;
visionUrl
=
"https://console.jomalls.com"
;
throw
new
Error
(
`配置文件加载失败:
${
err
.
message
}
`
);
}
}
readEnv
();
export
default
{
...
...
src/utils/axios.js
View file @
2d90bc5b
import
axios
from
"axios"
;
import
Vue
from
"vue"
;
import
{
Loading
}
from
"element-ui"
;
const
{
getHostApi
}
=
require
(
"@/server/utils/store"
);
// create an axios instance
const
service
=
axios
.
create
({
baseURL
:
"http://localhost:3000"
,
// url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
timeout
:
50000000
,
// request timeout
timeout
:
12600000
,
// request timeout
});
let
loading
;
...
...
@@ -28,17 +26,6 @@ function endLoading() {
service
.
interceptors
.
request
.
use
(
(
config
)
=>
{
const
user
=
Vue
.
prototype
.
$dataStore
.
get
(
"user"
);
// const isFullUrl = /^https?:\/\//i.test(config.url);
// console.log(33, config.url);
// if (!isFullUrl) {
// if (process.env.NODE_ENV === "development") {
// config.baseURL = "http://localhost:3000";
// } else {
// config.baseURL = config.baseURL = getHostApi().apiApiHost;
// }
// }
if
(
user
)
{
config
.
headers
[
"jwt-token"
]
=
user
.
token
;
}
...
...
@@ -54,16 +41,6 @@ service.interceptors.request.use(
// Add a response interceptor
service
.
interceptors
.
response
.
use
(
/**
* If you want to get http information such as headers or status
* Please return response => response
*/
/**
* Determine the request status by custom code
* Here is just an example
* You can also judge the status by HTTP Status Code
*/
async
(
response
)
=>
{
// do something with response data
const
res
=
response
.
data
;
...
...
src/views/design/main/index.vue
View file @
2d90bc5b
...
...
@@ -1849,7 +1849,8 @@ export default {
detail &&
detail.mssWidth &&
detail.mssHeight &&
selectImgList.length
selectImgList.length &&
!detail?.saveImgList.some((el) => el.isCut)
"
>
<b
style=
"color: green"
v-if=
"hasSize"
...
...
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