diff --git a/TUIKit/assets/icon/unopened-envelope.svg b/TUIKit/assets/icon/unopened-envelope.svg new file mode 100644 index 0000000..36a5c10 --- /dev/null +++ b/TUIKit/assets/icon/unopened-envelope.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/TUIKit/components/TUIChat/index.vue b/TUIKit/components/TUIChat/index.vue index 722f8c7..149b196 100644 --- a/TUIKit/components/TUIChat/index.vue +++ b/TUIKit/components/TUIChat/index.vue @@ -288,14 +288,15 @@ if (!conversation) { return } + // return when currentConversationID.value is the same as conversation.conversationID. if (currentConversationID.value === conversation?.conversationID) { return } - isGroup.value = false let conversationType = TUIChatEngine.TYPES.CONV_C2C const conversationID = conversation.conversationID + if (conversationID.startsWith(TUIChatEngine.TYPES.CONV_GROUP)) { conversationType = TUIChatEngine.TYPES.CONV_GROUP isGroup.value = true @@ -304,7 +305,6 @@ '' ) } - headerExtensionList.value = [] isMultipleSelectMode.value = false // Initialize chatType @@ -350,6 +350,4 @@ } - + diff --git a/TUIKit/components/TUIChat/message-input-toolbar/evaluate/index.vue b/TUIKit/components/TUIChat/message-input-toolbar/evaluate/index.vue index d1350f3..0da2eb0 100644 --- a/TUIKit/components/TUIChat/message-input-toolbar/evaluate/index.vue +++ b/TUIKit/components/TUIChat/message-input-toolbar/evaluate/index.vue @@ -213,7 +213,6 @@ ) } - TUIChatService.sendCustomMessage( options as SendMessageParams, sendMessageOptions diff --git a/TUIKit/components/TUIChat/message-input-toolbar/index.vue b/TUIKit/components/TUIChat/message-input-toolbar/index.vue index 09c721a..54699d0 100644 --- a/TUIKit/components/TUIChat/message-input-toolbar/index.vue +++ b/TUIKit/components/TUIChat/message-input-toolbar/index.vue @@ -59,10 +59,10 @@ v-if="featureConfig.InputQuickReplies" @onDialogPopupShowOrHide="handleSwiperDotShow" /> - + /> --> diff --git a/TUIKit/components/TUIChat/message-input-toolbar/red-envelope/index.vue b/TUIKit/components/TUIChat/message-input-toolbar/red-envelope/index.vue index d7098fe..37ee8e7 100644 --- a/TUIKit/components/TUIChat/message-input-toolbar/red-envelope/index.vue +++ b/TUIKit/components/TUIChat/message-input-toolbar/red-envelope/index.vue @@ -3,17 +3,50 @@ import ToolbarItemContainer from '../toolbar-item-container/index.vue' import custom from '../../../../assets/icon/red-packet.svg' import { isUniFrameWork } from '../../../../utils/env' + import { CHAT_MSG_CUSTOM_TYPE } from '../../../../constant' + import TUIChatEngine, { + type IConversationModel, + type SendMessageParams, + SendMessageOptions, + StoreName, + TUIChatService, + TUIStore + } from '@tencentcloud/chat-uikit-engine-lite' + import { isEnabledMessageReadReceiptGlobal } from '../../utils/utils' + import OfflinePushInfoManager, { + type IOfflinePushInfoCreateParams + } from '../../offlinePushInfoManager' + import { getUserPayPwd } from '@/api/my-index' + import { useUI } from '@/utils/use-ui' + import { navigateTo } from '@/utils/router' + import { sendRedEnvelope } from '../../../../../api/tui-kit' - const placeholderStyle = `font-family: PingFang SC, PingFang SC; font-weight: 500; color: #666666; font-size: 32rpx; font-style: normal; text-transform: none;` + const { showDialog } = useUI() + const placeholderStyle = `font-family: PingFang SC, PingFang SC; font-weight: 500; color: #a9a9a9; font-size: 32rpx; font-style: normal; text-transform: none;` const evaluateIcon = custom - /** 提示框 */ - const message = ref() + const currentConversation = ref() + + TUIStore.watch(StoreName.CONV, { + currentConversation: (conversation: IConversationModel) => { + currentConversation.value = conversation + } + }) + + const tixian = ref() + /** 错误提示 */ + const errorData = reactive({ + integralShow: false, + numShow: false, + color: '#f56c6c' + }) const container = ref() const formData = reactive({ // 积分 integral: '', + // 红包数量 + num: '', // 红包标题 title: '' }) @@ -27,16 +60,49 @@ if (!formData.integral) { data.valid = true data.message = '请输入积分' - message.value.open() return data } if (Number(formData.integral) > 2000) { data.valid = true data.message = '积分不能大于2000' - message.value.open() + + return data + } + return data + }) + + /** 监听是否是群组 */ + const isGroup = computed( + () => currentConversation?.value?.type === 'GROUP' + ) + /** 监听群人数 */ + const memberCount = computed( + () => currentConversation?.value?.groupProfile?.memberCount + ) + + /** 监听红包个数 */ + const monitorNum = computed(() => { + const data = { + valid: false, + message: '' + } + if (!formData.num) { + data.valid = true + data.message = '请输入红包个数' return data } + if (Number(formData.num) === 0) { + data.valid = true + data.message = '红包个数不能为 0' + return data + } + + if (Number(formData.num) > memberCount.value) { + data.valid = true + data.message = '红包个数不能大于群人数' + return data + } return data }) @@ -44,6 +110,9 @@ console.log('弹出窗口') formData.integral = '' formData.title = '' + formData.num = '' + errorData.integralShow = false + errorData.numShow = false } const onDialogClose = () => { @@ -54,9 +123,106 @@ container?.value?.toggleDialogDisplay(false) } - const onSubmit = () => { - if (!formData.integral) return - console.log('确认') + /** 监听输入 */ + const monitorInput = () => { + if (monitorPoints.value.valid) { + errorData.integralShow = true + return + } + + errorData.integralShow = false + } + + /** 监听红包个数输入值 */ + const numInput = () => { + if (monitorNum.value.valid) { + errorData.numShow = true + return + } + errorData.numShow = false + } + + const onSubmit = async () => { + if (isGroup.value) { + if (monitorNum.value.valid) { + errorData.numShow = true + return + } + } + + if (monitorPoints.value.valid) { + errorData.integralShow = true + return + } + + const res = await getUserPayPwd() + if (res?.data) { + tixian.value.open() + } else { + const show = await showDialog('提示', '请先设置支付密码') + if (show) { + navigateTo('/pages/my-index/wallet/edit-password', { type: 0 }) + } + } + } + + const pwdModalSubmit = async (e: number[]) => { + // 默认文本 + const text = `${formData.title || '恭喜发财,大吉大利'}` + const payload = { + data: JSON.stringify({ + businessID: CHAT_MSG_CUSTOM_TYPE.RED_ENVELOPE, + version: 1, + // 积分 + integral: Number(formData.integral), + // 红包个数 + num: Number(formData.num || '1'), + // 发送类型 + type: currentConversation?.value?.type, + title: text + }), + description: text, + extension: text + } + const options = { + to: + currentConversation?.value?.groupProfile?.groupID || + currentConversation?.value?.userProfile?.userID, + conversationType: currentConversation?.value?.type, + payload, + needReadReceipt: isEnabledMessageReadReceiptGlobal() + } + const offlinePushInfoCreateParams: IOfflinePushInfoCreateParams = { + conversation: currentConversation.value as IConversationModel, + payload: options.payload, + messageType: TUIChatEngine.TYPES.MSG_CUSTOM + } + + const sendMessageOptions: SendMessageOptions = { + offlinePushInfo: OfflinePushInfoManager.create( + offlinePushInfoCreateParams + ) + } + const isGroup = currentConversation?.value?.type === 'GROUP' + const data = { + password: e.join(''), + title: text, + packetType: isGroup ? 2 : 1, + receiverType: isGroup ? 2 : 1, + totalAmount: Number(formData.integral), + totalCount: Number(formData.num || '1') + } + try { + tixian.value.close() + await sendRedEnvelope(data) + TUIChatService.sendCustomMessage( + options as SendMessageParams, + sendMessageOptions + ) + container?.value?.toggleDialogDisplay(false) + } catch (error) { + tixian.value.close() + } } @@ -71,6 +237,11 @@ @onDialogShow="onDialogShow" @onDialogClose="onDialogClose" > + 发红包 @@ -81,22 +252,59 @@ @click.stop="closeDialog" > - - - 积分 - + + + + + 红包个数 + + + + + + + {{ monitorNum.message }} + + + 本群共{{ memberCount }}人 + + + + 积分 + + + + {{ monitorPoints.message }} + + 塞进红包 - - - - - diff --git a/TUIKit/components/TUIChat/message-input-toolbar/red-envelope/style/index.scss b/TUIKit/components/TUIChat/message-input-toolbar/red-envelope/style/index.scss index e436121..8b686d9 100644 --- a/TUIKit/components/TUIChat/message-input-toolbar/red-envelope/style/index.scss +++ b/TUIKit/components/TUIChat/message-input-toolbar/red-envelope/style/index.scss @@ -5,7 +5,7 @@ display: flex; justify-content: space-between; align-items: center; - margin-bottom: 26rpx; + margin-bottom: 30rpx; .title { font-size: 32rpx; color: #1c1c1c; @@ -13,13 +13,19 @@ } .input-box { - margin-bottom: 26rpx; + margin-bottom: 60rpx; background: #ffffff; border-radius: 16rpx; padding: 24rpx 34rpx; display: flex; justify-content: space-between; align-items: center; + .form-box { + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + } text { font-size: 32rpx; color: #1c1c1c; @@ -30,6 +36,16 @@ color: #1c1c1c; text-align: right; } + .num-box { + display: flex; + align-items: center; + justify-content: right; + text { + margin-left: 10rpx; + margin-bottom: 1rpx; + color: #1c1c1c; + } + } } .title-box { @@ -73,11 +89,40 @@ // 警告提现 .on-reminder { + display: flex; + flex-direction: column; + align-items: flex-start; text { - color: #f56c6c; + color: #f56c6c !important; } input { color: #f56c6c; } + .error-text { + margin-top: 10rpx; + font-size: 24rpx; + } + } + + // 群红包个数 + .group-box { + display: flex; + flex-direction: column; + .input-box { + margin-bottom: 10rpx; + } + .num { + margin-bottom: 30rpx; + margin-left: 34rpx; + font-size: 28rpx; + color: #5e5e5e; + } + } +} + +.pwd-modal { + :deep(.modal) { + position: relative; + right: 20rpx; } } diff --git a/TUIKit/components/TUIChat/message-input-toolbar/toolbar-item-container/index.vue b/TUIKit/components/TUIChat/message-input-toolbar/toolbar-item-container/index.vue index 3222601..d5d0aa1 100644 --- a/TUIKit/components/TUIChat/message-input-toolbar/toolbar-item-container/index.vue +++ b/TUIKit/components/TUIChat/message-input-toolbar/toolbar-item-container/index.vue @@ -4,13 +4,13 @@ :class="[ 'toolbar-item-container', !isPC && 'toolbar-item-container-h5', - isUniFrameWork && 'toolbar-item-container-uni', + isUniFrameWork && 'toolbar-item-container-uni' ]" >
@@ -34,7 +34,7 @@ 'toolbar-item-container-dialog', isDark && 'toolbar-item-container-dialog-dark', !isPC && 'toolbar-item-container-h5-dialog', - isUniFrameWork && 'toolbar-item-container-uni-dialog', + isUniFrameWork && 'toolbar-item-container-uni-dialog' ]" > diff --git a/TUIKit/components/TUIChat/message-input/message-input-quote/index.vue b/TUIKit/components/TUIChat/message-input/message-input-quote/index.vue index d1743e5..5ceba0e 100644 --- a/TUIKit/components/TUIChat/message-input/message-input-quote/index.vue +++ b/TUIKit/components/TUIChat/message-input/message-input-quote/index.vue @@ -4,13 +4,20 @@ :class="{ 'input-quote-container': true, 'input-quote-container-uni': isUniFrameWork, - 'input-quote-container-h5': isH5, + 'input-quote-container-h5': isH5 }" >
- {{ quoteMessage.nick || quoteMessage.from }}: {{ quoteContentText }} + {{ quoteMessage.nick || quoteMessage.from }}: + {{ quoteContentText }}
+ diff --git a/TUIKit/components/TUIChat/message-list/index.vue b/TUIKit/components/TUIChat/message-list/index.vue index 7a68792..b3310ab 100644 --- a/TUIKit/components/TUIChat/message-list/index.vue +++ b/TUIKit/components/TUIChat/message-list/index.vue @@ -2,26 +2,23 @@
-
+
{{ TUITranslateService.t( - "TUIChat.【安全提示】本 APP 仅用于体验腾讯云即时通信 IM 产品功能,不可用于业务洽谈与拓展。请勿轻信汇款、中奖等涉及钱款的信息,勿轻易拨打陌生电话,谨防上当受骗。" + 'TUIChat.【安全提示】本 APP 仅用于体验腾讯云即时通信 IM 产品功能,不可用于业务洽谈与拓展。请勿轻信汇款、中奖等涉及钱款的信息,勿轻易拨打陌生电话,谨防上当受骗。' ) }} - {{ - TUITranslateService.t("TUIChat.点此投诉") - }} + + {{ TUITranslateService.t('TUIChat.点此投诉') }} +
- {{ TUITranslateService.t("TUIChat.查看更多") }} + {{ TUITranslateService.t('TUIChat.查看更多') }}

  • -
    +
  • @@ -184,10 +191,10 @@ :center="true" :isHeaderShow="isPC" @submit="resendMessageConfirm()" - @update:show="(e) => (reSendDialogShow = e)" + @update:show="e => (reSendDialogShow = e)" >

    - {{ TUITranslateService.t("TUIChat.确认重发该消息?") }} + {{ TUITranslateService.t('TUIChat.确认重发该消息?') }}

    @@ -203,7 +210,7 @@ :popDirection="'right'" > diff --git a/TUIKit/components/TUIChat/message-list/message-elements/message-custom.vue b/TUIKit/components/TUIChat/message-list/message-elements/message-custom.vue index d7cc619..614cdb7 100644 --- a/TUIKit/components/TUIChat/message-list/message-elements/message-custom.vue +++ b/TUIKit/components/TUIChat/message-list/message-elements/message-custom.vue @@ -72,6 +72,22 @@
    + @@ -89,6 +105,8 @@ import { ICustomMessagePayload } from '../../../../interface' import Icon from '../../../common/Icon.vue' import star from '../../../../assets/icon/star-light.png' + import unopenedEnvelope from '../../../../assets/icon/unopened-envelope.svg' + interface Props { messageItem: IMessageModel content: any @@ -187,4 +205,32 @@ } } } + + .red-envelope { + display: flex; + flex-direction: column; + background: #f3901f; + border-radius: 16rpx; + padding: 20rpx; + .top-title { + display: flex; + align-items: center; + padding-bottom: 10rpx; + margin-bottom: 10rpx; + border-bottom: 2rpx solid #ffffff; + .title { + width: 40vw; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 32rpx; + font-weight: 500; + color: #ffffff; + } + } + .bottom-text { + font-size: 24rpx; + color: #ffffff; + } + } diff --git a/TUIKit/components/TUIChat/message-list/message-elements/message-image.vue b/TUIKit/components/TUIChat/message-list/message-elements/message-image.vue index 8ac47ec..3b0d142 100644 --- a/TUIKit/components/TUIChat/message-list/message-elements/message-image.vue +++ b/TUIKit/components/TUIChat/message-list/message-elements/message-image.vue @@ -1,8 +1,5 @@ diff --git a/TUIKit/components/TUIContact/utils/index.ts b/TUIKit/components/TUIContact/utils/index.ts index 1cc7b6f..7e0c19a 100644 --- a/TUIKit/components/TUIContact/utils/index.ts +++ b/TUIKit/components/TUIContact/utils/index.ts @@ -250,7 +250,23 @@ export const refuseFriendApplication = (userID: string) => { // Dismiss group export const dismissGroup = (groupID: string) => { - deleteImGroup(groupID) + // deleteImGroup(groupID) + // .then(() => { + // Toast({ + // message: TUITranslateService.t('TUIContact.解散群聊成功'), + // type: TOAST_TYPE.SUCCESS + // }) + // TUIGlobal?.updateContactSearch && TUIGlobal?.updateContactSearch() + // switchTab('/TUIKit/components/TUIConversation/index') + // }) + // .catch((error: any) => { + // console.warn('dismiss group failed:', error) + // Toast({ + // message: TUITranslateService.t('TUIContact.解散群聊失败'), + // type: TOAST_TYPE.ERROR + // }) + // }) + TUIGroupService.dismissGroup(groupID) .then(() => { Toast({ message: TUITranslateService.t('TUIContact.解散群聊成功'), @@ -266,33 +282,34 @@ export const dismissGroup = (groupID: string) => { type: TOAST_TYPE.ERROR }) }) - // TUIGroupService.dismissGroup(groupID) - // .then(() => { - // Toast({ - // message: TUITranslateService.t('TUIContact.解散群聊成功'), - // type: TOAST_TYPE.SUCCESS, - // }); - // TUIGlobal?.updateContactSearch && TUIGlobal?.updateContactSearch(); - // }) - // .catch((error: any) => { - // console.warn('dismiss group failed:', error); - // Toast({ - // message: TUITranslateService.t('TUIContact.解散群聊失败'), - // type: TOAST_TYPE.ERROR, - // }); - // }); } // Quit group export const quitGroup = (groupID: string) => { - console.log('222') - quitImGroup(groupID) + // console.log('222') + // quitImGroup(groupID) + // .then(() => { + // Toast({ + // message: TUITranslateService.t('TUIContact.退出群组成功'), + // type: TOAST_TYPE.SUCCESS + // }) + + // switchTab('/TUIKit/components/TUIConversation/index') + // }) + // .catch((error: any) => { + // console.warn('quit group failed:', error) + // Toast({ + // message: TUITranslateService.t('TUIContact.退出群组失败'), + // type: TOAST_TYPE.ERROR + // }) + // }) + + TUIGroupService.quitGroup(groupID) .then(() => { Toast({ message: TUITranslateService.t('TUIContact.退出群组成功'), type: TOAST_TYPE.SUCCESS }) - switchTab('/TUIKit/components/TUIConversation/index') }) .catch((error: any) => { @@ -302,21 +319,6 @@ export const quitGroup = (groupID: string) => { type: TOAST_TYPE.ERROR }) }) - - // TUIGroupService.quitGroup(groupID) - // .then(() => { - // Toast({ - // message: TUITranslateService.t('TUIContact.退出群组成功'), - // type: TOAST_TYPE.SUCCESS, - // }); - // }) - // .catch((error: any) => { - // console.warn('quit group failed:', error); - // Toast({ - // message: TUITranslateService.t('TUIContact.退出群组失败'), - // type: TOAST_TYPE.ERROR, - // }); - // }); } // Join group diff --git a/TUIKit/components/TUIConversation/conversation-list/index.vue b/TUIKit/components/TUIConversation/conversation-list/index.vue index 78e9493..7483570 100644 --- a/TUIKit/components/TUIConversation/conversation-list/index.vue +++ b/TUIKit/components/TUIConversation/conversation-list/index.vue @@ -1,8 +1,5 @@