|
@@ -14,6 +14,11 @@
|
14
|
14
|
</div>
|
15
|
15
|
</ul>
|
16
|
16
|
</div>
|
|
17
|
+ <div v-if="audios.length>0" style="position: relative;z-index: 101;">
|
|
18
|
+ <audio v-for="(audio, k) in audios" v-if="audio.isShow" :key="k" @ended="audioEnd(k)">
|
|
19
|
+ <source :src="audio.url" />
|
|
20
|
+ </audio>
|
|
21
|
+ </div>
|
17
|
22
|
</div>
|
18
|
23
|
</template>
|
19
|
24
|
|
|
@@ -22,25 +27,31 @@ export default {
|
22
|
27
|
data () {
|
23
|
28
|
return {
|
24
|
29
|
users: [],
|
|
30
|
+ audios: [],
|
|
31
|
+ diffM: 5000,
|
25
|
32
|
newinfo: {
|
26
|
33
|
firstName: '',
|
27
|
34
|
classId: '1',
|
28
|
|
- words: '欢迎光临'
|
|
35
|
+ words: '欢迎光临',
|
|
36
|
+ url: 'aa'
|
29
|
37
|
},
|
30
|
38
|
vipAinfo: {
|
31
|
39
|
firstName: '张先生',
|
32
|
40
|
classId: '2',
|
33
|
|
- words: '您好'
|
|
41
|
+ words: '您好',
|
|
42
|
+ url: 'bb'
|
34
|
43
|
},
|
35
|
44
|
vipBinfo: {
|
36
|
45
|
firstName: '王女士',
|
37
|
46
|
classId: '2',
|
38
|
|
- words: '您好~'
|
|
47
|
+ words: '您好~',
|
|
48
|
+ url: 'cc'
|
39
|
49
|
},
|
40
|
50
|
vipCinfo: {
|
41
|
51
|
firstName: '许女士',
|
42
|
52
|
classId: '2',
|
43
|
|
- words: 'hello'
|
|
53
|
+ words: 'hello',
|
|
54
|
+ url: 'dd'
|
44
|
55
|
}
|
45
|
56
|
}
|
46
|
57
|
},
|
|
@@ -59,16 +70,29 @@ export default {
|
59
|
70
|
this.users.splice(0, 1)
|
60
|
71
|
}
|
61
|
72
|
this.users = [...this.users, {...info, createdata: Date.parse(new Date())}]
|
|
73
|
+ this.audios = [...this.audios, {...info, isShow: true, createdata: Date.parse(new Date())}]
|
62
|
74
|
}
|
|
75
|
+ },
|
|
76
|
+ audioEnd (index) {
|
|
77
|
+ let as = this.audios
|
|
78
|
+ this.audios = as.map((x, i) => {
|
|
79
|
+ if (i === index) {
|
|
80
|
+ x.isShow = false
|
|
81
|
+ }
|
|
82
|
+ })
|
63
|
83
|
}
|
64
|
84
|
},
|
65
|
85
|
created () {
|
66
|
86
|
const _that = this
|
67
|
87
|
window.setInterval(() => {
|
68
|
|
- let dels = _that.users.filter(x => Date.parse(new Date()) - x.createdata > 5000)
|
|
88
|
+ let dels = _that.users.filter(x => Date.parse(new Date()) - x.createdata > this.diffM)
|
69
|
89
|
dels.map(x => {
|
70
|
90
|
_that.users.splice(this.users.findIndex(i => i.createdata === x.createdata), 1)
|
71
|
91
|
})
|
|
92
|
+ let delaudios = _that.audios.filter(x => Date.parse(new Date()) - x.createdata > this.diffM)
|
|
93
|
+ delaudios.map(x => {
|
|
94
|
+ _that.audios.splice(this.audios.findIndex(i => i.createdata === x.createdata), 1)
|
|
95
|
+ })
|
72
|
96
|
}, 100)
|
73
|
97
|
}
|
74
|
98
|
}
|