Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
trimble-admin-pro
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
56eb8457
authored
2020-03-02 13:32:32 +0800
by
qingxiao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1
1 parent
83d217e5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
122 additions
and
8 deletions
src/api/fetch-api.js
src/views/public/components/publicSaveDialog.vue
src/views/public/index.vue
sync.sh
src/api/fetch-api.js
View file @
56eb845
...
...
@@ -99,7 +99,7 @@ export const formdata = (url, data) => {
}
export
const
request
=
{
/*
export const request = {
post(url, data) {
return axios.post(`${requestDomain}${url}`, data);
},
...
...
@@ -127,5 +127,106 @@ export const request = {
}
return fullUrl;
},
/!*test*!/
};*/
export
const
request
=
{
post
(
url
,
data
)
{
//return axios.post(`${requestDomain}${url}`, data);
let
requestUrl
=
url
.
indexOf
(
'://'
)
>=
0
?
`
${
url
}
`
:
`
${
requestDomain
}${
url
}
`
return
axios
.
post
(
requestUrl
,
data
)
},
get
(
url
,
data
)
{
//return axios.get(`${requestDomain}${url}`, { params: data });
let
requestUrl
=
url
.
indexOf
(
'://'
)
>=
0
?
`
${
url
}
`
:
`
${
requestDomain
}${
url
}
`
return
axios
.
get
(
requestUrl
,
{
params
:
data
})
},
form
(
url
,
params
)
{
let
formData
=
new
FormData
()
//使用formData对象
for
(
let
key
in
params
)
{
formData
.
append
(
key
,
params
[
key
])
}
let
requestUrl
=
url
.
indexOf
(
'://'
)
>=
0
?
`
${
url
}
`
:
`
${
requestDomain
}${
url
}
`
return
axios
.
post
(
requestUrl
,
formData
,
formDataHeaders
)
},
build
(
url
,
params
)
{
let
fullUrl
=
`
${
requestDomain
}${
url
}
`
let
split
=
''
for
(
let
key
in
params
)
{
if
(
split
)
{
split
=
'&'
}
else
{
split
=
'?'
}
fullUrl
+=
split
+
key
+
'='
+
params
[
key
]
}
return
fullUrl
},
/*test*/
};
postTest
(
url
,
data
)
{
axios
({
// 用axios发送post请求
method
:
'post'
,
url
:
`
${
requestDomain
}${
url
}
`
,
// 请求地址
data
:
data
,
// 参数
responseType
:
'blob'
// 表明返回服务器返回的数据类型
}).
then
(
res
=>
{
// 处理返回的文件流
console
.
log
(
'请求头:'
,
res
.
headers
)
console
.
log
(
'res的数据:'
,
res
)
const
filename
=
res
.
headers
[
'content-disposition'
].
split
(
'='
)[
1
]
console
.
log
(
'文件名:'
,
filename
)
const
blob
=
new
Blob
([
res
.
data
],
{
type
:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
//new Blob([res])中不加data就会返回下图中[objece objece]内容(少取一层)
const
elink
=
document
.
createElement
(
'a'
)
elink
.
download
=
filename
elink
.
style
.
display
=
'none'
elink
.
href
=
URL
.
createObjectURL
(
blob
)
document
.
body
.
appendChild
(
elink
)
elink
.
click
()
document
.
body
.
removeChild
(
elink
)
URL
.
revokeObjectURL
(
elink
.
href
)
// 释放URL 对象
})
var
xhr
=
new
XMLHttpRequest
()
//xhr.open("POST", "https://ow.go.qudone.com/zlzmapi/admin/member/export/test", true);
xhr
.
open
(
'POST'
,
'http://127.0.0.1:8011/zlzmapi/admin/member/export/test'
,
true
)
xhr
.
setRequestHeader
(
'adminSessionId'
,
'a91986990ed049bebd0b4ab67d346229'
)
xhr
.
responseType
=
'blob'
xhr
.
onload
=
function
()
{
if
(
this
.
status
===
200
)
{
//var blob = new Blob([this.response], {type: 'application/vnd.ms-excel;charset=ISO8859-1'});
var
blob
=
new
Blob
([
this
.
response
],
{
type
:
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
console
.
log
(
'打印response:'
,
this
)
var
a
=
document
.
createElement
(
'a'
)
var
url
=
window
.
URL
.
createObjectURL
(
blob
)
a
.
href
=
url
document
.
body
.
appendChild
(
a
)
a
.
click
()
}
}
xhr
.
send
()
/* return axios.post(`${requestDomain}${url}`, data, formDataHeaders).then(res => {
let fileName = res.headers['Content-Disposition']
console.log('文件名:', fileName)
console.log('res的数据:', res)
console.log('res的data的数据:', res.data)
console.log('测试导出2')
//将文件流转成blob形式
const blob = new Blob([res.data], { type: 'application/vnd.ms-excel;charset=utf-8' })
console.log('blob的值:', blob)
const elink = document.createElement('a')
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // 释放URL 对象
document.body.removeChild(elink)
/!* let objectUrl = URL.createObjectURL(blob)
window.location.href = objectUrl
*!/
})*/
}
}
...
...
src/views/public/components/publicSaveDialog.vue
View file @
56eb845
...
...
@@ -42,7 +42,9 @@
</el-time-picker>
</el-form-item>
<el-form-item
label=
"地点:"
prop=
"city"
>
<el-row
:gutter=
"5"
>
<el-input
v-model=
"publicForm.city"
maxlength=
"100"
show-word-limit
></el-input>
<!--
<el-row
:gutter=
"5"
>
<el-col
:span=
"7"
>
<el-select
v-model=
"publicForm.province"
...
...
@@ -72,7 +74,7 @@
></el-option>
</el-select>
</el-col>
</el-row>
</el-row>
-->
</el-form-item>
<el-form-item
label=
"报名:"
prop=
"enroll"
>
<el-input
v-model=
"publicForm.enroll"
maxlength=
"200"
...
...
src/views/public/index.vue
View file @
56eb845
...
...
@@ -12,10 +12,7 @@
v-loading=
"loading"
>
<el-table-column
label=
"活动标题"
prop=
"title"
></el-table-column>
<el-table-column
label=
"地点"
prop=
"province"
>
<template
slot-scope=
"scope"
>
{{
scope
.
row
.
province
}}
-
{{
scope
.
row
.
city
}}
</
template
>
<el-table-column
label=
"地点"
prop=
"city"
>
</el-table-column>
<el-table-column
label=
"报名"
prop=
"enroll"
></el-table-column>
<el-table-column
label=
"开始时间"
>
...
...
sync.sh
0 → 100644
View file @
56eb845
# chmod u+x sync.sh
cp -R dist/
*
G:
\\
workspaceAll
\\
IdeaProjects
\\
wzhi
cd
G:
\\
workspaceAll
\\
IdeaProjects
\\
wzhi
read
-p
"请输入commit提交的描述: "
msg
if
[[
$msg
==
""
]]
;
then
msg
=
"默认提交"
fi
git add -A
git commit -m
$msg
git push
git status
Please
register
or
sign in
to post a comment