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

很多网站没有后台新闻稿营销

很多网站没有后台,新闻稿营销,写作网站,手游官网首页1.微信小程序 预览pdf 或者 图片等 //utils.js 文件//通过接口返回文件链接 打开文档 export default function previewFile({ downLinkUrl, tempFilePath }) {let url "https://" downLinkUrl.replace("http://", "").replace("https:…

1.微信小程序 预览pdf 或者 图片等 

//utils.js  文件//通过接口返回文件链接 打开文档
export default function previewFile({ downLinkUrl, tempFilePath }) {let url = "https://" + downLinkUrl.replace("http://", "").replace("https://", "");return new Promise((resolve, reject) => {wx.downloadFile({url: url,success(res) {//保存到本地wx.saveFile({tempFilePath: res.tempFilePath,success(res) {const savedFilePath = res.savedFilePath;// 打开文件wx.openDocument({filePath: savedFilePath,showMenu: true,success(res) {resolve({ code: 200, msg: "打开文档成功", data: { savedFilePath } });},fail(err) {reject({ code: 500, msg: "打开文件失败", data: err });}});},fail(err) {reject({ code: 500, msg: "保存文件失败", data: err });}});},fail(err) {reject({ code: 500, msg: "下载文件失败", data: err });}});});
}
 //预览       previewFile(item) {//图片类型const isImageType = [".png", ".jpe", ".jpeg", ".jpg", ".gif"];const fileSuffix = item.fileName.substring(item.fileName.lastIndexOf("."));//如果是图片if (isImageType.includes(fileSuffix)) {wx.previewImage({showmenu: true,urls: [item.downLinkUrl], // 需要预览的图片 http 链接列表success() {console.log("打开图片成功");},fail(err) {console.log(err);uni.$u.toast("打开图片失败");}});} else {uni.showLoading();//如果有临时文件路径if (item.tempFilePath) {// 打开文件wx.openDocument({filePath: item.tempFilePath,showMenu: true,success(res) {uni.$u.toast("打开文档成功");},fail(err) {uni.$u.toast("预览失败请稍后重试");}});} else {previewFile(item).then(res => {let { savedFilePath } = res.data;item.tempFilePath = savedFilePath;uni.$u.toast(res.msg);}).catch(err => {uni.$u.toast(err.msg);}).finally(() => {// uni.hideLoading();});}}},//判断是否显示预览按钮isPreviewFileType(fileName) {const fileSuffix = fileName.substring(fileName.lastIndexOf("."));const isPreviewFileType = [".png",".jpe",".jpeg",".jpg",".gif",".pdf",".PDF",".doc",".docx",".dot",".xlc",".xlm",".xls",".xlt",".xlw",".xlsx"];if (isPreviewFileType.includes(fileSuffix)) {return true;} else {return false;}}

文件下载

        downLoadFile(item) {if (item.downLoading) return;item.downLoading = true;const linkUrl = item.downLinkUrl.replace(/^http:\/\//, "https://");uni.downloadFile({url: linkUrl,success: res => {item.downTempFilePath = res.tempFilePath;this.onExport(item);},fail: err => {console.log("err----", err);this.$u.toast("下载失败,请检查您的网络");},complete: function() {setTimeout(() => {item.downLoading = false;}, 0);}});},

 2.浏览器预览

export function previewHandle(params) {//新开页面-预览文件let url = params.downLinkUrl,fileName = params.fileName;const fileSuffix = fileName.substring(fileName.lastIndexOf("."));if (isPreviewFileType.includes(fileSuffix)) {const previewUrl = `http://dcsapi.com/?k=57170800621178060806081&url=${encodeURIComponent(url)}&watermark=千里马招标网`;window.open(previewUrl);} else {alert("该文件暂不支持预览~");}
}

http://www.ds6.com.cn/news/111102.html

相关文章:

  • 为什么招聘网站做不大网站怎么做的
  • 怎么查询公司网站备案广州百度seo
  • 淮南医院网站建设qq推广软件
  • 网站建设 企业网站 框架网站建设的数字化和互联网化
  • 网站的建设维护宝鸡seo
  • lao3d wordpress 插件优化网站建设seo
  • 网站设计排行榜前十优化防控措施
  • 网站开发公司制作平台网上国网app推广方案
  • 网站如何做seo优化优化疫情防控
  • 网站建设怎么寻找客户最近中国新闻热点大事件
  • 临沂谁会做网站在百度怎么发广告做宣传
  • 有哪些做西点及烘焙的网站企业网站关键词优化
  • 医院网站制作优化排名推广教程网站
  • 淄博微信网站制作企业推广软件
  • 网站建设的基本流程是什么热狗网站排名优化外包
  • smartos wordpress快速提高网站关键词排名优化
  • 如何做网站免费教程广东省新闻
  • 淘宝网站制作建设是真的吗合肥今日头条最新消息
  • 南阳网站推广效果seo的作用有哪些
  • 做外贸网站费用百度免费广告发布平台
  • 干部网络培训平台苏州网站优化排名推广
  • dedecms网站乱码专业seo站长工具
  • 做网站都需要哪些技术2022黄页全国各行业
  • 山西做网站的企业百度推广代理公司
  • 公司网站做地图地址怎么发帖子做推广
  • 免费源码资源源码站go郑州seo顾问阿亮
  • 传媒公司取名字大全比较好的网络优化公司
  • 网站备案号在哪里查询营销网站建设创意
  • 企业网站空间网页模板怎么用
  • 网站获取访客百度一下官网首页