diff --git a/app/Models/FileContent.php b/app/Models/FileContent.php index 352f7cdc5..1a8b06183 100644 --- a/app/Models/FileContent.php +++ b/app/Models/FileContent.php @@ -70,7 +70,7 @@ class FileContent extends AbstractModel 'name' => $name, 'ext' => $fileExt ])); - return Base::fillUrl("online/preview/{$name}?key={$key}"); + return Base::fillUrl("online/preview/{$name}?key={$key}&version=" . Base::getVersion() . "&__=" . Base::msecTime()); } /** diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index 28e288f72..72be1d6ad 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -66,6 +66,16 @@ import {MarkdownPreview} from "../store/markdown"; return str }, + /** + * 预览文件地址 + * @param name + * @param key + * @returns {*} + */ + onlinePreviewUrl(name, key) { + return $A.apiUrl(`../online/preview/${name}?key=${key}&version=${window.systemInfo.version}&__=${new Date().getTime()}`) + }, + /** * 项目配置模板 * @param project_id diff --git a/resources/assets/js/pages/manage/components/FileContent.vue b/resources/assets/js/pages/manage/components/FileContent.vue index 066c0eb8c..1c5dbc46e 100644 --- a/resources/assets/js/pages/manage/components/FileContent.vue +++ b/resources/assets/js/pages/manage/components/FileContent.vue @@ -295,7 +295,7 @@ export default { previewUrl() { if (this.isPreview) { const {name, key} = this.contentDetail; - return $A.apiUrl(`../online/preview/${name}?key=${key}&version=${window.systemInfo.version}`) + return $A.onlinePreviewUrl(name, key) } return ''; }, diff --git a/resources/assets/js/pages/manage/components/FilePreview.vue b/resources/assets/js/pages/manage/components/FilePreview.vue index ac8bcbd73..c992badb4 100644 --- a/resources/assets/js/pages/manage/components/FilePreview.vue +++ b/resources/assets/js/pages/manage/components/FilePreview.vue @@ -109,7 +109,7 @@ export default { previewUrl() { if (this.isPreview) { const {name, key} = this.contentDetail; - return $A.apiUrl(`../online/preview/${name}?key=${key}&version=${window.systemInfo.version}`) + return $A.onlinePreviewUrl(name, key) } return ''; }, diff --git a/resources/assets/js/pages/single/fileMsg.vue b/resources/assets/js/pages/single/fileMsg.vue index e1abb093f..e405ebcd2 100644 --- a/resources/assets/js/pages/single/fileMsg.vue +++ b/resources/assets/js/pages/single/fileMsg.vue @@ -133,7 +133,7 @@ export default { previewUrl() { const {name, key} = this.msgDetail.content; - return $A.apiUrl(`../online/preview/${name}?key=${key}&version=${window.systemInfo.version}`) + return $A.onlinePreviewUrl(name, key) } }, methods: { diff --git a/resources/assets/js/pages/single/fileTask.vue b/resources/assets/js/pages/single/fileTask.vue index bda9b808d..bb7ccb057 100644 --- a/resources/assets/js/pages/single/fileTask.vue +++ b/resources/assets/js/pages/single/fileTask.vue @@ -121,7 +121,7 @@ export default { previewUrl() { const {name, key} = this.fileDetail.content; - return $A.apiUrl(`../online/preview/${name}?key=${key}&version=${window.systemInfo.version}`) + return $A.onlinePreviewUrl(name, key) } }, methods: {