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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askbot-dragon",
3
- "version": "1.5.68",
3
+ "version": "1.5.69",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -5,64 +5,17 @@
5
5
  另外增加了在知识项目中预览当前文件的一些功能
6
6
  -->
7
7
  <template>
8
- <!-- <van-popup v-model="previewShowPopup" position="bottom" :style="{ height: '90%', background:'#FFFFFF'}" v-if="previewShowPopup">
9
- <div class="footer">
10
- <span>查看详情</span>
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
- v-show="showSummary && isHasChat"
88
- :tagIds="tagIds"
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"></pdfPosition>
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
- :src="url"
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;" :style="{height: iframeHeight}"></iframe>
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
- <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
123
- </div>
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
- data () {
135
- return {
136
- previewShowPopup: false,
137
- fileText:'',
138
- fileType:"",
139
- isPc:false,
140
- drawer:false,
141
- tagIds: [],
142
- // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
143
- loading:true,
144
- previewKnowledgeId:"",
145
- showSummary:true,
146
- iframeHeight:"100%",
147
- isDownload:false,
148
- textWatermarkStr:""
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
- mounted() {
152
- window.addEventListener('message',this.handleIframeMessage,false);
153
- this.isPcFun();
105
+ officePreviewType: {
106
+ type: String,
107
+ default: ''
154
108
  },
155
- props:{
156
- url:{
157
- type: String,
158
- required: true,
159
- },
160
- officePreviewType:{
161
- type: String,
162
- default: ''
163
- },
164
- isMessageRecord:{
165
- type: Boolean,
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
- components:{
190
- IntelligentSummary,
191
- pdfPosition
121
+ isHasChat: {
122
+ type: Boolean,
123
+ default: false
192
124
  },
193
- watch:{
194
- drawer(value) {
195
- if(value) {
196
- this.$emit('open')
197
- this.$nextTick(() =>{
198
- zoomElement(document.getElementById('drawer_content_pre'))
199
- })
200
- } else {
201
- this.$emit('close')
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
- showSummary:{
205
- handler(val){
206
- // if (!val){
207
- // this.$nextTick(() => {
208
- // let preCon = document.querySelector('.pdf_view');
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
- knowledgeId:{
222
- handler(val){
223
- if (val){
224
- this.getTextWatermark();
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
- computed:{
230
- pdfStyle() {
231
- return {
232
- paddingTop: this.isPc ? '30px' : '0', // 30px 是 加上外层的 20 流出 50的上边距展示 放大缩小操作栏
233
- paddingBottom: this.tagIds > 1 ? '60px' : '0',
234
- height: '100%'
235
- }
236
- },
237
- previewUrl() {
238
- console.debug('VUE_APP_ENV',process.env.VUE_APP_ENV)
239
- let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
240
- // if(this.url != '') {
241
- // if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
242
- // url += btoa(encodeURIComponent(this.url))
243
- // } else {
244
- // url += btoa(this.url)
245
- // }
246
- // }
247
- url = url + this.url
248
- if(this.sourceFileType == '.ppt' || this.sourceFileType == '.pptx' || this.sourceFileType == '.pdf') {
249
- url += '&officePreviewType=pdf'
250
- }
251
- console.log('textWatermarkStr 216',this.textWatermarkStr)
252
- if (this.textWatermarkStr){
253
- url += '&textWatermarkValue=' + this.textWatermarkStr
254
- }
255
- return url
256
- },
257
- // fileType() {
258
- // const fileType = this.url.substring(this.url.lastIndexOf('.'));
259
- // if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
260
- // return 'VIDEO'
261
- // } else {
262
- // return 'OTHER'
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
- methods :{
268
- close() {
269
- setTimeout(() =>{
270
- this.previewShowPopup = false;
271
- this.fileType = ''
272
- }, 300)
273
- this.drawer = false;
274
- this.showSummary = false;
275
- },
276
- loadIframe() {
277
-
278
- if(this.fileType == 'VIDEO' || this.fileType == 'WECHAT' || (this.tagIds && this.tagIds.length != 0)) {
279
- this.loading = false
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
- this.$http.post(url,obj).then(res => {
360
- console.log('getTextWatermark',res.data.data)
361
- if (res.data.data){
362
- this.textWatermarkStr = res.data.data.textWatermarkStr;
363
- this.isDownload = res.data.data.showDownloadBtn;
364
- }
365
- })
366
- },
367
- downLoad () {
368
- let url = this.previewOssPath
369
- if (decodeURIComponent(url) != url) {
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
- const fileType = url.substring(url.lastIndexOf('.'));
373
- this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
374
- headers:{
375
- "Content-Type": "application/json",
376
- }
377
- }).then(res => {
378
- console.log('downLoad 341',res)
379
- if (res.data) {
380
- if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
381
- if(isMobile()) {
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
- return
401
- } else {
402
- // setTimeout(() =>{
403
- // window.open(res.data,'下载', 'noopener')
404
- // }, 2000)
405
- // window.open(res.data,'下载', 'noopener')
406
- if(isMobile()) {
407
- const iframe = document.createElement("iframe");
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
- beforeDestroy() {
437
- window.removeEventListener('message', this.handleIframeMessage);
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
- .mobile_onload_btn{
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
- width: 100%;
485
- height: 100%;
486
- box-sizing: border-box;
487
- background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
488
- background-position: center;
489
- background-size: 50px;
490
- background-repeat: no-repeat;
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
- .preview_iframe_kk{
414
+
415
+ .preview_iframe_kk {
493
416
  width: 100%;
494
417
  height: 100%;
495
418
  }
496
- .preview_iframe_html{
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
- /deep/.lake-content{
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
- /deep/li:not(.rich-text-li), ol:not(.list-paddingleft-2), ul:not(.list-paddingleft-2){
519
- list-style-type: auto!important;
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
- /deep/img{
453
+
454
+ /deep/img {
522
455
  width: 100%;
523
456
  }
524
- /deep/.ne-table{
457
+
458
+ /deep/.ne-table {
525
459
  width: 100% !important;
526
460
  }
527
461
  }
462
+
528
463
  .footer {
529
- width: calc(100% - 40px);
530
- height: 50px;
531
- display: flex;
532
- align-items: center;
533
- justify-content: space-between;
534
- cursor: pointer;
535
- padding: 0 20px;
536
- border-bottom: 1px solid #cccccc;
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
- display: flex;
540
- align-items: center;
541
- justify-content: center;
542
- width: 100%;
543
- height: 100%;
544
- position: absolute;
545
- top: 0;
546
- left: 0;
547
- background: #FFF;
548
- img {
549
- width: 50px;
550
- height: 50px;
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
- .header-right{
500
+
501
+ .header-right {
564
502
  display: flex;
565
503
  align-items: center;
566
- .summaryBtn{
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
- .summaryActiveBtn{
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
- /* 这里是针对移动设备的css样式设置 */
619
- /deep/.el-drawer__body{
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
- /* 这里是针对pc设备的css样式设置 */
634
- /deep/.el-drawer__body{
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
- /* 这里是针对pc设备的css样式设置 */
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
- /deep/.el-drawer__body{
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>