diff --git a/app/Http/Controllers/Api/FileController.php b/app/Http/Controllers/Api/FileController.php
index 8e4f224a..019a66dc 100755
--- a/app/Http/Controllers/Api/FileController.php
+++ b/app/Http/Controllers/Api/FileController.php
@@ -590,4 +590,35 @@ class FileController extends AbstractController
$file->pushMsg($action, $action == "delete" ? null : $file, $array);
return Base::retSuccess($action == "delete" ? "删除成功" : "设置成功", $file);
}
+
+ /**
+ * 退出共享
+ *
+ * @apiParam {Number} id 文件ID
+ */
+ public function share__out()
+ {
+ $user = User::auth();
+ //
+ $id = intval(Request::input('id'));
+ //
+ $file = File::allowFind($id);
+ //
+ if ($file->userid == $user->userid) {
+ return Base::retError('不能退出自己共享的文件');
+ }
+ if (FileUser::where([
+ 'file_id' => $file->id,
+ 'userid' => 0,
+ ])->exists()) {
+ return Base::retError('无法退出共享所有人的文件或文件夹');
+ }
+ FileUser::where([
+ 'file_id' => $file->id,
+ 'userid' => $user->userid,
+ ])->delete();
+ //
+ $file->setShare();
+ return Base::retSuccess("退出成功");
+ }
}
diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue
index b12ee331..4f2d924e 100644
--- a/resources/assets/js/pages/manage/file.vue
+++ b/resources/assets/js/pages/manage/file.vue
@@ -119,7 +119,13 @@
{{$L('重命名')}}
{{$L('复制')}}
{{$L('剪切')}}
- {{$L('共享')}}
+
+ {{$L('共享')}}
+ {{$L('链接')}}
+
+
+ {{$L('退出共享')}}
+
{{$L('删除')}}
@@ -797,6 +803,28 @@ export default {
this.getShare();
break;
+ case 'outshare':
+ $A.modalConfirm({
+ content: '你确定要退出【' + item.name + '】共享成员吗?',
+ loading: true,
+ onOk: () => {
+ this.$store.dispatch("call", {
+ url: 'file/share/out',
+ data: {
+ id: item.id,
+ },
+ }).then(({msg}) => {
+ $A.messageSuccess(msg);
+ this.$Modal.remove();
+ this.$store.dispatch("forgetFile", item.id);
+ }).catch(({msg}) => {
+ this.$Modal.remove();
+ $A.modalError(msg, 301);
+ });
+ }
+ });
+ break;
+
case 'delete':
let typeName = item.type == 'folder' ? '文件夹' : '文件';
$A.modalConfirm({
@@ -814,7 +842,7 @@ export default {
this.$Modal.remove();
this.$store.dispatch("forgetFile", item.id);
}).catch(({msg}) => {
- $A.modalError(msg);
+ $A.modalError(msg, 301);
this.$Modal.remove();
});
}