1***@qq.com
1***@qq.com
  • 发布:2020-02-08 17:52
  • 更新:2020-02-08 17:52
  • 阅读:626

chooseAlbum在安卓app端获取的图片路径是不存在的

分类:HBuilderX

chooseAlbum() {
var that = this;
let imgArr = [];
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择、摄像头
success: function(res) {
uni.showLoading({
title: '上传中'
})
console.log('在这',JSON.stringify(res.tempFilePaths));

                    let path = JSON.stringify(res.tempFilePaths);  

                    pathToBase64(path)  
                      .then(base64 => {  
                        console.log(base64)  
                      })  
                      .catch(error => {  
                        console.error(error)  
                      })  
                    for (let i in res.tempFilePaths) {  
                        imgArr = res.tempFilePaths[i];  
                    }  
                    that.photo_list = imgArr;  
                    let url = that.photo_list;  
                    uni.showModal({  
                        content: '调取成功上传前url:' + url,  
                        showCancel: false  
                    });  
                    that.urlTobase64(url);  
                    uni.hideLoading();  
                },  
                fail: function(res) {  
                    uni.showModal({  
                        content: '调取失败',  
                        showCancel: false  
                    });  
                }  
            });  
        },  

总是报错{"code":12,"message":"路径不存在"} at pages\merchantsSettled\merchantsSettled.vue:360

2020-02-08 17:52 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复