收藏
回答

wx.downloadFile下载的文件保存到微信聊天记录,选择保存到企业微信,显示0K?

wx.downloadFile下载的文件保存到微信聊天记录,选择保存到企业微信,显示0K?怎么解决,直接保存到微信聊天记录又可以,但是保存到企业微信会显示0K

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

2 个回答

  • 社区技术运营专员--阳光
    社区技术运营专员--阳光
    02-20

    请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

    02-20
    有用
    回复 2
    • 27
      27
      02-20
      request('/app-api/document/salesman/downloadExcel', {
           method: 'POST',
           data
          })
          .then((response) => {
           uni.hideLoading();
           if(response.data.code == 0){
            that.orderData.pdfurl = response.data.data.path
            that.orderData.pdfname = response.data.data.name
            console.log(response.data.data.path)
            that.showpdfurl = true
            uni.downloadFile({
              url: response.data.data.path, // PDF文件的URL
              success: function (res) {
             if (res.statusCode === 200) {
              that.show = false
              if (process.env.UNI_PLATFORM === 'h5') {
                  // 在 H5 平台的代码
               uni.showToast({
                title: '下载成功',
                icon: 'none',
                duration: 2000
               });
               window.open(res.tempFilePath);
              }else{
               uni.shareFileMessage({
                filePath: res.tempFilePath,
                fileName: response.data.data.name,
                success: () => {
                 console.log(err, '转发文件成功');
                },
                fail: (err) => {
                 console.log(err, '转发文件失败');
                }
               });
              }
             } else {
              console.error('PDF文件下载失败');
             uni.showToast({
              title: '下载失败',
              icon: 'none',
              duration: 2000
             });
             }
              },
              fail: function (err) {
             console.error('下载失败:' + JSON.stringify(err));
             uni.showToast({
              title: '下载失败',
              icon: 'none',
              duration: 2000
             });
              }
            });
           }else{
            uni.showToast({
                title: response.data.msg,
                icon: 'none',
                duration: 2000
            });
           }
          })
      02-20
      回复
    • 27
      27
      02-20
      02-20
      回复
  • 智能回答 智能回答 该问答由AI生成
    02-19
    有用
登录 后发表内容