123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- <template>
- <!-- <Login></Login> -->
- <div class="container">
- <div class="header">
- <img :src="headImg" alt="" />
- </div>
- <el-container>
- <left></left>
- <right></right>
- <div ref="linedomRef"
- style="width:1px;height:1px;position: absolute;z-index: 228;border-radius:15px;background:#ccc;border: 1px solid darkcyan;">
- </div>
- </el-container>
- <div ref="popoverRef" id="popoverRef" class="modelInfo">
- <div class="model-detail">
- <span v-for="item in classDeviceInfo">
- <!-- {{ item }} -->
- <!-- {{ item.value === "在线" }} -->
- <span class="title">{{ item && item.name }}: </span>
- <span :class="item.online ? 'green' : item.online == 'false' ? 'red' : ''">{{ item && item.value }}
- </span>
- </span>
- </div>
- </div>
- <!-- 视频播放弹框 -->
- <el-dialog class="videoDialog" v-model="videoDialog" title="互动教师1" 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 axios from 'axios';
- export default ({
- name: 'Histogram',
- components: { Login, Left, Right, ElScrollbar, ElPagination, ElDialog, videoPlay, ElCarousel, ElCarouselItem, CircleProgress },
- setup() {
- // 视频数据
- const videoData = reactive({
- width: "100%", //播放器高度
- height: "100%", //播放器高度
- color: "red", //主题色
- title: "互动教室", //视频名称
- src: "https://cdn.jsdelivr.net/gh/xdlumia/files/video-play/IronMan.mp4", //视频源
- muted: false, //静音
- webFullScreen: false,
- // speedRate: ["0.75", "1.0", "1.25", "1.5", "2.0"], //播放倍速
- 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() {
- // console.log("positon----方法返回元素的大小及其相对于视口的位置", position.value)
- 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', // translucent
- endPlugOutlineColor: '#2AC367',
- size: 3,
- startPlugSize: 1.5,
- startPlugOutlineSize: 2,
- endPlugSize: 1.5,
- endPlugOutlineSize: 2
- })
- const classDeviceInfo = ref([])
- const classDataLoaded = ref(false)
- const classDevice = async function (deviceCode) {
- let res = await getClassDetail(deviceCode)
- console.log("获取到了当前点击物体得详情", res)
- classDeviceInfo.value = res.data;
- classDataLoaded.value = true
- }
- const clickData1 = ref({})
- const mouseClick = function (e) {
- // console.log("屏幕点击位置看", e)
- clickData1.value.x = e.clientX;
- clickData1.value.y = e.clientY;
- }
- const clickFun = function (e) {
- console.log("当前鼠标点击的坐标", e, e.clientX, e.clientY);
- }
- const handleResponseFunction = (data) => {
- // console.log("从UE返回过来的值", data)
- console.log("重新变了坐标", 2423423423);
- let json = eval("(" + data + ")");//转对象
- clickData.value = json;
- console.log("clickData---点击的数据", json)
- if (json.deviceCode) {
- getClassDetail(json.deviceCode).then(res => {
- classDeviceInfo.value = res.data;
- classDeviceInfo.value.map(i => {
- // if (i.name === "设备状态") {
- // i.online = true
- // } else {
- // i.online = "no"
- // }
- if (i.value == "在线") {
- i.online = true
- }
- if (i.value == "离线") {
- i.online = false
- }
- // i.online = i.name === "设备状态" ? true : false
- })
- 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)) + '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 () {
- // console.log("监听一下窗口是不是改了--click", lineContainer);
- callUIInteraction("windowSizeChange")
- }
- const getUserInfo = (url) => {
- let userurl = " https://weizhi.huanghuai.edu.cn/cmccr-server/center/cas/v1/getUser?casLoginUrl=https://cas.huanghuai.edu.cn/cas/serviceValidate?"
- + url + "&service=https://weizhi.huanghuai.edu.cn/cmips/"
- // axios.get(userurl).then(res => {
- // })
- }
- onMounted(() => {
- addResponseEventListener("444", handleResponseFunction);
- window.addEventListener('resize', windowSize);
- // window.addEventListener('click', windowSize);
- // addResponseEventListener("widowSizeChange", windoChangeFunction);
- let search = window.location.hash.split("?")[1];
- getUserInfo(search)
- // console.log(search, "编码")
- // let code = result.split("?")[0]; //去掉&之后的冗余部分
- // console.log(result);
- // // window.addEventListener('hashchange', pathChange);
- // const searchParams = currentUrl.searchParams;
- // let ticket = searchParams.get("ticket"); // 'devpoint'
- // console.log("ticket", ticket);
- // searchParams.get("page"); // '1'
- })
- const headImg = ref('./img/head.png')
- return {
- centerDialogVisible,
- interDevice,
- clickData,
- triggerRef,
- videoData,
- onPlay,
- videoDialog,
- lookVideo,
- linedomRef,
- popoverRef,
- lineContainer,
- classDeviceInfo,
- mouseClick,
- headImg
- }
- },
- })
- </script>
- <style scoped lang="scss">
- @import '../assets/css/home.scss';
- </style>
|