修改xml不能下载的问题
This commit is contained in:
parent
5c971ef2e8
commit
b4438b4638
|
@ -1,6 +1,6 @@
|
||||||
// pages/invoiceInfo/index.js
|
// pages/invoiceInfo/index.js
|
||||||
import { getInvoiceInfoDetail, downloadInvoice } from "../../service/invoice";
|
import { getInvoiceInfoDetail, downloadInvoice } from "../../service/invoice";
|
||||||
import { alertError, alertInfo, loadingFunc } from "../../utils/index";
|
import { alertError, alertInfo, alertSuccess, loadingFunc } from "../../utils/index";
|
||||||
import request from '../../utils/request'
|
import request from '../../utils/request'
|
||||||
const { OK } = request;
|
const { OK } = request;
|
||||||
Page({
|
Page({
|
||||||
|
@ -47,6 +47,29 @@ Page({
|
||||||
alertInfo("暂无文档信息")
|
alertInfo("暂无文档信息")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (sheetRes.tapIndex === 0) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '暂不支持xml格式预览,请复制链接后打开浏览器下载',
|
||||||
|
confirmText: '复制链接',
|
||||||
|
showCancel: true,
|
||||||
|
complete: (res) => {
|
||||||
|
if (res.cancel) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.confirm) {
|
||||||
|
wx.setClipboardData({
|
||||||
|
data,
|
||||||
|
success: () => {
|
||||||
|
alertSuccess("复制成功")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
wx.downloadFile({
|
wx.downloadFile({
|
||||||
url: data,
|
url: data,
|
||||||
success(res) {
|
success(res) {
|
||||||
|
@ -58,7 +81,7 @@ Page({
|
||||||
console.log('res.tempFilePath', res.tempFilePath, sheetRes.tapIndex)
|
console.log('res.tempFilePath', res.tempFilePath, sheetRes.tapIndex)
|
||||||
wx.openDocument({
|
wx.openDocument({
|
||||||
filePath: res.tempFilePath,
|
filePath: res.tempFilePath,
|
||||||
fileType: [sheetRes.tapIndex === 0 ? 'xml' : "pdf"], // 3. 这个必须写合法类型,不然下载不了 !!!
|
// fileType: sheetRes.tapIndex === 0 ? 'xml' : "pdf", // 3. 这个必须写合法类型,不然下载不了 !!!
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user