wx.chooseImage与wx.getFileSystemManager
发布于 5 年前 作者 msong 14989 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

通过chooseImage,调用相机拍照后,通过getFileSystemManager.readFile读取之前拍摄的图片base64数据,图片会保存在用户本地

  • 预期表现

图片不保存到用户本地

  • 复现路径
uploadImg: function(flg) {
        var that = this
        that.loadingShow()
        wx.chooseImage({
            count: 1, 
            sizeType: ['compressed'],
            sourceType: ['camera'], 
            success: function(res) {
                // let path = res.tempFilePaths
                wx.saveFile({
                    tempFilePath: res.tempFilePaths[0],
                    success: function (res) {
                        let path = res.savedFilePath
                        wx.getFileSystemManager().readFile({
                            filePath: path, 
                            encoding: 'base64'
                            success: res => {                                         
                                console.log(res)
                            }
                        })
                    }
                })
                 
            },
            fail: function(res) {
                console.log('接口异常');
                that.connectErrorReturn('操作取消或者相机打开异常');
                return;
            }
        })
    },
  • 提供一个最简复现 Demo
1 回复

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部