Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
glsx-oss-merchant-data
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 41e1d80e
authored
Jun 28, 2019
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
tijiao
1 parent
35a1c029
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
18 deletions
src/views/customer/businessDetails/index.vue
src/views/customer/businessDetails/index.vue
View file @
41e1d80
...
...
@@ -76,6 +76,11 @@
>
上传图片
</gl-button>
</gl-upload>
<input
type=
"file"
id=
"id"
name=
"image"
class=
"getImgUrl_file"
@
change=
"shangc($event)"
accept=
"image/jpg,image/jpeg,image/png"
>
<form
method=
"post"
action=
"http://gfs.test.glsx.com.cn/file/upstring"
>
<input
type=
"systemSign"
name=
""
/>
<br/><br/>
<input
type=
"files"
name=
""
/>
</form>
</span>
<gl-select
v-else-if=
"i.name == 'merchantChannelName' && isEdit"
...
...
@@ -628,14 +633,15 @@ export default {
this
.
merchantInfo
.
merchantPortrait
=
''
},
shangc
(
e
)
{
const
_this
=
this
//
const _this = this
console
.
log
(
e
)
const
files
=
document
.
getElementById
(
'id'
).
files
[
0
]
//
const name = document.getElementById('id').files[0].name
//
const arr = name.split('.')
const
name
=
document
.
getElementById
(
'id'
).
files
[
0
].
name
const
arr
=
name
.
split
(
'.'
)
// this.fileInfo.name = arr[0]
// console.log(arr)
this
.
fileInfo
.
fileType
=
document
.
getElementById
(
'id'
).
files
[
0
].
name
// this.fileInfo.fileType = document.getElementById('id').files[0].name
this
.
fileInfo
.
fileType
=
arr
[
1
]
let
fileSize
=
0
// const fileMaxSize = 10240 // 1M
if
(
files
)
{
...
...
@@ -660,20 +666,61 @@ export default {
// let that = this
reader
.
readAsDataURL
(
files
)
reader
.
onload
=
e
=>
{
console
.
log
(
e
)
// imgFile = e.target.result
// const arrBase64 = imgFile.split(',')
this
.
fileInfo
.
fileBase
=
e
.
target
.
result
console
.
log
(
this
.
fileInfo
.
fileType
)
console
.
log
(
this
.
fileInfo
.
fileBase
)
axios
.
post
(
'http://gfs.test.glsx.com.cn/file/upstring'
,
{
systemSign
:
'/mechantData'
,
fileType
:
_this
.
fileInfo
.
fileType
,
uploadData
:
_this
.
fileInfo
.
fileBase
},
{
headers
:
{
// 'Content-Type': 'application/json; charset=utf-8'
}
// console.log(e)
const
imgFile
=
e
.
target
.
result
const
arrBase64
=
imgFile
.
split
(
','
)
// this.fileInfo.fileBase = e.target.result
this
.
fileInfo
.
fileBase
=
arrBase64
[
1
]
// console.log(this.fileInfo.fileType)
// console.log(this.fileInfo.fileBase)
const
fileParams
=
this
.
fileInfo
.
fileType
+
'@'
+
this
.
fileInfo
.
fileBase
const
aa
=
{
systemSign
:
'mechantData'
,
files
:
fileParams
}
const
fileTemp
=
JSON
.
stringify
(
aa
)
console
.
log
(
fileTemp
)
// axios({
// method: 'post',
// headers: {
// 'Content-Type': 'application/json'
// },
// transformRequest: [function(data) {
// console.log('---------')
// data = JSON.stringify(data)
// return data
// }],
// url: 'http://gfs.test.glsx.com.cn/file/upstring',
// params: {},
// data: {
// 'systemSign': 'mechantData',
// 'files': fileParams
// }
// })
// axios.post('http://gfs.test.glsx.com.cn/file/upstring', { fileTemp },
// {
// headers: {
// 'content-type': 'application/x-www-form-urlencoded'
// }
// // requestType: 'jsonString'
// }).then(res => {
// console.log(res)
// }).catch(err => {
// console.log(err)
// })
axios
({
method
:
'post'
,
url
:
'http://gfs.test.glsx.com.cn/file/upstring'
,
data
:
aa
,
// headers: {
// 'content-type': 'application/x-www-form-urlencoded'
// },
transformRequest
:
[
function
(
data
)
{
console
.
log
(
data
)
data
=
JSON
.
stringify
(
data
)
console
.
log
(
data
)
return
data
}]
// requestType: 'jsonString'
}).
then
(
res
=>
{
console
.
log
(
res
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment