no message
This commit is contained in:
parent
34ad840f2d
commit
c56c6c72ae
@ -325,8 +325,8 @@ class FileController extends AbstractController
|
||||
//
|
||||
$file->size = $content->size;
|
||||
$file->save();
|
||||
$file->pushContentChange();
|
||||
//
|
||||
$content->content = $content->formatContent($file->type, $content->content);
|
||||
return Base::retSuccess('保存成功', $content);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,11 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Exceptions\ApiException;
|
||||
use App\Module\Base;
|
||||
use App\Tasks\PushTask;
|
||||
use Hhxsv5\LaravelS\Swoole\Task\Task;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Request;
|
||||
|
||||
/**
|
||||
* Class File
|
||||
@ -155,6 +159,35 @@ class File extends AbstractModel
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送内容发生变化消息
|
||||
*/
|
||||
public function pushContentChange()
|
||||
{
|
||||
$userid = [$this->userid];
|
||||
if ($this->share == 1) {
|
||||
$userid = array_merge($userid, WebSocket::wherePath('file/content/' . $this->id)->pluck('userid')->toArray());
|
||||
} elseif ($this->share == 2) {
|
||||
$userid = array_merge($userid, FileUser::whereFileId($this->id)->pluck('userid')->toArray());
|
||||
}
|
||||
//
|
||||
$userid = array_values(array_filter(array_unique($userid)));
|
||||
$params = [
|
||||
'ignoreFd' => Request::header('fd'),
|
||||
'userid' => $userid,
|
||||
'msg' => [
|
||||
'type' => 'fileContentChange',
|
||||
'data' => [
|
||||
'id' => $this->id,
|
||||
'nickname' => User::nickname(),
|
||||
'time' => Base::time()
|
||||
],
|
||||
]
|
||||
];
|
||||
$task = new PushTask($params, false);
|
||||
Task::deliver($task);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件并检测权限
|
||||
* @param $id
|
||||
|
@ -265,6 +265,19 @@ class User extends AbstractModel
|
||||
return $user->userid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的昵称
|
||||
* @return string
|
||||
*/
|
||||
public static function nickname()
|
||||
{
|
||||
$user = self::authInfo();
|
||||
if (!$user) {
|
||||
return '';
|
||||
}
|
||||
return $user->nickname;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户身份认证(获取用户信息)
|
||||
* @param null $identity 判断身份
|
||||
|
@ -12,14 +12,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="avatar-wrapper">
|
||||
<div :class="['avatar-box', userId === userid || user.online ? 'online' : '']" :style="boxStyle">
|
||||
<div v-if="showIcon" :class="['avatar-box', userId === userid || user.online ? 'online' : '']" :style="boxStyle">
|
||||
<em :style="spotStyle"></em>
|
||||
<EAvatar v-if="showImg" :src="user.userimg" :size="avatarSize"/>
|
||||
<EAvatar v-else :size="avatarSize" class="avatar-text">
|
||||
<span :style="spotStyle">{{nickname}}</span>
|
||||
</EAvatar>
|
||||
</div>
|
||||
<div v-if="showName" class="avatar-name">{{user.nickname}}</div>
|
||||
<div v-if="showName" class="avatar-name" :style="nameStyle">{{user.nickname}}</div>
|
||||
</div>
|
||||
</ETooltip>
|
||||
</template>
|
||||
@ -37,6 +37,10 @@
|
||||
type: [String, Number],
|
||||
default: 'default'
|
||||
},
|
||||
showIcon: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showName: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
@ -90,6 +94,17 @@
|
||||
}
|
||||
},
|
||||
|
||||
nameStyle() {
|
||||
const {showIcon} = this;
|
||||
if (!showIcon) {
|
||||
return {
|
||||
paddingLeft: 0
|
||||
}
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
|
||||
avatarSize() {
|
||||
let {borderWitdh, size} = this
|
||||
if (size === 'default') size = 32;
|
||||
|
@ -123,6 +123,16 @@ export default {
|
||||
if (data.path == 'file/content/' + this.fileId) {
|
||||
this.editUser = data.userids;
|
||||
}
|
||||
} else if (type == 'fileContentChange') {
|
||||
if (this.parentShow && data.id == this.fileId) {
|
||||
$A.modalConfirm({
|
||||
title: "更新提示",
|
||||
content: '团队成员(' + data.nickname + ')更新了内容,<br/>更新时间:' + $A.formatDate("Y-m-d H:i:s", data.time) + '。<br/><br/>点击【确定】加载最新内容。',
|
||||
onOk: () => {
|
||||
this.getContent();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
@ -207,8 +217,6 @@ export default {
|
||||
}).then(({data, msg}) => {
|
||||
$A.messageSuccess(msg);
|
||||
this.loadIng--;
|
||||
this.contentDetail = data.content;
|
||||
this.updateBak();
|
||||
this.$store.dispatch("saveFile", {
|
||||
id: this.fileId,
|
||||
size: data.size,
|
||||
|
@ -80,7 +80,13 @@
|
||||
</EDropdownMenu>
|
||||
</EDropdown>
|
||||
<div class="file-icon">
|
||||
<i v-if="item.share" class="taskfont"></i>
|
||||
<template v-if="item.share">
|
||||
<UserAvatar v-if="item.userid != userId" :userid="item.userid" class="share-avatar" :size="20"/>
|
||||
<div v-else class="share-icon">
|
||||
<i v-if="item.share == 1" class="taskfont" :title="$L('所有人')"></i>
|
||||
<i v-else class="taskfont" :title="$L('指定成员')"></i>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div v-if="item._edit" class="file-input">
|
||||
<Input
|
||||
@ -179,6 +185,11 @@ export default {
|
||||
this.editHeight = window.innerHeight - 40;
|
||||
},
|
||||
|
||||
activated() {
|
||||
this.$store.dispatch("websocketPath", "file");
|
||||
this.getFileList();
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['userId', 'userInfo', 'files']),
|
||||
|
||||
@ -222,28 +233,23 @@ export default {
|
||||
},
|
||||
|
||||
watch: {
|
||||
pid: {
|
||||
handler() {
|
||||
this.getFileList();
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
|
||||
editShow: {
|
||||
handler(val) {
|
||||
if (val) {
|
||||
this.editShowNum++;
|
||||
this.$store.dispatch("websocketPath", "file/content/" + this.editInfo.id)
|
||||
} else {
|
||||
this.$store.dispatch("websocketPath", "file")
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
pid() {
|
||||
this.getFileList();
|
||||
},
|
||||
|
||||
tableMode(val) {
|
||||
this.$store.state.method.setStorage("fileTableMode", val)
|
||||
}
|
||||
},
|
||||
|
||||
editShow(val) {
|
||||
if (val) {
|
||||
this.editShowNum++;
|
||||
this.$store.dispatch("websocketPath", "file/content/" + this.editInfo.id);
|
||||
} else {
|
||||
this.$store.dispatch("websocketPath", "file");
|
||||
this.getFileList();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
@ -290,6 +296,13 @@ export default {
|
||||
}
|
||||
}
|
||||
}))
|
||||
return h('div', {
|
||||
class: 'file-nbox'
|
||||
}, [
|
||||
h('div', {
|
||||
class: 'file-name ' + row.type,
|
||||
}, array),
|
||||
]);
|
||||
} else {
|
||||
// 编辑
|
||||
array.push(h('QuickEdit', {
|
||||
@ -317,16 +330,42 @@ export default {
|
||||
}, [
|
||||
h('AutoTip', row.name)
|
||||
]));
|
||||
//
|
||||
const iconArray = [];
|
||||
if (row.share) {
|
||||
if (row.share == 1) {
|
||||
iconArray.push(h('i', {
|
||||
class: 'taskfont',
|
||||
domProps: {
|
||||
title: this.$L('所有人'),
|
||||
innerHTML: ''
|
||||
},
|
||||
}))
|
||||
} else {
|
||||
iconArray.push(h('i', {
|
||||
class: 'taskfont',
|
||||
domProps: {
|
||||
title: this.$L('指定成员'),
|
||||
innerHTML: ''
|
||||
},
|
||||
}))
|
||||
}
|
||||
}
|
||||
return h('div', {
|
||||
class: 'file-nbox'
|
||||
}, [
|
||||
h('div', {
|
||||
class: 'file-name ' + row.type,
|
||||
}, array),
|
||||
iconArray
|
||||
]);
|
||||
}
|
||||
return h('div', {
|
||||
class: 'file-name ' + row.type
|
||||
}, array);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$L('大小'),
|
||||
key: 'size',
|
||||
width: 120,
|
||||
width: 110,
|
||||
resizable: true,
|
||||
sortable: true,
|
||||
render: (h, {row}) => {
|
||||
@ -339,7 +378,7 @@ export default {
|
||||
{
|
||||
title: this.$L('类型'),
|
||||
key: 'type',
|
||||
width: 120,
|
||||
width: 110,
|
||||
resizable: true,
|
||||
sortable: true,
|
||||
render: (h, {row}) => {
|
||||
@ -351,6 +390,23 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$L('所有者'),
|
||||
key: 'userid',
|
||||
width: 130,
|
||||
resizable: true,
|
||||
sortable: true,
|
||||
render: (h, {row}) => {
|
||||
return h('UserAvatar', {
|
||||
props: {
|
||||
size: 18,
|
||||
userid: row.userid,
|
||||
showIcon: false,
|
||||
showName: true,
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$L('最后修改'),
|
||||
key: 'updated_at',
|
||||
|
86
resources/assets/sass/pages/page-file.scss
vendored
86
resources/assets/sass/pages/page-file.scss
vendored
@ -235,34 +235,46 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.file-name {
|
||||
.file-nbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
padding-right: 26px;
|
||||
&:before {
|
||||
flex-shrink: 0;
|
||||
content: "";
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
margin-right: 8px;
|
||||
.file-name {
|
||||
flex: 1;
|
||||
width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
margin-right: 46px;
|
||||
&:before {
|
||||
flex-shrink: 0;
|
||||
content: "";
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
margin-right: 8px;
|
||||
}
|
||||
&.folder:before {
|
||||
background-image: url("../images/file/folder.svg");
|
||||
}
|
||||
&.document:before {
|
||||
background-image: url("../images/file/document.svg");
|
||||
}
|
||||
&.mind:before {
|
||||
background-image: url("../images/file/mind.svg");
|
||||
}
|
||||
&.sheet:before {
|
||||
background-image: url("../images/file/sheet.svg");
|
||||
}
|
||||
&.flow:before {
|
||||
background-image: url("../images/file/flow.svg");
|
||||
}
|
||||
}
|
||||
&.folder:before {
|
||||
background-image: url("../images/file/folder.svg");
|
||||
}
|
||||
&.document:before {
|
||||
background-image: url("../images/file/document.svg");
|
||||
}
|
||||
&.mind:before {
|
||||
background-image: url("../images/file/mind.svg");
|
||||
}
|
||||
&.sheet:before {
|
||||
background-image: url("../images/file/sheet.svg");
|
||||
}
|
||||
&.flow:before {
|
||||
background-image: url("../images/file/flow.svg");
|
||||
.taskfont {
|
||||
color: #aaaaaa;
|
||||
font-size: 16px;
|
||||
margin: 0 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -345,23 +357,31 @@
|
||||
background-size: contain;
|
||||
margin-top: 12px;
|
||||
position: relative;
|
||||
.taskfont {
|
||||
.share-icon,
|
||||
.share-avatar {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: -2px;
|
||||
font-size: 18px;
|
||||
color: #ffffff;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #9ACD7B;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transform: scale(0.9);
|
||||
.taskfont {
|
||||
font-size: 18px;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
&.shear {
|
||||
opacity: 0.38;
|
||||
}
|
||||
&.folder .file-icon {
|
||||
background-image: url("../images/file/folder.svg");
|
||||
.taskfont {
|
||||
right: 6px;
|
||||
bottom: 2px;
|
||||
}
|
||||
}
|
||||
&.document .file-icon {
|
||||
background-image: url("../images/file/document.svg");
|
||||
|
6
resources/assets/sass/taskfont.scss
vendored
6
resources/assets/sass/taskfont.scss
vendored
@ -1,8 +1,8 @@
|
||||
@font-face {
|
||||
font-family: 'taskfont'; /* Project id 2583385 */
|
||||
src: url('//at.alicdn.com/t/font_2583385_s6r5dbjuxi.woff2?t=1625128084843') format('woff2'),
|
||||
url('//at.alicdn.com/t/font_2583385_s6r5dbjuxi.woff?t=1625128084843') format('woff'),
|
||||
url('//at.alicdn.com/t/font_2583385_s6r5dbjuxi.ttf?t=1625128084843') format('truetype');
|
||||
src: url('//at.alicdn.com/t/font_2583385_vbi15jduv0n.woff2?t=1625644968453') format('woff2'),
|
||||
url('//at.alicdn.com/t/font_2583385_vbi15jduv0n.woff?t=1625644968453') format('woff'),
|
||||
url('//at.alicdn.com/t/font_2583385_vbi15jduv0n.ttf?t=1625644968453') format('truetype');
|
||||
}
|
||||
|
||||
.taskfont {
|
||||
|
Loading…
x
Reference in New Issue
Block a user