askbot-dragon 1.7.61-beta → 1.7.63-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 (36) hide show
  1. package/package.json +5 -4
  2. package/public/index.html +8 -10
  3. package/src/assets/js/AliyunlssUtil.js +49 -25
  4. package/src/assets/js/hammer.js +13 -2
  5. package/src/assets/less/converSationContainer/common.less +7 -0
  6. package/src/components/ActionAlertIframe.vue +24 -1
  7. package/src/components/AiGuide.vue +114 -151
  8. package/src/components/AnswerDocknowledge.vue +23 -14
  9. package/src/components/ConversationContainer.vue +104 -213
  10. package/src/components/MyEditor.vue +2 -1
  11. package/src/components/actionSatisfaction.vue +1 -1
  12. package/src/components/answerRadio.vue +50 -4
  13. package/src/components/askVideo.vue +23 -0
  14. package/src/components/associationIntention.vue +11 -7
  15. package/src/components/formTemplate.vue +54 -50
  16. package/src/components/intelligentSummary.vue +5 -1
  17. package/src/components/markDownText.vue +21 -21
  18. package/src/components/message/TextMessage.vue +5 -1
  19. package/src/components/message/swiper/ticketSwiper.vue +1 -1
  20. package/src/components/newPdfPosition.vue +878 -0
  21. package/src/components/pagination.vue +129 -0
  22. package/src/components/pdfPosition.vue +213 -33
  23. package/src/components/preview/docView.vue +114 -0
  24. package/src/components/preview/excelView.vue +191 -0
  25. package/src/components/preview/newPositionPreview.vue +370 -0
  26. package/src/components/preview/pdfView.vue +824 -0
  27. package/src/components/previewDoc.vue +4 -0
  28. package/src/components/previewPdf.vue +626 -314
  29. package/src/components/senderMessagePlatform.vue +1 -1
  30. package/src/components/utils/ckeditor.js +1 -1
  31. package/src/components/welcomeKnowledgeFile.vue +5 -1
  32. package/src/components/welcomeLlmCard.vue +5 -1
  33. package/src/locales/cn.json +60 -60
  34. package/src/locales/en.json +60 -60
  35. package/src/locales/jp.json +73 -0
  36. package/src/main.js +1 -1
@@ -8,31 +8,41 @@
8
8
  <el-drawer title="" :visible.sync="drawer" :with-header="false" :append-to-body="true" :destroy-on-close="true"
9
9
  :modal="false" :direction="previewShowPopup ? 'btt' : 'rtl'" :size="previewShowPopup ? '90%' : '65%'"
10
10
  custom-class="pdf-preview-drawer" v-if="drawer">
11
- <div class="drawer-header" :class="isLiBang ? 'libang_head' : ''" v-if="!isPc">
12
- <div class="header-btn btn_position">
13
- <div class="onload_btn" v-if="isDownload" @click="downLoad">
14
- {{ $t('dragonCommon.download') }}
15
- </div>
16
- <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun" v-if="isHasChat">
17
- <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
18
- <span>{{ $t('dragonCommon.smartSummary') }}</span>
19
- </div>
20
- <template v-if="isHasChat">
21
- <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
22
- <i class="iconfont guoran-wendapingjia"></i>
23
- {{ $t('dragonCommon.chat') }}
24
- </div>
25
- <div class="chat chat_active" @click="previewToDialog(false)" v-else>
26
- <i class="iconfont guoran-wendapingjia"></i>
27
- {{ $t('dragonCommon.chat') }}
28
- </div>
29
- </template>
30
- </div>
11
+ <div class="drawer-header" :class="(isDownload || isHasChat) && isLiBang ? 'has_btn_libang_head' : (isLiBang ? 'libang_head' : (isDownload || isHasChat ? 'has_btn_head' : ''))" v-if="!isPc">
31
12
  <div class="header_title">
32
- <div class="header_close">
13
+ <template v-if="isDownload || isHasChat">
14
+ <div class="top-header">
15
+ <div class="header-btn">
16
+ <div class="onload_btn" v-if="isDownload" @click="downLoad">
17
+ {{ $t('dragonCommon.download') }}
18
+ </div>
19
+ <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun" v-if="isHasChat">
20
+ <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
21
+ <span>{{ $t('dragonCommon.smartSummary') }}</span>
22
+ </div>
23
+ <template v-if="isHasChat">
24
+ <div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
25
+ <i class="iconfont guoran-wendapingjia"></i>
26
+ {{ $t('dragonCommon.chat') }}
27
+ </div>
28
+ <div class="chat chat_active" @click="previewToDialog(false)" v-else>
29
+ <i class="iconfont guoran-wendapingjia"></i>
30
+ {{ $t('dragonCommon.chat') }}
31
+ </div>
32
+ </template>
33
+ </div>
34
+ <section @click="close">
35
+ <i class="iconfont guoran-shanchu"></i>
36
+ </section>
37
+ </div>
33
38
  <span class="title_left">
34
39
  {{ title ? title : $t('dragonCommon.viewDetails') }}
