|
|
@@ -1,97 +1,101 @@
|
|
|
<template>
|
|
|
<Teleport to="body">
|
|
|
<div v-if="state.open" class="video-monitor-backdrop">
|
|
|
- <section class="video-monitor" role="dialog" aria-modal="true" aria-labelledby="video-monitor-title" data-video-monitor>
|
|
|
- <header>
|
|
|
- <div>
|
|
|
- <h2 id="video-monitor-title">{{ state.device?.deviceName || '视频监控设备' }}</h2>
|
|
|
- <!-- The six fields the operator checks on a monitor device (维护者 2026-11-18). -->
|
|
|
- <dl class="video-monitor__meta" data-video-meta>
|
|
|
- <div><dt>设备名称</dt><dd data-video-meta-field="deviceName">{{ state.device?.deviceName || '—' }}</dd></div>
|
|
|
- <div><dt>业务设备编码</dt><dd data-video-meta-field="businessCode">{{ state.device?.businessCode || state.device?.deviceCode || '—' }}</dd></div>
|
|
|
- <div><dt>接入方式</dt><dd data-video-meta-field="accessType">{{ accessTypeText }}</dd></div>
|
|
|
- <div><dt>国标设备 / 通道</dt><dd data-video-meta-field="gb">{{ gbText }}</dd></div>
|
|
|
- <div><dt>安装位置</dt><dd data-video-meta-field="location">{{ state.device?.location || '—' }}</dd></div>
|
|
|
- <div><dt>厂商</dt><dd data-video-meta-field="manufacturer">{{ state.device?.manufacturer || '—' }}</dd></div>
|
|
|
- </dl>
|
|
|
- </div>
|
|
|
- <button type="button" aria-label="关闭监控" @click="video.close">关闭</button>
|
|
|
+ <section class="video-monitor" role="dialog" aria-modal="true" aria-labelledby="video-monitor-title"
|
|
|
+ data-video-monitor data-video-design="dahua-cockpit-b">
|
|
|
+ <header class="video-monitor__header">
|
|
|
+ <div><span class="video-monitor__eyebrow">VIDEO / 现场监控</span><h2 id="video-monitor-title">{{ state.device?.deviceName || '视频监控设备' }}</h2></div>
|
|
|
+ <button type="button" class="video-monitor__close" aria-label="关闭监控" @click="video.close">关闭 <span aria-hidden="true">×</span></button>
|
|
|
</header>
|
|
|
- <div class="video-monitor__tabs">
|
|
|
- <button type="button" :aria-pressed="mode === 'live'" @click="switchMode('live')">实时视频</button>
|
|
|
- <button type="button" :aria-pressed="mode === 'history'" :disabled="!state.device?.capabilities?.records"
|
|
|
- :title="state.device?.capabilities?.records ? '' : '此设备未确认录像能力'" @click="switchMode('history')">历史录像</button>
|
|
|
- </div>
|
|
|
- <template v-if="mode === 'history'">
|
|
|
- <div class="video-monitor__range">
|
|
|
- <label>开始 <input v-model="range.startTime" type="text" placeholder="yyyy-MM-dd HH:mm:ss" /></label>
|
|
|
- <label>结束 <input v-model="range.endTime" type="text" placeholder="yyyy-MM-dd HH:mm:ss" /></label>
|
|
|
- <button type="button" :disabled="state.historyPhase === 'querying'" @click="video.queryHistory(range.startTime, range.endTime)">查询录像</button>
|
|
|
- </div>
|
|
|
- <p v-if="state.historyPhase === 'querying'">正在查询录像…</p>
|
|
|
- <p v-else-if="state.historyError" role="alert">{{ state.historyError }}</p>
|
|
|
- <p v-else-if="state.historyPhase === 'listed' && state.empty">该时间段没有录像(查询范围不代表留存期限)</p>
|
|
|
- <ul v-else-if="state.records?.length" class="video-monitor__records">
|
|
|
- <li v-for="(record, index) in state.records" :key="index">
|
|
|
- <span>{{ record.name || '录像' }}{{ record.type ? ` · ${record.type}` : '' }} {{ record.startTime }} ~ {{ record.endTime }}</span>
|
|
|
- <button type="button" @click="playRecord(record)">播放</button>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- <!-- Volume and fullscreen are not device capabilities, so they stay usable here;
|
|
|
- the native bar was removed only to stop pause/seek bypassing the grey gate. -->
|
|
|
- <div v-if="state.playbackMedia" class="video-monitor__playback-controls" data-playback-surface>
|
|
|
- <button type="button" data-playback-mute :aria-pressed="playbackMuted"
|
|
|
- @click="togglePlaybackMute">{{ playbackMuted ? '取消静音' : '静音' }}</button>
|
|
|
- <button type="button" data-playback-fullscreen @click="enterPlaybackFullscreen">全屏</button>
|
|
|
- <label v-if="state.playbackControls?.seek" class="video-monitor__seek">
|
|
|
- 跳到 <input v-model="playbackPosition" type="number" min="0" step="1"
|
|
|
- :max="playbackDuration" data-playback-position /> 秒
|
|
|
- <span v-if="playbackDuration" class="video-monitor__seek-max">(本段共 {{ playbackDuration }} 秒)</span>
|
|
|
- </label>
|
|
|
- </div>
|
|
|
- <!-- Unconfirmed playback controls stay visible but grey, each stating why. -->
|
|
|
- <div v-if="state.playbackMedia" class="video-monitor__playback-controls">
|
|
|
- <button v-for="control in playbackControls" :key="control.key" type="button"
|
|
|
- :data-playback-control="control.key" :disabled="!control.enabled"
|
|
|
- :title="control.enabled ? '' : control.reason" @click="runControl(control)">{{ control.label }}</button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <p class="video-monitor__status" role="status">{{ labels[state.phase] || '未播放' }}</p>
|
|
|
- <p v-if="retryNote" class="video-monitor__status" role="status">{{ retryNote }}</p>
|
|
|
+ <dl class="video-monitor__meta" data-video-meta>
|
|
|
+ <div><dt>设备名称</dt><dd data-video-meta-field="deviceName">{{ state.device?.deviceName || '—' }}</dd></div>
|
|
|
+ <div><dt>业务设备编码</dt><dd data-video-meta-field="businessCode">{{ state.device?.businessCode || state.device?.deviceCode || '—' }}</dd></div>
|
|
|
+ <div><dt>接入方式</dt><dd data-video-meta-field="accessType">{{ accessTypeText }}</dd></div>
|
|
|
+ <div><dt>国标设备 / 通道</dt><dd data-video-meta-field="gb">{{ gbText }}</dd></div>
|
|
|
+ <div><dt>安装位置</dt><dd data-video-meta-field="location">{{ state.device?.location || '—' }}</dd></div>
|
|
|
+ <div><dt>厂商</dt><dd data-video-meta-field="manufacturer">{{ state.device?.manufacturer || '—' }}</dd></div>
|
|
|
+ </dl>
|
|
|
<div class="video-monitor__body">
|
|
|
- <aside data-ptz-panel>
|
|
|
- <h3>云台控制</h3>
|
|
|
- <!-- Buttons always exist; an absent capability or permission only greys them (维护者 2026-11-18). -->
|
|
|
- <div class="video-monitor__ptz" role="group" aria-label="云台控制">
|
|
|
+ <aside class="video-monitor__ptz-panel" data-ptz-panel aria-label="云台界面预留">
|
|
|
+ <div class="video-monitor__section-head"><h3>云台控制</h3><span class="video-monitor__badge">界面预留</span></div>
|
|
|
+ <div class="video-monitor__ptz-pad" data-ptz-pad role="group" aria-label="八向云台方向盘">
|
|
|
<button v-for="key in PTZ_DIRECTIONS" :key="key" type="button" :data-ptz-direction="key"
|
|
|
- :disabled="!ptzEnabled" :title="ptzEnabled ? '' : ptzReason">{{ ptzLabel(key) }}</button>
|
|
|
+ :class="'video-monitor__direction--' + key" disabled :title="ptzReason" :aria-label="'云台' + PTZ_LABELS[key]">
|
|
|
+ <span aria-hidden="true">{{ PTZ_ARROWS[key] }}</span>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="video-monitor__ptz-stop" data-ptz-stop disabled :title="ptzReason" aria-label="云台停止"><span aria-hidden="true">■</span><small>停止</small></button>
|
|
|
</div>
|
|
|
- <div class="video-monitor__ptz" role="group" aria-label="云台变倍">
|
|
|
- <button type="button" data-ptz-zoom="in" :disabled="!ptzEnabled" :title="ptzEnabled ? '' : ptzReason">放大</button>
|
|
|
- <button type="button" data-ptz-zoom="out" :disabled="!ptzEnabled" :title="ptzEnabled ? '' : ptzReason">缩小</button>
|
|
|
+ <label class="video-monitor__speed">速度 <span>STEP {{ ptzSpeed }}</span><input v-model="ptzSpeed" type="range" min="1" max="8" step="1" disabled :title="ptzReason" aria-label="云台速度" data-ptz-speed /></label>
|
|
|
+ <div class="video-monitor__lens" role="group" aria-label="云台镜头控制">
|
|
|
+ <span>变倍</span><button type="button" data-ptz-zoom="out" disabled :title="ptzReason" aria-label="云台缩小">−</button><button type="button" data-ptz-zoom="in" disabled :title="ptzReason" aria-label="云台放大">+</button>
|
|
|
+ <span>聚焦</span><button type="button" data-ptz-focus="far" disabled :title="ptzReason" aria-label="云台远焦">−</button><button type="button" data-ptz-focus="near" disabled :title="ptzReason" aria-label="云台近焦">+</button>
|
|
|
</div>
|
|
|
- <button type="button" data-ptz-stop :disabled="!ptzEnabled" :title="ptzEnabled ? '' : ptzReason">停止</button>
|
|
|
- <p v-if="!ptzEnabled" data-ptz-hint>{{ ptzReason }}</p>
|
|
|
+ <p class="video-monitor__ptz-hint" data-ptz-hint>{{ ptzReason }}</p>
|
|
|
+ <p class="video-monitor__note">本期仅呈现控制布局,不发送物理控制命令。</p>
|
|
|
</aside>
|
|
|
- <div class="video-monitor__screen">
|
|
|
- <VideoPlayer v-if="state.media" :media="state.media" @ready="video.ready" @error="video.fail" />
|
|
|
- <!-- Live and playback share one Jessibuca FLV player; native controls would
|
|
|
- also bypass the grey gate, so playback turns them off. -->
|
|
|
- <VideoPlayer v-else-if="state.playbackMedia" :media="state.playbackMedia"
|
|
|
- label="历史录像画面" :controls="false"
|
|
|
- @ready="video.readyPlayback" @error="video.failPlayback" />
|
|
|
- <p v-else-if="state.phase === 'retrying'">等待自动重连…</p>
|
|
|
- <p v-else>{{ state.error || '等待视频连接' }}</p>
|
|
|
+ <div class="video-monitor__viewer">
|
|
|
+ <div ref="surface" class="video-monitor__surface" data-video-surface>
|
|
|
+ <div class="video-monitor__screen">
|
|
|
+ <VideoPlayer v-if="mode === 'live' && state.media" key="live" :media="state.media" :controls="false"
|
|
|
+ :muted="playbackMuted" :volume="volume / 100" @ready="video.ready" @error="video.fail" @presentation-error="presentationError = $event" />
|
|
|
+ <VideoPlayer v-else-if="mode === 'history' && state.playbackMedia" key="history" :media="state.playbackMedia" :controls="false"
|
|
|
+ label="历史录像画面" :muted="playbackMuted" :volume="volume / 100" @ready="video.readyPlayback" @error="video.failPlayback" @presentation-error="presentationError = $event" />
|
|
|
+ <div v-else class="video-monitor__placeholder"><span aria-hidden="true">▷</span><p>{{ mode === 'history' ? (state.historyError || '请选择已有录像开始回放') : (state.error || '等待视频连接') }}</p></div>
|
|
|
+ </div>
|
|
|
+ <div class="video-monitor__toolbar" data-video-toolbar :data-playback-surface="mode === 'history' ? '' : undefined">
|
|
|
+ <div class="video-monitor__tabs" role="group" aria-label="视频模式">
|
|
|
+ <button type="button" :aria-pressed="mode === 'live'" :disabled="switching" @click="switchMode('live')">实时视频</button>
|
|
|
+ <button type="button" :aria-pressed="mode === 'history'" :disabled="switching || !state.device?.capabilities?.records"
|
|
|
+ :title="state.device?.capabilities?.records ? '' : '此设备未提供录像查询能力'" @click="switchMode('history')">历史录像</button>
|
|
|
+ </div>
|
|
|
+ <span class="video-monitor__status" role="status" :data-video-phase="mode === 'live' ? state.phase : state.historyPhase">{{ statusText }}</span>
|
|
|
+ <div class="video-monitor__presentation">
|
|
|
+ <button type="button" data-video-mute :data-playback-mute="mode === 'history' ? '' : undefined" :disabled="!activeMedia" :aria-pressed="playbackMuted"
|
|
|
+ :aria-label="playbackMuted ? '取消静音' : '静音'" @click="togglePlaybackMute">{{ playbackMuted ? '取消静音' : '静音' }}</button>
|
|
|
+ <label>音量<input v-model="volume" type="range" min="0" max="100" step="1" :disabled="!activeMedia" aria-label="视频音量" data-video-volume /></label>
|
|
|
+ <button type="button" data-video-fullscreen :data-playback-fullscreen="mode === 'history' ? '' : undefined" :disabled="!activeMedia" aria-label="视频画面全屏" @click="enterPlaybackFullscreen">全屏</button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <template v-if="mode === 'history' && state.playbackMedia">
|
|
|
+ <div class="video-monitor__playback-controls" role="group" aria-label="录像回放控制">
|
|
|
+ <button v-for="control in playbackControls" :key="control.key" type="button" :data-playback-control="control.key" :disabled="!control.enabled"
|
|
|
+ :title="control.enabled ? '' : control.reason" :aria-label="control.label" @click="runControl(control)">{{ control.label }}</button>
|
|
|
+ </div>
|
|
|
+ <label v-if="state.playbackControls?.seek" class="video-monitor__seek">跳转位置
|
|
|
+ <input v-model="playbackPosition" type="number" min="0" :max="playbackDuration" step="1" aria-label="录像跳转秒数" data-playback-position />
|
|
|
+ <span>/ {{ playbackDuration }} 秒</span>
|
|
|
+ <input v-model="playbackPosition" type="range" min="0" :max="playbackDuration" step="1" aria-label="选择录像跳转位置" data-playback-seek-slider />
|
|
|
+ </label>
|
|
|
+ </template>
|
|
|
+ <p v-if="presentationError" class="video-monitor__warning" role="alert" data-video-presentation-error>{{ presentationError }}</p>
|
|
|
+ </div>
|
|
|
+ <div v-if="mode === 'history'" class="video-monitor__history" data-video-history>
|
|
|
+ <div class="video-monitor__range">
|
|
|
+ <label>开始(UTC+8)<input v-model="range.startTime" type="text" placeholder="yyyy-MM-dd HH:mm:ss" aria-label="录像查询开始时间" /></label>
|
|
|
+ <label>结束(UTC+8)<input v-model="range.endTime" type="text" placeholder="yyyy-MM-dd HH:mm:ss" aria-label="录像查询结束时间" /></label>
|
|
|
+ <button type="button" :disabled="state.historyPhase === 'querying'" @click="video.queryHistory(range.startTime, range.endTime)">查询录像</button>
|
|
|
+ </div>
|
|
|
+ <div class="video-monitor__records-scroll" tabindex="0" aria-label="录像查询结果" data-video-records-region>
|
|
|
+ <p v-if="state.historyPhase === 'querying'">正在查询录像…</p>
|
|
|
+ <p v-else-if="state.historyError" role="alert">{{ state.historyError }}</p>
|
|
|
+ <p v-else-if="state.empty">该时间段没有录像(查询范围不代表留存期限)</p>
|
|
|
+ <ul v-else-if="state.records?.length" class="video-monitor__records">
|
|
|
+ <li v-for="(record, index) in state.records" :key="index" :class="{ 'is-selected': selectedRecord === record }">
|
|
|
+ <span><b>{{ record.name || '录像' }}</b><small>{{ record.type || '录像片段' }} · {{ record.startTime }} ~ {{ record.endTime }}</small></span>
|
|
|
+ <button type="button" :disabled="switching || state.historyPhase === 'starting'" :aria-label="'播放录像 ' + record.startTime" @click="playRecord(record)">播放</button>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <p v-if="state.error && state.media" role="alert">{{ state.error }}</p>
|
|
|
+ <p v-if="retryNote && mode === 'live'" class="video-monitor__status" role="status">{{ retryNote }}</p>
|
|
|
+ <p v-if="state.error && mode === 'live' && state.media" role="alert">{{ state.error }}</p>
|
|
|
<p v-if="state.cleanupError" class="video-monitor__warning" role="alert">{{ state.cleanupError }}</p>
|
|
|
- <footer>
|
|
|
- <!-- Live-only: in history mode this would start a live stream beside the playback. -->
|
|
|
- <button v-if="mode === 'live' && !state.media && !['starting','connecting','retrying'].includes(state.phase)"
|
|
|
- type="button" :disabled="Boolean(state.cleanupError)" @click="video.retry">重新播放</button>
|
|
|
+ <footer class="video-monitor__footer">
|
|
|
+ <button v-if="mode === 'live' && !state.media && !['starting','connecting','retrying'].includes(state.phase)" type="button" :disabled="Boolean(state.cleanupError)" @click="video.retry">重新播放</button>
|
|
|
<button v-if="state.cleanupError" type="button" @click="video.retryCleanup">重试清理</button>
|
|
|
- <span>默认静音 · 不提供截图、下载或录制</span>
|
|
|
+ <span>默认静音 · 不提供截图、下载或录制</span><span>Jessibuca / FLV</span>
|
|
|
</footer>
|
|
|
</section>
|
|
|
</div>
|
|
|
@@ -111,17 +115,14 @@ const labels = { idle: '未播放', starting: '正在建立视频会话', connec
|
|
|
// Switching tabs ends the current stream but must keep the monitor open.
|
|
|
const mode = ref('live')
|
|
|
const range = reactive(video.historyWindow())
|
|
|
-// PTZ panel: the buttons are always present; only capability/permission greys them out.
|
|
|
-const PTZ_DIRECTIONS = ['up', 'down', 'left', 'right', 'up-left', 'up-right', 'down-left', 'down-right']
|
|
|
+const switching = ref(false)
|
|
|
+// This release presents PTZ only; a capability flag alone must never enable physical commands.
|
|
|
+const PTZ_DIRECTIONS = ['up-left', 'up', 'up-right', 'left', 'right', 'down-left', 'down', 'down-right']
|
|
|
const PTZ_LABELS = { up: '上', down: '下', left: '左', right: '右', 'up-left': '左上', 'up-right': '右上', 'down-left': '左下', 'down-right': '右下' }
|
|
|
-const ptzLabel = (key) => PTZ_LABELS[key]
|
|
|
-// Real device PTZ control is ticket 06; until the device confirms it, the buttons stay grey with a reason.
|
|
|
-const PTZ_UNCONFIRMED = '设备未确认云台能力或当前无控制权限'
|
|
|
-const ptzEnabled = computed(() => {
|
|
|
- const device = state.value.device
|
|
|
- return Boolean(device?.capabilities?.ptz) && !state.value.cleanupError
|
|
|
-})
|
|
|
-const ptzReason = computed(() => state.value.cleanupError ? '会话释放未确认,暂停控制' : PTZ_UNCONFIRMED)
|
|
|
+const PTZ_ARROWS = { up: '↑', down: '↓', left: '←', right: '→', 'up-left': '↖', 'up-right': '↗', 'down-left': '↙', 'down-right': '↘' }
|
|
|
+const ptzSpeed = ref(4)
|
|
|
+const ptzReason = computed(() => state.value.cleanupError ? '会话释放未确认,暂停控制'
|
|
|
+ : state.value.device?.capabilities?.ptz ? '云台操作尚未接入,本期仅界面预留' : '设备暂不支持云台控制')
|
|
|
// Access mode and GB identifiers come straight from the binding; blanks show as a dash.
|
|
|
const ACCESS_TEXT = { GB28181: '国标接入', MANUAL: '手工接入' }
|
|
|
const accessTypeText = computed(() => {
|
|
|
@@ -134,21 +135,28 @@ const gbText = computed(() => {
|
|
|
? `${device.gbDeviceId || '—'} / ${device.gbChannelId || '—'}`
|
|
|
: '—'
|
|
|
})
|
|
|
+let modeVersion = 0
|
|
|
const switchMode = async (next) => {
|
|
|
- if (next === mode.value) return
|
|
|
- if (next === 'history') {
|
|
|
- await video.stopLive()
|
|
|
- mode.value = 'history'
|
|
|
- await video.queryHistory(range.startTime, range.endTime)
|
|
|
- } else {
|
|
|
- await video.stopPlayback()
|
|
|
- mode.value = 'live'
|
|
|
- await video.startLive()
|
|
|
- }
|
|
|
+ if (next === mode.value || switching.value) return
|
|
|
+ const version = ++modeVersion
|
|
|
+ switching.value = true
|
|
|
+ try {
|
|
|
+ if (next === 'history') await video.stopLive()
|
|
|
+ else await video.stopPlayback()
|
|
|
+ // Close, selection changes and unconfirmed cleanup must not resume an old switch.
|
|
|
+ if (version !== modeVersion || !state.value.open || state.value.cleanupError) return
|
|
|
+ mode.value = next
|
|
|
+ if (next === 'history') await video.queryHistory(range.startTime, range.endTime)
|
|
|
+ else await video.startLive()
|
|
|
+ } finally { if (version === modeVersion) switching.value = false }
|
|
|
+}
|
|
|
+const selectedRecord = ref(null)
|
|
|
+const playRecord = async (record) => {
|
|
|
+ playbackPosition.value = ''
|
|
|
+ selectedRecord.value = record
|
|
|
+ await video.play(record.startTime, record.endTime)
|
|
|
}
|
|
|
-const playRecord = (record) => video.play(record.startTime, record.endTime)
|
|
|
-// Every playback control is advertised with its real availability. Until a device is confirmed,
|
|
|
-// each stays grey with a stated reason instead of silently disappearing.
|
|
|
+// Controls describe the server operation set, not a claim of physical device support.
|
|
|
const CONTROL_REASON = '服务端未开放此控制能力'
|
|
|
const playbackControls = computed(() => {
|
|
|
const granted = state.value.playbackControls || {}
|
|
|
@@ -175,16 +183,21 @@ const runControl = (control) => {
|
|
|
}
|
|
|
void video.controlPlayback(control.key)
|
|
|
}
|
|
|
-// Local presentation only: the player starts muted, and neither action is a device capability.
|
|
|
-const playbackMuted = ref(true)
|
|
|
-const playbackVideo = () => document.querySelector('[data-video-monitor] video[aria-label="历史录像画面"]')
|
|
|
-const togglePlaybackMute = () => {
|
|
|
- const element = playbackVideo()
|
|
|
- if (!element) return
|
|
|
- playbackMuted.value = !playbackMuted.value
|
|
|
- element.muted = playbackMuted.value
|
|
|
+// Local presentation never creates a new business session or sends a device command.
|
|
|
+const surface = ref(null)
|
|
|
+const playbackMuted = ref(true), volume = ref(50), presentationError = ref('')
|
|
|
+const activeMedia = computed(() => mode.value === 'live' ? state.value.media : state.value.playbackMedia)
|
|
|
+const statusText = computed(() => labels[mode.value === 'live' ? state.value.phase : state.value.historyPhase] || '未播放')
|
|
|
+const togglePlaybackMute = () => { playbackMuted.value = !playbackMuted.value; presentationError.value = '' }
|
|
|
+const enterPlaybackFullscreen = async () => {
|
|
|
+ const target = surface.value
|
|
|
+ presentationError.value = ''
|
|
|
+ try {
|
|
|
+ if (!target?.requestFullscreen) throw new Error('此浏览器不支持画面全屏')
|
|
|
+ await target.requestFullscreen()
|
|
|
+ } catch (error) { presentationError.value = error?.message || '无法进入全屏,请检查浏览器权限' }
|
|
|
}
|
|
|
-const enterPlaybackFullscreen = () => { void playbackVideo()?.requestFullscreen?.() }
|
|
|
+watch(activeMedia, () => { playbackMuted.value = true; presentationError.value = '' })
|
|
|
const retryNote = computed(() => state.value.phase !== 'retrying' || !state.value.retryAttempt
|
|
|
? ''
|
|
|
: `第 ${state.value.retryAttempt} 次自动重试,等待 ${Math.round((state.value.retryDelayMs || 0) / 1000)} 秒(剩余 ${state.value.retriesLeft ?? 0} 次)`)
|
|
|
@@ -195,7 +208,10 @@ watch(() => [state.value.ownerSource, detail.selection.deviceCode, enhancement.s
|
|
|
}, { flush: 'sync' })
|
|
|
let trigger
|
|
|
watch(() => state.value.open, async (open) => {
|
|
|
+ modeVersion++; switching.value = false
|
|
|
if (!open) { if (trigger?.isConnected) trigger.focus?.(); return }
|
|
|
+ mode.value = 'live'; selectedRecord.value = null; playbackPosition.value = ''; playbackMuted.value = true; volume.value = 50
|
|
|
+ Object.assign(range, video.historyWindow())
|
|
|
trigger = document.activeElement
|
|
|
await nextTick()
|
|
|
if (state.value.open) document.querySelector('[data-video-monitor] [aria-label="关闭监控"]')?.focus()
|
|
|
@@ -204,7 +220,10 @@ const keyboard = (event) => {
|
|
|
if (!state.value.open) return
|
|
|
if (event.key === 'Escape') { event.preventDefault(); void video.close(); return }
|
|
|
if (event.key !== 'Tab') return
|
|
|
- const items = Array.from(document.querySelectorAll('[data-video-monitor] button:not(:disabled), [data-video-monitor] video'))
|
|
|
+ // Fullscreen hides the rest of the dialog; never wrap focus onto an invisible close button.
|
|
|
+ const root = document.fullscreenElement === surface.value ? surface.value : document.querySelector('[data-video-monitor]')
|
|
|
+ const items = Array.from(root?.querySelectorAll('button:not(:disabled), input:not(:disabled), select:not(:disabled), [tabindex="0"]') || [])
|
|
|
+ .filter(element => !element.hidden && element.getAttribute('aria-hidden') !== 'true')
|
|
|
if (!items.length) return
|
|
|
const index = items.indexOf(document.activeElement)
|
|
|
if (index < 0 || (event.shiftKey && index === 0) || (!event.shiftKey && index === items.length - 1)) {
|
|
|
@@ -216,28 +235,4 @@ const leave = () => { void video.close() }
|
|
|
onMounted(() => { document.addEventListener('visibilitychange', hidden); document.addEventListener('keydown', keyboard); window.addEventListener('pagehide', leave) })
|
|
|
onBeforeUnmount(() => { document.removeEventListener('visibilitychange', hidden); document.removeEventListener('keydown', keyboard); window.removeEventListener('pagehide', leave); void video.close() })
|
|
|
</script>
|
|
|
-<style scoped>
|
|
|
-.video-monitor-backdrop { position: fixed; inset: 0; z-index: 15000; display: grid; place-items: center; padding: 24px; background: #0009; }
|
|
|
-.video-monitor { width: min(76vw, 1400px); max-height: 92vh; overflow: auto; color: #e0f6ff; background: #092635f5; border: 1px solid #3a91a5; border-radius: 8px; padding: 20px; box-shadow: 0 20px 90px #0009; font-family: sans-serif; }
|
|
|
-.video-monitor header { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
|
|
|
-.video-monitor h2, .video-monitor h3 { margin: 0 0 8px; }
|
|
|
-.video-monitor header p { margin: 0; color: #9dbbc8; overflow-wrap: anywhere; }
|
|
|
-.video-monitor button { padding: 7px 18px; color: #d8f8ff; background: #14556b; border: 1px solid #448ba0; border-radius: 4px; cursor: pointer; }
|
|
|
-.video-monitor button:disabled { color: #8399a3; background: #263c46; border-color: #49616b; cursor: not-allowed; }
|
|
|
-.video-monitor__meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 18px; margin: 8px 0 0; }
|
|
|
-.video-monitor__meta div { display: flex; gap: 8px; font-size: 13px; color: #b6d4e0; }
|
|
|
-.video-monitor__meta dt { color: #8fb4c2; margin: 0; white-space: nowrap; }
|
|
|
-.video-monitor__meta dd { margin: 0; overflow-wrap: anywhere; }
|
|
|
-.video-monitor__ptz { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
|
|
|
-.video-monitor__tabs { display: flex; gap: 20px; align-items: center; margin-top: 18px; }
|
|
|
-.video-monitor__status { color: #a3d5e3; }
|
|
|
-.video-monitor__body { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px; }
|
|
|
-.video-monitor aside { color: #a7c3d0; background: #09212c; padding: 15px; }
|
|
|
-.video-monitor aside p, .video-monitor footer { font-size: 13px; color: #9cb9c5; }
|
|
|
-.video-monitor__screen { min-height: 300px; aspect-ratio: 16 / 9; display: grid; place-items: center; background: #02090e; }
|
|
|
-.video-monitor__screen > :deep(*) { width: 100%; height: 100%; }
|
|
|
-.video-monitor__screen > p { display: grid; place-items: center; margin: 0; }
|
|
|
-.video-monitor__warning { color: #ffc478; }
|
|
|
-.video-monitor footer { display: flex; gap: 16px; align-items: center; margin-top: 15px; }
|
|
|
-@media (max-width: 720px) { .video-monitor { width: 100%; } .video-monitor__body { grid-template-columns: 1fr; } .video-monitor aside { display: none; } }
|
|
|
-</style>
|
|
|
+<style scoped src="./videoMonitorPanel.css"></style>
|