cnhis-design-vue 2.1.30 → 2.1.31

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 (129) hide show
  1. package/CHANGELOG.md +22 -22
  2. package/es/affix/index.js +8 -8
  3. package/es/age/index.js +10 -10
  4. package/es/alert/index.js +8 -8
  5. package/es/anchor/index.js +8 -8
  6. package/es/auto-complete/index.js +8 -8
  7. package/es/avatar/index.js +8 -8
  8. package/es/back-top/index.js +8 -8
  9. package/es/badge/index.js +8 -8
  10. package/es/base/index.js +8 -8
  11. package/es/big-table/index.js +164 -164
  12. package/es/breadcrumb/index.js +8 -8
  13. package/es/button/index.js +31 -31
  14. package/es/calendar/index.js +8 -8
  15. package/es/captcha/index.js +3 -3
  16. package/es/card/index.js +8 -8
  17. package/es/carousel/index.js +8 -8
  18. package/es/cascader/index.js +8 -8
  19. package/es/checkbox/index.js +9 -9
  20. package/es/col/index.js +8 -8
  21. package/es/collapse/index.js +8 -8
  22. package/es/color-picker/index.js +1 -1
  23. package/es/comment/index.js +8 -8
  24. package/es/config-provider/index.js +8 -8
  25. package/es/date-picker/index.js +8 -8
  26. package/es/descriptions/index.js +8 -8
  27. package/es/divider/index.js +8 -8
  28. package/es/drag-layout/index.js +3 -3
  29. package/es/drawer/index.js +8 -8
  30. package/es/dropdown/index.js +8 -8
  31. package/es/editor/index.js +1 -1
  32. package/es/empty/index.js +8 -8
  33. package/es/fabric-chart/index.js +11 -11
  34. package/es/form/index.js +8 -8
  35. package/es/form-model/index.js +8 -8
  36. package/es/form-table/index.js +94 -92
  37. package/es/form-table/style.css +1 -1
  38. package/es/index/index.js +708 -667
  39. package/es/index/style.css +1 -1
  40. package/es/input/index.js +9 -9
  41. package/es/input-number/index.js +8 -8
  42. package/es/layout/index.js +8 -8
  43. package/es/list/index.js +8 -8
  44. package/es/locale-provider/index.js +8 -8
  45. package/es/map/index.js +9 -9
  46. package/es/mentions/index.js +8 -8
  47. package/es/menu/index.js +8 -8
  48. package/es/message/index.js +8 -8
  49. package/es/multi-chat/index.js +164 -148
  50. package/es/multi-chat/style.css +1 -1
  51. package/es/multi-chat-client/index.js +133 -117
  52. package/es/multi-chat-client/style.css +1 -1
  53. package/es/multi-chat-history/index.js +40 -27
  54. package/es/multi-chat-history/style.css +1 -1
  55. package/es/multi-chat-record/index.js +74 -36
  56. package/es/multi-chat-record/style.css +1 -1
  57. package/es/multi-chat-setting/index.js +79 -46
  58. package/es/multi-chat-setting/style.css +1 -1
  59. package/es/multi-chat-sip/index.js +1 -1
  60. package/es/notification/index.js +8 -8
  61. package/es/page-header/index.js +8 -8
  62. package/es/pagination/index.js +8 -8
  63. package/es/popconfirm/index.js +8 -8
  64. package/es/popover/index.js +8 -8
  65. package/es/progress/index.js +8 -8
  66. package/es/radio/index.js +9 -9
  67. package/es/rate/index.js +8 -8
  68. package/es/result/index.js +8 -8
  69. package/es/row/index.js +8 -8
  70. package/es/scale-view/index.js +33 -33
  71. package/es/select/index.js +11 -11
  72. package/es/select-label/index.js +11 -11
  73. package/es/select-person/index.js +2 -2
  74. package/es/shortcut-setter/index.js +10 -10
  75. package/es/skeleton/index.js +8 -8
  76. package/es/slider/index.js +8 -8
  77. package/es/space/index.js +8 -8
  78. package/es/spin/index.js +8 -8
  79. package/es/statistic/index.js +8 -8
  80. package/es/steps/index.js +8 -8
  81. package/es/switch/index.js +8 -8
  82. package/es/table-filter/index.js +74 -74
  83. package/es/tabs/index.js +8 -8
  84. package/es/tag/index.js +9 -9
  85. package/es/time-picker/index.js +8 -8
  86. package/es/timeline/index.js +8 -8
  87. package/es/tooltip/index.js +8 -8
  88. package/es/transfer/index.js +8 -8
  89. package/es/tree/index.js +8 -8
  90. package/es/tree-select/index.js +8 -8
  91. package/es/upload/index.js +8 -8
  92. package/es/utils/UniRTCv2.js +12 -2
  93. package/es/verification-code/index.js +2 -2
  94. package/lib/cui.common.js +796 -754
  95. package/lib/cui.umd.js +796 -754
  96. package/lib/cui.umd.min.js +39 -39
  97. package/package.json +2 -2
  98. package/packages/big-table/src/BigTable.vue +3044 -3044
  99. package/packages/big-table/src/utils/batchEditing.js +610 -610
  100. package/packages/big-table/src/utils/bigTableProps.js +95 -95
  101. package/packages/button/src/ButtonPrint/components/IdentityVerification.vue +181 -181
  102. package/packages/button/src/ButtonPrint/index.vue +739 -739
  103. package/packages/fabric-chart/src/components/TimeScaleValue.vue +113 -113
  104. package/packages/fabric-chart/src/const/defaultVaule.js +59 -59
  105. package/packages/fabric-chart/src/fabric-chart/FabricScaleValue.vue +135 -135
  106. package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +558 -558
  107. package/packages/fabric-chart/src/fabric-chart2/FabricTop.vue +172 -172
  108. package/packages/form-table/src/FormTable.vue +4 -1
  109. package/packages/multi-chat/chat/audio.vue +5 -2
  110. package/packages/multi-chat/chat/chatFooter.vue +1594 -1594
  111. package/packages/multi-chat/chat/chatHistory.vue +6 -0
  112. package/packages/multi-chat/chat/index.vue +2 -1
  113. package/packages/multi-chat/chat/quickReply.vue +439 -439
  114. package/packages/multi-chat/components/avatar.vue +1 -2
  115. package/packages/multi-chat/img/replay.png +0 -0
  116. package/packages/multi-chat/setting/baseInfo/index.vue +1316 -1316
  117. package/packages/multi-chat/setting/sessionList/messageRecord.vue +9 -0
  118. package/packages/multi-chat/store/getters.js +3 -0
  119. package/packages/multi-chat/store/mutation.js +3 -0
  120. package/packages/multi-chat/store/state.js +113 -112
  121. package/packages/scale-view/formitem/r-choice.vue +714 -714
  122. package/packages/scale-view/scaleView.vue +2010 -2010
  123. package/packages/table-filter/src/components/c-tree-select/tree-select.vue +336 -336
  124. package/packages/table-filter/src/components/multi-select/multi-select.vue +219 -219
  125. package/packages/table-filter/src/components/out-quick-search/out-quick-search.vue +340 -340
  126. package/packages/table-filter/src/components/search-condition/SearchCondition.vue +1825 -1825
  127. package/packages/table-filter/src/const/dataOptions.js +43 -43
  128. package/src/directive/preventReClick.js +12 -12
  129. package/src/utils/UniRTCv2.js +7 -2
