@tencentcloud/ai-desk-customer-vue 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +11 -4
  2. package/assets/customer_avatar.png +0 -0
  3. package/assets/face.svg +10 -0
  4. package/assets/files.svg +5 -0
  5. package/assets/image.svg +8 -0
  6. package/assets/rating_tool_icon.svg +5 -0
  7. package/assets/rating_tool_icon_h5.svg +1 -0
  8. package/assets/video.svg +8 -0
  9. package/assets/video_h5.svg +1 -0
  10. package/components/CustomerServiceChat/chat-header/index-web.vue +16 -14
  11. package/components/CustomerServiceChat/index-web.vue +69 -13
  12. package/components/CustomerServiceChat/message-input/index-web.vue +31 -5
  13. package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +24 -0
  14. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue +1 -1
  15. package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.vue +1 -1
  16. package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.vue +6 -8
  17. package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.vue +11 -16
  18. package/components/CustomerServiceChat/message-input-toolbar/index-web.vue +61 -18
  19. package/components/CustomerServiceChat/message-input-toolbar/rating-tool/index.vue +72 -0
  20. package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/h5.scss +10 -1
  21. package/components/CustomerServiceChat/message-input-toolbar/user-define-input-tool.vue +80 -0
  22. package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.vue +9 -14
  23. package/components/CustomerServiceChat/message-list/index-web.vue +33 -6
  24. package/components/CustomerServiceChat/message-list/message-elements/message-bubble-web.vue +53 -6
  25. package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-branch.vue +5 -5
  26. package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-desk.vue +8 -3
  27. package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-branch/branch-pc.vue +20 -6
  28. package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-branch/index.vue +2 -2
  29. package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-order.vue +1 -2
  30. package/components/CustomerServiceChat/message-list/message-elements/message-file.vue +1 -1
  31. package/components/CustomerServiceChat/message-list/scroll-button/index.vue +3 -3
  32. package/components/CustomerServiceChat/message-list/style/web.scss +2 -1
  33. package/components/CustomerServiceChat/message-toolbar-button/index.vue +111 -42
  34. package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-end-human-service.vue +59 -0
  35. package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-human-service.vue +55 -0
  36. package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-service-rating.vue +59 -0
  37. package/constant.ts +15 -0
  38. package/interface.ts +35 -5
  39. package/locales/en/aidesk.ts +4 -3
  40. package/locales/fil/aidesk.ts +2 -1
  41. package/locales/id/aidesk.ts +3 -2
  42. package/locales/ja/aidesk.ts +1 -0
  43. package/locales/ms/aidesk.ts +1 -0
  44. package/locales/ru/aidesk.ts +1 -0
  45. package/locales/th/aidesk.ts +1 -0
  46. package/locales/vi/aidesk.ts +1 -0
  47. package/locales/zh_cn/aidesk.ts +1 -0
  48. package/locales/zh_tw/aidesk.ts +1 -0
  49. package/package.json +1 -1
  50. package/server.ts +5 -1
  51. package/utils/state.js +30 -0
  52. package/utils/utils.ts +48 -1
  53. package/assets/face.png +0 -0
  54. package/assets/files.png +0 -0
  55. package/assets/image.png +0 -0
  56. package/assets/video.png +0 -0
package/CHANGELOG.md CHANGED
@@ -1,10 +1,17 @@
1
- ## [1.3.0] (2025-5-21)
1
+ ## 1.4.0 @2025.5.27
2
+
3
+ ### Features
4
+ - 支持自定义配置。
5
+ - 支持任务流分支选择后不隐藏。
6
+ - 优化消息列表的样式的滚动体验。
7
+
8
+ ## 1.3.0 @2025.5.21
2
9
 
3
10
  ### Features
4
11
  - 支持订单消息。
5
12
  - 优化表单消息、任务流消息、流式消息、Markdown 图文混排等的交互体验。
6
13
 
7
- ## [1.1.0] (2025-4-23)
14
+ ## 1.1.0 @2025.4.23
8
15
 
9
16
  ### Features
10
17
  - 新增 `initWithProfile` 接口,支持用户端带昵称(nickName)和头像(avatar)登录,提升人工客服与用户交互体验。
@@ -12,13 +19,13 @@
12
19
  - 优化发消息体验。
13
20
  - 优化组件样式。
14
21
 
15
- ## [1.0.1] (2025-4-16)
22
+ ## 1.0.1 @2025.4.16
16
23
 
17
24
  ### Features
18
25
  - 简化接入。
