2***@qq.com
2***@qq.com
  • 发布:2024-04-23 14:52
  • 更新:2024-04-23 14:52
  • 阅读:117

uni.chooseImage, 部分安卓手机机型无法二次调起相机。没有报错,没有提示,第二次点击没有反应

分类:HBuilderX
selectImage: function(type) {  
            var vm = this  
            uni.chooseImage({  
                sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有  
                sourceType: ['camera', 'album'], //从相册选择  
                success: (e) => {  
                    let list = []  
                    uni.showLoading({  
                        title: "正在上传..."  
                    })  
                    let imagePathArr = e.tempFilePaths  
                    let keyname = (this.fileKeyName ? this.fileKeyName : 'file');  
                    for (let i = 0; i < imagePathArr.length; i++) {  
                        let params = {  
                            filePath: imagePathArr[i],  
                            name: keyname,  
                        }  
                        uploadFile({  
                            ...params  
                        }).then((path) => {  
                            if (!path) return;  
                            if (type === 'wateringSystem') {  
                                this.valiFormData.wxWateringSystem.push(imagePathArr[i]);  
                                this.valiFormData.wateringSystemPath = [...this.valiFormData  
                                    .wateringSystemPath, path  
                                ]  
                            } else if (type === 'instrumentPanel') {  
                                this.valiFormData.wxInstrumentPanel.push(imagePathArr[i]);  
                                this.valiFormData.instrumentPanelPath = [...this.valiFormData  
                                    .instrumentPanelPath, path  
                                ]  
                            } else if (type === 'carLights') {  
                                this.valiFormData.wxCarLights.push(imagePathArr[i]);  
                                this.valiFormData.carLightsPath = [...this.valiFormData  
                                    .carLightsPath, path  
                                ]  
                            } else if (type === 'tyre') {  
                                this.valiFormData.wxtyre.push(imagePathArr[i]);  
                                this.valiFormData.tyrePath = [...this.valiFormData.tyrePath,  
                                    path  
                                ]  
                            }  

                            uni.hideLoading();  
                        })  
                    }  

                }  
            })  
        },
2024-04-23 14:52 负责人:无 分享
已邀请:

要回复问题请先登录注册