@tencentcloud/ai-desk-customer-vue 1.7.3 → 1.7.5

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 (34) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/components/CustomerServiceChat/index-web.vue +3 -0
  3. package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +5 -5
  4. package/components/CustomerServiceChat/message-list/index-web.vue +70 -9
  5. package/components/CustomerServiceChat/message-list/message-elements/message-bubble-web.vue +16 -7
  6. package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-desk.vue +7 -1
  7. package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-rich-text.vue +7 -48
  8. package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-stream.vue +6 -16
  9. package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-plugin-web.vue +6 -0
  10. package/components/CustomerServiceChat/message-list/message-elements/message-image-web.vue +1 -0
  11. package/components/CustomerServiceChat/message-list/message-elements/message-large-stream.vue +2 -16
  12. package/components/CustomerServiceChat/message-list/message-elements/message-video-web.vue +20 -8
  13. package/components/CustomerServiceChat/message-toolbar-button/index.vue +11 -0
  14. package/components/CustomerServiceChat/message-toolbar-button/toolbar-button-end-human-service.vue +108 -1
  15. package/components/CustomerServiceChat/style/h5.scss +2 -0
  16. package/components/common/Dialog/index.vue +28 -7
  17. package/components/common/Dialog/style/h5.scss +1 -9
  18. package/components/common/Dialog/style/web.scss +25 -11
  19. package/components/common/ImagePreviewer/image-item-web.vue +9 -1
  20. package/components/common/ImagePreviewer/index-web.vue +179 -42
  21. package/locales/en/aidesk.ts +4 -0
  22. package/locales/es/aidesk.ts +4 -0
  23. package/locales/fil/aidesk.ts +4 -0
  24. package/locales/id/aidesk.ts +5 -1
  25. package/locales/ja/aidesk.ts +4 -0
  26. package/locales/ko/aidesk.ts +4 -0
  27. package/locales/ms/aidesk.ts +4 -0
  28. package/locales/ru/aidesk.ts +4 -0
  29. package/locales/th/aidesk.ts +4 -0
  30. package/locales/vi/aidesk.ts +4 -0
  31. package/locales/zh_cn/aidesk.ts +4 -0
  32. package/locales/zh_tw/aidesk.ts +4 -0
  33. package/package.json +1 -1
  34. package/utils/utils.ts +24 -0
@@ -1,21 +1,52 @@
1
1
  <template>
2
- <div :class="['toolbar-button', isH5 ? 'toolbar-button-h5' : '', isClicked ? 'end-conversation-button-clicked' : '']" @click="onClick">
2
+ <div :class="['toolbar-button', 'end-human-service', isH5 ? 'toolbar-button-h5' : '', isClicked ? 'end-conversation-button-clicked' : '']" @click="onClick" v-bind="$attrs">
3
3
  <Icon v-if="props.icon" class="toolbar-button-icon" :file="props.icon" width="14px" height="14px"/>
4
4
  <div class="toolbar-button-text">
5
5
  {{ props.title || TUITranslateService.t('AIDesk.结束会话') }}
6
6
  </div>
7
7
  </div>
8
+ <Dialog
9
+ v-if="dialogShow"
10
+ class="end-conversation-dialog"
11
+ :show="dialogShow"
12
+ :center="true"
13
+ :isHeaderShow="false"
14
+ :confirmText="TUITranslateService.t('AIDesk.确认结束')"
15
+ :cancelText="TUITranslateService.t('AIDesk.再想想')"
16
+ :confirmBtnClass="'end-conversation-dialog__confirm-btn'"
17
+ @submit="onEndConversationConfirm"
18
+ @update:show="(e) => (dialogShow = e)"
19
+ >
20
+ <template #icon>
21
+ <div class="end-conversation-dialog-icon">
22
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
23
+ <path d="M18.36 6.64a9 9 0 1 1-12.73 0"></path>
24
+ <line x1="12" y1="2" x2="12" y2="12"></line>
25
+ </svg>
26
+ </div>
27
+ </template>
28
+ <div class="end-conversation-dialog-content">
29
+ <p class="end-conversation-dialog-title">
30
+ {{ TUITranslateService.t('AIDesk.确定要结束本次会话吗?') }}
31
+ </p>
32
+ <p class="end-conversation-dialog-desc">
33
+ {{ TUITranslateService.t('AIDesk.结束后将无法继续与当前客服对话') }}
34
+ </p>
35
+ </div>
36
+ </Dialog>
8
37
  </template>
9
38
  <script lang="ts" setup>
10
39
  import vue from '../../../adapter-vue';
11
40
  const { ref, onMounted, onUnmounted } = vue;
12
41
  import { isH5 } from '../../../utils/env';
13
42
  import Icon from '../../common/Icon.vue';
43
+ import Dialog from '../../common/Dialog/index.vue';
14
44
  import { TUITranslateService, TUIChatService, IConversationModel, TUIStore, StoreName } from '../../../@aidesk/uikit-engine';
