当前位置: 首页 > news >正文

微信小程序上传pdf和显示

引用:https://blog.csdn.net/qq_54027065/article/details/129854339

     loadResume(){let that = thisuni.showLoading({title:"下载中"})wx.downloadFile({url:url,success:(res)=>{console.log(res,"res11111")if (res.statusCode === 200){setTimeout(()=>{wx.openDocument({filePath: res.tempFilePath,fileType:"pdf"})// toast("加载成功")uni.hideLoading()},1000)}else{toast("文件不存在或者服务器报错")setTimeout(()=>{uni.hideLoading()},1000)}},error:()=>{uni.hideLoading()},finally:()=>{// uni.hideLoading()}})},uploadResume(){console.log("upload resume")wx.chooseMessageFile({count:1,type:"file",success:(res)=>{console.log(res,"res11")let path = res.tempFiles[0].pathconsole.log(path,"path")var suffix = path.split(".")[1];if (suffix !== "pdf"){toast("只能上传pdf的文件")return}uni.showLoading({title:"上传中",mask:true})wx.uploadFile({url:url,header:{"Authorization":getToken()},name:"file",filePath:path,success:(res)=>{console.log(res,"hehe123")if (res.statusCode === 200){this.form.reviewInfo.resumeUrl = res.datatoast("上传成功")}else{toast("上传失败")}setTimeout(()=>{uni.hideLoading()},2000)},fail:(res)=>{toast("上传失败")setTimeout(()=>{uni.hideLoading()},2000)}})}})},
http://www.lryc.cn/news/485313.html

相关文章:

  • MongoDB分布式集群搭建----副本集----PSS/PSA
  • PDF编辑的好东西
  • 块设备的两种访问方法的区别
  • java 泛型中的 ?
  • 如何在jupyter notebook切换python环境
  • 用Python将Word文档转换为Markdown格式
  • CSV 文件
  • SpringCloud核心组件(五)
  • TCP为什么需要三次握手和四次挥手,有哪些需要注意的地方?
  • 机器学习(基础2)
  • Cpolar 内网穿透使用
  • ThreadLocal 提供线程局部变量
  • MongoDB聚合管道数组操作
  • 大数据如何助力干部选拔的公正性
  • Python_爬虫2_爬虫引发的问题
  • shell编程之编程基础
  • 24.11.15 Vue3
  • 图形几何之美系列:法向量计算之轮廓有向面积辅助法
  • CPU的性能指标总结(学习笔记)
  • Cadence安装
  • 【网络】子网掩码
  • Android Osmdroid + 天地图 (二)
  • 使用大语言模型创建 Graph 数据
  • Java poi 模板导出Word 带图片
  • SpringCloud-使用FFmpeg对视频压缩处理
  • shell bash---类似数组类型
  • IIoT(Industrial Internet of Things,工业物联网)
  • 【C++】引用(reference)
  • 学习日记_20241115_聚类方法(层次聚类)
  • 安卓开发怎么获取返回上一级activity事件