收藏
回答

wx.chooseImage调用无效?

真机iphone6sp远程调试,能打开相册,选取图片后无反应,成功和失败的回调函数都有日志 但是都没打印出来。确认过微信有图片读取和写入权限。开发者工具能正常使用。

upImage: function () {
    const that = this
    wx.chooseImage({
        count: 1, // 默认9
        sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
        sourceType: ['album'], // 可以指定来源是相册还是相机,默认二者都有
        success: function (res) {
            console.log(res)
            // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
            const tempFilePaths = res.tempFilePaths;
            that.setData({
                img: tempFilePaths[0]
            })
            // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
            var nowTime = util.formatTime(new Date());

            //支持多图上传
            for (var i = 0; i < res.tempFilePaths.length; i++) {
                //显示消息提示框
                wx.showLoading({
                    title: '上传中' + (i + 1) + '/' + res.tempFilePaths.length,
                    mask: true
                })

                //上传图片
                //你的域名下的/img文件下的/当前年月日文件下的/图片.png
                //图片路径可自行修改
                uploadImage(res.tempFilePaths[i], 'img/' + nowTime + '/',
                    function (result) {
                        that.setData({
                            "taskitme.wepic": result
                        })
                        wx.hideLoading();
                        console.log(that.data.taskitme)

                    }, function (result) {
                        wx.hideLoading()
                        console.log(result)
                    }
                )
            }


        },fail(res) {
            console.log(res)
        }
    })
},


回答关注问题邀请回答
收藏

2 个回答

  • 灵芝
    灵芝
    2020-02-19

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

    2020-02-19
    有用
    回复 3
    • Patient゜
      Patient゜
      2020-02-20
      你除了这句还会什么   必现的问题  还提供啥
      2020-02-20
      2
      回复
    • 灵芝
      灵芝
      2020-02-20回复Patient゜
      我这边未复现
      2020-02-20
      回复
    • Patient゜
      Patient゜
      2021-03-11回复灵芝
      你试试为缓存到本地的iloud照片试试
      2021-03-11
      回复
  • Patient゜
    Patient゜
    2020-02-19

    补充 又测试了一下 新照片有效 老照片无效

    2020-02-19
    有用
    回复
登录 后发表内容
问题标签