right.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <template>
  2. <el-aside class="right">
  3. <div class="right_top">
  4. <div class="title" :style="{ background: `url(${frame})` }">
  5. <div class="text">物联设备统计</div>
  6. </div>
  7. <div class="content">
  8. <div class="logo">
  9. <span>{{ equipmentTotal.total }}</span>
  10. <img class="animate" :src="d1img" alt="" />
  11. <img :src="d12img" alt="" />
  12. <span><b>总数</b>(个)</span>
  13. </div>
  14. <div class="list">
  15. <div class="item_r">
  16. <img :src="d2img" alt="" />
  17. <div
  18. class="percent"
  19. style="display: flex; justify-content: space-between"
  20. >
  21. <a>在线</a> <a>{{ equipmentTotal.online }} <span>(个)</span> </a>
  22. </div>
  23. </div>
  24. <div class="item_r">
  25. <img :src="d3img" alt="" />
  26. <div
  27. class="percent"
  28. style="display: flex; justify-content: space-between"
  29. >
  30. <a>离线</a>
  31. <a>{{ equipmentTotal.underline }} <span>(个)</span> </a>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="right_center">
  38. <div class="title title-mt " :style="{ background: `url(${frame})` }">
  39. <div class="text">物联设备类型统计</div>
  40. </div>
  41. <div class="contentwrap">
  42. <div class="count" v-for="(item, index) in interDevice" :key="index">
  43. <CircleProgress
  44. :target-value="item.number"
  45. :color="item.color"
  46. text-position="top"
  47. >
  48. <img :src="deviceImg + item.icon + '.png'" alt="" />
  49. <!-- <img :src="'src/assets/img/' + item.icon + '.png'" alt=""> -->
  50. </CircleProgress>
  51. <div class="text">{{ item?.text }}</div>
  52. <!-- <el-tooltip placement="bottom">
  53. <template #content> multiple lines<br />second line </template>
  54. <el-text style="width: 100px;" class="w-100px mb-2" truncated>
  55. 测试测试测试
  56. </el-text>
  57. </el-tooltip> -->
  58. </div>
  59. </div>
  60. </div>
  61. <div class="right_bottom">
  62. <div class="title title-mt" :style="{ background: `url(${frame})` }">
  63. <div class="text">教室实时监控</div>
  64. </div>
  65. <div class="monitorContent">
  66. <el-carousel class="monitor">
  67. <el-carousel-item v-for="(item, index) in carouselData" :key="index">
  68. <p style="margin-left: 12px; margin-bottom: 3px; font-size: 14px">
  69. {{ item.activeMonitor?.title }}
  70. </p>
  71. <div class="interactclass">
  72. <div
  73. class="room"
  74. v-for="(item, index) in item.activeMonitor?.array"
  75. :key="index"
  76. >
  77. <span style="z-index: 99">{{ item?.title }}</span>
  78. <!-- <img :src="deviceImg + 'rb2.png'" alt="" @click="lookVideo(item)"> -->
  79. <div
  80. v-if="item.src"
  81. style="width: 100%; height: 100%"
  82. @click="lookVideo(item)"
  83. >
  84. <div class="vue3VideoPlay">
  85. <vue3VideoPlay
  86. width="100%"
  87. height="8.8vh"
  88. style="object-fit: fill"
  89. :src="item.src"
  90. :type="videoData.type"
  91. :autoPlay="true"
  92. :control="false"
  93. :preload="meta"
  94. />
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. <p
  100. style="
  101. margin-top: 18px;
  102. margin-left: 12px;
  103. margin-bottom: 3px;
  104. font-size: 14px;
  105. "
  106. >
  107. {{ item.activeMonitor?.title1 }}
  108. </p>
  109. <div class="interactclass">
  110. <div
  111. class="room"
  112. v-for="(item, index) in item.activeMonitor?.array1"
  113. :key="index"
  114. >
  115. <span style="z-index: 99">{{ item?.title }}</span>
  116. <!-- <br>
  117. <div>
  118. {{ item.src }}
  119. </div> -->
  120. <div style="width: 100%; height: 100%" @click="lookVideo(item)">
  121. <div class="vue3VideoPlay">
  122. <vue3VideoPlay
  123. width="100%"
  124. height="9vh"
  125. style="object-fit: fill"
  126. :src="item.src"
  127. :type="videoData.type"
  128. :autoPlay="true"
  129. :control="false"
  130. :preload="meta"
  131. />
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. </el-carousel-item>
  137. </el-carousel>
  138. </div>
  139. </div>
  140. </el-aside>
  141. <!-- 视频播放弹框 -->
  142. <el-dialog
  143. class="videoDialog"
  144. v-model="videoDialog"
  145. :title="dialogTitle"
  146. width="62%"
  147. align="center"
  148. top="8%"
  149. style="z-index: 2015"
  150. >
  151. <videoPlay v-bind="videoData" />
  152. <!-- {{ videoData.src }} -->
  153. </el-dialog>
  154. </template>
  155. <script >
  156. import { reactive, onMounted, ref, nextTick, onBeforeUnmount } from "vue";
  157. import { ElCarousel, ElCarouselItem } from "element-plus";
  158. import "vue3-video-play/dist/style.css";
  159. import { videoPlay } from "vue3-video-play";
  160. // import CircleProgress from './CircleProgress.vue';
  161. import { getDevice, getVideoUrl, getvideo } from "../request/api";
  162. export default {
  163. name: "Histogram",
  164. components: { videoPlay, ElCarousel, ElCarouselItem },
  165. setup() {
  166. // 视频数据
  167. const videoData = reactive({
  168. width: "100%", //播放器高度
  169. height: "66.5vh", //播放器高度
  170. color: "red", //主题色
  171. // title: "互动教室", //视频名称
  172. // src: "https://cdn.jsdelivr.net/gh/xdlumia/files/video-play/IronMan.mp4", //视频源
  173. src: "",
  174. type: "m3u8",
  175. muted: true, //静音
  176. webFullScreen: false,
  177. // speedRate: ["0.75", "1.0", "1.25", "1.5", "2.0"], //播放倍速
  178. autoPlay: true, //自动播放
  179. loop: false, //循环播放
  180. mirror: false, //镜像画面
  181. ligthOff: false, //关灯模式
  182. volume: 0.3, //默认音量大小
  183. control: true, //是否显示控制
  184. currentTime: 0, //跳转到固定播放时间
  185. controlBtns: [
  186. "audioTrack",
  187. "quality",
  188. "speedRate",
  189. "volume",
  190. "setting",
  191. "pip",
  192. "pageFullScreen",
  193. "fullScreen",
  194. ], //显示所有按钮,
  195. });
  196. //视频播放弹框
  197. const videoDialog = ref(false);
  198. // const videoshow = ref(true)
  199. const dialogTitle = ref("");
  200. // 播放视频
  201. const lookVideo = function (item) {
  202. videoDialog.value = true;
  203. dialogTitle.value = item.title;
  204. let copysrc = JSON.parse(JSON.stringify(item));
  205. console.log("sadi2", copysrc);
  206. // videoData.src = item.scr
  207. videoData.src = copysrc.src;
  208. console.log("kankna222", videoData.src);
  209. // getVideoUrl({ "rtsp": item.src }).then((res) => {
  210. // console.log("视频处理", res);
  211. // console.log("视频处理2", res.data.httpFlv);
  212. // videoData.src = res.data.httpFlv
  213. // })
  214. // videoData.src = src
  215. };
  216. // 播放视频
  217. const onPlay = function () {
  218. console.log("播放视频");
  219. };
  220. // 物联设备
  221. let equipmentTotal = ref({});
  222. // 物联设备类型统计
  223. let interDevice = ref([]);
  224. // 智慧教室
  225. let carouselData = ref([]);
  226. //获取页面数据
  227. const getDeviceData = async () => {
  228. //视频转码
  229. // getvideo({
  230. // "rtsp": "rtsp://admin:admin@10.116.255.67:554",
  231. // }).then((res)=>{
  232. // console.log('sadnuq21',res);
  233. // })
  234. let res = await getDevice();
  235. console.log("s12312123", res);
  236. if (res.code !== 200) {
  237. ElMessage.error("数据请求出错");
  238. }
  239. let { category, monitor, status } = res.data;
  240. //物联设备统计
  241. equipmentTotal.value = status;
  242. // 物联设备类型数据
  243. console.log("sadui12u31", category);
  244. //截取数组前6项
  245. interDevice.value = category;
  246. // 互动教室
  247. carouselData.value = monitor;
  248. carouselData.value.map((res) => {
  249. console.log("sadhi2", res.activeMonitor);
  250. res.activeMonitor?.array.map((array) => {
  251. //视频转码
  252. getvideo({
  253. rtsp: array.src,
  254. }).then((res) => {
  255. console.log("sadnuq21", res.data);
  256. console.log("sadnuq2121", res.data.httpFlv);
  257. // array.src='http://kbs-dokdo.gscdn.com/dokdo_300/_definst_/dokdo_300.stream/playlist.m3u8'
  258. array.src = res.data.httpFlv;
  259. });
  260. });
  261. res.activeMonitor?.array1.map((array1) => {
  262. console.log("asdui1231", array1);
  263. //视频转码
  264. getvideo({
  265. rtsp: array1.src,
  266. }).then((res) => {
  267. console.log("sadnuq212123s2", res.data);
  268. // array1.src='http://kbs-dokdo.gscdn.com/dokdo_300/_definst_/dokdo_300.stream/playlist.m3u8'
  269. array1.src = res.data.httpFlv;
  270. });
  271. });
  272. });
  273. //开启物联网统计数据定时刷新
  274. startdeviceInterval();
  275. // setTimeout(() => {
  276. // console.log('处理后监控视频数据===',carouselData.value);
  277. // }, 2000);
  278. };
  279. // 定时刷新物联网统计数据
  280. let deviceInterval = ref(null);
  281. const startdeviceInterval = () => {
  282. //清除物联网统计数据刷新定时器
  283. clearTimeout(deviceInterval.value);
  284. deviceInterval.value = setInterval(() => {
  285. getDeviceData();
  286. }, 5000);
  287. };
  288. onMounted(() => {
  289. getDeviceData();
  290. });
  291. onBeforeUnmount(() => {
  292. //清除物联网统计数据刷新定时器
  293. clearTimeout(deviceInterval.value);
  294. });
  295. const d1img = ref("./img/d1_1.png");
  296. const d12img = ref("./img/d1_2.png");
  297. const d2img = ref("./img/d2.png");
  298. const d3img = ref("./img/d3.png");
  299. const deviceImg = ref("./img/");
  300. const frame = ref("./img/frame.png");
  301. return {
  302. interDevice,
  303. videoData,
  304. onPlay,
  305. videoDialog,
  306. lookVideo,
  307. carouselData,
  308. equipmentTotal,
  309. d1img,
  310. d12img,
  311. d2img,
  312. d3img,
  313. deviceImg,
  314. dialogTitle,
  315. startdeviceInterval,
  316. frame
  317. };
  318. },
  319. };
  320. </script>
  321. <style scoped lang="scss">
  322. @import "../assets/css/right.scss";
  323. </style>
  324. <style lang="scss">
  325. .videoDialog {
  326. .el-dialog__header {
  327. height: 49px;
  328. line-height: 49px;
  329. padding: 0;
  330. background-color: #1b67d9;
  331. margin-right: 0;
  332. .el-dialog__title {
  333. color: #fff;
  334. font-family: Inter;
  335. }
  336. .el-dialog__headerbtn {
  337. top: 0px;
  338. i {
  339. color: #fff;
  340. font-size: 20px;
  341. font-weight: bold;
  342. }
  343. }
  344. }
  345. .el-dialog__body {
  346. padding: 0 !important;
  347. }
  348. }
  349. </style>