35
40
  </span>
41
+ </template>
42
+ <div class="header_close" v-else>
43
+ <span class="title_left">
44
+ {{ title ? title : '查看详情' }}
45
+ </span>
36
46
  <section @click="close">
37
47
  <i class="iconfont guoran-shanchu"></i>
38
48
  </section>
@@ -55,7 +65,7 @@
55
65
  {{ $t('dragonCommon.download') }}
56
66
  </div>
57
67
  <div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun"
58
- v-if="isHasChat">
68
+ v-if="isHasChat || formKnowledgeManagement">
59
69
  <i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
60
70
  <span>{{ $t('dragonCommon.smartSummary') }}</span>
61
71
  </div>
@@ -81,16 +91,23 @@
81
91
  </p>
82
92
  </div>
83
93
  </div>
84
- <div id="drawer_content_pre" :class="isLiBang && folderName ? 'libang_content_pre' : ''">
94
+ <div id="drawer_content_pre" :class="(isDownload || isHasChat) && !isPc && isLiBang && folderName ? 'has_btn_libang_content_pre' : (isLiBang && folderName ? 'libang_content_pre' : '')">
85
95
  <intelligent-summary v-show="showSummary && isHasChat" :tagIds="tagIds" :knowledgeId="knowledgeId"
86
96
  @closeSummary="closeSummary" @recommendQues="recommendQues"
87
97
  @getSummarySuccess="getSummarySuccess"></intelligent-summary>
88
- <div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer">
98
+ <div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer && newVersion === false && newFileType !== 'PPT'">
89
99
  <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :textWatermarkStr="textWatermarkStr">
90
100
  </pdfPosition>
91
101
  </div>
102
+ <new-position-preview
103
+ ref="newPositionPreview"
104
+ v-else-if="tagIds && tagIds.length!= 0 && newVersion && newFileType !== 'PPT'"
105
+ :knowledgeId="knowledgeId"
106
+ :tagIds="tagIds"
107
+ :url="previewHref"
108
+ ></new-position-preview>
92
109
  <template v-else>
93
- <div v-if="fileType == 'VIDEO'" style="width: 100%;">
110
+ <div v-if="fileType == 'VIDEO'" style="width: 100%;height: 100%">
94
111
  <video :src="url" controls width="100%;" height="98%"></video>
95
112
  </div>
96
113
  <div v-else-if="fileType == 'HTML'" style="width: 100%;">
@@ -103,6 +120,18 @@
103
120
  <template v-else>
104
121
  <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;"
105
122
  :style="{ height: iframeHeight }"></iframe>
123
+ <template v-if="!loading && (newFileType === 'PPT' && pageChunkData.length > 1)">
124
+ <div class="btn_footer" v-if="!isPc">
125
+ <div class="prev" @click="prev">上一段</div>
126
+ <div class="next" @click="next">下一段</div>
127
+ </div>
128
+ <div id="pagination" v-if="isPc">
129
+ <el-pagination :current-page="currentPage + 1" @current-change="currentChange" @prev-click="prev"
130
+ @next-click="next" layout="slot, prev, pager, next" :page-size="1" :total="pageChunkData.length">
131
+ <span class="total-class">答案由{{ pageChunkData.length }}段内容生成</span>
132
+ </el-pagination>
133
+ </div>
134
+ </template>
106
135
  </template>
107
136
  </template>
108
137
  </div>
@@ -121,8 +150,9 @@ import { zoomElement } from '../assets/js/hammer'
121
150
  import IntelligentSummary from "./intelligentSummary";
122
151
  import { isMobile } from "../assets/js/common";
123
152
  import { Toast } from 'vant';
