askbot-dragon 88.0.10 → 88.0.12

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": "88.0.10",
3
+ "version": "88.0.12",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
@@ -70,7 +70,182 @@ let imageTypeObj = {
70
70
  aiv: "video",
71
71
  news:"news"
72
72
  }
73
+ function newInitWaterMark(elId, textValue) {
74
+ //默认设置
75
+ var defaultSettings = {
73
76
 
77
+ watermark_txt: "",
78
+
79
+ visitorWatermark_txt: "",
80
+
81
+ watermark_x: 0, //水印起始位置x轴坐标
82
+
83
+ watermark_y: 0, //水印起始位置Y轴坐标
84
+
85
+ watermark_rows: 0, //水印行数
86
+
87
+ watermark_cols: 0, //水印列数
88
+
89
+ watermark_x_space: 40, //水印x轴间隔
90
+
91
+ watermark_y_space: 60, //水印y轴间隔
92
+
93
+ watermark_color: "black", //水印字体颜色
94
+
95
+ watermark_alpha: 0.3, //水印透明度
96
+
97
+ watermark_fontsize: "12px", //水印字体大小
98
+
99
+ watermark_font: "微软雅黑", //水印字体
100
+
101
+ watermark_width: 100, //水印宽度
102
+
103
+ watermark_height: 60, //水印长度
104
+
105
+ watermark_angle: 20 //水印倾斜度数
106
+
107
+ };
108
+ let textWatermarkValue = textValue;
109
+ if (textWatermarkValue) {
110
+ defaultSettings.watermark_txt = textWatermarkValue;
111
+ }
112
+ if (!textWatermarkValue) {
113
+ return;
114
+ }
115
+
116
+ //采用配置项替换默认值,作用类似jquery.extend
117
+
118
+ if (arguments.length === 1 && typeof arguments[0] === "object") {
119
+
120
+ // 获取参数配置
121
+
122
+ var src = arguments[0];
123
+
124
+ for (let key in src) {
125
+
126
+ if (src[key] && defaultSettings[key] && src[key] === defaultSettings[key])
127
+
128
+ continue;
129
+
130
+ else if (src[key])
131
+
132
+ defaultSettings[key] = src[key];
133
+
134
+ }
135
+
136
+ }
137
+
138
+ var oTemp = document.createDocumentFragment();
139
+
140
+ //获取页面最大宽度
141
+
142
+ var page_width = Math.max(document.getElementById(elId).scrollWidth, document.getElementById(elId).clientWidth);
143
+
144
+ var cutWidth = page_width * 0.0150;
145
+
146
+ page_width = page_width - cutWidth;
147
+
148
+ //获取页面最大高度
149
+ var page_height = document.getElementById(elId).scrollHeight;
150
+ console.log('page_height',page_height, page_width);
151
+
152
+ // var page_height = Math.max(document.body.scrollHeight, document.body.clientHeight);
153
+
154
+ // var page_height = document.body.scrollHeight+document.body.scrollTop;
155
+
156
+ //如果将水印列数设置为0,或水印列数设置过大,超过页面最大宽度,则重新计算水印列数和水印x轴间隔
157
+
158
+ if (defaultSettings.watermark_cols == 0 || (parseInt(defaultSettings.watermark_x + defaultSettings
159
+
160
+ .watermark_width * defaultSettings.watermark_cols + defaultSettings.watermark_x_space * (
161
+
162
+ defaultSettings.watermark_cols - 1)) > page_width)) {
163
+
164
+ defaultSettings.watermark_cols = parseInt((page_width - defaultSettings.watermark_x + defaultSettings
165
+
166
+ .watermark_x_space) / (defaultSettings.watermark_width + defaultSettings
167
+
168
+ .watermark_x_space));
169
+
170
+ defaultSettings.watermark_x_space = parseInt((page_width - defaultSettings.watermark_x -
171
+
172
+ defaultSettings
173
+
174
+ .watermark_width * defaultSettings.watermark_cols) / (defaultSettings.watermark_cols - 1));
175
+
176
+ }
177
+
178
+ //如果将水印行数设置为0,或水印行数设置过大,超过页面最大长度,则重新计算水印行数和水印y轴间隔
179
+
180
+ if (defaultSettings.watermark_rows == 0 || (parseInt(defaultSettings.watermark_y + defaultSettings
181
+
182
+ .watermark_height * defaultSettings.watermark_rows + defaultSettings.watermark_y_space * (
183
+
184
+ defaultSettings.watermark_rows - 1)) > page_height)) {
185
+
186
+ defaultSettings.watermark_rows = parseInt((defaultSettings.watermark_y_space + page_height -
187
+
188
+ defaultSettings
189
+
190
+ .watermark_y) / (defaultSettings.watermark_height + defaultSettings.watermark_y_space));
191
+
192
+ defaultSettings.watermark_y_space = parseInt(((page_height - defaultSettings.watermark_y) -
193
+
194
+ defaultSettings
195
+
196
+ .watermark_height * defaultSettings.watermark_rows) / (defaultSettings.watermark_rows - 1));
197
+
198
+ }
199
+
200
+ var x;
201
+ var y;
202
+ for (var i = 0; i < defaultSettings.watermark_rows; i++) {
203
+ y = defaultSettings.watermark_y + (defaultSettings.watermark_y_space + defaultSettings.watermark_height) * i;
204
+ for (var j = 0; j < defaultSettings.watermark_cols; j++) {
205
+ x = defaultSettings.watermark_x + (defaultSettings.watermark_width + defaultSettings.watermark_x_space) * j;
206
+ var mask_div = document.createElement("div");
207
+
208
+ mask_div.id = "mask_div" + i + j;
209
+ mask_div.className = "mask_div";
210
+ mask_div.style.webkitTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
211
+ mask_div.style.MozTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
212
+ mask_div.style.msTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
213
+ mask_div.style.OTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
214
+ mask_div.style.transform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
215
+ mask_div.style.visibility = "";
216
+ mask_div.style.position = "absolute";
217
+ //奇偶行错开,这样水印就不对齐,显的不呆板
218
+ mask_div.style.left = x + 20 + "px";
219
+ mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
220
+
221
+ mask_div.style.top = y + 10 + "px";
222
+
223
+ mask_div.style.overflow = "hidden";
224
+
225
+ mask_div.style.pointerEvents = "none"; //让水印不遮挡页面的点击事件
226
+
227
+ mask_div.style.opacity = defaultSettings.watermark_alpha;
228
+
229
+ mask_div.style.fontSize = defaultSettings.watermark_fontsize;
230
+
231
+ mask_div.style.fontFamily = defaultSettings.watermark_font;
232
+
233
+ mask_div.style.color = defaultSettings.watermark_color;
234
+
235
+ mask_div.style.textAlign = "center";
236
+
237
+ mask_div.style.width = defaultSettings.watermark_width + "px";
238
+
239
+ mask_div.style.height = defaultSettings.watermark_width + "px";
240
+
241
+ mask_div.style.display = "block";
242
+
243
+ oTemp.appendChild(mask_div);
244
+ }
245
+ }
246
+ document.getElementById(elId).appendChild(oTemp);
247
+ }
74
248
  export {
75
- imageTypeObj
249
+ imageTypeObj,
250
+ newInitWaterMark
76
251
  }
