Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2022-04-21 15:07:38 +08:00
4 changed files with 72 additions and 32 deletions

View File

@@ -39,6 +39,7 @@
:instance="instance" :instance="instance"
@replay="onReplay" @replay="onReplay"
@backLiveing="playbackUrls = []" @backLiveing="playbackUrls = []"
@checkChange="onCheckChange"
v-if="!isShowBar && monitors.length" v-if="!isShowBar && monitors.length"
style="width: 100%; height: 68px;"> style="width: 100%; height: 68px;">
</Synergy> </Synergy>
@@ -152,6 +153,14 @@
} }
}, },
onCheckChange (e) {
this.monitors.forEach((item, index) => {
if (e.indexOf(item.index) === -1) {
this.monitors.splice(index, 1)
}
})
},
onChange(e) { onChange(e) {
if (e === 1 && this.monitors.length) { if (e === 1 && this.monitors.length) {
this.monitors = [this.monitors[0]] this.monitors = [this.monitors[0]]

View File

@@ -168,7 +168,10 @@
}, },
backLiveing () { backLiveing () {
this.form.date = this.$moment(new Date()).format('YYYY-MM-DD')
this.date = this.$moment(new Date()).format('YYYY-MM-DD')
this.getLiveingUrl() this.getLiveingUrl()
this.getSlwPlaybackTime()
}, },
getLiveingUrl () { getLiveingUrl () {

View File

@@ -57,11 +57,14 @@
<img title="展开" src="https://cdn.cunwuyun.cn/slw2.0/images/arrow.png" /> <img title="展开" src="https://cdn.cunwuyun.cn/slw2.0/images/arrow.png" />
</div> </div>
<div class="playback-list" v-if="isShowTimeline"> <div class="playback-list" v-if="isShowTimeline">
<div class="playback-item" v-for="(item, index) in times" :key="index"> <el-checkbox-group v-model="checked" @change="onCheckChange">
<el-checkbox></el-checkbox> <div class="playback-item" v-for="(item, index) in times" :key="index">
<span>通道{{ index }}</span> <el-checkbox :label="item.id">
<PlaybackTime class="playback-item__timeline" :key="'PlaybackTime' + index" :times="item"></PlaybackTime> <span>通道{{ index + 1 }}</span>
</div> <PlaybackTime class="playback-item__timeline" :key="'PlaybackTime' + index" :times="item.times"></PlaybackTime>
</el-checkbox>
</div>
</el-checkbox-group>
</div> </div>
</div> </div>
<ai-dialog <ai-dialog
@@ -99,6 +102,7 @@
return { return {
canvasWidth: 0, canvasWidth: 0,
currIndex: 0, currIndex: 0,
checked: [],
isShowDate: false, isShowDate: false,
isShow: true, isShow: true,
isShowVolume: false, isShowVolume: false,
@@ -124,17 +128,14 @@
}, },
watch: { watch: {
src: { ids: {
handler (val) { handler (val) {
if (val) { if (val) {
this.isShow = false this.checked = this.ids.split(',')
this.getSlwPlaybackTime()
this.$nextTick(() => {
this.isShow = true
})
} }
}, },
immediate: true, immediate: false,
deep: true deep: true
} }
}, },
@@ -142,7 +143,9 @@
mounted () { mounted () {
this.form.date = this.$moment(new Date()).format('YYYY-MM-DD') this.form.date = this.$moment(new Date()).format('YYYY-MM-DD')
this.date = this.$moment(new Date()).format('YYYY-MM-DD') this.date = this.$moment(new Date()).format('YYYY-MM-DD')
this.getSlwPlaybackTime() this.getSlwPlaybackTime()
this.checked = this.ids.split(',')
this.$nextTick(() => { this.$nextTick(() => {
this.init() this.init()
}) })
@@ -167,6 +170,10 @@
this.isChoose = true this.isChoose = true
}, },
onCheckChange (e) {
this.$emit('checkChange', e)
},
backLiveing () { backLiveing () {
this.$emit('backLiveing') this.$emit('backLiveing')
this.isLiveing = true this.isLiveing = true
@@ -322,17 +329,20 @@
if (res.code == 0) { if (res.code == 0) {
if (res.data && res.data.length) { if (res.data && res.data.length) {
this.times = res.data.map(v => { this.times = res.data.map(v => {
return v.times.map(item => { return {
const startTime = (item.startTime - new Date(this.date + ' 00:00:00').getTime()) / 1000 id: v.id,
const endTime = (item.endTime - new Date(this.date + ' 00:00:00').getTime()) / 1000 times: v.times.map(item => {
const startTime = (item.startTime - new Date(this.date + ' 00:00:00').getTime()) / 1000
const endTime = (item.endTime - new Date(this.date + ' 00:00:00').getTime()) / 1000
return { return {
startTime: Number(startTime.toFixed(0)), startTime: Number(startTime.toFixed(0)),
endTime: Number(endTime.toFixed(0)) endTime: Number(endTime.toFixed(0))
} }
}).sort((a, b) => { }).sort((a, b) => {
return a.startTime - b.startTime return a.startTime - b.startTime
}) })
}
}) })
} }
@@ -406,8 +416,6 @@
color: #FFFFFF; color: #FFFFFF;
.playback-item { .playback-item {
display: flex;
align-items: center;
width: 100%; width: 100%;
margin-bottom: 4px; margin-bottom: 4px;
@@ -415,14 +423,28 @@
margin-bottom: 0; margin-bottom: 0;
} }
.playback-item__timeline { .el-checkbox {
flex: 1; display: flex;
height: 12px; align-items: center;
border-radius: 6px; width: 100%;
}
span { .el-checkbox__label {
padding: 0 8px 0 0; display: flex;
align-items: center;
flex: 1;
.playback-item__timeline {
flex: 1;
height: 12px;
line-height: 1;
border-radius: 6px;
}
span {
padding: 0 8px 0 0;
color: #fff;
}
}
} }
} }
} }

View File

@@ -133,6 +133,12 @@
}, },
init () { init () {
if (this.timer) {
clearInterval(this.timer)
this.timer = null
}
this.ratioW = this.x / this.canvasWidth
this.$nextTick(() => { this.$nextTick(() => {
this.isInit = true this.isInit = true
this.$nextTick(() => { this.$nextTick(() => {
@@ -146,7 +152,7 @@
this.ctx.height = document.querySelector('.canvas').offsetHeight this.ctx.height = document.querySelector('.canvas').offsetHeight
if (this.x > 0) { if (this.x > 0) {
this.x = this.canvasWidth * this.ratioW this.x = this.ratioW * this.canvasWidth
} else { } else {
this.initNowTime() this.initNowTime()
} }