Commit d0db5561 authored by caicaicai's avatar caicaicai

修改

parent e885549a
...@@ -6,6 +6,16 @@ var HttpReq = function(){ ...@@ -6,6 +6,16 @@ var HttpReq = function(){
return { return {
//卡车调度系统 //卡车调度系统
truckDispatching:{ truckDispatching:{
//图片上传
uploadPictures: function(data){
return request({
url: '/api/Area/updateAvatar',
method: 'POST',
data:data,
}).then((res) => {
return res
})
},
//系统管理——班次设置 //系统管理——班次设置
shiftQuery: function(param){ shiftQuery: function(param){
return request({ return request({
......
...@@ -262,23 +262,31 @@ export default { ...@@ -262,23 +262,31 @@ export default {
let file = event.target.files[0]; let file = event.target.files[0];
let formData1 = new FormData(); let formData1 = new FormData();
formData1.append("avatar", file); formData1.append("avatar", file);
Axios({ HttpReq.truckDispatching.uploadPictures(formData1).then((res) => {
url: process.env.VUE_APP_LOCAL_API2 + '/api/Area/updateAvatar', this.$notify({
method: "post", title: '上传成功!',
data: formData1, type: 'success',
}).then( duration: 2500
response => { });
if (response.status == 200) { that.picFileName = res.avatar;
this.$message.success("上传成功"); })
that.picFileName = response.data.avatar; // Axios({
} else { // url: process.env.VUE_APP_LOCAL_API2 + '/api/users/updateAvatar',
this.$message.error("上传失败"); // method: "post",
} // data: formData1,
}, // }).then(
) // response => {
.catch(error => { // if (response.status == 200) {
console.log(error); // this.$message.success("上传成功");
}); // that.picFileName = response.data.avatar;
// } else {
// this.$message.error("上传失败");
// }
// },
// )
// .catch(error => {
// console.log(error);
// });
}, },
} }
} }
......
...@@ -480,23 +480,14 @@ export default { ...@@ -480,23 +480,14 @@ export default {
let file = event.target.files[0]; let file = event.target.files[0];
let formData1 = new FormData(); let formData1 = new FormData();
formData1.append("avatar", file); formData1.append("avatar", file);
Axios({ HttpReq.truckDispatching.uploadPictures(formData1).then((res) => {
url: process.env.VUE_APP_LOCAL_API2 + '/api/Area/updateAvatar', this.$notify({
method: "post", title: '上传成功!',
data: formData1, type: 'success',
}).then( duration: 2500
response => { });
if (response.status == 200) { that.picFileName = res.avatar;
this.$message.success("上传成功"); })
that.picFileName = response.data.avatar;
} else {
this.$message.error("上传失败");
}
},
)
.catch(error => {
console.log(error);
});
}, },
......
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