@@ -1,1594 +1,1594 @@
1
- <template>
2
- <a-layout-footer style="position: relative;cursor:pointer" v-show="!queueItem || !hideQueueBtns">
3
- <div class="message-operate">
4
- <a-upload
5
- v-if="isShow('PICTURE')"
6
- class="operate-icon"
7
- v-decorator="[
8
- 'upload',
9
- {
10
- valuePropName: 'fileList'
11
- }
12
- ]"
13
- :beforeUpload="beforeUpload"
14
- >
15
- <a-tooltip placement="top">
16
- <template slot="title">{{ i18nText('1.9.181') }}</template>
17
- <svg-icon icon-class="liaotiantupian1" class="toolbar"></svg-icon>
18
- </a-tooltip>
19
- </a-upload>
20
- <a-popover :title="i18nText('1.9.354')" trigger="click" v-model="visible">
21
- <a slot="content">
22
- <div class="emoji-wrapper">
23
- <p v-for="(item, index) in emojiList" :key="index" @click="() => handleEmojiClick(item)" :class="['twa', 'emoji', item]"></p>
24
- </div>
25
- </a>
26
-
27
- <a-tooltip placement="top">
28
- <template slot="title">{{ i18nText('1.9.354') }}</template>
29
- <svg-icon icon-class="liaotianbiaoqing1" @click="showEmoji" class="toolbar" v-if="isShow('SMILINEFACE')"></svg-icon>
30
- </a-tooltip>
31
- </a-popover>
32
- <template v-for="(item, index) in toolbar">
33
- <a-tooltip placement="top" :key="index">
34
- <template slot="title">{{ item.name }}</template>
35
- <svg-icon :icon-class="item.icon" class="toolbar" :class="{ 'closed-toolbar': closedSession }" @click="handleToolBarClick(item)"></svg-icon>
36
- </a-tooltip>
37
- </template>
38
- <!-- 快捷回复 -->
39
- <a-tooltip placement="top" :title="'快捷回复'">
40
- <a-popover trigger="click" overlayClassName="quick-reply" placement="topLeft" v-model="quickShow">
41
- <template slot="content">
42
- <quick-reply :quickShow.sync="quickShow" :quickData="quickData"></quick-reply>
43
- </template>
44
- <svg-icon icon-class="liaotiankuaijiehuifu1" class="toolbar" @click="openQuickData" v-if="isShow('FASTREPLY') && isServer"></svg-icon>
45
- </a-popover>
46
- </a-tooltip>
47
- <a-tooltip :title="'语音通话'">
48
- <svg-icon icon-class="liaotianyuyindianhua" @click="handleVideoClick('voice')" class="toolbar" v-if="isShow('VOICE_CALL')"></svg-icon>
49
- <!-- <img
50
- width="20"
51
- src="../img/multi-voice.png"
52
- @click="handleVideoClick('voice')"
53
- v-if="isShow('VOICE_CALL') && isServer"
54
- /> -->
55
- </a-tooltip>
56
- <a-tooltip :title="'发送语音'">
57
- <svg-icon icon-class="liaotianyuyin1" @click="handleVoice(true)" class="toolbar" :class="{ 'click-voice': showVoice }" v-if="isShow('VOICE')"></svg-icon>
58
- <!-- <img
59
- width="20"
60
- src="../img/multi-video.png"
61
- @click="handleVideoClick('video')"
62
- v-if="isShow('VIDEO') && isServer"
63
- /> -->
64
- </a-tooltip>
65
- <a-tooltip :title="'视频通话'">
66
- <svg-icon icon-class="liaotianshipin1" @click="handleVideoClick('video')" class="toolbar" v-if="isShow('VIDEO')"></svg-icon>
67
- <!-- <img
68
- width="20"
69
- src="../img/multi-video.png"
70
- @click="handleVideoClick('video')"
71
- v-if="isShow('VIDEO') && isServer"
72
- /> -->
73
- </a-tooltip>
74
- </div>
75
- <div class="message" style="text-align: left">
76
- <div class="content-edit">
77
- <div
78
- ref="contentEdit"
79
- @click="saveRange"
80
- @keyup.exact="saveRange"
81
- @change="changeData"
82
- @input="handleInput"
83
- @compositionstart="() => (this.ping = true)"
84
- @compositionend="() => (this.ping = false)"
85
- @keydown="handleKeyDown"
86
- @paste="handlePaste"
87
- contenteditable="true"
88
- ></div>
89
- </div>
90
- <span class="prompt">Enter {{ i18nText('1.2.1.11.6') }}, Ctrl + Enter {{ i18nText('1.9.356') }}</span>
91
- <a-button :disabled="sendDisabled" class="message-send" @click="handleMsgSend">{{ i18nText('1.2.1.11.6') }}</a-button>
92
- </div>
93
- <div id="canvas-wrapper" style="display: none">
94
- <canvas id="canvas"></canvas>
95
- </div>
96
- <template v-if="showOverlay">
97
- <div class="overlay" v-if="(!onChating || sessionEnd) && !queueItem"></div>
98
- </template>
99
- <div class="queue-page" v-if="queueItem">
100
- <div v-if="accessDesc" class="queue-tips">{{ accessDesc }}</div>
101
- <div class="queue-btns">
102
- <div v-if="enableTransfer" class="toSession" @click="handleOpenTransfer">
103
- {{ i18nText('1.10.201') }}
104
- </div>
105
- <div class="toSession primary" @click="handleAccess">
106
- {{ accessText || i18nText('1.9.352') }}
107
- </div>
108
- <div v-if="enableRefuse" class="toSession danger" @click="openRefuseReason">
109
- {{ i18nText('1.9.353') }}
110
- </div>
111
- </div>
112
- </div>
113
- <!-- 操作栏弹窗 -->
114
- <a-modal
115
- :wrapClassName="isFullScreen ? 'chat-footer-modal-big' : 'chat-footer-modal-small'"
116
- :title="modalData.name"
117
- :visible="modalShow"
118
- :maskClosable="false"
119
- :mask="true"
120
- :width="isFullScreen ? '100%' : '80%'"
121
- destroyOnClose
122
- :okText="i18nText('1.2.1.11.6')"
123
- :footer="null"
124
- @cancel="handleClose"
125
- @ok="handleOk"
126
- >
127
- <iframe id="toolbarIframe" v-if="modalData.targetType === 'LINK_ADDRESS'" width="100%" height="100%" frameborder="0" :src="modalData.address" allow="camera;midi"></iframe>
128
- </a-modal>
129
- <!-- 接入拦截 -->
130
- <a-modal
131
- :title="accessInterceptTitle"
132
- :visible="accessIntercept"
133
- :maskClosable="false"
134
- :mask="true"
135
- :footer="null"
136
- destroyOnClose
137
- :width="600"
138
- :bodyStyle="{ height: '280px' }"
139
- @cancel="
140
- () => {
141
- this.accessIntercept = false;
142
- }
143
- "
144
- >
145
- <iframe width="100%" height="100%" frameborder="0" :src="accessInterceptUrl"></iframe>
146
- </a-modal>
147
- <!-- 语音消息 -->
148
- <voice v-if="showVoice" :showVoice="showVoice" @closeVoice="handleVoice"></voice>
149
- <ModalUserTransfer v-if="enableTransfer" :title="i18nText('1.10.201')" :visible.sync="transferVisible" :assemblyId="assemblyId" @ok="handleTransfer" />
150
- <ModalRefuseReason v-if="refuseVisible" :visible.sync="refuseVisible" :reasonList="refuseReasonList" @ok="handleRefuse" />
151
- </a-layout-footer>
152
- </template>
153
-
154
- <script>
155
- import { Layout, Tooltip, Upload, Modal, Popover, Button } from 'ant-design-vue';
156
- import SvgIcon from '@/component/svg/index.vue';
157
- import ImageCompress from '../utils/compressImage';
158
- import { parseParams } from '../utils/panelsetting';
159
-
160
- import { mapState, mapGetters, mapMutations, mapActions } from '../store/helper';
161
- import fetch, { qs } from '@/utils/chatFetch';
162
- import QuickReply from './quickReply';
163
- import voice from './voice';
164
- import ModalUserTransfer from '../components/modal-user-transfer';
165
- import ModalRefuseReason from '../components/modal-refuse-reason';
166
- import vexutils from '@/utils/vexutils';
167
- export default {
168
- inject: ['store', 'i18nText', 'dispatchEvent', 'registerEvent', 'unregisterEvent'],
169
- components: {
170
- AModal: Modal,
171
- [Layout.Footer.name]: Layout.Footer,
172
- [Tooltip.name]: Tooltip,
173
- [Upload.name]: Upload,
174
- [Button.name]: Button,
175
- [Popover.name]: Popover,
176
- SvgIcon,
177
- ModalRefuseReason,
178
- ModalUserTransfer,
179
- QuickReply,
180
- voice
181
- },
182
- props: {
183
- // 隐藏排队状态底部信息
184
- hideQueueBtns: {
185
- type: Boolean,
186
- default: false
187
- },
188
- validTalkingEnv: {
189
- type: Function
190
- },
191
- curChatType: {
192
- type: String
193
- },
194
- clientFinish: {
195
- type: Boolean,
196
- default: true
197
- },
198
- addvisible: {
199
- type: Boolean,
200
- default: false
201
- },
202
- isShowVoice: {
203
- type: Boolean,
204
- default: false
205
- }
206
- },
207
- data() {
208
- return {
209
- // message: "",
210
- visible: false,
211
- modalShow: false,
212
- modalData: {},
213
- ping: false,
214
- templateId: null, // 卡片模板
215
- isFullScreen: false,
216
- emojiList: require('../utils/emoji.json'),
217
- quickData: [],
218
- quickShow: false,
219
- screenshot: false,
220
- screenshotFile: null,
221
- timer: null,
222
- accessIntercept: false,
223
- curToolbarItem: {},
224
- showVoice: false,
225
- transferVisible: false,
226
- refuseVisible: false,
227
-
228
- apiResult: {}, // 前置条件的返回值
229
- };
230
- },
231
- computed: {
232
- ...mapGetters([
233
- 'userInfo',
234
- 'assemblyId',
235
- 'sessionId',
236
- 'serviceId',
237
- 'onChating',
238
- 'roomId',
239
- 'isServer',
240
- 'assemblySetting',
241
- 'chatType',
242
- 'sessionEnd',
243
- 'closedSession',
244
- 'clientParams',
245
- 'footerMessage',
246
- 'queueItem',
247
- 'sessionType',
248
- 'groupMembers',
249
- 'curScrollItem'
250
- ]),
251
- ...mapState({
252
- classify: state => state.lastClassify || state.classify
253
- }),
254
- message() {
255
- return this.footerMessage;
256
- },
257
- sendDisabled() {
258
- return this.message.length === 0;
259
- },
260
- orgId() {
261
- return this.userInfo?.sysParams?.orgId;
262
- },
263
- userId() {
264
- return this.userInfo?.sysParams?.userId;
265
- },
266
- toolbar() {
267
- if (!this.isServer) return [];
268
- let toolbar = this.assemblySetting.toolbar || [];
269
- toolbar = toolbar.filter(item => {
270
- const { source, isChecked, isCloseChecked, isClosedAble } = item;
271
- if (source === 'PC' && (
272
- (!this.closedSession && isChecked === 'Y') ||
273
- (this.closedSession && isCloseChecked === 'Y' && isChecked === 'Y' && isClosedAble === 'Y')
274
- )
275
- ){
276
- const showCondition = item.showCondition || [];
277
- const i = showCondition.findIndex(({ p_name, p_value }) => {
278
- const params = this.clientParams;
279
- const value = params[p_name];
280
- if (p_value.startsWith('form.')) {
281
- return value !== p_name[p_value.slice(5)];
282
- }
283
- return value !== p_value;
284
- });
285
- return i < 0;
286
- }
287
- return false;
288
- });
289
- return toolbar;
290
- },
291
- isListClassify() {
292
- return this.assemblySetting.isListClassify === 'Y';
293
- },
294
- showOverlay() {
295
- return this.curChatType != 'robot' || this.clientFinish;
296
- },
297
- accessText() {
298
- let obj = this.assemblySetting.serverSetting.serverInfo.filter(item => item.key === 'ongoingButton')[0];
299
- return obj?.value;
300
- },
301
- accessDesc() {
302
- let obj = this.assemblySetting.serverSetting.serverInfo.filter(item => item.key === 'ongoingDescription')[0];
303
- return obj?.value;
304
- },
305
- accessInterceptObj() {
306
- let obj = this.assemblySetting.accessInterceptSetting?.filter(item => item.source === 'PC');
307
- if (obj && obj[0]) {
308
- return obj[0];
309
- }
310
- return undefined;
311
- },
312
- // 拦截url
313
- accessInterceptUrl() {
314
- const { accessInterceptObj: obj, apiResult } = this;
315
- if (obj) {
316
- return this.getLinkAddress(obj,{result:apiResult});
317
- }
318
- return '';
319
- },
320
- // 拦截title
321
- accessInterceptTitle() {
322
- const { accessInterceptObj: obj } = this;
323
- if (obj) {
324
- let res = obj.titleI18n ? this.i18nText(obj.titleI18n) : obj.title;
325
- return res || '接入拦截';
326
- }
327
- return '接入拦截';
328
- },
329
- // 是否开启 排队转接
330
- enableTransfer() {
331
- if (this.assemblySetting.type === 'single') {
332
- let setting = null;
333
- if (this.isListClassify) {
334
- const classify = this.classify;
335
- const { listClassify = [] } = this.assemblySetting;
336
- const target = listClassify.find(item => item.classify === classify);
337
- setting = target ? target.serverFunctionSetting : null;
338
- } else {
339
- setting = this.assemblySetting?.serverSetting?.functionSetting;
340
- }
341
- if (setting) {
342
- const v = setting.find(item => item.function === 'TRANSFER_BEFORE');
343
- return v ? v.isChecked == 'Y' : false;
344
- }
345
- }
346
- return false;
347
- },
348
- enableRefuse() {
349
- let setting = null;
350
- if (this.isListClassify) {
351
- const classify = this.classify;
352
- const { listClassify = [] } = this.assemblySetting;
353
- const target = listClassify.find(item => item.classify === classify);
354
- setting = target ? target.serverFunctionSetting : null;
355
- } else {
356
- setting = this.assemblySetting?.serverSetting?.functionSetting;
357
- }
358
- if (setting) {
359
- const v = setting.find(item => item.function === 'ACCESS_REFUSE');
360
- return v ? v.isChecked == 'Y' : false;
361
- }
362
- return false;
363
- },
364
- refuseReasonList() {
365
- const list = this.assemblySetting?.refuseReasonSetting?.list || [];
366
- return list.filter(v => !!v.text);
367
- }
368
- },
369
-
370
- mounted() {
371
- this.bindEvents();
372
- },
373
- methods: {
374
- ...mapMutations([
375
- 'setLastClassify',
376
- 'setSessionTimer',
377
- 'setScrollQueueId',
378
- 'setCurScrollItem',
379
- 'setIsAppendMsg',
380
- 'setMessage',
381
- 'setShowVideo',
382
- 'setCaller',
383
- 'setMedicalOrPrescription',
384
- 'setModalVisible',
385
- 'setFooterMessage',
386
- 'setQueueItem',
387
- 'setSessionId',
388
- 'setCurrentTab',
389
- 'setClientId',
390
- 'setOnChating',
391
- 'setClientParams',
392
- 'setSessionHistoryList',
393
- 'setSessionEnd',
394
- 'setQuestionId',
395
- 'setDictionaryKey',
396
- 'setMultiVideoShow',
397
- 'setVideoStatus',
398
- 'setVideoMode',
399
- 'setAddMemberType',
400
- 'setShowAudio',
401
- 'setVideoMembers',
402
- 'setLastCurrentTab',
403
- 'setIsRecorderVoice',
404
- 'setVideoData',
405
- 'setSessionType'
406
- ]),
407
- ...mapMutations({
408
- clearMsgList: 'setMsgList'
409
- }),
410
- ...mapActions(['sendMessage', 'sendRobotMessage', 'handleBotChat', 'setMsgList', 'setChatTimer']),
411
- deleteStyle(value) {
412
- // 去掉样式
413
- value = value.replace(/style\s*?=\s*?(['"])[\s\S]*?\1/g, '');
414
- value = value.replace(/data\s*?=\s*?(['"])[\s\S]*?\1/g, '');
415
- value = value.replace(/class\s*?=\s*?(['"])[\s\S]*?\1/g, match => {
416
- if (match.includes('twa')) {
417
- return match;
418
- } else {
419
- return '';
420
- }
421
- });
422
- value = value.replace(/face\s*?=\s*?(['"])[\s\S]*?\1/g, '');
423
- value = value.replace(/<a/g, '<span');
424
- value = value.replace(/a>/g, 'span>');
425
- value = value.replace(/<i/g, '<span');
426
- value = value.replace(/i>/g, 'span>');
427
- value = value.replace(/<u/g, '<span');
428
- value = value.replace(/u>/g, 'span>');
429
- value = value.replace(/<strong/g, '<span');
430
- value = value.replace(/strong>/g, 'span>');
431
- value = value.replace(/<h\d/g, '<span');
432
- value = value.replace(/h\d>/g, 'span>');
433
- value = value.replace(/<b>/g, '<span>');
434
- value = value.replace(/b>/g, 'span>');
435
- value = value.replace(/<font/g, '<span');
436
- value = value.replace(/font>/g, 'span>');
437
- return value;
438
- },
439
- // 更新 message值 (未用v-html,修改后需要手动设置聊天框html内容)
440
- updateMessage(value) {
441
- this._editValue = value;
442
- this.setFooterMessage(`${value}`);
443
- const editRef = this.$refs.contentEdit;
444
- if (!editRef) return;
445
- editRef.innerHTML = value;
446
- },
447
- // 根据 聊天框 html节点内容 设置 message值 (未用v-html,html内容更改需主动设置message值)
448
- setMessageByHTML() {
449
- const editRef = this.$refs.contentEdit;
450
- if (!editRef) return;
451
- const message = editRef.innerHTML;
452
- this._editValue = message;
453
- this.setFooterMessage(`${message}`);
454
- },
455
-
456
- showEmoji() {
457
- // this.visible = true;
458
- },
459
-
460
- isShow(type) {
461
- if (type === 'SMILINEFACE' && this.curChatType === 'robot') return true;
462
- if (this.isListClassify) {
463
- let label;
464
- if (this.isServer) {
465
- label = 'serverFunctionSetting';
466
- } else {
467
- label = 'clientFunctionSetting';
468
- }
469
- let classifyItem = this.assemblySetting.listClassify.filter(item => item.classify === this.classify);
470
- if (!classifyItem || !classifyItem.length) return;
471
- let funs = classifyItem[0][label] || [];
472
- return funs.find(item => item.function === type)?.isChecked === 'Y';
473
- }
474
- let label;
475
- if (this.isServer) {
476
- label = 'serverSetting';
477
- } else {
478
- label = 'clientSetting';
479
- }
480
- let funs = this.assemblySetting[label]?.functionSetting || [];
481
- return funs.find(item => item.function === type)?.isChecked === 'Y';
482
- },
483
-
484
- handleEmojiClick(item) {
485
- let emojiHtml = `<p contenteditable="false" class="twa emoji ${item}"></p>&nbsp`;
486
- this.insertToEdit(emojiHtml);
487
- },
488
- /* edit-content光标定位 */
489
- resetSelection() {
490
- let edit = this.$refs.contentEdit;
491
- let sel, range;
492
- if (window.getSelection && document.createRange) {
493
- range = document.createRange();
494
- range.selectNodeContents(edit);
495
- range.collapse(true);
496
- range.setEnd(edit, edit.childNodes.length);
497
- range.setStart(edit, edit.childNodes.length);
498
- sel = window.getSelection();
499
- sel.removeAllRanges();
500
- sel.addRange(range);
501
- }
502
- },
503
-
504
- insertToEdit(value, isEditing) {
505
- const { _editSel, _editRange } = this;
506
- let sel, range;
507
- if (window.getSelection) {
508
- if (!isEditing) {
509
- if (_editRange) {
510
- sel = _editSel;
511
- range = _editRange;
512
- } else {
513
- // 初始状态没有focus聊天框,需要手动focus 获取光标位置
514
- const editRef = this.$refs.contentEdit;
515
- if (!editRef) return;
516
- editRef.focus();
517
- this.saveRange();
518
- sel = this._editSel;
519
- range = this._editRange;
520
- }
521
- } else {
522
- sel = window.getSelection();
523
- range = sel.getRangeAt(0);
524
- }
525
- range.deleteContents();
526
- let frag;
527
- if (range.createContextualFragment) {
528
- frag = range.createContextualFragment(value);
529
- } else {
530
- const el = document.createElement('div');
531
- el.innerHTML = value;
532
- frag = document.createDocumentFragment();
533
- let node, lastNode;
534
- while ((node = el.firstChild)) {
535
- lastNode = frag.appendChild(node); // 之所以能终止循环,是因为el的child一旦添加到dom后,作为fragment里的的child就没了。那么el.firstChild就会返回null
536
- }
537
- }
538
- const lastNode = frag.lastChild;
539
- range.insertNode(frag);
540
- // 把光标挪到插入的元素后面
541
- range.setStartAfter(lastNode);
542
- sel.removeAllRanges();
543
- sel.addRange(range);
544
- } else {
545
- range = isEditing || !_editRange ? document.selection.createRange() : _editRange;
546
- range.pasteHTML(value);
547
- range.select();
548
- }
549
- this.setMessageByHTML();
550
- },
551
- saveRange() {
552
- if (window.getSelection) {
553
- this._editSel = window.getSelection();
554
- this._editRange = this._editSel.getRangeAt(0);
555
- } else {
556
- this._editRange = document.selection.createRange();
557
- }
558
- },
559
- handleInput(e) {
560
- if (e.inputType === 'deleteContentBackward') {
561
- this.screenshot = false;
562
- this.screenshotFile = null;
563
- }
564
- setTimeout(() => {
565
- if (this.ping || this.pasteTimer) return;
566
- this.setMessageByHTML();
567
- }, 0);
568
- },
569
- changeData(e) {
570
- let message = e.srcElement.innerHTML;
571
- if (e.inputType === 'deleteContentBackward') {
572
- let div = document.createElement('div');
573
- div.innerHTML = e.srcElement.innerHTML;
574
- if (div.lastChild?.className?.startsWith('twa emoji')) {
575
- div.removeChild(div.lastChild);
576
- message = div.innerHTML;
577
- }
578
- this.screenshot = false;
579
- this.screenshotFile = null;
580
- }
581
-
582
- setTimeout(() => {
583
- if (this.ping) return;
584
- this.setFooterMessage(`${message}`);
585
- this.$nextTick().then(() => {
586
- this.resetSelection();
587
- this.ping = false;
588
- });
589
- }, 0);
590
- },
591
-
592
- beforeUpload(data) {
593
- let { type } = data;
594
- if (!type.startsWith('image/')) {
595
- this.$message.warning(`${this.i18nText('1.9.357')}!`);
596
- return;
597
- }
598
- let that = this;
599
- this.$confirm({
600
- title: this.i18nText('1.9.331'),
601
- content: `${this.i18nText('1.9.358')}?`,
602
- okText: '确定',
603
- cancelText: '取消',
604
- onOk() {
605
- return that.uploadImg(data);
606
- },
607
- onCancel() {
608
- return false;
609
- }
610
- });
611
- },
612
-
613
- /* 压缩上传 */
614
- uploadImg(file) {
615
- const hide = this.$message.loading(`${this.i18nText('1.9.199')}...`, 0);
616
- new ImageCompress(file, 'canvas', fetch, {
617
- url: '/hospitalUpload/picture'
618
- })
619
- .execute()
620
- .then(({ data }) => {
621
- if (data.result === 'SUCCESS') {
622
- this.doMsgSend(1, data.map.url);
623
- hide();
624
- } else {
625
- hide();
626
- this.$message.info(data.msg || `${this.i18nText('1.9.174')}!`);
627
- }
628
- })
629
- .catch(() => {
630
- hide();
631
- this.$message.info(`${this.i18nText('1.9.174')}!`);
632
- })
633
- .finally(() => {
634
- this.screenshotFile = null;
635
- this.screenshot = false;
636
- this.updateMessage('');
637
- });
638
- },
639
-
640
- /* 发送消息 */
641
- doMsgSend(type, content) {
642
- let body = {
643
- content: type === 0 ? `<div>${content}</div>` : content,
644
- type: type
645
- };
646
- if (this.curChatType === 'robot') {
647
- // this.setQuestionId("");
648
- // this.setDictionaryKey("");
649
- this.sendRobotMessage(content);
650
- } else {
651
- this.sendMessage(body);
652
- }
653
- },
654
- handleMsgSend() {
655
- // 截图上传
656
- if (this.screenshot) {
657
- this.uploadImg(this.screenshotFile);
658
- return;
659
- }
660
- if (this.chatType === 'bot') {
661
- this.handleBotChat(this.message).then(isHuman => {
662
- if (isHuman) {
663
- this.$parent.$parent.$parent.initWebSocket();
664
- }
665
- this.updateMessage('');
666
- });
667
- return;
668
- }
669
-
670
- const editRef = this.$refs.contentEdit;
671
- if (editRef) {
672
- const message = editRef.innerText;
673
- if (message.length > 2000) {
674
- this.$message.warning('请控制在2000字以内!');
675
- return;
676
- }
677
- }
678
- // let reg = /(.*?)(<div><br><\/div>)*?$/;
679
- let reg = /(.*?)(<div>(<span>)?<br>(<\/span>)?<\/div>)*?$/;
680
- let message = this.message.match(reg);
681
- if (message[2]) {
682
- this.updateMessage(message[1]);
683
- }
684
- this.updateMessage(this.message.replace(/style/g, 'data'));
685
- if (this.message.trim()) {
686
- this.doMsgSend(0, this.message);
687
- } else {
688
- return this.$message.warning(this.i18nText('1.9.359'));
689
- }
690
- this.updateMessage('');
691
- },
692
- handleKeyDown(e) {
693
- // 判断enter 发送还是换行
694
- if (e.keyCode === 13) {
695
- e.preventDefault();
696
- if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
697
- this.handleWrap();
698
- } else {
699
- this.handleMsgSend();
700
- }
701
- }
702
- },
703
- handleWrap() {
704
- let ctn = `<br>`;
705
- // 非ie环境 元素后面没有node的时候换行需要两个<br>
706
- if (!/msie/.test(navigator.userAgent) && window.getSelection) {
707
- const focusNode = window.getSelection().focusNode;
708
- let nextSibling = focusNode.nextSibling;
709
- if (focusNode === this.$refs.contentEdit) {
710
- nextSibling = focusNode.childNodes[0];
711
- }
712
- do {
713
- if (!nextSibling || nextSibling.nodeValue || nextSibling.tagName == 'BR') break;
714
- } while ((nextSibling = nextSibling.nextSibling));
715
- if (!nextSibling) {
716
- ctn += ctn;
717
- }
718
- }
719
- this.insertToEdit(ctn);
720
- this.$nextTick().then(() => {
721
- this.ping = false;
722
- });
723
- },
724
- handleVideoClick(type) {
725
- // this.curScrollItem.type 2多人 1单人
726
- if (this.sessionType === 2) {
727
- this.$emit('update:addvisible', true);
728
- this.setAddMemberType(2);
729
- this.setVideoMode(type === 'voice' ? 1 : 2);
730
- } else {
731
- const openTalking = sip => {
732
- this.setShowAudio(true);
733
- this.setVideoMode(type === 'voice' ? 1 : 2);
734
- this.$nextTick(() => {
735
- this.setVideoMembers([]);
736
- });
737
- this.setVideoData({
738
- callerSipKey: sip?.username,
739
- callerSipName: sip?.name
740
- });
741
- };
742
- if (this.validTalkingEnv) {
743
- this.validTalkingEnv().then(res => {
744
- if (res.status) {
745
- openTalking(res.sip);
746
- }
747
- });
748
- } else {
749
- openTalking();
750
- }
751
- }
752
- // this.groupMembers.length > 2
753
- return;
754
- },
755
- handleVoice(val) {
756
- val && this.setIsRecorderVoice(true);
757
- this.showVoice = val;
758
- },
759
- showPrescription() {
760
- this.setModalVisible(true);
761
- this.setMedicalOrPrescription('prescription');
762
- },
763
- showMedicalRecord() {
764
- this.setModalVisible(true);
765
- this.setMedicalOrPrescription('medical');
766
- },
767
- beofreToolBarClick(item) {
768
- // 操作栏前置条件
769
- return new Promise((resolve, reject) => {
770
- const { precondition } = item;
771
- if (precondition) {
772
- this.requestPreCondition(precondition)
773
- .then(res => {
774
- const result = res.data.result === 'SUCCESS';
775
- !result && this.$message.error(res.data.resultMsg || this.i18nText('1.9.22'));
776
- resolve(result);
777
- })
778
- .catch(error => {
779
- this.$message.error(error.resultMsg || this.i18nText('1.9.22'));
780
- resolve(false);
781
- });
782
- } else {
783
- resolve(true);
784
- }
785
- });
786
- },
787
- async handleToolBarClick(item) {
788
- const validate = await this.beofreToolBarClick(item);
789
- if (!validate) return;
790
- let { openMode, name, templateId, isFullScreen } = item;
791
- this.dispatchEvent('click_toolbar', { ...item });
792
- if (!item.address) return;
793
- this.curToolbarItem = item;
794
- this.templateId = templateId;
795
- this.isFullScreen = isFullScreen === 'Y';
796
- let address = this.getLinkAddress(item);
797
- if (openMode === 'WINDOW') {
798
- window.open(address, name);
799
- return;
800
- }
801
- if (openMode === 'EJECT') {
802
- this.modalShow = true;
803
- this.modalData = Object.assign({}, item, { address });
804
- this.$nextTick().then(() => {
805
- window.addEventListener('message', this.iframeEvent);
806
- });
807
- return;
808
- }
809
- },
810
- iframeEvent(event) {
811
- const method = event?.data?.method;
812
- this[method]?.(event);
813
- },
814
- // 发送
815
- handleParentMessageSend({ data, source, origin }) {
816
- let params = {
817
- assemblyId: this.assemblyId,
818
- sessionId: this.sessionId,
819
- orgId: this.orgId
820
- };
821
- params = Object.assign(params, data.data);
822
- let { actionType } = this.curToolbarItem;
823
- actionType && Object.assign(params, { actionType });
824
- return fetch.post('/chat/access/sendToolBarData', qs.stringify(params)).then(({ data }) => {
825
- if (data.result === 'SUCCESS') {
826
- source.postMessage({ status: 0, resultMsg: data.resultMsg }, origin);
827
- } else {
828
- source.postMessage({ status: 1, resultMsg: data.resultMsg }, origin);
829
- }
830
- });
831
- },
832
- // 关闭
833
- handleClose() {
834
- this.modalShow = false;
835
- window.removeEventListener('message', this.iframeEvent);
836
- },
837
- getLinkAddress(item,paramsData= {}) {
838
- let t = {talbe:{},form:{},sys:{}};
839
- Object.assign(t,paramsData ||{})
840
- let { address = '', params = [] } = item;
841
- let urlParams = [];
842
- params.forEach(({ p_name, p_value }) => {
843
- let value;
844
- if (p_value.startsWith('form.')) {
845
- value = this.clientParams[p_value.slice(5)];
846
- } else if( /\${result.(.*?)\}/g.test(p_value)) {
847
- value = vexutils.handleSysParams(p_value,t)
848
- } else {
849
- value = p_value;
850
- }
851
- urlParams.push(`${p_name}=${value}`);
852
- });
853
- if(/\${result.(.*?)\}/g.test(address)){
854
- address = vexutils.handleSysParams(address,t)
855
- }
856
- let { actionType } = this.curToolbarItem;
857
- actionType && urlParams.push(`actionType=${actionType}`);
858
- if (address.includes('?')) {
859
- address += `&${urlParams.join('&')}`;
860
- } else {
861
- address += `?${urlParams.join('&')}`;
862
- }
863
- return address;
864
- },
865
- handleOk() {
866
- window.handleParentMessageSend();
867
- },
868
- // 剪切板粘贴
869
- handlePaste(e) {
870
- const cbd = e.clipboardData;
871
- const ua = window.navigator.userAgent;
872
- // 如果是 Safari 直接 return
873
- if (!(e.clipboardData && e.clipboardData.items)) {
874
- this.handlePasteText(e);
875
- return;
876
- }
877
- if (
878
- cbd.items &&
879
- cbd.items.length === 2 &&
880
- cbd.items[0].kind === 'string' &&
881
- cbd.items[1].kind === 'file' &&
882
- cbd.types &&
883
- cbd.types.length === 2 &&
884
- cbd.types[0] === 'text/plain' &&
885
- cbd.types[1] === 'Files' &&
886
- ua.match(/Macintosh/i) &&
887
- Number(ua.match(/Chrome\/(\d{2})/i)[1]) < 49
888
- ) {
889
- this.handlePasteText(e);
890
- return;
891
- }
892
- const hasFile = this.handleImgPaste(cbd.items);
893
- if (hasFile) {
894
- e.stopPropagation();
895
- e.preventDefault();
896
- return;
897
- }
898
- this.handlePasteText(e);
899
- },
900
- handleImgPaste(files) {
901
- let hasFile = false;
902
- for (let i = 0; i < files.length; i++) {
903
- let item = files[i];
904
- if (item.kind == 'file') {
905
- hasFile = true;
906
- // blob 就是从剪切板获得的文件,可以进行上传或其他操作
907
- const blob = item.getAsFile();
908
- if (blob.size === 0) {
909
- return;
910
- }
911
- const reader = new FileReader();
912
- const imgs = new Image();
913
- imgs.file = blob;
914
- reader.onload = e => {
915
- imgs.src = e.target.result;
916
- imgs.width = '150';
917
- this.updateMessage(this.htmlToString(imgs));
918
- this.$nextTick().then(() => {
919
- this.resetSelection();
920
- this.screenshot = true;
921
- this.screenshotFile = blob;
922
- });
923
- };
924
- reader.readAsDataURL(blob);
925
- }
926
- }
927
- return hasFile;
928
- },
929
- // 处理文本粘贴
930
- handlePasteText() {
931
- if (this.pasteTimer) clearTimeout(this.pasteTimer);
932
- const ele = this.$refs.contentEdit;
933
- if (!ele) return;
934
- let before = ele.innerHTML;
935
- this.pasteTimer = setTimeout(() => {
936
- function getPasteHtml(before, after) {
937
- // 计算粘贴后html不同的位置起点和终点(插入"abc",则得出sPos为0,ePos为2)
938
- var sPos = -1,
939
- ePos = -1;
940
- for (var i = 0, len = after.length; i < len; ++i) {
941
- if (sPos == -1 && before.substr(i, 1) != after.substr(i, 1)) sPos = i;
942
- if (ePos == -1 && before.substr(before.length - i - 1, 1) != after.substr(after.length - i - 1, 1)) ePos = i;
943
-
944
- if ((sPos != -1 && ePos != -1) || len - 1 - ePos <= sPos) break;
945
- }
946
- if (sPos == -1 || ePos == -1) return;
947
- ePos = len - 1 - ePos;
948
-
949
- if (ePos <= sPos) {
950
- // 遇到像ab,粘贴ab后变成abab这种了,这是需要从sPos开始往后找,找到和before一样的为止
951
- i = sPos;
952
- var beforeSPosNext = before.substr(i + 1, 10); // 取后10个来对比,如果没有10个,则取最多
953
- while (++i < len) {
954
- if (beforeSPosNext == after.substr(i, beforeSPosNext.length)) {
955
- ePos = i;
956
- break;
957
- }
958
- }
959
- i == len && (ePos = len - 1);
960
- }
961
- // 如果有<和>,则需要计算在内
962
- if (after.substr(sPos - 1, 1) == '<') --sPos;
963
- if (after.substr(ePos + 1, 1) == '>') ++ePos;
964
-
965
- // 分段获得文本,前半段 插入段 后半段
966
- var pastedText = after.substring(sPos, ePos + 1),
967
- formerText = after.substr(0, sPos),
968
- latterText = after.substr(sPos + pastedText.length);
969
-
970
- // 判断formerText和pastedText是否闭合了
971
- var lastLT = formerText.lastIndexOf('<'),
972
- lastGT = formerText.lastIndexOf('>');
973
- if (lastGT < lastLT) {
974
- // 标签断了xxxxx<
975
- pastedText = formerText.slice(lastLT) + pastedText;
976
- formerText = formerText.slice(0, lastLT);
977
- }
978
-
979
- lastLT = pastedText.lastIndexOf('<');
980
- lastGT = pastedText.lastIndexOf('>');
981
- if (lastGT < lastLT) {
982
- // 标签断了<xxxxxx
983
- var _insertGT = latterText.indexOf('>') + 1;
984
- pastedText += latterText.slice(0, _insertGT);
985
- latterText = latterText.slice(_insertGT);
986
- }
987
- return [formerText, pastedText, latterText];
988
- }
989
- var after = ele.innerHTML;
990
- const data = getPasteHtml(before, after);
991
- if (data) {
992
- let [formerText, insertText, latterText] = data;
993
- insertText = this.deleteStyle(insertText);
994
- ele.innerHTML = formerText + insertText + "<span class='pasteCaretPosHelper'></span>" + latterText; // 插入pasteCaretPosHelper以帮助定位光标位置
995
- var pasteCaretPosHelper = ele.querySelector('.pasteCaretPosHelper'),
996
- range,
997
- selection;
998
- if (pasteCaretPosHelper) {
999
- if (document.createRange) {
1000
- // Chrome, IE 9+
1001
- range = document.createRange();
1002
- range.setStartAfter(pasteCaretPosHelper);
1003
- range.collapse(false);
1004
- selection = window.getSelection();
1005
- selection.removeAllRanges();
1006
- selection.addRange(range);
1007
- } else if (document.selection) {
1008
- // IE 8 and lower
1009
- range = document.body.createTextRange();
1010
- range.moveToElementText(pasteCaretPosHelper);
1011
- range.collapse(false);
1012
- range.select();
1013
- }
1014
- pasteCaretPosHelper.parentNode.removeChild(pasteCaretPosHelper);
1015
- }
1016
- }
1017
- this.setMessageByHTML();
1018
- this.saveRange();
1019
- this.pasteTimer = null;
1020
- }, 50);
1021
- },
1022
- // 拖拽上传图片
1023
- handleFiles(files) {
1024
- this.handleImgPaste(files);
1025
- },
1026
- htmlToString(dom) {
1027
- let div = document.createElement('div');
1028
- div.appendChild(dom);
1029
- return div.innerHTML;
1030
- },
1031
- /**
1032
- * 接入拦截
1033
- */
1034
- handleAccessIntercept(result) {
1035
- let { data } = result;
1036
- let { status, data: param } = data;
1037
- if (status === 1) {
1038
- this.accessChat(param).finally(() => {
1039
- this.accessIntercept = false;
1040
- });
1041
- } else {
1042
- this.accessIntercept = false;
1043
- }
1044
- },
1045
- /* 客服点击接入按钮进入会话 */
1046
- async handleAccess() {
1047
- this.apiResult = {};
1048
- let accessInterceptValidate = this.handleAccessInterceptValue();
1049
- let data = null; // 接口参数
1050
- if (accessInterceptValidate && this.accessInterceptUrl) {
1051
- const r = await this.beforeAccessIntercept();
1052
- if (!r) return;
1053
- if (r.value == 'Y') {
1054
- this.accessIntercept = true;
1055
- this.$nextTick().then(() => {
1056
- window.addEventListener('message', this.handleAccessIntercept);
1057
- });
1058
- return;
1059
- } else {
1060
- data = r.data; // 获取接入拦截返回参数
1061
- }
1062
- }
1063
- clearTimeout(this.timer);
1064
- this.timer = setTimeout(() => {
1065
- this.accessChat(data);
1066
- }, 300);
1067
- },
1068
- // 条件转换请求
1069
- requestPreCondition(precondition) {
1070
- const { targetType, targetName, targetId, params } = precondition;
1071
- const data = parseParams(params, this.clientParams);
1072
- let url = '';
1073
- if (targetType === 'API') {
1074
- data.url = targetName;
1075
- url = `/api/executeApi`;
1076
- } else {
1077
- data.sqlEnterId = targetId;
1078
- url = `/form/saveSqlEnter`;
1079
- }
1080
- return fetch.post(url, qs.stringify(data));
1081
- },
1082
- async beforeAccessIntercept() {
1083
- function parseResult(r) {
1084
- let value = 'Y';
1085
- const data = r.split('&').reduce((obj, str) => {
1086
- const [k, v] = str.split('=');
1087
- if (k) {
1088
- if (k == 'value') {
1089
- value = v || value;
1090
- } else {
1091
- obj = obj || {};
1092
- obj[k] = v || '';
1093
- }
1094
- }
1095
- return obj;
1096
- }, null);
1097
- return {
1098
- value,
1099
- data
1100
- };
1101
- }
1102
- this.apiResult = {};
1103
- const accessInterceptSetting = this.assemblySetting.accessInterceptSetting || [];
1104
- const setting = accessInterceptSetting.find(item => item.source == 'PC' && item.isChecked == 'Y' && item.precondition);
1105
- if (setting) {
1106
- const precondition = setting.precondition;
1107
- try {
1108
- let res = await this.requestPreCondition(precondition);
1109
- this.apiResult = res?.data?.map || {};
1110
- if (res.data.result === 'SUCCESS') {
1111
- let value = res.data.map?.result;
1112
- value = value ? JSON.parse(value) : {};
1113
- return value.value ? parseResult(value.value) : false;
1114
- } else {
1115
- this.$message.error(res.data.resultMsg || this.i18nText('1.9.22'));
1116
- return false;
1117
- }
1118
- } catch (error) {
1119
- this.$message.error(error.resultMsg || this.i18nText('1.9.22'));
1120
- return false;
1121
- }
1122
- }
1123
- return {
1124
- value: 'Y',
1125
- data: null
1126
- };
1127
- },
1128
- handleAccessInterceptValue() {
1129
- let { listClassify = [], isListClassify, serverSetting = {} } = this.assemblySetting;
1130
- let list = [];
1131
- if (isListClassify != 'Y') {
1132
- let { functionSetting = [] } = serverSetting;
1133
- list = functionSetting;
1134
- } else {
1135
- let curList = listClassify.find(item => item.classify == this.classify);
1136
- if (!curList) return false;
1137
- list = curList.serverFunctionSetting || [];
1138
- }
1139
- if (!list.length) return true;
1140
- let curItem = list.find(item => item.function == 'ACCESS_INTERCEPT');
1141
- if (!curItem) return true;
1142
- return curItem.isChecked == 'Y';
1143
- },
1144
- accessChat(data) {
1145
- let { bid: userId, username, userType } = this.queueItem;
1146
- let params = {
1147
- assemblyId: this.assemblyId,
1148
- userId,
1149
- userType,
1150
- lastSessionId: this.sessionId,
1151
- relateId: this.clientParams.relateId
1152
- };
1153
- if (data) {
1154
- params.addParams = JSON.stringify(data);
1155
- }
1156
- return fetch.post('/chat/service/accessChat', qs.stringify(params)).then(({ data }) => {
1157
- if (data.result === 'SUCCESS') {
1158
- let { countdown, clientParams, sessionType, countdownDesc } = data.map;
1159
- this.setSessionId(data.map.sessionId);
1160
- this.clearMsgList();
1161
- this.setMsgList();
1162
- this.setCurrentTab('session');
1163
- this.setLastCurrentTab('session');
1164
- this.setClientId(username);
1165
- this.setOnChating(true);
1166
- this.setSessionEnd(false);
1167
- this.setQueueItem(null);
1168
- sessionType && this.setSessionType(sessionType);
1169
- if (countdown >= 0) {
1170
- this.setChatTimer({ countdown, countdownDesc });
1171
- }
1172
- this.setClientParams(clientParams);
1173
- this.getSessionHistoryList();
1174
- this.dispatchEvent('user_accessSuccess', {
1175
- map: data.map,
1176
- user: { ...this.curScrollItem }
1177
- });
1178
- } else {
1179
- this.$message.warning(data.resultMsg);
1180
- }
1181
- });
1182
- },
1183
- handleOpenTransfer() {
1184
- if (this.enableTransfer) {
1185
- this.transferVisible = true;
1186
- }
1187
- },
1188
- handleTransfer(data) {
1189
- const receiveId = data.converUserId;
1190
- if (receiveId) {
1191
- if (this.userId == receiveId) {
1192
- this.$message.warning(this.i18nText('1.2.7.14.1'));
1193
- return;
1194
- }
1195
- this.transferVisible = false;
1196
- fetch({
1197
- url: '/chat/service/transferQueue',
1198
- method: 'POST',
1199
- data: qs.stringify({
1200
- relateId: this.clientParams.relateId,
1201
- orgId: this.orgId,
1202
- assemblyId: this.assemblyId,
1203
- userId: this.curScrollItem?.bid,
1204
- userType: this.curScrollItem?.userType || '',
1205
- receiveId: receiveId,
1206
- deptId: data.deptId,
1207
- remark: data.converMark
1208
- })
1209
- })
1210
- .then(({ data }) => {
1211
- if (data.result === 'SUCCESS') {
1212
- this.dispatchEvent('user_transferQueueSuccess', {
1213
- user: { ...this.curScrollItem }
1214
- });
1215
- this.$message.success(this.i18nText('1.9.336'));
1216
- this.clearCurrentSession(true);
1217
- } else {
1218
- this.$message.warning(data.resultMsg || this.i18nText('1.10.201') + this.i18nText('1.9.22'));
1219
- }
1220
- })
1221
- .catch(err => {
1222
- this.$message.warning(err.resultMsg || this.i18nText('1.10.201') + this.i18nText('1.9.22'));
1223
- });
1224
- } else {
1225
- this.$message.warning(this.i18nText('1.9.335'));
1226
- }
1227
- },
1228
- getSessionHistoryList() {
1229
- this.setSessionHistoryList([]);
1230
- if (this.assemblySetting.recordScopeSetting === 'CURRENT') return;
1231
- fetch
1232
- .get('/chat/service/getPastSessionList', {
1233
- params: { sessionId: this.sessionId }
1234
- })
1235
- .then(({ data }) => {
1236
- if (data.result === 'SUCCESS') {
1237
- let list = data.list.map(item => {
1238
- if (item.id === this.sessionId || this.type === 'session') {
1239
- item.onChating = true;
1240
- }
1241
- return item;
1242
- });
1243
- this.setSessionHistoryList(list);
1244
- }
1245
- });
1246
- },
1247
- openQuickData() {
1248
- // this.quickShow = true;
1249
- if (this.quickData.length < 1) {
1250
- fetch
1251
- .get('/fastReply/getChatList', {
1252
- params: {
1253
- category: this.assemblySetting.chatPublicCategory
1254
- }
1255
- })
1256
- .then(({ data }) => {
1257
- if (data.result === 'SUCCESS') {
1258
- this.quickData = data.list;
1259
- }
1260
- });
1261
- }
1262
- },
1263
- // 清除当前会话
1264
- clearCurrentSession(update = false) {
1265
- this.clearMsgList([]);
1266
- this.setSessionHistoryList([]);
1267
- this.setSessionTimer('');
1268
- this.setClientId('');
1269
- this.setSessionId('');
1270
- this.setScrollQueueId('');
1271
- this.setLastClassify('');
1272
- this.setCurScrollItem(null);
1273
- this.setQueueItem(null);
1274
- this.setClientParams(null);
1275
- if (update) {
1276
- // 重新设置 currentTab 触发 scrollList 组件 更新排队列表
1277
- const currentTab = this.store.state?.currentTab;
1278
- if (currentTab === 'queue') {
1279
- this.setCurrentTab('');
1280
- this.$nextTick(() => {
1281
- this.setCurrentTab(this.store.state?.currentTab || currentTab);
1282
- });
1283
- }
1284
- }
1285
- },
1286
- openRefuseReason() {
1287
- if (this.enableRefuse) {
1288
- this.refuseVisible = true;
1289
- }
1290
- },
1291
- handleRefuse(remark) {
1292
- if (!this.enableRefuse) return;
1293
- fetch({
1294
- url: '/chat/service/accessRefuse',
1295
- method: 'POST',
1296
- data: qs.stringify({
1297
- relateId: this.clientParams.relateId,
1298
- orgId: this.orgId,
1299
- assemblyId: this.assemblyId,
1300
- userId: this.curScrollItem?.bid,
1301
- userType: this.curScrollItem?.userType || '',
1302
- remark: remark || '其他'
1303
- })
1304
- })
1305
- .then(({ data }) => {
1306
- if (data.result === 'SUCCESS') {
1307
- this.dispatchEvent('user_refuseSuccess', {
1308
- user: { ...this.curScrollItem }
1309
- });
1310
- this.$message.success(this.i18nText('1.10.184'));
1311
- this.clearCurrentSession(true);
1312
- } else {
1313
- this.$message.warning(data.resultMsg || this.i18nText('1.9.353') + this.i18nText('1.9.22'));
1314
- }
1315
- })
1316
- .catch(err => {
1317
- this.$message.warning(err.resultMsg || this.i18nText('1.9.353') + this.i18nText('1.9.22'));
1318
- });
1319
- this.refuseVisible = false;
1320
- },
1321
- bindEvents() {
1322
- const handleDrop = e => {
1323
- e.stopPropagation();
1324
- e.preventDefault();
1325
- this.handleFiles(e.dataTransfer.items);
1326
- };
1327
- document.addEventListener('drop', handleDrop, false);
1328
- this.registerEvent('accessCurrentSession', this.handleAccess);
1329
- this.registerEvent('refuseCurrentSession', this.openRefuseReason);
1330
- this.registerEvent('transferCurrentQueueSession', this.handleOpenTransfer);
1331
- this.$on('hook:beforeDestroy', () => {
1332
- document.removeEventListener('drop', handleDrop, false);
1333
- window.removeEventListener('message', this.iframeEvent);
1334
- window.removeEventListener('message', this.handleAccessIntercept);
1335
- this.unregisterEvent('accessCurrentSession', this.handleAccess);
1336
- this.unregisterEvent('refuseCurrentSession', this.openRefuseReason);
1337
- this.unregisterEvent('transferCurrentQueueSession', this.handleOpenTransfer);
1338
- });
1339
- }
1340
- },
1341
- watch: {
1342
- accessIntercept: {
1343
- handler(val) {
1344
- if (!val) {
1345
- window.removeEventListener('message', this.handleAccessIntercept);
1346
- }
1347
- }
1348
- },
1349
- message: {
1350
- handler(v) {
1351
- // 使用 _editValue 判断是否组件外修改 message,并更新聊天框
1352
- if (this._editValue !== v) {
1353
- this.updateMessage(v);
1354
- }
1355
- }
1356
- }
1357
- }
1358
- };
1359
- </script>
1360
-
1361
- <style lang="less">
1362
- .chat-footer-modal-big {
1363
- padding: 10px;
1364
- &.ant-modal-wrap {
1365
- overflow: none;
1366
- }
1367
- .ant-modal {
1368
- width: 100%;
1369
- height: 100%;
1370
- top: 0;
1371
- padding-bottom: 0;
1372
- }
1373
- .ant-modal-content {
1374
- height: 100%;
1375
- }
1376
- .ant-modal-body {
1377
- height: calc(100% - 55px);
1378
- }
1379
- }
1380
- .chat-footer-modal-small {
1381
- &.ant-modal-wrap {
1382
- overflow: none;
1383
- }
1384
- .ant-modal {
1385
- width: 80%;
1386
- height: 80%;
1387
- padding-bottom: 0;
1388
- top: 60px;
1389
- }
1390
- .ant-modal-content {
1391
- height: 100%;
1392
- }
1393
- .ant-modal-body {
1394
- height: 100%;
1395
- padding: 0;
1396
- }
1397
- }
1398
-
1399
- </style>
1400
- <style lang="less" scoped>
1401
- .message-operate {
1402
- display: flex;
1403
- align-items: center;
1404
- height: 40px;
1405
- line-height: 18px;
1406
- background: #fff;
1407
- overflow-x: auto;
1408
- overflow-y: hidden;
1409
- border-top: 1px solid #e6e6e6;
1410
- &::-webkit-scrollbar {
1411
- height: 5px;
1412
- }
1413
- > img {
1414
- // > .operate-icon {
1415
- margin-left: 10px;
1416
- }
1417
- /deep/ .ant-tabs .ant-tabs-top-content > .ant-tabs-tabpane {
1418
- height: 300px !important;
1419
- overflow: auto !important;
1420
- }
1421
- /deep/ .ant-upload-list {
1422
- display: none;
1423
- }
1424
- /deep/ .ant-upload {
1425
- height: 32px;
1426
- vertical-align: middle;
1427
- display: inline-block;
1428
- }
1429
- .no-click {
1430
- pointer-events: none;
1431
- opacity: 0.4;
1432
- }
1433
- .svg-icon {
1434
- color: rgba(0, 0, 0, 0.6);
1435
- }
1436
- }
1437
- .emoji-wrapper {
1438
- width: 500px;
1439
- height: 300px;
1440
- overflow: auto;
1441
- display: grid;
1442
- grid-template-columns: repeat(10, 1fr);
1443
- .emoji {
1444
- display: inline-block;
1445
- font-size: 20px;
1446
- margin: 10px;
1447
- text-align: center;
1448
- }
1449
- &::-webkit-scrollbar {
1450
- width: 5px;
1451
- }
1452
- }
1453
- .message {
1454
- position: relative;
1455
- height: 150px;
1456
- .message-send {
1457
- position: absolute;
1458
- bottom: 8px;
1459
- right: 14px;
1460
- height: 40px;
1461
- border-radius: 20px;
1462
- width: 86px;
1463
- font-weight: 600;
1464
- font-size: 18px;
1465
- color: #fff;
1466
- background-color: @primary-color;
1467
- border-color: @primary-color;
1468
- &:hover {
1469
- background-color: rgba(@primary-color, 0.7);
1470
- border-color: rgba(@primary-color, 0.7);
1471
- }
1472
- &[disabled]:hover,
1473
- &[disabled] {
1474
- background-color: #f5f5f5;
1475
- border-color: #d9d9d9;
1476
- color: #bebebe;
1477
- }
1478
- }
1479
- .prompt {
1480
- position: absolute;
1481
- bottom: 16px;
1482
- right: 120px;
1483
- color: #a6a6a6;
1484
- }
1485
- }
1486
- .infinite-container {
1487
- overflow-y: auto;
1488
- }
1489
- .message-wrapper {
1490
- position: relative;
1491
- .loading-icon {
1492
- position: absolute;
1493
- top: 0;
1494
- left: 50%;
1495
- }
1496
- }
1497
- .content-edit {
1498
- width: 100%;
1499
- height: 100%;
1500
- padding: 0 16px 56px;
1501
- word-break: break-word;
1502
- &::-webkit-scrollbar {
1503
- width: 5px;
1504
- }
1505
- cursor: text;
1506
- > div {
1507
- height: 100%;
1508
- outline: none;
1509
- overflow-y: auto;
1510
- overflow-x: hidden;
1511
- }
1512
- }
1513
- .overlay {
1514
- position: absolute;
1515
- width: 100%;
1516
- height: 100%;
1517
- top: 0;
1518
- cursor: not-allowed;
1519
- }
1520
- .queue-page {
1521
- display: flex;
1522
- flex-direction: column;
1523
- align-items: center;
1524
- justify-content: center;
1525
- position: absolute;
1526
- width: 100%;
1527
- height: 100%;
1528
- top: 0;
1529
- background: #fff;
1530
- z-index: 500;
1531
- border-top: 1px solid #e6e6e6;
1532
- .queue-tips {
1533
- font-size: 16px;
1534
- color: #272727;
1535
- line-height: 22px;
1536
- margin-bottom: 16px;
1537
- }
1538
- .queue-btns {
1539
- display: flex;
1540
- justify-content: center;
1541
- }
1542
- .toSession {
1543
- width: 80px;
1544
- height: 80px;
1545
- line-height: 80px;
1546
- text-align: center;
1547
- background: linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
1548
- box-shadow: 0px 4px 9px 0px rgba(186, 186, 186, 0.79);
1549
- border-radius: 50%;
1550
- color: #4b4b4b;
1551
- font-size: 20px;
1552
- font-weight: 500;
1553
- font-family: PingFangSC-Medium, PingFang SC;
1554
- transition: transform 0.3s ease;
1555
- &.primary {
1556
- background: linear-gradient(180deg, #2d7aff 0%, #2c5df4 100%);
1557
- box-shadow: 0px 5px 8px 0px rgba(44, 101, 247, 0.39);
1558
- color: #fff;
1559
- }
1560
- &.danger {
1561
- background: linear-gradient(180deg, #ff4b4b 0%, #c80606 100%);
1562
- box-shadow: 0px 5px 8px 0px rgba(217, 26, 26, 0.35);
1563
- color: #fff;
1564
- }
1565
- &:hover {
1566
- transform: scale(1.2);
1567
- }
1568
- & + .toSession {
1569
- margin-left: 36px;
1570
- }
1571
- }
1572
- }
1573
- .toolbar {
1574
- // margin-left: 10px;
1575
- margin: 0 5px;
1576
- font-size: 20px;
1577
- outline: none;
1578
- padding: 6px;
1579
- box-sizing: content-box;
1580
- &:hover {
1581
- background-color: #ebebeb;
1582
- border-radius: 6px;
1583
- }
1584
- }
1585
- .closed-toolbar {
1586
- z-index: 100;
1587
- }
1588
- /deep/ p {
1589
- margin-bottom: 0;
1590
- }
1591
- .click-voice {
1592
- color: #2d7aff;
1593
- }
1594
- </style>
1
+ <template>
2
+ <a-layout-footer style="position: relative;cursor:pointer" v-show="!queueItem || !hideQueueBtns">
3
+ <div class="message-operate">
4
+ <a-upload
5
+ v-if="isShow('PICTURE')"
6
+ class="operate-icon"
7
+ v-decorator="[
8
+ 'upload',
9
+ {
10
+ valuePropName: 'fileList'
11
+ }
12
+ ]"
13
+ :beforeUpload="beforeUpload"
14
+ >
15
+ <a-tooltip placement="top">
16
+ <template slot="title">{{ i18nText('1.9.181') }}</template>
17
+ <svg-icon icon-class="liaotiantupian1" class="toolbar"></svg-icon>
18
+ </a-tooltip>
19
+ </a-upload>
20
+ <a-popover :title="i18nText('1.9.354')" trigger="click" v-model="visible">
21
+ <a slot="content">
22
+ <div class="emoji-wrapper">
23
+ <p v-for="(item, index) in emojiList" :key="index" @click="() => handleEmojiClick(item)" :class="['twa', 'emoji', item]"></p>
24
+ </div>
25
+ </a>
26
+
27
+ <a-tooltip placement="top">
28
+ <template slot="title">{{ i18nText('1.9.354') }}</template>
29
+ <svg-icon icon-class="liaotianbiaoqing1" @click="showEmoji" class="toolbar" v-if="isShow('SMILINEFACE')"></svg-icon>
30
+ </a-tooltip>
31
+ </a-popover>
32
+ <template v-for="(item, index) in toolbar">
33
+ <a-tooltip placement="top" :key="index">
34
+ <template slot="title">{{ item.name }}</template>
35
+ <svg-icon :icon-class="item.icon" class="toolbar" :class="{ 'closed-toolbar': closedSession }" @click="handleToolBarClick(item)"></svg-icon>
36
+ </a-tooltip>
37
+ </template>
38
+ <!-- 快捷回复 -->
39
+ <a-tooltip placement="top" :title="'快捷回复'">
40
+ <a-popover trigger="click" overlayClassName="quick-reply" placement="topLeft" v-model="quickShow">
41
+ <template slot="content">
42
+ <quick-reply :quickShow.sync="quickShow" :quickData="quickData"></quick-reply>
43
+ </template>
44
+ <svg-icon icon-class="liaotiankuaijiehuifu1" class="toolbar" @click="openQuickData" v-if="isShow('FASTREPLY') && isServer"></svg-icon>
45
+ </a-popover>
46
+ </a-tooltip>
47
+ <a-tooltip :title="'语音通话'">
48
+ <svg-icon icon-class="liaotianyuyindianhua" @click="handleVideoClick('voice')" class="toolbar" v-if="isShow('VOICE_CALL')"></svg-icon>
49
+ <!-- <img
50
+ width="20"
51
+ src="../img/multi-voice.png"
52
+ @click="handleVideoClick('voice')"
53
+ v-if="isShow('VOICE_CALL') && isServer"
54
+ /> -->
55
+ </a-tooltip>
56
+ <a-tooltip :title="'发送语音'">
57
+ <svg-icon icon-class="liaotianyuyin1" @click="handleVoice(true)" class="toolbar" :class="{ 'click-voice': showVoice }" v-if="isShow('VOICE')"></svg-icon>
58
+ <!-- <img
59
+ width="20"
60
+ src="../img/multi-video.png"
61
+ @click="handleVideoClick('video')"
62
+ v-if="isShow('VIDEO') && isServer"
63
+ /> -->
64
+ </a-tooltip>
65
+ <a-tooltip :title="'视频通话'">
66
+ <svg-icon icon-class="liaotianshipin1" @click="handleVideoClick('video')" class="toolbar" v-if="isShow('VIDEO')"></svg-icon>
67
+ <!-- <img
68
+ width="20"
69
+ src="../img/multi-video.png"
70
+ @click="handleVideoClick('video')"
71
+ v-if="isShow('VIDEO') && isServer"
72
+ /> -->
73
+ </a-tooltip>
74
+ </div>
75
+ <div class="message" style="text-align: left">
76
+ <div class="content-edit">
77
+ <div
78
+ ref="contentEdit"
79
+ @click="saveRange"
80
+ @keyup.exact="saveRange"
81
+ @change="changeData"
82
+ @input="handleInput"
83
+ @compositionstart="() => (this.ping = true)"
84
+ @compositionend="() => (this.ping = false)"
85
+ @keydown="handleKeyDown"
86
+ @paste="handlePaste"
87
+ contenteditable="true"
88
+ ></div>
89
+ </div>
90
+ <span class="prompt">Enter {{ i18nText('1.2.1.11.6') }}, Ctrl + Enter {{ i18nText('1.9.356') }}</span>
91
+ <a-button :disabled="sendDisabled" class="message-send" @click="handleMsgSend">{{ i18nText('1.2.1.11.6') }}</a-button>
92
+ </div>
93
+ <div id="canvas-wrapper" style="display: none">
94
+ <canvas id="canvas"></canvas>
95
+ </div>
96
+ <template v-if="showOverlay">
97
+ <div class="overlay" v-if="(!onChating || sessionEnd) && !queueItem"></div>
98
+ </template>
99
+ <div class="queue-page" v-if="queueItem">
100
+ <div v-if="accessDesc" class="queue-tips">{{ accessDesc }}</div>
101
+ <div class="queue-btns">
102
+ <div v-if="enableTransfer" class="toSession" @click="handleOpenTransfer">
103
+ {{ i18nText('1.10.201') }}
104
+ </div>
105
+ <div class="toSession primary" @click="handleAccess">
106
+ {{ accessText || i18nText('1.9.352') }}
107
+ </div>
108
+ <div v-if="enableRefuse" class="toSession danger" @click="openRefuseReason">
109
+ {{ i18nText('1.9.353') }}
110
+ </div>
111
+ </div>
112
+ </div>
113
+ <!-- 操作栏弹窗 -->
114
+ <a-modal
115
+ :wrapClassName="isFullScreen ? 'chat-footer-modal-big' : 'chat-footer-modal-small'"
116
+ :title="modalData.name"
117
+ :visible="modalShow"
118
+ :maskClosable="false"
119
+ :mask="true"
120
+ :width="isFullScreen ? '100%' : '80%'"
121
+ destroyOnClose
122
+ :okText="i18nText('1.2.1.11.6')"
123
+ :footer="null"
124
+ @cancel="handleClose"
125
+ @ok="handleOk"
126
+ >
127
+ <iframe id="toolbarIframe" v-if="modalData.targetType === 'LINK_ADDRESS'" width="100%" height="100%" frameborder="0" :src="modalData.address" allow="camera;midi"></iframe>
128
+ </a-modal>
129
+ <!-- 接入拦截 -->
130
+ <a-modal
131
+ :title="accessInterceptTitle"
132
+ :visible="accessIntercept"
133
+ :maskClosable="false"
134
+ :mask="true"
135
+ :footer="null"
136
+ destroyOnClose
137
+ :width="600"
138
+ :bodyStyle="{ height: '280px' }"
139
+ @cancel="
140
+ () => {
141
+ this.accessIntercept = false;
142
+ }
143
+ "
144
+ >
145
+ <iframe width="100%" height="100%" frameborder="0" :src="accessInterceptUrl"></iframe>
146
+ </a-modal>
147
+ <!-- 语音消息 -->
148
+ <voice v-if="showVoice" :showVoice="showVoice" @closeVoice="handleVoice"></voice>
149
+ <ModalUserTransfer v-if="enableTransfer" :title="i18nText('1.10.201')" :visible.sync="transferVisible" :assemblyId="assemblyId" @ok="handleTransfer" />
150
+ <ModalRefuseReason v-if="refuseVisible" :visible.sync="refuseVisible" :reasonList="refuseReasonList" @ok="handleRefuse" />
151
+ </a-layout-footer>
152
+ </template>
153
+
154
+ <script>
155
+ import { Layout, Tooltip, Upload, Modal, Popover, Button } from 'ant-design-vue';
156
+ import SvgIcon from '@/component/svg/index.vue';
157
+ import ImageCompress from '../utils/compressImage';
158
+ import { parseParams } from '../utils/panelsetting';
159
+
160
+ import { mapState, mapGetters, mapMutations, mapActions } from '../store/helper';
161
+ import fetch, { qs } from '@/utils/chatFetch';
162
+ import QuickReply from './quickReply';
163
+ import voice from './voice';
164
+ import ModalUserTransfer from '../components/modal-user-transfer';
165
+ import ModalRefuseReason from '../components/modal-refuse-reason';
166
+ import vexutils from '@/utils/vexutils';
167
+ export default {
168
+ inject: ['store', 'i18nText', 'dispatchEvent', 'registerEvent', 'unregisterEvent'],
169
+ components: {
170
+ AModal: Modal,
171
+ [Layout.Footer.name]: Layout.Footer,
172
+ [Tooltip.name]: Tooltip,
173
+ [Upload.name]: Upload,
174
+ [Button.name]: Button,
175
+ [Popover.name]: Popover,
176
+ SvgIcon,
177
+ ModalRefuseReason,
178
+ ModalUserTransfer,
179
+ QuickReply,
180
+ voice
181
+ },
182
+ props: {
183
+ // 隐藏排队状态底部信息
184
+ hideQueueBtns: {
185
+ type: Boolean,
186
+ default: false
187
+ },
188
+ validTalkingEnv: {
189
+ type: Function
190
+ },
191
+ curChatType: {
192
+ type: String
193
+ },
194
+ clientFinish: {
195
+ type: Boolean,
196
+ default: true
197
+ },
198
+ addvisible: {
199
+ type: Boolean,
200
+ default: false
201
+ },
202
+ isShowVoice: {
203
+ type: Boolean,
204
+ default: false
205
+ }
206
+ },
207
+ data() {
208
+ return {
209
+ // message: "",
210
+ visible: false,
211
+ modalShow: false,
212
+ modalData: {},
213
+ ping: false,
214
+ templateId: null, // 卡片模板
215
+ isFullScreen: false,
216
+ emojiList: require('../utils/emoji.json'),
217
+ quickData: [],
218
+ quickShow: false,
219
+ screenshot: false,
220
+ screenshotFile: null,
221
+ timer: null,
222
+ accessIntercept: false,
223
+ curToolbarItem: {},
224
+ showVoice: false,
225
+ transferVisible: false,
226
+ refuseVisible: false,
227
+
228
+ apiResult: {}, // 前置条件的返回值
229
+ };
230
+ },
231
+ computed: {
232
+ ...mapGetters([
233
+ 'userInfo',
234
+ 'assemblyId',
235
+ 'sessionId',
236
+ 'serviceId',
237
+ 'onChating',
238
+ 'roomId',
239
+ 'isServer',
240
+ 'assemblySetting',
241
+ 'chatType',
242
+ 'sessionEnd',
243
+ 'closedSession',
244
+ 'clientParams',
245
+ 'footerMessage',
246
+ 'queueItem',
247
+ 'sessionType',
248
+ 'groupMembers',
249
+ 'curScrollItem'
250
+ ]),
251
+ ...mapState({
252
+ classify: state => state.lastClassify || state.classify
253
+ }),
254
+ message() {
255
+ return this.footerMessage;
256
+ },
257
+ sendDisabled() {
258
+ return this.message.length === 0;
259
+ },
260
+ orgId() {
261
+ return this.userInfo?.sysParams?.orgId;
262
+ },
263
+ userId() {
264
+ return this.userInfo?.sysParams?.userId;
265
+ },
266
+ toolbar() {
267
+ if (!this.isServer) return [];
268
+ let toolbar = this.assemblySetting.toolbar || [];
269
+ toolbar = toolbar.filter(item => {
270
+ const { source, isChecked, isCloseChecked, isClosedAble } = item;
271
+ if (source === 'PC' && (
272
+ (!this.closedSession && isChecked === 'Y') ||
273
+ (this.closedSession && isCloseChecked === 'Y' && isChecked === 'Y' && isClosedAble === 'Y')
274
+ )
275
+ ){
276
+ const showCondition = item.showCondition || [];
277
+ const i = showCondition.findIndex(({ p_name, p_value }) => {
278
+ const params = this.clientParams;
279
+ const value = params[p_name];
280
+ if (p_value.startsWith('form.')) {
281
+ return value !== p_name[p_value.slice(5)];
282
+ }
283
+ return value !== p_value;
284
+ });
285
+ return i < 0;
286
+ }
287
+ return false;
288
+ });
289
+ return toolbar;
290
+ },
291
+ isListClassify() {
292
+ return this.assemblySetting.isListClassify === 'Y';
293
+ },
294
+ showOverlay() {
295
+ return this.curChatType != 'robot' || this.clientFinish;
296
+ },
297
+ accessText() {
298
+ let obj = this.assemblySetting.serverSetting.serverInfo.filter(item => item.key === 'ongoingButton')[0];
299
+ return obj?.value;
300
+ },
301
+ accessDesc() {
302
+ let obj = this.assemblySetting.serverSetting.serverInfo.filter(item => item.key === 'ongoingDescription')[0];
303
+ return obj?.value;
304
+ },
305
+ accessInterceptObj() {
306
+ let obj = this.assemblySetting.accessInterceptSetting?.filter(item => item.source === 'PC');
307
+ if (obj && obj[0]) {
308
+ return obj[0];
309
+ }
310
+ return undefined;
311
+ },
312
+ // 拦截url
313
+ accessInterceptUrl() {
314
+ const { accessInterceptObj: obj, apiResult } = this;
315
+ if (obj) {
316
+ return this.getLinkAddress(obj,{result:apiResult});
317
+ }
318
+ return '';
319
+ },
320
+ // 拦截title
321
+ accessInterceptTitle() {
322
+ const { accessInterceptObj: obj } = this;
323
+ if (obj) {
324
+ let res = obj.titleI18n ? this.i18nText(obj.titleI18n) : obj.title;
325
+ return res || '接入拦截';
326
+ }
327
+ return '接入拦截';
328
+ },
329
+ // 是否开启 排队转接
330
+ enableTransfer() {
331
+ if (this.assemblySetting.type === 'single') {
332
+ let setting = null;
333
+ if (this.isListClassify) {
334
+ const classify = this.classify;
335
+ const { listClassify = [] } = this.assemblySetting;
336
+ const target = listClassify.find(item => item.classify === classify);
337
+ setting = target ? target.serverFunctionSetting : null;
338
+ } else {
339
+ setting = this.assemblySetting?.serverSetting?.functionSetting;
340
+ }
341
+ if (setting) {
342
+ const v = setting.find(item => item.function === 'TRANSFER_BEFORE');
343
+ return v ? v.isChecked == 'Y' : false;
344
+ }
345
+ }
346
+ return false;
347
+ },
348
+ enableRefuse() {
349
+ let setting = null;
350
+ if (this.isListClassify) {
351
+ const classify = this.classify;
352
+ const { listClassify = [] } = this.assemblySetting;
353
+ const target = listClassify.find(item => item.classify === classify);
354
+ setting = target ? target.serverFunctionSetting : null;
355
+ } else {
356
+ setting = this.assemblySetting?.serverSetting?.functionSetting;
357
+ }
358
+ if (setting) {
359
+ const v = setting.find(item => item.function === 'ACCESS_REFUSE');
360
+ return v ? v.isChecked == 'Y' : false;
361
+ }
362
+ return false;
363
+ },
364
+ refuseReasonList() {
365
+ const list = this.assemblySetting?.refuseReasonSetting?.list || [];
366
+ return list.filter(v => !!v.text);
367
+ }
368
+ },
369
+
370
+ mounted() {
371
+ this.bindEvents();
372
+ },
373
+ methods: {
374
+ ...mapMutations([
375
+ 'setLastClassify',
376
+ 'setSessionTimer',
377
+ 'setScrollQueueId',
378
+ 'setCurScrollItem',
379
+ 'setIsAppendMsg',
380
+ 'setMessage',
381
+ 'setShowVideo',
382
+ 'setCaller',
383
+ 'setMedicalOrPrescription',
384
+ 'setModalVisible',
385
+ 'setFooterMessage',
386
+ 'setQueueItem',
387
+ 'setSessionId',
388
+ 'setCurrentTab',
389
+ 'setClientId',
390
+ 'setOnChating',
391
+ 'setClientParams',
392
+ 'setSessionHistoryList',
393
+ 'setSessionEnd',
394
+ 'setQuestionId',
395
+ 'setDictionaryKey',
396
+ 'setMultiVideoShow',
397
+ 'setVideoStatus',
398
+ 'setVideoMode',
399
+ 'setAddMemberType',
400
+ 'setShowAudio',
401
+ 'setVideoMembers',
402
+ 'setLastCurrentTab',
403
+ 'setIsRecorderVoice',
404
+ 'setVideoData',
405
+ 'setSessionType'
406
+ ]),
407
+ ...mapMutations({
408
+ clearMsgList: 'setMsgList'
409
+ }),
410
+ ...mapActions(['sendMessage', 'sendRobotMessage', 'handleBotChat', 'setMsgList', 'setChatTimer']),
411
+ deleteStyle(value) {
412
+ // 去掉样式
413
+ value = value.replace(/style\s*?=\s*?(['"])[\s\S]*?\1/g, '');
414
+ value = value.replace(/data\s*?=\s*?(['"])[\s\S]*?\1/g, '');
415
+ value = value.replace(/class\s*?=\s*?(['"])[\s\S]*?\1/g, match => {
416
+ if (match.includes('twa')) {
417
+ return match;
418
+ } else {
419
+ return '';
420
+ }
421
+ });
422
+ value = value.replace(/face\s*?=\s*?(['"])[\s\S]*?\1/g, '');
423
+ value = value.replace(/<a/g, '<span');
424
+ value = value.replace(/a>/g, 'span>');
425
+ value = value.replace(/<i/g, '<span');
426
+ value = value.replace(/i>/g, 'span>');
427
+ value = value.replace(/<u/g, '<span');
428
+ value = value.replace(/u>/g, 'span>');
429
+ value = value.replace(/<strong/g, '<span');
430
+ value = value.replace(/strong>/g, 'span>');
431
+ value = value.replace(/<h\d/g, '<span');
432
+ value = value.replace(/h\d>/g, 'span>');
433
+ value = value.replace(/<b>/g, '<span>');
434
+ value = value.replace(/b>/g, 'span>');
435
+ value = value.replace(/<font/g, '<span');
436
+ value = value.replace(/font>/g, 'span>');
437
+ return value;
438
+ },
439
+ // 更新 message值 (未用v-html,修改后需要手动设置聊天框html内容)
440
+ updateMessage(value) {
441
+ this._editValue = value;
442
+ this.setFooterMessage(`${value}`);
443
+ const editRef = this.$refs.contentEdit;
444
+ if (!editRef) return;
445
+ editRef.innerHTML = value;
446
+ },
447
+ // 根据 聊天框 html节点内容 设置 message值 (未用v-html,html内容更改需主动设置message值)
448
+ setMessageByHTML() {
449
+ const editRef = this.$refs.contentEdit;
450
+ if (!editRef) return;
451
+ const message = editRef.innerHTML;
452
+ this._editValue = message;
453
+ this.setFooterMessage(`${message}`);
454
+ },
455
+
456
+ showEmoji() {
457
+ // this.visible = true;
458
+ },
459
+
460
+ isShow(type) {
461
+ if (type === 'SMILINEFACE' && this.curChatType === 'robot') return true;
462
+ if (this.isListClassify) {
463
+ let label;
464
+ if (this.isServer) {
465
+ label = 'serverFunctionSetting';
466
+ } else {
467
+ label = 'clientFunctionSetting';
468
+ }
469
+ let classifyItem = this.assemblySetting.listClassify.filter(item => item.classify === this.classify);
470
+ if (!classifyItem || !classifyItem.length) return;
471
+ let funs = classifyItem[0][label] || [];
472
+ return funs.find(item => item.function === type)?.isChecked === 'Y';
473
+ }
474
+ let label;
475
+ if (this.isServer) {
476
+ label = 'serverSetting';
477
+ } else {
478
+ label = 'clientSetting';
479
+ }
480
+ let funs = this.assemblySetting[label]?.functionSetting || [];
481
+ return funs.find(item => item.function === type)?.isChecked === 'Y';
482
+ },
483
+
484
+ handleEmojiClick(item) {
485
+ let emojiHtml = `<p contenteditable="false" class="twa emoji ${item}"></p>&nbsp`;
486
+ this.insertToEdit(emojiHtml);
487
+ },
488
+ /* edit-content光标定位 */
489
+ resetSelection() {
490
+ let edit = this.$refs.contentEdit;
491
+ let sel, range;
492
+ if (window.getSelection && document.createRange) {
493
+ range = document.createRange();
494
+ range.selectNodeContents(edit);
495
+ range.collapse(true);
496
+ range.setEnd(edit, edit.childNodes.length);
497
+ range.setStart(edit, edit.childNodes.length);
498
+ sel = window.getSelection();
499
+ sel.removeAllRanges();
500
+ sel.addRange(range);
501
+ }
502
+ },
503
+
504
+ insertToEdit(value, isEditing) {
505
+ const { _editSel, _editRange } = this;
506
+ let sel, range;
507
+ if (window.getSelection) {
508
+ if (!isEditing) {
509
+ if (_editRange) {
510
+ sel = _editSel;
511
+ range = _editRange;
512
+ } else {
513
+ // 初始状态没有focus聊天框,需要手动focus 获取光标位置
514
+ const editRef = this.$refs.contentEdit;
515
+ if (!editRef) return;
516
+ editRef.focus();
517
+ this.saveRange();
518
+ sel = this._editSel;
519
+ range = this._editRange;
520
+ }
521
+ } else {
522
+ sel = window.getSelection();
523
+ range = sel.getRangeAt(0);
524
+ }
525
+ range.deleteContents();
526
+ let frag;
527
+ if (range.createContextualFragment) {
528
+ frag = range.createContextualFragment(value);
529
+ } else {
530
+ const el = document.createElement('div');
531
+ el.innerHTML = value;
532
+ frag = document.createDocumentFragment();
533
+ let node, lastNode;
534
+ while ((node = el.firstChild)) {
535
+ lastNode = frag.appendChild(node); // 之所以能终止循环,是因为el的child一旦添加到dom后,作为fragment里的的child就没了。那么el.firstChild就会返回null
536
+ }
537
+ }
538
+ const lastNode = frag.lastChild;
539
+ range.insertNode(frag);
540
+ // 把光标挪到插入的元素后面
541
+ range.setStartAfter(lastNode);
542
+ sel.removeAllRanges();
543
+ sel.addRange(range);
544
+ } else {
545
+ range = isEditing || !_editRange ? document.selection.createRange() : _editRange;
546
+ range.pasteHTML(value);
547
+ range.select();
548
+ }
549
+ this.setMessageByHTML();
550
+ },
551
+ saveRange() {
552
+ if (window.getSelection) {
553
+ this._editSel = window.getSelection();
554
+ this._editRange = this._editSel.getRangeAt(0);
555
+ } else {
556
+ this._editRange = document.selection.createRange();
557
+ }
558
+ },
559
+ handleInput(e) {
560
+ if (e.inputType === 'deleteContentBackward') {
561
+ this.screenshot = false;
562
+ this.screenshotFile = null;
563
+ }
564
+ setTimeout(() => {
565
+ if (this.ping || this.pasteTimer) return;
566
+ this.setMessageByHTML();
567
+ }, 0);
568
+ },
569
+ changeData(e) {
570
+ let message = e.srcElement.innerHTML;
571
+ if (e.inputType === 'deleteContentBackward') {
572
+ let div = document.createElement('div');
573
+ div.innerHTML = e.srcElement.innerHTML;
574
+ if (div.lastChild?.className?.startsWith('twa emoji')) {
575
+ div.removeChild(div.lastChild);
576
+ message = div.innerHTML;
577
+ }
578
+ this.screenshot = false;
579
+ this.screenshotFile = null;
580
+ }
581
+
582
+ setTimeout(() => {
583
+ if (this.ping) return;
584
+ this.setFooterMessage(`${message}`);
585
+ this.$nextTick().then(() => {
586
+ this.resetSelection();
587
+ this.ping = false;
588
+ });
589
+ }, 0);
590
+ },
591
+
592
+ beforeUpload(data) {
593
+ let { type } = data;
594
+ if (!type.startsWith('image/')) {
595
+ this.$message.warning(`${this.i18nText('1.9.357')}!`);
596
+ return;
597
+ }
598
+ let that = this;
599
+ this.$confirm({
600
+ title: this.i18nText('1.9.331'),
601
+ content: `${this.i18nText('1.9.358')}?`,
602
+ okText: '确定',
603
+ cancelText: '取消',
604
+ onOk() {
605
+ return that.uploadImg(data);
606
+ },
607
+ onCancel() {
608
+ return false;
609
+ }
610
+ });
611
+ },
612
+
613
+ /* 压缩上传 */
614
+ uploadImg(file) {
615
+ const hide = this.$message.loading(`${this.i18nText('1.9.199')}...`, 0);
616
+ new ImageCompress(file, 'canvas', fetch, {
617
+ url: '/hospitalUpload/picture'
618
+ })
619
+ .execute()
620
+ .then(({ data }) => {
621
+ if (data.result === 'SUCCESS') {
622
+ this.doMsgSend(1, data.map.url);
623
+ hide();
624
+ } else {
625
+ hide();
626
+ this.$message.info(data.msg || `${this.i18nText('1.9.174')}!`);
627
+ }
628
+ })
629
+ .catch(() => {
630
+ hide();
631
+ this.$message.info(`${this.i18nText('1.9.174')}!`);
632
+ })
633
+ .finally(() => {
634
+ this.screenshotFile = null;
635
+ this.screenshot = false;
636
+ this.updateMessage('');
637
+ });
638
+ },
639
+
640
+ /* 发送消息 */
641
+ doMsgSend(type, content) {
642
+ let body = {
643
+ content: type === 0 ? `<div>${content}</div>` : content,
644
+ type: type
645
+ };
646
+ if (this.curChatType === 'robot') {
647
+ // this.setQuestionId("");
648
+ // this.setDictionaryKey("");
649
+ this.sendRobotMessage(content);
650
+ } else {
651
+ this.sendMessage(body);
652
+ }
653
+ },
654
+ handleMsgSend() {
655
+ // 截图上传
656
+ if (this.screenshot) {
657
+ this.uploadImg(this.screenshotFile);
658
+ return;
659
+ }
660
+ if (this.chatType === 'bot') {
661
+ this.handleBotChat(this.message).then(isHuman => {
662
+ if (isHuman) {
663
+ this.$parent.$parent.$parent.initWebSocket();
664
+ }
665
+ this.updateMessage('');
666
+ });
667
+ return;
668
+ }
669
+
670
+ const editRef = this.$refs.contentEdit;
671
+ if (editRef) {
672
+ const message = editRef.innerText;
673
+ if (message.length > 2000) {
674
+ this.$message.warning('请控制在2000字以内!');
675
+ return;
676
+ }
677
+ }
678
+ // let reg = /(.*?)(<div><br><\/div>)*?$/;
679
+ let reg = /(.*?)(<div>(<span>)?<br>(<\/span>)?<\/div>)*?$/;
680
+ let message = this.message.match(reg);
681
+ if (message[2]) {
682
+ this.updateMessage(message[1]);
683
+ }
684
+ this.updateMessage(this.message.replace(/style/g, 'data'));
685
+ if (this.message.trim()) {
686
+ this.doMsgSend(0, this.message);
687
+ } else {
688
+ return this.$message.warning(this.i18nText('1.9.359'));
689
+ }
690
+ this.updateMessage('');
691
+ },
692
+ handleKeyDown(e) {
693
+ // 判断enter 发送还是换行
694
+ if (e.keyCode === 13) {
695
+ e.preventDefault();
696
+ if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
697
+ this.handleWrap();
698
+ } else {
699
+ this.handleMsgSend();
700
+ }
701
+ }
702
+ },
703
+ handleWrap() {
704
+ let ctn = `<br>`;
705
+ // 非ie环境 元素后面没有node的时候换行需要两个<br>
706
+ if (!/msie/.test(navigator.userAgent) && window.getSelection) {
707
+ const focusNode = window.getSelection().focusNode;
708
+ let nextSibling = focusNode.nextSibling;
709
+ if (focusNode === this.$refs.contentEdit) {
710
+ nextSibling = focusNode.childNodes[0];
711
+ }
712
+ do {
713
+ if (!nextSibling || nextSibling.nodeValue || nextSibling.tagName == 'BR') break;
714
+ } while ((nextSibling = nextSibling.nextSibling));
715
+ if (!nextSibling) {
716
+ ctn += ctn;
717
+ }
718
+ }
719
+ this.insertToEdit(ctn);
720
+ this.$nextTick().then(() => {
721
+ this.ping = false;
722
+ });
723
+ },
724
+ handleVideoClick(type) {
725
+ // this.curScrollItem.type 2多人 1单人
726
+ if (this.sessionType === 2) {
727
+ this.$emit('update:addvisible', true);
728
+ this.setAddMemberType(2);
729
+ this.setVideoMode(type === 'voice' ? 1 : 2);
730
+ } else {
731
+ const openTalking = sip => {
732
+ this.setShowAudio(true);
733
+ this.setVideoMode(type === 'voice' ? 1 : 2);
734
+ this.$nextTick(() => {
735
+ this.setVideoMembers([]);
736
+ });
737
+ this.setVideoData({
738
+ callerSipKey: sip?.username,
739
+ callerSipName: sip?.name
740
+ });
741
+ };
742
+ if (this.validTalkingEnv) {
743
+ this.validTalkingEnv().then(res => {
744
+ if (res.status) {
745
+ openTalking(res.sip);
746
+ }
747
+ });
748
+ } else {
749
+ openTalking();
750
+ }
751
+ }
752
+ // this.groupMembers.length > 2
753
+ return;
754
+ },
755
+ handleVoice(val) {
756
+ val && this.setIsRecorderVoice(true);
757
+ this.showVoice = val;
758
+ },
759
+ showPrescription() {
760
+ this.setModalVisible(true);
761
+ this.setMedicalOrPrescription('prescription');
762
+ },
763
+ showMedicalRecord() {
764
+ this.setModalVisible(true);
765
+ this.setMedicalOrPrescription('medical');
766
+ },
767
+ beofreToolBarClick(item) {
768
+ // 操作栏前置条件
769
+ return new Promise((resolve, reject) => {
770
+ const { precondition } = item;
771
+ if (precondition) {
772
+ this.requestPreCondition(precondition)
773
+ .then(res => {
774
+ const result = res.data.result === 'SUCCESS';
775
+ !result && this.$message.error(res.data.resultMsg || this.i18nText('1.9.22'));
776
+ resolve(result);
777
+ })
778
+ .catch(error => {
779
+ this.$message.error(error.resultMsg || this.i18nText('1.9.22'));
780
+ resolve(false);
781
+ });
782
+ } else {
783
+ resolve(true);
784
+ }
785
+ });
786
+ },
787
+ async handleToolBarClick(item) {
788
+ const validate = await this.beofreToolBarClick(item);
789
+ if (!validate) return;
790
+ let { openMode, name, templateId, isFullScreen } = item;
791
+ this.dispatchEvent('click_toolbar', { ...item });
792
+ if (!item.address) return;
793
+ this.curToolbarItem = item;
794
+ this.templateId = templateId;
795
+ this.isFullScreen = isFullScreen === 'Y';
796
+ let address = this.getLinkAddress(item);
797
+ if (openMode === 'WINDOW') {
798
+ window.open(address, name);
799
+ return;
800
+ }
801
+ if (openMode === 'EJECT') {
802
+ this.modalShow = true;
803
+ this.modalData = Object.assign({}, item, { address });
804
+ this.$nextTick().then(() => {
805
+ window.addEventListener('message', this.iframeEvent);
806
+ });
807
+ return;
808
+ }
809
+ },
810
+ iframeEvent(event) {
811
+ const method = event?.data?.method;
812
+ this[method]?.(event);
813
+ },
814
+ // 发送
815
+ handleParentMessageSend({ data, source, origin }) {
816
+ let params = {
817
+ assemblyId: this.assemblyId,
818
+ sessionId: this.sessionId,
819
+ orgId: this.orgId
820
+ };
821
+ params = Object.assign(params, data.data);
822
+ let { actionType } = this.curToolbarItem;
823
+ actionType && Object.assign(params, { actionType });
824
+ return fetch.post('/chat/access/sendToolBarData', qs.stringify(params)).then(({ data }) => {
825
+ if (data.result === 'SUCCESS') {
826
+ source.postMessage({ status: 0, resultMsg: data.resultMsg }, origin);
827
+ } else {
828
+ source.postMessage({ status: 1, resultMsg: data.resultMsg }, origin);
829
+ }
830
+ });
831
+ },
832
+ // 关闭
833
+ handleClose() {
834
+ this.modalShow = false;
835
+ window.removeEventListener('message', this.iframeEvent);
836
+ },
837
+ getLinkAddress(item,paramsData= {}) {
838
+ let t = {talbe:{},form:{},sys:{}};
839
+ Object.assign(t,paramsData ||{})
840
+ let { address = '', params = [] } = item;
841
+ let urlParams = [];
842
+ params.forEach(({ p_name, p_value }) => {
843
+ let value;
844
+ if (p_value.startsWith('form.')) {
845
+ value = this.clientParams[p_value.slice(5)];
846
+ } else if( /\${result.(.*?)\}/g.test(p_value)) {
847
+ value = vexutils.handleSysParams(p_value,t)
848
+ } else {
849
+ value = p_value;
850
+ }
851
+ urlParams.push(`${p_name}=${value}`);
852
+ });
853
+ if(/\${result.(.*?)\}/g.test(address)){
854
+ address = vexutils.handleSysParams(address,t)
855
+ }
856
+ let { actionType } = this.curToolbarItem;
857
+ actionType && urlParams.push(`actionType=${actionType}`);
858
+ if (address.includes('?')) {
859
+ address += `&${urlParams.join('&')}`;
860
+ } else {
861
+ address += `?${urlParams.join('&')}`;
862
+ }
863
+ return address;
864
+ },
865
+ handleOk() {
866
+ window.handleParentMessageSend();
867
+ },
868
+ // 剪切板粘贴
869
+ handlePaste(e) {
870
+ const cbd = e.clipboardData;
871
+ const ua = window.navigator.userAgent;
872
+ // 如果是 Safari 直接 return
873
+ if (!(e.clipboardData && e.clipboardData.items)) {
874
+ this.handlePasteText(e);
875
+ return;
876
+ }
877
+ if (
878
+ cbd.items &&
879
+ cbd.items.length === 2 &&
880
+ cbd.items[0].kind === 'string' &&
881
+ cbd.items[1].kind === 'file' &&
882
+ cbd.types &&
883
+ cbd.types.length === 2 &&
884
+ cbd.types[0] === 'text/plain' &&
885
+ cbd.types[1] === 'Files' &&
886
+ ua.match(/Macintosh/i) &&
887
+ Number(ua.match(/Chrome\/(\d{2})/i)[1]) < 49
888
+ ) {
889
+ this.handlePasteText(e);
890
+ return;
891
+ }
892
+ const hasFile = this.handleImgPaste(cbd.items);
893
+ if (hasFile) {
894
+ e.stopPropagation();
895
+ e.preventDefault();
896
+ return;
897
+ }
898
+ this.handlePasteText(e);
899
+ },
900
+ handleImgPaste(files) {
901
+ let hasFile = false;
902
+ for (let i = 0; i < files.length; i++) {
903
+ let item = files[i];
904
+ if (item.kind == 'file') {
905
+ hasFile = true;
906
+ // blob 就是从剪切板获得的文件,可以进行上传或其他操作
907
+ const blob = item.getAsFile();
908
+ if (blob.size === 0) {
909
+ return;
910
+ }
911
+ const reader = new FileReader();
912
+ const imgs = new Image();
913
+ imgs.file = blob;
914
+ reader.onload = e => {
915
+ imgs.src = e.target.result;
916
+ imgs.width = '150';
917
+ this.updateMessage(this.htmlToString(imgs));
918
+ this.$nextTick().then(() => {
919
+ this.resetSelection();
920
+ this.screenshot = true;
921
+ this.screenshotFile = blob;
922
+ });
923
+ };
924
+ reader.readAsDataURL(blob);
925
+ }
926
+ }
927
+ return hasFile;
928
+ },
929
+ // 处理文本粘贴
930
+ handlePasteText() {
931
+ if (this.pasteTimer) clearTimeout(this.pasteTimer);
932
+ const ele = this.$refs.contentEdit;
933
+ if (!ele) return;
934
+ let before = ele.innerHTML;
935
+ this.pasteTimer = setTimeout(() => {
936
+ function getPasteHtml(before, after) {
937
+ // 计算粘贴后html不同的位置起点和终点(插入"abc",则得出sPos为0,ePos为2)
938
+ var sPos = -1,
939
+ ePos = -1;
940
+ for (var i = 0, len = after.length; i < len; ++i) {
941
+ if (sPos == -1 && before.substr(i, 1) != after.substr(i, 1)) sPos = i;
942
+ if (ePos == -1 && before.substr(before.length - i - 1, 1) != after.substr(after.length - i - 1, 1)) ePos = i;
943
+
944
+ if ((sPos != -1 && ePos != -1) || len - 1 - ePos <= sPos) break;
945
+ }
946
+ if (sPos == -1 || ePos == -1) return;
947
+ ePos = len - 1 - ePos;
948
+
949
+ if (ePos <= sPos) {
950
+ // 遇到像ab,粘贴ab后变成abab这种了,这是需要从sPos开始往后找,找到和before一样的为止
951
+ i = sPos;
952
+ var beforeSPosNext = before.substr(i + 1, 10); // 取后10个来对比,如果没有10个,则取最多
953
+ while (++i < len) {
954
+ if (beforeSPosNext == after.substr(i, beforeSPosNext.length)) {
955
+ ePos = i;
956
+ break;
957
+ }
958
+ }
959
+ i == len && (ePos = len - 1);
960
+ }
961
+ // 如果有<和>,则需要计算在内
962
+ if (after.substr(sPos - 1, 1) == '<') --sPos;
963
+ if (after.substr(ePos + 1, 1) == '>') ++ePos;
964
+
965
+ // 分段获得文本,前半段 插入段 后半段
966
+ var pastedText = after.substring(sPos, ePos + 1),
967
+ formerText = after.substr(0, sPos),
968
+ latterText = after.substr(sPos + pastedText.length);
969
+
970
+ // 判断formerText和pastedText是否闭合了
971
+ var lastLT = formerText.lastIndexOf('<'),
972
+ lastGT = formerText.lastIndexOf('>');
973
+ if (lastGT < lastLT) {
974
+ // 标签断了xxxxx<
975
+ pastedText = formerText.slice(lastLT) + pastedText;
976
+ formerText = formerText.slice(0, lastLT);
977
+ }
978
+
979
+ lastLT = pastedText.lastIndexOf('<');
980
+ lastGT = pastedText.lastIndexOf('>');
981
+ if (lastGT < lastLT) {
982
+ // 标签断了<xxxxxx
983
+ var _insertGT = latterText.indexOf('>') + 1;
984
+ pastedText += latterText.slice(0, _insertGT);
985
+ latterText = latterText.slice(_insertGT);
986
+ }
987
+ return [formerText, pastedText, latterText];
988
+ }
989
+ var after = ele.innerHTML;
990
+ const data = getPasteHtml(before, after);
991
+ if (data) {
992
+ let [formerText, insertText, latterText] = data;
993
+ insertText = this.deleteStyle(insertText);
994
+ ele.innerHTML = formerText + insertText + "<span class='pasteCaretPosHelper'></span>" + latterText; // 插入pasteCaretPosHelper以帮助定位光标位置
995
+ var pasteCaretPosHelper = ele.querySelector('.pasteCaretPosHelper'),
996
+ range,
997
+ selection;
998
+ if (pasteCaretPosHelper) {
999
+ if (document.createRange) {
1000
+ // Chrome, IE 9+
1001
+ range = document.createRange();
1002
+ range.setStartAfter(pasteCaretPosHelper);
1003
+ range.collapse(false);
1004
+ selection = window.getSelection();
1005
+ selection.removeAllRanges();
1006
+ selection.addRange(range);
1007
+ } else if (document.selection) {
1008
+ // IE 8 and lower
1009
+ range = document.body.createTextRange();
1010
+ range.moveToElementText(pasteCaretPosHelper);
1011
+ range.collapse(false);
1012
+ range.select();
1013
+ }
1014
+ pasteCaretPosHelper.parentNode.removeChild(pasteCaretPosHelper);
1015
+ }
1016
+ }
1017
+ this.setMessageByHTML();
1018
+ this.saveRange();
1019
+ this.pasteTimer = null;
1020
+ }, 50);
1021
+ },
1022
+ // 拖拽上传图片
1023
+ handleFiles(files) {
1024
+ this.handleImgPaste(files);
1025
+ },
1026
+ htmlToString(dom) {
1027
+ let div = document.createElement('div');
1028
+ div.appendChild(dom);
1029
+ return div.innerHTML;
1030
+ },
1031
+ /**
1032
+ * 接入拦截
1033
+ */
1034
+ handleAccessIntercept(result) {
1035
+ let { data } = result;
1036
+ let { status, data: param } = data;
1037
+ if (status === 1) {
1038
+ this.accessChat(param).finally(() => {
1039
+ this.accessIntercept = false;
1040
+ });
1041
+ } else {
1042
+ this.accessIntercept = false;
1043
+ }
1044
+ },
1045
+ /* 客服点击接入按钮进入会话 */
1046
+ async handleAccess() {
1047
+ this.apiResult = {};
1048
+ let accessInterceptValidate = this.handleAccessInterceptValue();
1049
+ let data = null; // 接口参数
1050
+ if (accessInterceptValidate && this.accessInterceptUrl) {
1051
+ const r = await this.beforeAccessIntercept();
1052
+ if (!r) return;
1053
+ if (r.value == 'Y') {
1054
+ this.accessIntercept = true;
1055
+ this.$nextTick().then(() => {
1056
+ window.addEventListener('message', this.handleAccessIntercept);
1057
+ });
1058
+ return;
1059
+ } else {
1060
+ data = r.data; // 获取接入拦截返回参数
1061
+ }
1062
+ }
1063
+ clearTimeout(this.timer);
1064
+ this.timer = setTimeout(() => {
1065
+ this.accessChat(data);
1066
+ }, 300);
1067
+ },
1068
+ // 条件转换请求
1069
+ requestPreCondition(precondition) {
1070
+ const { targetType, targetName, targetId, params } = precondition;
1071
+ const data = parseParams(params, this.clientParams);
1072
+ let url = '';
1073
+ if (targetType === 'API') {
1074
+ data.url = targetName;
1075
+ url = `/api/executeApi`;
1076
+ } else {
1077
+ data.sqlEnterId = targetId;
1078
+ url = `/form/saveSqlEnter`;
1079
+ }
1080
+ return fetch.post(url, qs.stringify(data));
1081
+ },
1082
+ async beforeAccessIntercept() {
1083
+ function parseResult(r) {
1084
+ let value = 'Y';
1085
+ const data = r.split('&').reduce((obj, str) => {
1086
+ const [k, v] = str.split('=');
1087
+ if (k) {
1088
+ if (k == 'value') {
1089
+ value = v || value;
1090
+ } else {
1091
+ obj = obj || {};
1092
+ obj[k] = v || '';
1093
+ }
1094
+ }
1095
+ return obj;
1096
+ }, null);
1097
+ return {
1098
+ value,
1099
+ data
1100
+ };
1101
+ }
1102
+ this.apiResult = {};
1103
+ const accessInterceptSetting = this.assemblySetting.accessInterceptSetting || [];
1104
+ const setting = accessInterceptSetting.find(item => item.source == 'PC' && item.isChecked == 'Y' && item.precondition);
1105
+ if (setting) {
1106
+ const precondition = setting.precondition;
1107
+ try {
1108
+ let res = await this.requestPreCondition(precondition);
1109
+ this.apiResult = res?.data?.map || {};
1110
+ if (res.data.result === 'SUCCESS') {
1111
+ let value = res.data.map?.result;
1112
+ value = value ? JSON.parse(value) : {};
1113
+ return value.value ? parseResult(value.value) : false;
1114
+ } else {
1115
+ this.$message.error(res.data.resultMsg || this.i18nText('1.9.22'));
1116
+ return false;
1117
+ }
1118
+ } catch (error) {
1119
+ this.$message.error(error.resultMsg || this.i18nText('1.9.22'));
1120
+ return false;
1121
+ }
1122
+ }
1123
+ return {
1124
+ value: 'Y',
1125
+ data: null
1126
+ };
1127
+ },
1128
+ handleAccessInterceptValue() {
1129
+ let { listClassify = [], isListClassify, serverSetting = {} } = this.assemblySetting;
1130
+ let list = [];
1131
+ if (isListClassify != 'Y') {
1132
+ let { functionSetting = [] } = serverSetting;
1133
+ list = functionSetting;
1134
+ } else {
1135
+ let curList = listClassify.find(item => item.classify == this.classify);
1136
+ if (!curList) return false;
1137
+ list = curList.serverFunctionSetting || [];
1138
+ }
1139
+ if (!list.length) return true;
1140
+ let curItem = list.find(item => item.function == 'ACCESS_INTERCEPT');
1141
+ if (!curItem) return true;
1142
+ return curItem.isChecked == 'Y';
1143
+ },
1144
+ accessChat(data) {
1145
+ let { bid: userId, username, userType } = this.queueItem;
1146
+ let params = {
1147
+ assemblyId: this.assemblyId,
1148
+ userId,
1149
+ userType,
1150
+ lastSessionId: this.sessionId,
1151
+ relateId: this.clientParams.relateId
1152
+ };
1153
+ if (data) {
1154
+ params.addParams = JSON.stringify(data);
1155
+ }
1156
+ return fetch.post('/chat/service/accessChat', qs.stringify(params)).then(({ data }) => {
1157
+ if (data.result === 'SUCCESS') {
1158
+ let { countdown, clientParams, sessionType, countdownDesc } = data.map;
1159
+ this.setSessionId(data.map.sessionId);
1160
+ this.clearMsgList();
1161
+ this.setMsgList();
1162
+ this.setCurrentTab('session');
1163
+ this.setLastCurrentTab('session');
1164
+ this.setClientId(username);
1165
+ this.setOnChating(true);
1166
+ this.setSessionEnd(false);
1167
+ this.setQueueItem(null);
1168
+ sessionType && this.setSessionType(sessionType);
1169
+ if (countdown >= 0) {
1170
+ this.setChatTimer({ countdown, countdownDesc });
1171
+ }
1172
+ this.setClientParams(clientParams);
1173
+ this.getSessionHistoryList();
1174
+ this.dispatchEvent('user_accessSuccess', {
1175
+ map: data.map,
1176
+ user: { ...this.curScrollItem }
1177
+ });
1178
+ } else {
1179
+ this.$message.warning(data.resultMsg);
1180
+ }
1181
+ });
1182
+ },
1183
+ handleOpenTransfer() {
1184
+ if (this.enableTransfer) {
1185
+ this.transferVisible = true;
1186
+ }
1187
+ },
1188
+ handleTransfer(data) {
1189
+ const receiveId = data.converUserId;
1190
+ if (receiveId) {
1191
+ if (this.userId == receiveId) {
1192
+ this.$message.warning(this.i18nText('1.2.7.14.1'));
1193
+ return;
1194
+ }
1195
+ this.transferVisible = false;
1196
+ fetch({
1197
+ url: '/chat/service/transferQueue',
1198
+ method: 'POST',
1199
+ data: qs.stringify({
1200
+ relateId: this.clientParams.relateId,
1201
+ orgId: this.orgId,
1202
+ assemblyId: this.assemblyId,
1203
+ userId: this.curScrollItem?.bid,
1204
+ userType: this.curScrollItem?.userType || '',
1205
+ receiveId: receiveId,
1206
+ deptId: data.deptId,
1207
+ remark: data.converMark
1208
+ })
1209
+ })
1210
+ .then(({ data }) => {
1211
+ if (data.result === 'SUCCESS') {
1212
+ this.dispatchEvent('user_transferQueueSuccess', {
1213
+ user: { ...this.curScrollItem }
1214
+ });
1215
+ this.$message.success(this.i18nText('1.9.336'));
1216
+ this.clearCurrentSession(true);
1217
+ } else {
1218
+ this.$message.warning(data.resultMsg || this.i18nText('1.10.201') + this.i18nText('1.9.22'));
1219
+ }
1220
+ })
1221
+ .catch(err => {
1222
+ this.$message.warning(err.resultMsg || this.i18nText('1.10.201') + this.i18nText('1.9.22'));
1223
+ });
1224
+ } else {
1225
+ this.$message.warning(this.i18nText('1.9.335'));
1226
+ }
1227
+ },
1228
+ getSessionHistoryList() {
1229
+ this.setSessionHistoryList([]);
1230
+ if (this.assemblySetting.recordScopeSetting === 'CURRENT') return;
1231
+ fetch
1232
+ .get('/chat/service/getPastSessionList', {
1233
+ params: { sessionId: this.sessionId }
1234
+ })
1235
+ .then(({ data }) => {
1236
+ if (data.result === 'SUCCESS') {
1237
+ let list = data.list.map(item => {
1238
+ if (item.id === this.sessionId || this.type === 'session') {
1239
+ item.onChating = true;
1240
+ }
1241
+ return item;
1242
+ });
1243
+ this.setSessionHistoryList(list);
1244
+ }
1245
+ });
1246
+ },
1247
+ openQuickData() {
1248
+ // this.quickShow = true;
1249
+ if (this.quickData.length < 1) {
1250
+ fetch
1251
+ .get('/fastReply/getChatList', {
1252
+ params: {
1253
+ category: this.assemblySetting.chatPublicCategory
1254
+ }
1255
+ })
1256
+ .then(({ data }) => {
1257
+ if (data.result === 'SUCCESS') {
1258
+ this.quickData = data.list;
1259
+ }
1260
+ });
1261
+ }
1262
+ },
1263
+ // 清除当前会话
1264
+ clearCurrentSession(update = false) {
1265
+ this.clearMsgList([]);
1266
+ this.setSessionHistoryList([]);
1267
+ this.setSessionTimer('');
1268
+ this.setClientId('');
1269
+ this.setSessionId('');
1270
+ this.setScrollQueueId('');
1271
+ this.setLastClassify('');
1272
+ this.setCurScrollItem(null);
1273
+ this.setQueueItem(null);
1274
+ this.setClientParams(null);
1275
+ if (update) {
1276
+ // 重新设置 currentTab 触发 scrollList 组件 更新排队列表
1277
+ const currentTab = this.store.state?.currentTab;
1278
+ if (currentTab === 'queue') {
1279
+ this.setCurrentTab('');
1280
+ this.$nextTick(() => {
1281
+ this.setCurrentTab(this.store.state?.currentTab || currentTab);
1282
+ });
1283
+ }
1284
+ }
1285
+ },
1286
+ openRefuseReason() {
1287
+ if (this.enableRefuse) {
1288
+ this.refuseVisible = true;
1289
+ }
1290
+ },
1291
+ handleRefuse(remark) {
1292
+ if (!this.enableRefuse) return;
1293
+ fetch({
1294
+ url: '/chat/service/accessRefuse',
1295
+ method: 'POST',
1296
+ data: qs.stringify({
1297
+ relateId: this.clientParams.relateId,
1298
+ orgId: this.orgId,
1299
+ assemblyId: this.assemblyId,
1300
+ userId: this.curScrollItem?.bid,
1301
+ userType: this.curScrollItem?.userType || '',
1302
+ remark: remark || '其他'
1303
+ })
1304
+ })
1305
+ .then(({ data }) => {
1306
+ if (data.result === 'SUCCESS') {
1307
+ this.dispatchEvent('user_refuseSuccess', {
1308
+ user: { ...this.curScrollItem }
1309
+ });
1310
+ this.$message.success(this.i18nText('1.10.184'));
1311
+ this.clearCurrentSession(true);
1312
+ } else {
1313
+ this.$message.warning(data.resultMsg || this.i18nText('1.9.353') + this.i18nText('1.9.22'));
1314
+ }
1315
+ })
1316
+ .catch(err => {
1317
+ this.$message.warning(err.resultMsg || this.i18nText('1.9.353') + this.i18nText('1.9.22'));
1318
+ });
1319
+ this.refuseVisible = false;
1320
+ },
1321
+ bindEvents() {
1322
+ const handleDrop = e => {
1323
+ e.stopPropagation();
1324
+ e.preventDefault();
1325
+ this.handleFiles(e.dataTransfer.items);
1326
+ };
1327
+ document.addEventListener('drop', handleDrop, false);
1328
+ this.registerEvent('accessCurrentSession', this.handleAccess);
1329
+ this.registerEvent('refuseCurrentSession', this.openRefuseReason);
1330
+ this.registerEvent('transferCurrentQueueSession', this.handleOpenTransfer);
1331
+ this.$on('hook:beforeDestroy', () => {
1332
+ document.removeEventListener('drop', handleDrop, false);
1333
+ window.removeEventListener('message', this.iframeEvent);
1334
+ window.removeEventListener('message', this.handleAccessIntercept);
1335
+ this.unregisterEvent('accessCurrentSession', this.handleAccess);
1336
+ this.unregisterEvent('refuseCurrentSession', this.openRefuseReason);
1337
+ this.unregisterEvent('transferCurrentQueueSession', this.handleOpenTransfer);
1338
+ });
1339
+ }
1340
+ },
1341
+ watch: {
1342
+ accessIntercept: {
1343
+ handler(val) {
1344
+ if (!val) {
1345
+ window.removeEventListener('message', this.handleAccessIntercept);
1346
+ }
1347
+ }
1348
+ },
1349
+ message: {
1350
+ handler(v) {
1351
+ // 使用 _editValue 判断是否组件外修改 message,并更新聊天框
1352
+ if (this._editValue !== v) {
1353
+ this.updateMessage(v);
1354
+ }
1355
+ }
1356
+ }
1357
+ }
1358
+ };
1359
+ </script>
1360
+
1361
+ <style lang="less">
1362
+ .chat-footer-modal-big {
1363
+ padding: 10px;
1364
+ &.ant-modal-wrap {
1365
+ overflow: none;
1366
+ }
1367
+ .ant-modal {
1368
+ width: 100%;
1369
+ height: 100%;
1370
+ top: 0;
1371
+ padding-bottom: 0;
1372
+ }
1373
+ .ant-modal-content {
1374
+ height: 100%;
1375
+ }
1376
+ .ant-modal-body {
1377
+ height: calc(100% - 55px);
1378
+ }
1379
+ }
1380
+ .chat-footer-modal-small {
1381
+ &.ant-modal-wrap {
1382
+ overflow: none;
1383
+ }
1384
+ .ant-modal {
1385
+ width: 80%;
1386
+ height: 80%;
1387
+ padding-bottom: 0;
1388
+ top: 60px;
1389
+ }
1390
+ .ant-modal-content {
1391
+ height: 100%;
1392
+ }
1393
+ .ant-modal-body {
1394
+ height: 100%;
1395
+ padding: 0;
1396
+ }
1397
+ }
1398
+
1399
+ </style>
1400
+ <style lang="less" scoped>
1401
+ .message-operate {
1402
+ display: flex;
1403
+ align-items: center;
1404
+ height: 40px;
1405
+ line-height: 18px;
1406
+ background: #fff;
1407
+ overflow-x: auto;
1408
+ overflow-y: hidden;
1409
+ border-top: 1px solid #e6e6e6;
1410
+ &::-webkit-scrollbar {
1411
+ height: 5px;
1412
+ }
1413
+ > img {
1414
+ // > .operate-icon {
1415
+ margin-left: 10px;
1416
+ }
1417
+ /deep/ .ant-tabs .ant-tabs-top-content > .ant-tabs-tabpane {
1418
+ height: 300px !important;
1419
+ overflow: auto !important;
1420
+ }
1421
+ /deep/ .ant-upload-list {
1422
+ display: none;
1423
+ }
1424
+ /deep/ .ant-upload {
1425
+ height: 32px;
1426
+ vertical-align: middle;
1427
+ display: inline-block;
1428
+ }
1429
+ .no-click {
1430
+ pointer-events: none;
1431
+ opacity: 0.4;
1432
+ }
1433
+ .svg-icon {
1434
+ color: rgba(0, 0, 0, 0.6);
1435
+ }
1436
+ }
1437
+ .emoji-wrapper {
1438
+ width: 500px;
1439
+ height: 300px;
1440
+ overflow: auto;
1441
+ display: grid;
1442
+ grid-template-columns: repeat(10, 1fr);
1443
+ .emoji {
1444
+ display: inline-block;
1445
+ font-size: 20px;
1446
+ margin: 10px;
1447
+ text-align: center;
1448
+ }
1449
+ &::-webkit-scrollbar {
1450
+ width: 5px;
1451
+ }
1452
+ }
1453
+ .message {
1454
+ position: relative;
1455
+ height: 150px;
1456
+ .message-send {
1457
+ position: absolute;
1458
+ bottom: 8px;
1459
+ right: 14px;
1460
+ height: 40px;
1461
+ border-radius: 20px;
1462
+ width: 86px;
1463
+ font-weight: 600;
1464
+ font-size: 18px;
1465
+ color: #fff;
1466
+ background-color: @primary-color;
1467
+ border-color: @primary-color;
1468
+ &:hover {
1469
+ background-color: rgba(@primary-color, 0.7);
1470
+ border-color: rgba(@primary-color, 0.7);
1471
+ }
1472
+ &[disabled]:hover,
1473
+ &[disabled] {
1474
+ background-color: #f5f5f5;
1475
+ border-color: #d9d9d9;
1476
+ color: #bebebe;
1477
+ }
1478
+ }
1479
+ .prompt {
1480
+ position: absolute;
1481
+ bottom: 16px;
1482
+ right: 120px;
1483
+ color: #a6a6a6;
1484
+ }
1485
+ }
1486
+ .infinite-container {
1487
+ overflow-y: auto;
1488
+ }
1489
+ .message-wrapper {
1490
+ position: relative;
1491
+ .loading-icon {
1492
+ position: absolute;
1493
+ top: 0;
1494
+ left: 50%;
1495
+ }
1496
+ }
1497
+ .content-edit {
1498
+ width: 100%;
1499
+ height: 100%;
1500
+ padding: 0 16px 56px;
1501
+ word-break: break-word;
1502
+ &::-webkit-scrollbar {
1503
+ width: 5px;
1504
+ }
1505
+ cursor: text;
1506
+ > div {
1507
+ height: 100%;
1508
+ outline: none;
1509
+ overflow-y: auto;
1510
+ overflow-x: hidden;
1511
+ }
1512
+ }
1513
+ .overlay {
1514
+ position: absolute;
1515
+ width: 100%;
1516
+ height: 100%;
1517
+ top: 0;
1518
+ cursor: not-allowed;
1519
+ }
1520
+ .queue-page {
1521
+ display: flex;
1522
+ flex-direction: column;
1523
+ align-items: center;
1524
+ justify-content: center;
1525
+ position: absolute;
1526
+ width: 100%;
1527
+ height: 100%;
1528
+ top: 0;
1529
+ background: #fff;
1530
+ z-index: 500;
1531
+ border-top: 1px solid #e6e6e6;
1532
+ .queue-tips {
1533
+ font-size: 16px;
1534
+ color: #272727;
1535
+ line-height: 22px;
1536
+ margin-bottom: 16px;
1537
+ }
1538
+ .queue-btns {
1539
+ display: flex;
1540
+ justify-content: center;
1541
+ }
1542
+ .toSession {
1543
+ width: 80px;
1544
+ height: 80px;
1545
+ line-height: 80px;
1546
+ text-align: center;
1547
+ background: linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
1548
+ box-shadow: 0px 4px 9px 0px rgba(186, 186, 186, 0.79);
1549
+ border-radius: 50%;
1550
+ color: #4b4b4b;
1551
+ font-size: 20px;
1552
+ font-weight: 500;
1553
+ font-family: PingFangSC-Medium, PingFang SC;
1554
+ transition: transform 0.3s ease;
1555
+ &.primary {
1556
+ background: linear-gradient(180deg, #2d7aff 0%, #2c5df4 100%);
1557
+ box-shadow: 0px 5px 8px 0px rgba(44, 101, 247, 0.39);
1558
+ color: #fff;
1559
+ }
1560
+ &.danger {
1561
+ background: linear-gradient(180deg, #ff4b4b 0%, #c80606 100%);
1562
+ box-shadow: 0px 5px 8px 0px rgba(217, 26, 26, 0.35);
1563
+ color: #fff;
1564
+ }
1565
+ &:hover {
1566
+ transform: scale(1.2);
1567
+ }
1568
+ & + .toSession {
1569
+ margin-left: 36px;
1570
+ }
1571
+ }
1572
+ }
1573
+ .toolbar {
1574
+ // margin-left: 10px;
1575
+ margin: 0 5px;
1576
+ font-size: 20px;
1577
+ outline: none;
1578
+ padding: 6px;
1579
+ box-sizing: content-box;
1580
+ &:hover {
1581
+ background-color: #ebebeb;
1582
+ border-radius: 6px;
1583
+ }
1584
+ }
1585
+ .closed-toolbar {
1586
+ z-index: 100;
1587
+ }
1588
+ /deep/ p {
1589
+ margin-bottom: 0;
1590
+ }
1591
+ .click-voice {
1592
+ color: #2d7aff;
1593
+ }
1594
+ </style>