15
45
  import { CUSTOM_MESSAGE_SRC } from '../../../constant';
16
46
  import { isEnabledMessageReadReceiptGlobal, getTo } from '../../../utils/utils';
17
47
  const currentConversation = ref<IConversationModel>();
18
48
  const isClicked = ref(false);
49
+ const dialogShow = ref(false);
19
50
  interface IProps {
20
51
  title?:string;
21
52
  icon?:string | undefined;
@@ -45,6 +76,13 @@ const onCurrentConversationUpdate = (conversation: IConversationModel) => {
45
76
  };
46
77
 
47
78
  const onClick = () => {
79
+ if (isClicked.value || !currentConversation.value) {
80
+ return;
81
+ }
82
+ dialogShow.value = true;
83
+ }
84
+
85
+ const onEndConversationConfirm = () => {
48
86
  if (isClicked.value || !currentConversation.value) {
49
87
  return;
50
88
  }
@@ -72,4 +110,73 @@ const onClick = () => {
72
110
  color: #97A3B4;
73
111
  cursor: default;
74
112
  }
113
+
114
+ .toolbar-button.end-human-service:not(.overflow-popover-item):hover {
115
+ border-color: #ef4444;
116
+ color: #ef4444;
117
+ background: #fef2f2;
118
+ }
119
+
120
+ .overflow-popover-item.end-human-service:hover {
121
+ color: #ef4444;
122
+ background: #fef2f2;
123
+ }
124
+
125
+ .end-conversation-dialog .end-conversation-dialog-icon {
126
+ width: 56px;
127
+ height: 56px;
128
+ border-radius: 50%;
129
+ background: linear-gradient(135deg, #fef3c7, #fde68a);
130
+ display: flex;
131
+ align-items: center;
132
+ justify-content: center;
133
+ color: #d97706;
134
+ }
135
+
136
+ .end-conversation-dialog .end-conversation-dialog-icon svg {
137
+ width: 28px;
138
+ height: 28px;
139
+ }
140
+
141
+ .end-conversation-dialog .end-conversation-dialog-content {
142
+ display: flex;
143
+ flex-direction: column;
144
+ align-items: center;
145
+ text-align: center;
146
+ }
147
+
148
+ .end-conversation-dialog .end-conversation-dialog-title {
149
+ font-size: 18px;
150
+ font-weight: 600;
151
+ margin: 0 0 8px;
152
+ }
153
+
154
+ .end-conversation-dialog .end-conversation-dialog-desc {
155
+ font-size: 14px;
156
+ color: #666;
157
+ margin: 0;
158
+ }
159
+
160
+ .end-conversation-dialog .dialog-main-content {
161
+ flex-direction: column;
162
+ margin-bottom: 24px;
163
+ }
164
+
165
+ .end-conversation-dialog .dialog-main {
166
+ background: #fff;
167
+ border-radius: 16px;
168
+ width: 380px;
169
+ padding: 32px 28px 24px;
170
+ text-align: center;
171
+ box-shadow: 0 20px 60px rgba(0, 0, 0, .15);
172
+ }
173
+
174
+ .end-conversation-dialog .btn.end-conversation-dialog__confirm-btn {
175
+ border: 0;
176
+ background: linear-gradient(135deg, #ef4444, #dc2626);
177
+ color: #fff;
178
+ box-shadow: 0 2px 8px rgba(239, 68, 68, .3);
179
+ }
180
+
181
+
75
182
  </style>
@@ -8,6 +8,8 @@
8
8
  background-image:url("../../../assets/background_mobile.png");
9
9
  background-size: cover;
10
10
  height: 100vh;
11
+ // iOS Safari 100vh 包含浏览器工具栏,会遮挡底部输入框;使用动态视口单位 dvh
12
+ height: 100dvh;
11
13
  &-message-list {
12
14
  flex: 1;
13
15
  overflow: hidden;
@@ -22,10 +22,13 @@
22
22
  @click="close"
23
23
  />
24
24
  </header>
25
- <div
26
- class="dialog-main-content"
27
- :class="[isH5 ? 'dialog-main-content-uniapp' : '']"
28
- >
25
+ <div class="dialog-main-content">
26
+ <div
27
+ v-if="$slots.icon"
28
+ class="dialog-main-icon"
29
+ >
30
+ <slot name="icon" />
31
+ </div>
29
32
  <slot />
30
33
  </div>
31
34
  <footer
@@ -34,15 +37,17 @@
34
37
  >
35
38
  <button
36
39
  class="btn btn-cancel"
40
+ :class="cancelBtnClass"
37
41
  @click="close"
38
42
  >
39
- {{ TUITranslateService.t('取消') }}
43
+ {{ cancelText || TUITranslateService.t('取消') }}
40
44
  </button>
41
45
  <button
42
46
  class="btn btn-default"
47
+ :class="confirmBtnClass"
43
48
  @click="submit"
44
49
  >
45
- {{ TUITranslateService.t('确定') }}
50
+ {{ confirmText || TUITranslateService.t('确定') }}
46
51
  </button>
47
52
  </footer>
48
53
  </main>
@@ -52,7 +57,7 @@
52
57
  <script lang="ts" setup>
53
58
  import vue from '../../../adapter-vue';
54
59
  import { TUITranslateService } from '../../../@aidesk/uikit-engine';
55
- import { isPC, isH5 } from '../../../utils/env';
60
+ import { isPC } from '../../../utils/env';
56
61
  const { ref, watchEffect } = vue;
57
62
  const clickType = {
58
63
  OUTSIDE: 'outside',
@@ -83,6 +88,22 @@ const props = defineProps({
83
88
  type: Boolean,
84
89
  default: false,
85
90
  },
91
+ confirmText: {
92
+ type: String,
93
+ default: '',
94
+ },
95
+ cancelText: {
96
+ type: String,
97
+ default: '',
98
+ },
99
+ confirmBtnClass: {
100
+ type: String,
101
+ default: '',
102
+ },
103
+ cancelBtnClass: {
104
+ type: String,
105
+ default: '',
106
+ },
86
107
  });
87
108
 
88
109
  const showDialog = ref(false);
@@ -5,8 +5,7 @@
5
5
 
6
6
  .dialog {
7
7
  &-main {
8
- border-radius: 0;
9
- padding: 0;
8
+ border-radius: 10px;
10
9
  display: flex;
11
10
  flex-direction: column;
12
11
  overflow: hidden;
@@ -23,16 +22,9 @@
23
22
  display: flex;
24
23
  justify-content: center;
25
24
  align-items: center;
26
- margin-bottom: 0;
27
-
28
- &-uniapp {
29
- padding: 40px 0;
30
- }
31
25
  }
32
26
 
33
27
  &-footer {
34
- border-top: 1px solid #DDD;
35
-
36
28
  .btn {
37
29
  flex: 1;
38
30
  margin: 0;
@@ -4,15 +4,15 @@
4
4
  height: 100%;
5
5
  left: 0;
6
6
  top: 0;
7
- z-index: 6;
7
+ z-index: 9999;
8
8
  display: flex;
9
9
  justify-content: center;
10
10
  align-items: center;
11
11
 
12
12
  &-main {
13
13
  min-width: 368px;
14
- border-radius: 10px;
15
- padding: 20px 30px;
14
+ border-radius: 12px;
15
+ padding: 32px 28px 24px;
16
16
 
17
17
  &-header {
18
18
  display: flex;
@@ -35,27 +35,41 @@
35
35
  margin-bottom: 20px;
36
36
  }
37
37
 
38
+ &-icon {
39
+ display: flex;
40
+ justify-content: center;
41
+ margin-bottom: 12px;
42
+ }
43
+
38
44
  &-footer {
39
45
  display: flex;
40
- justify-content: flex-end;
46
+ justify-content: center;
47
+ gap: 12px;
41
48
  }
42
49
  }
43
50
  }
44
51
 
45
52
  .btn {
46
- padding: 8px 20px;
47
- margin: 0 6px;
48
- border-radius: 4px;
49
- border: none;
53
+ flex: 1;
54
+ margin: 0;
55
+ padding: 11px 0;
56
+ border: 0;
57
+ border-radius: 9px;
58
+ background: #efefef;
50
59
  font-size: 14px;
60
+ font-weight: 500;
61
+ color: #666;
51
62
  text-align: center;
52
63
  line-height: 20px;
64
+ cursor: pointer;
65
+ transition: all .2s;
53
66
 
54
67
  &:disabled {
55
- opacity: 0.3;
68
+ opacity: .3;
56
69
  }
57
70
 
58
- &:last-child {
59
- margin-right: 0;
71
+ &-default {
72
+ background: #006eff;
73
+ color: #fff;
60
74
  }
61
75
  }
@@ -2,7 +2,7 @@
2
2
  <img
3
3
  class="image-preview"
4
4
  :style="{
5
- transform: `scale(${props.zoom}) rotate(${props.rotate}deg)`,
5
+ transform: `translate3d(${props.translateX}px, ${props.translateY}px, 0) scale(${props.zoom}) rotate(${props.rotate}deg)`,
6
6
  }"
7
7
  :src="props.src"
8
8
  >
@@ -21,6 +21,14 @@ const props = defineProps({
21
21
  type: String,
22
22
  default: '',
23
23
  },
24
+ translateX: {
25
+ type: Number,
26
+ default: 0,
27
+ },
28
+ translateY: {
29
+ type: Number,
30
+ default: 0,
31
+ },
24
32
  });
25
33
  </script>
26
34
  <style lang="scss">