[update] pdf预览增加一个随机数参数

This commit is contained in:
lideqin
2024-06-18 10:00:02 +08:00
parent 2377aff2be
commit 372914e06e
+4 -1
View File
@@ -5,7 +5,10 @@ const getToken = () => Vue.ls.get(ACCESS_TOKEN)
// 预览pdf
const previewPdf = (id) => {
const url = `${window._CONFIG.domianURL}/sys/common/view/${id}?type=view&at=${getToken()}`
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
const url = `${window._CONFIG.domianURL}/sys/common/view/${id}?type=view&at=${getToken()}&serial=${uidGenerator()}`
return `${process.env.BASE_URL}pdfjs/web/viewer.html?file=` + encodeURIComponent(url) + '&.pdf'
}