153
+ import NewPositionPreview from "./preview/newPositionPreview";
124
154
  export default {
125
- data () {
155
+ data() {
126
156
  return {
127
157
  previewShowPopup: false,
128
158
  fileText: '',
@@ -132,317 +162,461 @@ export default {
132
162
  tagIds: [],
133
163
  // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
134
164
  loading: true,
165
+ fileName: '',
135
166
  previewKnowledgeId: "",
136
- showSummary: true,
167
+ showSummary: false,
137
168
  iframeHeight: "100%",
138
169
  isDownload: false,
139
170
  textWatermarkStr: "",
140
- copy:''
171
+ copy: '',
172
+ newVersion: '',
173
+ previewHref: "",
174
+ newFileType: "",
175
+ numberPage: 0,
176
+ pageChunkData: [],
177
+ currentPage: 0
141
178
  }
142
179
  },
143
- mounted () {
144
- this.$i18n.locale = sessionStorage.getItem("systemLanguage") || 'cn';
145
- window.addEventListener('message', this.handleIframeMessage, false);
146
- this.isPcFun();
147
- },
148
- props: {
149
- url: {
150
- type: String,
151
- required: true,
152
- },
153
- officePreviewType: {
154
- type: String,
155
- default: ''
156
- },
157
- isMessageRecord: {
158
- type: Boolean,
159
- default: false,
180
+ mounted() {
181
+ this.$i18n.locale = sessionStorage.getItem("systemLanguage") || 'cn';
182
+ window.addEventListener('message', this.handleIframeMessage, false);
183
+ this.isPcFun();
160
184
  },
161
- sourceFileType: {
162
- type: String,
163
- default: '',
164
- },
165
- title: {
166
- type: String,
167
- default: ''
168
- },
169
- isHasChat: {
170
- type: Boolean,
171
- default: false
172
- },
173
- knowledgeId: {
174
- type: String,
175
- default: '',
176
- },
177
- previewOssPath: {
178
- type: String,
179
- default: '',
180
- },
181
- folderName: {
182
- type: String,
183
- default: '',
185
+ props: {
186
+ url: {
187
+ type: String,
188
+ required: true,
189
+ },
190
+ officePreviewType: {
191
+ type: String,
192
+ default: ''
193
+ },
194
+ isMessageRecord: {
195
+ type: Boolean,
196
+ default: false,
197
+ },
198
+ sourceFileType: {
199
+ type: String,
200
+ default: '',
201
+ },
202
+ title: {
203
+ type: String,
204
+ default: ''
205
+ },
206
+ isHasChat: {
207
+ type: Boolean,
208
+ default: false
209
+ },
210
+ knowledgeId: {
211
+ type: String,
212
+ default: '',
213
+ },
214
+ previewOssPath: {
215
+ type: String,
216
+ default: '',
217
+ },
218
+ folderName: {
219
+ type: String,
220
+ default: '',
221
+ },
222
+ folderUrl: {
223
+ type: String,
224
+ default: '',
225
+ },
226
+ isLiBang: {
227
+ type: Boolean,
228
+ default: false
229
+ },
230
+ formKnowledgeManagement: {
231
+ type: Boolean,
232
+ default: false
233
+ }
184
234
  },
185
- folderUrl: {
186
- type: String,
187
- default: '',
235
+ components: {
236
+ NewPositionPreview,
237
+ IntelligentSummary,
238
+ pdfPosition
188
239
  },
189
- isLiBang: {
190
- type: Boolean,
191
- default: false
192
- }},
193
- components: {
194
- IntelligentSummary,
195
- pdfPosition
196
- },
197
- watch: {
198
- drawer (value) {
199
- if (value) {
200
- this.$emit('open')
201
- this.$nextTick(() => {
202
- zoomElement(document.getElementById('drawer_content_pre'))
240
+ watch: {
241
+ drawer(value) {
242
+ if (value) {
243
+ this.$emit('open')
244
+ this.$nextTick(() => {
245
+ if (this.tagIds && this.tagIds.length != 0) {
246
+ zoomElement(document.getElementById('pdf_container_view'))
247
+ }
248
+ })
249
+ } else {
250
+ this.$emit('close')
251
+ }
252
+ setTimeout(() => {
253
+ let previewIframe = document.getElementsByClassName('preview_iframe')
254
+ Array.from(previewIframe).forEach(item => {
255
+ item.onload = () => {
256
+ console.debug('previewIframe 106', previewIframe, this.drawer)
257
+ item.style.backgroundImage = 'none'
258
+ }
259
+ })
203
260
  })
204
- } else {
205
- this.$emit('close')
261
+ },
262
+ showSummary: {
263
+ handler(val) {
264
+ // if (!val){
265
+ // this.$nextTick(() => {
266
+ // let preCon = document.querySelector('.pdf_view');
267
+ // if (preCon){
268
+ // preCon.style.height = 'calc(100% - ' + 50 + 'px)'
269
+ // }
270
+ // })
271
+ // } else {
272
+ // this.getSummarySuccess();
273
+ // }
274
+ if (val) {
275
+ this.getSummarySuccess();
276
+ }
277
+ }
278
+ },
279
+ knowledgeId: {
280
+ handler(val) {
281
+ if (val) {
282
+ this.getTextWatermark();
283
+ }
284
+ }
206
285
  }
207
286
  },
208
- showSummary: {
209
- handler (val) {
210
- // if (!val){
211
- // this.$nextTick(() => {
212
- // let preCon = document.querySelector('.pdf_view');
213
- // if (preCon){
214
- // preCon.style.height = 'calc(100% - ' + 50 + 'px)'
287
+ computed: {
288
+ pdfStyle() {
289
+ return {
290
+ paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
291
+ paddingBottom: this.tagIds > 1 ? '60px' : '0',
292
+ height: '100%'
293
+ }
294
+ },
295
+ previewUrl() {
296
+ console.debug('VUE_APP_ENV', process.env.VUE_APP_ENV)
297
+ let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
298
+ // if(this.url != '') {
299
+ // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
300
+ // url += btoa(encodeURIComponent(this.url))
301
+ // } else {
302
+ // url += btoa(this.url)
215
303
  // }
216
- // })
217
- // } else {
218
- // this.getSummarySuccess();
219
304
  // }
220
- if (val) {
221
- this.getSummarySuccess();
305
+ url = url + this.url
306
+ url += '&officePreviewType=pdf'
307
+ if (this.watermark) {
308
+ url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
309
+ url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
222
310
  }
223
- }
224
- },
225
- knowledgeId: {
226
- handler (val) {
227
- if (val) {
228
- this.getTextWatermark();
311
+ console.log('textWatermarkStr 216', this.textWatermarkStr)
312
+ if (this.textWatermarkStr) {
313
+ url += '&textWatermarkValue=' + this.textWatermarkStr
229
314
  }
230
- }
231
- }
232
- },
233
- computed: {
234
- pdfStyle () {
235
- return {
236
- paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
237
- paddingBottom: this.tagIds > 1 ? '60px' : '0',
238
- height: '100%'
239
- }
240
- },
241
- previewUrl () {
242
- console.debug('VUE_APP_ENV', process.env.VUE_APP_ENV)
243
- let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
244
- // if(this.url != '') {
245
- // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
246
- // url += btoa(encodeURIComponent(this.url))
315
+ return url
316
+ },
317
+ // fileType() {
318
+ // const fileType = this.url.substring(this.url.lastIndexOf('.'));
319
+ // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
320
+ // return 'VIDEO'
247
321
  // } else {
248
- // url += btoa(this.url)
322
+ // return 'OTHER'
249
323
  // }
324
+
250
325
  // }
251
- url = url + this.url
252
- if (this.sourceFileType == '.ppt' || this.sourceFileType == '.pptx' || this.sourceFileType == '.pdf') {
253
- url += '&officePreviewType=pdf'
254
- }
255
- console.log('textWatermarkStr 216', this.textWatermarkStr)
256
- if (this.textWatermarkStr) {
257
- url += '&textWatermarkValue=' + this.textWatermarkStr
258
- }
259
- return url
260
- },
261
- // fileType() {
262
- // const fileType = this.url.substring(this.url.lastIndexOf('.'));
263
- // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
264
- // return 'VIDEO'
265
- // } else {
266
- // return 'OTHER'
267
- // }
268
-
269
- // }
270
- },
271
- methods: {
272
- close () {
273
- setTimeout(() => {
274
- this.previewShowPopup = false;
275
- this.fileType = ''
276
- }, 300)
277
- this.drawer = false;
278
- this.showSummary = false;
279
326
  },
280
- loadIframe () {
281
-
282
- if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0)) {
283
- this.loading = false
284
- } else {
285
- let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
286
- if (iframe) {
287
- iframe.onload = () => {
288
- this.loading = false;
289
- document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
327
+ methods: {
328
+ close() {
329
+ setTimeout(() => {
330
+ this.previewShowPopup = false;
331
+ this.fileType = ''
332
+ }, 300)
333
+ this.drawer = false;
334
+ this.showSummary = false;
335
+ },
336
+ loadIframe() {
337
+
338
+ if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0 && this.newFileType !== 'PPT')) {
339
+ this.loading = false
340
+ } else {
341
+ let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
342
+ if (iframe) {
343
+ iframe.onload = () => {
344
+ this.loading = false;
345
+ document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
346
+ }
290
347
  }
348
+ // let time = setInterval(() =>{
349
+ //
350
+ // if(iframe) {
351
+ // this.loading = false
352
+ // clearInterval(time)
353
+ // }
354
+ // }, 500)
291
355
  }
292
- // let time = setInterval(() =>{
293
- //
294
- // if(iframe) {
295
- // this.loading = false
296
- // clearInterval(time)
297
- // }
298
- // }, 500)
299
- }
300
- },
301
- getBolb () {
302
- this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
303
- fileInOssPath: this.url,
304
- templateId: ''
305
- }).then(res => {
306
- if (res.data.code == 0) {
307
- this.fileText = res.data.data
308
- this.loading = false
356
+ },
357
+ getBolb() {
358
+ this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
359
+ fileInOssPath: this.url,
360
+ templateId: ''
361
+ }).then(res => {
362
+ if (res.data.code == 0) {
363
+ this.fileText = res.data.data
364
+ this.loading = false
365
+ }
366
+ })
367
+ },
368
+ previewToDialog(flag) {
369
+ this.$emit('previewToDialog', flag)
370
+ },
371
+ closeSummary() {
372
+ this.showSummary = false;
373
+ },
374
+ recommendQues(item, knowledgeId) {
375
+ console.log('recommendQues', item, knowledgeId);
376
+ this.$emit('recommendQues', item, knowledgeId)
377
+ },
378
+ handleIframeMessage(res) {
379
+ if (res.data.type == 'getViewerHeight') {
380
+ let iframeHeight = this.iframeHeight.replace('px', '')
381
+ if (res.data.data && iframeHeight != (res.data.data + 50)) {
382
+ this.iframeHeight = res.data.data + 50 + 'px'
383
+ }
309
384
  }
310
- })
311
- },
312
- previewToDialog (flag) {
313
- this.$emit('previewToDialog', flag)
314
- },
315
- closeSummary () {
316
- this.showSummary = false;
317
- },
318
- recommendQues (item, knowledgeId) {
319
- console.log('recommendQues', item, knowledgeId);
320
- this.$emit('recommendQues', item, knowledgeId)
321
- },
322
- handleIframeMessage (res) {
323
- console.log('handleIframeMessage', res)
324
- if (res.data.type == 'getViewerHeight') {
325
- let iframeHeight = this.iframeHeight.replace('px', '')
326
- if (res.data.data && iframeHeight != (res.data.data + 50)) {
327
- this.iframeHeight = res.data.data + 50 + 'px'
385
+ if (res.data.type == 'getViewPage' && res.data.data) {
386
+ this.numberPage = Number(res.data.data);
387
+ if (this.pageChunkData.length > 0) {
388
+ this.scrollPPTPage(this.pageChunkData[0])
389
+ }
328
390
  }
329
- }
330
- },
331
- summaryFun () {
332
- this.showSummary = !this.showSummary;
333
- if (this.showSummary) {
334
- document.getElementById('drawer_content_pre').scrollTop = 0;
335
- }
336
- },
337
- getSummarySuccess () {
338
- this.$nextTick(() => {
339
- // if (this.tagIds.length > 0){
340
- // let intelligentSummary = document.getElementById('intelligentSummary');
341
- // let preCon = document.querySelector('.pdf_view')
342
- // if (intelligentSummary){
343
- // let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
344
- // if (preCon){
345
- // preCon.style.height = 'calc(100% - ' + height + 'px)'
346
- // }
347
- // console.log('height',height,preCon)
348
- // }
349
- // }
350
- // let intelligentSummary = document.getElementById('intelligentSummary');
351
- // let height = intelligentSummary.offsetHeight
352
- // this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
353
- })
354
- },
355
- getTextWatermark () {
356
- let url = '/knowledge-api/open/knowledge/getPermissionInfo';
357
- let obj = {
358
- "knowledgeId": this.knowledgeId,
359
- "userId": sessionStorage.getItem('_currentUserId'),
360
- "mainId": sessionStorage.getItem('_mainId'),
361
- "corpId": sessionStorage.getItem('_corpid')
362
- }
363
- this.$http.post(url, obj).then(res => {
364
- console.log('getTextWatermark', res.data.data)
365
- if (res.data.data) {
366
- this.textWatermarkStr = res.data.data.textWatermarkStr;
367
- this.isDownload = res.data.data.showDownloadBtn;
391
+ if (res.data.type == 'getViewerHeight' || res.data.type == 'getViewPage') {
392
+ if (this.pageChunkData.length > 0) {
393
+ this.scrollPPTPage(this.pageChunkData[0])
394
+ }
368
395
  }
369
- })
370
- },
371
- downLoad () {
372
- let url = this.previewOssPath
373
- if (decodeURIComponent(url) != url) {
374
- url = decodeURIComponent(url)
375
- }
376
- const fileType = url.substring(url.lastIndexOf('.'));
377
- this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
378
- headers: {
379
- "Content-Type": "application/json",
396
+ },
397
+ summaryFun() {
398
+ this.showSummary = !this.showSummary;
399
+ if (this.showSummary) {
400
+ document.getElementById('drawer_content_pre').scrollTop = 0;
401
+ }
402
+ },
403
+ getSummarySuccess() {
404
+ this.$nextTick(() => {
405
+ // if (this.tagIds.length > 0){
406
+ // let intelligentSummary = document.getElementById('intelligentSummary');
407
+ // let preCon = document.querySelector('.pdf_view')
408
+ // if (intelligentSummary){
409
+ // let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
410
+ // if (preCon){
411
+ // preCon.style.height = 'calc(100% - ' + height + 'px)'
412
+ // }
413
+ // console.log('height',height,preCon)
414
+ // }
415
+ // }
416
+ // let intelligentSummary = document.getElementById('intelligentSummary');
417
+ // let height = intelligentSummary.offsetHeight
418
+ // this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
419
+ })
420
+ },
421
+ getTextWatermark() {
422
+ let url = '/knowledge-api/open/knowledge/getPermissionInfo';
423
+ let obj = {
424
+ "knowledgeId": this.knowledgeId,
425
+ "userId": sessionStorage.getItem('_currentUserId'),
426
+ "mainId": sessionStorage.getItem('_mainId'),
427
+ "corpId": sessionStorage.getItem('_corpid')
428
+ }
429
+ this.$http.post(url, obj).then(res => {
430
+ console.log('getTextWatermark', res.data.data)
431
+ if (res.data.data) {
432
+ this.textWatermarkStr = res.data.data.textWatermarkStr;
433
+ this.isDownload = res.data.data.showDownloadBtn;
434
+ }
435
+ })
436
+ },
437
+ downLoad() {
438
+ if (this.formKnowledgeManagement) {
439
+ this.$emit('downLoad', this.previewOssPath);
440
+ return
441
+ }
442
+ let url = this.previewOssPath
443
+ if (decodeURIComponent(url) != url) {
444
+ url = decodeURIComponent(url)
380
445
  }
381
- }).then(res => {
382
- console.log('downLoad 341', res)
383
- if (res.data || res.bodyText) {
384
- if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
385
- this.copy = res.data
386
- if (isMobile()) {
387
- setTimeout(() =>{
388
- const range = document.createRange();
389
- range.selectNode(document.getElementById('text'));
390
- const selection = window.getSelection();
391
- //移除之前选中内容
392
- if (selection.rangeCount > 0) selection.removeAllRanges();
393
- selection.addRange(range);
394
- document.execCommand('copy');
395
- selection.removeAllRanges()
396
- Toast(this.$t('dragonCommon.Safaridownload'));
397
- this.close()
398
- },100)
446
+ const fileType = url.substring(url.lastIndexOf('.'));
447
+ this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
448
+ headers: {
449
+ "Content-Type": "application/json",
450
+ }
451
+ }).then(res => {
452
+ console.log('downLoad 341', res)
453
+ if (res.data || res.bodyText) {
454
+ if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
455
+ this.copy = res.data
456
+ if (isMobile()) {
457
+ setTimeout(() => {
458
+ const range = document.createRange();
459
+ range.selectNode(document.getElementById('text'));
460
+ const selection = window.getSelection();
461
+ //移除之前选中内容
462
+ if (selection.rangeCount > 0) selection.removeAllRanges();
463
+ selection.addRange(range);
464
+ document.execCommand('copy');
465
+ selection.removeAllRanges()
466
+ Toast(this.$t('dragonCommon.Safaridownload'));
467
+ this.close()
468
+ }, 100)
469
+ } else {
470
+ let a = document.createElement('a')
471
+ a.href = res.data
472
+ a.download = (this.title) + fileType
473
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
474
+ }
475
+ return
399
476
  } else {
400
- let a = document.createElement('a')
401
- a.href = res.data
402
- a.download = (this.title) + fileType
403
- a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
477
+ // setTimeout(() =>{
478
+ // window.open(res.data,'下载', 'noopener')
479
+ // }, 2000)
480
+ // window.open(res.data,'下载', 'noopener')
481
+ if (isMobile()) {
482
+
483
+ const iframe = document.createElement("iframe");
484
+ iframe.setAttribute("hidden", "hidden");
485
+ iframe.onload = () => {
486
+ if (iframe) {
487
+ console.log("iframe onload....")
488
+ iframe.setAttribute('src', 'about:blank');
489
+ }
490
+ };
491
+ document.body.insertBefore(iframe, null);
492
+ iframe.setAttribute("src", res.data);
493
+ } else {
494
+ let a = document.createElement('a')
495
+ a.href = res.data
496
+ a.download = (this.title) + fileType
497
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
498
+ }
499
+ this.close()
404
500
  }
405
- return
406
- } else {
407
- // setTimeout(() =>{
408
- // window.open(res.data,'下载', 'noopener')
409
- // }, 2000)
410
- // window.open(res.data,'下载', 'noopener')
411
- if (isMobile()) {
412
- const iframe = document.createElement("iframe");
413
- iframe.setAttribute("hidden", "hidden");
414
- iframe.onload = () => {
415
- if (iframe) {
416
- console.log("iframe onload....")
417
- iframe.setAttribute('src', 'about:blank');
501
+ }
502
+ })
503
+ },
504
+ isPcFun() {
505
+ if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
506
+ this.isPc = false
507
+ } else {
508
+ this.isPc = true
509
+ }
510
+ },
511
+ clickFloder() {
512
+ this.$emit('previewClickFloder')
513
+ },
514
+ getOssPath(url) {
515
+ let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate';
516
+ let type = this.getFileType(url)
517
+ this.newFileType = type;
518
+ if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC') {
519
+ httpUrl += '?needEncrypt=false'
520
+ } else {
521
+ httpUrl += '?needEncrypt=true'
522
+ }
523
+ this.$http.post(httpUrl, {
524
+ "fileInOssPath": url
525
+ }).then(res => {
526
+ console.log('getOssPath', res)
527
+ if (res.data.code == '0') {
528
+ this.previewHref = res.data.data;
529
+ }
530
+ })
531
+ },
532
+ getFileType(url) {
533
+ let index = url.lastIndexOf('?')
534
+ let newFileInOssPath = url.substring(0, url.indexOf("?"))
535
+ if (index == -1) {
536
+ newFileInOssPath = url
537
+ }
538
+ const fileType = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'));
539
+ if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc') {
540
+ return 'VIDEO'
541
+ } else if (fileType === '.html') {
542
+ return 'HTML'
543
+ } else if (fileType === '.png' || fileType === '.jpg' || fileType === '.jpeg' || fileType === '.PNG' || fileType === '.JPG' || fileType === '.JPEG') {
544
+ return 'IMAGE'
545
+ } else if (fileType === '.docx' || fileType === '.doc') {
546
+ return 'DOC'
547
+ } else if (fileType === '.ppt' || fileType === '.pptx') {
548
+ return 'PPT'
549
+ } else if (fileType === '.pdf') {
550
+ return 'PDF'
551
+ } else if (fileType === '.txt') {
552
+ return 'TXT'
553
+ } else {
554
+ return 'OTHER'
555
+ }
556
+ },
557
+ //判断是否使用新定位组件
558
+ getLocationInfo() {
559
+ this.newVersion = "";
560
+ this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + this.tagIds.join(',')).then(res => {
561
+ console.log('getLocationInfo', res)
562
+ this.pageChunkData = [];
563
+ if (res.data.code == 0) {
564
+ if (res.data.data && res.data.data.length > 0 && res.data.data[0].extractVersion == 'v3') {
565
+ this.newVersion = true;
566
+ if (this.newFileType !== 'PPT') {
567
+ this.loading = false;
568
+ }
569
+ for (let i = 0; i < res.data.data.length; i++) {
570
+ if (res.data.data[i].paragraphChunkInfo && res.data.data[i].paragraphChunkInfo.pageChunkData) {
571
+ this.pageChunkData.push(res.data.data[i].paragraphChunkInfo.pageChunkData.page_number)
572
+ }
573
+ }
574
+ if (this.pageChunkData.length > 1) {
575
+ let iframe = document.getElementsByClassName('preview_iframe_kk')
576
+ if (iframe && iframe.length > 0) {
577
+ iframe[0].style.paddingBottom = '50px'
418
578
  }
419
- };
420
- document.body.insertBefore(iframe, null);
421
- iframe.setAttribute("src", res.data);
579
+ }
422
580
  } else {
423
- let a = document.createElement('a')
424
- a.href = res.data
425
- a.download = (this.title) + fileType
426
- a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
581
+ this.newVersion = false;
427
582
  }
428
- this.close()
583
+ }
584
+ })
585
+ },
586
+ currentChange(value) {
587
+ this.currentPage = value - 1;
588
+ this.scrollPPTPage()
589
+ },
590
+ prev() {
591
+ if (this.currentPage == 0) {
592
+ return
593
+ }
594
+ this.currentPage--;
595
+ this.scrollPPTPage()
596
+ },
597
+ next() {
598
+ if (this.currentPage === (this.pageChunkData.length - 1)) {
599
+ return;
600
+ }
601
+ this.currentPage++;
602
+ this.scrollPPTPage()
603
+ },
604
+ scrollPPTPage() {
605
+ if (this.numberPage > 0) {
606
+ let pageNumber = this.pageChunkData[this.currentPage];
607
+ let height = Math.floor(Number(this.iframeHeight.replace('px', "")));
608
+ let pageHeight = Math.floor(height / this.numberPage);
609
+ let scrollHeight = (pageNumber - 1) * pageHeight;
610
+ let dom = document.getElementById('drawer_content_pre');
611
+ if (dom) {
612
+ dom.scrollTo(0, scrollHeight)
429
613
  }
430
614
  }
431
- })
432
- },
433
- isPcFun () {
434
- if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
435
- this.isPc = false
436
- } else {
437
- this.isPc = true
438
615
  }
439
616
  },
440
- clickFloder() {
441
- this.$emit('previewClickFloder')
442
- }},
443
- beforeDestroy () {
444
- window.removeEventListener('message', this.handleIframeMessage);
445
- }
617
+ beforeDestroy() {
618
+ window.removeEventListener('message', this.handleIframeMessage);
619
+ }
446
620
  }
447
621
  </script>
448
622
 
@@ -506,7 +680,133 @@ export default {
506
680
  width: 100%;
507
681
  height: 100%;
508
682
  }
683
+ .btn_footer {
684
+ width: 100%;
685
+ height: 60px;
686
+ display: flex;
687
+ align-items: center;
688
+ justify-content: space-around;
689
+ position: absolute;
690
+ bottom: 0px;
691
+ left: 0;
692
+ z-index: 999;
693
+ background: #ffffff;
694
+
695
+ .prev,
696
+ .next {
697
+ width: 35%;
698
+ height: 40px;
699
+ display: flex;
700
+ align-items: center;
701
+ justify-content: center;
702
+ border-radius: 50px;
703
+ cursor: pointer;
704
+ }
705
+
706
+ .prev {
707
+ background: #F2F5FA;
708
+ color: #000;
709
+ }
710
+
711
+ .next {
712
+ background: #366aff;
713
+ color: #ffffff;
714
+ }
715
+ }
716
+ #pagination {
717
+ .total-class {
718
+ margin-right: 13px;
719
+ font-weight: 400;
720
+ }
509
721
 
722
+ position: absolute;
723
+ bottom: 0px;
724
+ right: 0;
725
+ width: 100%;
726
+ display: flex;
727
+ align-items: center;
728
+ justify-content: center;
729
+ height: 50px;
730
+ background-color: white;
731
+ box-shadow: 0px 0px 18px 0px rgba(29, 55, 129, 0.07);
732
+ border-radius: 5px;
733
+ z-index: 1000;
734
+
735
+
736
+
737
+ /deep/.el-pagination {
738
+ margin-right: 110px;
739
+ }
740
+
741
+ /deep/.el-pager {
742
+ background: #EDF0F6;
743
+ border-radius: 15px;
744
+ }
745
+
746
+ /deep/.el-pagination.is-background .btn-next {
747
+ width: 30px;
748
+ height: 30px;
749
+ background: #EDF0F6;
750
+ border-radius: 50%;
751
+ }
752
+
753
+ /deep/.el-pagination .btn-next {
754
+ width: 30px;
755
+ height: 30px;
756
+ background: #EDF0F6;
757
+ border-radius: 50%;
758
+ padding-left: 0;
759
+ margin-left: 5px;
760
+ }
761
+
762
+ /deep/.el-pagination .btn-prev {
763
+ width: 30px;
764
+ height: 30px;
765
+ background: #EDF0F6;
766
+ border-radius: 50%;
767
+ padding-right: 0;
768
+ margin-right: 5px;
769
+ }
770
+
771
+ /deep/.el-pagination button {
772
+ padding: 0;
773
+ min-width: 30px;
774
+ }
775
+
776
+ /deep/.el-pager li {
777
+ background: #EDF0F6;
778
+ height: 30px;
779
+ min-width: 30px;
780
+ line-height: 30px;
781
+ font-size: 12px;
782
+ color: #717b90;
783
+ }
784
+
785
+ /deep/.el-pager li:first-child {
786
+ border-bottom-left-radius: 15px !important;
787
+ border-top-left-radius: 15px !important;
788
+ }
789
+
790
+ /deep/.el-pager li:last-child {
791
+ border-top-right-radius: 15px !important;
792
+ border-bottom-right-radius: 15px !important;
793
+ }
794
+
795
+ /deep/.el-pager li.active {
796
+ width: 30px;
797
+ height: 30px;
798
+ min-width: 30px;
799
+ background: #366AFF;
800
+ border: 3px solid #A1B9FF;
801
+ border-radius: 50%;
802
+ line-height: 24px;
803
+ color: white;
804
+ }
805
+
806
+ /deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
807
+ background: #366AFF;
808
+ }
809
+ }
510
810
  .preview_iframe_html {
511
811
  width: 100%;
512
812
  height: 100%;
@@ -581,7 +881,12 @@ export default {
581
881
  .libang_head {
582
882
  height: 64px !important;
583
883
  }
584
-
884
+ .has_btn_libang_head{
885
+ height: 85px!important;
886
+ }
887
+ .has_btn_head{
888
+ height: 60px!important;
889
+ }
585
890
  .drawer-header {
586
891
  width: 100%;
587
892
  height: 50px;
@@ -602,6 +907,7 @@ justify-content: space-between;
602
907
  .header-right {
603
908
  display: flex;
604
909
  }
910
+
605
911
  .summaryBtn {
606
912
  flex: none;
607
913
  //width: 95px;
@@ -667,17 +973,25 @@ justify-content: space-between;
667
973
  align-items: center;
668
974
  justify-content: space-between;
669
975
  line-height: 26px;
670
- .title_left {
671
- white-space: nowrap; /* 确保文本不会换行 */
672
- overflow: hidden; /* 隐藏超出容器的文本 */
673
- text-overflow: ellipsis; /* 当文本超出容器时显示省略号 */
674
- margin-right: 8px;
675
- }
976
+ }
977
+ .title_left {
978
+ white-space: nowrap; /* 确保文本不会换行 */
979
+ overflow: hidden; /* 隐藏超出容器的文本 */
980
+ text-overflow: ellipsis; /* 当文本超出容器时显示省略号 */
981
+ margin-right: 8px;
982
+ text-align: left;
983
+ }
984
+ .top-header{
985
+ display: flex;
986
+ align-items: center;
987
+ justify-content: flex-end;
988
+ margin-bottom: 6px;
676
989
  }
677
990
  .header_floder {
678
991
  display: flex;
679
992
  align-items: center;
680
993
  line-height: 26px;
994
+ text-align: left;
681
995
  i {
682
996
  margin: 0 5px;
683
997
  color: #366aff;
@@ -691,7 +1005,9 @@ justify-content: space-between;
691
1005
  }
692
1006
  }
693
1007
  }
694
-
1008
+ .has_btn_libang_content_pre{
1009
+ height: calc(100% - 85px) !important;
1010
+ }
695
1011
  @media screen and (max-width: 767px) {
696
1012
 
697
1013
  /* 这里是针对移动设备的css样式设置 */
@@ -703,10 +1019,6 @@ justify-content: space-between;
703
1019
  overflow: auto;
704
1020
  height: calc(100% - 50px);
705
1021
  background: #FFF;
706
- background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
707
- background-position: center;
708
- background-size: 50px;
709
- background-repeat: no-repeat;
710
1022
  }
711
1023
 
712
1024
  .libang_content_pre {