lookDetails: function (e) {
commom.commom.sendFormId(e.detail.formId);
let ext = e.detail.target.dataset.ext;
if (wx.getStorageSync(‘filePath‘)){
let fileMgr = wx.getFileSystemManager();
let oldType = wx.getStorageSync("fileType");
fileMgr.unlink({
filePath: wx.env.USER_DATA_PATH + ‘/file.‘ + ext,
success: function (r) {
console.log(‘remove save file. success.‘, r);
},
fail: function (r) {
console.log(‘remove save file.‘, r);
}
});
}
if (ext != ‘png‘ && ext != ‘jpg‘) {
wx.downloadFile({
url: e.detail.target.dataset.url,
header: {
"content-type": ‘application/‘ + ext
},
filePath: wx.env.USER_DATA_PATH + ‘/file.‘ + ext,
success(res) {
const filePath = wx.env.USER_DATA_PATH + ‘/file.‘ + ext
wx.openDocument({
filePath,
success(res) {
console.log(‘打开文档成功‘);
wx.setStorageSync(‘filePath‘, wx.env.USER_DATA_PATH + ‘/file.‘ + ext)
},
fail(res) {
commom.commom.noIconToast(‘证书打开失败,请发送到邮件查看‘)
}
})
},
complete: function (err) {
console.log(err)
}
})
} else {
wx.previewImage({
urls: [e.detail.target.dataset.url] // 需要预览的图片http链接列表
})
}
},