askbot-dragon 1.3.27 → 1.3.30
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
|
@@ -84,6 +84,7 @@ export default {
|
|
|
84
84
|
let url = typeof item == 'object' ? item.url : item
|
|
85
85
|
this.previewHref = url
|
|
86
86
|
this.$refs.previewDoc.previewShowPopup = true
|
|
87
|
+
this.$refs.previewDoc.title = typeof item == 'object' ? item.name : item
|
|
87
88
|
},
|
|
88
89
|
deleteAttch (index) {
|
|
89
90
|
this.$emit('attachDeleteAttch', index)
|
|
@@ -290,7 +290,6 @@
|
|
|
290
290
|
</div>
|
|
291
291
|
<div v-else-if="item.formField.type==='EXPLANATION'||item.formField.type==='EXPLAIN'" class="explan-ation">
|
|
292
292
|
<div class="explanation">
|
|
293
|
-
123123123
|
|
294
293
|
<p class="explanation-p" v-if="item.formField.type==='EXPLANATION'">
|
|
295
294
|
<span class="el-icon-info"></span>
|
|
296
295
|
{{item.formField.extInfo.descriptionText}}
|
|
@@ -21,76 +21,113 @@
|
|
|
21
21
|
<template v-else>
|
|
22
22
|
<iframe class="preview_iframe" :src="previewUrl" style="border:none;"></iframe>
|
|
23
23
|
</template>
|
|
24
|
+
<div class="onload_btn" @click="downLoad">
|
|
25
|
+
下载
|
|
26
|
+
</div>
|
|
24
27
|
</div>
|
|
25
28
|
</template>
|
|
26
29
|
|
|
27
30
|
<script>
|
|
28
31
|
export default {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
data () {
|
|
33
|
+
return {
|
|
34
|
+
previewShowPopup: false,
|
|
35
|
+
title:'工单附件'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
props: {
|
|
39
|
+
url: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: true,
|
|
33
42
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
officePreviewType: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: ''
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
computed: {
|
|
49
|
+
previewUrl () {
|
|
50
|
+
let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
|
|
51
|
+
if (this.url != '') {
|
|
52
|
+
if (/[\u4E00-\u9FA5]+/g.test(this.url)) {
|
|
53
|
+
url += btoa(encodeURIComponent(this.url))
|
|
54
|
+
} else {
|
|
55
|
+
url += btoa(this.url)
|
|
42
56
|
}
|
|
57
|
+
url += '&encodeURIComponent=true'
|
|
58
|
+
}
|
|
59
|
+
return url
|
|
43
60
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
fileType() {
|
|
58
|
-
const fileType = this.url.substring(this.url.lastIndexOf('.'));
|
|
59
|
-
if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
|
|
60
|
-
return 'VIDEO'
|
|
61
|
-
} else {
|
|
62
|
-
return 'OTHER'
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
}
|
|
61
|
+
fileType () {
|
|
62
|
+
const fileType = this.url.substring(this.url.lastIndexOf('.'));
|
|
63
|
+
if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
|
|
64
|
+
return 'VIDEO'
|
|
65
|
+
} else {
|
|
66
|
+
return 'OTHER'
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
methods: {
|
|
72
|
+
close () {
|
|
73
|
+
this.$emit('close')
|
|
66
74
|
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
loadIframe (item) {
|
|
76
|
+
let iframe = document.getElementsByClassName('preview_iframe')[0]
|
|
77
|
+
iframe.onload(() => {
|
|
78
|
+
iframe.contentWindow.postMessage({
|
|
79
|
+
type: "positionText",
|
|
80
|
+
data: item.text,
|
|
81
|
+
page: item.page
|
|
82
|
+
}, '*')
|
|
83
|
+
})
|
|
84
|
+
// if(preview) {
|
|
85
|
+
// preview.postMessage({
|
|
86
|
+
// type: "positionText",
|
|
87
|
+
// data: ``
|
|
88
|
+
// }, '*')
|
|
89
|
+
// }
|
|
90
|
+
},
|
|
91
|
+
downLoad () {
|
|
92
|
+
const fileType = this.url.substring(this.url.lastIndexOf('.'));
|
|
93
|
+
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
|
|
94
|
+
navigator.clipboard.writeText(this.url)
|
|
95
|
+
this.$message({
|
|
96
|
+
title: '下载地址已复制,请前往Safari浏览器访问下载'
|
|
97
|
+
})
|
|
98
|
+
return
|
|
99
|
+
} else if (/(Android)/i.test(navigator.userAgent)) {
|
|
100
|
+
console.log('isAndroid')
|
|
101
|
+
} else {
|
|
102
|
+
console.log('isPC')
|
|
103
|
+
}
|
|
104
|
+
if (fileType == '.txt') {
|
|
105
|
+
this.$http.get(this.url).then(res =>{
|
|
106
|
+
let elink = document.createElement("a");// 设置下载文件名
|
|
107
|
+
elink.download = this.title + '.txt';
|
|
108
|
+
elink.style.display = "none";
|
|
109
|
+
let blob = new Blob([res.data]);
|
|
110
|
+
elink.href = URL.createObjectURL(blob);
|
|
111
|
+
document.body.appendChild(elink);
|
|
112
|
+
elink.click();
|
|
113
|
+
document.body.removeChild(elink);
|
|
114
|
+
URL.revokeObjectURL(blob); //释放对象
|
|
115
|
+
})
|
|
116
|
+
} else {
|
|
117
|
+
let a = document.createElement('a')
|
|
118
|
+
a.href = this.url
|
|
119
|
+
a.download = (this.title) + fileType
|
|
120
|
+
a.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
|
|
121
|
+
}
|
|
87
122
|
}
|
|
123
|
+
}
|
|
88
124
|
}
|
|
89
125
|
</script>
|
|
90
126
|
|
|
91
127
|
<style lang="less" scoped>
|
|
92
128
|
.previewDoc{
|
|
93
129
|
height: 100%;
|
|
130
|
+
position: relative;
|
|
94
131
|
}
|
|
95
132
|
.preview_iframe {
|
|
96
133
|
width: 100%;
|
|
@@ -110,4 +147,22 @@ export default {
|
|
|
110
147
|
/deep/.el-drawer__body{
|
|
111
148
|
height: 100%;
|
|
112
149
|
}
|
|
150
|
+
.onload_btn {
|
|
151
|
+
position: absolute;
|
|
152
|
+
left: 50%;
|
|
153
|
+
transform: translateX(-50%);
|
|
154
|
+
bottom: 40px;
|
|
155
|
+
width: 200px;
|
|
156
|
+
background-color: #366AFF;
|
|
157
|
+
color: white;
|
|
158
|
+
height: 48px;
|
|
159
|
+
display: flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
justify-content: center;
|
|
162
|
+
border-radius: 28px;
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
i{
|
|
165
|
+
margin-right: 8px;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
113
168
|
</style>
|