guoshilong
2022-10-13 75ade28a7b3e1a1f652733cb9a1055a8f300a6e5
事件上报上传视频可预览
1 files modified
35 ■■■■ changed files
pages/eventgm/eventsReported.vue 35 ●●●● patch | view | raw | blame | history
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
            }
        },
    }
};