|
@@ -138,9 +138,10 @@
|
|
<view class="small_title"><text></text><text>报警抓拍</text></view>
|
|
<view class="small_title"><text></text><text>报警抓拍</text></view>
|
|
<view class="picture_b" >
|
|
<view class="picture_b" >
|
|
<!-- 西北农林演示报警抓拍预案的时候-判断不显示视频 -->
|
|
<!-- 西北农林演示报警抓拍预案的时候-判断不显示视频 -->
|
|
- <view class="video" v-if="form.warningType!=1 && form.warningType!=4">
|
|
|
|
- <video id="myvideo" class="video_t" :src="configUrl+form.recordVideo"></video>
|
|
|
|
|
|
+ <view class="video" v-if="form.warningType!=1">
|
|
|
|
+ <video id="myvideo" class="video_t" :bindloadedmetada="onLoadedMetadata" :src="configUrl+form.recordVideo"></video>
|
|
<img class="video_b" @click="lockVideo()" src="@/images/icon_bjzp_spbof.png"/>
|
|
<img class="video_b" @click="lockVideo()" src="@/images/icon_bjzp_spbof.png"/>
|
|
|
|
+ <canvas id="myCanvas" canvas-id="myCanvas"></canvas>
|
|
</view>
|
|
</view>
|
|
<view v-if="form.warningType==1" class="img" @click="lockImg(form.warningDetailList)">
|
|
<view v-if="form.warningType==1" class="img" @click="lockImg(form.warningDetailList)">
|
|
<img v-for="item in form.warningDetailList" :src="configUrl+item.photoUrl"/>
|
|
<img v-for="item in form.warningDetailList" :src="configUrl+item.photoUrl"/>
|
|
@@ -217,7 +218,42 @@ export default {
|
|
|
|
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
-
|
|
|
|
|
|
+ //截取封面
|
|
|
|
+ videoCover(){
|
|
|
|
+ let video = document.getElementById('#myvideo');
|
|
|
|
+ let canvas = document.createElement("canvas");
|
|
|
|
+ let width = video.width; //canvas的尺寸和图片一样
|
|
|
|
+ let height = video.height;
|
|
|
|
+ canvas.width = width;
|
|
|
|
+ canvas.height = height;
|
|
|
|
+ canvas.getContext("2d").drawImage(video, 0, 0, width, height); //绘制canvas
|
|
|
|
+ let videoImg = canvas.toDataURL('image/jpeg'); //转换为base64
|
|
|
|
+ },
|
|
|
|
+ onLoadedMetadata(e){
|
|
|
|
+ console.log(1111)
|
|
|
|
+ const duration=e.duration;
|
|
|
|
+ const width=e.videoWidth;
|
|
|
|
+ const heigth=e.videoHeight;
|
|
|
|
+
|
|
|
|
+ const canvas=uni.createCanvasContext('myCanvas')
|
|
|
|
+ canvas.canvas.width=width;
|
|
|
|
+ canvas.canvas.height=heigth;
|
|
|
|
+
|
|
|
|
+ canvas.drawImage('myVideo',0,0,width,heigth)
|
|
|
|
+ canvas.draw();
|
|
|
|
+
|
|
|
|
+ const that=this;
|
|
|
|
+
|
|
|
|
+ setTimeout(function(){
|
|
|
|
+ uni.canvasToTempFilePath({
|
|
|
|
+ canvasId:'myCanvas',
|
|
|
|
+ success:function(res) {
|
|
|
|
+ const imagePath=res.tempFilePath;
|
|
|
|
+ console.log(imagePath)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },1000)
|
|
|
|
+ },
|
|
//滚动事件
|
|
//滚动事件
|
|
scrollGet(){
|
|
scrollGet(){
|
|
let self=this;
|
|
let self=this;
|