@tencentcloud/ai-desk-customer-vue 0.7.0 → 1.0.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.
- package/CHANGELOG.md +5 -3
- package/README.md +153 -50
- package/components/CustomerServiceChat/chat-header/index-web.vue +2 -2
- package/components/CustomerServiceChat/index-web.vue +71 -11
- package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +7 -1
- package/components/CustomerServiceChat/message-input-toolbar/emoji-dialog-mobile/emoji-dialog-mobile.vue +2 -1
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue +2 -1
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.vue +2 -1
- package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.vue +3 -2
- package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.vue +4 -3
- package/components/CustomerServiceChat/message-input-toolbar/index-web.vue +2 -2
- package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.vue +2 -2
- package/components/CustomerServiceChat/message-list/message-elements/message-bubble-web.vue +19 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-custom.vue +6 -2
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/marked.ts +4 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-branch.vue +13 -4
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form/component-mobile/input-mobile.vue +4 -2
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form/component-mobile/radios-mobile.vue +4 -2
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form/component-pc/input-pc.vue +4 -2
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form/component-pc/radio-pc.vue +5 -3
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form/form-mobile.vue +6 -4
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form/form-pc.vue +5 -3
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-product-card.vue +21 -11
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-rating/message-rating-number.vue +6 -6
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-rating/message-rating-star.vue +14 -14
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-robot-welcome.vue +2 -6
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-single-form/form-input.vue +6 -4
- package/components/CustomerServiceChat/message-list/message-elements/message-location.vue +2 -1
- package/components/CustomerServiceChat/message-list/message-elements/message-text.vue +1 -1
- package/components/CustomerServiceChat/message-list/message-elements/message-thinking.vue +2 -2
- package/components/CustomerServiceChat/message-list/message-tool/index-web.vue +1 -1
- package/components/CustomerServiceChat/message-list/message-tool/message-revoked.vue +1 -0
- package/components/CustomerServiceChat/message-list/scroll-button/index.vue +3 -1
- package/components/CustomerServiceChat/message-toolbar-button/index.vue +2 -2
- package/components/common/Dialog/index.vue +2 -2
- package/components/common/ImagePreviewer/index-web.vue +2 -2
- package/constant.ts +14 -0
- package/excluded-list.txt +0 -1
- package/index.ts +1 -6
- package/locales/en/TUIChat.ts +158 -0
- package/locales/en/aidesk.ts +16 -0
- package/locales/en/component.ts +6 -0
- package/locales/en/index.ts +26 -0
- package/locales/en/time.ts +37 -0
- package/locales/fil/TUIChat.ts +160 -0
- package/locales/fil/aidesk.ts +16 -0
- package/locales/fil/component.ts +6 -0
- package/locales/fil/index.ts +25 -0
- package/locales/fil/time.ts +18 -0
- package/locales/id/TUIChat.ts +164 -0
- package/locales/id/aidesk.ts +16 -0
- package/locales/id/component.ts +6 -0
- package/locales/id/index.ts +26 -0
- package/locales/id/time.ts +19 -0
- package/locales/index.ts +30 -0
- package/locales/ja/TUIChat.ts +165 -0
- package/locales/ja/aidesk.ts +16 -0
- package/locales/ja/component.ts +6 -0
- package/locales/ja/index.ts +26 -0
- package/locales/ja/time.ts +18 -0
- package/locales/ms/TUIChat.ts +165 -0
- package/locales/ms/aidesk.ts +16 -0
- package/locales/ms/component.ts +6 -0
- package/locales/ms/index.ts +26 -0
- package/locales/ms/time.ts +18 -0
- package/locales/ru/TUIChat.ts +158 -0
- package/locales/ru/aidesk.ts +16 -0
- package/locales/ru/component.ts +7 -0
- package/locales/ru/index.ts +26 -0
- package/locales/ru/time.ts +30 -0
- package/locales/th/TUIChat.ts +165 -0
- package/locales/th/aidesk.ts +16 -0
- package/locales/th/component.ts +6 -0
- package/locales/th/index.ts +26 -0
- package/locales/th/time.ts +18 -0
- package/locales/vi/TUIChat.ts +156 -0
- package/locales/vi/aidesk.ts +16 -0
- package/locales/vi/component.ts +6 -0
- package/locales/vi/index.ts +26 -0
- package/locales/vi/time.ts +18 -0
- package/locales/zh_cn/TUIChat.ts +158 -0
- package/locales/zh_cn/aidesk.ts +17 -0
- package/locales/zh_cn/component.ts +6 -0
- package/locales/zh_cn/index.ts +26 -0
- package/locales/zh_cn/time.ts +37 -0
- package/locales/zh_tw/TUIChat.ts +158 -0
- package/locales/zh_tw/aidesk.ts +16 -0
- package/locales/zh_tw/component.ts +6 -0
- package/locales/zh_tw/index.ts +26 -0
- package/locales/zh_tw/time.ts +37 -0
- package/package.json +2 -2
- package/server.ts +14 -2
- package/utils/index.ts +6 -16
- package/utils/utils.ts +4 -5
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 效果展示
|
|
6
6
|
|
|
7
|
-

