right.vue 12 KB

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