This commit is contained in:
Gdpao
2020-09-21 15:03:27 +08:00
parent 2f1b89c6a6
commit e2e5cf8b42
4 changed files with 16 additions and 7 deletions

View File

@@ -61,7 +61,6 @@ export default {
},
onLoad() {
this.getCache();
console.log(222);
},
onShow() {
this.getmyinfo()

View File

@@ -87,7 +87,13 @@ export default {
},
// 获取图片,上传图片
chooseImage(sourceType) {
let that = this
let that = this;
let photo_type = "";
if (this.role == 2) {
photo_type = "store_avatar"
} else {
photo_type = "avatar"
}
const token = uni.getStorageSync('token');
uni.chooseImage({
count: 1,
@@ -98,9 +104,10 @@ export default {
uni.uploadFile({
url: 'https://mall.dmygkeji.com/storeapi/Upload/uploadFile',
filePath: tempFilePaths[0],
name: 'avatar',
name: photo_type,
formData:{
name:"avatar"
name: photo_type,
store_id: that.info.store_id
},
header:{
Authorization:'Bearer' + " " + token
@@ -111,7 +118,10 @@ export default {
that.filename = obj.data.file_name
that.num++
console.log(that.fileurl,that.filename)
}
},
fail: (res) => {
console.log(res);
}
});
}
});