| | |
| | | count: 1, |
| | | sourceType: ['camera'], |
| | | success: (data) => { |
| | | this.pathToBase64(data.tempFilePaths[0]) |
| | | this.upload(data.tempFilePaths[0]) |
| | | // this.pathToBase64(data.tempFilePaths[0]) |
| | | } |
| | | }) |
| | | }, |
| | |
| | | count: 1, |
| | | sourceType: ['album'], |
| | | success: (data) => { |
| | | this.pathToBase64(data.tempFilePaths[0]) |
| | | this.upload(data.tempFilePaths[0]) |
| | | // this.pathToBase64(data.tempFilePaths[0]) |
| | | } |
| | | }) |
| | | }, |
| | |
| | | //#endif |
| | | }, |
| | | upload(file){ |
| | | httpUtils.request('/api/common/uploadPhotoBase64', { |
| | | base64: 'data:image/jpeg;base64,'+ file |
| | | }, 'POST').then((res) => { |
| | | if(res.status == 200){ |
| | | this.callback && this.callback(res.mapInfo.file) |
| | | }else{ |
| | | toast.info(res.info) |
| | | // httpUtils.request('/api/common/uploadPhotoBase64', { |
| | | // base64: file |
| | | // }, 'POST').then((res) => { |
| | | // console.log(res) |
| | | // if(res.status == 200){ |
| | | // this.callback && this.callback(res.mapInfo.file) |
| | | // }else{ |
| | | // toast.info(res.info) |
| | | // } |
| | | // }) |
| | | uni.uploadFile({ |
| | | url: httpUtils.baseUrl+'/api/common/uploadImg', |
| | | filePath: file, |
| | | name: 'file', |
| | | success: (res) => { |
| | | let result = JSON.parse(res.data); |
| | | if(result.status == 200){ |
| | | this.callback && this.callback(result.mapInfo.file) |
| | | }else{ |
| | | toast.info(result.info) |
| | | } |
| | | } |
| | | }) |
| | | } |