askbot-dragon 1.6.23-beta → 1.6.24-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
border="0"></iframe>
|
|
74
74
|
</template>
|
|
75
75
|
<template v-else>
|
|
76
|
-
<iframe class="
|
|
76
|
+
<iframe class="preview_iframe_kk" :src="previewUrl" style="border:none;"></iframe>
|
|
77
77
|
</template>
|
|
78
78
|
</template>
|
|
79
79
|
</div>
|
|
@@ -189,7 +189,7 @@ export default {
|
|
|
189
189
|
this.loading = false
|
|
190
190
|
} else {
|
|
191
191
|
let time = setInterval(() =>{
|
|
192
|
-
let iframe = document.getElementsByClassName('preview_iframe')[0]
|
|
192
|
+
let iframe = document.getElementsByClassName('preview_iframe')[0] || document.getElementsByClassName('preview_iframe_kk')[0];
|
|
193
193
|
if(iframe) {
|
|
194
194
|
this.loading = false
|
|
195
195
|
clearInterval(time)
|
|
@@ -215,13 +215,17 @@ export default {
|
|
|
215
215
|
<style lang="less" scoped>
|
|
216
216
|
.preview_iframe {
|
|
217
217
|
width: 100%;
|
|
218
|
-
height:
|
|
218
|
+
height: 100%;
|
|
219
219
|
box-sizing: border-box;
|
|
220
220
|
background-image: url('https://guoranopen-zjk.oss-cn-zhangjiakou.aliyuncs.com/cdn-common/images/loading.gif');
|
|
221
221
|
background-position: center;
|
|
222
222
|
background-size: 50px;
|
|
223
223
|
background-repeat: no-repeat;
|
|
224
224
|
}
|
|
225
|
+
.preview_iframe_kk{
|
|
226
|
+
width: 100%;
|
|
227
|
+
height: 100%;
|
|
228
|
+
}
|
|
225
229
|
.preview_iframe_html{
|
|
226
230
|
width: 100%;
|
|
227
231
|
height: 100%;
|
|
@@ -29,11 +29,13 @@
|
|
|
29
29
|
<span>查看更多</span>
|
|
30
30
|
</div>
|
|
31
31
|
</div>
|
|
32
|
+
<previewPdf ref="previewPdf" :url="previewHref" :sourceFileType="sourceFileType" officePreviewType="pdf"></previewPdf>
|
|
32
33
|
</div>
|
|
33
34
|
</template>
|
|
34
35
|
|
|
35
36
|
<script>
|
|
36
|
-
import { imageTypeObj } from "../assets/js/common";
|
|
37
|
+
import { imageTypeObj, isMobile } from "../assets/js/common";
|
|
38
|
+
import previewPdf from "./previewPdf";
|
|
37
39
|
export default {
|
|
38
40
|
name: "welcomeKnowledgeFile",
|
|
39
41
|
props:{
|
|
@@ -44,16 +46,77 @@ export default {
|
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
data(){
|
|
50
|
+
return{
|
|
51
|
+
previewHref: "",
|
|
52
|
+
sourceFileType:'',
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
components:{
|
|
56
|
+
previewPdf
|
|
49
57
|
},
|
|
50
58
|
methods:{
|
|
51
59
|
fileIcon(type){
|
|
52
60
|
return 'https://static.guoranbot.com/cdn-office-website/askbot_doc/' + imageTypeObj[type] + '.png'
|
|
53
61
|
},
|
|
54
62
|
clickFun(item){
|
|
55
|
-
this.$emit('knowledgeClickFun',item)
|
|
56
|
-
|
|
63
|
+
this.$emit('knowledgeClickFun',item);
|
|
64
|
+
this.$refs.previewPdf.previewShowPopup = false;
|
|
65
|
+
this.$refs.previewPdf.drawer = false;
|
|
66
|
+
let index = item.url.lastIndexOf('?')
|
|
67
|
+
let type = ''
|
|
68
|
+
let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate'
|
|
69
|
+
if (index !== -1) {
|
|
70
|
+
item.url = item.url.substring(0, index)
|
|
71
|
+
type = this.fileType(item.url)
|
|
72
|
+
} else {
|
|
73
|
+
type = this.fileType(item.url)
|
|
74
|
+
}
|
|
75
|
+
if (type === '' || type === 'OTHER') {
|
|
76
|
+
httpUrl = httpUrl += '?needEncrypt=true'
|
|
77
|
+
} else {
|
|
78
|
+
httpUrl = httpUrl += '?needEncrypt=false'
|
|
79
|
+
}
|
|
80
|
+
this.$http.post(httpUrl, {
|
|
81
|
+
"fileInOssPath":item.url
|
|
82
|
+
}).then(res =>{
|
|
83
|
+
if(res.data.code == '0') {
|
|
84
|
+
this.previewHref = res.data.data;
|
|
85
|
+
this.sourceFileType = item.url.substring(item.url.lastIndexOf('.'))
|
|
86
|
+
let isOhmPc = sessionStorage.getItem('isOhmPc')
|
|
87
|
+
if (isMobile() || isOhmPc == 'true'){
|
|
88
|
+
this.$refs.previewPdf.drawer = true;
|
|
89
|
+
this.$refs.previewPdf.previewShowPopup = true;
|
|
90
|
+
} else {
|
|
91
|
+
this.$refs.previewPdf.previewShowPopup = false;
|
|
92
|
+
this.$refs.previewPdf.drawer = true;
|
|
93
|
+
}
|
|
94
|
+
this.$refs.previewPdf.fileType = type
|
|
95
|
+
this.$refs.previewPdf.tagIds = item.tagIds
|
|
96
|
+
this.$refs.previewPdf.isMessageRecord = this.isMessageRecord ? true : false
|
|
97
|
+
if(item.tagIds && item.tagIds.length != 0) {
|
|
98
|
+
this.$refs.previewPdf.loading = false
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
this.$nextTick(() =>{
|
|
102
|
+
if(item.source == 'CREATED_BY_ONESELF' || type === 'HTML') {
|
|
103
|
+
this.$refs.previewPdf.getBolb(item)
|
|
104
|
+
}
|
|
105
|
+
this.$refs.previewPdf.loadIframe(item)
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
},
|
|
110
|
+
fileType (url) {
|
|
111
|
+
const fileType = url.substring(url.lastIndexOf('.'));
|
|
112
|
+
if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.MOVC' || fileType === '.mov' || fileType === '.movc' || fileType === '.mav' || fileType === '.MAV' || fileType == '.mp3' || fileType == '.MP3' || fileType === '.wav') {
|
|
113
|
+
return 'VIDEO'
|
|
114
|
+
} else if (fileType === '.html') {
|
|
115
|
+
return 'HTML'
|
|
116
|
+
} else {
|
|
117
|
+
return 'OTHER'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
57
120
|
}
|
|
58
121
|
};
|
|
59
122
|
</script>
|