cloud-web-corejs 1.0.54-dev.25 → 1.0.54-dev.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/onlineTalk/index.vue +246 -113
- package/src/components/onlineTalk/mixins.js +158 -46
package/package.json
CHANGED
@@ -42,10 +42,18 @@
|
|
42
42
|
<template v-if="item.contentType == 0">
|
43
43
|
{{ item.content }}
|
44
44
|
</template>
|
45
|
-
<template v-else>
|
45
|
+
<template v-else-if="item.contentType == 1">
|
46
46
|
<baseUpload accept="file" multi="false" :file.sync="item.file" :edit="false"
|
47
47
|
:showProperties="false" :showSize="true" :createBy="false"></baseUpload>
|
48
48
|
</template>
|
49
|
+
<template v-else-if="item.contentType == 2">
|
50
|
+
<ul>
|
51
|
+
<li v-for="(answer,index) in item.answers" :key="index">
|
52
|
+
<a href="javascript:void(0);" class="a-link"
|
53
|
+
@click="answerCheckHandle(answer)">{{ answer.question }}</a>
|
54
|
+
</li>
|
55
|
+
</ul>
|
56
|
+
</template>
|
49
57
|
</div>
|
50
58
|
</div>
|
51
59
|
</template>
|
@@ -60,7 +68,7 @@
|
|
60
68
|
<i class="el-icon-folder-opened btn" @click="addFile" :disabled="!talkUserId"></i>
|
61
69
|
</el-tooltip>
|
62
70
|
</div> -->
|
63
|
-
<div class="pop-inputTips" v-show="false">
|
71
|
+
<!-- <div class="pop-inputTips" v-show="false">
|
64
72
|
<p>该商品的<span>有效</span>日期?</p>
|
65
73
|
<p><span>有效</span>使用时间是什么时候?</p>
|
66
74
|
<p>该商品的<span>有效</span>日期?</p>
|
@@ -69,7 +77,7 @@
|
|
69
77
|
<p><span>有效</span>使用时间是什么时候?</p>
|
70
78
|
<p>该商品的<span>有效</span>日期?</p>
|
71
79
|
<p><span>有效</span>使用时间是什么时候?</p>
|
72
|
-
</div
|
80
|
+
</div>-->
|
73
81
|
<el-input type="textarea" :rows="6" class="txt-textarea" v-model="talkUser.content" placeholder="请输入
|
74
82
|
选择此处,可粘贴文件(Ctrl+V)"
|
75
83
|
:disabled="!talkUserId" ref="contentRef" @paste.native="pasteMessage"
|
@@ -127,7 +135,9 @@
|
|
127
135
|
<i class="iconfont icon-wendangshangchuan"></i>
|
128
136
|
从个人文档工作区选择
|
129
137
|
</el-button>
|
130
|
-
<el-button type="info" plain class="button-sty" @click="
|
138
|
+
<el-button type="info" plain class="button-sty" @click="openHistoryDialog"><i
|
139
|
+
class="el-icon-time"></i>历史记录
|
140
|
+
</el-button>
|
131
141
|
</div>
|
132
142
|
<div class="fr">
|
133
143
|
<span class="t">Ctrl + Enter </span>
|
@@ -219,66 +229,41 @@
|
|
219
229
|
<div class="history-box">
|
220
230
|
<div class="h-form">
|
221
231
|
<div class="search-box">
|
222
|
-
<div class="search-classify" v-if="
|
223
|
-
|
224
|
-
|
232
|
+
<div class="search-classify" v-if="historyType == 2" @click="checkHistoryType(null)"><i
|
233
|
+
class="el-icon-files"></i><span>文件</span><i
|
234
|
+
class='el-icon-close'></i></div>
|
235
|
+
<div class="search-classify" v-if="historyType == 1" @click="checkHistoryType(null)"><i
|
236
|
+
class="el-icon-files"></i><span>图片</span><i
|
237
|
+
class='el-icon-close'></i></div>
|
238
|
+
<el-input class="search-input" v-model="historyKeyword" clearable @input="changeHistoryKeyword"></el-input>
|
225
239
|
</div>
|
226
240
|
<div class="keys-box">
|
227
|
-
<span @click="
|
228
|
-
|
229
|
-
</div>
|
230
|
-
<div class="h-list" v-if="fileTab == 'list'">
|
231
|
-
<div class="item">
|
232
|
-
<div class="name">营销管理11</div>
|
233
|
-
<div class="time">2024-01-06 16:06</div>
|
234
|
-
<div>你好~</div>
|
235
|
-
</div>
|
236
|
-
<div class="item">
|
237
|
-
<div class="name">营销管理11</div>
|
238
|
-
<div class="time">2024-01-06 16:06</div>
|
239
|
-
<div>你好~</div>
|
240
|
-
</div>
|
241
|
-
<div class="item">
|
242
|
-
<div class="name">营销管理11</div>
|
243
|
-
<div class="time">2024-01-06 16:06</div>
|
244
|
-
<div>你好~</div>
|
241
|
+
<span @click="checkHistoryType(2)">文件</span>
|
242
|
+
<span @click="checkHistoryType(1)">图片</span>
|
245
243
|
</div>
|
246
244
|
</div>
|
247
|
-
<div class="h-
|
248
|
-
<div class="item">
|
249
|
-
<div class="
|
250
|
-
<div class="
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
</
|
255
|
-
<
|
256
|
-
<
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
245
|
+
<div class="h-list" @scroll="handleScrollH" >
|
246
|
+
<div class="item" v-for="(item,index) in talkHRecords" :key="index" :class="'talk_h'+item.id">
|
247
|
+
<div class="name">{{ item.sendUserName }}</div>
|
248
|
+
<div class="time">{{ item.createDate }}</div>
|
249
|
+
<div>
|
250
|
+
<template v-if="item.contentType == 0">
|
251
|
+
{{ item.content }}
|
252
|
+
</template>
|
253
|
+
<template v-else-if="item.contentType == 1">
|
254
|
+
<baseUpload accept="file" multi="false" :file.sync="item.file" :edit="false"
|
255
|
+
:showProperties="false" :showSize="true" :createBy="false"></baseUpload>
|
256
|
+
</template>
|
257
|
+
<template v-else-if="item.contentType == 2">
|
258
|
+
<ul>
|
259
|
+
<li v-for="(answer,index) in item.answers" :key="index">
|
260
|
+
<a href="javascript:void(0);" class="a-link">{{ answer.question }}</a>
|
261
|
+
</li>
|
262
|
+
</ul>
|
263
|
+
</template>
|
262
264
|
</div>
|
263
265
|
</div>
|
264
266
|
</div>
|
265
|
-
<div class="h-pic" v-if="fileTab == 'pic'">
|
266
|
-
<div class="item">
|
267
|
-
<el-image :src="src"></el-image>
|
268
|
-
</div>
|
269
|
-
<div class="item">
|
270
|
-
<el-image :src="src"></el-image>
|
271
|
-
</div>
|
272
|
-
<div class="item">
|
273
|
-
<el-image :src="src"></el-image>
|
274
|
-
</div>
|
275
|
-
<div class="item">
|
276
|
-
<el-image :src="src"></el-image>
|
277
|
-
</div>
|
278
|
-
<div class="item">
|
279
|
-
<el-image :src="src"></el-image>
|
280
|
-
</div>
|
281
|
-
</div>
|
282
267
|
</div>
|
283
268
|
</el-dialog>
|
284
269
|
</div>
|
@@ -295,10 +280,7 @@ export default {
|
|
295
280
|
privateProfileDialog: () => import('../../components/VabUpload/privateProfileDialog')
|
296
281
|
},
|
297
282
|
data() {
|
298
|
-
return {
|
299
|
-
showHistoryDialog:false,
|
300
|
-
fileTab:'list'
|
301
|
-
};
|
283
|
+
return {};
|
302
284
|
},
|
303
285
|
mounted() {
|
304
286
|
},
|
@@ -306,59 +288,180 @@ export default {
|
|
306
288
|
</script>
|
307
289
|
<style scoped lang="scss">
|
308
290
|
@import '~@/styles/variables.scss';
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
291
|
+
|
292
|
+
.history-box {
|
293
|
+
.h-form {
|
294
|
+
padding: 2px 16px 10px;
|
295
|
+
|
296
|
+
.search-classify {
|
297
|
+
background: #F4F4F4;
|
298
|
+
line-height: 28px;
|
299
|
+
height: 28px;
|
300
|
+
padding: 0 8px;
|
301
|
+
border-radius: 3px;
|
302
|
+
|
303
|
+
> i, > span {
|
304
|
+
vertical-align: middle;
|
305
|
+
font-size: 13px;
|
306
|
+
margin-top: 2px;
|
307
|
+
}
|
308
|
+
|
309
|
+
> span {
|
310
|
+
margin: 0 2px 0 4px
|
311
|
+
}
|
312
|
+
|
313
|
+
.el-icon-close {
|
314
|
+
cursor: pointer;
|
315
|
+
}
|
317
316
|
}
|
318
|
-
|
319
|
-
|
320
|
-
|
317
|
+
|
318
|
+
::v-deep .search-box {
|
319
|
+
border: solid 1px #eee;
|
320
|
+
padding: 5px;
|
321
|
+
border-radius: 8px;
|
322
|
+
display: flex;
|
323
|
+
background: #FFF;
|
324
|
+
|
325
|
+
.el-input {
|
326
|
+
flex: 1;
|
327
|
+
|
328
|
+
.el-input__inner {
|
329
|
+
border: none;
|
330
|
+
}
|
321
331
|
}
|
322
332
|
}
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
333
|
+
|
334
|
+
.keys-box {
|
335
|
+
margin-top: 10px;
|
336
|
+
padding: 0 2px;
|
337
|
+
|
338
|
+
span {
|
339
|
+
display: inline-block;
|
340
|
+
margin-right: 42px;
|
341
|
+
font-size: 13px;
|
342
|
+
color: #2A6494;
|
343
|
+
cursor: pointer;
|
344
|
+
border-bottom: solid 1px #F7F7F7;
|
345
|
+
|
346
|
+
&:hover {
|
347
|
+
border-bottom: solid 1px #2A6494
|
348
|
+
}
|
327
349
|
}
|
328
350
|
}
|
329
351
|
}
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
352
|
+
|
353
|
+
.h-list {
|
354
|
+
height: 520px;
|
355
|
+
overflow: auto;
|
356
|
+
padding: 2px 0;
|
357
|
+
background-color: #FFF;
|
358
|
+
|
359
|
+
.item {
|
360
|
+
border-bottom: solid 1px #f2f2f2;
|
361
|
+
position: relative;
|
362
|
+
padding: 12px 16px;
|
363
|
+
color: #323232;
|
364
|
+
font-size: 13px;
|
365
|
+
|
366
|
+
.name {
|
367
|
+
color: #999;
|
368
|
+
margin-bottom: 5px;
|
369
|
+
font-size: 12px;
|
370
|
+
}
|
371
|
+
|
372
|
+
.time {
|
373
|
+
position: absolute;
|
374
|
+
right: 16px;
|
375
|
+
top: 14px;
|
376
|
+
font-size: 12px;
|
377
|
+
color: #999;
|
378
|
+
}
|
379
|
+
|
380
|
+
&:hover {
|
381
|
+
background: #f7f7f7;
|
382
|
+
}
|
337
383
|
}
|
338
384
|
}
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
385
|
+
|
386
|
+
.h-pic {
|
387
|
+
height: 520px;
|
388
|
+
overflow: auto;
|
389
|
+
padding: 8px 14px;
|
390
|
+
background-color: #FFF;
|
391
|
+
|
392
|
+
.item {
|
393
|
+
width: 133px;
|
394
|
+
height: 133px;
|
395
|
+
display: inline-block;
|
396
|
+
vertical-align: middle;
|
397
|
+
margin: 3px;
|
398
|
+
|
399
|
+
.el-image {
|
400
|
+
width: 100%;
|
401
|
+
height: 100%;
|
402
|
+
}
|
403
|
+
|
404
|
+
&:hover .el-image {
|
405
|
+
border: solid 1px #2A6494
|
406
|
+
}
|
345
407
|
}
|
346
408
|
}
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
409
|
+
|
410
|
+
.h-file {
|
411
|
+
height: 520px;
|
412
|
+
overflow: auto;
|
413
|
+
padding: 8px 0;
|
414
|
+
background-color: #FFF;
|
415
|
+
|
416
|
+
.item {
|
417
|
+
position: relative;
|
418
|
+
padding: 8px 16px 0;
|
419
|
+
color: #323232;
|
420
|
+
font-size: 13px;
|
421
|
+
display: flex;
|
422
|
+
|
423
|
+
.img {
|
424
|
+
width: 58px;
|
425
|
+
height: 58px;
|
426
|
+
|
427
|
+
.el-image {
|
428
|
+
width: 100%;
|
429
|
+
height: 100%;
|
430
|
+
}
|
354
431
|
}
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
432
|
+
|
433
|
+
.txt {
|
434
|
+
border-bottom: solid 1px #f2f2f2;
|
435
|
+
flex: 1;
|
436
|
+
display: flex;
|
437
|
+
color: #999;
|
438
|
+
font-size: 12px;
|
439
|
+
padding: 0 0 6px;
|
440
|
+
margin-left: 12px;
|
441
|
+
|
442
|
+
p {
|
443
|
+
margin: 0 0 8px;
|
444
|
+
}
|
445
|
+
|
446
|
+
.name {
|
447
|
+
color: #323232;
|
448
|
+
font-size: 13px;
|
449
|
+
}
|
450
|
+
|
451
|
+
.t-l {
|
452
|
+
flex: 1
|
453
|
+
}
|
454
|
+
|
455
|
+
.t-r {
|
456
|
+
font-size: 12px;
|
457
|
+
text-align: right;
|
458
|
+
|
459
|
+
.ico {
|
460
|
+
display: inline-block;
|
461
|
+
color: #2A6494;
|
462
|
+
margin-left: 8px;
|
463
|
+
font-size: 16px;
|
464
|
+
}
|
362
465
|
}
|
363
466
|
}
|
364
467
|
}
|
@@ -366,7 +469,6 @@ export default {
|
|
366
469
|
}
|
367
470
|
|
368
471
|
|
369
|
-
|
370
472
|
.ico-online {
|
371
473
|
background: url(~@/resources/images/ico-service.png) no-repeat center 19px #FFF;
|
372
474
|
background-size: 40px;
|
@@ -491,7 +593,8 @@ export default {
|
|
491
593
|
|
492
594
|
.item {
|
493
595
|
margin: 10px 0;
|
494
|
-
font-size:14px;
|
596
|
+
font-size: 14px;
|
597
|
+
|
495
598
|
.name {
|
496
599
|
color: rgba(102, 102, 102, 0.6);
|
497
600
|
margin-bottom: 4px;
|
@@ -536,7 +639,8 @@ export default {
|
|
536
639
|
|
537
640
|
&.right {
|
538
641
|
text-align: right;
|
539
|
-
font-size:14px;
|
642
|
+
font-size: 14px;
|
643
|
+
|
540
644
|
.cont {
|
541
645
|
background-color: #D8E8F9;
|
542
646
|
|
@@ -571,13 +675,37 @@ export default {
|
|
571
675
|
padding: 10px 12px;
|
572
676
|
display: flex;
|
573
677
|
flex-direction: column;
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
678
|
+
|
679
|
+
.pop-inputTips {
|
680
|
+
position: absolute;
|
681
|
+
background: #FFF;
|
682
|
+
left: 10px;
|
683
|
+
border: solid 1px #eee;
|
684
|
+
overflow: auto;
|
685
|
+
height: 160px;
|
686
|
+
width: 400px;
|
687
|
+
font-size: 13px;
|
688
|
+
bottom: 100%;
|
689
|
+
margin-bottom: -22px;
|
690
|
+
z-index: 22;
|
691
|
+
box-shadow: 0 0 14px rgb(0 0 0 / 11%);
|
692
|
+
padding: 2px 0;
|
693
|
+
|
694
|
+
p {
|
695
|
+
padding: 10px 16px;
|
696
|
+
margin: 0;
|
697
|
+
cursor: pointer;
|
698
|
+
|
699
|
+
&:hover {
|
700
|
+
background: #f7f7f7
|
701
|
+
}
|
702
|
+
|
703
|
+
span {
|
704
|
+
color: $red
|
705
|
+
}
|
579
706
|
}
|
580
707
|
}
|
708
|
+
|
581
709
|
.btns {
|
582
710
|
background-color: #FAFAFA;
|
583
711
|
height: 36px;
|
@@ -747,9 +875,14 @@ export default {
|
|
747
875
|
}
|
748
876
|
}
|
749
877
|
}
|
750
|
-
|
751
|
-
|
878
|
+
|
879
|
+
.fl {
|
880
|
+
.button-sty .el-icon-time {
|
881
|
+
margin-bottom: 2px;
|
882
|
+
margin-right: 2px;
|
883
|
+
}
|
752
884
|
}
|
885
|
+
|
753
886
|
.fr {
|
754
887
|
.t {
|
755
888
|
vertical-align: middle;
|
@@ -33,7 +33,14 @@ tmixins = {
|
|
33
33
|
editFileIndex: -1,
|
34
34
|
showFileNameDialog: false,
|
35
35
|
editFileName: null,
|
36
|
-
editFileSuffix: null
|
36
|
+
editFileSuffix: null,
|
37
|
+
|
38
|
+
showHistoryDialog: false,
|
39
|
+
historyType: null,
|
40
|
+
topHistoryEnd: false,
|
41
|
+
talkHRecords: [],
|
42
|
+
historyKeyword: null,
|
43
|
+
fileTab: 'list'
|
37
44
|
};
|
38
45
|
},
|
39
46
|
mounted() {
|
@@ -237,17 +244,20 @@ tmixins = {
|
|
237
244
|
|
238
245
|
|
239
246
|
},
|
240
|
-
saveTalk() {
|
247
|
+
saveTalk(formData) {
|
241
248
|
let talkUser = this.talkUser;
|
242
|
-
|
249
|
+
|
243
250
|
let userInfo = this.userInfo;
|
251
|
+
let reqDaqta = {
|
252
|
+
toUser: talkUser.toUser,
|
253
|
+
content: talkUser.content,
|
254
|
+
...formData
|
255
|
+
}
|
256
|
+
if (!this.talkUserId || !reqDaqta.content) return
|
244
257
|
this.$http({
|
245
258
|
url: USER_PREFIX + `/talk/save`,
|
246
259
|
method: `post`,
|
247
|
-
data:
|
248
|
-
toUser: talkUser.toUser,
|
249
|
-
content: talkUser.content
|
250
|
-
},
|
260
|
+
data: reqDaqta,
|
251
261
|
isLoading: true,
|
252
262
|
loadingTarget: document.body,
|
253
263
|
success: res => {
|
@@ -262,29 +272,6 @@ tmixins = {
|
|
262
272
|
}
|
263
273
|
});
|
264
274
|
},
|
265
|
-
a(){
|
266
|
-
this.$http({
|
267
|
-
url: USER_PREFIX + `/knowledge_base/findLnowList`,
|
268
|
-
method: `post`,
|
269
|
-
data: {
|
270
|
-
toUser: talkUser.toUser,
|
271
|
-
content: talkUser.content
|
272
|
-
},
|
273
|
-
// isLoading: true,
|
274
|
-
loadingTarget: document.body,
|
275
|
-
success: res => {
|
276
|
-
let row = res.objx || {};
|
277
|
-
talkUser.content = null;
|
278
|
-
this.getList(0, () => {
|
279
|
-
this.$nextTick(() => {
|
280
|
-
this.topChatBoxButtom();
|
281
|
-
this.$refs.contentRef.focus();
|
282
|
-
})
|
283
|
-
})
|
284
|
-
}
|
285
|
-
});
|
286
|
-
|
287
|
-
},
|
288
275
|
getUserPage(flag) {
|
289
276
|
if (!this.dialogTableVisible) return
|
290
277
|
if (!this.inited) {
|
@@ -423,28 +410,42 @@ tmixins = {
|
|
423
410
|
//处理消息的发送时间(精确到分钟),用于分组
|
424
411
|
row._time = row.createDate.substring(0, 16)
|
425
412
|
//处理文本是否文件
|
413
|
+
let contentType = 0;
|
426
414
|
let file = null;
|
415
|
+
let answers = [];
|
427
416
|
let cotnent = row.content;
|
428
417
|
let str = "#file:";
|
429
|
-
|
430
|
-
|
431
|
-
if (
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
file =
|
418
|
+
let str2 = "#answer:";
|
419
|
+
if (cotnent) {
|
420
|
+
if (cotnent.indexOf(str) == 0) {
|
421
|
+
let jsonStr = cotnent.slice(str.length)
|
422
|
+
if (jsonStr) {
|
423
|
+
try {
|
424
|
+
file = JSON.parse(jsonStr);
|
425
|
+
if (!file.domain || !file.url) {
|
426
|
+
file = null;
|
427
|
+
}
|
428
|
+
} catch (e) {
|
429
|
+
console.error(e);
|
436
430
|
}
|
437
|
-
} catch (e) {
|
438
431
|
}
|
432
|
+
contentType = 1;
|
433
|
+
} else if (cotnent.startsWith(str2)) {
|
434
|
+
let jsonStr = cotnent.slice(str2.length)
|
435
|
+
if (jsonStr) {
|
436
|
+
try {
|
437
|
+
answers = JSON.parse(jsonStr) || [];
|
438
|
+
} catch (e) {
|
439
|
+
console.error(e);
|
440
|
+
}
|
441
|
+
}
|
442
|
+
contentType = 2;
|
439
443
|
}
|
440
444
|
}
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
row.contentType = 0;
|
446
|
-
row.file = null;
|
447
|
-
}
|
445
|
+
|
446
|
+
row.contentType = contentType;
|
447
|
+
row.file = file;
|
448
|
+
row.answers = answers;
|
448
449
|
},
|
449
450
|
createTimerHandle() {
|
450
451
|
this.clearTimerHandle();
|
@@ -727,7 +728,118 @@ tmixins = {
|
|
727
728
|
file.fileName = this.editFileName.toString();
|
728
729
|
file.name = (file.fileName + "." + file.fileSuffix).toString();
|
729
730
|
this.showFileNameDialog = false;
|
730
|
-
}
|
731
|
+
},
|
732
|
+
answerCheckHandle(item) {
|
733
|
+
this.saveTalk({
|
734
|
+
content: item.question,
|
735
|
+
knowledgeId: item.id
|
736
|
+
})
|
737
|
+
},
|
738
|
+
openHistoryDialog() {
|
739
|
+
this.historyKeyword = null;
|
740
|
+
this.historyType = null;
|
741
|
+
this.topHistoryEnd = false;
|
742
|
+
this.talkHRecords = [];
|
743
|
+
this.showHistoryDialog = true;
|
744
|
+
this.getHList(0, () => {
|
745
|
+
if (this.talkHRecords.length) {
|
746
|
+
this.$nextTick(() => {
|
747
|
+
document.querySelector('.talk_h' + this.talkHRecords[this.talkHRecords.length - 1].id).scrollIntoView();
|
748
|
+
})
|
749
|
+
}
|
750
|
+
});
|
751
|
+
},
|
752
|
+
checkHistoryType(historyType) {
|
753
|
+
this.historyType = historyType;
|
754
|
+
this.topHistoryEnd = false;
|
755
|
+
this.talkHRecords = [];
|
756
|
+
this.getHList(0, () => {
|
757
|
+
if (this.talkHRecords.length) {
|
758
|
+
this.$nextTick(() => {
|
759
|
+
document.querySelector('.talk_h' + this.talkHRecords[this.talkHRecords.length - 1].id).scrollIntoView();
|
760
|
+
})
|
761
|
+
}
|
762
|
+
});
|
763
|
+
},
|
764
|
+
changeHistoryKeyword() {
|
765
|
+
this.topHistoryEnd = false;
|
766
|
+
this.talkHRecords = [];
|
767
|
+
this.getHList(0, () => {
|
768
|
+
if (this.talkHRecords.length) {
|
769
|
+
this.$nextTick(() => {
|
770
|
+
document.querySelector('.talk_h' + this.talkHRecords[this.talkHRecords.length - 1].id).scrollIntoView();
|
771
|
+
})
|
772
|
+
}
|
773
|
+
});
|
774
|
+
},
|
775
|
+
handleScrollH(event) {
|
776
|
+
let scrollTop = event.target.scrollTop;
|
777
|
+
let scrollHeight = event.target.scrollHeight;
|
778
|
+
let clientHeight = event.target.clientHeight;
|
779
|
+
let isTop = scrollTop <= 0;
|
780
|
+
let isButtom = scrollTop + clientHeight >= scrollHeight;
|
781
|
+
if (isTop) {
|
782
|
+
//上拉,查上一页的记录
|
783
|
+
let firstDom = event.target.querySelector('.item');
|
784
|
+
this.getHList(1, () => {
|
785
|
+
firstDom && firstDom.scrollIntoView();
|
786
|
+
});
|
787
|
+
}
|
788
|
+
},
|
789
|
+
getHList(direction, callback) {
|
790
|
+
if (!this.showHistoryDialog) return
|
791
|
+
if (!this.talkUserId) return
|
792
|
+
let talkUser = this.talkUser;
|
793
|
+
if (direction == 1 && this.topHistoryEnd) {
|
794
|
+
////上拉,且没有记录
|
795
|
+
return;
|
796
|
+
}
|
797
|
+
let lastId = this.getLastHRecordId(direction);
|
798
|
+
direction = direction || 0;
|
799
|
+
this.$http({
|
800
|
+
url: USER_PREFIX + `/talk/list`,
|
801
|
+
method: `post`,
|
802
|
+
data: {
|
803
|
+
toUser: this.talkUserId,
|
804
|
+
lastId: lastId,
|
805
|
+
direction: direction,
|
806
|
+
type: this.historyType,
|
807
|
+
keyWord: this.historyKeyword
|
808
|
+
},
|
809
|
+
modal: false,
|
810
|
+
success: res => {
|
811
|
+
let rows = res.objx || [];
|
812
|
+
rows.forEach(row => {
|
813
|
+
this.handleContent(row);
|
814
|
+
})
|
815
|
+
if (direction == 0) {
|
816
|
+
this.talkHRecords.push(...rows);
|
817
|
+
} else {
|
818
|
+
this.talkHRecords.splice(0, 0, ...rows);
|
819
|
+
}
|
820
|
+
|
821
|
+
if (direction == 1 && rows.length == 0) {
|
822
|
+
//上拉,且没有记录
|
823
|
+
this.topHistoryEnd = true;
|
824
|
+
}
|
825
|
+
callback && callback();
|
826
|
+
}
|
827
|
+
});
|
828
|
+
},
|
829
|
+
getLastHRecordId(direction) {
|
830
|
+
direction = direction || 0;
|
831
|
+
let lastTalkRecordId = null;
|
832
|
+
if (this.talkHRecords.length) {
|
833
|
+
if (direction == 0) {
|
834
|
+
//下拉,获取最后一条记录的ID
|
835
|
+
lastTalkRecordId = this.talkHRecords[this.talkHRecords.length - 1].id;
|
836
|
+
} else {
|
837
|
+
//上拉,获取第一条记录的ID
|
838
|
+
lastTalkRecordId = this.talkHRecords[0].id;
|
839
|
+
}
|
840
|
+
}
|
841
|
+
return lastTalkRecordId;
|
842
|
+
},
|
731
843
|
//file end
|
732
844
|
}
|
733
845
|
};
|