收藏
回答

wx.openDocument在ios系统和安卓系统下载打开的文件类型不一样?

代码:

wx.downloadFile({

url: this.data.filePath,

success: function (res) {

console.log(res.tempFilePath)

wx.openDocument({

filePath: res.tempFilePath,

showMenu: true,

success: function (res) {

wx.showToast({

title: '下载成功!',

})

},

fail: function (res) {

}

})

}

})


后台上传了一个pdf文件,在iOS系统打开正常,转发给好友也是PDF格式,可是换了安卓系统测试后,打开之后变成了tmp文件格式,且转发也变成了tmp,微信不支持打开此类文件。跪求解决方法

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

2 个回答

  • 颩欥膤
    颩欥膤
    2020-11-20

    请问这个问题修复了吗?我这也是安卓上下载成功、打开也成功,在IOS上下载成功,但是打开失败:不支持的filetype。

    2020-11-20
    有用
    回复 4
    • 颩欥膤
      颩欥膤
      2020-11-21
      doc 格式     
      docx 格式     
      xls 格式     
      xlsx 格式     
      ppt 格式     
      pptx 格式     

      pdf 格式    

      以上这些格式,在ios上能正常打开,txt、jpg格式的再iOS上下载成功,但是打开失败。
      2020-11-21
      回复
    • Cjiang
      Cjiang
      2020-11-23回复颩欥膤
      这个api打开的是文档。
      2020-11-23
      回复
    • Cjiang
      Cjiang
      2020-11-23回复颩欥膤
      2020-11-23
      回复
    •  
       
      2021-12-14回复颩欥膤
      ios能打开doc?
      2021-12-14
      回复
  • Cjiang
    Cjiang
    2020-10-20

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

    2020-10-20
    有用
    回复 11
    • Foll to her꧂
      Foll to her꧂
      2020-10-22
      华为荣耀9 版本号 7.0.19 调试库2.13.1   
      wx.downloadFile({
              url: this.data.filePath,
              success: function (res) {
                console.log(res.tempFilePath)
                const tempFilePath = res.tempFilePath;
                wx.openDocument({
                  filePath: res.tempFilePath,
                  showMenu: true,
                  success: function (res) {
                    wx.showToast({
                      title: '下载成功!',
                    })
                  },
                  fail: function (res) {
                  }
                })
              }
            })
      2020-10-22
      回复
    • Cjiang
      Cjiang
      2020-10-22回复Foll to her꧂
      按上面链接操作提供能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
      2020-10-22
      回复
    • Foll to her꧂
      Foll to her꧂
      2020-10-22回复Cjiang
      https://developers.weixin.qq.com/s/zOQyIhmY7Kls     麻烦你给指导一下
      2020-10-22
      1
      回复
    • Foll to her꧂
      Foll to her꧂
      2020-10-23回复Cjiang
      你好 看了吗
      2020-10-23
      回复
    • Cjiang
      Cjiang
      2020-10-24回复Foll to her꧂
      你好,可以加上以下截图的路径试试。图1:wx.downloadFile的一个属性,并使用:文件系统中的用户目录路径


      参考文档:https://developers.weixin.qq.com/miniprogram/dev/reference/api/wx.env.html
      修改的代码具体参考图2.
      2020-10-24
      2
      回复
    查看更多(6)
登录 后发表内容
问题标签