Browse Source

设备视频

pull/19/head
freshman-white 2 years ago
parent
commit
df69595c93
  1. 5
      .eslintrc.js
  2. 1
      package.json
  3. 7
      src/api/manage.ts
  4. 33
      src/components/GMap.vue
  5. 41
      src/components/livestream-newOthers.vue
  6. 7
      src/pages/page-web/projects/tsa.vue

5
.eslintrc.js

@ -3,9 +3,10 @@ module.exports = {
browser: true, browser: true,
commonjs: true, commonjs: true,
es2021: true, es2021: true,
node: true node: true,
}, },
extends: ['standard', 'plugin:vue/vue3-essential'], parser: 'vue-eslint-parser',
extends: ['standard','eslint:recommended', 'plugin:vue/vue3-essential'],
parserOptions: { parserOptions: {
ecmaVersion: 12, ecmaVersion: 12,
parser: '@typescript-eslint/parser' parser: '@typescript-eslint/parser'

1
package.json

@ -53,6 +53,7 @@
"vite-plugin-style-import": "^1.0.1", "vite-plugin-style-import": "^1.0.1",
"vite-plugin-svg-icons": "^1.0.5", "vite-plugin-svg-icons": "^1.0.5",
"vite-plugin-vconsole": "^1.1.0", "vite-plugin-vconsole": "^1.1.0",
"vue-eslint-parser": "^9.3.1",
"vue-tsc": "^0.0.24" "vue-tsc": "^0.0.24"
}, },
"license": "ISC", "license": "ISC",

7
src/api/manage.ts

