自动播放视频
This commit is contained in:
@@ -2,12 +2,14 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
|||||||
import router from '@/routers'
|
import router from '@/routers'
|
||||||
import type { DetectionLockHolder } from '@/stores/modules/detectionLock'
|
import type { DetectionLockHolder } from '@/stores/modules/detectionLock'
|
||||||
import mittBus, { STOP_DETECTION_TIMER_EVENT } from '@/utils/mittBus'
|
import mittBus, { STOP_DETECTION_TIMER_EVENT } from '@/utils/mittBus'
|
||||||
|
import { requestResourceManageAutoplayFirst } from '@/utils/resourceManageAutoplay'
|
||||||
|
|
||||||
const stopDetectionTimer = () => {
|
const stopDetectionTimer = () => {
|
||||||
mittBus.emit(STOP_DETECTION_TIMER_EVENT)
|
mittBus.emit(STOP_DETECTION_TIMER_EVENT)
|
||||||
}
|
}
|
||||||
|
|
||||||
const goResourceManage = async () => {
|
const goResourceManage = async () => {
|
||||||
|
requestResourceManageAutoplayFirst()
|
||||||
if (router.hasRoute('resourceManage')) {
|
if (router.hasRoute('resourceManage')) {
|
||||||
await router.push({ name: 'resourceManage' })
|
await router.push({ name: 'resourceManage' })
|
||||||
return
|
return
|
||||||
|
|||||||
11
frontend/src/utils/resourceManageAutoplay.ts
Normal file
11
frontend/src/utils/resourceManageAutoplay.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
let shouldAutoplayFirstVideo = false
|
||||||
|
|
||||||
|
export const requestResourceManageAutoplayFirst = () => {
|
||||||
|
shouldAutoplayFirstVideo = true
|
||||||
|
}
|
||||||
|
|
||||||
|
export const consumeResourceManageAutoplayFirst = () => {
|
||||||
|
if (!shouldAutoplayFirstVideo) return false
|
||||||
|
shouldAutoplayFirstVideo = false
|
||||||
|
return true
|
||||||
|
}
|
||||||
@@ -217,7 +217,10 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
handleFatalError(step1, step1InitLog, '电压和电流过载!')
|
handleFatalError(step1, step1InitLog, '电压和电流过载!')
|
||||||
}
|
}
|
||||||
if (newValue.code === 4) {
|
if (newValue.code === 4) {
|
||||||
handleFatalError(step1, step1InitLog, '过载检测成功!')
|
step1InitLog.value.push({
|
||||||
|
type: 'info',
|
||||||
|
log: '过载测试成功!',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'yjc_ytxjy':
|
case 'yjc_ytxjy':
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import ProTable from '@/components/ProTable/index.vue'
|
|||||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||||
import type { ResourceManage } from '@/api/resourceManage/interface'
|
import type { ResourceManage } from '@/api/resourceManage/interface'
|
||||||
import { getResourceManageList, getResourceManagePlayUrl } from '@/api/resourceManage'
|
import { getResourceManageList, getResourceManagePlayUrl } from '@/api/resourceManage'
|
||||||
|
import { consumeResourceManageAutoplayFirst } from '@/utils/resourceManageAutoplay'
|
||||||
import ResourceManagePopup from './components/resourceManagePopup.vue'
|
import ResourceManagePopup from './components/resourceManagePopup.vue'
|
||||||
import ResourcePlayerDialog from './components/resourcePlayerDialog.vue'
|
import ResourcePlayerDialog from './components/resourcePlayerDialog.vue'
|
||||||
|
|
||||||
@@ -51,7 +52,16 @@ const resourceManagePopup = ref()
|
|||||||
const resourcePlayerDialog = ref()
|
const resourcePlayerDialog = ref()
|
||||||
|
|
||||||
const getTableList = async (params: ResourceManage.ReqResourceManageParams) => {
|
const getTableList = async (params: ResourceManage.ReqResourceManageParams) => {
|
||||||
return getResourceManageList(params)
|
const response = await getResourceManageList(params)
|
||||||
|
const firstRecord = response.data.records?.[0]
|
||||||
|
|
||||||
|
if (consumeResourceManageAutoplayFirst()) {
|
||||||
|
if (firstRecord) {
|
||||||
|
await handlePlay(firstRecord)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatFileSize = (size?: number) => {
|
const formatFileSize = (size?: number) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user