监控自动切换

new-map
ihzero 2023-03-03 13:40:03 +08:00
parent 09d76e302c
commit 2cc05f16f3
2 changed files with 33 additions and 5 deletions

View File

@ -45,12 +45,12 @@
</ARow> -->
<FormItem class="enter-x">
<Button type="primary" size="large" block @click="handleLogin('/')" :loading="loading">
登录后台
</Button>
<Button size="large" class="mt-4" block @click="handleLogin('/v')" :loading="loading">
登录大屏
</Button>
<Button type="primary" size="large" block @click="handleLogin('/')" :loading="loading">
登录后台
</Button>
<!-- <Button size="large" class="mt-4 enter-x" block @click="handleRegister">
{{ t('sys.login.registerButton') }}
</Button> -->

View File

@ -66,7 +66,15 @@
</template>
<script lang="ts">
import { defineComponent, reactive, ref, onBeforeMount, computed, toRefs } from 'vue'
import {
defineComponent,
reactive,
ref,
onBeforeMount,
computed,
toRefs,
onBeforeUnmount,
} from 'vue'
import { DownOutlined } from '@ant-design/icons-vue'
import { Dropdown, Menu } from 'ant-design-vue'
import { getAgriculturalDeviceBasic, getDevices, getffmpegip } from '/@/api/sys/other'
@ -121,7 +129,8 @@
}
async function getData() {
const { ip, port } = await getffmpegip()
const { ip, port, change_time } = await getffmpegip()
const resData = await getDevices({
base_id: props.baseId ?? Data.currentTab,
type: 1,
@ -142,6 +151,21 @@
}
})
if (Data.list.length > 0) currentVido.value = Data.list[0]
if (!isBase.value) {
autoChage(change_time)
}
}
let timer: any = null
function autoChage(time) {
timer && clearInterval(timer)
timer = setInterval(() => {
const index = Data.tabList.findIndex((e) => e.id == Data.currentTab)
const currentIndex = index + 1
const current = Data.tabList[currentIndex % Data.tabList.length]
onMenuClick({ key: current.id, ...current })
}, 1000 * time)
}
function onChangeVideo(e) {
@ -158,6 +182,10 @@
}
})
onBeforeUnmount(() => {
timer && clearInterval(timer)
})
return {
isBase,
listBig,