|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
## 开发环境要求
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
|
|
30
30
|
【vue-cli】
|
|
31
31
|
|
|
32
|
-
>
|
|
33
|
-
>
|
|
34
|
-
|
|
35
|
-
>
|
|
36
|
-
>
|
|
32
|
+
> **说明:**
|
|
33
|
+
>
|
|
34
|
+
> 1. 请确保您的`@vue/cli`版本在 **5.0.0** 以上,您可使用以下示例代码升级`@vue/cli`版本至 v5.0.8。
|
|
35
|
+
> 2. 如果您的项目由较低版本的`@vue/cli`创建,集成 UIKit 后运行项目如有报错,请查阅[常见问题](https://cloud.tencent.com/document/product/269/102783#04a7d474-e04a-4765-910f-9bbfe4e3ced9)解决。
|
|
37
36
|
|
|
38
37
|
|
|
39
38
|
使用 vue-cli 方式创建项目, 配置 Vue2 / Vue3 + TypeScript + sass。
|
|
39
|
+
|
|
40
40
|
如果您尚未安装 vue-cli 或者 vue-cli 版本低于 5.0.0 ,可以在 terminal 或 cmd 中采用如下方式进行安装:
|
|
41
41
|
|
|
42
42
|
|
|
@@ -79,10 +79,10 @@ npm i @vue/composition-api unplugin-vue2-script-setup vue@2.6.14 vue-template-co
|
|
|
79
79
|
【vite】
|
|
80
80
|
|
|
81
81
|
> **说明:**
|
|
82
|
-
>
|
|
82
|
+
>
|
|
83
83
|
|
|
84
84
|
> Vite 需要[**Node.js**](https://nodejs.org/en/)** 版本 18+,20+。**当您的包管理器发出警告时,请注意升级您的 Node 版本,详情请参考 [vite 官网](https://cn.vitejs.dev/guide/)。
|
|
85
|
-
>
|
|
85
|
+
>
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
使用 vite 方式创建项目,按照下图选项配置 Vue + TypeScript 。
|
|
@@ -134,13 +134,13 @@ echo. > src\style.css
|
|
|
134
134
|
|
|
135
135
|
【shell】
|
|
136
136
|
``` bash
|
|
137
|
-
npm i @tencentcloud/ai-desk-customer-vue
|
|
137
|
+
npm i @tencentcloud/ai-desk-customer-vue@latest
|
|
138
138
|
```
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
【shell】
|
|
142
142
|
``` bash
|
|
143
|
-
mkdir -p ./src/ai-desk-customer-vue && rsync -av --exclude={'node_modules','
|
|
143
|
+
mkdir -p ./src/ai-desk-customer-vue && rsync -av --exclude={'node_modules','excluded-list.txt'} ./node_modules/@tencentcloud/ai-desk-customer-vue/ ./src/ai-desk-customer-vue
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
【Windows 端】
|
|
@@ -148,7 +148,7 @@ mkdir -p ./src/ai-desk-customer-vue && rsync -av --exclude={'node_modules','pack
|
|
|
148
148
|
|
|
149
149
|
【shell】
|
|
150
150
|
``` bash
|
|
151
|
-
npm i @tencentcloud/ai-desk-customer-vue
|
|
151
|
+
npm i @tencentcloud/ai-desk-customer-vue@latest
|
|
152
152
|
```
|
|
153
153
|
|
|
154
154
|
|
|
@@ -164,10 +164,10 @@ xcopy .\node_modules\@tencentcloud\ai-desk-customer-vue .\src\ai-desk-customer-v
|
|
|
164
164
|
##### 例如:在 App.vue 页面中实现以下代码,即可快速搭建客服咨询界面(以下示例代码同时支持 Web 端与 H5 端):
|
|
165
165
|
|
|
166
166
|
> **说明:**
|
|
167
|
-
>
|
|
167
|
+
>
|
|
168
168
|
|
|
169
169
|
> 以下示例代码使用了 setup 语法,如果您的项目没有使用 setup 语法,请按照 Vue3/Vue2 的标准方式注册组件。
|
|
170
|
-
>
|
|
170
|
+
>
|
|
171
171
|
|
|
172
172
|
|
|
173
173
|
|
|
@@ -176,14 +176,45 @@ xcopy .\node_modules\@tencentcloud\ai-desk-customer-vue .\src\ai-desk-customer-v
|
|
|
176
176
|
``` javascript
|
|
177
177
|
<template>
|
|
178
178
|
<CustomerServiceChat
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
183
|
-
/>
|
|
179
|
+
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
180
|
+
:toolbarButtonList="toolbarButtonList"
|
|
181
|
+
/>
|
|
184
182
|
</template>
|
|
185
183
|
<script setup lang="ts">
|
|
186
|
-
|
|
184
|
+
import TUICustomerServer from './ai-desk-customer-vue/server';
|
|
185
|
+
import { CustomerServiceChat } from './ai-desk-customer-vue';
|
|
186
|
+
import { onMounted, ref } from "vue";
|
|
187
|
+
import TUIChatEngine, { TUIChatService } from "@tencentcloud/chat-uikit-engine";
|
|
188
|
+
|
|
189
|
+
// 配置工具栏 button list,例如【转人工】
|
|
190
|
+
const toolbarButtonList = ref([
|
|
191
|
+
{
|
|
192
|
+
title: '转人工',
|
|
193
|
+
renderCondition: () => {
|
|
194
|
+
// return true 即渲染,您可以在这里控制 button 显隐时机
|
|
195
|
+
return true;
|
|
196
|
+
},
|
|
197
|
+
clickEvent: () => {
|
|
198
|
+
// 点击 button 后的回调
|
|
199
|
+
if (TUIChatEngine.isReady()) {
|
|
200
|
+
TUIChatService.sendTextMessage({
|
|
201
|
+
to: '@customer_service_account',
|
|
202
|
+
conversationType: TUIChatEngine.TYPES.CONV_C2C,
|
|
203
|
+
payload: {
|
|
204
|
+
text: '转人工'
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
]);
|
|
211
|
+
|
|
212
|
+
onMounted(() => {
|
|
213
|
+
const SDKAppID = 0; // Your SDKAppID,即开通了智能客服 Desk 的应用 ID
|
|
214
|
+
const userID = ''; // Your userID,可复用您 app 的账号体系,或随机生成
|
|
215
|
+
const userSig = ''; // Your userSig,接入阶段可控制台生成,生产阶段请务必由服务端生成
|
|
216
|
+
TUICustomerServer.init(SDKAppID, userID, userSig);
|
|
217
|
+
});
|
|
187
218
|
</script>
|
|
188
219
|
<style scoped>
|
|
189
220
|
</style>
|
|
@@ -194,20 +225,50 @@ xcopy .\node_modules\@tencentcloud\ai-desk-customer-vue .\src\ai-desk-customer-v
|
|
|
194
225
|
<template>
|
|
195
226
|
<div id="app">
|
|
196
227
|
<CustomerServiceChat
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
userSig=""
|
|
200
|
-
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
228
|
+
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
229
|
+
:toolbarButtonList="toolbarButtonList"
|
|
201
230
|
/>
|
|
202
231
|
</div>
|
|
203
232
|
</template>
|
|
204
233
|
<script lang="ts" setup>
|
|
205
|
-
import
|
|
234
|
+
import TUICustomerServer from './ai-desk-customer-vue/server';
|
|
235
|
+
import { CustomerServiceChat } from './ai-desk-customer-vue';
|
|
236
|
+
import vue from './ai-desk-customer-vue/adapter-vue';
|
|
237
|
+
import TUIChatEngine, { TUIChatService } from "@tencentcloud/chat-uikit-engine";
|
|
238
|
+
|
|
239
|
+
const { ref, onMounted } = vue;
|
|
240
|
+
|
|
241
|
+
// 配置工具栏 button list,例如【转人工】
|
|
242
|
+
const toolbarButtonList = ref([
|
|
243
|
+
{
|
|
244
|
+
title: '转人工',
|
|
245
|
+
renderCondition: () => {
|
|
246
|
+
// return true 即渲染,您可以在这里控制 button 显隐时机
|
|
247
|
+
return true;
|
|
248
|
+
},
|
|
249
|
+
clickEvent: () => {
|
|
250
|
+
// 点击 button 后的回调
|
|
251
|
+
if (TUIChatEngine.isReady()) {
|
|
252
|
+
TUIChatService.sendTextMessage({
|
|
253
|
+
to: '@customer_service_account',
|
|
254
|
+
conversationType: TUIChatEngine.TYPES.CONV_C2C,
|
|
255
|
+
payload: {
|
|
256
|
+
text: '转人工'
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
]);
|
|
263
|
+
|
|
264
|
+
onMounted(() => {
|
|
265
|
+
const SDKAppID = 0; // Your SDKAppID
|
|
266
|
+
const userID = ''; // Your userID
|
|
267
|
+
const userSig = ''; // Your userSig
|
|
268
|
+
TUICustomerServer.init(SDKAppID, userID, userSig);
|
|
269
|
+
});
|
|
206
270
|
</script>
|
|
207
271
|
<style lang="scss">
|
|
208
|
-
body {
|
|
209
|
-
margin: 0;
|
|
210
|
-
}
|
|
211
272
|
</style>
|
|
212
273
|
```
|
|
213
274
|
|
|
@@ -216,23 +277,53 @@ body {
|
|
|
216
277
|
<template>
|
|
217
278
|
<div id="app">
|
|
218
279
|
<CustomerServiceChat
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
userSig=""
|
|
222
|
-
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
280
|
+
:style="{ width: '600px', height: '80vh', margin: '10px auto', boxShadow: '0 11px 20px #ccc' }"
|
|
281
|
+
:toolbarButtonList="toolbarButtonList"
|
|
223
282
|
/>
|
|
224
283
|
</div>
|
|
225
284
|
</template>
|
|
226
285
|
<script lang="ts" setup>
|
|
227
|
-
import
|
|
286
|
+
import TUICustomerServer from './ai-desk-customer-vue/server';
|
|
287
|
+
import { CustomerServiceChat } from './ai-desk-customer-vue';
|
|
288
|
+
import vue from './ai-desk-customer-vue/adapter-vue';
|
|
289
|
+
import TUIChatEngine, { TUIChatService } from "@tencentcloud/chat-uikit-engine";
|
|
290
|
+
|
|
291
|
+
const { ref, onMounted } = vue;
|
|
292
|
+
|
|
293
|
+
// 配置工具栏 button list,例如【转人工】
|
|
294
|
+
const toolbarButtonList = ref([
|
|
295
|
+
{
|
|
296
|
+
title: '转人工',
|
|
297
|
+
renderCondition: () => {
|
|
298
|
+
// return true 即渲染,您可以在这里控制 button 显隐时机
|
|
299
|
+
return true;
|
|
300
|
+
},
|
|
301
|
+
clickEvent: () => {
|
|
302
|
+
// 点击 button 后的回调
|
|
303
|
+
if (TUIChatEngine.isReady()) {
|
|
304
|
+
TUIChatService.sendTextMessage({
|
|
305
|
+
to: '@customer_service_account',
|
|
306
|
+
conversationType: TUIChatEngine.TYPES.CONV_C2C,
|
|
307
|
+
payload: {
|
|
308
|
+
text: '转人工'
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
]);
|
|
315
|
+
|
|
316
|
+
onMounted(() => {
|
|
317
|
+
const SDKAppID = 0; // Your SDKAppID
|
|
318
|
+
const userID = ''; // Your userID
|
|
319
|
+
const userSig = ''; // Your userSig
|
|
320
|
+
TUICustomerServer.init(SDKAppID, userID, userSig);
|
|
321
|
+
});
|
|
228
322
|
</script>
|
|
229
323
|
<style lang="scss">
|
|
230
|
-
body {
|
|
231
|
-
margin: 0;
|
|
232
|
-
}
|
|
233
324
|
</style>
|
|
234
325
|
```
|
|
235
|
-
1. 在 `main.ts/
|
|
326
|
+
1. 在 `main.ts/main.js `中引入 VueCompositionAPI。
|
|
236
327
|
|
|
237
328
|
``` javascript
|
|
238
329
|
import VueCompositionAPI from "@vue/composition-api";
|
|
@@ -268,18 +359,18 @@ export * from "@vue/composition-api";
|
|
|
268
359
|
|
|
269
360
|
### 步骤4: 获取 SDKAppID 、userID 、 userSig
|
|
270
361
|
|
|
271
|
-
设置`
|
|
272
|
-
- SDKAppID
|
|
362
|
+
设置`App.vue`中的 `SDKAppID`、`userID`、`userSig` 。
|
|
363
|
+
- SDKAppID 信息,可在 [即时通信 IM 控制台](https://console.cloud.tencent.com/im) 单击**应用管理** > **创建新应用**,并选择**客服服务 Desk** > **智能客服**, [开通智能客服](https://console.cloud.tencent.com/im/ai-desk) 后获取。
|
|
273
364
|
|
|
274
|
-
|
|
365
|
+

|
|
275
366
|
|
|
276
|
-
|
|
367
|
+

|
|
277
368
|
|
|
278
|
-
|
|
369
|
+
- userID 信息,可本地生成一个随机的字符串,例如 test-1234。
|
|
279
370
|
|
|
280
|
-
- userSig 信息,可单击 [
|
|
371
|
+
- userSig 信息,可单击 [即时通信 IM 控制台 > UserSig生成校验](https://console.cloud.tencent.com/im/tool-usersig),填写创建的 userID,即可生成 userSig。
|
|
281
372
|
|
|
282
|
-
|
|
373
|
+

|
|
283
374
|
|
|
284
375
|
|
|
285
376
|
### 步骤5:启动项目,发起您的第一条客服咨询
|
|
@@ -291,15 +382,15 @@ export * from "@vue/composition-api";
|
|
|
291
382
|
【vue-cli】
|
|
292
383
|
|
|
293
384
|
> **说明:**
|
|
294
|
-
>
|
|
385
|
+
>
|
|
295
386
|
|
|
296
387
|
> 由于 vue-cli 默认开启 webpack 全局 overlay 报错信息提示,为了您有更好的体验,**建议您关闭全局 overlay 报错提示。**
|
|
297
|
-
>
|
|
388
|
+
>
|
|
298
389
|
|
|
299
390
|
> 在 vue.config.js 中添加以下代码
|
|
300
|
-
>
|
|
391
|
+
>
|
|
301
392
|
|
|
302
|
-
>
|
|
393
|
+
>
|
|
303
394
|
|
|
304
395
|
【webpack4及以上】
|
|
305
396
|
> `module.exports = defineConfig({`
|
|
@@ -316,10 +407,10 @@ export * from "@vue/composition-api";
|
|
|
316
407
|
> ` overlay: false,`
|
|
317
408
|
> ` },`
|
|
318
409
|
> `};`
|
|
319
|
-
>
|
|
410
|
+
>
|
|
320
411
|
|
|
321
412
|
> 在 tsconfig.json 中关闭 ai-desk-customer-vue 的ts检测。
|
|
322
|
-
>
|
|
413
|
+
>
|
|
323
414
|
> `{`
|
|
324
415
|
> ` "exclude": [`
|
|
325
416
|
> ` "node_modules",`
|
|
@@ -374,6 +465,18 @@ vue add typescript
|
|
|
374
465
|
npm install -D typescript
|
|
375
466
|
```
|
|
376
467
|
|
|
468
|
+
##### 运行报错:Uncaught TypeError: marked__WEBPACK_IMPORTED_MODULE_0_ Marked is not a constructor
|
|
469
|
+
|
|
470
|
+
如果您运行过程中出现如下错误,说明您当前 Vue CLI 构建的项目环境版本较低,需要降低 uikit 中使用的 marked 版本至 5.1.2。
|
|
471
|
+
|
|
472
|
+

|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
请在您项目的 根目录 使用以下脚本降低 marked 版本:
|
|
476
|
+
``` bash
|
|
477
|
+
npm i marked@5.1.2 --legacy-peer-deps
|
|
478
|
+
```
|
|
479
|
+
|
|
377
480
|
##### 编译报错 node_modules/marked/lib/marked.esm.js: Class private methods are not enabled.
|
|
378
481
|
|
|
379
482
|
如果您运行过程中出现如下错误,说明您当前使用的 marked 版本过低,请升级 marked 版本至 6.0.0。
|
|
@@ -388,4 +491,4 @@ npm i marked@6.0.0 --legacy-peer-deps
|
|
|
388
491
|
|
|
389
492
|
## 交流与反馈
|
|
390
493
|
|
|
391
|
-
[点此进入 IM 社群](https://zhiliao.qq.com/s/c5GY7HIM62CK),享有专业工程师的支持,解决您的难题。
|
|
494
|
+
[点此进入 IM 社群](https://zhiliao.qq.com/s/c5GY7HIM62CK),享有专业工程师的支持,解决您的难题。
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<div class="chat-header-container">
|
|
12
12
|
<Icon v-if="!isPC" style="width:32px;" :file="customerAvatarMobile" />
|
|
13
13
|
<div :class="['chat-header-content', !isPC && 'chat-header-h5-content']">
|
|
14
|
-
{{ isPC? currentConversationName :'Hi,我是'+ currentConversationName }}
|
|
14
|
+
{{ isPC? currentConversationName : TUITranslateService.t('AIDesk.Hi,我是') + currentConversationName }}
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
|
17
17
|
</div>
|
|
@@ -31,7 +31,7 @@ import { isPC } from '../../../utils/env';
|
|
|
31
31
|
const { ref, onMounted, onUnmounted } = vue;
|
|
32
32
|
|
|
33
33
|
interface IProps {
|
|
34
|
-
canCloseChat
|
|
34
|
+
canCloseChat?: boolean;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const emits = defineEmits(['closeChat']);
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
'tui-chat-message-input',
|
|
39
39
|
!isPC && 'tui-chat-h5-message-input'
|
|
40
40
|
]"
|
|
41
|
-
:isMuted="
|
|
42
|
-
:muteText="
|
|
41
|
+
:isMuted="isMuted"
|
|
42
|
+
:muteText="muteText"
|
|
43
43
|
:placeholder="TUITranslateService.t('TUIChat.请输入消息')"
|
|
44
44
|
:inputToolbarDisplayType="inputToolbarDisplayType"
|
|
45
45
|
@changeToolbarDisplayType="changeToolbarDisplayType"
|
|
@@ -76,26 +76,28 @@
|
|
|
76
76
|
<script lang="ts" setup>
|
|
77
77
|
import vue from '../../adapter-vue';
|
|
78
78
|
import {
|
|
79
|
-
|
|
79
|
+
IMessageModel,
|
|
80
|
+
StoreName,
|
|
81
|
+
TUIChatEngine,
|
|
80
82
|
TUIConversationService,
|
|
81
83
|
TUIStore,
|
|
82
|
-
|
|
83
|
-
IMessageModel,
|
|
84
|
-
TUIChatEngine
|
|
84
|
+
TUITranslateService
|
|
85
85
|
} from '@tencentcloud/chat-uikit-engine';
|
|
86
|
-
import TUICore, {
|
|
86
|
+
import TUICore, {TUIConstants, TUILogin} from '@tencentcloud/tui-core';
|
|
87
87
|
import ChatHeader from './chat-header/index-web.vue';
|
|
88
88
|
import MessageList from './message-list/index-web.vue';
|
|
89
89
|
import MessageInput from './message-input/index-web.vue';
|
|
90
90
|
import MessageInputToolbar from './message-input-toolbar/index-web.vue';
|
|
91
91
|
import EmojiDialog from './message-input-toolbar/emoji-dialog-mobile/emoji-dialog-mobile.vue';
|
|
92
|
-
import { isPC
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
92
|
+
import {isH5, isPC} from '../../utils/env';
|
|
93
|
+
import {ToolbarButtonModel, ToolbarDisplayType} from '../../interface';
|
|
94
|
+
import {isSupportedLang} from '../../utils/';
|
|
95
95
|
import Log from '../../utils/logger';
|
|
96
96
|
import MessageToolbarButton from './message-toolbar-button/index.vue';
|
|
97
|
+
import TUILocales from '../../locales';
|
|
98
|
+
import { Toast, TOAST_TYPE } from '../common/Toast/index-web';
|
|
97
99
|
|
|
98
|
-
const { ref, onMounted, onUnmounted, computed } = vue;
|
|
100
|
+
const { ref, onMounted, onUnmounted, computed, nextTick } = vue;
|
|
99
101
|
|
|
100
102
|
interface IProps {
|
|
101
103
|
canCloseChat?: boolean;
|
|
@@ -103,6 +105,7 @@ interface IProps {
|
|
|
103
105
|
userID?:string;
|
|
104
106
|
userSig?:string;
|
|
105
107
|
robotLang?:string;
|
|
108
|
+
userLang?:string;
|
|
106
109
|
toolbarButtonList?:ToolbarButtonModel[];
|
|
107
110
|
}
|
|
108
111
|
|
|
@@ -111,15 +114,19 @@ const emits = defineEmits(['closeChat']);
|
|
|
111
114
|
const currentConversationID = ref();
|
|
112
115
|
const inputToolbarDisplayType = ref<ToolbarDisplayType>('none');
|
|
113
116
|
const messageInputRef = ref();
|
|
117
|
+
const isMuted = ref(false);
|
|
118
|
+
const muteText = ref('');
|
|
114
119
|
const messageListRef = ref<InstanceType<typeof MessageList>>();
|
|
115
120
|
const emojiOpen = ref(false);
|
|
116
121
|
const toolShowH5 = ref(false);
|
|
122
|
+
const langauges = Object.keys(TUILocales);
|
|
117
123
|
const props = withDefaults(defineProps<IProps>(), {
|
|
118
124
|
canCloseChat: true,
|
|
119
125
|
SDKAppID: 0,
|
|
120
126
|
userID: '',
|
|
121
127
|
userSig: '',
|
|
122
128
|
robotLang: '',
|
|
129
|
+
userLang:'',
|
|
123
130
|
toolbarButtonList:() => [] as ToolbarButtonModel[]
|
|
124
131
|
});
|
|
125
132
|
|
|
@@ -135,10 +142,49 @@ const loginCustomerUIKit = () => {
|
|
|
135
142
|
TUIConversationService.switchConversation(conversationID);
|
|
136
143
|
TUIChatEngine.chat.callExperimentalAPI('isFeatureEnabledForStat', Math.pow(2, 42));
|
|
137
144
|
}).catch((error) => {
|
|
145
|
+
Toast({
|
|
146
|
+
message: TUITranslateService.t('TUIChat.登录失败'),
|
|
147
|
+
type: TOAST_TYPE.ERROR,
|
|
148
|
+
duration: 30000,
|
|
149
|
+
});
|
|
138
150
|
console.log(error);
|
|
139
151
|
})
|
|
140
152
|
}
|
|
141
153
|
|
|
154
|
+
const convertLanguageToLowercase = (language) => {
|
|
155
|
+
let lowercase = language.toLowerCase();
|
|
156
|
+
if (lowercase === 'zh-cn' || lowercase === 'zh_cn') {
|
|
157
|
+
lowercase = 'zh';
|
|
158
|
+
} else if (lowercase === 'zh-tw' || lowercase === 'zh-hk') {
|
|
159
|
+
lowercase = 'zh_tw';
|
|
160
|
+
}
|
|
161
|
+
return lowercase;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const initLanguage = () => {
|
|
165
|
+
Log.i(`initLanguage ${props.userLang}`);
|
|
166
|
+
TUITranslateService.provideLanguages({ ...TUILocales });
|
|
167
|
+
TUITranslateService.useI18n();
|
|
168
|
+
let language;
|
|
169
|
+
if (props.userLang !== '') {
|
|
170
|
+
let userLang = convertLanguageToLowercase(props.userLang);
|
|
171
|
+
if (!langauges.includes(userLang)) {
|
|
172
|
+
Log.w(`userLang:${props.userLang} is not supported`);
|
|
173
|
+
language = 'en';
|
|
174
|
+
} else {
|
|
175
|
+
language = userLang;
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
let navigatorLang = convertLanguageToLowercase(navigator.language);
|
|
179
|
+
if (!langauges.includes(navigatorLang)) {
|
|
180
|
+
language = 'en';
|
|
181
|
+
} else {
|
|
182
|
+
language = navigatorLang;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
TUITranslateService.changeLanguage(language);
|
|
186
|
+
}
|
|
187
|
+
|
|
142
188
|
try {
|
|
143
189
|
const userContext = TUILogin.getContext();
|
|
144
190
|
if(userContext.userID == '' && props.SDKAppID!==0 && props.userID!=='' && props.userSig!==''){
|
|
@@ -147,6 +193,7 @@ try {
|
|
|
147
193
|
Log.w(`robotLang:${props.robotLang} is not supported`);
|
|
148
194
|
}
|
|
149
195
|
}
|
|
196
|
+
initLanguage();
|
|
150
197
|
} catch (e) {
|
|
151
198
|
console.log(e)
|
|
152
199
|
}
|
|
@@ -155,12 +202,18 @@ onMounted(() => {
|
|
|
155
202
|
TUIStore.watch(StoreName.CONV, {
|
|
156
203
|
currentConversationID: onCurrentConversationIDUpdate,
|
|
157
204
|
});
|
|
205
|
+
TUIStore.watch(StoreName.USER, {
|
|
206
|
+
kickedOut: onKickedOut
|
|
207
|
+
});
|
|
158
208
|
});
|
|
159
209
|
|
|
160
210
|
onUnmounted(() => {
|
|
161
211
|
TUIStore.unwatch(StoreName.CONV, {
|
|
162
212
|
currentConversationID: onCurrentConversationIDUpdate,
|
|
163
213
|
});
|
|
214
|
+
TUIStore.unwatch(StoreName.USER, {
|
|
215
|
+
kickedOut: onKickedOut
|
|
216
|
+
});
|
|
164
217
|
});
|
|
165
218
|
|
|
166
219
|
const isInputToolbarShow = computed<boolean>(() => {
|
|
@@ -211,6 +264,13 @@ function scrollToLatestMessage() {
|
|
|
211
264
|
messageListRef.value?.scrollToLatestMessage();
|
|
212
265
|
}
|
|
213
266
|
|
|
267
|
+
function onKickedOut(type: string) {
|
|
268
|
+
if (type) {
|
|
269
|
+
isMuted.value = true;
|
|
270
|
+
muteText.value = TUITranslateService.t('TUIChat.账号被强制下线');
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
214
274
|
function onCurrentConversationIDUpdate(conversationID: string) {
|
|
215
275
|
if (!conversationID) {
|
|
216
276
|
return;
|
|
@@ -759,7 +759,6 @@ defineExpose({
|
|
|
759
759
|
overflow: hidden;
|
|
760
760
|
|
|
761
761
|
.message-input-editor-area {
|
|
762
|
-
overflow: auto;
|
|
763
762
|
user-select: text;
|
|
764
763
|
hyphens: auto;
|
|
765
764
|
word-break: keep-all;
|
|
@@ -878,4 +877,11 @@ defineExpose({
|
|
|
878
877
|
pointer-events: none;
|
|
879
878
|
}
|
|
880
879
|
}
|
|
880
|
+
|
|
881
|
+
.message-input-mute {
|
|
882
|
+
color: #721c24;
|
|
883
|
+
background-color: #f8d7da;
|
|
884
|
+
border-color: #f5c6cb;
|
|
885
|
+
text-align: center;
|
|
886
|
+
}
|
|
881
887
|
</style>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
</ul>
|
|
18
18
|
<div class="sendButtonContainer">
|
|
19
19
|
<div class="sendButton" @click="sendMessage">
|
|
20
|
-
|
|
20
|
+
{{ TUITranslateService.t("发送") }}
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
23
|
</div>
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
TUIStore,
|
|
33
33
|
StoreName,
|
|
34
34
|
IConversationModel,
|
|
35
|
+
TUITranslateService,
|
|
35
36
|
SendMessageParams,
|
|
36
37
|
} from '@tencentcloud/chat-uikit-engine';
|
|
37
38
|
import {
|
package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue
CHANGED
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
class="send-btn"
|
|
62
62
|
@click="sendMessage"
|
|
63
63
|
>
|
|
64
|
-
|
|
64
|
+
{{ TUITranslateService.t("发送") }}
|
|
65
65
|
</li>
|
|
66
66
|
</ul>
|
|
67
67
|
</div>
|
|
@@ -74,6 +74,7 @@ import {
|
|
|
74
74
|
StoreName,
|
|
75
75
|
IConversationModel,
|
|
76
76
|
SendMessageParams,
|
|
77
|
+
TUITranslateService
|
|
77
78
|
} from '@tencentcloud/chat-uikit-engine';
|
|
78
79
|
import Icon from '../../../common/Icon.vue';
|
|
79
80
|
import faceIcon from '../../../../assets/face.png';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<ToolbarItemContainer
|
|
3
3
|
ref="container"
|
|
4
4
|
:iconFile="faceIcon"
|
|
5
|
-
title="表情"
|
|
5
|
+
:title="TUITranslateService.t('表情')"
|
|
6
6
|
@onDialogShow="onDialogShow"
|
|
7
7
|
@onDialogClose="onDialogClose"
|
|
8
8
|
:isH5EmojiShow="props.isH5EmojiShow"
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
TUIStore,
|
|
21
21
|
StoreName,
|
|
22
22
|
IConversationModel,
|
|
23
|
+
TUITranslateService
|
|
23
24
|
} from '@tencentcloud/chat-uikit-engine';
|
|
24
25
|
import vue from '../../../../adapter-vue';
|
|
25
26
|
import faceIcon from '../../../../assets/face.png';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ToolbarItemContainer
|
|
3
3
|
:iconFile="isH5?fileIconH5:fileIcon"
|
|
4
|
-
title="文件"
|
|
4
|
+
:title="TUITranslateService.t('文件')"
|
|
5
5
|
iconWidth='21px'
|
|
6
6
|
iconHeight='18px'
|
|
7
7
|
:needDialog="false"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<div :class="['file-upload', !isPC && 'file-upload-h5']">
|
|
11
11
|
<input
|
|
12
12
|
ref="inputRef"
|
|
13
|
-
title="文件"
|
|
13
|
+
:title="TUITranslateService.t('文件')"
|
|
14
14
|
type="file"
|
|
15
15
|
data-type="file"
|
|
16
16
|
accept="*"
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
IConversationModel,
|
|
28
28
|
SendMessageParams,
|
|
29
29
|
SendMessageOptions,
|
|
30
|
+
TUITranslateService
|
|
30
31
|
} from '@tencentcloud/chat-uikit-engine';
|
|
31
32
|
import vue from '../../../../adapter-vue';
|
|
32
33
|
import ToolbarItemContainer from '../toolbar-item-container/index.vue';
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
>
|
|
14
14
|
<input
|
|
15
15
|
ref="inputRef"
|
|
16
|
-
title="图片"
|
|
16
|
+
:title="TUITranslateService.t('图片')"
|
|
17
17
|
type="file"
|
|
18
18
|
accept="image/gif,image/jpeg,image/jpg,image/png,image/bmp,image/webp,video/mov,video/mp4"
|
|
19
19
|
@change="sendImageInWeb"
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
IConversationModel,
|
|
30
30
|
SendMessageParams,
|
|
31
31
|
SendMessageOptions,
|
|
32
|
+
TUITranslateService
|
|
32
33
|
} from '@tencentcloud/chat-uikit-engine';
|
|
33
34
|
import { TUIGlobal } from '@tencentcloud/universal-api';
|
|
34
35
|
import vue from '../../../../adapter-vue';
|
|
@@ -58,11 +59,11 @@ const currentConversation = ref<IConversationModel>();
|
|
|
58
59
|
const IMAGE_TOOLBAR_SHOW_MAP = {
|
|
59
60
|
web_album: {
|
|
60
61
|
icon: imageIcon,
|
|
61
|
-
title:
|
|
62
|
+
title: TUITranslateService.t("图片"),
|
|
62
63
|
},
|
|
63
64
|
uni_album: {
|
|
64
65
|
icon: imageUniIcon,
|
|
65
|
-
title:
|
|
66
|
+
title: TUITranslateService.t("图片"),
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
|
|
@@ -50,8 +50,8 @@ const { ref, onMounted, onUnmounted, watch } = vue;
|
|
|
50
50
|
|
|
51
51
|
interface IProps {
|
|
52
52
|
displayType: ToolbarDisplayType;
|
|
53
|
-
isH5EmojiShow
|
|
54
|
-
isH5ToolShow
|
|
53
|
+
isH5EmojiShow?:boolean;
|
|
54
|
+
isH5ToolShow?:boolean;
|
|
55
55
|
}
|
|
56
56
|
interface IEmits {
|
|
57
57
|
(e: 'scrollToLatestMessage'): void;
|