Merge branch 'wyfMain-dev'
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:
commit
2676e70c0c
@ -109,7 +109,7 @@ class Talk extends Base {
|
|||||||
// useSettingsStore().isPromptTone && palyMusic()
|
// useSettingsStore().isPromptTone && palyMusic()
|
||||||
}
|
}
|
||||||
|
|
||||||
handle() {
|
async handle() {
|
||||||
// 不是自己发送的消息则需要播放提示音
|
// 不是自己发送的消息则需要播放提示音
|
||||||
if (!this.isCurrSender()) {
|
if (!this.isCurrSender()) {
|
||||||
this.play()
|
this.play()
|
||||||
@ -117,8 +117,19 @@ class Talk extends Base {
|
|||||||
|
|
||||||
// 判断会话列表是否存在,不存在则创建
|
// 判断会话列表是否存在,不存在则创建
|
||||||
if (useTalkStore().findTalkIndex(this.getIndexName()) == -1) {
|
if (useTalkStore().findTalkIndex(this.getIndexName()) == -1) {
|
||||||
|
if (this.resource.msg_type == 1106) {
|
||||||
|
//群解散时,需要热更新会话列表
|
||||||
|
await useTalkStore().loadTalkList()
|
||||||
|
} else if (
|
||||||
|
this.resource.msg_type == 1104 ||
|
||||||
|
this.resource.msg_type == 1115
|
||||||
|
) {
|
||||||
|
//群成员被移出时,需要热更新会话列表
|
||||||
|
await useTalkStore().loadTalkList()
|
||||||
|
} else {
|
||||||
return this.addTalkItem()
|
return this.addTalkItem()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 判断当前是否正在和好友对话
|
// 判断当前是否正在和好友对话
|
||||||
if (this.isTalk(this.talk_type, this.receiver_id, this.sender_id)) {
|
if (this.isTalk(this.talk_type, this.receiver_id, this.sender_id)) {
|
||||||
|
@ -206,6 +206,12 @@ const onUploadImageVideo = async (file, type = 'image', fileUrl) => {
|
|||||||
uploadImg(form, (e) => onProgressFn(e, randomId)).then(
|
uploadImg(form, (e) => onProgressFn(e, randomId)).then(
|
||||||
({ status, data, msg }) => {
|
({ status, data, msg }) => {
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
|
// 更新上传状态为成功
|
||||||
|
const index = virtualList.value.findIndex(item => item.file_num === randomId)
|
||||||
|
if (index !== -1) {
|
||||||
|
virtualList.value[index].uploadStatus = 2
|
||||||
|
virtualList.value[index].uploadCurrent = 100
|
||||||
|
}
|
||||||
resolve({
|
resolve({
|
||||||
type: 'image',
|
type: 'image',
|
||||||
url: data.ori_url,
|
url: data.ori_url,
|
||||||
@ -215,6 +221,11 @@ const onUploadImageVideo = async (file, type = 'image', fileUrl) => {
|
|||||||
file_num: randomId,
|
file_num: randomId,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
// 更新上传状态为失败
|
||||||
|
const index = virtualList.value.findIndex(item => item.file_num === randomId)
|
||||||
|
if (index !== -1) {
|
||||||
|
virtualList.value[index].uploadStatus = 3
|
||||||
|
}
|
||||||
resolve('')
|
resolve('')
|
||||||
message.error(msg)
|
message.error(msg)
|
||||||
}
|
}
|
||||||
@ -261,6 +272,12 @@ const onUploadImageVideo = async (file, type = 'image', fileUrl) => {
|
|||||||
uploadImg(form, (e) => onProgressFn(e, randomId)).then(
|
uploadImg(form, (e) => onProgressFn(e, randomId)).then(
|
||||||
({ status, data, msg }) => {
|
({ status, data, msg }) => {
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
|
// 更新上传状态为成功
|
||||||
|
const index = virtualList.value.findIndex(item => item.file_num === randomId)
|
||||||
|
if (index !== -1) {
|
||||||
|
virtualList.value[index].uploadStatus = 2
|
||||||
|
virtualList.value[index].uploadCurrent = 100
|
||||||
|
}
|
||||||
console.log(data)
|
console.log(data)
|
||||||
resolve({
|
resolve({
|
||||||
type: 'video',
|
type: 'video',
|
||||||
@ -271,8 +288,13 @@ const onUploadImageVideo = async (file, type = 'image', fileUrl) => {
|
|||||||
file_num: randomId,
|
file_num: randomId,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// resolve('')
|
// 更新上传状态为失败
|
||||||
// message.error(msg)
|
const index = virtualList.value.findIndex(item => item.file_num === randomId)
|
||||||
|
if (index !== -1) {
|
||||||
|
virtualList.value[index].uploadStatus = 3
|
||||||
|
}
|
||||||
|
resolve('')
|
||||||
|
message.error(msg)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -456,7 +478,23 @@ const chooseFile = () => {
|
|||||||
uploadStatus: 1, // 1 上传中 2 上传成功 3 上传失败
|
uploadStatus: 1, // 1 上传中 2 上传成功 3 上传失败
|
||||||
}
|
}
|
||||||
virtualList.value.unshift(newItem)
|
virtualList.value.unshift(newItem)
|
||||||
uploadsStore.initUploadFile(res.tempFiles[0], props.talkParams, randomId)
|
uploadsStore.initUploadFile(res.tempFiles[0], props.talkParams, randomId, (status, data, msg) => {
|
||||||
|
if (status === 0) {
|
||||||
|
// 更新上传状态为成功
|
||||||
|
const index = virtualList.value.findIndex(item => item.file_num === randomId)
|
||||||
|
if (index !== -1) {
|
||||||
|
virtualList.value[index].uploadStatus = 2
|
||||||
|
virtualList.value[index].uploadCurrent = 100
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 更新上传状态为失败
|
||||||
|
const index = virtualList.value.findIndex(item => item.file_num === randomId)
|
||||||
|
if (index !== -1) {
|
||||||
|
virtualList.value[index].uploadStatus = 3
|
||||||
|
}
|
||||||
|
message.error(msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,14 @@
|
|||||||
@scrolltoupper="onScrollToUpper"
|
@scrolltoupper="onScrollToUpper"
|
||||||
>
|
>
|
||||||
<template #top>
|
<template #top>
|
||||||
<customNavbar :title="talkParams.username" id="navBarArea">
|
<customNavbar
|
||||||
|
:title="talkParams.username"
|
||||||
|
id="navBarArea"
|
||||||
|
:hideBack="dialogueStore.isOpenMultiSelect"
|
||||||
|
>
|
||||||
|
<template #left v-if="dialogueStore.isOpenMultiSelect">
|
||||||
|
<text class="ml-[36rpx]" @click="dialogueStore.isOpenMultiSelect = false">取消</text>
|
||||||
|
</template>
|
||||||
<template
|
<template
|
||||||
#subTitle
|
#subTitle
|
||||||
v-if="talkStore?.findItem(talkParams.index_name)?.group_type === 4"
|
v-if="talkStore?.findItem(talkParams.index_name)?.group_type === 4"
|
||||||
@ -310,13 +317,13 @@
|
|||||||
<tm-image :width="68" :height="68" :src="zu6051"></tm-image>
|
<tm-image :width="68" :height="68" :src="zu6051"></tm-image>
|
||||||
<div class="mt-[6rpx]">逐条转发</div>
|
<div class="mt-[6rpx]">逐条转发</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<!-- <div
|
||||||
@click="handleWechatForward"
|
@click="handleWechatForward"
|
||||||
class="flex flex-col items-center justify-center"
|
class="flex flex-col items-center justify-center"
|
||||||
>
|
>
|
||||||
<tm-image :width="68" :height="68" :src="zu6052"></tm-image>
|
<tm-image :width="68" :height="68" :src="zu6052"></tm-image>
|
||||||
<div class="mt-[6rpx]">微信</div>
|
<div class="mt-[6rpx]">微信</div>
|
||||||
</div>
|
</div> -->
|
||||||
<div
|
<div
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
class="flex flex-col items-center justify-center"
|
class="flex flex-col items-center justify-center"
|
||||||
@ -1346,9 +1353,12 @@ const getMentionSelectLists = (mentionSelectList) => {
|
|||||||
|
|
||||||
// 逐个插入mention
|
// 逐个插入mention
|
||||||
mentionSelectList.forEach((mentionSelectItem) => {
|
mentionSelectList.forEach((mentionSelectItem) => {
|
||||||
|
// 如果是@所有人,确保 id 为 0
|
||||||
|
const id =
|
||||||
|
mentionSelectItem?.nickname === '所有人' ? 0 : mentionSelectItem?.id
|
||||||
mention.insertItem(
|
mention.insertItem(
|
||||||
{
|
{
|
||||||
id: mentionSelectItem?.id,
|
id: id,
|
||||||
denotationChar: '@',
|
denotationChar: '@',
|
||||||
value: mentionSelectItem?.nickname + ' ',
|
value: mentionSelectItem?.nickname + ' ',
|
||||||
},
|
},
|
||||||
@ -1382,11 +1392,19 @@ const updateMentionUserIds = () => {
|
|||||||
// 收集当前所有@的用户ID,并转换为number类型
|
// 收集当前所有@的用户ID,并转换为number类型
|
||||||
ops.forEach((op) => {
|
ops.forEach((op) => {
|
||||||
if (op.insert && op.insert.mention) {
|
if (op.insert && op.insert.mention) {
|
||||||
currentMentions.add(Number(op.insert.mention.id))
|
const id = Number(op.insert.mention.id)
|
||||||
|
// 过滤掉 null 值
|
||||||
|
if (!isNaN(id)) {
|
||||||
|
currentMentions.add(id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 直接使用当前编辑器中的mentions作为mentionUserIds
|
// 直接使用当前编辑器中的mentions作为mentionUserIds
|
||||||
|
// 如果当前有@所有人,或者没有任何@,则添加0
|
||||||
|
if (currentMentions.has(0) || currentMentions.size === 0) {
|
||||||
|
currentMentions.add(0)
|
||||||
|
}
|
||||||
state.value.mentionUserIds = Array.from(currentMentions)
|
state.value.mentionUserIds = Array.from(currentMentions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 && !data.is_dismiss && !data.is_quit) {
|
if (data.talk_type == 2 && !this.isDismiss && !this.isQuit) {
|
||||||
this.updateGroupMembers()
|
this.updateGroupMembers()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -141,6 +141,8 @@ export const useDialogueListStore = createGlobalState(() => {
|
|||||||
...virtualList.value[index], // 保留原有不需要修改的字段
|
...virtualList.value[index], // 保留原有不需要修改的字段
|
||||||
...item, // 覆盖需要更新的字段
|
...item, // 覆盖需要更新的字段
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
zpagingRef.value?.addChatRecordData(item, false, false)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
zpagingRef.value?.addChatRecordData(item, false, false)
|
zpagingRef.value?.addChatRecordData(item, false, false)
|
||||||
|
@ -91,7 +91,19 @@ export const useUploadsStore = defineStore('uploads', {
|
|||||||
|
|
||||||
item.status = 1
|
item.status = 1
|
||||||
|
|
||||||
ServeFileSubareaUpload(form)
|
// 开始上传时就更新进度
|
||||||
|
const currentPercentage = (item.uploadIndex / item.files.length) * 100
|
||||||
|
item.percentage = currentPercentage.toFixed(1)
|
||||||
|
updateUploadProgress(msgId, currentPercentage)
|
||||||
|
|
||||||
|
ServeFileSubareaUpload(form, (progressEvent) => {
|
||||||
|
// 计算当前分片的进度
|
||||||
|
const currentChunkProgress = (progressEvent.loaded / progressEvent.total) * 100
|
||||||
|
// 计算总体进度:已完成分片 + 当前分片的进度
|
||||||
|
const totalProgress = ((item.uploadIndex + currentChunkProgress / 100) / item.files.length) * 100
|
||||||
|
item.percentage = totalProgress.toFixed(1)
|
||||||
|
updateUploadProgress(msgId, totalProgress)
|
||||||
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
item.uploadIndex++
|
item.uploadIndex++
|
||||||
@ -103,21 +115,36 @@ export const useUploadsStore = defineStore('uploads', {
|
|||||||
|
|
||||||
updateUploadProgress(msgId,100)
|
updateUploadProgress(msgId,100)
|
||||||
this.sendUploadMessage(item, msgId)
|
this.sendUploadMessage(item, msgId)
|
||||||
} else {
|
|
||||||
const percentage = (item.uploadIndex / item.files.length) * 100
|
|
||||||
item.percentage = percentage.toFixed(1)
|
|
||||||
console.log(msgId,'msgId');
|
|
||||||
console.log(percentage,'percentage');
|
|
||||||
|
|
||||||
updateUploadProgress(msgId,percentage)
|
// 更新虚拟列表中的状态
|
||||||
|
const { virtualList } = useDialogueListStore()
|
||||||
|
const index = virtualList.value.findIndex(item => item.file_num === msgId)
|
||||||
|
if (index !== -1) {
|
||||||
|
virtualList.value[index].uploadStatus = 2
|
||||||
|
virtualList.value[index].uploadCurrent = 100
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 继续上传下一个分片
|
||||||
this.triggerUpload(uploadId, msgId)
|
this.triggerUpload(uploadId, msgId)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item.status = 3
|
item.status = 3
|
||||||
|
// 更新虚拟列表中的状态为失败
|
||||||
|
const { virtualList } = useDialogueListStore()
|
||||||
|
const index = virtualList.value.findIndex(item => item.file_num === msgId)
|
||||||
|
if (index !== -1) {
|
||||||
|
virtualList.value[index].uploadStatus = 3
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
item.status = 3
|
item.status = 3
|
||||||
|
// 更新虚拟列表中的状态为失败
|
||||||
|
const { virtualList } = useDialogueListStore()
|
||||||
|
const index = virtualList.value.findIndex(item => item.file_num === msgId)
|
||||||
|
if (index !== -1) {
|
||||||
|
virtualList.value[index].uploadStatus = 3
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -104,6 +104,11 @@ export const upload = (url, data = {}, options = {}) => {
|
|||||||
url,
|
url,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data,
|
data: data,
|
||||||
|
onUploadProgress: (progressEvent) => {
|
||||||
|
if (options.onProgress) {
|
||||||
|
options.onProgress(progressEvent)
|
||||||
|
}
|
||||||
|
},
|
||||||
...options
|
...options
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user