askbot-dragon 1.7.54-beta → 1.7.56-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.
- package/package.json +14 -2
- package/src/components/ActionAlertIframe.vue +1 -0
- package/src/components/AiGuide.vue +3 -7
- package/src/components/AnswerDocknowledge.vue +26 -23
- package/src/components/ConversationContainer.vue +1 -3
- package/src/components/MyEditor.vue +1 -1
- package/src/components/QwFeedback.vue +2 -1
- package/src/components/actionSatisfaction.vue +2 -2
- package/src/components/answerRadio.vue +5 -3
- package/src/components/assetDetails.vue +1 -1
- package/src/components/assetMessage.vue +14 -13
- package/src/components/fielListView.vue +1 -1
- package/src/components/formTemplate.vue +1 -0
- package/src/components/intelligentSummary.vue +15 -12
- package/src/components/markDownText.vue +4 -4
- package/src/components/myPopup.vue +14 -11
- package/src/components/pdfPosition.vue +67 -58
- package/src/components/popup.vue +8 -7
- package/src/components/preview/excelView.vue +14 -6
- package/src/components/previewDoc.vue +1 -0
- package/src/components/previewPdf.vue +431 -420
- package/src/components/receiverMessagePlatform.vue +24 -20
- package/src/components/senderMessagePlatform.vue +19 -11
- package/src/components/tree.vue +2 -2
- package/src/components/welcomeKnowledgeFile.vue +5 -2
- package/src/components/welcomeSuggest.vue +1 -1
- package/src/locales/cn.json +55 -65
- package/src/locales/en.json +60 -71
- package/src/main.js +18 -17
|
@@ -5,11 +5,29 @@
|
|
|
5
5
|
另外增加了在知识项目中预览当前文件的一些功能
|
|
6
6
|
-->
|
|
7
7
|
<template>
|
|
8
|
-
<el-drawer
|
|
9
|
-
:modal="
|
|
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
|
-
|
|
12
|
-
|
|
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>
|
|
13
31
|
<div class="header_title">
|
|
14
32
|
<template v-if="isDownload || isHasChat">
|
|
15
33
|
<div class="top-header">
|
|
@@ -37,7 +55,7 @@
|
|
|
37
55
|
</section>
|
|
38
56
|
</div>
|
|
39
57
|
<span class="title_left">
|
|
40
|
-
{{ title ? title :
|
|
58
|
+
{{ title ? title : $t('dragonCommon.viewDetails') }}
|
|
41
59
|
</span>
|
|
42
60
|
</template>
|
|
43
61
|
<div class="header_close" v-else>
|
|
@@ -59,25 +77,25 @@
|
|
|
59
77
|
<div class="header_title">
|
|
60
78
|
<div :class="isLiBang && folderName ? 'header_close' : 'header_top'">
|
|
61
79
|
<span class="title_left">
|
|
62
|
-
{{ title ? title :
|
|
80
|
+
{{ title ? title : $t('dragonCommon.viewDetails') }}
|
|
63
81
|
</span>
|
|
64
82
|
<div class="header-btn">
|
|
65
83
|
<div class="onload_btn" v-if="isDownload" @click="downLoad">
|
|
66
|
-
|
|
84
|
+
{{ $t('dragonCommon.download') }}
|
|
67
85
|
</div>
|
|
68
86
|
<div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun"
|
|
69
87
|
v-if="isHasChat || formKnowledgeManagement">
|
|
70
88
|
<i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
|
|
71
|
-
<span
|
|
89
|
+
<span>{{ $t('dragonCommon.smartSummary') }}</span>
|
|
72
90
|
</div>
|
|
73
91
|
<template v-if="isHasChat">
|
|
74
92
|
<div class="chat" @click="previewToDialog(true)" v-if="!previewKnowledgeId">
|
|
75
93
|
<i class="iconfont guoran-wendapingjia"></i>
|
|
76
|
-
|
|
94
|
+
{{ $t('dragonCommon.chat') }}
|
|
77
95
|
</div>
|
|
78
96
|
<div class="chat chat_active" @click="previewToDialog(false)" v-else>
|
|
79
97
|
<i class="iconfont guoran-wendapingjia"></i>
|
|
80
|
-
|
|
98
|
+
{{ $t('dragonCommon.chat') }}
|
|
81
99
|
</div>
|
|
82
100
|
</template>
|
|
83
101
|
<section @click="close">
|
|
@@ -93,12 +111,7 @@
|
|
|
93
111
|
</div>
|
|
94
112
|
</div>
|
|
95
113
|
<div id="drawer_content_pre" :class="isLiBang && folderName ? 'libang_content_pre' : ''">
|
|
96
|
-
|
|
97
|
-
<intelligent-summary
|
|
98
|
-
v-show="showSummary && (isHasChat || formKnowledgeManagement) && fileType !== 'VIDEO' && fileType !== 'IMAGE'"
|
|
99
|
-
:tagIds="tagIds"
|
|
100
|
-
:knowledgeId="knowledgeId"
|
|
101
|
-
:formKnowledgeManagement="formKnowledgeManagement"
|
|
114
|
+
<intelligent-summary v-show="showSummary && isHasChat" :tagIds="tagIds" :knowledgeId="knowledgeId"
|
|
102
115
|
@closeSummary="closeSummary" @recommendQues="recommendQues"
|
|
103
116
|
@getSummarySuccess="getSummarySuccess"></intelligent-summary>
|
|
104
117
|
<div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer && newVersion === false && newFileType !== 'PPT'">
|
|
@@ -117,7 +130,7 @@
|
|
|
117
130
|
<video :src="url" controls width="100%;" height="98%"></video>
|
|
118
131
|
</div>
|
|
119
132
|
<div v-else-if="fileType == 'HTML'" style="width: 100%;">
|
|
120
|
-
<div class="preview_iframe_html" style="text-
|
|
133
|
+
<div class="preview_iframe_html" style="text-align:left" v-html="fileText"></div>
|
|
121
134
|
</div>
|
|
122
135
|
<template v-else-if="url.includes('https://www') || url.includes('http://www')">
|
|
123
136
|
<iframe class="preview_iframe" :src="url" width="100%" height="100%" scrolling="100%" frameborder="no"
|
|
@@ -140,9 +153,6 @@
|
|
|
140
153
|
</template>
|
|
141
154
|
</template>
|
|
142
155
|
</template>
|
|
143
|
-
<!-- <div class="mobile_onload_btn" v-if="isDownload && !isPc" @click="downLoad">
|
|
144
|
-
下载
|
|
145
|
-
</div> -->
|
|
146
156
|
</div>
|
|
147
157
|
<div class="loading_img" v-show="loading">
|
|
148
158
|
<img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
|
|
@@ -161,96 +171,97 @@ import { isMobile } from "../assets/js/common";
|
|
|
161
171
|
import { Toast } from 'vant';
|
|
162
172
|
import NewPositionPreview from "./preview/newPositionPreview";
|
|
163
173
|
export default {
|
|
164
|
-
data
|
|
174
|
+
data() {
|
|
165
175
|
return {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
newVersion:'',
|
|
182
|
-
previewHref:"",
|
|
183
|
-
newFileType:"",
|
|
184
|
-
numberPage:0,
|
|
185
|
-
pageChunkData:[],
|
|
186
|
-
currentPage:0
|
|
176
|
+
previewShowPopup: false,
|
|
177
|
+
fileText: '',
|
|
178
|
+
fileType: "",
|
|
179
|
+
isPc: false,
|
|
180
|
+
drawer: false,
|
|
181
|
+
tagIds: [],
|
|
182
|
+
// '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
|
|
183
|
+
loading: true,
|
|
184
|
+
fileName: '',
|
|
185
|
+
previewKnowledgeId: "",
|
|
186
|
+
showSummary: false,
|
|
187
|
+
iframeHeight: "100%",
|
|
188
|
+
isDownload: false,
|
|
189
|
+
textWatermarkStr: "",
|
|
190
|
+
copy: '',
|
|
191
|
+
newVersion: '',
|
|
192
|
+
previewHref: "",
|
|
193
|
+
newFileType: "",
|
|
194
|
+
numberPage: 0,
|
|
195
|
+
pageChunkData: [],
|
|
196
|
+
currentPage: 0
|
|
187
197
|
}
|
|
188
|
-
|
|
198
|
+
},
|
|
189
199
|
mounted() {
|
|
190
|
-
|
|
200
|
+
this.$i18n.locale = sessionStorage.getItem("systemLanguage") || 'cn';
|
|
201
|
+
window.addEventListener('message', this.handleIframeMessage, false);
|
|
191
202
|
this.isPcFun();
|
|
192
203
|
},
|
|
193
|
-
props:{
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
204
|
+
props: {
|
|
205
|
+
url: {
|
|
206
|
+
type: String,
|
|
207
|
+
required: true,
|
|
208
|
+
},
|
|
209
|
+
officePreviewType: {
|
|
210
|
+
type: String,
|
|
211
|
+
default: ''
|
|
212
|
+
},
|
|
213
|
+
isMessageRecord: {
|
|
214
|
+
type: Boolean,
|
|
215
|
+
default: false,
|
|
216
|
+
},
|
|
217
|
+
sourceFileType: {
|
|
218
|
+
type: String,
|
|
219
|
+
default: '',
|
|
220
|
+
},
|
|
221
|
+
title: {
|
|
222
|
+
type: String,
|
|
223
|
+
default: ''
|
|
224
|
+
},
|
|
225
|
+
isHasChat: {
|
|
226
|
+
type: Boolean,
|
|
227
|
+
default: false
|
|
228
|
+
},
|
|
229
|
+
knowledgeId: {
|
|
230
|
+
type: String,
|
|
231
|
+
default: '',
|
|
232
|
+
},
|
|
233
|
+
previewOssPath: {
|
|
234
|
+
type: String,
|
|
235
|
+
default: '',
|
|
236
|
+
},
|
|
237
|
+
folderName: {
|
|
238
|
+
type: String,
|
|
239
|
+
default: '',
|
|
240
|
+
},
|
|
241
|
+
folderUrl: {
|
|
242
|
+
type: String,
|
|
243
|
+
default: '',
|
|
244
|
+
},
|
|
245
|
+
isLiBang: {
|
|
246
|
+
type: Boolean,
|
|
247
|
+
default: false
|
|
248
|
+
},
|
|
249
|
+
formKnowledgeManagement: {
|
|
250
|
+
type: Boolean,
|
|
251
|
+
default: false
|
|
252
|
+
}
|
|
233
253
|
},
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
254
|
+
components: {
|
|
255
|
+
NewPositionPreview,
|
|
256
|
+
IntelligentSummary,
|
|
257
|
+
pdfPosition
|
|
237
258
|
},
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
NewPositionPreview,
|
|
245
|
-
IntelligentSummary,
|
|
246
|
-
pdfPosition
|
|
247
|
-
},
|
|
248
|
-
watch: {
|
|
249
|
-
drawer (value) {
|
|
250
|
-
if (value) {
|
|
251
|
-
this.$emit('open')
|
|
252
|
-
this.$nextTick(() => {
|
|
253
|
-
if (this.tagIds && this.tagIds.length != 0){
|
|
259
|
+
watch: {
|
|
260
|
+
drawer(value) {
|
|
261
|
+
if (value) {
|
|
262
|
+
this.$emit('open')
|
|
263
|
+
this.$nextTick(() => {
|
|
264
|
+
if (this.tagIds && this.tagIds.length != 0) {
|
|
254
265
|
zoomElement(document.getElementById('pdf_container_view'))
|
|
255
266
|
}
|
|
256
267
|
})
|
|
@@ -259,16 +270,16 @@ export default {
|
|
|
259
270
|
}
|
|
260
271
|
setTimeout(() => {
|
|
261
272
|
let previewIframe = document.getElementsByClassName('preview_iframe')
|
|
262
|
-
Array.from(previewIframe).forEach(item =>{
|
|
263
|
-
item.onload = () =>{
|
|
264
|
-
console.debug('previewIframe 106',previewIframe,this.drawer)
|
|
273
|
+
Array.from(previewIframe).forEach(item => {
|
|
274
|
+
item.onload = () => {
|
|
275
|
+
console.debug('previewIframe 106', previewIframe, this.drawer)
|
|
265
276
|
item.style.backgroundImage = 'none'
|
|
266
277
|
}
|
|
267
278
|
})
|
|
268
279
|
})
|
|
269
280
|
},
|
|
270
|
-
showSummary:{
|
|
271
|
-
handler(val){
|
|
281
|
+
showSummary: {
|
|
282
|
+
handler(val) {
|
|
272
283
|
// if (!val){
|
|
273
284
|
// this.$nextTick(() => {
|
|
274
285
|
// let preCon = document.querySelector('.pdf_view');
|
|
@@ -279,352 +290,352 @@ export default {
|
|
|
279
290
|
// } else {
|
|
280
291
|
// this.getSummarySuccess();
|
|
281
292
|
// }
|
|
282
|
-
if(val) {
|
|
293
|
+
if (val) {
|
|
283
294
|
this.getSummarySuccess();
|
|
284
295
|
}
|
|
285
296
|
}
|
|
286
297
|
},
|
|
287
|
-
knowledgeId:{
|
|
288
|
-
handler(val){
|
|
289
|
-
if (val){
|
|
298
|
+
knowledgeId: {
|
|
299
|
+
handler(val) {
|
|
300
|
+
if (val) {
|
|
290
301
|
this.getTextWatermark();
|
|
291
302
|
}
|
|
292
303
|
}
|
|
293
304
|
}
|
|
294
305
|
},
|
|
295
|
-
computed:{
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
306
|
+
computed: {
|
|
307
|
+
pdfStyle() {
|
|
308
|
+
return {
|
|
309
|
+
paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
|
|
310
|
+
paddingBottom: this.tagIds > 1 ? '60px' : '0',
|
|
311
|
+
height: '100%'
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
previewUrl() {
|
|
315
|
+
console.debug('VUE_APP_ENV', process.env.VUE_APP_ENV)
|
|
316
|
+
let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
|
|
317
|
+
// if(this.url != '') {
|
|
318
|
+
// if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
|
|
319
|
+
// url += btoa(encodeURIComponent(this.url))
|
|
320
|
+
// } else {
|
|
321
|
+
// url += btoa(this.url)
|
|
322
|
+
// }
|
|
323
|
+
// }
|
|
324
|
+
url = url + this.url
|
|
325
|
+
url += '&officePreviewType=pdf'
|
|
326
|
+
if (this.watermark) {
|
|
327
|
+
url = this.watermark.textWatermarkValue ? (url += '&textWatermarkValue=' + this.watermark.textWatermarkValue) : url
|
|
328
|
+
url = this.watermark.visitorWatermarkValue ? (url += '&visitorWatermarkValue=' + this.watermark.visitorWatermarkValue) : url
|
|
329
|
+
}
|
|
330
|
+
console.log('textWatermarkStr 216', this.textWatermarkStr)
|
|
331
|
+
if (this.textWatermarkStr) {
|
|
332
|
+
url += '&textWatermarkValue=' + this.textWatermarkStr
|
|
333
|
+
}
|
|
334
|
+
return url
|
|
335
|
+
},
|
|
336
|
+
// fileType() {
|
|
337
|
+
// const fileType = this.url.substring(this.url.lastIndexOf('.'));
|
|
338
|
+
// if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
|
|
339
|
+
// return 'VIDEO'
|
|
340
|
+
// } else {
|
|
341
|
+
// return 'OTHER'
|
|
342
|
+
// }
|
|
332
343
|
|
|
333
|
-
|
|
334
|
-
},
|
|
335
|
-
methods: {
|
|
336
|
-
close () {
|
|
337
|
-
setTimeout(() => {
|
|
338
|
-
this.previewShowPopup = false;
|
|
339
|
-
this.fileType = ''
|
|
340
|
-
}, 300)
|
|
341
|
-
this.drawer = false;
|
|
342
|
-
this.showSummary = false;
|
|
344
|
+
// }
|
|
343
345
|
},
|
|
344
|
-
|
|
346
|
+
methods: {
|
|
347
|
+
close() {
|
|
348
|
+
setTimeout(() => {
|
|
349
|
+
this.previewShowPopup = false;
|
|
350
|
+
this.fileType = ''
|
|
351
|
+
}, 300)
|
|
352
|
+
this.drawer = false;
|
|
353
|
+
this.showSummary = false;
|
|
354
|
+
},
|
|
355
|
+
loadIframe() {
|
|
345
356
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
357
|
+
if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0 && this.newFileType !== 'PPT')) {
|
|
358
|
+
this.loading = false
|
|
359
|
+
} else {
|
|
360
|
+
let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
|
|
361
|
+
if (iframe) {
|
|
362
|
+
iframe.onload = () => {
|
|
363
|
+
this.loading = false;
|
|
364
|
+
document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
|
|
365
|
+
}
|
|
354
366
|
}
|
|
367
|
+
// let time = setInterval(() =>{
|
|
368
|
+
//
|
|
369
|
+
// if(iframe) {
|
|
370
|
+
// this.loading = false
|
|
371
|
+
// clearInterval(time)
|
|
372
|
+
// }
|
|
373
|
+
// }, 500)
|
|
355
374
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
375
|
+
},
|
|
376
|
+
getBolb() {
|
|
377
|
+
this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
|
|
378
|
+
fileInOssPath: this.url,
|
|
379
|
+
templateId: ''
|
|
380
|
+
}).then(res => {
|
|
381
|
+
if (res.data.code == 0) {
|
|
382
|
+
this.fileText = res.data.data
|
|
383
|
+
this.loading = false
|
|
384
|
+
}
|
|
385
|
+
})
|
|
386
|
+
},
|
|
387
|
+
previewToDialog(flag) {
|
|
388
|
+
this.$emit('previewToDialog', flag)
|
|
389
|
+
},
|
|
390
|
+
closeSummary() {
|
|
391
|
+
this.showSummary = false;
|
|
392
|
+
},
|
|
393
|
+
recommendQues(item, knowledgeId) {
|
|
394
|
+
console.log('recommendQues', item, knowledgeId);
|
|
395
|
+
this.$emit('recommendQues', item, knowledgeId)
|
|
396
|
+
},
|
|
397
|
+
handleIframeMessage(res) {
|
|
398
|
+
if (res.data.type == 'getViewerHeight') {
|
|
399
|
+
let iframeHeight = this.iframeHeight.replace('px', '')
|
|
400
|
+
if (res.data.data && iframeHeight != (res.data.data + 50)) {
|
|
401
|
+
this.iframeHeight = res.data.data + 50 + 'px'
|
|
402
|
+
}
|
|
373
403
|
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
closeSummary () {
|
|
380
|
-
this.showSummary = false;
|
|
381
|
-
},
|
|
382
|
-
recommendQues (item, knowledgeId) {
|
|
383
|
-
console.log('recommendQues', item, knowledgeId);
|
|
384
|
-
this.$emit('recommendQues', item, knowledgeId)
|
|
385
|
-
},
|
|
386
|
-
handleIframeMessage (res) {
|
|
387
|
-
if (res.data.type == 'getViewerHeight') {
|
|
388
|
-
let iframeHeight = this.iframeHeight.replace('px', '')
|
|
389
|
-
if (res.data.data && iframeHeight != (res.data.data + 50)) {
|
|
390
|
-
this.iframeHeight = res.data.data + 50 + 'px'
|
|
404
|
+
if (res.data.type == 'getViewPage' && res.data.data) {
|
|
405
|
+
this.numberPage = Number(res.data.data);
|
|
406
|
+
if (this.pageChunkData.length > 0) {
|
|
407
|
+
this.scrollPPTPage(this.pageChunkData[0])
|
|
408
|
+
}
|
|
391
409
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
this.scrollPPTPage(this.pageChunkData[0])
|
|
410
|
+
if (res.data.type == 'getViewerHeight' || res.data.type == 'getViewPage') {
|
|
411
|
+
if (this.pageChunkData.length > 0) {
|
|
412
|
+
this.scrollPPTPage(this.pageChunkData[0])
|
|
413
|
+
}
|
|
397
414
|
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
415
|
+
},
|
|
416
|
+
summaryFun() {
|
|
417
|
+
this.showSummary = !this.showSummary;
|
|
418
|
+
if (this.showSummary) {
|
|
419
|
+
document.getElementById('drawer_content_pre').scrollTop = 0;
|
|
402
420
|
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
getTextWatermark () {
|
|
430
|
-
let url = '/knowledge-api/open/knowledge/getPermissionInfo';
|
|
431
|
-
let obj = {
|
|
432
|
-
"knowledgeId": this.knowledgeId,
|
|
433
|
-
"userId": sessionStorage.getItem('_currentUserId'),
|
|
434
|
-
"mainId": sessionStorage.getItem('_mainId'),
|
|
435
|
-
"corpId": sessionStorage.getItem('_corpid')
|
|
436
|
-
}
|
|
437
|
-
this.$http.post(url, obj).then(res => {
|
|
438
|
-
console.log('getTextWatermark', res.data.data)
|
|
439
|
-
if (res.data.data) {
|
|
440
|
-
this.textWatermarkStr = res.data.data.textWatermarkStr;
|
|
441
|
-
this.isDownload = res.data.data.showDownloadBtn;
|
|
421
|
+
},
|
|
422
|
+
getSummarySuccess() {
|
|
423
|
+
this.$nextTick(() => {
|
|
424
|
+
// if (this.tagIds.length > 0){
|
|
425
|
+
// let intelligentSummary = document.getElementById('intelligentSummary');
|
|
426
|
+
// let preCon = document.querySelector('.pdf_view')
|
|
427
|
+
// if (intelligentSummary){
|
|
428
|
+
// let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
|
|
429
|
+
// if (preCon){
|
|
430
|
+
// preCon.style.height = 'calc(100% - ' + height + 'px)'
|
|
431
|
+
// }
|
|
432
|
+
// console.log('height',height,preCon)
|
|
433
|
+
// }
|
|
434
|
+
// }
|
|
435
|
+
// let intelligentSummary = document.getElementById('intelligentSummary');
|
|
436
|
+
// let height = intelligentSummary.offsetHeight
|
|
437
|
+
// this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
|
|
438
|
+
})
|
|
439
|
+
},
|
|
440
|
+
getTextWatermark() {
|
|
441
|
+
let url = '/knowledge-api/open/knowledge/getPermissionInfo';
|
|
442
|
+
let obj = {
|
|
443
|
+
"knowledgeId": this.knowledgeId,
|
|
444
|
+
"userId": sessionStorage.getItem('_currentUserId'),
|
|
445
|
+
"mainId": sessionStorage.getItem('_mainId'),
|
|
446
|
+
"corpId": sessionStorage.getItem('_corpid')
|
|
442
447
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
|
|
456
|
-
headers: {
|
|
457
|
-
"Content-Type": "application/json",
|
|
448
|
+
this.$http.post(url, obj).then(res => {
|
|
449
|
+
console.log('getTextWatermark', res.data.data)
|
|
450
|
+
if (res.data.data) {
|
|
451
|
+
this.textWatermarkStr = res.data.data.textWatermarkStr;
|
|
452
|
+
this.isDownload = res.data.data.showDownloadBtn;
|
|
453
|
+
}
|
|
454
|
+
})
|
|
455
|
+
},
|
|
456
|
+
downLoad() {
|
|
457
|
+
if (this.formKnowledgeManagement) {
|
|
458
|
+
this.$emit('downLoad', this.previewOssPath);
|
|
459
|
+
return
|
|
458
460
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
461
|
+
let url = this.previewOssPath
|
|
462
|
+
if (decodeURIComponent(url) != url) {
|
|
463
|
+
url = decodeURIComponent(url)
|
|
464
|
+
}
|
|
465
|
+
const fileType = url.substring(url.lastIndexOf('.'));
|
|
466
|
+
this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
|
|
467
|
+
headers: {
|
|
468
|
+
"Content-Type": "application/json",
|
|
469
|
+
}
|
|
470
|
+
}).then(res => {
|
|
471
|
+
console.log('downLoad 341', res)
|
|
472
|
+
if (res.data || res.bodyText) {
|
|
473
|
+
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
|
|
474
|
+
this.copy = res.data
|
|
475
|
+
if (isMobile()) {
|
|
476
|
+
setTimeout(() => {
|
|
477
|
+
const range = document.createRange();
|
|
478
|
+
range.selectNode(document.getElementById('text'));
|
|
479
|
+
const selection = window.getSelection();
|
|
480
|
+
//移除之前选中内容
|
|
481
|
+
if (selection.rangeCount > 0) selection.removeAllRanges();
|
|
482
|
+
selection.addRange(range);
|
|
483
|
+
document.execCommand('copy');
|
|
484
|
+
selection.removeAllRanges()
|
|
485
|
+
Toast(this.$t('dragonCommon.Safaridownload'));
|
|
486
|
+
this.close()
|
|
487
|
+
}, 100)
|
|
488
|
+
} else {
|
|
489
|
+
let a = document.createElement('a')
|
|
490
|
+
a.href = res.data
|
|
491
|
+
a.download = (this.title) + fileType
|
|
492
|
+
a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
|
|
493
|
+
}
|
|
494
|
+
return
|
|
477
495
|
} else {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
return
|
|
484
|
-
} else {
|
|
485
|
-
// setTimeout(() =>{
|
|
486
|
-
// window.open(res.data,'下载', 'noopener')
|
|
487
|
-
// }, 2000)
|
|
488
|
-
// window.open(res.data,'下载', 'noopener')
|
|
489
|
-
if (isMobile()) {
|
|
496
|
+
// setTimeout(() =>{
|
|
497
|
+
// window.open(res.data,'下载', 'noopener')
|
|
498
|
+
// }, 2000)
|
|
499
|
+
// window.open(res.data,'下载', 'noopener')
|
|
500
|
+
if (isMobile()) {
|
|
490
501
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
502
|
+
const iframe = document.createElement("iframe");
|
|
503
|
+
iframe.setAttribute("hidden", "hidden");
|
|
504
|
+
iframe.onload = () => {
|
|
505
|
+
if (iframe) {
|
|
506
|
+
console.log("iframe onload....")
|
|
507
|
+
iframe.setAttribute('src', 'about:blank');
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
document.body.insertBefore(iframe, null);
|
|
511
|
+
iframe.setAttribute("src", res.data);
|
|
512
|
+
} else {
|
|
513
|
+
let a = document.createElement('a')
|
|
514
|
+
a.href = res.data
|
|
515
|
+
a.download = (this.title) + fileType
|
|
516
|
+
a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
|
|
497
517
|
}
|
|
498
|
-
|
|
499
|
-
document.body.insertBefore(iframe, null);
|
|
500
|
-
iframe.setAttribute("src", res.data );
|
|
501
|
-
} else {
|
|
502
|
-
let a = document.createElement('a')
|
|
503
|
-
a.href = res.data
|
|
504
|
-
a.download = (this.title) + fileType
|
|
505
|
-
a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
|
|
518
|
+
this.close()
|
|
506
519
|
}
|
|
507
|
-
|
|
508
|
-
}
|
|
520
|
+
}
|
|
521
|
+
})
|
|
522
|
+
},
|
|
523
|
+
isPcFun() {
|
|
524
|
+
if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
|
|
525
|
+
this.isPc = false
|
|
526
|
+
} else {
|
|
527
|
+
this.isPc = true
|
|
509
528
|
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
getOssPath(url){
|
|
523
|
-
let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate';
|
|
524
|
-
let type = this.getFileType(url)
|
|
525
|
-
this.newFileType = type;
|
|
526
|
-
if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC') {
|
|
527
|
-
httpUrl += '?needEncrypt=false'
|
|
528
|
-
} else {
|
|
529
|
-
httpUrl += '?needEncrypt=true'
|
|
530
|
-
}
|
|
531
|
-
this.$http.post(httpUrl, {
|
|
532
|
-
"fileInOssPath": url
|
|
533
|
-
}).then(res => {
|
|
534
|
-
console.log('getOssPath',res)
|
|
535
|
-
if (res.data.code == '0'){
|
|
536
|
-
this.previewHref = res.data.data;
|
|
529
|
+
},
|
|
530
|
+
clickFloder() {
|
|
531
|
+
this.$emit('previewClickFloder')
|
|
532
|
+
},
|
|
533
|
+
getOssPath(url) {
|
|
534
|
+
let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate';
|
|
535
|
+
let type = this.getFileType(url)
|
|
536
|
+
this.newFileType = type;
|
|
537
|
+
if (type === 'VIDEO' || type === 'PDF' || type === 'EXCEL' || type === 'TXT' || type === 'DOC') {
|
|
538
|
+
httpUrl += '?needEncrypt=false'
|
|
539
|
+
} else {
|
|
540
|
+
httpUrl += '?needEncrypt=true'
|
|
537
541
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
542
|
+
this.$http.post(httpUrl, {
|
|
543
|
+
"fileInOssPath": url
|
|
544
|
+
}).then(res => {
|
|
545
|
+
console.log('getOssPath', res)
|
|
546
|
+
if (res.data.code == '0') {
|
|
547
|
+
this.previewHref = res.data.data;
|
|
548
|
+
}
|
|
549
|
+
})
|
|
550
|
+
},
|
|
551
|
+
getFileType(url) {
|
|
552
|
+
let index = url.lastIndexOf('?')
|
|
553
|
+
let newFileInOssPath = url.substring(0, url.indexOf("?"))
|
|
554
|
+
if (index == -1) {
|
|
555
|
+
newFileInOssPath = url
|
|
556
|
+
}
|
|
557
|
+
const fileType = newFileInOssPath.substring(newFileInOssPath.lastIndexOf('.'));
|
|
558
|
+
if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc') {
|
|
559
|
+
return 'VIDEO'
|
|
560
|
+
} else if (fileType === '.html') {
|
|
561
|
+
return 'HTML'
|
|
562
|
+
} else if (fileType === '.png' || fileType === '.jpg' || fileType === '.jpeg' || fileType === '.PNG' || fileType === '.JPG' || fileType === '.JPEG') {
|
|
563
|
+
return 'IMAGE'
|
|
564
|
+
} else if (fileType === '.docx' || fileType === '.doc') {
|
|
565
|
+
return 'DOC'
|
|
566
|
+
} else if (fileType === '.ppt' || fileType === '.pptx') {
|
|
567
|
+
return 'PPT'
|
|
568
|
+
} else if (fileType === '.pdf') {
|
|
569
|
+
return 'PDF'
|
|
570
|
+
} else if (fileType === '.txt') {
|
|
571
|
+
return 'TXT'
|
|
572
|
+
} else {
|
|
573
|
+
return 'OTHER'
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
//判断是否使用新定位组件
|
|
577
|
+
getLocationInfo() {
|
|
578
|
+
this.newVersion = "";
|
|
579
|
+
this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + this.tagIds.join(',')).then(res => {
|
|
580
|
+
console.log('getLocationInfo', res)
|
|
581
|
+
this.pageChunkData = [];
|
|
582
|
+
if (res.data.code == 0) {
|
|
583
|
+
if (res.data.data && res.data.data.length > 0 && res.data.data[0].extractVersion == 'v3') {
|
|
584
|
+
this.newVersion = true;
|
|
585
|
+
if (this.newFileType !== 'PPT') {
|
|
586
|
+
this.loading = false;
|
|
580
587
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
588
|
+
for (let i = 0; i < res.data.data.length; i++) {
|
|
589
|
+
if (res.data.data[i].paragraphChunkInfo && res.data.data[i].paragraphChunkInfo.pageChunkData) {
|
|
590
|
+
this.pageChunkData.push(res.data.data[i].paragraphChunkInfo.pageChunkData.page_number)
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
if (this.pageChunkData.length > 1) {
|
|
594
|
+
let iframe = document.getElementsByClassName('preview_iframe_kk')
|
|
595
|
+
if (iframe && iframe.length > 0) {
|
|
596
|
+
iframe[0].style.paddingBottom = '50px'
|
|
597
|
+
}
|
|
586
598
|
}
|
|
599
|
+
} else {
|
|
600
|
+
this.newVersion = false;
|
|
587
601
|
}
|
|
588
|
-
} else {
|
|
589
|
-
this.newVersion = false;
|
|
590
602
|
}
|
|
603
|
+
})
|
|
604
|
+
},
|
|
605
|
+
currentChange(value) {
|
|
606
|
+
this.currentPage = value - 1;
|
|
607
|
+
this.scrollPPTPage()
|
|
608
|
+
},
|
|
609
|
+
prev() {
|
|
610
|
+
if (this.currentPage == 0) {
|
|
611
|
+
return
|
|
591
612
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
scrollPPTPage(){
|
|
613
|
-
if (this.numberPage > 0){
|
|
614
|
-
let pageNumber = this.pageChunkData[this.currentPage];
|
|
615
|
-
let height = Math.floor(Number(this.iframeHeight.replace('px',"")));
|
|
616
|
-
let pageHeight = Math.floor(height / this.numberPage);
|
|
617
|
-
let scrollHeight = (pageNumber - 1) * pageHeight;
|
|
618
|
-
let dom = document.getElementById('drawer_content_pre');
|
|
619
|
-
if (dom){
|
|
620
|
-
dom.scrollTo(0,scrollHeight)
|
|
613
|
+
this.currentPage--;
|
|
614
|
+
this.scrollPPTPage()
|
|
615
|
+
},
|
|
616
|
+
next() {
|
|
617
|
+
if (this.currentPage === (this.pageChunkData.length - 1)) {
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
this.currentPage++;
|
|
621
|
+
this.scrollPPTPage()
|
|
622
|
+
},
|
|
623
|
+
scrollPPTPage() {
|
|
624
|
+
if (this.numberPage > 0) {
|
|
625
|
+
let pageNumber = this.pageChunkData[this.currentPage];
|
|
626
|
+
let height = Math.floor(Number(this.iframeHeight.replace('px', "")));
|
|
627
|
+
let pageHeight = Math.floor(height / this.numberPage);
|
|
628
|
+
let scrollHeight = (pageNumber - 1) * pageHeight;
|
|
629
|
+
let dom = document.getElementById('drawer_content_pre');
|
|
630
|
+
if (dom) {
|
|
631
|
+
dom.scrollTo(0, scrollHeight)
|
|
632
|
+
}
|
|
621
633
|
}
|
|
622
634
|
}
|
|
623
|
-
}
|
|
624
635
|
},
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
636
|
+
beforeDestroy() {
|
|
637
|
+
window.removeEventListener('message', this.handleIframeMessage);
|
|
638
|
+
}
|
|
628
639
|
}
|
|
629
640
|
</script>
|
|
630
641
|
|