askbot-dragon 1.1.7 → 1.1.10
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 +1 -1
- package/src/components/AnswerDocknowledge.vue +48 -13
- package/src/components/previewPdf.vue +114 -0
- package/vue.config.js +8 -0
package/package.json
CHANGED
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
<img class="alc-title-icon" height="24px" width="24px" :src="item.src" alt="" srcset="">
|
|
13
13
|
<span class="alc-title-from">{{ item.from }}</span>
|
|
14
14
|
</div>
|
|
15
|
-
|
|
16
|
-
<span @click="lookAttach(item.url, item)" class="aci-view">查看 ></span>
|
|
17
|
-
</div>
|
|
15
|
+
|
|
18
16
|
</div>
|
|
19
17
|
<div v-html="item.introduction" class="alc-box-introduction">
|
|
20
18
|
</div>
|
|
@@ -22,6 +20,9 @@
|
|
|
22
20
|
<div v-show="docSource[item.source]" class="upload-source">
|
|
23
21
|
{{docSource[item.source]}}
|
|
24
22
|
</div>
|
|
23
|
+
<div class="alc-content-text" v-if="msg.content.type == 1">
|
|
24
|
+
<span @click="lookAttach(item.url)" class="aci-view">查看 ></span>
|
|
25
|
+
</div>
|
|
25
26
|
<!-- <div class="time">
|
|
26
27
|
<span>更新时间:</span>
|
|
27
28
|
{{ new Date(item.updateTime).Format('MM-dd hh:mm') }}
|
|
@@ -44,15 +45,15 @@
|
|
|
44
45
|
</div>
|
|
45
46
|
</div>
|
|
46
47
|
</div>
|
|
47
|
-
<
|
|
48
|
+
<previewPdf ref="previewPdf" :url="previewHref" officePreviewType="pdf"></previewPdf>
|
|
48
49
|
</div>
|
|
49
50
|
</template>
|
|
50
51
|
|
|
51
52
|
<script>
|
|
52
|
-
import
|
|
53
|
+
import previewPdf from "./previewPdf";
|
|
53
54
|
export default {
|
|
54
55
|
name: "answerDocknowledge",
|
|
55
|
-
components: {
|
|
56
|
+
components: { previewPdf },
|
|
56
57
|
data() {
|
|
57
58
|
return {
|
|
58
59
|
isPC: true,
|
|
@@ -131,12 +132,39 @@ export default {
|
|
|
131
132
|
},
|
|
132
133
|
methods: {
|
|
133
134
|
//预览图片
|
|
134
|
-
lookAttach(url) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
lookAttach(url, item) {
|
|
136
|
+
let index = url.lastIndexOf('?')
|
|
137
|
+
let type = ''
|
|
138
|
+
let httpUrl = '/knowledge-api/knowledge/getTemporaryCertificate'
|
|
139
|
+
if (index !== -1) {
|
|
140
|
+
url = url.substring(0, index)
|
|
141
|
+
type = this.fileType(url)
|
|
142
|
+
}
|
|
143
|
+
if (type === '' || type === 'OTHER') {
|
|
144
|
+
httpUrl = httpUrl += '?needEncrypt=true'
|
|
145
|
+
}
|
|
146
|
+
this.$http.post(httpUrl, {
|
|
147
|
+
"fileInOssPath":url
|
|
148
|
+
}).then(res =>{
|
|
149
|
+
if(res.data.code == '0') {
|
|
150
|
+
this.previewHref = res.data.data
|
|
151
|
+
this.$refs.previewPdf.previewShowPopup = true;
|
|
152
|
+
this.$refs.previewPdf.fileType = type
|
|
153
|
+
this.$nextTick(() =>{
|
|
154
|
+
this.$refs.previewPdf.loadIframe(item)
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
},
|
|
159
|
+
fileType (url) {
|
|
160
|
+
const fileType = url.substring(url.lastIndexOf('.'));
|
|
161
|
+
if (fileType === '.mp4' || fileType === '.MP4') {
|
|
162
|
+
return 'VIDEO'
|
|
163
|
+
} else if (fileType === '.html' || fileType === '.md') {
|
|
164
|
+
return 'HTML'
|
|
165
|
+
} else {
|
|
166
|
+
return 'OTHER'
|
|
167
|
+
}
|
|
140
168
|
},
|
|
141
169
|
}
|
|
142
170
|
}
|
|
@@ -147,6 +175,7 @@ export default {
|
|
|
147
175
|
min-width: 100px;
|
|
148
176
|
|
|
149
177
|
.answer-text {
|
|
178
|
+
font-size: 13px;
|
|
150
179
|
line-height: 18px;
|
|
151
180
|
padding: 0px 0px 12px 0px;
|
|
152
181
|
|
|
@@ -181,7 +210,7 @@ export default {
|
|
|
181
210
|
display: flex;
|
|
182
211
|
align-items: center;
|
|
183
212
|
.source-form{
|
|
184
|
-
width:
|
|
213
|
+
width: 26px;
|
|
185
214
|
flex: none;
|
|
186
215
|
color: #A9B3C6;
|
|
187
216
|
}
|
|
@@ -209,6 +238,7 @@ export default {
|
|
|
209
238
|
margin-top: 10px;
|
|
210
239
|
color: #616161;
|
|
211
240
|
font-size: 12px;
|
|
241
|
+
line-height: 19px;
|
|
212
242
|
}
|
|
213
243
|
.alc-updateTime{
|
|
214
244
|
display: flex;
|
|
@@ -220,6 +250,7 @@ export default {
|
|
|
220
250
|
.upload-source{
|
|
221
251
|
flex: none;
|
|
222
252
|
height: 18px;
|
|
253
|
+
line-height: 18px;
|
|
223
254
|
background: #E9F9F8;
|
|
224
255
|
border: 1px solid #AFF2CD;
|
|
225
256
|
border-radius: 2px;
|
|
@@ -233,6 +264,10 @@ export default {
|
|
|
233
264
|
color: #999999;
|
|
234
265
|
margin-left: 10px;
|
|
235
266
|
}
|
|
267
|
+
.alc-content-text {
|
|
268
|
+
color: #366aff;
|
|
269
|
+
cursor: pointer;
|
|
270
|
+
}
|
|
236
271
|
}
|
|
237
272
|
.alc-title-icon {
|
|
238
273
|
margin: 0 2px;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<van-popup v-model="previewShowPopup" position="bottom" :style="{ height: '90%', background:'#FFFFFF'}">
|
|
3
|
+
<div class="footer">
|
|
4
|
+
<span>查看详情</span>
|
|
5
|
+
<section @click="close">
|
|
6
|
+
<i class="iconfont guoran-shanchu"></i>
|
|
7
|
+
</section>
|
|
8
|
+
</div>
|
|
9
|
+
<div v-if="fileType == 'VIDEO'" style="width: 100%;height: calc(100% - 70px)">
|
|
10
|
+
<video :src="url" controls width="100%;" height="98%"></video>
|
|
11
|
+
</div>
|
|
12
|
+
<template v-else-if="url.includes('https://www') || url.includes('http://www')">
|
|
13
|
+
<iframe class="preview_iframe"
|
|
14
|
+
:src="url"
|
|
15
|
+
width="100%"
|
|
16
|
+
height="100%"
|
|
17
|
+
scrolling="100%"
|
|
18
|
+
frameborder="no"
|
|
19
|
+
border="0"></iframe>
|
|
20
|
+
</template>
|
|
21
|
+
<template v-else>
|
|
22
|
+
<iframe class="preview_iframe" :src="previewUrl" style="border:none;"></iframe>
|
|
23
|
+
</template>
|
|
24
|
+
</van-popup>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
export default {
|
|
29
|
+
data () {
|
|
30
|
+
return {
|
|
31
|
+
previewShowPopup: false
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
props:{
|
|
35
|
+
url:{
|
|
36
|
+
type: String,
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
officePreviewType:{
|
|
40
|
+
type: String,
|
|
41
|
+
default: ''
|
|
42
|
+
},
|
|
43
|
+
fileType :{
|
|
44
|
+
type: String,
|
|
45
|
+
default: ''
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
computed:{
|
|
49
|
+
previewUrl() {
|
|
50
|
+
console.debug('VUE_APP_ENV',process.env.VUE_APP_ENV)
|
|
51
|
+
let url = process.env.VUE_APP_ENV === 'production' ? 'https://kkfileview.askbot.cn/onlinePreview?url=' : 'https://test.open.askbot.cn/kkfileview/onlinePreview?url='
|
|
52
|
+
// if(this.url != '') {
|
|
53
|
+
// if(/[\u4E00-\u9FA5]+/g.test(this.url)) {
|
|
54
|
+
// url += btoa(encodeURIComponent(this.url))
|
|
55
|
+
// } else {
|
|
56
|
+
// url += btoa(this.url)
|
|
57
|
+
// }
|
|
58
|
+
// }
|
|
59
|
+
url = url + this.url
|
|
60
|
+
if(this.officePreviewType !== '') {
|
|
61
|
+
url += '&officePreviewType=pdf'
|
|
62
|
+
}
|
|
63
|
+
return url
|
|
64
|
+
},
|
|
65
|
+
// fileType() {
|
|
66
|
+
// const fileType = this.url.substring(this.url.lastIndexOf('.'));
|
|
67
|
+
// if (fileType === '.mp4' || fileType === '.MP4' || fileType === '.MOV' || fileType === '.mov') {
|
|
68
|
+
// return 'VIDEO'
|
|
69
|
+
// } else {
|
|
70
|
+
// return 'OTHER'
|
|
71
|
+
// }
|
|
72
|
+
|
|
73
|
+
// }
|
|
74
|
+
},
|
|
75
|
+
methods :{
|
|
76
|
+
close() {
|
|
77
|
+
this.previewShowPopup = false
|
|
78
|
+
},
|
|
79
|
+
loadIframe(item) {
|
|
80
|
+
let iframe = document.getElementsByClassName('preview_iframe')[0]
|
|
81
|
+
iframe.onload(() =>{
|
|
82
|
+
iframe.contentWindow.postMessage({
|
|
83
|
+
type: "positionText",
|
|
84
|
+
data: item.text,
|
|
85
|
+
page: item.page
|
|
86
|
+
}, '*')
|
|
87
|
+
})
|
|
88
|
+
// if(preview) {
|
|
89
|
+
// preview.postMessage({
|
|
90
|
+
// type: "positionText",
|
|
91
|
+
// data: ``
|
|
92
|
+
// }, '*')
|
|
93
|
+
// }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<style lang="less" scoped>
|
|
100
|
+
.preview_iframe {
|
|
101
|
+
width: 100%;
|
|
102
|
+
height: calc(100% - 52px);
|
|
103
|
+
}
|
|
104
|
+
.footer {
|
|
105
|
+
width: calc(100% - 40px);
|
|
106
|
+
height: 50px;
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: space-between;
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
padding: 0 20px;
|
|
112
|
+
border-bottom: 1px solid #cccccc;
|
|
113
|
+
}
|
|
114
|
+
</style>
|
package/vue.config.js
CHANGED
|
@@ -32,6 +32,14 @@ module.exports = {
|
|
|
32
32
|
'^/order-api': '/'
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
+
'/knowledge-api/': {
|
|
36
|
+
target: 'http://master.test.askbot.cn:30202',
|
|
37
|
+
changeOrigin: true,
|
|
38
|
+
ws: true,
|
|
39
|
+
pathRewrite: {
|
|
40
|
+
'^/knowledge-api': '/'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
35
43
|
},
|
|
36
44
|
},
|
|
37
45
|
configureWebpack: {
|