Commit 41e1d80e by 胡悦

tijiao

1 parent 35a1c029
...@@ -76,6 +76,11 @@ ...@@ -76,6 +76,11 @@
>上传图片</gl-button> >上传图片</gl-button>
</gl-upload> </gl-upload>
<input type="file" id="id" name="image" class="getImgUrl_file" @change="shangc($event)" accept="image/jpg,image/jpeg,image/png"> <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> </span>
<gl-select <gl-select
v-else-if="i.name == 'merchantChannelName' && isEdit" v-else-if="i.name == 'merchantChannelName' && isEdit"
...@@ -628,14 +633,15 @@ export default { ...@@ -628,14 +633,15 @@ export default {
this.merchantInfo.merchantPortrait = '' this.merchantInfo.merchantPortrait = ''
}, },
shangc(e) { shangc(e) {
const _this = this // const _this = this
console.log(e) console.log(e)
const files = document.getElementById('id').files[0] const files = document.getElementById('id').files[0]
// const name = document.getElementById('id').files[0].name const name = document.getElementById('id').files[0].name
// const arr = name.split('.') const arr = name.split('.')
// this.fileInfo.name = arr[0] // this.fileInfo.name = arr[0]
// console.log(arr) // 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 let fileSize = 0
// const fileMaxSize = 10240 // 1M // const fileMaxSize = 10240 // 1M
if (files) { if (files) {
...@@ -660,20 +666,61 @@ export default { ...@@ -660,20 +666,61 @@ export default {
// let that = this // let that = this
reader.readAsDataURL(files) reader.readAsDataURL(files)
reader.onload = e => { reader.onload = e => {
console.log(e) // console.log(e)
// imgFile = e.target.result const imgFile = e.target.result
// const arrBase64 = imgFile.split(',') const arrBase64 = imgFile.split(',')
this.fileInfo.fileBase = e.target.result // this.fileInfo.fileBase = e.target.result
console.log(this.fileInfo.fileType) this.fileInfo.fileBase = arrBase64[1]
console.log(this.fileInfo.fileBase) // console.log(this.fileInfo.fileType)
axios.post('http://gfs.test.glsx.com.cn/file/upstring', { // console.log(this.fileInfo.fileBase)
systemSign: '/mechantData', const fileParams = this.fileInfo.fileType + '@' + this.fileInfo.fileBase
fileType: _this.fileInfo.fileType, const aa = {
uploadData: _this.fileInfo.fileBase systemSign: 'mechantData',
}, { files: fileParams
headers: { }
// 'Content-Type': 'application/json; charset=utf-8' 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' // requestType: 'jsonString'
}).then(res => { }).then(res => {
console.log(res) console.log(res)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!