@@ -99,6 +99,7 @@
99
99
  </div>
100
100
  <previewPdf ref="previewPdf"
101
101
  :url="previewHref"
102
+ :previewOssPath="previewOssPath"
102
103
  :title="title" :sourceFileType="sourceFileType"
103
104
  officePreviewType="pdf"
104
105
  @previewToDialog="previewToDialog"
@@ -203,7 +204,8 @@ export default {
203
204
  loadMoreFlag: false,
204
205
  previewKnowledgeId:"",
205
206
  previewKnowledge:{},
206
- title:''
207
+ title:'',
208
+ previewOssPath:""
207
209
  }
208
210
  },
209
211
  props: ['msg', 'isAskLightning', 'isMessageRecord', "isApp","isHasChat","activeKnowledgeId"],
@@ -285,6 +287,7 @@ export default {
285
287
  this.previewKnowledgeId = item.knowledgeId
286
288
  this.$refs.previewPdf.previewShowPopup = false;
287
289
  this.$refs.previewPdf.drawer = false;
290
+ this.previewOssPath = url;
288
291
  let index = url.lastIndexOf('?')
289
292
  let type = ''
290
293
  let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate'
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="pdf_view" ref="pdfView" @scroll="pdfScroll" :style="{
2
+ <div class="pdf_view" id="pdf_view" :style="{
3
3
  marginTop: isPC ? '50px' : '',
4
4
  marginBottom: tagIds.length > 1 ? '60px' : '0px',
5
5
  height: setHeight
@@ -17,6 +17,7 @@
17
17
  </el-option>
18
18
  </el-select>
19
19
  </div>
20
+ <div class="pdf_container_view" id="pdf_container_view" @scroll="pdfScroll" ref="pdfView"></div>
20
21
  <div class="btn_footer" v-if="tagIds.length > 1 && !isPC">
21
22
  <div class="prev" @click="prev">上一段</div>
22
23
  <div class="next" @click="next">下一段</div>
@@ -32,6 +33,7 @@
32
33
 
33
34
  <script>
34
35
  import _ from 'lodash'
36
+ import { newInitWaterMark } from "../assets/js/common";
35
37
  // import * as pdfjsLib from 'pdfjs-dist'
36
38
  // pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdfjs-dist/build/pdf.worker';
37
39
  // import { TextLayerBuilder } from "pdfjs-dist/web/pdf_viewer";
@@ -47,7 +49,7 @@ const { TextLayerBuilder } = window['pdfjs-dist/web/pdf_viewer']
47
49
  // import { zoomElement } from '../assets/js/hammer'
48
50
  export default {
49
51
  name: 'pdfView',
50
- props: ['tagIds', 'isMessageRecord'],
52
+ props: ['tagIds', 'isMessageRecord','textWatermarkStr'],
51
53
  data () {
52
54
  return {
53
55
  url: '',
@@ -258,6 +260,9 @@ export default {
258
260
  this.contentView.style.paddingBottom = '60px'
259
261
  // contentView.style.overflowY = 'auto'
260
262
  this.$refs.pdfView.appendChild(this.contentView);
263
+ if (this.textWatermarkStr){
264
+ newInitWaterMark('pdf_container_view',this.textWatermarkStr)
265
+ }
261
266
  }
262
267
  this.renderPages(pageIndex)
263
268
  },
@@ -872,6 +877,7 @@ export default {
872
877
  // 在 pdf_view 下创建 所有canvs的容器
873
878
  this.contentView = document.createElement('div')
874
879
  this.contentView.style.transformOrigin = '0px 0px 0px'
880
+ this.contentView.setAttribute('id','contentView');
875
881
  this.$http.get('/knowledge-api/knowledge/knowledge-part-location-info/list?ids=' + value.join(',')).then(res => {
876
882
  // res.data = {"data":[{"id":"64591b7d8bb8ab1b91c65f24","knowledgeId":"64591a9c8da27649473f3b4b","mainId":"fb348d095c0b4fd7bbd37826563dac7d","page":3,"total":18,"pageHeight":540.0,"pageWidth":960.00946,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/11/55/18/64591b638bb8ab1b91c65eed/3.pdf","extractInfo":{"location":[280.488,161.32,398.71573,61.99298],"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距北京市区65公里,是以奇而著称,融山川、碧水、古长城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","lines":[{"content":"黄花城水长城旅游区位于北京市怀柔区九渡河镇境内,距","location":[280.488,161.32,398.71573,15.9869995]},{"content":"北京市区65公里,是以奇而著称,融山川、碧水、古长","location":[283.691,184.30899,392.3055,15.9869995]},{"content":"城为一体的旅游休闲胜地。而这里的“三绝景”更是引人入","location":[282.699,207.32599,394.3033,15.9869995]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
877
883
  // res.data = {"data":[{"id":"64590ce1eb1320043401cc90","knowledgeId":"64590cd5017b461d67e282e1","mainId":"fb348d095c0b4fd7bbd37826563dac7d","page":2,"total":5,"pageHeight":841.8898,"pageWidth":595.30396,"publicPageFileUrl":"https://askbot-pdf-all.oss-cn-zhangjiakou.aliyuncs.com/fb348d095c0b4fd7bbd37826563dac7d/2023/05/08/10/53/20/64590ce0eb1320043401cc7b/2.pdf","extractInfo":{"location":[89.32981,638.1907,415.15512,98.63251],"content":":北京地铁 13\r号线 :藤黄\r色 :西直门站—\r东直门站 :17 :41.\r5 :6\r准\rB :2002年\r09月\r28日 ","lines":[{"content":":北京地铁 13\r号线 ","location":[89.32981,638.1907,99.44599,98.63251]},{"content":":藤黄\r色 ","location":[188.7758,638.1907,46.79959,98.63251]},{"content":":西直门站—\r东直门站 ","location":[235.5754,638.1907,86.09996,98.63251]},{"content":":17 ","location":[321.67535,638.1907,36.200012,98.63251]},{"content":":41.\r5 ","location":[357.87537,638.1907,39.400696,98.63251]},{"content":":6\r准\rB ","location":[397.27606,638.1907,41.099,98.63251]},{"content":":2002年\r09月\r28日 ","location":[438.37506,638.1907,66.10986,98.63251]}],"tagId":null}}],"code":"0","msg":null,"traceId":null}
@@ -1038,9 +1044,9 @@ export default {
1038
1044
  // tagIds 会按照gpt识别的生成有序的数组,前端直接按照下标的顺序取就可以了
1039
1045
  // 缓存拿到的所有数据
1040
1046
  this.cachePdf = res.data.data
1041
- let publicPageFileUrl = res.data.data[0].publicPageFileUrl
1047
+ let publicPageFileUrl = res.data.data && res.data.data[0] ? res.data.data[0].publicPageFileUrl : ''
1042
1048
  this.currentPage = 0
1043
- if (publicPageFileUrl.substring(publicPageFileUrl.lastIndexOf('.')) === '.pdf') {
1049
+ if (publicPageFileUrl && publicPageFileUrl.substring(publicPageFileUrl.lastIndexOf('.')) === '.pdf') {
1044
1050
  this.preViewType = 'pdf'
1045
1051
  this.setPageAllLine(this.cachePdf)
1046
1052
  this.getpdfResloutePage(res.data.data[0])
@@ -1302,6 +1308,12 @@ export default {
1302
1308
  background: rgba(221, 222, 223, 1);
1303
1309
  }
1304
1310
  }
1311
+ .pdf_container_view{
1312
+ height: 100%;
1313
+ width: 100%;
1314
+ position: relative;
1315
+ overflow: auto;
1316
+ }
1305
1317
  }
1306
1318
  </style>
1307
1319
  <style lang="less">
@@ -1,4 +1,9 @@
1
+ <!-- preview-document
2
+ 组件主要负责 富文本中配置的链接,图片 及上传附件下的附件列表中的单纯预览
3
+ 走的是kkview项目预览或者iframe直接打开文件地址,不对预览文件解析不包含其他功能开发
4
+ -->
1
5
  <template>
6
+
2
7
  <div class="previewDoc">
3
8
  <div class="footer">
4
9
  <span>查看详情</span>
@@ -1,3 +1,9 @@
1
+
2
+ <!-- preview-pdf
3
+ 组件主要负责 知识项目中 文件的预览,携带定位信息参数 tagIds tagId 的会解析文件增加定位功能
4
+ 不携带定位信息的 也是走 kkview项目预览
5
+ 另外增加了在知识项目中预览当前文件的一些功能
6
+ -->
1
7
  <template>
2
8
  <!-- <van-popup v-model="previewShowPopup" position="bottom" :style="{ height: '90%', background:'#FFFFFF'}" v-if="previewShowPopup">
3
9
  <div class="footer">
@@ -49,6 +55,9 @@
49
55
  <div class="drawer-footer">
50
56
  <span>{{title ? title : "查看详情"}}</span>
51
57
  <div class="header-right">
58
+ <div class="onload_btn" v-if="isDownload && isPc" @click="downLoad">
59
+ 下载
60
+ </div>
52
61
  <div class="summaryBtn"
53
62
  :class="showSummary ? 'summaryActiveBtn' : ''"
54
63
  @click="summaryFun"
@@ -74,15 +83,15 @@
74
83
  </div>
75
84
  <div id="drawer_content_pre">
76
85
  <intelligent-summary
77
- v-show="showSummary"
86
+ v-show="showSummary && isHasChat"
78
87
  :knowledgeId="knowledgeId"
79
88
  @closeSummary="closeSummary"
80
89
  @recommendQues="recommendQues"
81
90
  @getSummarySuccess="getSummarySuccess"
82
- :style="{marginTop:tagIds && tagIds.length != 0 ? '50px' : ''}"
91
+ :style="{marginTop:tagIds && tagIds.length != 0 && isPc ? '50px' : ''}"
83
92
  ></intelligent-summary>
84
93
  <template v-if="tagIds && tagIds.length != 0 && drawer">
85
- <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord"></pdfPosition>
94
+ <pdfPosition :tagIds="tagIds" :isMessageRecord="isMessageRecord" :textWatermarkStr="textWatermarkStr"></pdfPosition>
86
95
  </template>
87
96
  <template v-else>
88
97
  <div v-if="fileType == 'VIDEO'" style="width: 100%;">
@@ -104,6 +113,9 @@
104
113
  <iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;" :style="{height: iframeHeight}"></iframe>
105
114
  </template>
106
115
  </template>
116
+ <div class="mobile_onload_btn" v-if="isDownload && !isPc" @click="downLoad">
117
+ 下载
118
+ </div>
107
119
  </div>
108
120
  <div class="loading_img" v-show="loading">
109
121
  <img src="https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif" alt="">
@@ -115,24 +127,29 @@
115
127
  import pdfPosition from './pdfPosition.vue'
116
128
  import { zoomElement } from '../assets/js/hammer'
117
129
  import IntelligentSummary from "./intelligentSummary";
130
+ import { isMobile } from "../assets/js/common";
131
+ import { Toast } from 'vant';
118
132
  export default {
119
133
  data () {
120
134
  return {
121
135
  previewShowPopup: false,
122
136
  fileText:'',
123
137
  fileType:"",
124
- isPc:true,
138
+ isPc:false,
125
139
  drawer:false,
126
140
  tagIds: [],
127
141
  // '6454aa1a70573a6ead6f0f7d', '6454aa1a70573a6ead6f0f81',
128
142
  loading:true,
129
143
  previewKnowledgeId:"",
130
144
  showSummary:true,
131
- iframeHeight:"100%"
145
+ iframeHeight:"100%",
146
+ isDownload:false,
147
+ textWatermarkStr:""
132
148
  }
133
149
  },
134
150
  mounted() {
135
- window.addEventListener('message',this.handleIframeMessage,false)
151
+ window.addEventListener('message',this.handleIframeMessage,false);
152
+ this.isPcFun();
136
153
  },
137
154
  props:{
138
155
  url:{
@@ -162,6 +179,10 @@ export default {
162
179
  knowledgeId:{
163
180
  type: String,
164
181
  default: '',
182
+ },
183
+ previewOssPath:{
184
+ type: String,
185
+ default: '',
165
186
  }
166
187
  },
167
188
  components:{
@@ -189,6 +210,13 @@ export default {
189
210
  this.getSummarySuccess();
190
211
  }
191
212
  }
213
+ },
214
+ knowledgeId:{
215
+ handler(val){
216
+ if (val){
217
+ this.getTextWatermark();
218
+ }
219
+ }
192
220
  }
193
221
  },
194
222
  computed:{
@@ -206,6 +234,10 @@ export default {
206
234
  if(this.sourceFileType == '.ppt' || this.sourceFileType == '.pptx' || this.sourceFileType == '.pdf') {
207
235
  url += '&officePreviewType=pdf'
208
236
  }
237
+ console.log('textWatermarkStr 216',this.textWatermarkStr)
238
+ if (this.textWatermarkStr){
239
+ url += '&textWatermarkValue=' + this.textWatermarkStr
240
+ }
209
241
  return url
210
242
  },
211
243
  // fileType() {
@@ -289,9 +321,8 @@ export default {
289
321
  if (this.tagIds.length > 0){
290
322
  let intelligentSummary = document.getElementById('intelligentSummary');
291
323
  let preCon = document.querySelector('.pdf_view')
292
- console.log('intelligentSummary',preCon,intelligentSummary)
293
324
  if (intelligentSummary){
294
- let height = intelligentSummary.offsetHeight + 100;
325
+ let height = intelligentSummary.offsetHeight + (this.isPc ? 100 : 50 );
295
326
  if (preCon){
296
327
  preCon.style.height = 'calc(100% - ' + height + 'px)'
297
328
  }
@@ -300,6 +331,90 @@ export default {
300
331
  }
301
332
  })
302
333
  },
334
+ getTextWatermark(){
335
+ let url = '/knowledge-api/open/knowledge/getPermissionInfo';
336
+ let obj = {
337
+ "knowledgeId":this.knowledgeId,
338
+ "userId":sessionStorage.getItem('_currentUserId'),
339
+ "mainId":sessionStorage.getItem('_mainId'),
340
+ "corpId":sessionStorage.getItem('_corpid')
341
+ }
342
+ this.$http.post(url,obj).then(res => {
343
+ console.log('getTextWatermark',res.data.data)
344
+ if (res.data.data){
345
+ this.textWatermarkStr = res.data.data.textWatermarkStr;
346
+ this.isDownload = res.data.data.showDownloadBtn;
347
+ }
348
+ })
349
+ },
350
+ downLoad () {
351
+ let url = this.previewOssPath
352
+ if (decodeURIComponent(url) != url) {
353
+ url = decodeURIComponent(url)
354
+ }
355
+ const fileType = url.substring(url.lastIndexOf('.'));
356
+ this.$http.post('/knowledge-api/temporary-certificate/or-origin?expired=10', url, {
357
+ headers:{
358
+ "Content-Type": "application/json",
359
+ }
360
+ }).then(res => {
361
+ console.log('downLoad 341',res)
362
+ if (res.data) {
363
+ if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
364
+ if(isMobile()) {
365
+ setTimeout(() =>{
366
+ const range = document.createRange();
367
+ range.selectNode(document.getElementById('text'));
368
+ const selection = window.getSelection();
369
+ //移除之前选中内容
370
+ if (selection.rangeCount > 0) selection.removeAllRanges();
371
+ selection.addRange(range);
372
+ document.execCommand('copy');
373
+ selection.removeAllRanges()
374
+ Toast('下载地址已复制,请前往Safari浏览器访问下载');
375
+ this.close()
376
+ },100)
377
+ } else {
378
+ navigator.clipboard.writeText(res.data)
379
+ this.$message.success({
380
+ message:'下载地址已复制,请前往Safari浏览器访问下载',
381
+ })
382
+ }
383
+ return
384
+ } else {
385
+ // setTimeout(() =>{
386
+ // window.open(res.data,'下载', 'noopener')
387
+ // }, 2000)
388
+ // window.open(res.data,'下载', 'noopener')
389
+ if(isMobile()) {
390
+ const iframe = document.createElement("iframe");
391
+ iframe.setAttribute("hidden", "hidden");
392
+ iframe.onload = () => {
393
+ if (iframe) {
394
+ console.log("iframe onload....")
395
+ iframe.setAttribute('src', 'about:blank');
396
+ }
397
+ };
398
+ document.body.insertBefore(iframe, null);
399
+ iframe.setAttribute("src", res.data);
400
+ } else {
401
+ let a = document.createElement('a')
402
+ a.href = res.data
403
+ a.download = (this.title) + fileType
404
+ a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
405
+ }
406
+ this.close()
407
+ }
408
+ }
409
+ })
410
+ },
411
+ isPcFun(){
412
+ if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
413
+ this.isPc = false
414
+ } else {
415
+ this.isPc = true
416
+ }
417
+ }
303
418
  },
304
419
  beforeDestroy() {
305
420
  window.removeEventListener('message', this.handleIframeMessage);
@@ -311,6 +426,38 @@ export default {
311
426
  #drawer_content_pre{
312
427
  padding: 20px;
313
428
  scroll-behavior: smooth;
429
+ .mobile_onload_btn{
430
+ position: absolute;
431
+ right: 0;
432
+ bottom: 10%;
433
+ width: 20px;
434
+ height: 60px;
435
+ display: flex;
436
+ align-items: center;
437
+ justify-content: center;
438
+ cursor: pointer;
439
+ border-top-left-radius: 10px;
440
+ border-bottom-left-radius: 10px;
441
+ color: #366aff;
442
+ background: #ffffff;
443
+ border: 1px solid #a1b9ff;
444
+ font-size: 12px;
445
+ border-right: none;
446
+ text-align: center;
447
+ }
448
+ }
449
+ .onload_btn {
450
+ width: 80px;
451
+ height: 26px;
452
+ display: flex;
453
+ align-items: center;
454
+ justify-content: center;
455
+ cursor: pointer;
456
+ margin-right: 10px;
457
+ border-radius: 15px;
458
+ color: #366aff;
459
+ background: #ffffff;
460
+ border: 1px solid #a1b9ff;
314
461
  }
315
462
  .preview_iframe {
316
463
  width: 100%;
@@ -36,6 +36,7 @@
36
36
  </div>
37
37
  <previewPdf ref="previewPdf"
38
38
  :url="previewHref"
39
+ :previewOssPath="previewOssPath"
39
40
  :sourceFileType="sourceFileType"
40
41
  officePreviewType="pdf"
41
42
  @previewToDialog="previewToDialog"
@@ -97,7 +98,8 @@ export default {
97
98
  sourceFileType: '',
98
99
  page: 1,
99
100
  previewKnowledgeId:"",
100
- previewKnowledge:{}
101
+ previewKnowledge:{},
102
+ previewOssPath:""
101
103
  }
102
104
  },
103
105
  components: {
@@ -116,6 +118,7 @@ export default {
116
118
  this.previewKnowledgeId = item.knowledgeId
117
119
  this.$refs.previewPdf.previewShowPopup = false;
118
120
  this.$refs.previewPdf.drawer = false;
121
+ this.previewOssPath = item.url;
119
122
  let index = item.url.lastIndexOf('?')
120
123
  let type = ''
121
124
  let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate'