Skip to content

Commit

Permalink
Merge pull request #17 from Angus2333/main
Browse files Browse the repository at this point in the history
Uniapp IMUIKit v10.2.0
  • Loading branch information
shine2008 authored Oct 31, 2024
2 parents aea5b8b + 5461b67 commit 7e557aa
Show file tree
Hide file tree
Showing 72 changed files with 2,864 additions and 597 deletions.
6 changes: 5 additions & 1 deletion NEUIKit/components/Icon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,15 @@ const urlMap = {
'icon-file':
'https://yx-web-nosdn.netease.im/common/90485f277f50fc081970ded8772ec7c5/file.png',
'icon-pin':
'https://yx-web-nosdn.netease.im/common/8874f30f648cde89dbbe9a59e9cb7f8a/pin.png',
'https://yx-web-nosdn.netease.im/common/6eb4fafcca008d2e93e90311696d6b96/black-pin.png',
'icon-green-pin':
'https://yx-web-nosdn.netease.im/common/4a1f15eff2f53563c4f1cf6ecde82d2c/green-pin.png',
'choose-picture':
'https://yx-web-nosdn.netease.im/common/97b3ca79a589d5753cbc0e8e8ec09501/choose-picture.png',
'icon-collection':
'https://yx-web-nosdn.netease.im/common/aa1bad3410009dea83d34d513dcd20f3/add-collection.png',
'blue-collection':
'https://yx-web-nosdn.netease.im/common/fb3836a8731b57720fcfdd3b589b3d5f/collection.png',
}
//以上链接访问有频率控制,建议您将静态放到您服务器上,然后修改上面的链接即可
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<div v-if="friendList.length > 0" class="friend-select-wrapper">
<div v-if="personList.length > 0" class="friend-select-wrapper">
<div class="member-wrapper">
<radio-group v-if="radio" @change="checkboxChange">
<div
class="member-item"
v-for="item in friendList"
v-for="item in personList"
:key="item.accountId"
>
<radio
Expand All @@ -19,14 +19,14 @@
/>
<Avatar class="user-avatar" size="36" :account="item.accountId" />
<div class="user-name">
<Appellation :account="item.accountId" />
<Appellation :account="item.accountId" :teamId="item.teamId" />
</div>
</div>
</radio-group>
<checkbox-group v-else @change="checkboxChange">
<div
class="member-item"
v-for="item in friendList"
v-for="item in personList"
:key="item.accountId"
>
<checkbox
Expand All @@ -41,7 +41,7 @@
/>
<Avatar class="user-avatar" size="36" :account="item.accountId" />
<div class="user-name">
<Appellation :account="item.accountId" />
<Appellation :account="item.accountId" :teamId="item.teamId" />
</div>
</div>
</checkbox-group>
Expand Down Expand Up @@ -72,15 +72,16 @@ import {
withDefaults,
} from '../utils/transformVue'
export type FriendSelectItem = {
export type PersonSelectItem = {
accountId: string
teamId?: string
disabled?: boolean
checked?: boolean
}
const props = withDefaults(
defineProps<{
friendList: FriendSelectItem[]
personList: PersonSelectItem[]
showBtn?: boolean
btnText?: string
radio?: boolean
Expand All @@ -97,7 +98,7 @@ const props = withDefaults(
const selectAccount = ref<string[]>([])
onMounted(() => {
selectAccount.value = props.friendList
selectAccount.value = props.personList
.filter((item) => item.checked)
.map((item) => item.accountId)
})
Expand Down
13 changes: 7 additions & 6 deletions NEUIKit/components/PinCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ const handlePinMsg = () => {
handleCopy()
} else if (data.tapIndex === 2) {
customNavigateTo({
url: `/pages/Chat/forward?forwardConversationType=${V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_TEAM}&msgIdClient=${props.msg.messageClientId}`,
url: `/pages/Chat/forward?forwardConversationType=${V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_TEAM}&msgIdClient=${props.msg.messageClientId}&origin=pin`,
})
} else if (data.tapIndex === 3) {
customNavigateTo({
url: `/pages/Chat/forward?forwardConversationType=${V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_P2P}&msgIdClient=${props.msg.messageClientId}`,
url: `/pages/Chat/forward?forwardConversationType=${V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_P2P}&msgIdClient=${props.msg.messageClientId}&origin=pin`,
})
}
} else if (
Expand All @@ -202,11 +202,11 @@ const handlePinMsg = () => {
props.handleUnPinMsg()
} else if (data.tapIndex === 1) {
customNavigateTo({
url: `/pages/Chat/forward?forwardConversationType=${V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_TEAM}&msgIdClient=${props.msg.messageClientId}`,
url: `/pages/Chat/forward?forwardConversationType=${V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_TEAM}&msgIdClient=${props.msg.messageClientId}&origin=pin`,
})
} else if (data.tapIndex === 2) {
customNavigateTo({
url: `/pages/Chat/forward?forwardConversationType=${V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_P2P}&msgIdClient=${props.msg.messageClientId}`,
url: `/pages/Chat/forward?forwardConversationType=${V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_P2P}&msgIdClient=${props.msg.messageClientId}&origin=pin`,
})
}
} else {
Expand Down Expand Up @@ -307,7 +307,7 @@ const timeFormat = () => {
}
.content-wrapper {
padding: 12px 16px 16px 16px;
word-wrap: break-word;
.file-wrapper {
position: relative;
width: 50%;
Expand Down Expand Up @@ -344,10 +344,11 @@ const timeFormat = () => {
transform: translate(-40%, -50%);
}
.audio-wrapper {
width: fit-content;
opacity: 1;
background: #d6e5f6;
overflow: hidden;
padding: 12px 16px;
padding: 10px 12px;
border-radius: 0 8px 8px 8px;
background-color: #e8eaed;
}
Expand Down
22 changes: 20 additions & 2 deletions NEUIKit/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ export default {
unpinText: 'Unmark',
unpinFailedText: 'Unmark Failed',
noPinListText: 'No Mark',
collectionText: 'Add collection',
deleteCollectionText: 'Delete collection',
addCollectionSuccessText: 'Add collection success',
addCollectionFailedText: 'Add collection Failed',
deleteCollectionFailedText: 'Delete collection Failed',
noCollectionsText: 'No collection',
teamBannedText: 'Message Banned',
you: 'You',
pinThisText: 'Marked this message',
Expand Down Expand Up @@ -190,7 +196,8 @@ export default {
removeBlacklist: 'Unblock',
forwardSuccessText: 'Forward Success',
forwardFailText: 'Forward Failed',
getMessageFailed: 'Fail to get message ',
getMessageFailed: 'Fail to get message',
getForwardMessageFailed: 'Fail to get forward message',
sendFailWithInBlackText:
'The other party has blocked you, message sending failed',
sendFailWithDeleteText:
Expand Down Expand Up @@ -223,8 +230,16 @@ export default {
unreadText: 'Unread',
fileText: 'file',
allUnReadText: 'All Unread',
msgRecallTimeErrorText: 'Message recall time exceeded',
allReadText: 'All Read',

searchText: 'Search',
searchTitleText: 'Search',
friendText: 'Friend',
teamText: 'Group',
searchResultNullText: 'User does not exist',
conversationSendFailText: '[Send Failed]',
conversationNotificationText: '[Notification]',
fileMsgTitleText: '[File Message]',
// emoji 不能随便填,要用固定 key
Laugh: '[Laugh]',
Happy: '[Happy]',
Expand Down Expand Up @@ -316,6 +331,9 @@ export default {
107320: 'PIN not exist',
107322: 'PIN already exist',
107327: 'PIN function disabled',
189301: 'collection limit exceeded',
189302: 'collection not exist',
189449: 'collection concurrent operation failed',
// 群相关
109432: 'no permission',
}
21 changes: 20 additions & 1 deletion NEUIKit/locale/zh-Hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ export default {
getMessageFailed: '获取消息失败',
replyText: '回复',
replyNotFindText: '该消息已撤回或删除',
msgRecallTimeErrorText: '已超过时间无法撤回',

forwardToTeamText: '转发到群组',
forwardToFriendText: '转发到个人',
sessionRecordText: '的会话记录',
Expand All @@ -132,6 +134,12 @@ export default {
unpinText: '取消标记',
unpinFailedText: '取消标记失败',
noPinListText: '暂无标记消息',
collectionText: '收藏',
deleteCollectionText: '删除收藏',
addCollectionSuccessText: '收藏成功',
addCollectionFailedText: '添加收藏失败',
deleteCollectionFailedText: '删除收藏失败',
noCollectionsText: '暂无收藏',
you: '你',
pinThisText: '标记了这条消息',
delete: '删除此消息',
Expand Down Expand Up @@ -267,7 +275,15 @@ export default {
fileText: '文件',
allUnReadText: '全部成员未读',
allReadText: '全部成员已读',

searchText: '请输入你要搜索的关键字',
searchTitleText: '搜索',
friendText: '好友',
teamText: '群组',
searchResultNullText: '该用户不存在',
conversationSendFailText: '[发送失败]',
conversationNotificationText: '[通知消息]',
getForwardMessageFailed: '该消息已撤回或删除',
fileMsgTitleText: '[文件消息]',
// emoji 不能随便填,要用固定 key
Laugh: '[大笑]',
Happy: '[开心]',
Expand Down Expand Up @@ -359,6 +375,9 @@ export default {
107320: 'PIN 消息不存在',
107322: '重复 PIN',
107327: '未开启 PIN 功能',
189301: '收藏数量超限',
189302: '收藏不存在',
189449: '并发操作收藏失败',
// 群相关
109432: '没有权限',
}
18 changes: 18 additions & 0 deletions NEUIKit/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/Conversation/conversation-search/index",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/Login/index",
"style": {
Expand Down Expand Up @@ -157,6 +163,18 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/user-card/my/collection-card",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/user-card/my/collection-list",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/user-card/my-detail/index",
"style": {
Expand Down
12 changes: 9 additions & 3 deletions NEUIKit/pages/Chat/forward.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const teamList = ref<V2NIMTeam[]>([])
const conversationId = uni.$UIKitStore?.uiStore.selectedConversation
let msgIdClient = ''
let origin = ''
// 转发相关
const forwardModalVisible = ref(false)
const forwardTo = ref('')
Expand All @@ -118,7 +119,7 @@ const handleForwardConfirm = (forwardComment: string) => {
if (!forwardMsg.value) {
uni.showToast({
title: t('getMessageFailed'),
title: t('getForwardMessageFailed'),
icon: 'error',
})
setTimeout(() => {
Expand Down Expand Up @@ -163,6 +164,7 @@ onLoad((props) => {
forwardConversationType.value = Number(props?.forwardConversationType)
console.log('forwardConversationType: ', props?.forwardConversationType)
msgIdClient = props?.msgIdClient
origin = props?.origin
})
const uninstallTeamListWatch = autorun(() => {
Expand Down Expand Up @@ -206,8 +208,7 @@ const handleItemClick = (_forwardTo: string) => {
forwardMsg.value = deepClone(
uni.$UIKitStore.msgStore.getMsg(conversationId, [msgIdClient])?.[0]
)
if (!forwardMsg.value) {
// forwardMsg.value 为空,说明是转发的 pin 消息,此时内存里面可能没有该消息,需要从 pinMsgs 中去查。
if (origin === 'pin') {
const curPinMsgsMap = uni.$UIKitStore.msgStore.pinMsgs.get(conversationId)
const pinInfo = [...curPinMsgsMap.values()].find((pinInfo) => {
Expand All @@ -221,6 +222,11 @@ const handleItemClick = (_forwardTo: string) => {
if (pinInfo) {
forwardMsg.value = pinInfo.message
}
} else if (origin === 'collection') {
const msg = uni.$UIKitStore.msgStore.collectionMsgs.get(msgIdClient)
if (msg) {
forwardMsg.value = msg
}
}
forwardModalVisible.value = true
Expand Down
29 changes: 18 additions & 11 deletions NEUIKit/pages/Chat/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ import NavBar from './message/nav-bar.vue'
import Icon from '../../components/Icon.vue'
import MessageList from './message/message-list.vue'
import MessageInput from './message/message-input.vue'
import { HISTORY_LIMIT, MSG_ID_FLAG } from '../../utils/constants'
import { HISTORY_LIMIT } from '../../utils/constants'
import { t } from '../../utils/i18n'
import { V2NIMMessage } from 'nim-web-sdk-ng/dist/v2/NIM_UNIAPP_SDK/V2NIMMessageService'
import { V2NIMConst } from 'nim-web-sdk-ng/dist/v2/NIM_UNIAPP_SDK'
export interface YxReplyMsg {
idClient: string
messageClientId: string
scene: V2NIMConst.V2NIMConversationType
from: string
receiverId: string
Expand Down Expand Up @@ -321,7 +321,7 @@ const msgsWatch = autorun(() => {
if (messages.length !== 0) {
const _replyMsgsMap: any = {}
const reqMsgs: YxReplyMsg[] = []
const idClients: Record<string, string> = {}
const messageClientIds: Record<string, string> = {}
msgs.value.forEach((msg) => {
if (msg.serverExtension) {
try {
Expand All @@ -337,16 +337,23 @@ const msgsWatch = autorun(() => {
_replyMsgsMap[msg.messageClientId] = replyMsg
// 如果没找到,说明被回复的消息可能有三种情况:1.被删除 2.被撤回 3.不在当前消息列表中(一次性没拉到,在之前的消息中)
} else {
_replyMsgsMap[msg.messageClientId] = { idClient: 'noFind' }
const { scene, from, to, idServer, idClient, time, receiverId } =
yxReplyMsg
_replyMsgsMap[msg.messageClientId] = { messageClientId: 'noFind' }
const {
scene,
from,
to,
idServer,
messageClientId,
time,
receiverId,
} = yxReplyMsg
if (
scene &&
from &&
to &&
idServer &&
idClient &&
messageClientId &&
time &&
receiverId
) {
Expand All @@ -355,11 +362,11 @@ const msgsWatch = autorun(() => {
from,
to,
idServer,
idClient,
messageClientId,
time,
receiverId,
})
idClients[idServer] = msg.messageClientId
messageClientIds[idServer] = msg.messageClientId
}
}
}
Expand All @@ -373,7 +380,7 @@ const msgsWatch = autorun(() => {
reqMsgs.map((item) => ({
senderId: item.from,
receiverId: item.receiverId,
messageClientId: item.idClient,
messageClientId: item.messageClientId,
messageServerId: item.idServer,
createTime: item.time,
conversationType: item.scene,
Expand All @@ -384,7 +391,7 @@ const msgsWatch = autorun(() => {
if (res?.length > 0) {
res.forEach((item: V2NIMMessage) => {
if (item.messageServerId) {
_replyMsgsMap[idClients[item.messageServerId]] = item
_replyMsgsMap[messageClientIds[item.messageServerId]] = item
}
})
}
Expand Down
Loading

0 comments on commit 7e557aa

Please sign in to comment.