cloud-web-corejs 1.0.54-dev.25 → 1.0.54-dev.27

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.25",
4
+ "version": "1.0.54-dev.27",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "lint": "eslint --ext .js,.vue src",
@@ -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 class="onlieTalk-search-list">
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,16 +68,16 @@
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">
64
- <p>该商品的<span>有效</span>日期?</p>
65
- <p><span>有效</span>使用时间是什么时候?</p>
66
- <p>该商品的<span>有效</span>日期?</p>
67
- <p><span>有效</span>使用时间是什么时候?</p>
68
- <p>该商品的<span>有效</span>日期?</p>
69
- <p><span>有效</span>使用时间是什么时候?</p>
70
- <p>该商品的<span>有效</span>日期?</p>
71
- <p><span>有效</span>使用时间是什么时候?</p>
72
- </div>
71
+ <!-- <div class="pop-inputTips" v-show="false">
72
+ <p>该商品的<span>有效</span>日期?</p>
73
+ <p><span>有效</span>使用时间是什么时候?</p>
74
+ <p>该商品的<span>有效</span>日期?</p>
75
+ <p><span>有效</span>使用时间是什么时候?</p>
76
+ <p>该商品的<span>有效</span>日期?</p>
77
+ <p><span>有效</span>使用时间是什么时候?</p>
78
+ <p>该商品的<span>有效</span>日期?</p>
79
+ <p><span>有效</span>使用时间是什么时候?</p>
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="showHistoryDialog=true"><i class="el-icon-time"></i>历史记录</el-button>
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="fileTab == 'file'"><i class="el-icon-files"></i><span>文件</span><i class='el-icon-close' @click="fileTab = 'list'"></i></div>
223
- <div class="search-classify" v-if="fileTab == 'pic'"><i class="el-icon-files"></i><span>图片</span><i class='el-icon-close' @click="fileTab = 'list'"></i></div>
224
- <el-input class="search-input"></el-input>
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="fileTab = 'file'">文件</span><span @click="fileTab = 'pic'">图片</span>
241
+ <span @click="checkHistoryType(2)">文件</span>
242
+ <span @click="checkHistoryType(1)">图片</span>
228
243
  </div>
229
244
  </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>
