right.vue 12 KB

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