askbot-dragon 0.7.21 → 0.7.25
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
|
@@ -82,7 +82,7 @@ function ossFileUrl(ossConfig, path, cname) {
|
|
|
82
82
|
function uploadImageByBase64(ossConfig,blob) {
|
|
83
83
|
let ossClient = new OSS(ossConfig);
|
|
84
84
|
|
|
85
|
-
// object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt
|
|
85
|
+
// object-key可以自定义为文件名(例如file.txt)或目录(例如abc/test/file.txt)的形 式,实现将文件上传至当前Bucket或Bucket下的指定目录。
|
|
86
86
|
let objectKey = pathGenerate(new Date().getTime());
|
|
87
87
|
let result = ossClient.put(objectKey, blob);
|
|
88
88
|
console.debug(result);
|
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
:raw-controls="true"
|
|
16
16
|
x5-video-player-type="h5-page"
|
|
17
17
|
style="object-fit: contain;width: calc(100vw - 139px);height: 160px;background-color: black;border-radius: 25px;max-width: 230px;padding-left: 10px"
|
|
18
|
-
|
|
18
|
+
preload
|
|
19
|
+
:poster="videoSrc+'?spm=qipa250&x-oss-process=video/snapshot,t_1000,f_jpg,w_0,h_0,m_fast'"
|
|
19
20
|
class="video-player vjs-custom-skin"
|
|
20
21
|
:id="msg.keyId+'key'">
|
|
21
22
|
<source :src="videoSrc"/>
|
|
22
23
|
</video>
|
|
24
|
+
<div id="output"></div>
|
|
23
25
|
</div>
|
|
24
26
|
</template>
|
|
25
27
|
<script>
|
|
@@ -50,19 +52,20 @@
|
|
|
50
52
|
mounted() {
|
|
51
53
|
this.$nextTick(()=>{
|
|
52
54
|
this.videoSrc = this.url ? this.url : this.localUrl
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
+
this.poster = this.videoSrc+'?spm=qipa250&x-oss-process=video/snapshot,t_1000,f_jpg,w_0,h_0,m_fast'
|
|
56
|
+
console.debug('poster',this.poster)
|
|
55
57
|
})
|
|
56
58
|
|
|
57
59
|
},
|
|
58
60
|
methods:{
|
|
59
61
|
getImage(){
|
|
60
62
|
let that = this
|
|
61
|
-
var video;
|
|
63
|
+
var video,output;
|
|
62
64
|
var scale = 0.8;
|
|
63
65
|
|
|
64
66
|
var initialize = function() {
|
|
65
67
|
let id = that.msg.keyId+'key'
|
|
68
|
+
output = document.getElementById("output");
|
|
66
69
|
video = document.getElementById(id);
|
|
67
70
|
video.addEventListener('loadeddata',captureImage);
|
|
68
71
|
};
|
|
@@ -73,8 +76,10 @@
|
|
|
73
76
|
canvas.height = video.videoHeight * scale;
|
|
74
77
|
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
75
78
|
/*var img = document.createElement("img");
|
|
76
|
-
img.crossOrigin = 'anonymous'
|
|
77
|
-
|
|
79
|
+
img.crossOrigin = 'anonymous'
|
|
80
|
+
img.src = canvas.toDataURL("image/png");*/
|
|
81
|
+
let reg = /\.(png|jpg|gif)$/
|
|
82
|
+
console.debug('img.src',output)
|
|
78
83
|
let base64 = canvas.toDataURL("image/png")
|
|
79
84
|
let blob = that.dataURLtoFile(base64,'name')
|
|
80
85
|
let promise = uploadImageByBase64(ossConfig,blob);
|
|
@@ -82,9 +87,12 @@
|
|
|
82
87
|
console.debug("upload base64 reslut",res);
|
|
83
88
|
if (res&&res.url){
|
|
84
89
|
that.poster = res.url
|
|
90
|
+
if (!reg.test(that.poster)){
|
|
91
|
+
that.poster +='.png'
|
|
92
|
+
}
|
|
85
93
|
}
|
|
94
|
+
console.debug('poster',that.poster)
|
|
86
95
|
});
|
|
87
|
-
/*output.appendChild(img);*/
|
|
88
96
|
};
|
|
89
97
|
|
|
90
98
|
initialize();
|
|
@@ -1809,12 +1809,12 @@ export default {
|
|
|
1809
1809
|
}
|
|
1810
1810
|
}
|
|
1811
1811
|
.submitClass{
|
|
1812
|
-
width: 100px;
|
|
1812
|
+
min-width: 100px;
|
|
1813
1813
|
background-color: #366aff;
|
|
1814
1814
|
color: white!important;
|
|
1815
1815
|
height: 32px;
|
|
1816
1816
|
i{
|
|
1817
|
-
|
|
1817
|
+
padding-right: 8px;
|
|
1818
1818
|
font-weight: 600;
|
|
1819
1819
|
}
|
|
1820
1820
|
}
|
|
@@ -1873,12 +1873,12 @@ export default {
|
|
|
1873
1873
|
width: 100%;
|
|
1874
1874
|
font-size: 1em;
|
|
1875
1875
|
.submitClass{
|
|
1876
|
-
width: 100px;
|
|
1876
|
+
min-width: 100px;
|
|
1877
1877
|
color: white!important;
|
|
1878
1878
|
background-color:#366aff;
|
|
1879
1879
|
border-color: #366aff;
|
|
1880
1880
|
i{
|
|
1881
|
-
|
|
1881
|
+
padding-right: 8px;
|
|
1882
1882
|
font-weight: 600;
|
|
1883
1883
|
}
|
|
1884
1884
|
}
|