|
@@ -146,26 +146,24 @@ export default {
|
|
return newStr
|
|
return newStr
|
|
},
|
|
},
|
|
uploadImg(imgData) {
|
|
uploadImg(imgData) {
|
|
- // var bytes = window.atob(imgData.split(',')[1]);
|
|
|
|
- // var ab = new ArrayBuffer(bytes.length);
|
|
|
|
- // var ia = new Uint8Array(ab);
|
|
|
|
- // for(var i = 0; i < bytes.length; i++){
|
|
|
|
- // ia[i] = bytes.charCodeAt(i); //这里有点疑惑,ia是怎么改变ab的?注:①
|
|
|
|
- // }
|
|
|
|
- // var blob = new Blob([ab], {type: 'image/jpeg'});
|
|
|
|
- var fd = new FormData();
|
|
|
|
- fd.append('file', this.base64Url2Blob(imgData));
|
|
|
|
- fd.append('innerPublic',true);
|
|
|
|
|
|
+ // var fd = new FormData();
|
|
|
|
+ // fd.append('file', this.base64Url2Blob(imgData));
|
|
|
|
+ // fd.append('innerPublic',true);
|
|
const config = {
|
|
const config = {
|
|
headers: {
|
|
headers: {
|
|
- 'Content-Type': 'multipart/form-data'
|
|
|
|
|
|
+ // 'Content-Type': 'multipart/form-data'
|
|
|
|
+ 'Content-Type': 'multipart/json'
|
|
},
|
|
},
|
|
withCredentials: false
|
|
withCredentials: false
|
|
} // 添加请求头
|
|
} // 添加请求头
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
axios.post(
|
|
axios.post(
|
|
'//star.xiaojukeji.com/upload/img.node',
|
|
'//star.xiaojukeji.com/upload/img.node',
|
|
- fd,
|
|
|
|
|
|
+ // fd,
|
|
|
|
+ {
|
|
|
|
+ 'imgData': imgData,
|
|
|
|
+ 'innerPublic': true
|
|
|
|
+ },
|
|
config
|
|
config
|
|
).then(res => {
|
|
).then(res => {
|
|
console.log(res)
|
|
console.log(res)
|