fix: 客户端编辑文件不显示协助成员

This commit is contained in:
kuaifan 2022-01-28 01:12:22 +08:00
parent 09d3131d46
commit a881bfd63b
2 changed files with 35 additions and 12 deletions

View File

@ -204,7 +204,19 @@ class WebSocketService implements WebSocketHandlerInterface
*/
private function deleteUser($fd)
{
WebSocket::whereFd($fd)->delete();
$array = [];
WebSocket::whereFd($fd)->chunk(10, function($list) use (&$array) {
/** @var WebSocket $item */
foreach ($list as $item) {
$item->delete();
if ($item->path && str_starts_with($item->path, "file/content/")) {
$array[$item->path] = $item->path;
}
}
});
foreach ($array as $path) {
$this->pushPath($path);
}
}
/**

View File

@ -112,6 +112,7 @@ export default {
document.addEventListener('keydown', this.keySave);
window.addEventListener('message', this.handleMessage)
},
beforeDestroy() {
document.removeEventListener('keydown', this.keySave);
window.removeEventListener('message', this.handleMessage)
@ -130,6 +131,18 @@ export default {
deep: true,
},
value: {
handler(val) {
if (val) {
this.ready = true;
this.editUser = [this.userId];
} else {
this.fileContent[this.fileId] = this.contentDetail;
}
},
immediate: true,
},
wsMsg: {
handler(info) {
const {type, data} = info;
@ -158,21 +171,15 @@ export default {
deep: true,
},
value: {
handler(val) {
if (val) {
this.ready = true;
this.editUser = [this.userId];
} else {
this.fileContent[this.fileId] = this.contentDetail;
}
},
immediate: true,
wsOpenNum() {
if (this.$isSubElectron) {
this.$store.dispatch("websocketPath", "file/content/" + this.fileId);
}
},
},
computed: {
...mapState(['fileContent', 'wsMsg', 'userId']),
...mapState(['fileContent', 'wsMsg', 'userId', 'wsOpenNum']),
equalContent() {
return this.contentBak == $A.jsonStringify(this.contentDetail);
@ -246,6 +253,10 @@ export default {
this.loadContent--;
this.contentDetail = data.content;
this.updateBak();
//
if (this.$isSubElectron) {
this.$store.dispatch("websocketConnection")
}
}).catch(({msg}) => {
$A.modalError(msg);
this.loadIng--;