视频手动关闭后 定时器没有取消

pull/2/head
dearlin 2023-11-09 10:26:42 +08:00
parent 32db2c7fcd
commit 4d2865a5ed
3 changed files with 29 additions and 4 deletions

View File

@ -318,7 +318,7 @@ export default {
}, },
over() { over() {
// //
console.log('定时器动关闭') console.log('定时器动关闭')
this.$message.warning('单次播放时长已到5分钟自动关闭') this.$message.warning('单次播放时长已到5分钟自动关闭')
clearInterval(this.timer) clearInterval(this.timer)
}, },
@ -363,6 +363,8 @@ export default {
} }
}, },
back() { back() {
console.log('手动关闭定时器')
clearInterval(this.timer)
if (this.dialogVideo) this.dialogVideo = false if (this.dialogVideo) this.dialogVideo = false
if (this.dialogVideoBack) this.dialogVideoBack = false if (this.dialogVideoBack) this.dialogVideoBack = false
if (this.dialogVideoAll) { if (this.dialogVideoAll) {

View File

@ -100,6 +100,7 @@ export default {
dialogVideoBack: false, dialogVideoBack: false,
dialogVideoAll: false, dialogVideoAll: false,
VIDEOURL: '', VIDEOURL: '',
timer: '',
player: {}, player: {},
// //
config: config, config: config,
@ -125,6 +126,18 @@ export default {
}, },
methods: { methods: {
//
start() {
console.log('定时器开启')
this.timer = setInterval(this.over, (5 * 60 * 1000)) // 5;
},
over() {
//
console.log('定时器自动关闭')
this.$message.warning('单次播放时长已到5分钟自动关闭')
this.back()
clearInterval(this.timer)
},
async init(UNITS_ID) { async init(UNITS_ID) {
this.visible = true this.visible = true
this.UNITS_ID = UNITS_ID this.UNITS_ID = UNITS_ID
@ -172,6 +185,8 @@ export default {
} }
}, },
back() { back() {
console.log('定时器手动关闭')
clearInterval(this.timer)
if (this.dialogVideo) this.dialogVideo = false if (this.dialogVideo) this.dialogVideo = false
if (this.dialogVideoBack) this.dialogVideoBack = false if (this.dialogVideoBack) this.dialogVideoBack = false
if (this.dialogVideoAll) { if (this.dialogVideoAll) {
@ -187,6 +202,8 @@ export default {
} }
}, },
showVideo(row) { showVideo(row) {
this.$message.warning('单次播放最多五分钟')
this.start()
if (!row.PLATFORMVIDEOMANAGEMENT_ID) { if (!row.PLATFORMVIDEOMANAGEMENT_ID) {
this.VIDEOURL = row.VIDEOURL this.VIDEOURL = row.VIDEOURL
this.dialogVideo = true this.dialogVideo = true
@ -217,6 +234,7 @@ export default {
}) })
}) })
}).catch((e) => { }).catch((e) => {
this.over()
this.listLoading = false this.listLoading = false
}) })
} }
@ -264,8 +282,11 @@ export default {
closeWindow() { closeWindow() {
this.handleClose() this.handleClose()
} }
} },
beforeDestroy() {
console.log('页面定时器关闭')
clearInterval(this.timer)
},
} }
</script> </script>

View File

@ -249,7 +249,7 @@ export default {
}, },
over() { over() {
// //
console.log('定时器动关闭') console.log('定时器动关闭')
clearInterval(this.timer) clearInterval(this.timer)
}, },
closeVideoStart() { closeVideoStart() {
@ -702,6 +702,8 @@ export default {
}) })
}, },
back() { back() {
console.log('手动关闭定时器')
clearInterval(this.timer)
if (this.dialogVideo) this.dialogVideo = false if (this.dialogVideo) this.dialogVideo = false
if (this.dialogVideoBack) this.dialogVideoBack = false if (this.dialogVideoBack) this.dialogVideoBack = false
if (this.dialogVideoAll) { if (this.dialogVideoAll) {