245
- </div>
246
- </div>
247
- <div class="h-file" v-if="fileTab == 'file'">
248
- <div class="item">
249
- <div class="img"><el-image :src="src"></el-image></div>
250
- <div class="txt">
251
- <div class="t-l">
252
- <p class="name">放大.pdf</p>
253
- <p>admin</p>
254
- </div>
255
- <div class="t-r">
256
- <p>2021-12-10</p>
257
- <p>
258
- <span>2.3M</span>
259
- <el-tooltip class="ico" effect="dark" content="下载" placement="top"><i class="el-icon-download"></i></el-tooltip>
260
- </p>
261
- </div>
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 class="onlieTalk-search-list">
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,191 @@ export default {
306
288
  </script>
307
289
  <style scoped lang="scss">
308
290
  @import '~@/styles/variables.scss';
309
- .history-box{
310
- .h-form{
311
- padding:2px 16px 10px;
312
- .search-classify{
313
- background:#F4F4F4;line-height:28px;height:28px;padding:0 8px;border-radius: 3px;
314
- > i , > span{vertical-align: middle;font-size: 13px;margin-top: 2px;}
315
- > span{margin:0 2px 0 4px}
316
- .el-icon-close{cursor: pointer;}
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
- ::v-deep .search-box{border:solid 1px #eee;padding:5px;border-radius: 8px;display:flex;background:#FFF;
319
- .el-input{flex:1;
320
- .el-input__inner{border:none;}
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
- .keys-box{
324
- margin-top:10px;padding: 0 2px;
325
- span{display: inline-block;margin-right: 42px;font-size: 13px;color: #2A6494;cursor: pointer;border-bottom:solid 1px #F7F7F7;
326
- &:hover{border-bottom:solid 1px #2A6494}
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
- .h-list{
331
- height: 520px;overflow: auto;padding:2px 0;background-color: #FFF;
332
- .item{
333
- border-bottom:solid 1px #f2f2f2;position: relative;padding:12px 16px;color: #323232;font-size: 13px;
334
- .name{color:#999;margin-bottom: 5px;font-size: 12px;}
335
- .time{position: absolute;right:16px;top: 14px;font-size: 12px;color: #999;}
336
- &:hover{background:#f7f7f7;}
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
+ overflow: hidden;
366
+ .onlieTalk-search-list{
367
+ list-style: none;margin: -6px 0;padding: 0;min-width: 360px;max-width: 90%;border: solid 1px #eee;padding: 4px 8px;border-radius: 6px;margin: 10px 0 4px;background: #f7f7f7;overflow: hidden;
368
+ li{
369
+ padding: 12px 2px;border-bottom: dashed 1px #dfdfdf;display: block;position: relative;font-size: 12px;cursor: pointer;
370
+ &:after{content:"\e6e0";font-family: element-icons!important;color:#747474;height:30px;border-radius: 50%;position: absolute;top:50%;margin-top:-15px;right:0;line-height:30px;}
371
+ &:last-child{
372
+ border-bottom: none;
373
+ }
374
+ }
375
+ }
376
+ .name {
377
+ color: #999;
378
+ margin-bottom: 5px;
379
+ font-size: 12px;
380
+ }
381
+
382
+ .time {
383
+ position: absolute;
384
+ right: 16px;
385
+ top: 14px;
386
+ font-size: 12px;
387
+ color: #999;
388
+ }
389
+ ::v-deep .upload-box{margin:-10px 0 0 0 !important;border-top:none}
390
+ &:hover {
391
+ background: #f7f7f7;
392
+ }
393
+
337
394
  }
338
395
  }
339
- .h-pic{
340
- height: 520px;overflow: auto;padding:8px 14px;background-color: #FFF;
341
- .item{
342
- width:133px;height:133px;display:inline-block;vertical-align: middle;margin: 3px;
343
- .el-image{width: 100%;height:100%;}
344
- &:hover .el-image{border:solid 1px #2A6494}
396
+
397
+ .h-pic {
398
+ height: 520px;
399
+ overflow: auto;
400
+ padding: 8px 14px;
401
+ background-color: #FFF;
402
+
403
+ .item {
404
+ width: 133px;
405
+ height: 133px;
406
+ display: inline-block;
407
+ vertical-align: middle;
408
+ margin: 3px;
409
+
410
+ .el-image {
411
+ width: 100%;
412
+ height: 100%;
413
+ }
414
+
415
+ &:hover .el-image {
416
+ border: solid 1px #2A6494
417
+ }
345
418
  }
346
419
  }
347
- .h-file{
348
- height: 520px;overflow: auto;padding:8px 0;background-color: #FFF;
349
- .item{
350
- position: relative;padding:8px 16px 0;color: #323232;font-size: 13px;display: flex;
351
- .img{
352
- width:58px;height:58px;
353
- .el-image{width: 100%;height:100%;}
420
+
421
+ .h-file {
422
+ height: 520px;
423
+ overflow: auto;
424
+ padding: 8px 0;
425
+ background-color: #FFF;
426
+
427
+ .item {
428
+ position: relative;
429
+ padding: 8px 16px 0;
430
+ color: #323232;
431
+ font-size: 13px;
432
+ display: flex;
433
+
434
+ .img {
435
+ width: 58px;
436
+ height: 58px;
437
+
438
+ .el-image {
439
+ width: 100%;
440
+ height: 100%;
441
+ }
354
442
  }
355
- .txt{
356
- border-bottom:solid 1px #f2f2f2;flex:1;display: flex;color:#999;font-size:12px;padding:0 0 6px;margin-left:12px;
357
- p{margin:0 0 8px;}
358
- .name{color:#323232;font-size: 13px;}
359
- .t-l{flex:1}
360
- .t-r{font-size:12px;text-align: right;
361
- .ico{display: inline-block;color:#2A6494;margin-left:8px;font-size: 16px;}
443
+
444
+ .txt {
445
+ border-bottom: solid 1px #f2f2f2;
446
+ flex: 1;
447
+ display: flex;
448
+ color: #999;
449
+ font-size: 12px;
450
+ padding: 0 0 6px;
451
+ margin-left: 12px;
452
+
453
+ p {
454
+ margin: 0 0 8px;
455
+ }
456
+
457
+ .name {
458
+ color: #323232;
459
+ font-size: 13px;
460
+ }
461
+
462
+ .t-l {
463
+ flex: 1
464
+ }
465
+
466
+ .t-r {
467
+ font-size: 12px;
468
+ text-align: right;
469
+
470
+ .ico {
471
+ display: inline-block;
472
+ color: #2A6494;
473
+ margin-left: 8px;
474
+ font-size: 16px;
475
+ }
362
476
  }
363
477
  }
364
478
  }
@@ -366,7 +480,6 @@ export default {
366
480
  }
367
481
 
368
482
 
369
-
370
483
  .ico-online {
371
484
  background: url(~@/resources/images/ico-service.png) no-repeat center 19px #FFF;
372
485
  background-size: 40px;
@@ -491,7 +604,17 @@ export default {
491
604
 
492
605
  .item {
493
606
  margin: 10px 0;
494
- font-size:14px;
607
+ font-size: 14px;
608
+ .onlieTalk-search-list{
609
+ list-style: none;margin: -6px 0;padding: 0;min-width: 360px;max-width: 90%;
610
+ li{
611
+ padding: 12px 2px;border-bottom: dashed 1px #dfdfdf;display: block;position: relative;font-size: 12px;cursor: pointer;
612
+ &:after{content:"\e6e0";font-family: element-icons!important;color:#747474;height:30px;border-radius: 50%;position: absolute;top:50%;margin-top:-15px;right:0;line-height:30px;}
613
+ &:last-child{
614
+ border-bottom: none;
615
+ }
616
+ }
617
+ }
495
618
  .name {
496
619
  color: rgba(102, 102, 102, 0.6);
497
620
  margin-bottom: 4px;
@@ -536,7 +659,8 @@ export default {
536
659
 
537
660
  &.right {
538
661
  text-align: right;
539
- font-size:14px;
662
+ font-size: 14px;
663
+
540
664
  .cont {
541
665
  background-color: #D8E8F9;
542
666
 
@@ -571,13 +695,37 @@ export default {
571
695
  padding: 10px 12px;
572
696
  display: flex;
573
697
  flex-direction: column;
574
- .pop-inputTips{
575
- position: absolute;background: #FFF;left: 10px;border: solid 1px #eee;overflow: auto;height: 160px;width: 400px;font-size: 13px;bottom: 100%;margin-bottom: -22px;z-index: 22;box-shadow: 0 0 14px rgb(0 0 0 / 11%);padding:2px 0;
576
- p{padding: 10px 16px;margin: 0;cursor: pointer;
577
- &:hover{background:#f7f7f7}
578
- span{color:$red}
698
+
699
+ .pop-inputTips {
700
+ position: absolute;
701
+ background: #FFF;
702
+ left: 10px;
703
+ border: solid 1px #eee;
704
+ overflow: auto;
705
+ height: 160px;
706
+ width: 400px;
707
+ font-size: 13px;
708
+ bottom: 100%;
709
+ margin-bottom: -22px;
710
+ z-index: 22;
711
+ box-shadow: 0 0 14px rgb(0 0 0 / 11%);
712
+ padding: 2px 0;
713
+
714
+ p {
715
+ padding: 10px 16px;
716
+ margin: 0;
717
+ cursor: pointer;
718
+
719
+ &:hover {
720
+ background: #f7f7f7
721
+ }
722
+
723
+ span {
724
+ color: $red
725
+ }
579
726
  }
580
727
  }
728
+
581
729
  .btns {
582
730
  background-color: #FAFAFA;
583
731
  height: 36px;
@@ -747,9 +895,14 @@ export default {
747
895
  }
748
896
  }
749
897
  }
750
- .fl{
751
- .button-sty .el-icon-time{margin-bottom: 2px;margin-right: 2px;}
898
+
899
+ .fl {
900
+ .button-sty .el-icon-time {
901
+ margin-bottom: 2px;
902
+ margin-right: 2px;
903
+ }
752
904
  }
905
+
753
906
  .fr {
754
907
  .t {
755
908
  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
- if (!this.talkUserId || !talkUser.content) return
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
- if (cotnent.indexOf(str) == 0) {
430
- let jsonStr = cotnent.slice(str.length)
431
- if (jsonStr) {
432
- try {
433
- file = JSON.parse(jsonStr);
434
- if (!file.domain || !file.url) {
435
- file = null;
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
- if (file) {
442
- row.file = file;
443
- row.contentType = 1;
444
- } else {
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
  };