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 @@