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

View File

@ -99,6 +99,8 @@
:msg-data="item" :msg-data="item"
:dialog-type="dialogData.type" :dialog-type="dialogData.type"
:hide-percentage="isMyDialog" :hide-percentage="isMyDialog"
:operate-visible="operateVisible"
:operate-action="operateVisible && item.id === operateItem.id"
@on-longpress="onLongpress"/> @on-longpress="onLongpress"/>
</DynamicScrollerItem> </DynamicScrollerItem>
</template> </template>
@ -137,14 +139,41 @@
:visible="operateVisible" :visible="operateVisible"
@on-clickoutside="operateVisible = false" @on-clickoutside="operateVisible = false"
@on-click="onOperate" @on-click="onOperate"
transferClassName="dialog-wrapper-operate"
transfer> transfer>
<div :style="{userSelect:operateVisible ? 'none' : 'auto', height: operateStyles.height}"></div> <div :style="{userSelect:operateVisible ? 'none' : 'auto', height: operateStyles.height}"></div>
<DropdownMenu slot="list"> <DropdownMenu slot="list">
<DropdownItem name="forward">{{ $L('转发') }}</DropdownItem> <DropdownItem v-if="operateHasText" name="copy">
<DropdownItem v-if="operateItem.userid == userId" name="withdraw">{{ $L('撤回') }}</DropdownItem> <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'"> <template v-if="operateItem.type === 'file'">
<DropdownItem name="view" divided>{{ $L('查看文件') }}</DropdownItem> <DropdownItem name="view" divided>
<DropdownItem name="down">{{ $L('下载文件') }}</DropdownItem> <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> </template>
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
@ -275,8 +304,9 @@ export default {
wrapperStyle: {}, wrapperStyle: {},
operateStyles: {},
operateVisible: false, operateVisible: false,
operateHasText: false,
operateStyles: {},
operateItem: {}, operateItem: {},
} }
}, },
@ -785,8 +815,9 @@ export default {
}, },
onLongpress({event, el, msgData}) { onLongpress({event, el, msgData}) {
this.operateVisible = false; this.operateVisible = this.operateItem.id === msgData.id;
this.operateItem = $A.isJson(msgData) ? msgData : {}; this.operateItem = $A.isJson(msgData) ? msgData : {};
this.operateHasText = msgData.type === 'text' && msgData.msg.text.replace(/<[^>]+>/g,"").length > 0
this.$nextTick(() => { this.$nextTick(() => {
const projectRect = el.getBoundingClientRect(); const projectRect = el.getBoundingClientRect();
const wrapRect = this.$el.getBoundingClientRect(); const wrapRect = this.$el.getBoundingClientRect();
@ -801,6 +832,19 @@ export default {
onOperate(name) { onOperate(name) {
switch (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": case "forward":
this.onForward('open') this.onForward('open')
break; break;

View File

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

View File

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

View File

@ -1179,10 +1179,10 @@ export default {
if (!this.linkData.url) { if (!this.linkData.url) {
return; return;
} }
this.$copyText(this.linkData.url).then(() => { this.$copyText(this.linkData.url).then(_ => {
$A.messageSuccess(this.$L('复制成功')); $A.messageSuccess('复制成功');
}, () => { }).catch(_ => {
$A.messageError(this.$L('复制失败')); $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/dropdown-item";
@import "~element-ui/packages/theme-chalk/src/notification"; @import "~element-ui/packages/theme-chalk/src/notification";
.el-dropdown-menu {
user-select: none;
}
.el-dropdown-menu__item { .el-dropdown-menu__item {
min-width: 100px; min-width: 100px;

View File

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

View File

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