diff --git a/pages/invoiceDetail/index.js b/pages/invoiceDetail/index.js index 810279a..40963fc 100644 --- a/pages/invoiceDetail/index.js +++ b/pages/invoiceDetail/index.js @@ -1,6 +1,6 @@ // pages/invoiceInfo/index.js 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' const { OK } = request; Page({ @@ -47,6 +47,29 @@ Page({ alertInfo("暂无文档信息") 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({ url: data, success(res) { @@ -58,7 +81,7 @@ Page({ console.log('res.tempFilePath', res.tempFilePath, sheetRes.tapIndex) wx.openDocument({ filePath: res.tempFilePath, - fileType: [sheetRes.tapIndex === 0 ? 'xml' : "pdf"], // 3. 这个必须写合法类型,不然下载不了 !!! + // fileType: sheetRes.tapIndex === 0 ? 'xml' : "pdf", // 3. 这个必须写合法类型,不然下载不了 !!! success: function (res) { },