From 75ade28a7b3e1a1f652733cb9a1055a8f300a6e5 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Thu, 13 Oct 2022 11:15:13 +0800
Subject: [PATCH] 事件上报上传视频可预览

---
 pages/eventgm/eventsReported.vue |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/pages/eventgm/eventsReported.vue b/pages/eventgm/eventsReported.vue
index 2024148..b5fecbd 100644
--- a/pages/eventgm/eventsReported.vue
+++ b/pages/eventgm/eventsReported.vue
@@ -53,8 +53,7 @@
 				></evan-upload>
 			</u-form-item>
 			
-			<!-- <video  :src="videoUrl"></video> -->
-			
+			<video id="myVideo" v-show="videoShow" :src="videoUrl" @fullscreenchange="fullScreenChange"></video>
 			<u-form-item label-position="top" label="备注:">
 				<u-input v-model="form.remark" type="textarea" />
 			</u-form-item>
@@ -120,6 +119,7 @@
 			uploadList:[],
 			videoUrl:"",
 			videoShow:false,
+			videoContext:null,
 			showType:false,
 			typeList:[],
 			showState:false,
@@ -140,6 +140,7 @@
 	},
 	onReady() {
 		this.$refs.uForm.setRules(this.rules);
+		this.videoContext = uni.createVideoContext("myVideo",this)
 	},
 	onLoad(option) {
 		if(option.id){
@@ -168,6 +169,7 @@
 			uni.getLocation({
 				type: 'wgs84',
 				isHighAccuracy:true,
+				accuracy:'best',
 				geocode:true,
 				success: res=> {
 					console.log(res)
@@ -175,6 +177,18 @@
 					console.log('当前位置的纬度:' + res.latitude);
 					this.form.longitude = res.longitude
 					this.form.latitude = res.latitude
+					
+					//#ifdef APP-PLUS
+					//根据经纬度获取地址信息
+					var point = new plus.maps.Point(res.longitude, res.latitude);
+					plus.maps.Map.reverseGeocode(
+						point,
+						{},
+						(successRes)=>{
+							this.form.address = successRes.address
+						}
+					)
+					//#endif
 				}
 			});
 		},
@@ -259,15 +273,18 @@
 			res.imgCoverKey = thumbnail
 			return res
 		},
+		//视频预览
 		onPreVideo(video){
-			// console.log(video)
-			// this.videoShow = true
 			this.videoUrl = video.url
-			// uni.previewMedia({
-			// 	sources:[{
-			// 		url:video.url
-			// 	}]
-			// })
+			this.videoShow = true
+			this.videoContext.requestFullScreen({direction:0})
+		},
+		//退出全屏
+		fullScreenChange(e){
+			if(!e.detail.fullScreen){
+				//隐藏视频
+				this.videoShow = false
+			}
 		},
 	}
 };

--
Gitblit v1.9.3