askbot-dragon 1.5.68 → 1.5.69
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 +1 -1
- package/src/components/previewPdf.vue +365 -412
package/package.json
CHANGED
|
@@ -5,64 +5,17 @@
|
|
|
5
5
|
另外增加了在知识项目中预览当前文件的一些功能
|
|
6
6
|
-->
|
|
7
7
|
<template>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<section @click="close">
|
|
12
|
-
<i class="iconfont guoran-shanchu"></i>
|
|
13
|
-
</section>
|
|
14
|
-
</div>
|
|
15
|
-
<template v-if="tagIds && tagIds.length != 0 && previewShowPopup">
|
|
16
|
-
<pdfPosition :tagIds="tagIds" ></pdfPosition>
|
|
17
|
-
</template>
|
|
18
|
-
<template v-else>
|
|
19
|
-
<div v-if="fileType == 'VIDEO'" style="width: 100%;height: calc(100% - 60px)">
|
|
20
|
-
<video :src="url" controls width="100%;" height="98%"></video>
|
|
21
|
-
</div>
|
|
22
|
-
<div v-else-if="fileType == 'HTML'" style="width: 100%;height: calc(100% - 60px)">
|
|
23
|
-
<div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
|
|
24
|
-
</div>
|
|
25
|
-
<template v-else-if="url.includes('https://www') || url.includes('http://www')">
|
|
26
|
-
<iframe class="preview_iframe"
|
|
27
|
-
:src="url"
|
|
28
|
-
width="100%"
|
|
29
|
-
height="100%"
|
|
30
|
-
scrolling="100%"
|
|
31
|
-
frameborder="no"
|
|
32
|
-
border="0"></iframe>
|
|
33
|
-
</template>
|
|
34
|
-
<template v-else>
|
|
35
|
-
<iframe class="preview_iframe" :src="previewUrl" style="border:none;"></iframe>
|
|
36
|
-
</template>
|
|
37
|
-
</template>
|
|
38
|
-
<div class="loading_img" v-show="loading">
|
|
39
|
-
<img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
|
|
40
|
-
</div>
|
|
41
|
-
</van-popup> -->
|
|
42
|
-
<el-drawer
|
|
43
|
-
title="我是标题"
|
|
44
|
-
:visible.sync="drawer"
|
|
45
|
-
:with-header="false"
|
|
46
|
-
:append-to-body="true"
|
|
47
|
-
:destroy-on-close="true"
|
|
48
|
-
:modal="false"
|
|
49
|
-
:direction="previewShowPopup ? 'btt' : 'rtl'"
|
|
50
|
-
:size="previewShowPopup ? '90%' : '65%'"
|
|
51
|
-
custom-class="pdf-preview-drawer"
|
|
52
|
-
v-if="drawer"
|
|
53
|
-
>
|
|
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
|
+
custom-class="pdf-preview-drawer" v-if="drawer">
|
|
54
11
|
<!-- v-else-if="drawer" -->
|
|
55
12
|
<div class="drawer-footer">
|
|
56
|
-
<span>{{title ? title : "查看详情"}}</span>
|
|
13
|
+
<span>{{ title ? title : "查看详情" }}</span>
|
|
57
14
|
<div class="header-right">
|
|
58
15
|
<div class="onload_btn" v-if="isDownload && isPc" @click="downLoad">
|
|
59
16
|
下载
|
|
60
17
|
</div>
|
|
61
|
-
<div class="summaryBtn"
|
|
62
|
-
:class="showSummary ? 'summaryActiveBtn' : ''"
|
|
63
|
-
@click="summaryFun"
|
|
64
|
-
v-if="isHasChat"
|
|
65
|
-
>
|
|
18
|
+
<div class="summaryBtn" :class="showSummary ? 'summaryActiveBtn' : ''" @click="summaryFun" v-if="isHasChat">
|
|
66
19
|
<i class="iconfont guoran-tongyichicun-write-29-jiqiren"></i>
|
|
67
20
|
<span>智能摘要</span>
|
|
68
21
|
</div>
|
|
@@ -83,16 +36,12 @@
|
|
|
83
36
|
</div>
|
|
84
37
|
<div id="drawer_content_pre">
|
|
85
38
|
<!-- :style="{marginTop:tagIds && tagIds.length != 0 && isPc ? '50px' : ''}" -->
|
|
86
|
-
<intelligent-summary
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
:knowledgeId="knowledgeId"
|
|
90
|
-
@closeSummary="closeSummary"
|
|
91
|
-
@recommendQues="recommendQues"
|
|
92
|
-
@getSummarySuccess="getSummarySuccess"
|
|
93
|
-
></intelligent-summary>
|
|
39
|
+
<intelligent-summary v-show="showSummary && isHasChat" :tagIds="tagIds" :knowledgeId="knowledgeId"
|
|
40
|
+
@closeSummary="closeSummary" @recommendQues="recommendQues"
|
|
41
|
+
@getSummarySuccess="getSummarySuccess"></intelligent-summary>
|
|
94
42
|
<div class="pdf_positon" :style="pdfStyle" v-if="tagIds && tagIds.length != 0 && drawer">
|
|
95
|
-
<pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :textWatermarkStr="textWatermarkStr"
|
|
43
|
+
<pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :textWatermarkStr="textWatermarkStr">
|
|
44
|
+
</pdfPosition>
|
|
96
45
|
</div>
|
|
97
46
|
<template v-else>
|
|
98
47
|
<div v-if="fileType == 'VIDEO'" style="width: 100%;">
|
|
@@ -102,16 +51,12 @@
|
|
|
102
51
|
<div class="preview_iframe_html" style="text-algin:left" v-html="fileText"></div>
|
|
103
52
|
</div>
|
|
104
53
|
<template v-else-if="url.includes('https://www') || url.includes('http://www')">
|
|
105
|
-
<iframe class="preview_iframe"
|
|
106
|
-
|
|
107
|
-
width="100%"
|
|
108
|
-
height="100%"
|
|
109
|
-
scrolling="100%"
|
|
110
|
-
frameborder="no"
|
|
111
|
-
border="0"></iframe>
|
|
54
|
+
<iframe class="preview_iframe" :src="url" width="100%" height="100%" scrolling="100%" frameborder="no"
|
|
55
|
+
border="0"></iframe>
|
|
112
56
|
</template>
|
|
113
57
|
<template v-else>
|
|
114
|
-
<iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;"
|
|
58
|
+
<iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;"
|
|
59
|
+
:style="{ height: iframeHeight }"></iframe>
|
|
115
60
|
</template>
|
|
116
61
|
</template>
|
|
117
62
|
<div class="mobile_onload_btn" v-if="isDownload && !isPc" @click="downLoad">
|
|
@@ -119,8 +64,8 @@
|
|
|
119
64
|
</div>
|
|
120
65
|
</div>
|
|
121
66
|
<div class="loading_img" v-show="loading">
|
|
122
|
-
|
|
123
|
-
|
|
67
|
+
<img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
|
|
68
|
+
</div>
|
|
124
69
|
</el-drawer>
|
|
125
70
|
</template>
|
|
126
71
|
|
|
@@ -129,321 +74,295 @@ import pdfPosition from './pdfPosition.vue'
|
|
|
129
74
|
import { zoomElement } from '../assets/js/hammer'
|
|
130
75
|
import IntelligentSummary from "./intelligentSummary";
|
|
131
76
|
import { isMobile } from "../assets/js/common";
|
|
132
|
-
import { Toast } from 'vant';
|
|
77
|
+
// import { Toast } from 'vant';
|
|
133
78
|
export default {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
79
|
+
data () {
|
|
80
|
+
return {
|
|
81
|
+
previewShowPopup: false,
|
|
82
|
+
fileText: '',
|
|
83
|
+
fileType: "",
|
|
84
|
+
isPc: false,
|
|
85
|
+
drawer: false,
|
|
86
|
+
tagIds: [],
|
|
87
|
+
// '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
|
|
88
|
+
loading: true,
|
|
89
|
+
previewKnowledgeId: "",
|
|
90
|
+
showSummary: true,
|
|
91
|
+
iframeHeight: "100%",
|
|
92
|
+
isDownload: false,
|
|
93
|
+
textWatermarkStr: ""
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
mounted () {
|
|
97
|
+
window.addEventListener('message', this.handleIframeMessage, false);
|
|
98
|
+
this.isPcFun();
|
|
99
|
+
},
|
|
100
|
+
props: {
|
|
101
|
+
url: {
|
|
102
|
+
type: String,
|
|
103
|
+
required: true,
|
|
150
104
|
},
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
105
|
+
officePreviewType: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: ''
|
|
154
108
|
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
default:false,
|
|
167
|
-
},
|
|
168
|
-
sourceFileType:{
|
|
169
|
-
type: String,
|
|
170
|
-
default: '',
|
|
171
|
-
},
|
|
172
|
-
title: {
|
|
173
|
-
type: String,
|
|
174
|
-
default: ''
|
|
175
|
-
},
|
|
176
|
-
isHasChat:{
|
|
177
|
-
type:Boolean,
|
|
178
|
-
default:false
|
|
179
|
-
},
|
|
180
|
-
knowledgeId:{
|
|
181
|
-
type: String,
|
|
182
|
-
default: '',
|
|
183
|
-
},
|
|
184
|
-
previewOssPath:{
|
|
185
|
-
type: String,
|
|
186
|
-
default: '',
|
|
187
|
-
}
|
|
109
|
+
isMessageRecord: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: false,
|
|
112
|
+
},
|
|
113
|
+
sourceFileType: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: '',
|
|
116
|
+
},
|
|
117
|
+
title: {
|
|
118
|
+
type: String,
|
|
119
|
+
default: ''
|
|
188
120
|
},
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
121
|
+
isHasChat: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
default: false
|
|
192
124
|
},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
125
|
+
knowledgeId: {
|
|
126
|
+
type: String,
|
|
127
|
+
default: '',
|
|
128
|
+
},
|
|
129
|
+
previewOssPath: {
|
|
130
|
+
type: String,
|
|
131
|
+
default: '',
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
components: {
|
|
135
|
+
IntelligentSummary,
|
|
136
|
+
pdfPosition
|
|
137
|
+
},
|
|
138
|
+
watch: {
|
|
139
|
+
drawer (value) {
|
|
140
|
+
if (value) {
|
|
141
|
+
this.$emit('open')
|
|
142
|
+
this.$nextTick(() => {
|
|
143
|
+
zoomElement(document.getElementById('drawer_content_pre'))
|
|
144
|
+
})
|
|
145
|
+
} else {
|
|
146
|
+
this.$emit('close')
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
showSummary: {
|
|
150
|
+
handler (val) {
|
|
151
|
+
// if (!val){
|
|
152
|
+
// this.$nextTick(() => {
|
|
153
|
+
// let preCon = document.querySelector('.pdf_view');
|
|
154
|
+
// if (preCon){
|
|
155
|
+
// preCon.style.height = 'calc(100% - ' + 50 + 'px)'
|
|
156
|
+
// }
|
|
157
|
+
// })
|
|
158
|
+
// } else {
|
|
159
|
+
// this.getSummarySuccess();
|
|
160
|
+
// }
|
|
161
|
+
if (val) {
|
|
162
|
+
this.getSummarySuccess();
|
|
202
163
|
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
// if (preCon){
|
|
210
|
-
// preCon.style.height = 'calc(100% - ' + 50 + 'px)'
|
|
211
|
-
// }
|
|
212
|
-
// })
|
|
213
|
-
// } else {
|
|
214
|
-
// this.getSummarySuccess();
|
|
215
|
-
// }
|
|
216
|
-
if(val) {
|
|
217
|
-
this.getSummarySuccess();
|
|
218
|
-
}
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
knowledgeId: {
|
|
167
|
+
handler (val) {
|
|
168
|
+
if (val) {
|
|
169
|
+
this.getTextWatermark();
|
|
219
170
|
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
computed: {
|
|
175
|
+
pdfStyle () {
|
|
176
|
+
return {
|
|
177
|
+
paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
|
|
178
|
+
paddingBottom: this.tagIds > 1 ? '60px' : '0',
|
|
179
|
+
height: '100%'
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
previewUrl () {
|
|
183
|
+
console.debug('VUE_APP_ENV', process.env.VUE_APP_ENV)
|
|
184
|
+
let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
|
|
185
|
+
// if(this.url != '') {
|
|
186
|
+
// if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
|
|
187
|
+
// url += btoa(encodeURIComponent(this.url))
|
|
188
|
+
// } else {
|
|
189
|
+
// url += btoa(this.url)
|
|
190
|
+
// }
|
|
191
|
+
// }
|
|
192
|
+
url = url + this.url
|
|
193
|
+
if (this.sourceFileType == '.ppt' || this.sourceFileType == '.pptx' || this.sourceFileType == '.pdf') {
|
|
194
|
+
url += '&officePreviewType=pdf'
|
|
195
|
+
}
|
|
196
|
+
console.log('textWatermarkStr 216', this.textWatermarkStr)
|
|
197
|
+
if (this.textWatermarkStr) {
|
|
198
|
+
url += '&textWatermarkValue=' + this.textWatermarkStr
|
|
199
|
+
}
|
|
200
|
+
return url
|
|
201
|
+
},
|
|
202
|
+
// fileType() {
|
|
203
|
+
// const fileType = this.url.substring(this.url.lastIndexOf('.'));
|
|
204
|
+
// if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
|
|
205
|
+
// return 'VIDEO'
|
|
206
|
+
// } else {
|
|
207
|
+
// return 'OTHER'
|
|
208
|
+
// }
|
|
209
|
+
|
|
210
|
+
// }
|
|
211
|
+
},
|
|
212
|
+
methods: {
|
|
213
|
+
close () {
|
|
214
|
+
setTimeout(() => {
|
|
215
|
+
this.previewShowPopup = false;
|
|
216
|
+
this.fileType = ''
|
|
217
|
+
}, 300)
|
|
218
|
+
this.drawer = false;
|
|
219
|
+
this.showSummary = false;
|
|
220
|
+
},
|
|
221
|
+
loadIframe () {
|
|
222
|
+
|
|
223
|
+
if (this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0)) {
|
|
224
|
+
this.loading = false
|
|
225
|
+
} else {
|
|
226
|
+
let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
|
|
227
|
+
if (iframe) {
|
|
228
|
+
iframe.onload = () => {
|
|
229
|
+
this.loading = false;
|
|
230
|
+
document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
|
|
225
231
|
}
|
|
226
232
|
}
|
|
233
|
+
// let time = setInterval(() =>{
|
|
234
|
+
//
|
|
235
|
+
// if(iframe) {
|
|
236
|
+
// this.loading = false
|
|
237
|
+
// clearInterval(time)
|
|
238
|
+
// }
|
|
239
|
+
// }, 500)
|
|
227
240
|
}
|
|
228
241
|
},
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
242
|
+
getBolb () {
|
|
243
|
+
this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false', {
|
|
244
|
+
fileInOssPath: this.url,
|
|
245
|
+
templateId: ''
|
|
246
|
+
}).then(res => {
|
|
247
|
+
if (res.data.code == 0) {
|
|
248
|
+
this.fileText = res.data.data
|
|
249
|
+
this.loading = false
|
|
250
|
+
}
|
|
251
|
+
})
|
|
252
|
+
},
|
|
253
|
+
previewToDialog (flag) {
|
|
254
|
+
this.$emit('previewToDialog', flag)
|
|
255
|
+
},
|
|
256
|
+
closeSummary () {
|
|
257
|
+
this.showSummary = false;
|
|
258
|
+
},
|
|
259
|
+
recommendQues (item, knowledgeId) {
|
|
260
|
+
console.log('recommendQues', item, knowledgeId);
|
|
261
|
+
this.$emit('recommendQues', item, knowledgeId)
|
|
262
|
+
},
|
|
263
|
+
handleIframeMessage (res) {
|
|
264
|
+
console.log('handleIframeMessage', res)
|
|
265
|
+
if (res.data.type == 'getViewerHeight') {
|
|
266
|
+
let iframeHeight = this.iframeHeight.replace('px', '')
|
|
267
|
+
if (res.data.data && iframeHeight != (res.data.data + 50)) {
|
|
268
|
+
this.iframeHeight = res.data.data + 50 + 'px'
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
summaryFun () {
|
|
273
|
+
this.showSummary = !this.showSummary;
|
|
274
|
+
if (this.showSummary) {
|
|
275
|
+
document.getElementById('drawer_content_pre').scrollTop = 0;
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
getSummarySuccess () {
|
|
279
|
+
this.$nextTick(() => {
|
|
280
|
+
// if (this.tagIds.length > 0){
|
|
281
|
+
// let intelligentSummary = document.getElementById('intelligentSummary');
|
|
282
|
+
// let preCon = document.querySelector('.pdf_view')
|
|
283
|
+
// if (intelligentSummary){
|
|
284
|
+
// let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
|
|
285
|
+
// if (preCon){
|
|
286
|
+
// preCon.style.height = 'calc(100% - ' + height + 'px)'
|
|
263
287
|
// }
|
|
264
|
-
|
|
288
|
+
// console.log('height',height,preCon)
|
|
289
|
+
// }
|
|
265
290
|
// }
|
|
291
|
+
// let intelligentSummary = document.getElementById('intelligentSummary');
|
|
292
|
+
// let height = intelligentSummary.offsetHeight
|
|
293
|
+
// this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
|
|
294
|
+
})
|
|
266
295
|
},
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
} else {
|
|
281
|
-
let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
|
|
282
|
-
if (iframe){
|
|
283
|
-
iframe.onload = () => {
|
|
284
|
-
this.loading = false;
|
|
285
|
-
document.getElementById('drawer_content_pre').style.backgroundImage = 'none'
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
// let time = setInterval(() =>{
|
|
289
|
-
//
|
|
290
|
-
// if(iframe) {
|
|
291
|
-
// this.loading = false
|
|
292
|
-
// clearInterval(time)
|
|
293
|
-
// }
|
|
294
|
-
// }, 500)
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
getBolb() {
|
|
298
|
-
this.$http.post('/knowledge-api/knowledge/htmlTextDeal?onlyText=false',{
|
|
299
|
-
fileInOssPath: this.url,
|
|
300
|
-
templateId: ''
|
|
301
|
-
}).then(res =>{
|
|
302
|
-
if (res.data.code == 0) {
|
|
303
|
-
this.fileText = res.data.data
|
|
304
|
-
this.loading = false
|
|
305
|
-
}
|
|
306
|
-
})
|
|
307
|
-
},
|
|
308
|
-
previewToDialog(flag){
|
|
309
|
-
this.$emit('previewToDialog',flag)
|
|
310
|
-
},
|
|
311
|
-
closeSummary(){
|
|
312
|
-
this.showSummary = false;
|
|
313
|
-
},
|
|
314
|
-
recommendQues(item,knowledgeId){
|
|
315
|
-
console.log('recommendQues',item,knowledgeId);
|
|
316
|
-
this.$emit('recommendQues',item,knowledgeId)
|
|
317
|
-
},
|
|
318
|
-
handleIframeMessage(res){
|
|
319
|
-
console.log('handleIframeMessage',res)
|
|
320
|
-
if (res.data.type == 'getViewerHeight'){
|
|
321
|
-
let iframeHeight = this.iframeHeight.replace('px','')
|
|
322
|
-
if (res.data.data && iframeHeight != (res.data.data + 50)){
|
|
323
|
-
this.iframeHeight = res.data.data + 50 + 'px'
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
summaryFun(){
|
|
328
|
-
this.showSummary = !this.showSummary;
|
|
329
|
-
if (this.showSummary){
|
|
330
|
-
document.getElementById('drawer_content_pre').scrollTop = 0;
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
getSummarySuccess(){
|
|
334
|
-
this.$nextTick(() => {
|
|
335
|
-
// if (this.tagIds.length > 0){
|
|
336
|
-
// let intelligentSummary = document.getElementById('intelligentSummary');
|
|
337
|
-
// let preCon = document.querySelector('.pdf_view')
|
|
338
|
-
// if (intelligentSummary){
|
|
339
|
-
// let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
|
|
340
|
-
// if (preCon){
|
|
341
|
-
// preCon.style.height = 'calc(100% - ' + height + 'px)'
|
|
342
|
-
// }
|
|
343
|
-
// console.log('height',height,preCon)
|
|
344
|
-
// }
|
|
345
|
-
// }
|
|
346
|
-
// let intelligentSummary = document.getElementById('intelligentSummary');
|
|
347
|
-
// let height = intelligentSummary.offsetHeight
|
|
348
|
-
// this.pdfStyle.height = 'calc(100% - ' + height + 'px)'
|
|
349
|
-
})
|
|
350
|
-
},
|
|
351
|
-
getTextWatermark(){
|
|
352
|
-
let url = '/knowledge-api/open/knowledge/getPermissionInfo';
|
|
353
|
-
let obj = {
|
|
354
|
-
"knowledgeId":this.knowledgeId,
|
|
355
|
-
"userId":sessionStorage.getItem('_currentUserId'),
|
|
356
|
-
"mainId":sessionStorage.getItem('_mainId'),
|
|
357
|
-
"corpId":sessionStorage.getItem('_corpid')
|
|
296
|
+
getTextWatermark () {
|
|
297
|
+
let url = '/knowledge-api/open/knowledge/getPermissionInfo';
|
|
298
|
+
let obj = {
|
|
299
|
+
"knowledgeId": this.knowledgeId,
|
|
300
|
+
"userId": sessionStorage.getItem('_currentUserId'),
|
|
301
|
+
"mainId": sessionStorage.getItem('_mainId'),
|
|
302
|
+
"corpId": sessionStorage.getItem('_corpid')
|
|
303
|
+
}
|
|
304
|
+
this.$http.post(url, obj).then(res => {
|
|
305
|
+
console.log('getTextWatermark', res.data.data)
|
|
306
|
+
if (res.data.data) {
|
|
307
|
+
this.textWatermarkStr = res.data.data.textWatermarkStr;
|
|
308
|
+
this.isDownload = res.data.data.showDownloadBtn;
|
|
358
309
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
url = decodeURIComponent(url)
|
|
310
|
+
})
|
|
311
|
+
},
|
|
312
|
+
downLoad () {
|
|
313
|
+
let url = this.previewOssPath
|
|
314
|
+
if (decodeURIComponent(url) != url) {
|
|
315
|
+
url = decodeURIComponent(url)
|
|
316
|
+
}
|
|
317
|
+
const fileType = url.substring(url.lastIndexOf('.'));
|
|
318
|
+
this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
|
|
319
|
+
headers: {
|
|
320
|
+
"Content-Type": "application/json",
|
|
371
321
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
setTimeout(() =>{
|
|
383
|
-
const range = document.createRange();
|
|
384
|
-
range.selectNode(document.getElementById('text'));
|
|
385
|
-
const selection = window.getSelection();
|
|
386
|
-
//移除之前选中内容
|
|
387
|
-
if (selection.rangeCount > 0) selection.removeAllRanges();
|
|
388
|
-
selection.addRange(range);
|
|
389
|
-
document.execCommand('copy');
|
|
390
|
-
selection.removeAllRanges()
|
|
391
|
-
Toast('下载地址已复制,请前往Safari浏览器访问下载');
|
|
392
|
-
this.close()
|
|
393
|
-
},100)
|
|
394
|
-
} else {
|
|
395
|
-
navigator.clipboard.writeText(res.data)
|
|
396
|
-
this.$message.success({
|
|
397
|
-
message:'下载地址已复制,请前往Safari浏览器访问下载',
|
|
398
|
-
})
|
|
322
|
+
}).then(res => {
|
|
323
|
+
console.log('downLoad 341', res)
|
|
324
|
+
if (res.data || res.bodyText) {
|
|
325
|
+
if (isMobile()) {
|
|
326
|
+
const iframe = document.createElement("iframe");
|
|
327
|
+
iframe.setAttribute("hidden", "hidden");
|
|
328
|
+
iframe.onload = () => {
|
|
329
|
+
if (iframe) {
|
|
330
|
+
console.log("iframe onload....")
|
|
331
|
+
iframe.setAttribute('src', 'about:blank');
|
|
399
332
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
iframe.setAttribute("hidden", "hidden");
|
|
409
|
-
iframe.onload = () => {
|
|
410
|
-
if (iframe) {
|
|
411
|
-
console.log("iframe onload....")
|
|
412
|
-
iframe.setAttribute('src', 'about:blank');
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
document.body.insertBefore(iframe, null);
|
|
416
|
-
iframe.setAttribute("src", res.data);
|
|
417
|
-
} else {
|
|
418
|
-
let a = document.createElement('a')
|
|
419
|
-
a.href = res.data
|
|
420
|
-
a.download = (this.title) + fileType
|
|
421
|
-
a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
|
|
422
|
-
}
|
|
423
|
-
this.close()
|
|
424
|
-
}
|
|
333
|
+
};
|
|
334
|
+
document.body.insertBefore(iframe, null);
|
|
335
|
+
iframe.setAttribute("src", res.data || res.bodyText);
|
|
336
|
+
} else {
|
|
337
|
+
let a = document.createElement('a')
|
|
338
|
+
a.href = res.data || res.bodyText
|
|
339
|
+
a.download = (this.title) + fileType
|
|
340
|
+
a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
|
|
425
341
|
}
|
|
426
|
-
|
|
427
|
-
},
|
|
428
|
-
isPcFun(){
|
|
429
|
-
if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
|
|
430
|
-
this.isPc = false
|
|
431
|
-
} else {
|
|
432
|
-
this.isPc = true
|
|
342
|
+
this.close()
|
|
433
343
|
}
|
|
434
|
-
}
|
|
344
|
+
})
|
|
435
345
|
},
|
|
436
|
-
|
|
437
|
-
|
|
346
|
+
isPcFun () {
|
|
347
|
+
if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
|
|
348
|
+
this.isPc = false
|
|
349
|
+
} else {
|
|
350
|
+
this.isPc = true
|
|
351
|
+
}
|
|
438
352
|
}
|
|
353
|
+
},
|
|
354
|
+
beforeDestroy () {
|
|
355
|
+
window.removeEventListener('message', this.handleIframeMessage);
|
|
356
|
+
}
|
|
439
357
|
}
|
|
440
358
|
</script>
|
|
441
359
|
|
|
442
360
|
<style lang="less" scoped>
|
|
443
|
-
#drawer_content_pre{
|
|
361
|
+
#drawer_content_pre {
|
|
444
362
|
padding: 20px;
|
|
445
363
|
scroll-behavior: smooth;
|
|
446
|
-
|
|
364
|
+
|
|
365
|
+
.mobile_onload_btn {
|
|
447
366
|
position: absolute;
|
|
448
367
|
right: 0;
|
|
449
368
|
bottom: 10%;
|
|
@@ -462,11 +381,13 @@ export default {
|
|
|
462
381
|
border-right: none;
|
|
463
382
|
text-align: center;
|
|
464
383
|
}
|
|
384
|
+
|
|
465
385
|
.pdf_positon {
|
|
466
386
|
width: 100%;
|
|
467
387
|
box-sizing: border-box;
|
|
468
388
|
}
|
|
469
389
|
}
|
|
390
|
+
|
|
470
391
|
.onload_btn {
|
|
471
392
|
width: 80px;
|
|
472
393
|
height: 26px;
|
|
@@ -480,79 +401,95 @@ export default {
|
|
|
480
401
|
background: #ffffff;
|
|
481
402
|
border: 1px solid #a1b9ff;
|
|
482
403
|
}
|
|
404
|
+
|
|
483
405
|
.preview_iframe {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
406
|
+
width: 100%;
|
|
407
|
+
height: 100%;
|
|
408
|
+
box-sizing: border-box;
|
|
409
|
+
background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
|
|
410
|
+
background-position: center;
|
|
411
|
+
background-size: 50px;
|
|
412
|
+
background-repeat: no-repeat;
|
|
491
413
|
}
|
|
492
|
-
|
|
414
|
+
|
|
415
|
+
.preview_iframe_kk {
|
|
493
416
|
width: 100%;
|
|
494
417
|
height: 100%;
|
|
495
418
|
}
|
|
496
|
-
|
|
419
|
+
|
|
420
|
+
.preview_iframe_html {
|
|
497
421
|
width: 100%;
|
|
498
422
|
height: 100%;
|
|
499
423
|
overflow-y: scroll;
|
|
500
424
|
text-align: left;
|
|
501
425
|
box-sizing: border-box;
|
|
502
426
|
padding: 16px;
|
|
503
|
-
|
|
427
|
+
|
|
428
|
+
/deep/.lake-content {
|
|
504
429
|
margin-left: 10px;
|
|
505
430
|
}
|
|
431
|
+
|
|
506
432
|
/deep/a:link {
|
|
507
|
-
color: #0000ee!important;
|
|
433
|
+
color: #0000ee !important;
|
|
508
434
|
}
|
|
435
|
+
|
|
509
436
|
/deep/a:visited {
|
|
510
|
-
color: #0000ee!important;
|
|
437
|
+
color: #0000ee !important;
|
|
511
438
|
}
|
|
439
|
+
|
|
512
440
|
/deep/a:hover {
|
|
513
|
-
color: #0000ee!important;
|
|
441
|
+
color: #0000ee !important;
|
|
514
442
|
}
|
|
443
|
+
|
|
515
444
|
/deep/a:active {
|
|
516
|
-
color: #0000ee!important;
|
|
445
|
+
color: #0000ee !important;
|
|
517
446
|
}
|
|
518
|
-
|
|
519
|
-
|
|
447
|
+
|
|
448
|
+
/deep/li:not(.rich-text-li),
|
|
449
|
+
ol:not(.list-paddingleft-2),
|
|
450
|
+
ul:not(.list-paddingleft-2) {
|
|
451
|
+
list-style-type: auto !important;
|
|
520
452
|
}
|
|
521
|
-
|
|
453
|
+
|
|
454
|
+
/deep/img {
|
|
522
455
|
width: 100%;
|
|
523
456
|
}
|
|
524
|
-
|
|
457
|
+
|
|
458
|
+
/deep/.ne-table {
|
|
525
459
|
width: 100% !important;
|
|
526
460
|
}
|
|
527
461
|
}
|
|
462
|
+
|
|
528
463
|
.footer {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
464
|
+
width: calc(100% - 40px);
|
|
465
|
+
height: 50px;
|
|
466
|
+
display: flex;
|
|
467
|
+
align-items: center;
|
|
468
|
+
justify-content: space-between;
|
|
469
|
+
cursor: pointer;
|
|
470
|
+
padding: 0 20px;
|
|
471
|
+
border-bottom: 1px solid #cccccc;
|
|
537
472
|
}
|
|
473
|
+
|
|
538
474
|
.loading_img {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
475
|
+
display: flex;
|
|
476
|
+
align-items: center;
|
|
477
|
+
justify-content: center;
|
|
478
|
+
width: 100%;
|
|
479
|
+
height: 100%;
|
|
480
|
+
position: absolute;
|
|
481
|
+
top: 0;
|
|
482
|
+
left: 0;
|
|
483
|
+
background: #FFF;
|
|
484
|
+
|
|
485
|
+
img {
|
|
486
|
+
width: 50px;
|
|
487
|
+
height: 50px;
|
|
488
|
+
}
|
|
552
489
|
}
|
|
553
490
|
|
|
554
|
-
.drawer-footer{
|
|
555
|
-
width:100%;
|
|
491
|
+
.drawer-footer {
|
|
492
|
+
width: 100%;
|
|
556
493
|
height: 50px;
|
|
557
494
|
display: flex;
|
|
558
495
|
align-items: center;
|
|
@@ -560,10 +497,12 @@ export default {
|
|
|
560
497
|
cursor: pointer;
|
|
561
498
|
padding: 0 20px;
|
|
562
499
|
border-bottom: 1px solid #cccccc;
|
|
563
|
-
|
|
500
|
+
|
|
501
|
+
.header-right {
|
|
564
502
|
display: flex;
|
|
565
503
|
align-items: center;
|
|
566
|
-
|
|
504
|
+
|
|
505
|
+
.summaryBtn {
|
|
567
506
|
flex: none;
|
|
568
507
|
//width: 95px;
|
|
569
508
|
height: 26px;
|
|
@@ -579,17 +518,20 @@ export default {
|
|
|
579
518
|
color: #366aff;
|
|
580
519
|
margin-right: 10px;
|
|
581
520
|
font-size: 14px;
|
|
521
|
+
|
|
582
522
|
i {
|
|
583
523
|
font-size: 18px;
|
|
584
524
|
margin: 0 5px;
|
|
585
525
|
}
|
|
586
526
|
}
|
|
587
|
-
|
|
527
|
+
|
|
528
|
+
.summaryActiveBtn {
|
|
588
529
|
background: #366aff !important;
|
|
589
530
|
color: #ffffff !important;
|
|
590
531
|
}
|
|
532
|
+
|
|
591
533
|
.chat {
|
|
592
|
-
flex:none;
|
|
534
|
+
flex: none;
|
|
593
535
|
width: 95px;
|
|
594
536
|
height: 26px;
|
|
595
537
|
background: #ffffff;
|
|
@@ -603,22 +545,27 @@ export default {
|
|
|
603
545
|
color: #366aff;
|
|
604
546
|
margin-right: 10px;
|
|
605
547
|
font-size: 14px;
|
|
548
|
+
|
|
606
549
|
i {
|
|
607
550
|
font-size: 16px;
|
|
608
551
|
margin: 0 5px;
|
|
609
552
|
}
|
|
610
553
|
}
|
|
554
|
+
|
|
611
555
|
.chat_active {
|
|
612
556
|
background: #366aff !important;
|
|
613
557
|
color: #FFFFFF !important;
|
|
614
558
|
}
|
|
615
559
|
}
|
|
616
560
|
}
|
|
561
|
+
|
|
617
562
|
@media screen and (max-width: 767px) {
|
|
618
|
-
|
|
619
|
-
|
|
563
|
+
|
|
564
|
+
/* 这里是针对移动设备的css样式设置 */
|
|
565
|
+
/deep/.el-drawer__body {
|
|
620
566
|
height: 100%;
|
|
621
567
|
}
|
|
568
|
+
|
|
622
569
|
#drawer_content_pre {
|
|
623
570
|
overflow: auto;
|
|
624
571
|
height: calc(100% - 50px);
|
|
@@ -629,11 +576,14 @@ export default {
|
|
|
629
576
|
background-repeat: no-repeat;
|
|
630
577
|
}
|
|
631
578
|
}
|
|
579
|
+
|
|
632
580
|
@media screen and (min-width: 768px) {
|
|
633
|
-
|
|
634
|
-
|
|
581
|
+
|
|
582
|
+
/* 这里是针对pc设备的css样式设置 */
|
|
583
|
+
/deep/.el-drawer__body {
|
|
635
584
|
height: 100%;
|
|
636
585
|
}
|
|
586
|
+
|
|
637
587
|
#drawer_content_pre {
|
|
638
588
|
overflow: auto;
|
|
639
589
|
height: calc(100% - 50px);
|
|
@@ -642,22 +592,25 @@ export default {
|
|
|
642
592
|
}
|
|
643
593
|
|
|
644
594
|
@media screen and (min-width: 1200px) {
|
|
645
|
-
|
|
595
|
+
|
|
596
|
+
/* 这里是针对pc设备的css样式设置 */
|
|
646
597
|
.el-drawer__wrapper {
|
|
647
598
|
width: 55%;
|
|
648
599
|
left: calc(100vw - 55%);
|
|
649
600
|
right: 0;
|
|
601
|
+
|
|
650
602
|
/deep/.pdf-preview-drawer {
|
|
651
603
|
width: 100% !important;
|
|
652
604
|
}
|
|
653
605
|
}
|
|
654
|
-
|
|
606
|
+
|
|
607
|
+
/deep/.el-drawer__body {
|
|
655
608
|
height: 100%;
|
|
656
609
|
}
|
|
610
|
+
|
|
657
611
|
#drawer_content_pre {
|
|
658
612
|
overflow: auto;
|
|
659
613
|
height: calc(100% - 50px);
|
|
660
614
|
background: #FFF;
|
|
661
615
|
}
|
|
662
|
-
}
|
|
663
|
-
</style>
|
|
616
|
+
}</style>
|