Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
html
/
jinmao-community-platform
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5993a1ed
authored
May 26, 2021
by
袁晓帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改下载文件不成功的问题
parent
dcb26030
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
src/components/page/IOC/sellCarport.vue
+6
-2
src/main.js
+5
-3
No files found.
src/components/page/IOC/sellCarport.vue
View file @
5993a1ed
...
...
@@ -184,14 +184,18 @@ export default {
this
.
$axios
({
method
:
'post'
,
url
:
'/carParking/carExport'
,
data
:{},
data
:{
c
:
100
,
p
:
1
},
responseType
:
'blob'
,
headers
:
{
'Content-Type'
:
'application/json;charset=UTF-8'
,
//设置请求头请求格式为JSON
token
:
window
.
sessionStorage
.
getItem
(
'token'
),
projectId
:
window
.
sessionStorage
.
getItem
(
'projectId'
)
}
}).
then
(
res
=>
{
let
blob
=
new
Blob
([
res
],
{
type
:
"application/vnd.ms-excel"
});
// res就是接口返回的文件流了
let
blob
=
new
Blob
([
res
.
data
],
{
type
:
"application/vnd.ms-excel"
});
// res就是接口返回的文件流了
let
objectUrl
=
URL
.
createObjectURL
(
blob
);
window
.
location
.
href
=
objectUrl
;
});
...
...
src/main.js
View file @
5993a1ed
...
...
@@ -45,13 +45,15 @@ axios.interceptors.request.use(config => {
// 设置拦截器
axios
.
interceptors
.
response
.
use
(
function
(
response
)
{
console
.
log
(
response
.
config
.
url
)
if
(
response
.
data
.
code
===
'0'
)
{
return
response
}
else
if
(
response
.
data
.
code
===
'BASE_00004'
)
{
if
(
response
.
data
.
code
===
'0'
)
{
return
response
}
else
if
(
response
.
data
.
code
===
'BASE_00004'
)
{
store
.
dispatch
(
'clearCancel'
)
alert
(
'登录失效,请重新登录'
,
'温馨提示'
)
router
.
push
(
'/login'
)
return
false
}
else
if
(
response
.
data
.
type
===
'application/vnd.ms-excel'
)
{
return
response
}
else
{
// 在添加其他的错误码判断
if
(
response
.
data
.
msg
)
{
...
...
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