no message

This commit is contained in:
kuaifan 2022-06-03 17:15:49 +08:00
parent 4c2bf56cea
commit e71c13e9ac
14 changed files with 131 additions and 19 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
<template>
<div :class="`dialog-view ${msgData.type}`" :data-id="msgData.id">
<div class="dialog-view" :class="viewClass" :data-id="msgData.id">
<!--昵称-->
<div v-if="dialogType === 'group'" class="dialog-username">
<UserAvatar :userid="msgData.userid" :show-icon="false" :show-name="true" :tooltip-disabled="true"/>
@ -130,6 +130,14 @@ export default {
type: Boolean,
default: false
},
operateVisible: {
type: Boolean,
default: false
},
operateAction: {
type: Boolean,
default: false
},
},
data() {
@ -153,6 +161,17 @@ export default {
computed: {
...mapState(['userToken', 'userId', 'dialogMsgs']),
viewClass() {
const array = [];
if (this.msgData.type) {
array.push(this.msgData.type)
}
if (this.operateAction) {
array.push('operate-action')
}
return array
},
readList() {
return this.allList.filter(({read_at}) => read_at)
},
@ -325,6 +344,9 @@ export default {
},
playRecord() {
if (this.operateVisible) {
return
}
Store.set('audioSubscribe', {
id: this.msgData.id,
src: this.msgData.msg.path,
@ -335,6 +357,9 @@ export default {
},
openMeeting() {
if (this.operateVisible) {
return
}
Store.set('addMeeting', {
type: 'join',
name: this.msgData.msg.name,
@ -367,6 +392,9 @@ export default {
},
viewText({target}) {
if (this.operateVisible) {
return
}
switch (target.nodeName) {
case "IMG":
if (target.classList.contains('browse')) {
@ -386,6 +414,9 @@ export default {
},
viewFile() {
if (this.operateVisible) {
return
}
const {msg} = this.msgData;
if (['jpg', 'jpeg', 'gif', 'png'].includes(msg.ext)) {
this.viewPicture(msg.path);

View File

@ -99,6 +99,8 @@
:msg-data="item"
:dialog-type="dialogData.type"
:hide-percentage="isMyDialog"
:operate-visible="operateVisible"
:operate-action="operateVisible && item.id === operateItem.id"
@on-longpress="onLongpress"/>
</DynamicScrollerItem>
</template>
@ -137,14 +139,41 @@
:visible="operateVisible"
@on-clickoutside="operateVisible = false"
@on-click="onOperate"
transferClassName="dialog-wrapper-operate"
transfer>
<div :style="{userSelect:operateVisible ? 'none' : 'auto', height: operateStyles.height}"></div>
<DropdownMenu slot="list">
<DropdownItem name="forward">{{ $L('转发') }}</DropdownItem>
<DropdownItem v-if="operateItem.userid == userId" name="withdraw">{{ $L('撤回') }}</DropdownItem>
<DropdownItem v-if="operateHasText" name="copy">
<div class="operate-item">
<span>{{ $L('复制') }}</span>
<i class="taskfont">&#xe77f;</i>
</div>
</DropdownItem>
<DropdownItem name="forward">
<div class="operate-item">
<span>{{ $L('转发') }}</span>
<i class="taskfont">&#xe75e;</i>
</div>
</DropdownItem>
<DropdownItem v-if="operateItem.userid == userId" name="withdraw">
<div class="operate-item">
<span>{{ $L('撤回') }}</span>
<i class="taskfont">&#xe637;</i>
</div>
</DropdownItem>
<template v-if="operateItem.type === 'file'">
<DropdownItem name="view" divided>{{ $L('查看文件') }}</DropdownItem>
<DropdownItem name="down">{{ $L('下载文件') }}</DropdownItem>
<DropdownItem name="view" divided>
<div class="operate-item">
<span>{{ $L('查看') }}</span>
<i class="taskfont">&#xe77b;</i>
</div>
</DropdownItem>
<DropdownItem name="down">
<div class="operate-item">
<span>{{ $L('下载') }}</span>
<i class="taskfont">&#xe7a8;</i>
</div>
</DropdownItem>
</template>
</DropdownMenu>
</Dropdown>
@ -275,8 +304,9 @@ export default {
wrapperStyle: {},
operateStyles: {},
operateVisible: false,
operateHasText: false,
operateStyles: {},
operateItem: {},
}
},
@ -785,8 +815,9 @@ export default {
},
onLongpress({event, el, msgData}) {
this.operateVisible = false;
this.operateVisible = this.operateItem.id === msgData.id;
this.operateItem = $A.isJson(msgData) ? msgData : {};
this.operateHasText = msgData.type === 'text' && msgData.msg.text.replace(/<[^>]+>/g,"").length > 0
this.$nextTick(() => {
const projectRect = el.getBoundingClientRect();
const wrapRect = this.$el.getBoundingClientRect();
@ -801,6 +832,19 @@ export default {
onOperate(name) {
switch (name) {
case "copy":
if (this.operateHasText) {
const text = this.operateItem.msg.text.replace(/<[^>]+>/g,"");
this.$copyText(text).then(_ => {
$A.messageSuccess('复制成功');
}).catch(_ => {
$A.messageError('复制失败');
});
} else {
$A.messageWarning('不可复制的内容');
}
break;
case "forward":
this.onForward('open')
break;

View File

@ -430,10 +430,10 @@ export default {
if (!this.linkData.url) {
return;
}
this.$copyText(this.linkData.url).then(() => {
$A.messageSuccess(this.$L('复制成功'));
}, () => {
$A.messageError(this.$L('复制失败'));
this.$copyText(this.linkData.url).then(_ => {
$A.messageSuccess('复制成功');
}).catch(_ => {
$A.messageError('复制失败');
});
},

View File

@ -1321,10 +1321,10 @@ export default {
if (!this.inviteData.url) {
return;
}
this.$copyText(this.inviteData.url).then(() => {
$A.messageSuccess(this.$L('复制成功'));
}, () => {
$A.messageError(this.$L('复制失败'));
this.$copyText(this.inviteData.url).then(_ => {
$A.messageSuccess('复制成功');
}).catch(_ => {
$A.messageError('复制失败');
});
},

View File

@ -1179,10 +1179,10 @@ export default {
if (!this.linkData.url) {
return;
}
this.$copyText(this.linkData.url).then(() => {
$A.messageSuccess(this.$L('复制成功'));
}, () => {
$A.messageError(this.$L('复制失败'));
this.$copyText(this.linkData.url).then(_ => {
$A.messageSuccess('复制成功');
}).catch(_ => {
$A.messageError('复制失败');
});
},

View File

@ -15,6 +15,9 @@ $--dropdown-menuItem-hover-color: #606266;
@import "~element-ui/packages/theme-chalk/src/dropdown-item";
@import "~element-ui/packages/theme-chalk/src/notification";
.el-dropdown-menu {
user-select: none;
}
.el-dropdown-menu__item {
min-width: 100px;

View File

@ -58,6 +58,7 @@ body {
}
.ivu-select-dropdown {
user-select: none;
max-height: 360px;
&.select-node {

View File

@ -219,6 +219,14 @@
max-width: 70%;
}
&.operate-action {
.dialog-head {
.dialog-content {
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}
}
}
.dialog-username {
max-width: 100%;
height: 22px;
@ -237,6 +245,7 @@
border-radius: 2px 8px 8px 8px;
display: flex;
align-items: flex-start;
transition: box-shadow 0.3s ease;
&.an-emoticon,
&.an-emoji,
@ -931,6 +940,18 @@
}
}
.dialog-wrapper-operate {
.operate-item {
display: flex;
align-items: center;
justify-content: space-between;
min-width: 80px;
.taskfont {
margin-left: 24px;
}
}
}
@media (max-width: 768px) {
.dialog-wrapper {
.dialog-nav {
@ -1009,6 +1030,18 @@
padding-right: 14px;
padding-left: 14px;
overscroll-behavior: none;
.dialog-item {
.dialog-view {
user-select: none;
&.operate-action {
.content-text {
user-select: text;
}
}
}
}
}
.dialog-footer {
background-color: #f8f8f8;