19
26
  - TUICustomerServer 新增 sendTextMessage/sendCustomMessage/changeLanguage 等接口。
20
27
 
21
- ## [1.0.0] (2025-4-10)
28
+ ## 1.0.0 @2025.4.10
22
29
 
23
30
  ### Features
24
31
  - 国际化语言,支持简体中文、繁体中文、英语、日语、马来西亚语、印尼语、越南语、泰语、俄语、菲律宾语。
Binary file
@@ -0,0 +1,10 @@
1
+ <svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id="&#232;&#161;&#168;&#230;&#131;&#133;">
3
+ <g id="Union">
4
+ <path d="M5.83268 7.83332C6.29292 7.83332 6.66602 7.46023 6.66602 6.99999C6.66602 6.53975 6.29292 6.16666 5.83268 6.16666C5.37245 6.16666 4.99935 6.53975 4.99935 6.99999C4.99935 7.46023 5.37245 7.83332 5.83268 7.83332Z" fill="black" fill-opacity="0.4"/>
5
+ <path d="M10.9993 6.99999C10.9993 7.46023 10.6263 7.83332 10.166 7.83332C9.70578 7.83332 9.33268 7.46023 9.33268 6.99999C9.33268 6.53975 9.70578 6.16666 10.166 6.16666C10.6263 6.16666 10.9993 6.53975 10.9993 6.99999Z" fill="black" fill-opacity="0.4"/>
6
+ <path d="M7.99945 10.5001C8.74027 10.5001 9.41053 10.198 9.89378 9.71027L10.7634 10.7248C10.0452 11.4116 9.0716 11.8334 7.99945 11.8334C6.92723 11.8334 5.95353 11.4115 5.23532 10.7247L6.10497 9.71011C6.58822 10.1979 7.25855 10.5001 7.99945 10.5001Z" fill="black" fill-opacity="0.4"/>
7
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M15.3327 8.49999C15.3327 12.5501 12.0494 15.8333 7.99935 15.8333C3.94926 15.8333 0.666016 12.5501 0.666016 8.49999C0.666016 4.4499 3.94926 1.16666 7.99935 1.16666C12.0494 1.16666 15.3327 4.4499 15.3327 8.49999ZM13.9993 8.49999C13.9993 11.8137 11.3131 14.5 7.99935 14.5C4.68564 14.5 1.99935 11.8137 1.99935 8.49999C1.99935 5.18628 4.68564 2.49999 7.99935 2.49999C11.3131 2.49999 13.9993 5.18628 13.9993 8.49999Z" fill="black" fill-opacity="0.4"/>
8
+ </g>
9
+ </g>
10
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id="&#230;&#150;&#135;&#228;&#187;&#182;">
3
+ <path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M7.00065 3.49999L6.33398 2.16666H1.33398V14.5H14.6673V3.49999H7.00065ZM6.17661 4.83332H13.334V6.49999H2.66732V3.49999H5.50994L6.17661 4.83332ZM2.66732 7.83332V13.1667H13.334V7.83332H2.66732Z" fill="black" fill-opacity="0.4"/>
4
+ </g>
5
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id="&#229;&#155;&#190;&#231;&#137;&#135;">
3
+ <g id="Union">
4
+ <path d="M5.66602 7.16667C6.2183 7.16667 6.66602 6.71895 6.66602 6.16667C6.66602 5.61438 6.2183 5.16667 5.66602 5.16667C5.11373 5.16667 4.66602 5.61438 4.66602 6.16667C4.66602 6.71895 5.11373 7.16667 5.66602 7.16667Z" fill="black" fill-opacity="0.4"/>
5
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M0.666016 2.5V14.5H15.3327V2.5H0.666016ZM13.9993 3.83333H1.99935V10.4027L4.24217 8.51871L6.43497 9.9221L10.914 5.62228L13.9993 7.99186V3.83333ZM1.99935 13.1667V12.144L4.34912 10.1702L6.60076 11.6112L11.0107 7.37772L13.9993 9.67303V13.1667H1.99935Z" fill="black" fill-opacity="0.4"/>
6
+ </g>
7
+ </g>
8
+ </svg>
@@ -0,0 +1,5 @@
1
+ <svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id="&#232;&#181;&#158;">
3
+ <path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M7.25305 1.42188L8.10572 1.56398C9.39152 1.77829 10.334 2.8908 10.334 4.19437V5.83345H13.8803C14.7043 5.83345 15.331 6.57327 15.1955 7.38595L14.0845 14.0526C14.0377 14.3329 13.8803 15.1667 13.8803 15.1667H1.33398V6.5H5.16207L7.25305 1.42188ZM2.66732 13.8333H4.66732V7.83333H2.66732V13.8333ZM8.07605 2.92511L6.00065 7.96535V13.8334H12.7693L13.8803 7.16675H9.00065V4.19437C9.00065 3.60851 8.61992 3.09984 8.07605 2.92511Z" fill="black" fill-opacity="0.4"/>
4
+ </g>
5
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5C6168"><path d="M720-120H320v-520l280-280 50 50q7 7 11.5 19t4.5 23v14l-44 174h218q32 0 56 24t24 56v80q0 7-1.5 15t-4.5 15L794-168q-9 20-30 34t-44 14ZM240-640v520H80v-520h160Z"/></svg>
@@ -0,0 +1,8 @@
1
+ <svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g id="&#232;&#167;&#134;&#233;&#162;&#145;-&#230;&#137;&#147;&#229;&#188;&#128;">
3
+ <g id="Union">
4
+ <path d="M2.66667 6.5H5.33333V5.16667H2.66667V6.5Z" fill="black" fill-opacity="0.4"/>
5
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12.6667 5.37037L16 4.16667V12.8333L12.6667 11.6296V14.5H0V2.5H12.6667V5.37037ZM14.6667 6.06575V10.9342L11.3333 9.73054V13.1667H1.33333V3.83333H11.3333V7.26946L14.6667 6.06575Z" fill="black" fill-opacity="0.4"/>
6
+ </g>
7
+ </g>
8
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5C6168"><path d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h480q33 0 56.5 23.5T720-720v180l160-160v440L720-420v180q0 33-23.5 56.5T640-160H160Z"/></svg>
@@ -6,12 +6,11 @@
6
6
  @click="closeChat(currentConversation.conversationID)"
