From 27158e1ee7772740647cc612fa59c723563c3497 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Thu, 30 Dec 2021 10:58:51 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20office=E6=96=87=E4=BB=B6=E9=A2=84?= =?UTF-8?q?=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/FileController.php | 8 ++++++-- resources/assets/js/components/OnlyOffice.vue | 2 +- resources/assets/js/pages/manage/file.vue | 18 +++++++++--------- resources/assets/js/pages/single/file.vue | 9 +++++---- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/Api/FileController.php b/app/Http/Controllers/Api/FileController.php index 55321908..8b1b2286 100755 --- a/app/Http/Controllers/Api/FileController.php +++ b/app/Http/Controllers/Api/FileController.php @@ -96,9 +96,10 @@ class FileController extends AbstractController { $id = Request::input('id'); // + $permission = 0; if (Base::isNumber($id)) { User::auth(); - $file = File::permissionFind(intval($id)); + $file = File::permissionFind(intval($id), 0, $permission); } elseif ($id) { $fileLink = FileLink::whereCode($id)->first(); $file = $fileLink?->file; @@ -108,7 +109,10 @@ class FileController extends AbstractController } else { return Base::retError('参数错误'); } - return Base::retSuccess('success', $file); + // + $array = $file->toArray(); + $array['permission'] = $permission; + return Base::retSuccess('success', $array); } /** diff --git a/resources/assets/js/components/OnlyOffice.vue b/resources/assets/js/components/OnlyOffice.vue index a14134a5..c82206e1 100644 --- a/resources/assets/js/components/OnlyOffice.vue +++ b/resources/assets/js/components/OnlyOffice.vue @@ -164,7 +164,7 @@ export default { "callbackUrl": 'http://nginx/api/file/content/office?id=' + fileKey + '&token=' + this.userToken, } }; - if (this.isPreview) { + if (this.readOnly) { config.editorConfig.mode = "view"; config.editorConfig.callbackUrl = null; if (!config.editorConfig.user.id) { diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue index 515c2d7b..18b74f67 100644 --- a/resources/assets/js/pages/manage/file.vue +++ b/resources/assets/js/pages/manage/file.vue @@ -280,11 +280,11 @@ - - + + @@ -384,8 +384,8 @@ export default { linkData: {}, linkLoad: 0, - editShow: false, - editInfo: {permission: -1}, + fileShow: false, + fileInfo: {permission: -1}, uploadDir: false, uploadIng: 0, @@ -499,9 +499,9 @@ export default { this.$store.state.method.setStorage("fileTableMode", val) }, - editShow(val) { + fileShow(val) { if (val) { - this.$store.dispatch("websocketPath", "file/content/" + this.editInfo.id); + this.$store.dispatch("websocketPath", "file/content/" + this.fileInfo.id); } else { this.$store.dispatch("websocketPath", "file"); this.getFileList(); @@ -754,8 +754,8 @@ export default { if (this.$Electron) { this.openSingle(item); } else { - this.editInfo = item; - this.editShow = true; + this.fileInfo = item; + this.fileShow = true; } } }, diff --git a/resources/assets/js/pages/single/file.vue b/resources/assets/js/pages/single/file.vue index 55c48a1c..742dd1b5 100644 --- a/resources/assets/js/pages/single/file.vue +++ b/resources/assets/js/pages/single/file.vue @@ -1,19 +1,20 @@