zhangxiaoxu123456
2021-12-17 4d4a844ef624dde8667b314d353599297f6cb8d9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<template>
    <view class="showhfive-box">
        <web-view v-if="params.type == 0" :src="url"></web-view>
        <video 
           id="myVideo"
           class="showVideo" 
           v-if="params.type == 1" 
           :src="url" 
           controls 
           autoplay 
           page-gesture 
           :direction="0" 
           show-play-btn 
           show-center-play-btn 
           object-fit="fill" 
           enable-play-gesture 
           auto-pause-if-navigate
           ></video>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                url:'',
                fileType:'', //类型
                videoContext:'',
                params: {
                    id:'',
                    userId:'',
                    name:'',
                    type:'',
                    time:''
                },
                startTime: '', //进入页面时间
                endTime: '',  //离开页面时间
                lastTime:'', //停留时长
            }
        },
        onLoad(options) {
            console.log(options,'options------------')
            this.params.type = options.fileType
            // this.url = options.url
            this.params.id = options.id
            this.params.name = options.name
            // this.url = 'https://media.w3.org/2010/05/sintel/trailer.mp4'
            // this.url = 'https://hesuancj.cn:8889/show/showImg?result=1628039217322.mp4'
            this.url = decodeURIComponent(options.url)
            // console.log('this.url========',this.url)
            // this.url = 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
            this.params.userId = this.getStore('userInfo').id
            console.log('this.params.userId--------',this.params.userId)
            
        },
        onShow() {
            let a = new Date()
            this.startTime = a.getTime()
        },
        onHide() {
            
        },
        destroyed() {
            let b = new Date()
            this.endTime = b.getTime()
            let c = (this.endTime - this.startTime) / 1000 / 60
            this.params.time = Math.round(c)
            console.log('mathTime----',this.params.time)
            // let params = {
            //     id:
            // }
            console.log('this.params======this.params',this.params)
            this.$u.api.studySave(this.params).then(res => {
                console.log(res,'res------res')
            })
        },
        mounted() {
            
        }
    }
</script>
 
 
<style lang="scss" scoped>
    .showhfive-box{
        width:100%;
        height: 100%;
    }
    .showVideo{
        width: 100%;
    }
    /deep/ .uni-video-bar.uni-video-bar-full {
        z-index: 99;
    }
</style>