123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- <template>
- <div class="container">
- <div class="header">
- <img :src="headImg" alt="" />
- </div>
- <el-container>
- <Left ref="childRef" @childMethod="childMethod"></Left>
- <right></right>
- <div ref="linedomRef" style="width:1px;height:1px;position: absolute;z-index: 228;background:#ccc;">
- </div>
- </el-container>
- <div ref="popoverRef" id="popoverRef" class="modelInfo">
- <div v-if="orientation=='Left' || orientation=='Right'" class="model-detail" >
- <div v-for="item in classDeviceInfo" class="listbox" >
-
- <div class="list">
- {{ item[0].value }}
- </div>
- <div v-for="item2 in item" class="listtitle" >
-
- <div v-if="item2.name!=='设备名称'" style="height: 30px;display: flex;align-items: center;">
- <span class="name"> {{ item2.name }} :</span>
- <span v-if="item2.value!='在线'" class="value">{{ item2.value }}</span>
- <span v-else style=" font-family: 100; margin-left: 5px;color: #10C383;">{{ item2.value }}</span>
- </div>
- </div>
- </div>
- </div>
- <div v-else class="model-detail2" >
- <div style="display: flex;">
- <div v-for="item in classDeviceInfo" class="listbox2" >
-
- <div class="list" style="text-align: center;width: 100%;">
- {{ item[0].value }}
- </div>
-
- <div class="listtitlebox">
- <div v-for="item2 in item" class="listtitle" >
-
-
-
- <div v-if="item2.name!=='设备名称'">
- <span class="name"> {{ item2.name }} :</span>
- <span v-if="item2.value!='在线'" class="value" style="font-weight: 400;">{{ item2.value }}</span>
- <span v-else style=" font-family: 100; margin-left: 5px;color: #10C383;">{{ item2.value }}</span>
- </div>
-
- </div>
- </div>
-
- </div>
- </div>
- </div>
- </div>
-
- <el-dialog class="videoDialog" v-model="videoDialog" :title="titleDialog" width="60%" align="center" top="4%">
- <videoPlay v-bind="videoData" @play="onPlay" />
- </el-dialog>
- </div>
- </template>
- <script>
- import { reactive, onMounted, ref, toRefs, onBeforeUnmount, getCurrentInstance, nextTick } from 'vue';
- import { ElScrollbar, ElPagination, ElDialog, ElCarousel, ElCarouselItem, ElMessage } from "element-plus";
- import "vue3-video-play/dist/style.css";
- import { addResponseEventListener } from "../webrtcVideo.js";
- import { videoPlay } from "vue3-video-play";
- import CircleProgress from './CircleProgress.vue';
- import Left from './left.vue'
- import Right from './right.vue'
- import Login from './Login.vue'
- import LeaderLine from "../../public/js/leaderline.js"
- import { getClassDetail } from '../request/api.js'
- import {
- callUIInteraction,
- } from "../webrtcVideo";
- import { getVideoUrl } from '../request/api';
- export default ({
- name: 'Histogram',
- components: { Login, Left, Right, ElScrollbar, ElPagination, ElDialog, videoPlay, ElCarousel, ElCarouselItem, CircleProgress },
-
- setup() {
- const titleDialog = ref("")
- const orientation = ref("")
-
- const videoData = reactive({
- width: "100%",
- height: "100%",
- color: "red",
- title: "互动教室",
-
- type: 'm3u8',
- src: '',
- muted: false,
- webFullScreen: false,
-
- autoPlay: false,
- loop: false,
- mirror: false,
- ligthOff: false,
- volume: 0.3,
- control: true,
- currentTime: 0,
- controlBtns: [
- "audioTrack",
- "quality",
- "speedRate",
- "volume",
- "setting",
- "pip",
- "pageFullScreen",
- "fullScreen",
- ],
- });
-
- const interDevice = ref([])
-
- let centerDialogVisible = ref(false)
-
- let clickData = reactive({})
- const triggerRef = ref({
- getBoundingClientRect() {
-
- return position.value
- },
- })
- const position = ref({
- top: 0,
- left: 0,
- bottom: 0,
- right: 0,
- })
-
- const mousemoveHandler = (x, y) => {
- position.value = DOMRect.fromRect({
- width: 0,
- height: 0,
- x: x,
- y: y,
- })
- }
-
- const videoDialog = ref(false)
-
- const lookVideo = function () {
- videoDialog.value = true;
- console.log("点击了播放视频", 12312312)
- }
-
- const onPlay = function () {
- console.log("播放视频")
- }
- const linedomRef = ref(null)
- let lineContainer = ref(null)
- const popoverRef = ref(null)
- const lineStyleOption = ref({
- startPlug: 'disc',
- endPlug: 'disc',
- dash: true,
- color: '#2AC367',
- startPlugColor: '#fff',
- startPlugOutlineColor: '#2AC367',
- endPlugColor: '#fff',
- endPlugOutlineColor: '#2AC367',
- size: 3,
- startPlugSize: 1.5,
- startPlugOutlineSize: 2,
- endPlugSize: 1.5,
- endPlugOutlineSize: 2
- })
- const classDeviceInfo = ref([])
- const classDataLoaded = ref(false)
-
-
-
-
-
-
- const clickData1 = ref({})
- const mouseClick = function (e) {
-
- clickData1.value.x = e.clientX;
- clickData1.value.y = e.clientY;
- }
-
- const childMethod =()=>{
-
- if (lineContainer.value) {
- lineContainer.value.remove()
- lineContainer.value = null
- }
- }
- const childRef = ref(null);
- const handleResponseFunction = (data) => {
- console.log("从UE返回过来的值", data)
-
- if(data=='quit_class'){
-
- lineContainer.value.remove()
- lineContainer.value = null
-
- popoverRef.value.style.display = "none"
-
- if (childRef.value) {
- childRef.value.clearPanel();
- }
-
- }
- if (data == "{isrotate}") {
-
- if (lineContainer.value) {
- lineContainer.value.remove()
- lineContainer.value = null
- }
- popoverRef.value.style.display = "none"
- return
- }
- let json = eval("(" + data + ")");
- console.log("clickData---点击的数据", json)
- if (json.url) {
- videoDialog.value = true;
- titleDialog.value = json.name
- getVideoUrl({ "rtsp": json.url }).then(res => {
- videoData.src = res.data.httpFlv;
- console.log("32424", videoData.src)
- })
- return
- }
- clickData.value = json;
- orientation.value=clickData.value.direction
- console.log('看看这个',clickData.value.direction);
- if (json.deviceCode) {
-
-
- console.log('sadasd',json.deviceCode);
- let replacedStr = json.deviceCode.replace("/", "A");
- getClassDetail(replacedStr).then(res => {
- console.log('sad21312',res);
- classDeviceInfo.value = res.data;
- console.log('asd2121',classDeviceInfo.value);
-
-
-
-
-
-
-
-
- console.log("json.y ", json,);
- linedomRef.value.style.top = (clickData.value.y) + "px";
- linedomRef.value.style.left = (clickData.value.x) + "px";
- console.log("可以开始移动")
- console.log("看一下---小圆点的值--top", linedomRef.value.style.top)
- console.log("看一下---小圆点的值--left", linedomRef.value.style.left)
-
- popoverRef.value.style.display = "block"
- switch (json.direction) {
- case "Left":
- popoverRef.value.style.top = json.y - 30 + 'px'
- popoverRef.value.style.left = json.x - 320 + 'px'
- break;
- case "Up":
- popoverRef.value.style.top = (json.y - 300) + 'px'
- popoverRef.value.style.left = (json.x - 120) + 'px'
- break;
- case "Right":
- popoverRef.value.style.top = (Number(json.y)) -150+ 'px'
- popoverRef.value.style.left = Number(json.x) + 100 + 'px'
- break;
- case "Down":
- popoverRef.value.style.top = (Number(json.y) + 100) + 'px'
- popoverRef.value.style.left = Number(json.x) + 'px'
- break;
- default:
- popoverRef.value.style.top = json.y - 60 + 'px'
- popoverRef.value.style.left = json.x + 'px'
- break;
- }
- if (lineContainer.value) {
- lineContainer.value.remove()
- }
- lineContainer.value = new LeaderLine(linedomRef.value, popoverRef.value, lineStyleOption.value)
- lineContainer.value.show('draw', {
- duration: 100,
- timing: 'ease-in'
- })
- lineContainer.value.endPlugOutline = true;
- lineContainer.value.startPlugOutline = true;
- lineContainer.value.position();
- })
- }
- }
- const windowSize = function () {
-
- callUIInteraction("windowSize")
- }
-
- onMounted(() => {
- addResponseEventListener("444", handleResponseFunction);
- window.addEventListener('resize', windowSize);
-
-
- })
-
- const headImg = ref('./img/head.png')
- return {
- centerDialogVisible,
- interDevice,
- clickData,
- triggerRef,
- videoData,
- onPlay,
- videoDialog,
- lookVideo,
- linedomRef,
- popoverRef,
- lineContainer,
- classDeviceInfo,
- mouseClick,
- headImg,
- titleDialog,
- orientation,
- childMethod,
- childRef
-
- }
- },
- })
- </script>
- <style scoped lang="scss">
- @import '../assets/css/home.scss';
- </style>
|