askbot-dragon 1.5.78-beta → 1.5.78

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