@ -69,6 +69,13 @@ export const getLiveCapacity = async function (body: {}): Promise<IWorkspaceResp
return result.data return result.data
} }
// 设备信息
export const getLiveSnCapacity = async function (id:any): Promise<IWorkspaceResponse<any>> {
const url = `${HTTP_PREFIX}/live/capacity?sn=${id}`
const result = await request.get(url)
return result.data
}
// Start Livestream // Start Livestream
export const startLivestream = async function (body: {}): Promise<IWorkspaceResponse<any>> { export const startLivestream = async function (body: {}): Promise<IWorkspaceResponse<any>> {
const url = `${HTTP_PREFIX}/live/streams/start` const url = `${HTTP_PREFIX}/live/streams/start`

33
src/components/GMap.vue

@ -140,14 +140,14 @@
{{ 10 > (deviceInfo.device.battery.remain_flight_time % 60) ? '0' : ''}}{{deviceInfo.device.battery.remain_flight_time % 60 }} {{ 10 > (deviceInfo.device.battery.remain_flight_time % 60) ? '0' : ''}}{{deviceInfo.device.battery.remain_flight_time % 60 }}
</div> </div>
</div> </div>
<div class="fz14"> <div class="fz14 content-padding">
<div @click="play()">直播视频</div> <div @click="play()" class="video-btn"><a style="color: white;"><VideoCameraOutlined /></a>直播视频</div>
</div> </div>
</div> </div>
<div class="live" v-if="showLive"> <div class="live" v-if="showLive">
<!-- <div>2222</div> --> <!-- <div>2222</div> -->
<!-- <router-view :name="routeName" /> --> <!-- <router-view :name="routeName" /> -->
<LiveNewOthers></LiveNewOthers> <LiveNewOthers ref="liveStreamRef"></LiveNewOthers>
</div> </div>
</div> </div>
<!-- <div class="osd-panel2 fz12"> <!-- <div class="osd-panel2 fz12">
@ -430,7 +430,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { computed, defineComponent, onMounted, reactive, ref, watch } from 'vue' import { computed, defineComponent, onMounted, reactive, ref, watch, nextTick } from 'vue'
import { import {
generateLineContent, generateLineContent,
generatePointContent, generatePointContent,
@ -459,7 +459,7 @@ import {
BorderOutlined, LineOutlined, CloseOutlined, ControlOutlined, TrademarkOutlined, ArrowDownOutlined, BorderOutlined, LineOutlined, CloseOutlined, ControlOutlined, TrademarkOutlined, ArrowDownOutlined,
ThunderboltOutlined, SignalFilled, GlobalOutlined, HistoryOutlined, CloudUploadOutlined, RocketOutlined, ThunderboltOutlined, SignalFilled, GlobalOutlined, HistoryOutlined, CloudUploadOutlined, RocketOutlined,
FieldTimeOutlined, CloudOutlined, CloudFilled, FolderOpenOutlined, RobotFilled, ArrowUpOutlined, CarryOutOutlined, FieldTimeOutlined, CloudOutlined, CloudFilled, FolderOpenOutlined, RobotFilled, ArrowUpOutlined, CarryOutOutlined,
EyeInvisibleOutlined EyeInvisibleOutlined, VideoCameraOutlined
} from '@ant-design/icons-vue' } from '@ant-design/icons-vue'
import { EDeviceTypeName } from '../types' import { EDeviceTypeName } from '../types'
import DockControlPanel from './g-map/DockControlPanel.vue' import DockControlPanel from './g-map/DockControlPanel.vue'
@ -485,6 +485,7 @@ export default defineComponent({
CloudOutlined, CloudOutlined,
CloudFilled, CloudFilled,
FolderOpenOutlined, FolderOpenOutlined,
VideoCameraOutlined,
RobotFilled, RobotFilled,
ArrowUpOutlined, ArrowUpOutlined,
ArrowDownOutlined, ArrowDownOutlined,
@ -502,7 +503,7 @@ export default defineComponent({
const root = getRoot() const root = getRoot()
// const routeName = ref<string>('LiveOthers') // const routeName = ref<string>('LiveOthers')
const showLive = ref(false) const showLive = ref(false)
const liveStreamRef = ref()
const mouseMode = ref(false) const mouseMode = ref(false)
const store = useMyStore() const store = useMyStore()
const state = reactive({ const state = reactive({
@ -660,9 +661,11 @@ export default defineComponent({
mouseMode.value = bool mouseMode.value = bool
} }
function play () { function play () {
console.log(222)
// routeName.value = 'LiveOthers' // routeName.value = 'LiveOthers'
showLive.value = true showLive.value = !showLive.value
nextTick(() => {
showLive.value ? liveStreamRef.value.onStart() : liveStreamRef.value.onStop()
})
} }
// dock // dock
@ -769,7 +772,7 @@ export default defineComponent({
// layer.id = 'private_layer' + uuidv4() // layer.id = 'private_layer' + uuidv4()
// layer?.elements.push(resource) // layer?.elements.push(resource)
if (layer?.elements) { if (layer?.elements) {
;(layer?.elements as any[]).push(resource) (layer?.elements as any[]).push(resource)
} }
// console.log('layers', layers) // console.log('layers', layers)
// store.commit('SET_LAYER_INFO', layers) // store.commit('SET_LAYER_INFO', layers)
@ -840,6 +843,7 @@ export default defineComponent({
return { return {
draw, draw,
play, play,
liveStreamRef,
showLive, showLive,
// routeName, // routeName,
mouseMode, mouseMode,
@ -911,6 +915,17 @@ export default defineComponent({
color: #fff; color: #fff;
border-radius: 2px; border-radius: 2px;
/* opacity: 0.8; */ /* opacity: 0.8; */
.content-padding{
padding:16px;
.video-btn{
cursor:pointer;
text-align: center;
padding:2px 16px;
width:160px;
background-color:#1fa3f6;
}
}
} }
.live{ .live{
background: #000; background: #000;

41
src/components/livestream-newOthers.vue

@ -8,7 +8,6 @@
class="mt20" class="mt20"
></video> ></video>
<p class="fz24">Live streaming source selection</p> <p class="fz24">Live streaming source selection</p>
<div class=""> <div class="">
<template v-if="liveState && isDockLive"> <template v-if="liveState && isDockLive">
<span class="mr10">Lens:</span> <span class="mr10">Lens:</span>
@ -17,7 +16,7 @@
</a-radio-group> </a-radio-group>
</template> </template>
<template v-else> <template v-else>
<a-select <!-- <a-select
style="width: 100px" style="width: 100px"
placeholder="Select Live Type" placeholder="Select Live Type"
@select="onLiveTypeSelect" @select="onLiveTypeSelect"
@ -30,8 +29,8 @@
> >
{{ item.label }} {{ item.label }}
</a-select-option> </a-select-option>
</a-select> </a-select> -->
<a-select <!-- <a-select
class="ml10" class="ml10"
style="width:100px" style="width:100px"
placeholder="Select Drone" placeholder="Select Drone"
@ -44,8 +43,8 @@
@click="onDroneSelect(item)" @click="onDroneSelect(item)"
>{{ item.label }}</a-select-option >{{ item.label }}</a-select-option
> >
</a-select> </a-select> -->
<a-select <!-- <a-select
class="ml10" class="ml10"
style="width:100px" style="width:100px"
placeholder="Select Camera" placeholder="Select Camera"
@ -58,7 +57,7 @@
@click="onCameraSelect(item)" @click="onCameraSelect(item)"
>{{ item.label }}</a-select-option >{{ item.label }}</a-select-option
> >
</a-select> </a-select> -->
<!-- <a-select <!-- <a-select
class="ml10" class="ml10"
style="width:150px" style="width:150px"
@ -99,10 +98,10 @@
</div> </div>
<div class="flex-row flex-justify-center flex-align-center" style="margin-bottom: 20px;"> <div class="flex-row flex-justify-center flex-align-center" style="margin-bottom: 20px;">
<a-button v-if="liveState && isDockLive" type="primary" large @click="onSwitch">Switch Lens</a-button> <a-button v-if="liveState && isDockLive" type="primary" large @click="onSwitch">Switch Lens</a-button>
<a-button v-else type="primary" large @click="onStart">Play</a-button> <!-- <a-button v-else type="primary" large @click="onStart">Play</a-button>
<a-button class="ml20" type="primary" large @click="onStop" <a-button class="ml20" type="primary" large @click="onStop"
>Stop</a-button >Stop</a-button
> > -->
<!-- <a-button class="ml20" type="primary" large @click="onUpdateQuality" <!-- <a-button class="ml20" type="primary" large @click="onUpdateQuality"
>Update Clarity</a-button >Update Clarity</a-button
> >
@ -115,11 +114,13 @@
<script lang="ts" setup> <script lang="ts" setup>
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { onMounted, reactive, ref } from 'vue' import { onMounted, computed, ref } from 'vue'
import { CURRENT_CONFIG as config } from '/@/api/http/config' import { CURRENT_CONFIG as config } from '/@/api/http/config'
import { changeLivestreamLens, getLiveCapacity, setLivestreamQuality, startLivestream, stopLivestream } from '/@/api/manage' import { changeLivestreamLens, getLiveSnCapacity, setLivestreamQuality, startLivestream, stopLivestream } from '/@/api/manage'
import { getRoot } from '/@/root' import { getRoot } from '/@/root'
import { useMyStore } from '/@/store'
import jswebrtc from '/@/vendors/jswebrtc.min.js' import jswebrtc from '/@/vendors/jswebrtc.min.js'
const store = useMyStore()
const root = getRoot() const root = getRoot()
interface SelectOption { interface SelectOption {
@ -173,16 +174,18 @@ const videoList = ref()
const droneSelected = ref() const droneSelected = ref()
const cameraSelected = ref() const cameraSelected = ref()
const videoSelected = ref() const videoSelected = ref()
const claritySelected = ref() const claritySelected = ref(0)
const videoId = ref() const videoId = ref()
const liveState = ref<boolean>(false) const liveState = ref<boolean>(false)
const livetypeSelected = ref() const livetypeSelected = ref(1)
const rtspData = ref() const rtspData = ref()
const lensList = ref<string[]>([]) const lensList = ref<string[]>([])
const lensSelected = ref<String>() const lensSelected = ref<String>()
const isDockLive = ref(false) const isDockLive = ref(false)
const nonSwitchable = 'normal' const nonSwitchable = 'normal'
const osdVisible = computed(() => {
return store.state.osdVisible
})
const onRefresh = async () => { const onRefresh = async () => {
droneList.value = [] droneList.value = []
cameraList.value = [] cameraList.value = []
@ -190,7 +193,7 @@ const onRefresh = async () => {
droneSelected.value = null droneSelected.value = null
cameraSelected.value = null cameraSelected.value = null
videoSelected.value = null videoSelected.value = null
await getLiveCapacity({}) await getLiveSnCapacity(osdVisible.value.sn)
.then(res => { .then(res => {
console.log(res) console.log(res)
if (res.code === 0) { if (res.code === 0) {
@ -207,7 +210,7 @@ const onRefresh = async () => {
livestreamSource.value.forEach((ele: any) => { livestreamSource.value.forEach((ele: any) => {
temp.push({ label: ele.name + '-' + ele.sn, value: ele.sn, more: ele.cameras_list }) temp.push({ label: ele.name + '-' + ele.sn, value: ele.sn, more: ele.cameras_list })
}) })
droneList.value = temp droneSelected.value = temp[0].value
} }
} }
}) })
@ -231,9 +234,6 @@ const onStart = async () => {
) )
const timestamp = new Date().getTime().toString() const timestamp = new Date().getTime().toString()
if ( if (
livetypeSelected.value == null ||
droneSelected.value == null ||
cameraSelected.value == null ||
claritySelected.value == null claritySelected.value == null
) { ) {
message.warn('waring: not select live para!!!') message.warn('waring: not select live para!!!')
@ -366,6 +366,7 @@ const onDroneSelect = (val: SelectOption) => {
temp.push({ label: ele.name, value: ele.index, more: ele.videos_list }) temp.push({ label: ele.name, value: ele.index, more: ele.videos_list })
}) })
cameraList.value = temp cameraList.value = temp
cameraSelected.value = cameraList.value[0].value
} }
const onCameraSelect = (val: SelectOption) => { const onCameraSelect = (val: SelectOption) => {
cameraSelected.value = val.value cameraSelected.value = val.value
@ -412,6 +413,8 @@ const onSwitch = () => {
} }
}) })
} }
defineExpose({ onStart, onStop })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

7
src/pages/page-web/projects/tsa.vue

@ -137,12 +137,11 @@
</a-collapse-panel> </a-collapse-panel>
</a-collapse> </a-collapse>
<a-collapse :bordered="false" expandIconPosition="right" accordion style="background: #232323;"> <a-collapse :bordered="false" expandIconPosition="right" accordion style="background: #232323;">
<a-collapse-panel :key="EDeviceTypeName.Aircraft" header="Online Devices" style="border-bottom: 1px solid #4f4f4f;"> <a-collapse-panel v-if='!onlineDevices.data.length' :key="EDeviceTypeName.Aircraft" header="Online Devices" style="border-bottom: 1px solid #4f4f4f;">
<div v-if="onlineDevices.data.length === 0" style="height: 150px; color: white;"> <div style="height: 150px; color: white;">
<div style="background: red;" @click="cheshi">设备测试</div>
<a-empty :image="noData" :image-style="{ height: '60px' }" /> <a-empty :image="noData" :image-style="{ height: '60px' }" />
</div> </div>
<div v-else class="fz12" style="color: white;"> <div class="fz12" style="color: white;" v-else>
<div v-for="device in onlineDevices.data" :key="device.sn" style="background: #3c3c3c; height: 90px; width: 250px; margin-bottom: 10px;"> <div v-for="device in onlineDevices.data" :key="device.sn" style="background: #3c3c3c; height: 90px; width: 250px; margin-bottom: 10px;">
<div class="battery-slide" v-if="deviceInfo[device.sn]"> <div class="battery-slide" v-if="deviceInfo[device.sn]">
<div style="background: #535759; width: 100%;"></div> <div style="background: #535759; width: 100%;"></div>

Loading…
Cancel
Save