|
@@ -141,25 +141,27 @@ export default {
|
|
|
return newStr
|
|
|
},
|
|
|
uploadImg(imgData) {
|
|
|
- const HTTP = axios.create({
|
|
|
- baseURL: '/apis', // 这是基础url
|
|
|
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
|
- transformRequest: [(data) => {
|
|
|
- // Do whatever you want to transform the data
|
|
|
- let ret = ''
|
|
|
- for (const it in data) {
|
|
|
- ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
|
|
|
- }
|
|
|
- return ret
|
|
|
- }]
|
|
|
- })
|
|
|
- HTTP.post('//star.xiaojukeji.com/upload/img.node', {
|
|
|
- 'imgData': imgData,
|
|
|
- 'innerPublic': true
|
|
|
- }).then((res) => {
|
|
|
- console.log('res', res)
|
|
|
- console.log('res.url', res.url)
|
|
|
- return res.url
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ const HTTP = axios.create({
|
|
|
+ baseURL: '/apis', // 这是基础url
|
|
|
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
|
+ transformRequest: [(data) => {
|
|
|
+ // Do whatever you want to transform the data
|
|
|
+ let ret = ''
|
|
|
+ for (const it in data) {
|
|
|
+ ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
|
|
|
+ }
|
|
|
+ return ret
|
|
|
+ }]
|
|
|
+ })
|
|
|
+ HTTP.post('//star.xiaojukeji.com/upload/img.node', {
|
|
|
+ 'imgData': imgData,
|
|
|
+ 'innerPublic': true
|
|
|
+ }).then((res) => {
|
|
|
+ console.log('res', res)
|
|
|
+ console.log('res.url', res.url)
|
|
|
+ resolve(res.url)
|
|
|
+ })
|
|
|
})
|
|
|
// return new Promise((resolve, reject) => {
|
|
|
// axios.post(
|