mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-25 02:40:28 +00:00
定位回复消息位置
This commit is contained in:
parent
f3e9ac2b56
commit
d5c8b33678
@ -10,6 +10,7 @@
|
|||||||
:operate-visible="operateVisible"
|
:operate-visible="operateVisible"
|
||||||
:operate-action="operateVisible && source.id === operateItem.id"
|
:operate-action="operateVisible && source.id === operateItem.id"
|
||||||
@on-longpress="onLongpress"
|
@on-longpress="onLongpress"
|
||||||
|
@on-view-reply="onViewReply"
|
||||||
@on-view-text="onViewText"
|
@on-view-text="onViewText"
|
||||||
@on-view-file="onViewFile"
|
@on-view-file="onViewFile"
|
||||||
@on-emoji="onEmoji"/>
|
@on-emoji="onEmoji"/>
|
||||||
@ -74,6 +75,10 @@ export default {
|
|||||||
this.dispatch("on-longpress", e)
|
this.dispatch("on-longpress", e)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onViewReply(replyId) {
|
||||||
|
this.dispatch("on-view-reply", replyId)
|
||||||
|
},
|
||||||
|
|
||||||
onViewText(e) {
|
onViewText(e) {
|
||||||
this.dispatch("on-view-text", e)
|
this.dispatch("on-view-text", e)
|
||||||
},
|
},
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
:class="headClass"
|
:class="headClass"
|
||||||
v-longpress="{callback: handleLongpress, delay: 300}">
|
v-longpress="{callback: handleLongpress, delay: 300}">
|
||||||
<!--回复-->
|
<!--回复-->
|
||||||
<div v-if="replyData" class="dialog-reply no-dark-content">
|
<div v-if="replyData" class="dialog-reply no-dark-content" @click="viewReply">
|
||||||
<UserAvatar :userid="replyData.userid" :show-icon="false" :show-name="true" :tooltip-disabled="true"/>
|
<UserAvatar :userid="replyData.userid" :show-icon="false" :show-name="true" :tooltip-disabled="true"/>
|
||||||
<div class="reply-desc">{{formatMsgDesc(replyData)}}</div>
|
<div class="reply-desc">{{formatMsgDesc(replyData)}}</div>
|
||||||
</div>
|
</div>
|
||||||
@ -387,6 +387,10 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
viewReply() {
|
||||||
|
this.$emit("on-view-reply", this.replyData.id)
|
||||||
|
},
|
||||||
|
|
||||||
viewText(e) {
|
viewText(e) {
|
||||||
this.$emit("on-view-text", e)
|
this.$emit("on-view-text", e)
|
||||||
},
|
},
|
||||||
|
|||||||
@ -76,6 +76,7 @@
|
|||||||
:data-sources="allMsgs"
|
:data-sources="allMsgs"
|
||||||
:data-component="msgItem"
|
:data-component="msgItem"
|
||||||
|
|
||||||
|
:item-class-add="itemClassAdd"
|
||||||
:extra-props="{dialogData, isMyDialog, operateVisible, operateItem}"
|
:extra-props="{dialogData, isMyDialog, operateVisible, operateItem}"
|
||||||
:estimate-size="78"
|
:estimate-size="78"
|
||||||
:keeps="80"
|
:keeps="80"
|
||||||
@ -83,6 +84,7 @@
|
|||||||
@totop="loadNextPage"
|
@totop="loadNextPage"
|
||||||
|
|
||||||
@on-longpress="onLongpress"
|
@on-longpress="onLongpress"
|
||||||
|
@on-view-reply="onViewReply"
|
||||||
@on-view-text="onViewText"
|
@on-view-text="onViewText"
|
||||||
@on-view-file="onViewFile"
|
@on-view-file="onViewFile"
|
||||||
@on-emoji="onEmoji">
|
@on-emoji="onEmoji">
|
||||||
@ -326,6 +328,7 @@ export default {
|
|||||||
wrapperStart: 0,
|
wrapperStart: 0,
|
||||||
|
|
||||||
replyId: 0,
|
replyId: 0,
|
||||||
|
replyActiveIndex: -1,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -629,6 +632,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
itemClassAdd(index) {
|
||||||
|
return index === this.replyActiveIndex ? 'dialog-shake' : '';
|
||||||
|
},
|
||||||
|
|
||||||
inputFocus() {
|
inputFocus() {
|
||||||
this.$nextTick(_ => {
|
this.$nextTick(_ => {
|
||||||
this.$refs.input.focus()
|
this.$refs.input.focus()
|
||||||
@ -1014,6 +1021,22 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onViewReply(replyId) {
|
||||||
|
if (this.operateVisible) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const index = this.allMsgs.findIndex(item => item.id === replyId)
|
||||||
|
if (index > -1) {
|
||||||
|
this.$refs.scroller?.scrollToIndex(index);
|
||||||
|
requestAnimationFrame(_ => {
|
||||||
|
this.replyActiveIndex = index;
|
||||||
|
setTimeout(_ => {
|
||||||
|
this.replyActiveIndex = -1;
|
||||||
|
}, 800)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onViewText({target}) {
|
onViewText({target}) {
|
||||||
if (this.operateVisible) {
|
if (this.operateVisible) {
|
||||||
return
|
return
|
||||||
|
|||||||
@ -187,6 +187,11 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
padding: 16px 32px 0;
|
padding: 16px 32px 0;
|
||||||
|
|
||||||
|
.dialog-shake {
|
||||||
|
animation: ani-dialog-shake 500ms ease-in-out;
|
||||||
|
animation-delay: 200ms;
|
||||||
|
}
|
||||||
|
|
||||||
.dialog-item {
|
.dialog-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
@ -243,6 +248,8 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
padding-left: 9px;
|
padding-left: 9px;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
&:after {
|
&:after {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -1035,6 +1042,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes ani-dialog-shake {
|
||||||
|
10%, 90% { transform: translate3d(-1px, 0, 0); }
|
||||||
|
20%, 80% { transform: translate3d(+2px, 0, 0); }
|
||||||
|
30%, 70% { transform: translate3d(-4px, 0, 0); }
|
||||||
|
40%, 60% { transform: translate3d(+4px, 0, 0); }
|
||||||
|
50% { transform: translate3d(-4px, 0, 0); }
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.dialog-wrapper {
|
.dialog-wrapper {
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user