askbot-dragon 1.5.59-beta → 1.5.60-beta

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.
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div id="pdf_view" class="pdf_view" :style="{
2
+ <div class="pdf_view" ref="pdfView" @scroll="pdfScroll" :style="{
3
3
  marginTop: isPC ? '50px' : '',
4
4
  marginBottom: tagIds.length > 1 ? '60px' : '0px',
5
5
  height: setHeight
@@ -17,7 +17,6 @@
17
17
  </el-option>
18
18
  </el-select>
19
19
  </div>
20
- <div class="pdf_container_view" id="pdf_container_view" @scroll="pdfScroll" ref="pdfView"></div>
21
20
  <div class="btn_footer" v-if="tagIds.length > 1 && !isPC">
22
21
  <div class="prev" @click="prev">上一段</div>
23
22
  <div class="next" @click="next">下一段</div>
@@ -45,11 +44,10 @@ if (pdfjsLib) {
45
44
  // 'pdfjs-dist/build/pdf.worker';
46
45
  }
47
46
  const { TextLayerBuilder } = window['pdfjs-dist/web/pdf_viewer']
48
- const CSS_UNITS = 96.0 / 72.0
49
47
  // import { zoomElement } from '../assets/js/hammer'
50
48
  export default {
51
49
  name: 'pdfView',
52
- props: ['tagIds', 'isMessageRecord','fileName'],
50
+ props: ['tagIds', 'isMessageRecord'],
53
51
  data () {
54
52
  return {
55
53
  url: '',
@@ -96,7 +94,6 @@ export default {
96
94
  },
97
95
  isTouchMoved: false,
98
96
  transformSalce: null,
99
- defaultTransform:0.8,
100
97
  isPC: false,
101
98
  handScale: 'auto',
102
99
  scaleList: [
@@ -251,13 +248,12 @@ export default {
251
248
  if (this.$refs.pdfView.clientWidth / this.pageSize.width >= 1 || this.isMessageRecord) {
252
249
  this.contentView.style.width = `${pageSize.width - 10}px`;
253
250
  this.contentView.style.height = `${(this.totalPageCount * (pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
254
- this.contentView.style.margin = '0 auto 0'
255
251
  } else {
256
- this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width / CSS_UNITS
252
+ this.transformSalce = this.$refs.pdfView.clientWidth / this.pageSize.width
257
253
  this.contentView.style.width = `${pageSize.width * this.transformSalce - 10}px`;
258
254
  this.contentView.style.height = `${(this.totalPageCount * (pageSize.height * (this.transformSalce) + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
259
255
  }
260
- // this.contentView.style.margin = '0 auto 0'
256
+ this.contentView.style.margin = '0 auto 0'
261
257
  this.contentView.style.position = 'relative'
262
258
  this.contentView.style.paddingBottom = '60px'
263
259
  // contentView.style.overflowY = 'auto'
@@ -285,41 +281,36 @@ export default {
285
281
  const { pdfPage, pageNo, dom } = page;
286
282
  // dom 元素已存在,无须重新渲染,直接返回
287
283
  if ((dom && dom.children.length != 0) || page.loading) {
288
- return;
284
+ return;
289
285
  }
290
286
  page.loading = true
291
287
  const viewport = pdfPage.getViewport({
292
- scale: this.scale,
293
- rotation: this.rotation,
288
+ scale: this.scale,
289
+ rotation: this.rotation,
294
290
  });
295
291
  // 创建新的canvas
296
292
  const canvas = document.createElement('canvas');
297
293
  const context = canvas.getContext('2d');
298
294
  // canvas.getContext('2d');
299
- canvas.height = this.pageSize.height * (this.fileName ? CSS_UNITS : 1);
300
- canvas.width = this.pageSize.width * (this.fileName ? CSS_UNITS : 1);
295
+ canvas.height = this.pageSize.height;
296
+ canvas.width = this.pageSize.width;
301
297
  canvas.style.position = 'relative'
302
298
  canvas.style.top = -3 + 'px'
303
299
  // 创建渲染的dom
304
300
  const pageDom = document.createElement('div');
305
301
  pageDom.style.position = 'absolute';
306
- pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1)) + this.PAGE_INTVERVAL}px`;
307
- pageDom.style.width = `${this.pageSize.width * (this.fileName ? CSS_UNITS : 1)}px`;
308
- pageDom.style.height = `${this.pageSize.height * (this.fileName ? CSS_UNITS : 1)}px`;
302
+ pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL}px`;
303
+ pageDom.style.width = `${this.pageSize.width}px`;
304
+ pageDom.style.height = `${this.pageSize.height}px`;
309
305
  pageDom.setAttribute('data-id', 'page' + pageNo)
310
- // pageDom.appendChild(canvas);
306
+ pageDom.appendChild(canvas);
311
307
  // 渲染内容
312
308
  let renderContext = {
313
309
  canvasContext: context,
314
310
  viewport: viewport,
315
- transform: this.fileName ? [CSS_UNITS, 0, 0, CSS_UNITS, 0, 0] : '',
316
311
  }
317
312
  await pdfPage.render(renderContext).promise.then(() => {
318
- const html = canvas.toDataURL();
319
- let image = document.createElement('img');
320
- image.setAttribute('src',html)
321
- pageDom.appendChild(image);
322
- return pdfPage.getTextContent()
313
+ return pdfPage.getTextContent()
323
314
  }).then(async (textContent) => {
324
315
  const textLayerDiv = document.createElement('div');
325
316
  textLayerDiv.setAttribute('class', 'textLayer');
@@ -349,35 +340,36 @@ export default {
349
340
  let postionArr = lines[index].location
350
341
  let div = document.createElement('div')
351
342
  div.style.position = 'absolute';
352
- div.style.left = postionArr[0] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px',
343
+ div.style.left = postionArr[0] * this.scale + 'px',
353
344
  // 后端返回的坐标有基线对齐的问题,top 值是后端算好(基线top - 文字高度),在此加上文字高度的 1/9 (大致比例)为实际展示出文字的top值
354
- div.style.top = postionArr[1] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px'
355
- div.style.height = postionArr[3] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px';
356
- div.style.width = postionArr[2] * this.scale * (this.fileName ? CSS_UNITS : 1) + 'px'
345
+ div.style.top = postionArr[1] * this.scale + 'px'
346
+ div.style.height = postionArr[3] * this.scale + 'px';
347
+ div.style.width = postionArr[2] * this.scale + 'px'
357
348
  div.style.backgroundColor = 'rgba(54, 106, 255, 0.3)'
358
349
  div.classList.add('lineHeight')
359
350
  rectdom.appendChild(div)
360
351
  if (index == 0 && j == 0) {
361
352
  if (this.transformSalce !== null) {
362
- rectdomTop = postionArr[1]* this.scale * (this.fileName ? CSS_UNITS : 1) * this.transformSalce
363
- } else {
364
- rectdomTop = postionArr[1] * this.scale * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform
365
- }
366
- // if(this.isPC) {
367
- // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
368
- // }
353
+ rectdomTop = postionArr[1] * this.scale * this.transformSalce
354
+ } else {
355
+ rectdomTop = postionArr[1] * this.scale
356
+ }
357
+ // if(this.isPC) {
358
+ // rectdomTop = rectdomTop - 50 < 0 ? 0 : rectdomTop - 50
359
+ // }
360
+ }
361
+ }
362
+ }
363
+ if (rectdom.children.length > 0) {
364
+ pageDom.appendChild(rectdom)
365
+ }
369
366
  }
370
- }
371
367
  }
372
- if (rectdom.children.length > 0) {
373
- pageDom.appendChild(rectdom)
374
- }
375
- }
376
368
  }
377
- }
378
- textLayer.setTextContent(textContent);
379
- textLayer.render()
380
- pageDom.appendChild(textLayerDiv);
369
+ textLayer.setTextContent(textContent);
370
+ textLayer.render()
371
+ pageDom.appendChild(textLayerDiv);
372
+
381
373
  let backgroundDom = document.getElementById('backgroundLoad' + pageNo)
382
374
  if (backgroundDom) {
383
375
  this.contentView.removeChild(backgroundDom);
@@ -385,22 +377,8 @@ export default {
385
377
  page.dom = await pageDom;
386
378
  page.loading = false
387
379
  this.contentView.appendChild(pageDom);
388
- let pdf_view = document.getElementsByClassName('pdf_view');
389
- if (pdf_view && pdf_view[0]){
390
- pdf_view[0].style.backgroundImage = 'none'
391
- }
392
- let postionArr = []
393
- if (findPage){
394
- let AllLines = findPage.allLines
395
- if (AllLines.length){
396
- postionArr = AllLines[0].lines[0].location
397
- }
398
- }
399
- if(this.transformSalce !== null && this.fileName) {
400
- this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
401
- } else {
402
- this.contentView.style.transform = `scale(${this.defaultTransform})`;
403
-
380
+ if (this.transformSalce !== null) {
381
+ this.contentView.style.transform = `scale(${this.transformSalce}, ${this.transformSalce})`
404
382
  }
405
383
  if (this.changetoolbar) {
406
384
  setTimeout(() => {
@@ -412,21 +390,22 @@ export default {
412
390
  setTimeout(() => {
413
391
  let pageoffsetHeight = 0
414
392
  if (this.transformSalce !== null) {
415
- pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)
393
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce
416
394
  } else {
417
- pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL) * this.defaultTransform *(this.fileName ? CSS_UNITS : 1)
395
+ pageoffsetHeight = (this.pageSize.height + this.PAGE_INTVERVAL)
418
396
  }
419
397
  if (this.$refs.pdfView.clientHeight - pageoffsetHeight > 0 && pageIndex == 1) {
420
398
  const height = this.$refs.pdfView.clientHeight;
421
399
  let startNum = 0
422
400
  let endNum = 0
423
401
  if (this.transformSalce !== null) {
424
- startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce* (this.fileName ? CSS_UNITS : 1)))
425
- endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce* (this.fileName ? CSS_UNITS : 1)))
426
- } else {
427
- startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))
428
- endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))}
429
- console.log(this.$refs.pdfView.scrollTop, startNum, endNum, 'endNumendNum');
402
+ startNum = Math.ceil(this.$refs.pdfView.scrollTop / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
403
+ endNum = startNum + Math.ceil(height / ((this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce))
404
+ } else {
405
+ startNum = Math.ceil(this.$refs.pdfView.scrollTop / (this.pageSize.height + this.PAGE_INTVERVAL))
406
+ endNum = startNum + Math.ceil(height / (this.pageSize.height + this.PAGE_INTVERVAL))
407
+
408
+ }
430
409
  for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
431
410
  if (pageIndex > 0 && pageIndex <= this.pages.length) {
432
411
  this.loadPdfData(pageIndex)
@@ -458,14 +437,14 @@ export default {
458
437
  let startNum = 0
459
438
  let endNum = 0
460
439
  if (this.transformSalce !== null) {
461
- startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)))
462
- endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)))
440
+ startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
441
+ endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * this.transformSalce))
463
442
  } else {
464
- startNum = Math.ceil(scrollTop / ((that.pageSize.height + that.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))
465
- endNum = startNum + Math.ceil(height / ((that.pageSize.height + that.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1) * this.defaultTransform))
443
+ startNum = Math.ceil(scrollTop / (that.pageSize.height + that.PAGE_INTVERVAL))
444
+ endNum = startNum + Math.ceil(height / (that.pageSize.height + that.PAGE_INTVERVAL))
466
445
  }
467
- for (let pageIndex = startNum; pageIndex <= endNum; pageIndex++) {
468
- if (pageIndex > 0 && pageIndex <= that.pages.length) {
446
+ for (let pageIndex = startNum; pageIndex < endNum; pageIndex++) {
447
+ if (pageIndex > 0 && pageIndex < that.pages.length) {
469
448
  that.loadPdfData(pageIndex)
470
449
  }
471
450
  }
@@ -550,10 +529,10 @@ export default {
550
529
  return
551
530
  }
552
531
  const pageDom = document.createElement('div');
553
- pageDom.style.width = `${this.pageSize.width * (this.fileName ? CSS_UNITS : 1)}px`;
554
- pageDom.style.height = `${this.pageSize.height * (this.fileName ? CSS_UNITS : 1)}px`;
532
+ pageDom.style.width = `${this.pageSize.width}px`;
533
+ pageDom.style.height = `${this.pageSize.height}px`;
555
534
  pageDom.style.position = 'absolute';
556
- pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * (this.fileName ? CSS_UNITS : 1)) + this.PAGE_INTVERVAL
535
+ pageDom.style.top = `${((pageNo - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + this.PAGE_INTVERVAL
557
536
  }px`;
558
537
  pageDom.style.backgroundImage = `url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif')`
559
538
  pageDom.style.backgroundPosition = 'center'
@@ -628,9 +607,9 @@ export default {
628
607
  this.renderHighlights()
629
608
  })
630
609
  if (this.transformSalce !== null) {
631
- this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce * (this.fileName ? CSS_UNITS : 1)) + (this.identifyTextPostion.top * this.scale * this.transformSalce * (this.fileName ? CSS_UNITS : 1))}`
610
+ this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.transformSalce) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
632
611
  } else {
633
- this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL) * this.defaultTransform * (this.fileName ? CSS_UNITS : 1)) + (this.identifyTextPostion.top * this.scale * this.defaultTransform * (this.fileName ? CSS_UNITS : 1))}`
612
+ this.$refs.pdfView.scrollTop = `${((pdfResloute.page - 1) * (this.pageSize.height + this.PAGE_INTVERVAL)) + (this.identifyTextPostion.top * this.scale * this.transformSalce)}`
634
613
  }
635
614
  },
636
615
  scrollToExcalTop (currentPage) {
@@ -884,7 +863,6 @@ export default {
884
863
  if (value && value.length) {
885
864
  // 在 pdf_view 下创建 所有canvs的容器
886
865
  this.contentView = document.createElement('div')
887
- this.contentView.setAttribute('id','contentView')
888
866
  this.contentView.style.transformOrigin = '0px 0px 0px'
889
867
  this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
890
868
  // res.data = {"data":[{"id":"64591b7d8bb8ab1b91c65f24","knowledgeId":"64591a9c8da27649473f3b4b","mainId":"fb348d095c0b4fd7bbd37826563dac7d","page":3,"total":18,"pageHeight":540.0,"pageWidth":960.00946,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/11/55/18/64591b638bb8ab1b91c65eed/3.pdf","extractInfo":{"location":[280.488,161.32,398.71573,61.99298],"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距北京市区65公里,是以奇而著称,融山川、碧水、古长城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","lines":[{"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距","location":[280.488,161.32,398.71573,15.9869995]},{"content":"北京市区65公里,是以奇而著称,融山川、碧水、古长","location":[283.691,184.30899,392.3055,15.9869995]},{"content":"城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","location":[282.699,207.32599,394.3033,15.9869995]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
@@ -1075,16 +1053,11 @@ export default {
1075
1053
  xhr.onload = ({ currentTarget }) => {
1076
1054
  // 请求完成
1077
1055
  if (currentTarget.status === 200) { // 返回200
1078
- let pdf_view = document.getElementsByClassName('pdf_view');
1079
- if (pdf_view && pdf_view[0]){
1080
- pdf_view[0].style.backgroundImage = 'none'
1081
- }
1082
1056
  this.contentView.innerHTML = currentTarget.response
1083
1057
  this.contentView.style.padding = '10px'
1084
1058
  // this.contentView.style.position = 'relative'
1085
1059
  this.$refs.pdfView.style.backgroundColor = '#FFFFFF'
1086
1060
  this.$refs.pdfView.appendChild(this.contentView)
1087
-
1088
1061
  let allTr = Array.from(this.$refs.pdfView.getElementsByTagName('tr'))
1089
1062
  this.allTr = []
1090
1063
  for (let index = 0; index < allTr.length; index++) {
@@ -1127,14 +1100,10 @@ export default {
1127
1100
  width: 100%;
1128
1101
  height: calc(100% - 110px);
1129
1102
  overflow: auto;
1130
- //overflow-y: scroll;
1131
1103
  background-color: #f5f7fb;
1132
1104
  // margin-bottom: 60px;
1133
1105
  box-sizing: border-box;
1134
- background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
1135
- background-position: center;
1136
- background-size: 50px;
1137
- background-repeat: no-repeat;
1106
+
1138
1107
  // position: relative;
1139
1108
  // > div {
1140
1109
  // width: 100%;
@@ -1323,12 +1292,6 @@ export default {
1323
1292
  background: rgba(221, 222, 223, 1);
1324
1293
  }
1325
1294
  }
1326
- .pdf_container_view{
1327
- height: 100%;
1328
- width: 100%;
1329
- position: relative;
1330
- overflow: auto;
1331
- }
1332
1295
  }
1333
1296
  </style>
1334
1297
  <style lang="less">
@@ -1341,6 +1304,7 @@ export default {
1341
1304
  0% {
1342
1305
  background: rgba(255, 136, 0, 0.3);
1343
1306
  }
1307
+
1344
1308
  25% {
1345
1309
  background: rgba(255, 136, 0, 0.6);
1346
1310
  }
@@ -54,7 +54,7 @@
54
54
  </div>
55
55
  <div id="drawer_content_pre">
56
56
  <template v-if="tagIds && tagIds.length != 0 && drawer">
57
- <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :fileName="fileName" ref="pdfPosition"></pdfPosition>
57
+ <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord"></pdfPosition>
58
58
  </template>
59
59
  <template v-else>
60
60
  <div v-if="fileType == 'VIDEO'" style="width: 100%;">
@@ -97,7 +97,6 @@ export default {
97
97
  tagIds: [],
98
98
  // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
99
99
  loading:true,
100
- fileName:''
101
100
  }
102
101
  },
103
102
  mounted() {
@@ -127,20 +126,9 @@ export default {
127
126
  drawer(value) {
128
127
  if(value) {
129
128
  this.$nextTick(() =>{
130
- if (this.tagIds && this.tagIds.length != 0){
131
- zoomElement(document.getElementById('pdf_container_view'))
132
- }
129
+ zoomElement(document.getElementById('drawer_content_pre'))
133
130
  })
134
131
  }
135
- setTimeout(() => {
136
- let previewIframe = document.getElementsByClassName('preview_iframe')
137
- Array.from(previewIframe).forEach(item =>{
138
- item.onload = () =>{
139
- console.debug('previewIframe 106',previewIframe,this.drawer)
140
- item.style.backgroundImage = 'none'
141
- }
142
- })
143
- })
144
132
  }
145
133
  },
146
134
  computed:{
@@ -294,6 +282,10 @@ export default {
294
282
  overflow: auto;
295
283
  height: calc(100% - 50px);
296
284
  background: #FFF;
285
+ background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
286
+ background-position: center;
287
+ background-size: 50px;
288
+ background-repeat: no-repeat;
297
289
  }
298
290
  }
299
291
  @media screen and (min-width: 768px) {
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable */
2
2
  import {multipartUpload, ossFileUrl} from "./AliyunIssUtil";
3
3
  import { v4 as uuidv4 } from "uuid";
4
+ import { putObject } from "../../assets/js/obsBrowser";
4
5
  const ossConfig = {
5
6
  region: "oss-cn-zhangjiakou",
6
7
  //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
@@ -55,14 +56,16 @@ class MyUploadAdapter {
55
56
  let imgInfo = {
56
57
  url:'',
57
58
  }
58
- let res = multipartUpload(
59
- ossConfig,
60
- file,
61
- null,
62
- imgInfo
63
- );
59
+ // let res = multipartUpload(
60
+ // ossConfig,
61
+ // file,
62
+ // null,
63
+ // imgInfo
64
+ // );
65
+ let res = putObject(file);
64
66
  res.then(resp=>{
65
- imgInfo.url = ossFileUrl(ossConfig, resp.name)
67
+ // imgInfo.url = ossFileUrl(ossConfig, resp.name)
68
+ imgInfo.url = resp.url;
66
69
  let root = this.editor.model.document.getRoot()
67
70
  let children = root.getChildren()
68
71
  for(let child of children){
@@ -1,5 +1,6 @@
1
1
  import Command from "@ckeditor/ckeditor5-core/src/command";
2
2
  import { multipartUpload, ossFileUrl } from "../AliyunIssUtil";
3
+ import { putObject } from "../../../assets/js/obsBrowser";
3
4
  const ossConfig = {
4
5
  region: "oss-cn-zhangjiakou",
5
6
  //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
@@ -91,15 +92,16 @@ export default class ImageCommand extends Command {
91
92
  let imgInfo = {
92
93
  url: '',
93
94
  }
94
- let res = multipartUpload(
95
- ossConfig,
96
- file,
97
- null,
98
- imgInfo
99
- );
95
+ // let res = multipartUpload(
96
+ // ossConfig,
97
+ // file,
98
+ // null,
99
+ // imgInfo
100
+ // );
101
+ let res = putObject(file)
100
102
  console.log(res,'resprespresp');
101
103
  res.then(resp => {
102
- imgInfo.url = ossFileUrl(ossConfig, resp.name)
104
+ imgInfo.url = resp.url;
103
105
  console.log(resp,'resprespresp');
104
106
  console.log(imgInfo)
105
107
  resolve({
@@ -1,15 +1,6 @@
1
1
  import Command from "@ckeditor/ckeditor5-core/src/command";
2
- import { multipartUpload, ossFileUrl } from "../AliyunIssUtil";
3
2
  import { v4 as uuidv4 } from "uuid";
4
-
5
- const ossConfig = {
6
- region: "oss-cn-zhangjiakou",
7
- //云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用STS方式来进行API访问
8
- accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
9
- accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
10
- // stsToken: '<Your securityToken(STS)>',
11
- bucket: "guoranopen-zjk",
12
- }
3
+ import { putObject } from "../../../assets/js/obsBrowser";
13
4
 
14
5
  function findListener(askPluginListeners, type) {
15
6
  for (let i = 0, len = askPluginListeners.length; i < len; i++) {
@@ -164,14 +155,16 @@ export default class FileCommand extends Command {
164
155
  let imgInfo = {
165
156
  url: '',
166
157
  }
167
- let res = multipartUpload(
168
- ossConfig,
169
- file,
170
- null,
171
- imgInfo
172
- );
158
+ // let res = multipartUpload(
159
+ // ossConfig,
160
+ // file,
161
+ // null,
162
+ // imgInfo
163
+ // );
164
+ let res = putObject(file);
173
165
  res.then(resp => {
174
- imgInfo.url = ossFileUrl(ossConfig, resp.name)
166
+ // imgInfo.url = ossFileUrl(ossConfig, resp.name)
167
+ imgInfo.url = resp.url;
175
168
  resolve({
176
169
  name: resp.name,
177
170
  default: imgInfo.url