Dialog.vue
2.41 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<template>
<div class="mask" v-if="isShow">
<div class="dialog-wrap">
<div class="dialog">
<div class="dialog-title">
{{ title }}
<div class="close" @click="closeHandle">
<img src="@/assets/images/close.png" />
</div>
</div>
<video id="aivideos" ref="aivideos" muted="false" controls autoplay class="video-box">
<!-- <source src="/media/cc0-videos/flower.webm" type="video/webm" /> -->
<source v-if="type == 1" src="../../../assets/images/video(1).mp4" type="video/mp4" />
<source v-if="type == 2" :src="`https://img02.glsx.com.cn/weapp/resource/miniprogram/material/ai-practice.mp4?v=${version}`" type="video/mp4" />
</video>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Dialog',
props: {
isShow: Boolean,
title: String,
type: String
},
data() {
return {
msg: ''
}
},
mounted() {
this.version = Math.random() * 10
},
watch: {
isShow(val) {
if (val) {
this.$nextTick(() => {
this.$refs.aivideos.muted = !val
})
}
}
},
methods: {
closeHandle() {
this.$emit('closeDialog')
}
},
beforeDestroy() {
if (document.getElementById('aivideos')) document.getElementById('aivideos').muted = true
}
}
</script>
<style lang="scss" scoped>
.mask {
width: 100%;
height: 100%;
position: fixed;
z-index: 99;
left: 0px;
top: 0px;
background: rgba(0, 0, 0, 0.8);
}
.dialog-wrap {
width: 61.11vw;
height: 73.29vh;
position: absolute;
z-index: 1;
left: 50%;
top: 50%;
background-image: url('../../../assets/images/bg-5.png');
background-repeat: no-repeat;
background-size: 100% 100%;
transform: translate(-50%, -50%);
border-radius: 5px;
padding: 3.9vh 3.67vw;
box-sizing: border-box;
.close {
width: 20px;
height: 20px;
position: absolute;
right: -23vw;
top: -1vw;
cursor: pointer;
}
.dialog-title {
width: 13.19vw;
height: 4.39vh;
background-image: url('../../../assets/images/title-dialog.png');
background-repeat: no-repeat;
background-size: 100% 100%;
text-align: center;
font-size: 20px;
color: #ffffff;
margin: 0 auto;
position: relative;
line-height: 4.39vh;
}
.video-box {
width: 54vw;
height: 63.29vh;
}
}
video::-webkit-media-controls-fullscreen-button {
display: none;
}
</style>