mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-14 21:02:49 +00:00
perf: 优化未读消息提示
This commit is contained in:
parent
fbd662e400
commit
54117fe51a
@ -137,7 +137,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--跳转提示-->
|
<!--跳转提示-->
|
||||||
<div v-if="listPreparedStatus && positionMsg" class="dialog-position" :class="{'down': tagShow}">
|
<div v-if="positionShow && positionMsg" class="dialog-position" :class="{'down': tagShow}">
|
||||||
<div class="position-label" @click="onPositionMark">
|
<div class="position-label" @click="onPositionMark">
|
||||||
<Icon v-if="positionLoad > 0" type="ios-loading" class="icon-loading"></Icon>
|
<Icon v-if="positionLoad > 0" type="ios-loading" class="icon-loading"></Icon>
|
||||||
<i v-else class="taskfont"></i>
|
<i v-else class="taskfont"></i>
|
||||||
@ -731,6 +731,7 @@ export default {
|
|||||||
|
|
||||||
unreadMsgId: 0, // 最早未读消息id
|
unreadMsgId: 0, // 最早未读消息id
|
||||||
positionLoad: 0, // 定位跳转加载中
|
positionLoad: 0, // 定位跳转加载中
|
||||||
|
positionShow: false, // 定位跳转显示
|
||||||
firstMsgLength: 0, // 首次加载消息数量
|
firstMsgLength: 0, // 首次加载消息数量
|
||||||
isFirstShowTag: false, // 是否首次显示标签
|
isFirstShowTag: false, // 是否首次显示标签
|
||||||
msgPreparedStatus: false, // 消息准备完成
|
msgPreparedStatus: false, // 消息准备完成
|
||||||
@ -777,6 +778,7 @@ export default {
|
|||||||
'fileLinks',
|
'fileLinks',
|
||||||
'cacheEmojis',
|
'cacheEmojis',
|
||||||
|
|
||||||
|
'readReqNum',
|
||||||
'keyboardType',
|
'keyboardType',
|
||||||
'keyboardHeight',
|
'keyboardHeight',
|
||||||
'safeAreaBottom'
|
'safeAreaBottom'
|
||||||
@ -1042,9 +1044,9 @@ export default {
|
|||||||
return null
|
return null
|
||||||
},
|
},
|
||||||
|
|
||||||
positionMsg() {
|
positionMsg({msgNew, dialogData, allMsgs}) {
|
||||||
const {mention, unread, position_msgs} = this.dialogData
|
const {mention, unread, position_msgs} = dialogData
|
||||||
if (!position_msgs || position_msgs.length === 0 || unread === 0 || this.allMsgs.length === 0) {
|
if (!position_msgs || position_msgs.length === 0 || (unread - msgNew) <= 0 || allMsgs.length === 0) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
const item = $A.cloneJSON(position_msgs.find(item => {
|
const item = $A.cloneJSON(position_msgs.find(item => {
|
||||||
@ -1059,8 +1061,8 @@ export default {
|
|||||||
return item
|
return item
|
||||||
},
|
},
|
||||||
|
|
||||||
operateEmojis() {
|
operateEmojis({cacheEmojis}) {
|
||||||
const list = this.cacheEmojis.slice(0, 3)
|
const list = cacheEmojis.slice(0, 3)
|
||||||
Object.values(['👌', '👍', '😂', '🎉', '❤️', '🥳️', '🥰', '😥', '😭']).some(item => {
|
Object.values(['👌', '👍', '😂', '🎉', '❤️', '🥳️', '🥰', '😥', '😭']).some(item => {
|
||||||
if (!list.includes(item)) {
|
if (!list.includes(item)) {
|
||||||
list.push(item)
|
list.push(item)
|
||||||
@ -1069,15 +1071,15 @@ export default {
|
|||||||
return list
|
return list
|
||||||
},
|
},
|
||||||
|
|
||||||
maxSize() {
|
maxSize({systemConfig}) {
|
||||||
if(this.systemConfig?.file_upload_limit){
|
if(systemConfig?.file_upload_limit){
|
||||||
return this.systemConfig.file_upload_limit * 1024
|
return systemConfig.file_upload_limit * 1024
|
||||||
}
|
}
|
||||||
return 1024000
|
return 1024000
|
||||||
},
|
},
|
||||||
|
|
||||||
readEnabled() {
|
readEnabled({msgPreparedStatus, listPreparedStatus}) {
|
||||||
return this.msgPreparedStatus && this.listPreparedStatus
|
return msgPreparedStatus && listPreparedStatus
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1089,6 +1091,7 @@ export default {
|
|||||||
this.msgType = ''
|
this.msgType = ''
|
||||||
this.searchShow = false
|
this.searchShow = false
|
||||||
this.unreadMsgId = 0
|
this.unreadMsgId = 0
|
||||||
|
this.positionShow = false
|
||||||
this.firstMsgLength = this.allMsgList.length || 1
|
this.firstMsgLength = this.allMsgList.length || 1
|
||||||
this.listPreparedStatus = false
|
this.listPreparedStatus = false
|
||||||
this.scrollToBottomAndRefresh = false
|
this.scrollToBottomAndRefresh = false
|
||||||
@ -1339,6 +1342,10 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
readReqNum() {
|
||||||
|
this.positionShow = true
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
14
resources/assets/js/store/actions.js
vendored
14
resources/assets/js/store/actions.js
vendored
@ -2992,15 +2992,15 @@ export default {
|
|||||||
if (data.userid == state.userId) return;
|
if (data.userid == state.userId) return;
|
||||||
if (data.read_at) return;
|
if (data.read_at) return;
|
||||||
data.read_at = $A.formatDate();
|
data.read_at = $A.formatDate();
|
||||||
state.wsReadWaitData[data.id] = data.id;
|
state.readWaitData[data.id] = data.id;
|
||||||
}
|
}
|
||||||
clearTimeout(state.wsReadTimeout);
|
clearTimeout(state.readTimeout);
|
||||||
state.wsReadTimeout = setTimeout(_ => {
|
state.readTimeout = setTimeout(_ => {
|
||||||
if (state.userId === 0) {
|
if (state.userId === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const ids = Object.values(state.wsReadWaitData);
|
const ids = Object.values(state.readWaitData);
|
||||||
state.wsReadWaitData = {};
|
state.readWaitData = {};
|
||||||
if (ids.length === 0) {
|
if (ids.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -3014,8 +3014,10 @@ export default {
|
|||||||
dispatch("saveDialog", data)
|
dispatch("saveDialog", data)
|
||||||
}).catch(_ => {
|
}).catch(_ => {
|
||||||
ids.some(id => {
|
ids.some(id => {
|
||||||
state.wsReadWaitData[id] = id;
|
state.readWaitData[id] = id;
|
||||||
})
|
})
|
||||||
|
}).finally(_ => {
|
||||||
|
state.readReqNum++
|
||||||
});
|
});
|
||||||
}, 50);
|
}, 50);
|
||||||
},
|
},
|
||||||
|
|||||||
7
resources/assets/js/store/state.js
vendored
7
resources/assets/js/store/state.js
vendored
@ -98,8 +98,6 @@ export default {
|
|||||||
wsRandom: 0,
|
wsRandom: 0,
|
||||||
wsOpenNum: 0,
|
wsOpenNum: 0,
|
||||||
wsListener: {},
|
wsListener: {},
|
||||||
wsReadTimeout: null,
|
|
||||||
wsReadWaitData: {},
|
|
||||||
|
|
||||||
// 会员信息
|
// 会员信息
|
||||||
userInfo: {},
|
userInfo: {},
|
||||||
@ -125,6 +123,11 @@ export default {
|
|||||||
// 搜索关键词(主要用于移动端判断滑动返回)
|
// 搜索关键词(主要用于移动端判断滑动返回)
|
||||||
messengerSearchKey: {dialog: '', contacts: ''},
|
messengerSearchKey: {dialog: '', contacts: ''},
|
||||||
|
|
||||||
|
// 阅读消息
|
||||||
|
readReqNum: 0,
|
||||||
|
readTimeout: null,
|
||||||
|
readWaitData: {},
|
||||||
|
|
||||||
// 文件
|
// 文件
|
||||||
fileLists: [],
|
fileLists: [],
|
||||||
fileLinks: [],
|
fileLinks: [],
|
||||||
|
|||||||
@ -1449,7 +1449,7 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateX(100%);
|
transform: translateX(100%);
|
||||||
animation: position-in-animation 200ms ease-out forwards;
|
animation: position-in-animation 200ms ease-out forwards;
|
||||||
animation-delay: 600ms;
|
animation-delay: 100ms;
|
||||||
|
|
||||||
.position-label {
|
.position-label {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user