Compare commits

..

No commits in common. "6c63946d37692ce0cec7d8551c9e636c1373eee5" and "111f303b2afbafe114bd7baba8d4e4f8d3e9bbd2" have entirely different histories.

11 changed files with 52 additions and 101 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -50,12 +50,13 @@ const dropdown=ref({
options:[] as any,
item:{} as ITalkRecord,
})
const onConvertText = async (data: ITalkRecord) => {
const onConvertText =async (data: ITalkRecord) => {
data.is_convert_text = 1
const res = await voiceToText({ msgId: data.msg_id, voiceUrl: data.extra.url })
if (res.code == 200) {
const res = await voiceToText({msgId:data.msg_id,voiceUrl:data.extra.url})
if(res.code == 200){
data.extra.content = res.data.convText
}else data.is_convert_text = 0
}
}
const onloseConvertText=(data: ITalkRecord)=>{
data.is_convert_text = 0

View File

@ -1,14 +1,7 @@
<script lang="ts" setup>
import { ref, reactive, computed } from 'vue'
import { ref, reactive } from 'vue'
import { PlayOne, PauseOne } from '@icon-park/vue-next'
import { ITalkRecordExtraAudio, ITalkRecord } from '@/types/chat'
import { onClickOutside } from '@vueuse/core'
import { useTemplateRef } from 'vue'
import yuyin from "@/assets/image/yuyin.png"
import yuyin1 from "@/assets/image/yuyin1.png"
import bofang from "@/assets/image/bofang.png"
import bofang1 from "@/assets/image/bofang1.png"
const props = defineProps<{
extra: ITalkRecordExtraAudio
@ -29,22 +22,15 @@ const state = reactive({
showText: false
})
const target = useTemplateRef<HTMLElement>('target')
const onPlay = () => {
if (state.isAudioPlay) {
audioRef.value.pause()
state.isAudioPlay = false
} else {
audioRef.value.play()
state.isAudioPlay = true
onClickOutside(target, () => {
console.log('点击了外部区域')
audioRef.value.pause() //
state.isAudioPlay = false
})
}
}
state.isAudioPlay = !state.isAudioPlay
}
const onPlayEnd = () => {
state.isAudioPlay = false
@ -84,18 +70,10 @@ const formatTime = (value: number = 0) => {
return `${Math.floor(value)}"`
}
const right = computed(() => props.data.float === 'right')
</script>
<template>
<div
class="pointer w-200px bg-#F3F4FD rounded-10px px-11px"
:class="{
'!bg-[var(--im-message-right-bg-color)] !text-[var(--im-message-right-text-color)]': right
}"
@click.stop="onPlay"
ref="target"
>
<div class="im-message-audio h-44px" :class="{ right }">
<div class="pointer w-200px bg-#F3F4FD rounded-10px px-11px">
<div class="im-message-audio h-44px">
<aTrumpet :isPlay="false" color="black" :size="30"></aTrumpet>
<audio
ref="audioRef"
@ -109,16 +87,15 @@ const right = computed(() => props.data.float === 'right')
/>
<div class="play">
<div class="btn pointer">
<div class="btn pointer" @click.stop="onPlay">
<!-- <n-icon :size="18" :component="state.isAudioPlay ? PauseOne : PlayOne" /> -->
<img
v-if="!state.isAudioPlay"
:src="right ? yuyin1 : yuyin"
src="@/assets/image/yuyin.png"
class="w-[16px] h-[16px]"
alt=""
:style="{ transform: right && 'rotate(180deg)' }"
/>
<img v-else :src="right ? bofang1 : bofang" class="w-[16px] h-[16px]" alt="" />
<img v-else src="@/assets/image/bofang.png" class="w-[16px] h-[16px]" alt="" />
</div>
</div>
<!-- <div class="desc">
@ -152,9 +129,6 @@ const right = computed(() => props.data.float === 'right')
</div>
</template>
<style lang="less" scoped>
.right {
flex-direction: row-reverse !important;
}
.im-message-audio {
--audio-bg-color: #f5f5f5;
--audio-btn-bg-color: #ffffff;

View File

@ -170,7 +170,7 @@ if(newVal){
<div class="w-260px h-517px rounded-4px border-1px border-solid border-#E5E5E5 px-12px">
<div class="border-b-2px border-b-solid border-b-#FBFBFB h-35px flex items-center justify-end">
<n-button text color="#46299D" class="text-14px" @click="changeSelectType">
{{ selectType === 1 ? '多选' : '取消多选' }}
{{ selectType === 1 ? '多选' : '选' }}
</n-button>
</div>
<div>
@ -190,10 +190,9 @@ if(newVal){
:customStyle="{width:'42px',height:'42px'}"></avatarModule>
<!-- <n-image class="w-42px h-42px rounded-full" :src="item.avatar" /> -->
</div>
<div class="flex items-center overflow-hidden flex">
<div class="flex items-center">
<span class="text-ellipsis">{{ item.name }}</span>
<!-- <span v-if="item.type == 2" class="badge group ml-2"></span> -->
<span v-if="item.talk_type === 2" class="flex-shrink-0">{{ `(${item.group_member_num})` }}</span>
<span v-if="item.type == 2" class="badge group ml-2"></span>
</div>
</div>
</template>
@ -218,10 +217,9 @@ if(newVal){
:groupType="item.group_type"
:customStyle="{width:'42px',height:'42px'}"></avatarModule>
</div>
<div class="flex items-center overflow-hidden flex">
<div class="flex items-center">
<span class="text-ellipsis">{{ item.name }}</span>
<!-- <span v-if="item.type == 2" class="badge group ml-2"></span> -->
<span v-if="item.talk_type === 2" class="flex-shrink-0">{{ `(${item.group_member_num})` }}</span>
<span v-if="item.type == 2" class="badge group ml-2"></span>
</div>
<n-button class="ml-auto" text color="#C7C7C9" @click="onRemoveContact(item)">
<n-icon :component="CloseCircle" size="18" />

View File

@ -259,16 +259,10 @@ class Talk extends Base {
updated_at: parseTime(new Date())
})
if (this.getAccountId() !== this.sender_id) {
if (this.talk_type == 1 && this.getAccountId() !== this.sender_id) {
ServeClearTalkUnreadNum({
talk_type: this.talk_type,
receiver_id: this.talk_type == 1 ? this.sender_id : this.receiver_id
}).then(() => {
useTalkStore().updateItem({
index_name: item.index_name,
unread_num: 0,
atsign_num: 0
})
talk_type: 1,
receiver_id: this.sender_id
})
}
}

View File

@ -77,11 +77,11 @@ export function useSessionMenu() {
// key: 'delete_contact'
// })
} else {
// options.push({
options.push({
// label: '退出群聊',
// key: 'signout_group'
// })
label: '退出群聊',
key: 'signout_group'
})
}
dropdown.options = [...options]

View File

@ -150,7 +150,7 @@ export const useUploadsStore = defineStore('uploads', {
}
} catch (error) {
console.error("初始化分片上传失败:", error);
message.error("上传失败,请重试")
message.error("初始化上传失败,请重试")
this.handleUploadError(upload_id, clientUploadId)
}
},

View File

@ -325,7 +325,7 @@ const onConvertText = async (data: ITalkRecord) => {
const res = await voiceToText({ msgId: data.msg_id, voiceUrl: data.extra.url })
if (res.code == 200) {
data.extra.content = res.data.convText
} else data.is_convert_text = 0
}
}
const onloseConvertText = (data: ITalkRecord) => {
data.is_convert_text = 0
@ -354,10 +354,6 @@ const onRowClick = (item: ITalkRecord) => {
if (!isOneMonthBefore(item.created_at.split(' ')[0])) {
return useMessage.info('只支持转发近一个月内的消息')
}
//
if ([4, 13].includes(item.msg_type)) {
return useMessage.info('语音消息和群公告不支持转发')
}
console.log('item.msg_type', item.msg_type)
if (ForwardableMessageType.includes(item.msg_type)) {
item.isCheck = !item.isCheck
@ -439,15 +435,12 @@ const retry = (item: any) => {
confirmBox({
content: '确定重发吗'
}).then(() => {
item.extra.percentage = 0
uploadsStore.retryCommonUpload(item.extra.upload_id)
})
}
const onContextMenuAvatar = (e: any, item: any) => {
e.preventDefault()
// @
if (+props.talk_type === 1) return
if (item.float !== 'right') {
bus.emit(EditorConst.Mention, {
id: item.user_id,
@ -847,7 +840,7 @@ const onCustomSkipBottomEvent = () => {
<!-- 近一个月外的消息多选框禁用 {{ item }} -->
<n-checkbox
size="small"
:disabled="!isOneMonthBefore(item.created_at.split(' ')[0]) || [4, 13].includes(item.msg_type)"
:disabled="!isOneMonthBefore(item.created_at.split(' ')[0])"
:checked="item.isCheck"
@update:checked="item.isCheck = !item.isCheck"
/>
@ -947,13 +940,7 @@ const onCustomSkipBottomEvent = () => {
</div>
<!-- 已读回执 -->
<!-- item.user_id:发送这条消息的人id -->
<!-- props.uid:当前登录人id -->
<!-- props.receiver_id:当前消息要发送的人id -->
<div
class="talk_read_num"
v-if="item.user_id === props.uid && props.uid !== props.receiver_id"
>
<div class="talk_read_num" v-if="item.user_id === props.uid">
<span v-if="props.talk_type === 1">{{
item.read_total_num > 0 ? '已读' : '未读'
}}</span>

View File

@ -66,7 +66,7 @@ const onSendMessage = (data = {}, callBack: any) => {
if (code == 200) {
callBack(true)
} else {
// window['$message'].warning(message || msg)
window['$message'].warning(message || msg)
}
})
.catch(() => {

View File

@ -71,14 +71,11 @@ export function useMenu() {
dropdown.options.push({ label: '复制', key: 'copy' })
}
if (isOneMonthBefore(new Date(item.created_at.split(' ')[0])) && ![4,13].includes(item.msg_type)) {
// 根据时间判断只有近一个月内的消息才能支持多选 // 语音消息和群公告不支持转发
if (isOneMonthBefore(new Date(item.created_at.split(' ')[0]))) {
// 根据时间判断只有近一个月内的消息才能支持多选
dropdown.options.push({ label: '多选', key: 'multiSelect' })
}
if (isOneMonthBefore(new Date(item.created_at.split(' ')[0]))) {
// 根据时间判断只有近一个月内的消息才能支持引用
dropdown.options.push({ label: '引用', key: 'quote' })
}
if (canAddRevokeOption(uid, item, (dialogueStore.groupInfo as any).is_manager)) {
dropdown.options.push({ label: '撤回', key: 'revoke' });
}