mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-18 05:18:11 +00:00
消息列表滚动到底部
This commit is contained in:
parent
88316fda1c
commit
500e666416
@ -96,8 +96,9 @@
|
|||||||
</VirtualList>
|
</VirtualList>
|
||||||
|
|
||||||
<!--底部输入-->
|
<!--底部输入-->
|
||||||
<div class="dialog-footer" :class="{newmsg: msgNew > 0 && allMsgs.length > 0}" @click="onActive">
|
<div class="dialog-footer" :class="footerClass" @click="onActive">
|
||||||
<div class="dialog-newmsg" @click="onToBottom">{{$L(`有${msgNew}条新消息`)}}</div>
|
<div class="dialog-newmsg" @click="onToBottom">{{$L(`有${msgNew}条新消息`)}}</div>
|
||||||
|
<div class="dialog-goto" @click="onToBottom"><i class="taskfont"></i></div>
|
||||||
<DialogUpload
|
<DialogUpload
|
||||||
ref="chatUpload"
|
ref="chatUpload"
|
||||||
class="chat-upload"
|
class="chat-upload"
|
||||||
@ -326,6 +327,8 @@ export default {
|
|||||||
|
|
||||||
recordState: '',
|
recordState: '',
|
||||||
wrapperStart: 0,
|
wrapperStart: 0,
|
||||||
|
|
||||||
|
scrollBalance: 0,
|
||||||
scrollMoreLoad: false,
|
scrollMoreLoad: false,
|
||||||
|
|
||||||
replyId: 0,
|
replyId: 0,
|
||||||
@ -428,6 +431,17 @@ export default {
|
|||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
footerClass() {
|
||||||
|
const array = [];
|
||||||
|
if (this.msgNew > 0 && this.allMsgs.length > 0) {
|
||||||
|
array.push('newmsg')
|
||||||
|
}
|
||||||
|
if (this.scrollBalance > 50) {
|
||||||
|
array.push('goto')
|
||||||
|
}
|
||||||
|
return array
|
||||||
|
},
|
||||||
|
|
||||||
msgUnreadOnly() {
|
msgUnreadOnly() {
|
||||||
let num = 0;
|
let num = 0;
|
||||||
this.cacheDialogs.some(dialog => {
|
this.cacheDialogs.some(dialog => {
|
||||||
@ -910,29 +924,28 @@ export default {
|
|||||||
this.__onScroll && clearTimeout(this.__onScroll);
|
this.__onScroll && clearTimeout(this.__onScroll);
|
||||||
this.__onScroll = setTimeout(_ => {
|
this.__onScroll = setTimeout(_ => {
|
||||||
const {balance} = this.scrollInfo();
|
const {balance} = this.scrollInfo();
|
||||||
if (balance <= 10) {
|
this.scrollBalance = balance;
|
||||||
|
if (this.scrollBalance <= 10) {
|
||||||
this.msgNew = 0;
|
this.msgNew = 0;
|
||||||
}
|
}
|
||||||
}, 100)
|
//
|
||||||
//
|
if (!this.scrollMoreLoad) {
|
||||||
if (!this.scrollMoreLoad) {
|
let tmpPage = 0;
|
||||||
let tmpPage = 0;
|
for (let i = range.start; i <= range.end; i++) {
|
||||||
for (let i = range.start; i <= range.end; i++) {
|
if (tmpPage - parseInt(this.allMsgs[i]._page) > 1) {
|
||||||
if (tmpPage - parseInt(this.allMsgs[i]._page) > 1) {
|
this.scrollMoreLoad = true
|
||||||
this.scrollMoreLoad = true
|
|
||||||
setTimeout(_ => {
|
|
||||||
this.$store.dispatch("getDialogMoreMsgs", {
|
this.$store.dispatch("getDialogMoreMsgs", {
|
||||||
dialog_id: this.dialogId,
|
dialog_id: this.dialogId,
|
||||||
page: tmpPage - 1
|
page: tmpPage - 1
|
||||||
}).finally(_ => {
|
}).finally(_ => {
|
||||||
this.scrollMoreLoad = false
|
this.scrollMoreLoad = false
|
||||||
})
|
})
|
||||||
}, 100)
|
break;
|
||||||
break;
|
}
|
||||||
|
tmpPage = parseInt(this.allMsgs[i]._page);
|
||||||
}
|
}
|
||||||
tmpPage = parseInt(this.allMsgs[i]._page);
|
|
||||||
}
|
}
|
||||||
}
|
}, 100)
|
||||||
},
|
},
|
||||||
|
|
||||||
onBack() {
|
onBack() {
|
||||||
|
|||||||
@ -188,7 +188,7 @@
|
|||||||
padding: 16px 32px 0;
|
padding: 16px 32px 0;
|
||||||
|
|
||||||
.dialog-shake {
|
.dialog-shake {
|
||||||
animation: ani-dialog-shake 500ms ease-in-out;
|
animation: ani-dialog-shake 600ms ease-in-out;
|
||||||
animation-delay: 200ms;
|
animation-delay: 200ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -799,21 +799,47 @@
|
|||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
|
|
||||||
.dialog-newmsg {
|
.dialog-newmsg {
|
||||||
display: none;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -38px;
|
top: -44px;
|
||||||
right: 24px;
|
left: 50%;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
background-color: #555555;
|
background-color: #555555;
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
margin-bottom: 20px;
|
|
||||||
margin-right: 10px;
|
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
transition: all 0.3s;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
transform: translate(-50%, 120%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-goto {
|
||||||
|
display: flex;
|
||||||
|
align-content: center;
|
||||||
|
justify-content: center;
|
||||||
|
position: absolute;
|
||||||
|
top: -48px;
|
||||||
|
right: 8px;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
line-height: 40px;
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #555555;
|
||||||
|
border-radius: 50%;
|
||||||
|
cursor: pointer;
|
||||||
|
z-index: 2;
|
||||||
|
transition: all 0.3s;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
transform: translate(120%, 0);
|
||||||
|
.taskfont {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-upload {
|
.chat-upload {
|
||||||
@ -844,7 +870,17 @@
|
|||||||
|
|
||||||
&.newmsg {
|
&.newmsg {
|
||||||
.dialog-newmsg {
|
.dialog-newmsg {
|
||||||
display: block;
|
pointer-events: auto;
|
||||||
|
opacity: 1;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.goto {
|
||||||
|
.dialog-goto {
|
||||||
|
pointer-events: auto;
|
||||||
|
opacity: 1;
|
||||||
|
transform: translate(0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user