处理@显示、链接跳转、免打扰数量统计等问题
Some checks are pending
Check / lint (push) Waiting to run
Check / typecheck (push) Waiting to run
Check / build (build, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build, 18.x, windows-latest) (push) Waiting to run
Check / build (build:app, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:app, 18.x, windows-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Waiting to run
Some checks are pending
Check / lint (push) Waiting to run
Check / typecheck (push) Waiting to run
Check / build (build, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build, 18.x, windows-latest) (push) Waiting to run
Check / build (build:app, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:app, 18.x, windows-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Waiting to run
This commit is contained in:
parent
3642d3e2fa
commit
1f4c5ba6df
@ -1,5 +1,9 @@
|
|||||||
import request from '@/service/index.js'
|
import request from '@/service/index.js'
|
||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
|
import {
|
||||||
|
useTalkStore,
|
||||||
|
useDialogueStore
|
||||||
|
} from '@/store'
|
||||||
|
|
||||||
// 获取聊天列表服务接口
|
// 获取聊天列表服务接口
|
||||||
export const ServeGetTalkList = (data) => {
|
export const ServeGetTalkList = (data) => {
|
||||||
@ -40,6 +44,7 @@ export const ServeTopTalkList = (data) => {
|
|||||||
// 清除聊天消息未读数服务接口
|
// 清除聊天消息未读数服务接口
|
||||||
export const ServeClearTalkUnreadNum = (data, unReadNum) => {
|
export const ServeClearTalkUnreadNum = (data, unReadNum) => {
|
||||||
console.log('=======chatApp==UnreadNum', unReadNum)
|
console.log('=======chatApp==UnreadNum', unReadNum)
|
||||||
|
if(!useTalkStore().items[useTalkStore().findTalkIndex(useDialogueStore().index_name)].is_disturb){
|
||||||
if (typeof plus !== 'undefined') {
|
if (typeof plus !== 'undefined') {
|
||||||
let OAWebView = plus.webview.all()
|
let OAWebView = plus.webview.all()
|
||||||
OAWebView.forEach((webview) => {
|
OAWebView.forEach((webview) => {
|
||||||
@ -57,6 +62,7 @@ export const ServeClearTalkUnreadNum = (data, unReadNum) => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return request({
|
return request({
|
||||||
url: '/api/v1/talk/unread/clear',
|
url: '/api/v1/talk/unread/clear',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
@ -15,7 +15,7 @@ const float = props.data.float
|
|||||||
|
|
||||||
const textContent = computed(() => {
|
const textContent = computed(() => {
|
||||||
let text = props.extra?.content || ''
|
let text = props.extra?.content || ''
|
||||||
text = textReplaceLink(text)
|
// text = textReplaceLink(text)
|
||||||
if (props.data.talk_type == 2) {
|
if (props.data.talk_type == 2) {
|
||||||
text = textReplaceMention(text, '#1890ff')
|
text = textReplaceMention(text, '#1890ff')
|
||||||
}
|
}
|
||||||
|
@ -307,6 +307,19 @@ class Talk extends Base {
|
|||||||
msg_text: this.getTalkText(),
|
msg_text: this.getTalkText(),
|
||||||
updated_at: parseTime(new Date()),
|
updated_at: parseTime(new Date()),
|
||||||
})
|
})
|
||||||
|
//收到新消息时,同时判断是否有人@我
|
||||||
|
if (
|
||||||
|
this.resource.msg_type === 1 &&
|
||||||
|
this.resource?.extra?.mentions?.length > 0
|
||||||
|
) {
|
||||||
|
const findMention = this.resource?.extra?.mentions?.find(
|
||||||
|
(mention) => mention === this.getAccountId(),
|
||||||
|
)
|
||||||
|
//有人@我,则更新会话列表
|
||||||
|
if (findMention) {
|
||||||
|
useTalkStore().loadTalkList()
|
||||||
|
}
|
||||||
|
}
|
||||||
if (this.resource.msg_type == 1116) {
|
if (this.resource.msg_type == 1116) {
|
||||||
// 更新会话列表中的会话信息
|
// 更新会话列表中的会话信息
|
||||||
const dialogue = useDialogueListStore().getDialogueList(
|
const dialogue = useDialogueListStore().getDialogueList(
|
||||||
|
@ -139,6 +139,9 @@ const photoActionsSelect = (index) => {
|
|||||||
filter: 'image',
|
filter: 'image',
|
||||||
maximum: 9,
|
maximum: 9,
|
||||||
multiple: true,
|
multiple: true,
|
||||||
|
onmaxed: () => {
|
||||||
|
plus.nativeUI.toast('最多只能选择9张图片')
|
||||||
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -568,6 +568,10 @@ const state = ref({
|
|||||||
lastCursorIndex: undefined, //在失焦前保存光标位置
|
lastCursorIndex: undefined, //在失焦前保存光标位置
|
||||||
mentionUserIds: [], //存储所有被@的用户ID
|
mentionUserIds: [], //存储所有被@的用户ID
|
||||||
isInsertingMention: false, //是否正在插入mention
|
isInsertingMention: false, //是否正在插入mention
|
||||||
|
showMentionSelectTimer: null, //显示提醒选择框的定时器
|
||||||
|
lastMentionText: '', // 记录上一次触发@时的完整文本内容
|
||||||
|
lastMentionTriggered: false, // 记录当前@是否已经触发过
|
||||||
|
lastMentionPosition: -1, // 添加新的状态来记录上一次@的位置
|
||||||
})
|
})
|
||||||
|
|
||||||
uniOnload(async (options) => {
|
uniOnload(async (options) => {
|
||||||
@ -595,10 +599,13 @@ uniOnload(async (options) => {
|
|||||||
})
|
})
|
||||||
uniOnUnload(() => {
|
uniOnUnload(() => {
|
||||||
console.log('onUnload')
|
console.log('onUnload')
|
||||||
ServeClearTalkUnreadNum({
|
ServeClearTalkUnreadNum(
|
||||||
|
{
|
||||||
talk_type: Number(talkParams.type),
|
talk_type: Number(talkParams.type),
|
||||||
receiver_id: Number(talkParams.receiver_id),
|
receiver_id: Number(talkParams.receiver_id),
|
||||||
},talkParams.unReadNum).then(() => {
|
},
|
||||||
|
talkParams.unReadNum,
|
||||||
|
).then(() => {
|
||||||
talkStore.updateItem({
|
talkStore.updateItem({
|
||||||
index_name: talkParams.index_name,
|
index_name: talkParams.index_name,
|
||||||
unread_num: 0,
|
unread_num: 0,
|
||||||
@ -624,6 +631,8 @@ const handleHidePanel = () => {
|
|||||||
//点击编辑区聚焦输入框
|
//点击编辑区聚焦输入框
|
||||||
const onEditorClick = () => {
|
const onEditorClick = () => {
|
||||||
handleHidePanel()
|
handleHidePanel()
|
||||||
|
const quill = getQuill()
|
||||||
|
quill.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
const onSendMessage = (data = {}, callBack) => {
|
const onSendMessage = (data = {}, callBack) => {
|
||||||
@ -889,9 +898,9 @@ const editorOption = {
|
|||||||
if (range) {
|
if (range) {
|
||||||
state.value.lastCursorIndex = range.index
|
state.value.lastCursorIndex = range.index
|
||||||
}
|
}
|
||||||
state.value.isShowMentionSelect = true
|
|
||||||
// 失去焦点
|
// 使用防抖函数
|
||||||
quill.blur()
|
showMentionSelectDebounced(quill)
|
||||||
},
|
},
|
||||||
mentionContainerClass: '',
|
mentionContainerClass: '',
|
||||||
},
|
},
|
||||||
@ -1600,7 +1609,42 @@ onUnmounted(() => {
|
|||||||
if (avatarPressTimer) {
|
if (avatarPressTimer) {
|
||||||
clearTimeout(avatarPressTimer)
|
clearTimeout(avatarPressTimer)
|
||||||
}
|
}
|
||||||
|
// 清理防抖定时器
|
||||||
|
if (state.value.showMentionSelectTimer) {
|
||||||
|
clearTimeout(state.value.showMentionSelectTimer)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 修改防抖函数的实现
|
||||||
|
const showMentionSelectDebounced = (quill) => {
|
||||||
|
const text = quill.getText()
|
||||||
|
// 如果文本内容与上次不同,重置触发状态
|
||||||
|
console.log(
|
||||||
|
'lastMentionText',
|
||||||
|
state.value.lastMentionText,
|
||||||
|
state.value.lastMentionText.length,
|
||||||
|
)
|
||||||
|
console.log('text', text, text.length)
|
||||||
|
console.log(state.value.lastMentionTriggered)
|
||||||
|
if (text !== state.value.lastMentionText) {
|
||||||
|
state.value.lastMentionTriggered = false
|
||||||
|
}
|
||||||
|
if (text.length === 2) {
|
||||||
|
state.value.lastMentionText = text
|
||||||
|
state.value.lastMentionTriggered = true
|
||||||
|
state.value.isShowMentionSelect = true
|
||||||
|
}
|
||||||
|
// 如果已经触发过,则不再触发
|
||||||
|
if (state.value.lastMentionTriggered) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 记录当前文本内容和触发状态
|
||||||
|
state.value.lastMentionText = text
|
||||||
|
state.value.lastMentionTriggered = true
|
||||||
|
state.value.isShowMentionSelect = true
|
||||||
|
quill.blur()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.dialog-page {
|
.dialog-page {
|
||||||
|
@ -128,7 +128,7 @@ export const useDialogueStore = defineStore('dialogue', {
|
|||||||
this.unreadNum = data?.unread_num || 0
|
this.unreadNum = data?.unread_num || 0
|
||||||
|
|
||||||
this.members = []
|
this.members = []
|
||||||
if (data.talk_type == 2) {
|
if (data.talk_type == 2 && !data.is_dismiss && !data.is_quit) {
|
||||||
this.updateGroupMembers()
|
this.updateGroupMembers()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user