Commit 896752f3 by cuishuai

Merge branch 'develop' of gitlab.beecode.cn:sandofsuro/sedu-mobile-v2 into develop

parents 38a9c533 453185c5
...@@ -128,20 +128,16 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue" ...@@ -128,20 +128,16 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
}, },
uploadPic(imgPath){ uploadPic(imgPath){
var currentTime = new Date().getTime(); var currentTime = new Date().getTime();
var formData = new FormData();
let file = {uri: imgPath, type: 'application/octet-stream', name: currentTime+'.jpg'};
formData.append("file", file);
var user = {}; var user = {};
user.id = this.GLOBALUTIL.user.userid; user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username); user.name = encodeURI(this.GLOBALUTIL.user.username);
console.log(formData) uni.uploadFile({
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/file/image', url: this.GLOBALUTIL.url+'/safety/v1/file/image',
method: 'POST', files:[{uri: imgPath[0],name: currentTime+'.jpg'}],
body:formData, filePath:"",
name:"",
header: { header: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'multipart/form-data',
'user' : JSON.stringify(user) 'user' : JSON.stringify(user)
}, },
success: (res) => { success: (res) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment