askbot-dragon 1.7.25-beta → 1.7.28-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.
Files changed (34) hide show
  1. package/package.json +14 -14
  2. package/public/index.html +10 -8
  3. package/src/assets/js/AliyunlssUtil.js +50 -51
  4. package/src/assets/js/hammer.js +2 -13
  5. package/src/assets/less/converSationContainer/common.less +0 -7
  6. package/src/components/ActionAlertIframe.vue +1 -24
  7. package/src/components/AiGuide.vue +154 -121
  8. package/src/components/AnswerDocknowledge.vue +8 -8
  9. package/src/components/ConversationContainer.vue +211 -15
  10. package/src/components/MyEditor.vue +2 -12
  11. package/src/components/actionSatisfaction.vue +3 -3
  12. package/src/components/answerRadio.vue +3 -3
  13. package/src/components/askVideo.vue +2 -25
  14. package/src/components/associationIntention.vue +7 -11
  15. package/src/components/formTemplate.vue +54 -68
  16. package/src/components/intelligentSummary.vue +15 -17
  17. package/src/components/markDownText.vue +50 -14
  18. package/src/components/message/TextMessage.vue +11 -15
  19. package/src/components/message/swiper/ticketSwiper.vue +1 -1
  20. package/src/components/pdfPosition.vue +99 -271
  21. package/src/components/popup.vue +2 -2
  22. package/src/components/previewDoc.vue +2 -6
  23. package/src/components/previewPdf.vue +136 -166
  24. package/src/components/senderMessagePlatform.vue +4 -4
  25. package/src/components/utils/AliyunIssUtil.js +33 -12
  26. package/src/components/utils/ckeditor.js +59 -48
  27. package/src/components/welcomeKnowledgeFile.vue +2 -6
  28. package/src/components/welcomeLlmCard.vue +1 -5
  29. package/src/components/welcomeSuggest.vue +1 -1
  30. package/src/locales/cn.json +24 -70
  31. package/src/locales/en.json +24 -71
  32. package/src/main.js +16 -18
  33. package/src/components/newPdfPosition.vue +0 -878
  34. package/src/locales/jp.json +0 -73
@@ -6,7 +6,7 @@
6
6
 
7
7
  <div class="previewDoc">
8
8
  <div class="footer">
9
- <span>{{$t('common.viewDetail')}}</span>
9
+ <span>查看详情</span>
10
10
  <section @click="close">
11
11
  <i class="iconfont guoran-shanchu"></i>
12
12
  </section>
@@ -42,7 +42,7 @@
42
42
  <iframe class="preview_iframe" :src="previewUrl" style="border:none;"></iframe>
43
43
  </div>
44
44
  <div class="onload_btn" @click="downLoad">
45
- {{$t('common.download')}}
45
+ 下载
46
46
  </div>
47
47
  <div id="text">
48
48
  {{ copy }}
@@ -70,10 +70,6 @@ export default {
70
70
  officePreviewType: {
71
71
  type: String,
72
72
  default: ''
73
- },
74
- language:{
75
- type:String,
76
- default:"cn"
77
73
  }
78
74
  },
79
75
  computed: {
@@ -5,34 +5,33 @@
5
5
  另外增加了在知识项目中预览当前文件的一些功能
6
6
  -->
7
7
  <template>
8
- <el-drawer :title="$t('common.drawerTitle')" :visible.sync="drawer" :with-header="false" :append-to-body="true" :destroy-on-close="true"
9
- :modal="formKnowledgeManagement ? true : false" :direction="previewShowPopup ? 'btt' : 'rtl'" :size="previewShowPopup ? '90%' : '65%'"
8
+ <el-drawer title="" :visible.sync="drawer" :with-header="false" :append-to-body="true" :destroy-on-close="true"
9
+ :modal="false" :direction="previewShowPopup ? 'btt' : 'rtl'" :size="previewShowPopup ? '90%' : '65%'"
10
10
  custom-class="pdf-preview-drawer" v-if="drawer">
11
- <!-- v-else-if="drawer" -->
12
11
  <div class="drawer-header" :class="isLiBang ? 'libang_head' : ''" v-if="!isPc">
13
12
  <div class="header-btn btn_position">
14
13
  <div class="onload_btn" v-if="isDownload" @click="downLoad">
15
- {{$t('common.download')}}
14
+ {{ $t('dragonCommon.download') }}
16
15
  </div>
17
16
  <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun" v-if="isHasChat">
18
17
  <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
19
- <span>{{$t('previewPdf.intelligentSummary')}}</span>
18
+ <span>{{ $t('dragonCommon.smartSummary') }}</span>
20
19
  </div>
21
20
  <template v-if="isHasChat">
22
21
  <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
23
22
  <i class="iconfont guoran-wendapingjia"></i>
24
- {{$t('previewPdf.chat')}}
23
+ {{ $t('dragonCommon.chat') }}
25
24
  </div>
26
25
  <div class="chat chat_active" @click="previewToDialog(false)" v-else>
27
26
  <i class="iconfont guoran-wendapingjia"></i>
28
- {{$t('previewPdf.chat')}}
27
+ {{ $t('dragonCommon.chat') }}
29
28
  </div>
30
29
  </template>
31
30
  </div>
32
31
  <div class="header_title">
33
32
  <div class="header_close">
34
33
  <span class="title_left">
35
- {{ title ? title : $t('common.viewDetail') }}
34
+ {{ title ? title : $t('dragonCommon.viewDetails') }}
36
35
  </span>
37
36
  <section @click="close">
38
37
  <i class="iconfont guoran-shanchu"></i>
@@ -49,25 +48,25 @@
49
48
  <div class="header_title">
50
49
  <div :class="isLiBang && folderName ? 'header_close' : 'header_top'">
51
50
  <span class="title_left">
52
- {{ title ? title : "查看详情" }}
51
+ {{ title ? title : $t('dragonCommon.viewDetails') }}
53
52
  </span>
54
53
  <div class="header-btn">
55
- <div class="onload_btn" v-if="isDownload || true" @click="downLoad">
56
- {{$t('common.download')}}
54
+ <div class="onload_btn" v-if="isDownload" @click="downLoad">
55
+ {{ $t('dragonCommon.download') }}
57
56
  </div>
58
57
  <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun"
59
- v-if="isHasChat || formKnowledgeManagement">
58
+ v-if="isHasChat">
60
59
  <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
61
- <span>{{$t('previewPdf.intelligentSummary')}}</span>
60
+ <span>{{ $t('dragonCommon.smartSummary') }}</span>
62
61
  </div>
63
62
  <template v-if="isHasChat">
64
63
  <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
65
64
  <i class="iconfont guoran-wendapingjia"></i>
66
- {{$t('previewPdf.chat')}}
65
+ {{ $t('dragonCommon.chat') }}
67
66
  </div>
68
67
  <div class="chat chat_active" @click="previewToDialog(false)" v-else>
69
68
  <i class="iconfont guoran-wendapingjia"></i>
70
- {{$t('previewPdf.chat')}}
69
+ {{ $t('dragonCommon.chat') }}
71
70
  </div>
72
71
  </template>
73
72
  <section @click="close">
@@ -83,12 +82,7 @@
83
82
  </div>
84
83
  </div>
85
84
  <div id="drawer_content_pre" :class="isLiBang && folderName ? 'libang_content_pre' : ''">
86
- <!-- :style="{marginTop:tagIds && tagIds.length != 0 && isPc ? '50px' : ''}" -->
87
- <intelligent-summary
88
- v-show="showSummary && (isHasChat || formKnowledgeManagement) && fileType !== 'VIDEO' && fileType !== 'IMAGE'"
89
- :tagIds="tagIds"
90
- :knowledgeId="knowledgeId"
91
- :formKnowledgeManagement="formKnowledgeManagement"
85
+ <intelligent-summary v-show="showSummary && isHasChat" :tagIds="tagIds" :knowledgeId="knowledgeId"
92
86
  @closeSummary="closeSummary" @recommendQues="recommendQues"
93
87
  @getSummarySuccess="getSummarySuccess"></intelligent-summary>
94
88
  <div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer">
@@ -96,11 +90,11 @@
96
90
  </pdfPosition>
97
91
  </div>
98
92
  <template v-else>
99
- <div v-if="fileType == 'VIDEO'" style="width: 100%;height: 100%">
93
+ <div v-if="fileType == 'VIDEO'" style="width: 100%;">
100
94
  <video :src="url" controls width="100%;" height="98%"></video>
101
95
  </div>
102
96
  <div v-else-if="fileType == 'HTML'" style="width: 100%;">
103
- <div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
97
+ <div class="preview_iframe_html" style="text-align:left" v-html="fileText"></div>
104
98
  </div>
105
99
  <template v-else-if="url.includes('https://www') || url.includes('http://www')">
106
100
  <iframe class="preview_iframe" :src="url" width="100%" height="100%" scrolling="100%" frameborder="no"
@@ -111,9 +105,6 @@
111
105
  :style="{ height: iframeHeight }"></iframe>
112
106
  </template>
113
107
  </template>
114
- <!-- <div class="mobile_onload_btn" v-if="isDownload && !isPc" @click="downLoad">
115
- 下载
116
- </div> -->
117
108
  </div>
118
109
  <div class="loading_img" v-show="loading">
119
110
  <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
@@ -133,59 +124,59 @@ import { Toast } from 'vant';
133
124
  export default {
134
125
  data () {
135
126
  return {
136
- previewShowPopup: false,
137
- fileText: '',
138
- fileType: "",
139
- isPc: false,
140
- drawer: false,
141
- tagIds: [],
142
- // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
143
- loading: true,
144
- fileName:'',
145
- previewKnowledgeId:"",
146
- showSummary:true,
147
- iframeHeight:"100%",
148
- isDownload: false,
149
- textWatermarkStr:"",
150
- copy:''}
127
+ previewShowPopup: false,
128
+ fileText: '',
129
+ fileType: "",
130
+ isPc: false,
131
+ drawer: false,
132
+ tagIds: [],
133
+ // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
134
+ loading: true,
135
+ previewKnowledgeId: "",
136
+ showSummary: true,
137
+ iframeHeight: "100%",
138
+ isDownload: false,
139
+ textWatermarkStr: "",
140
+ copy:''
141
+ }
142
+ },
143
+ mounted () {
144
+ window.addEventListener('message', this.handleIframeMessage, false);
145
+ this.isPcFun();
146
+ },
147
+ props: {
148
+ url: {
149
+ type: String,
150
+ required: true,
151
151
  },
152
- mounted() {
153
- window.addEventListener('message',this.handleIframeMessage,false);
154
- this.isPcFun();
152
+ officePreviewType: {
153
+ type: String,
154
+ default: ''
155
+ },
156
+ isMessageRecord: {
157
+ type: Boolean,
158
+ default: false,
159
+ },
160
+ sourceFileType: {
161
+ type: String,
162
+ default: '',
163
+ },
164
+ title: {
165
+ type: String,
166
+ default: ''
167
+ },
168
+ isHasChat: {
169
+ type: Boolean,
170
+ default: false
171
+ },
172
+ knowledgeId: {
173
+ type: String,
174
+ default: '',
175
+ },
176
+ previewOssPath: {
177
+ type: String,
178
+ default: '',
155
179
  },
156
- props:{
157
- url:{
158
- type: String,
159
- required: true,
160
- },
161
- officePreviewType:{
162
- type: String,
163
- default: ''
164
- },
165
- isMessageRecord:{
166
- type: Boolean,
167
- default:false,
168
- },
169
- sourceFileType:{
170
- type: String,
171
- default: '',
172
- },
173
- title: {
174
- type: String,
175
- default: ''
176
- },
177
- isHasChat:{
178
- type:Boolean,
179
- default:false
180
- },
181
- knowledgeId:{
182
- type: String,
183
- default: '',
184
- },
185
- previewOssPath:{
186
- type: String,
187
- default: '',
188
- },
189
180
  folderName: {
190
181
  type: String,
191
182
  default: '',
@@ -197,12 +188,7 @@ export default {
197
188
  isLiBang: {
198
189
  type: Boolean,
199
190
  default: false
200
- },
201
- formKnowledgeManagement:{
202
- type: Boolean,
203
- default: false
204
- }
205
- },
191
+ }},
206
192
  components: {
207
193
  IntelligentSummary,
208
194
  pdfPosition
@@ -212,71 +198,58 @@ export default {
212
198
  if (value) {
213
199
  this.$emit('open')
214
200
  this.$nextTick(() => {
215
- if (this.tagIds && this.tagIds.length != 0){
216
- zoomElement(document.getElementById('pdf_container_view'))
217
- }
218
- })
219
- } else {
220
- this.$emit('close')
221
- }
222
- setTimeout(() => {
223
- let previewIframe = document.getElementsByClassName('preview_iframe')
224
- Array.from(previewIframe).forEach(item =>{
225
- item.onload = () =>{
226
- console.debug('previewIframe 106',previewIframe,this.drawer)
227
- item.style.backgroundImage = 'none'
228
- }
229
- })
201
+ zoomElement(document.getElementById('drawer_content_pre'))
230
202
  })
231
- },
232
- showSummary:{
233
- handler(val){
234
- // if (!val){
235
- // this.$nextTick(() => {
236
- // let preCon = document.querySelector('.pdf_view');
237
- // if (preCon){
238
- // preCon.style.height = 'calc(100% - ' + 50 + 'px)'
239
- // }
240
- // })
241
- // } else {
242
- // this.getSummarySuccess();
243
- // }
244
- if(val) {
245
- this.getSummarySuccess();
246
- }
203
+ } else {
204
+ this.$emit('close')
205
+ }
206
+ },
207
+ showSummary: {
208
+ handler (val) {
209
+ // if (!val){
210
+ // this.$nextTick(() => {
211
+ // let preCon = document.querySelector('.pdf_view');
212
+ // if (preCon){
213
+ // preCon.style.height = 'calc(100% - ' + 50 + 'px)'
214
+ // }
215
+ // })
216
+ // } else {
217
+ // this.getSummarySuccess();
218
+ // }
219
+ if (val) {
220
+ this.getSummarySuccess();
247
221
  }
248
- },
249
- knowledgeId:{
250
- handler(val){
251
- if (val){
252
- this.getTextWatermark();
253
- }
222
+ }
223
+ },
224
+ knowledgeId: {
225
+ handler (val) {
226
+ if (val) {
227
+ this.getTextWatermark();
254
228
  }
255
229
  }
230
+ }
231
+ },
232
+ computed: {
233
+ pdfStyle () {
234
+ return {
235
+ paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
236
+ paddingBottom: this.tagIds > 1 ? '60px' : '0',
237
+ height: '100%'
238
+ }
256
239
  },
257
- computed:{
258
- pdfStyle() {
259
- return {
260
- paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
261
- paddingBottom: this.tagIds > 1 ? '60px' : '0',
262
- height: '100%'
263
- }
264
- },
265
- previewUrl() {
266
- console.debug('VUE_APP_ENV',process.env.VUE_APP_ENV)
267
- let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
268
- // if(this.url != '') {
269
- // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
270
- // url += btoa(encodeURIComponent(this.url))
271
- // } else {
272
- // url += btoa(this.url)
273
- // }
274
- // }
275
- url = url + this.url
276
- url += '&officePreviewType=pdf'
277
- if(this.watermark) {
278
- url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
279
- url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
240
+ previewUrl () {
241
+ console.debug('VUE_APP_ENV', process.env.VUE_APP_ENV)
242
+ let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
243
+ // if(this.url != '') {
244
+ // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
245
+ // url += btoa(encodeURIComponent(this.url))
246
+ // } else {
247
+ // url += btoa(this.url)
248
+ // }
249
+ // }
250
+ url = url + this.url
251
+ if (this.sourceFileType == '.ppt' || this.sourceFileType == '.pptx' || this.sourceFileType == '.pdf') {
252
+ url += '&officePreviewType=pdf'
280
253
  }
281
254
  console.log('textWatermarkStr 216', this.textWatermarkStr)
282
255
  if (this.textWatermarkStr) {
@@ -395,10 +368,6 @@ export default {
395
368
  })
396
369
  },
397
370
  downLoad () {
398
- if (this.formKnowledgeManagement){
399
- this.$emit('downLoad',this.previewOssPath);
400
- return
401
- }
402
371
  let url = this.previewOssPath
403
372
  if (decodeURIComponent(url) != url) {
404
373
  url = decodeURIComponent(url)
@@ -410,7 +379,7 @@ export default {
410
379
  }
411
380
  }).then(res => {
412
381
  console.log('downLoad 341', res)
413
- if (res.data|| res.bodyText) {
382
+ if (res.data || res.bodyText) {
414
383
  if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
415
384
  this.copy = res.data
416
385
  if (isMobile()) {
@@ -423,7 +392,7 @@ export default {
423
392
  selection.addRange(range);
424
393
  document.execCommand('copy');
425
394
  selection.removeAllRanges()
426
- Toast(this.$t('previewPdf.copyUrl'));
395
+ Toast(this.$t('dragonCommon.Safaridownload'));
427
396
  this.close()
428
397
  },100)
429
398
  } else {
@@ -439,17 +408,16 @@ export default {
439
408
  // }, 2000)
440
409
  // window.open(res.data,'下载', 'noopener')
441
410
  if (isMobile()) {
442
-
443
- const iframe = document.createElement("iframe");
444
- iframe.setAttribute("hidden", "hidden");
445
- iframe.onload = () => {
446
- if (iframe) {
447
- console.log("iframe onload....")
448
- iframe.setAttribute('src', 'about:blank');
449
- }
450
- };
451
- document.body.insertBefore(iframe, null);
452
- iframe.setAttribute("src", res.data );
411
+ const iframe = document.createElement("iframe");
412
+ iframe.setAttribute("hidden", "hidden");
413
+ iframe.onload = () => {
414
+ if (iframe) {
415
+ console.log("iframe onload....")
416
+ iframe.setAttribute('src', 'about:blank');
417
+ }
418
+ };
419
+ document.body.insertBefore(iframe, null);
420
+ iframe.setAttribute("src", res.data);
453
421
  } else {
454
422
  let a = document.createElement('a')
455
423
  a.href = res.data
@@ -457,7 +425,7 @@ export default {
457
425
  a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
458
426
  }
459
427
  this.close()
460
- }
428
+ }
461
429
  }
462
430
  })
463
431
  },
@@ -538,7 +506,6 @@ export default {
538
506
  height: 100%;
539
507
  }
540
508
 
541
-
542
509
  .preview_iframe_html {
543
510
  width: 100%;
544
511
  height: 100%;
@@ -634,7 +601,6 @@ justify-content: space-between;
634
601
  .header-right {
635
602
  display: flex;
636
603
  }
637
-
638
604
  .summaryBtn {
639
605
  flex: none;
640
606
  //width: 95px;
@@ -701,9 +667,9 @@ justify-content: space-between;
701
667
  justify-content: space-between;
702
668
  line-height: 26px;
703
669
  .title_left {
704
- white-space: nowrap; /* 确保文本不会换行 */
705
- overflow: hidden; /* 隐藏超出容器的文本 */
706
- text-overflow: ellipsis; /* 当文本超出容器时显示省略号 */
670
+ white-space: nowrap; /* 确保文本不会换行 */
671
+ overflow: hidden; /* 隐藏超出容器的文本 */
672
+ text-overflow: ellipsis; /* 当文本超出容器时显示省略号 */
707
673
  margin-right: 8px;
708
674
  }
709
675
  }
@@ -736,6 +702,10 @@ justify-content: space-between;
736
702
  overflow: auto;
737
703
  height: calc(100% - 50px);
738
704
  background: #FFF;
705
+ background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
706
+ background-position: center;
707
+ background-size: 50px;
708
+ background-repeat: no-repeat;
739
709
  }
740
710
 
741
711
  .libang_content_pre {
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <div class="">
3
3
  <span v-if="messagePlateform == 'IM'">
4
- {{$t('senderMessagePlatform.IM')}}&nbsp;&nbsp;<span class="text_color">{{payload.newSession.receiverDisplayInfo.name}}</span>&nbsp;&nbsp;{{$t('senderMessagePlatform.service')}}
4
+ IM人工&nbsp;&nbsp;<span class="text_color">{{payload.newSession.receiverDisplayInfo.name}}</span>&nbsp;&nbsp;将为您服务
5
5
  </span>
6
6
  <span v-if="messagePlateform == 'BOT'">
7
- <span class="text_color">{{payload.newSession.receiverDisplayInfo.name}}</span>&nbsp;&nbsp;{{$t('senderMessagePlatform.service')}}
7
+ <span class="text_color">{{payload.newSession.receiverDisplayInfo.name}}</span>&nbsp;&nbsp;将为您服务
8
8
  </span>
9
9
  <span v-if="messagePlateform == 'Transfer' && (isShow === true || isShow === null)">
10
- <span class="text_color">{{payload.oldSession.receiverDisplayInfo.name}}</span>&nbsp;&nbsp;{{$t('senderMessagePlatform.transfer')}}&nbsp;&nbsp;<span class="text_color">{{payload.newSession.receiverDisplayInfo.name}}</span>
10
+ <span class="text_color">{{payload.oldSession.receiverDisplayInfo.name}}</span>&nbsp;&nbsp;将会话转接给&nbsp;&nbsp;<span class="text_color">{{payload.newSession.receiverDisplayInfo.name}}</span>
11
11
  </span>
12
12
  </div>
13
13
  </template>
@@ -20,7 +20,7 @@ export default {
20
20
 
21
21
  }
22
22
  },
23
- props:['source','payload',"language", 'isShow'],
23
+ props:['source','payload', 'isShow'],
24
24
  computed: {
25
25
  messagePlateform() {
26
26
  if(this.payload) {
@@ -1,6 +1,26 @@
1
1
  // const OSS = require('ali-oss');
2
2
  const OSS = window.OSS
3
3
 
4
+ const getPrivateOssConfig = () => {
5
+ let mainSource = sessionStorage.getItem('_mainSource') ? sessionStorage.getItem('_mainSource') : "askbot";
6
+ switch (mainSource) {
7
+ case "askbot":
8
+ return {
9
+ region: "oss-cn-zhangjiakou",
10
+ accessKeyId: "LTAI4G3QtdEdwkEbihBngAsK",
11
+ accessKeySecret: "OwgdVfc5PeCkIgqIdug660xmiSPchn",
12
+ bucket: "guoranopen-zjk",
13
+ }
14
+ case "lishi":
15
+ return {
16
+ region: "oss-ap-southeast-1",
17
+ accessKeyId: "LTAI5tAusPLDNJJwkvUbqi2T",
18
+ accessKeySecret: "xqPVaunOIbvTe3g9qsXal2IZO6RftK",
19
+ bucket: "askbotopen-ls",
20
+ };
21
+ }
22
+ }
23
+
4
24
  let IDX = 256, HEX = [], SIZE = 256, BUFFER;
5
25
  while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
6
26
  let mainId = sessionStorage.getItem('_mainId') ? sessionStorage.getItem('_mainId') : "";
@@ -36,12 +56,12 @@ function pathGenerate(filename) {
36
56
  }
37
57
 
38
58
 
39
- function upload(ossConfig, data) {
40
- let ossClient = new OSS(ossConfig);
59
+ function upload(data) {
60
+ let ossClient = new OSS(getPrivateOssConfig());
41
61
  // object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形式,实现将文件上传至当前Bucket或Bucket下的指定目录。
42
62
  let objectKey = pathGenerate(data.name);
43
- let result = ossClient.put(objectKey, data, {
44
- headers:{
63
+ let result = ossClient.put(objectKey, data, {
64
+ headers: {
45
65
  // 通过文件URL访问文件时,指定以附件形式下载文件,下载后的文件名称定义为example.jpg。
46
66
  'Content-Disposition': `attachment; filename="${encodeURIComponent(data.name)}"`
47
67
  },
@@ -50,13 +70,13 @@ function pathGenerate(filename) {
50
70
  return result;
51
71
  }
52
72
 
53
- function multipartUpload(ossConfig, data, callback,extCallback) {
54
- let ossClient = new OSS(ossConfig);
73
+ function multipartUpload(data, callback, extCallback) {
74
+ let ossClient = new OSS(getPrivateOssConfig());
55
75
  // object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形式,实现将文件上传至当前Bucket或Bucket下的指定目录。
56
76
  let objectKey = pathGenerate(data.name);
57
77
 
58
- let res = ossClient.multipartUpload(objectKey, data, {
59
- headers:{
78
+ let res = ossClient.multipartUpload(objectKey, data, {
79
+ headers: {
60
80
  // 通过文件URL访问文件时,指定以附件形式下载文件,下载后的文件名称定义为example.jpg。
61
81
  'Content-Disposition': `attachment; filename="${encodeURIComponent(data.name)}"`
62
82
  },
@@ -64,14 +84,15 @@ function pathGenerate(filename) {
64
84
  console.debug('progress callback', p, checkpoint);
65
85
  // 断点记录点。浏览器重启后无法直接继续上传,您需要手动触发上传操作。
66
86
  if (callback && callback instanceof Function) {
67
- callback(p, checkpoint,data,extCallback);
87
+ callback(p, checkpoint, data, extCallback);
68
88
  }
69
89
  }
70
90
  })
71
- return res;
91
+ return res;
72
92
  }
73
93
 
74
- function ossFileUrl(ossConfig, path, cname) {
94
+ function ossFileUrl(path, cname) {
95
+ let ossConfig = getPrivateOssConfig();
75
96
  if (cname == null) {
76
97
  return 'https://' + ossConfig.bucket + '.' + ossConfig.region + '.aliyuncs.com/' + path;
77
98
  } else {
@@ -79,4 +100,4 @@ function ossFileUrl(ossConfig, path, cname) {
79
100
  }
80
101
  }
81
102
 
82
- export {upload, multipartUpload, ossFileUrl}
103
+ export { upload, multipartUpload, ossFileUrl }