7
7
  >
8
8
  <Icon :file="backSVG" />
9
-
10
9
  </div>
11
10
  <div class="chat-header-container">
12
11
  <Icon v-if="!isPC" style="width:32px;" :file="customerAvatarMobile" />
13
12
  <div :class="['chat-header-content', !isPC && 'chat-header-h5-content']">
14
- {{ isPC? currentConversationName : TUITranslateService.t('AIDesk.Hi,我是') + currentConversationName }}
13
+ {{ currentConversationName }}
15
14
  </div>
16
15
  </div>
17
16
  </div>
@@ -28,6 +27,7 @@ import Icon from '../../common/Icon.vue';
28
27
  import backSVG from '../../../assets/back.svg';
29
28
  import customerAvatarMobile from '../../../assets/customer_avatar_mobile.png';
30
29
  import { isPC } from '../../../utils/env';
30
+ import state from '../../../utils/state';
31
31
  const { ref, onMounted, onUnmounted } = vue;
32
32
 
33
33
  interface IProps {
@@ -37,7 +37,7 @@ interface IProps {
37
37
  const emits = defineEmits(['closeChat']);
38
38
  const currentConversation = ref<IConversationModel>();
39
39
  const currentConversationName = ref('');
40
- const typingStatus = ref(false);
40
+ const isTyping = ref(false);
41
41
 
42
42
  const props = withDefaults(defineProps<IProps>(), {
43
43
  canCloseChat: true,
@@ -48,8 +48,8 @@ onMounted(() => {
48
48
  currentConversation: onCurrentConversationUpdated,
49
49
  });
50
50
 
51
- TUIStore.watch(StoreName.CHAT, {
52
- typingStatus: onTypingStatusUpdated,
51
+ TUIStore.watch(StoreName.CUSTOM, {
52
+ isTyping: onTypingStatusUpdated,
53
53
  });
54
54
  });
55
55
 
@@ -58,8 +58,8 @@ onUnmounted(() => {
58
58
  currentConversation: onCurrentConversationUpdated,
59
59
  });
60
60
 
61
- TUIStore.unwatch(StoreName.CHAT, {
62
- typingStatus: onTypingStatusUpdated,
61
+ TUIStore.unwatch(StoreName.CUSTOM, {
62
+ isTyping: onTypingStatusUpdated,
63
63
  });
64
64
  });
65
65
 
@@ -69,17 +69,19 @@ const closeChat = (conversationID: string | undefined) => {
69
69
 
70
70
  function onCurrentConversationUpdated(conversation: IConversationModel) {
71
71
  currentConversation.value = conversation;
72
- currentConversationName.value = currentConversation?.value?.getShowName();
72
+ currentConversationName.value = currentConversation.value?.getShowName();
73
73
  }
74
74
 
75
75
  function onTypingStatusUpdated(status: boolean) {
76
- typingStatus.value = status;
77
- if (typingStatus.value) {
78
- currentConversationName.value
79
- = TUITranslateService.t('TUIChat.对方正在输入');
76
+ isTyping.value = status;
77
+ if (isTyping.value && state.get('showTyping') === 1) {
78
+ currentConversationName.value = TUITranslateService.t('TUIChat.对方正在输入');
80
79
  } else {
81
- currentConversationName.value
82
- = currentConversation.value?.getShowName() || '';
80
+ if (isPC) {
81
+ currentConversationName.value = currentConversation.value?.getShowName();
82
+ } else {
83
+ currentConversationName.value = TUITranslateService.t('AIDesk.Hi,我是') + currentConversation.value?.getShowName();
84
+ }
83
85
  }
84
86
  }
85
87
  </script>
@@ -28,6 +28,7 @@
28
28
  !isPC && 'tui-chat-h5-message-input-toolbar'
29
29
  ]"
30
30
  :displayType="inputToolbarDisplayType"
31
+ :inputToolbarList="props.inputToolbarList"
31
32
  @insertEmoji="insertEmoji"
32
33
  @changeToolbarDisplayType="changeToolbarDisplayType"
33
34
  @scrollToLatestMessage="scrollToLatestMessage"
@@ -42,10 +43,12 @@
42
43
  :muteText="muteText"
43
44
  :placeholder="TUITranslateService.t('TUIChat.请输入消息')"
44
45
  :inputToolbarDisplayType="inputToolbarDisplayType"
46
+ :inputToolbarList="props.inputToolbarList"
45
47
  @changeToolbarDisplayType="changeToolbarDisplayType"
46
48
  @emojiShow="emojiShow"
47
49
  @toolShow="toolShow"
48
50
  @blurToolAndEmojiH5="blurToolAndEmojiH5"
51
+ @messageSent="onMessageSent"
49
52
  />
50
53
  <div class="input-toolbar-h5">
51
54
  <div :class="['emoji-dialog-h5',(toolShowH5 && !emojiOpen)?'tool-dialog-h5':'']">
@@ -63,6 +66,7 @@
63
66
  ]"
64
67
  :isH5ToolShow="toolShowH5"
65
68
  :displayType="inputToolbarDisplayType"
69
+ :inputToolbarList="props.inputToolbarList"
66
70
  @insertEmoji="insertEmoji"
67
71
  @changeToolbarDisplayType="changeToolbarDisplayType"
68
72
  @scrollToLatestMessage="scrollToLatestMessage"
@@ -81,7 +85,7 @@ import {
81
85
  TUIChatEngine,
82
86
  TUIConversationService,
83
87
  TUIStore,
84
- TUITranslateService
88
+ TUITranslateService,
85
89
  } from '@tencentcloud/chat-uikit-engine';
86
90
  import TUICore, {TUIConstants, TUILogin} from '@tencentcloud/tui-core';
87
91
  import ChatHeader from './chat-header/index-web.vue';
@@ -89,24 +93,37 @@ import MessageList from './message-list/index-web.vue';
89
93
  import MessageInput from './message-input/index-web.vue';
90
94
  import MessageInputToolbar from './message-input-toolbar/index-web.vue';
91
95
  import EmojiDialog from './message-input-toolbar/emoji-dialog-mobile/emoji-dialog-mobile.vue';
92
- import {isH5, isPC} from '../../utils/env';
93
- import {ToolbarButtonModel, ToolbarDisplayType} from '../../interface';
94
- import {isSupportedLang} from '../../utils/';
96
+ import { isH5, isPC } from '../../utils/env';
97
+ import { ToolbarButtonModel, ToolbarDisplayType, InputToolbarModel } from '../../interface';
98
+ import { isSupportedLang } from '../../utils/';
95
99
  import Log from '../../utils/logger';
96
100
  import MessageToolbarButton from './message-toolbar-button/index.vue';
97
101
  import TUILocales from '../../locales';
98
102
  import { Toast, TOAST_TYPE } from '../common/Toast/index-web';
103
+ import state from '../../utils/state.js';
104
+ import { switchReadStatus } from '../../utils/utils';
99
105
 
100
106
  const { ref, onMounted, onUnmounted, computed, nextTick } = vue;
101
107
 
102
108
  interface IProps {
103
109
  canCloseChat?: boolean;
104
- SDKAppID?:number;
105
- userID?:string;
106
- userSig?:string;
107
- robotLang?:string;
108
- userLang?:string;
109
- toolbarButtonList?:ToolbarButtonModel[];
110
+ SDKAppID?: number;
111
+ userID?: string;
112
+ userSig?: string;
113
+ robotLang?: string;
114
+ userLang?: string;
115
+ toolbarButtonList?: ToolbarButtonModel[];
116
+ showAvatar?: number;
117
+ robotAvatar?: string;
118
+ staffAvatar?: string;
119
+ userAvatar?: string;
120
+ showNickName?: number;
121
+ robotNickName?: string;
122
+ staffNickName?: string;
123
+ userNickName?: string;
124
+ inputToolbarList?: InputToolbarModel[];
125
+ showReadStatus?: number;
126
+ showTyping?: number;
110
127
  }
111
128
 
112
129
  const emits = defineEmits(['closeChat']);
@@ -126,8 +143,17 @@ const props = withDefaults(defineProps<IProps>(), {
126
143
  userID: '',
127
144
  userSig: '',
128
145
  robotLang: '',
129
- userLang:'',
130
- toolbarButtonList:() => [] as ToolbarButtonModel[]
146
+ userLang: '',
147
+ showReadStatus: 1,
148
+ showAvatar: 1,
149
+ robotAvatar: '',
150
+ staffAvatar: '',
151
+ userAvatar: '',
152
+ showNickName: 0,
153
+ robotNickName: '',
154
+ staffNickName: '',
155
+ userNickName: '',
156
+ showTyping: 0,
131
157
  });
132
158
 
133
159
  const loginCustomerUIKit = () => {
@@ -140,6 +166,7 @@ const loginCustomerUIKit = () => {
140
166
  Log.i(`login success, robotLang:${props.robotLang}`);
141
167
  let conversationID = 'C2C@customer_service_account';
142
168
  TUIConversationService.switchConversation(conversationID);
169
+ switchReadStatus(props.showReadStatus);
143
170
  TUIChatEngine.chat.callExperimentalAPI('isFeatureEnabledForStat', Math.pow(2, 42));
144
171
  }).catch((error) => {
145
172
  Toast({
@@ -185,15 +212,39 @@ const initLanguage = () => {
185
212
  TUITranslateService.changeLanguage(language);
186
213
  }
187
214
 
215
+ const setAvatarNickName = () => {
216
+ state.set('avatarNickName', {
217
+ showAvatar: props.showAvatar,
218
+ showNickName: props.showNickName,
219
+ userAvatar: props.userAvatar,
220
+ staffAvatar: props.staffAvatar,
221
+ robotAvatar: props.robotAvatar,
222
+ userNickName: props.userNickName,
223
+ staffNickName: props.staffNickName,
224
+ robotNickName: props.robotNickName,
225
+ });
226
+ }
227
+
228
+ const setShowReadStatus = () => {
229
+ state.set('showReadStatus', props.showReadStatus);
230
+ }
231
+
232
+ const setShowTyping = () => {
233
+ state.set('showTyping', props.showTyping);
234
+ }
235
+
188
236
  try {
189
237
  const userContext = TUILogin.getContext();
190
- if(userContext.userID == '' && props.SDKAppID!==0 && props.userID!=='' && props.userSig!==''){
238
+ if (userContext.userID == '' && props.SDKAppID !==0 && props.userID !=='' && props.userSig !==''){
191
239
  loginCustomerUIKit();
192
240
  if (props.robotLang && !isSupportedLang(props.robotLang)) {
193
241
  Log.w(`robotLang:${props.robotLang} is not supported`);
194
242
  }
195
243
  }
196
244
  initLanguage();
245
+ setAvatarNickName();
246
+ setShowReadStatus();
247
+ setShowTyping();
197
248
  } catch (e) {
198
249
  console.log(e)
199
250
  }
@@ -236,6 +287,11 @@ const sendMessage = () => {
236
287
  messageInputRef.value?.sendMessage();
237
288
  }
238
289
 
290
+ const onMessageSent = () => {
291
+ // 发送消息后列表滚动到底部
292
+ messageListRef.value?.scrollToLatestMessage();
293
+ }
294
+
239
295
  const handleEditor = (message: IMessageModel, type: string) => {
240
296
  if (!message || !type) return;
241
297
  switch (type) {
@@ -15,6 +15,8 @@
15
15
  :enableInput="props.enableInput"
16
16
  :enableTyping="props.enableTyping"
17
17
  :enableDragUpload="props.enableDragUpload"
18
+ :hasInputTool="shouldShowToolbar"
19
+ :hasEmojiTool="shouldShowEmoji"
18
20
  @sendMessage="sendMessage"
19
21
  @onTyping="onTyping"
20
22
  @blurToolAndEmojiH5="blurToolAndEmojiH5"
@@ -24,10 +26,10 @@
24
26
  v-if="!props.isMuted && isPC"
25
27
  @sendMessage="sendMessage"
26
28
  />
27
- <div v-if="isH5" class="emoji-icon" id="emoji-icon-h5" @click="emojiShow">
29
+ <div v-if="isH5 && shouldShowEmoji" :class="['emoji-icon',!shouldShowToolbar && isH5 ? 'emoji-h5-no-toolbar' : '']" id="emoji-icon-h5" @click="emojiShow">
28
30
  <Icon :file="emojiIcon" width="24px" height="24px"/>
29
31
  </div>
30
- <div v-show="isH5 && !showSendButton" class="tool-icon" @click="toolShow">
32
+ <div v-show="isH5 && shouldShowToolbar && !showSendButton" class="tool-icon" @click="toolShow">
31
33
  <Icon :file="toolIcon" width="24px" height="24px"/>
32
34
  </div>
33
35
  <div v-show="isH5 && showSendButton" class="send-button-h5" @click="sendMessage">
@@ -55,7 +57,8 @@ import Icon from '../../common/Icon.vue';
55
57
  import emojiIcon from '../../../assets/emoji.png';
56
58
  import toolIcon from '../../../assets/more_tools.png';
57
59
  import sendButtonIcon from '../../../assets/send_button_h5.svg';
58
- const { ref,onMounted,onBeforeUnmount } = vue;
60
+ import { INPUT_TOOLBAR_TYPE } from '../../../constant';
61
+ const { ref, onMounted, onBeforeUnmount, computed } = vue;
59
62
 
60
63
  const props = defineProps({
61
64
  placeholder: {
@@ -82,9 +85,13 @@ const props = defineProps({
82
85
  type: Boolean,
83
86
  default: true,
84
87
  },
88
+ inputToolbarList: {
89
+ type: Array,
90
+ default: undefined,
91
+ },
85
92
  });
86
93
 
87
- const emit = defineEmits(['sendMessage', 'resetReplyOrReference', 'onTyping','scrollToLatestMessage','changeToolbarDisplayType','insertEmoji','emojiShow','toolShow','blurToolAndEmojiH5']);
94
+ const emit = defineEmits(['messageSent', 'resetReplyOrReference', 'onTyping','scrollToLatestMessage','changeToolbarDisplayType','insertEmoji','emojiShow','toolShow','blurToolAndEmojiH5']);
88
95
  const editor = ref<InstanceType<typeof MessageInputEditor>>();
89
96
  const currentConversation = ref<IConversationModel>();
90
97
  const h5Dialog = ref<HTMLElement>();
@@ -130,7 +137,8 @@ const sendMessage = async () => {
130
137
  return editor;
131
138
  });
132
139
  await sendMessages(editorContentList, currentConversation.value);
133
- emit('sendMessage');
140
+ // 注意这里不要 emit 'sendMessage',避免写出死循环
141
+ emit('messageSent');
134
142
  editor.value?.resetEditor();
135
143
  showSendButton.value = false;
136
144
  };
@@ -162,6 +170,20 @@ const blurToolAndEmojiH5 = () =>{
162
170
  emit('blurToolAndEmojiH5');
163
171
  }
164
172
 
173
+ const shouldShowToolbar = computed(() => {
174
+ if (props.inputToolbarList !== undefined && props.inputToolbarList.length === 0) {
175
+ return false;
176
+ }
177
+ if (props.inputToolbarList !== undefined && props.inputToolbarList.length === 1 && props.inputToolbarList[0]?.presetId === INPUT_TOOLBAR_TYPE.EMOJI) {
178
+ return false;
179
+ }
180
+ return true;
181
+ });
182
+
183
+ const shouldShowEmoji = computed(() => {
184
+ return props.inputToolbarList === undefined || props.inputToolbarList.some(item => item.presetId === INPUT_TOOLBAR_TYPE.EMOJI && item.isEnabled === 1);
185
+ });
186
+
165
187
  defineExpose({
166
188
  insertEmoji,
167
189
  reEdit,
@@ -202,6 +224,10 @@ defineExpose({
202
224
  border: none;
203
225
  }
204
226
 
227
+ .emoji-h5-no-toolbar {
228
+ margin-right: 10px;
229
+ }
230
+
205
231
  .tool-icon {
206
232
  background: #fff;
207
233
  margin-left: 5px;
@@ -2,7 +2,10 @@
2
2
  <div
3
3
  :class="[
4
4
  'message-input-editor-container',
5
+ isPC && !props.hasInputTool && 'message-input-editor-container-no-inputTool',
5
6
  isH5 && 'message-input-editor-container-h5',
7
+ isH5 && !props.hasEmojiTool && props.hasInputTool && 'message-input-editor-container-h5-no-emoji-no-tool',
8
+ isH5 && !props.hasEmojiTool && !props.hasInputTool && 'message-input-editor-container-h5-no-emoji',
6
9
  ]"
7
10
  >
8
11
  <div
@@ -74,6 +77,14 @@ const props = defineProps({
74
77
  type: Boolean,
75
78
  default: true,
76
79
  },
80
+ hasEmojiTool: {
81
+ type: Boolean,
82
+ default: true,
83
+ },
84
+ hasInputTool: {
85
+ type: Boolean,
86
+ default: true,
87
+ }
77
88
  });
78
89
 
79
90
  const emits = defineEmits(['sendMessage', 'onTyping', 'blurToolAndEmojiH5', 'isInputNotEmpty']);
@@ -715,6 +726,10 @@ defineExpose({
715
726
  padding: 3px 10px 10px;
716
727
  }
717
728
 
729
+ &-container-no-inputTool {
730
+ padding: 10px 10px 10px;
731
+ }
732
+
718
733
  &-area {
719
734
  box-sizing: border-box;
720
735
  font-family: PingFangSC-Regular;
@@ -787,6 +802,15 @@ defineExpose({
787
802
  }
788
803
  }
789
804
  }
805
+
806
+ .message-input-editor-container-h5-no-emoji {
807
+ border-radius: 10px;
808
+ margin: 10px 10px 0 10px;
809
+ }
810
+
811
+ .message-input-editor-container-h5-no-emoji-no-tool {
812
+ border-radius: 10px;
813
+ }
790
814
  </style>
791
815
  <style lang="scss">
792
816
  /* stylelint-disable-next-line selector-class-pattern */
@@ -77,7 +77,7 @@ import {
77
77
  TUITranslateService
78
78
  } from '@tencentcloud/chat-uikit-engine';
79
79
  import Icon from '../../../common/Icon.vue';
80
- import faceIcon from '../../../../assets/face.png';
80
+ import faceIcon from '../../../../assets/face.svg';
81
81
  import { EMOJI_TYPE } from '.././../../../constant';
82
82
  import { isPC, isH5 } from '../../../../utils/env';
83
83
  import { IEmojiGroupList, IEmojiGroup } from '../../../../interface';
@@ -23,7 +23,7 @@ import {
23
23
  TUITranslateService
24
24
  } from '@tencentcloud/chat-uikit-engine';
25
25
  import vue from '../../../../adapter-vue';
26
- import faceIcon from '../../../../assets/face.png';
26
+ import faceIcon from '../../../../assets/face.svg';
27
27
  import EmojiPickerDialog from './emoji-picker-dialog.vue';
28
28
  import ToolbarItemContainer from '../toolbar-item-container/index.vue';
29
29
  import { isH5 } from '../../../../utils/env';
@@ -2,8 +2,8 @@
2
2
  <ToolbarItemContainer
3
3
  :iconFile="isH5?fileIconH5:fileIcon"
4
4
  :title="TUITranslateService.t('文件')"
5
- iconWidth='21px'
6
- iconHeight='18px'
5
+ iconWidth='20px'
6
+ iconHeight='20px'
7
7
  :needDialog="false"
8
8
  @onIconClick="onIconClick"
9
9
  >
@@ -31,10 +31,10 @@ import {
31
31
  } from '@tencentcloud/chat-uikit-engine';
32
32
  import vue from '../../../../adapter-vue';
33
33
  import ToolbarItemContainer from '../toolbar-item-container/index.vue';
34
- import fileIcon from '../../../../assets/files.png';
34
+ import fileIcon from '../../../../assets/files.svg';
35
35
  import fileIconH5 from '../../../../assets/file-h5.png';
36
36
  import { isPC, isH5 } from '../../../../utils/env';
37
- import { isEnabledMessageReadReceiptGlobal } from '../../../../utils/utils';
37
+ import { isEnabledMessageReadReceiptGlobal, getTo } from '../../../../utils/utils';
38
38
  const { ref } = vue;
39
39
 
40
40
  const inputRef = ref();
@@ -47,7 +47,7 @@ TUIStore.watch(StoreName.CONV, {
47
47
  });
48
48
 
49
49
  const onIconClick = () => {
50
- inputRef?.value?.click && inputRef?.value?.click();
50
+ inputRef?.value?.click && inputRef?.value?.click();
51
51
  };
52
52
 
53
53
  const sendFileMessage = (e: any) => {
@@ -55,9 +55,7 @@ const sendFileMessage = (e: any) => {
55
55
  return;
56
56
  }
57
57
  const options = {
58
- to:
59
- currentConversation?.value?.groupProfile?.groupID
60
- || currentConversation?.value?.userProfile?.userID,
58
+ to: getTo(currentConversation?.value),
61
59
  conversationType: currentConversation?.value?.type,
62
60
  payload: {
63
61
  file: e?.target,
@@ -2,8 +2,8 @@
2
2
  <ToolbarItemContainer
3
3
  :iconFile="imageToolbarForShow.icon"
4
4
  :title="imageToolbarForShow.title"
5
- iconWidth='21px'
6
- iconHeight= '18px'
5
+ iconWidth='20px'
6
+ iconHeight='20px'
7
7
  :needDialog="false"
8
8
  @onIconClick="onIconClick"
9
9
  :isH5ToolShow="isH5ToolShow"
@@ -35,9 +35,9 @@ import { TUIGlobal } from '@tencentcloud/universal-api';
35
35
  import vue from '../../../../adapter-vue';
36
36
  import { isPC, isH5 } from '../../../../utils/env';
37
37
  import ToolbarItemContainer from '../toolbar-item-container/index.vue';
38
- import imageIcon from '../../../../assets/image.png';
38
+ import imageIcon from '../../../../assets/image.svg';
39
39
  import imageUniIcon from '../../../../assets/image-uni.png';
40
- import { isEnabledMessageReadReceiptGlobal } from '../../../../utils/utils';
40
+ import { getTo, isEnabledMessageReadReceiptGlobal } from '../../../../utils/utils';
41
41
  const { ref, computed } = vue;
42
42
 
43
43
  const props = defineProps({
@@ -74,7 +74,7 @@ TUIStore.watch(StoreName.CONV, {
74
74
  });
75
75
 
76
76
  const imageToolbarForShow = computed((): { icon: string; title: string } => {
77
- if(isH5){
77
+ if (isH5) {
78
78
  return IMAGE_TOOLBAR_SHOW_MAP['uni_album'];
79
79
  }
80
80
  else {
@@ -83,10 +83,9 @@ const imageToolbarForShow = computed((): { icon: string; title: string } => {
83
83
  });
84
84
 
85
85
  const onIconClick = () => {
86
- if (inputRef.value?.click) {
87
- inputRef.value.click();
88
- }
89
-
86
+ if (inputRef.value?.click) {
87
+ inputRef.value.click();
88
+ }
90
89
  };
91
90
 
92
91
  const sendImageInWeb = (e: any) => {
@@ -103,7 +102,7 @@ const sendImageInWeb = (e: any) => {
103
102
  // 处理视频文件
104
103
  sendVideoMessage(e?.target);
105
104
  }
106
-
105
+
107
106
  e.target.value = '';
108
107
  };
109
108
 
@@ -112,9 +111,7 @@ const sendImageMessage = (files: any) => {
112
111
  return;
113
112
  }
114
113
  const options = {
115
- to:
116
- currentConversation?.value?.groupProfile?.groupID
117
- || currentConversation?.value?.userProfile?.userID,
114
+ to: getTo(currentConversation?.value),
118
115
  conversationType: currentConversation?.value?.type,
119
116
  payload: {
120
117
  file: files,
@@ -129,9 +126,7 @@ const sendVideoMessage = (file: any) => {
129
126
  return;
130
127
  }
131
128
  const options = {
132
- to:
133
- currentConversation?.value?.groupProfile?.groupID
134
- || currentConversation?.value?.userProfile?.userID,
129
+ to: getTo(currentConversation?.value),
135
130
  conversationType: currentConversation?.value?.type,
136
131
  payload: {
137
132
  file,