//导出
export function daoChu(path) {
console.log(path,'this.$baseUrl');
uni.showLoading({
title: 'Loading'
});
uni.downloadFile({
url:path ,
success: (res) => {
console.log("res: ", res);
if (res.statusCode === 200) {
var temp = res.tempFilePath
uni.saveFile({
tempFilePath: temp,
success: (ret) => {
var savedFilePath = ret.savedFilePath;
setTimeout(() => {
uni.openDocument({
filePath: savedFilePath,
fileType: 'pdf',//仅打开pdf格式的文件
showMenu: true,
success: function(file) {
console.log('打开文档成功');
}
});
uni.hideLoading()
}, 1000)
}
})
} else {
uni.showModal({
title: '提示:',
content: '打开成功',
showCancel: false,
cancelText: '取消',
cancelColor: '#000000',
confirmText: '确定',
confirmColor: '#3CC51F'
})
uni.hideLoading()
}
},
fail: () => {
uni.showModal({
title: '提示:',
content: '导出失败',
showCancel: false,
cancelText: '取消',
cancelColor: '#000000',
confirmText: '确定',
confirmColor: '#3CC51F'
})
uni.hideLoading()
}
})
}