right.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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="54%" align="center" top="10%" 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: "100%", //播放器高度
  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. console.log('kankna1',item[src]);
  168. console.log('看看src===========',videoData.src);
  169. console.log("点击了播放视频", 12312312, "播放路径", item)
  170. // getVideoUrl({ "rtsp": item.src }).then((res) => {
  171. // console.log("视频处理", res);
  172. // console.log("视频处理2", res.data.httpFlv);
  173. // videoData.src = res.data.httpFlv
  174. // })
  175. // videoData.src = src
  176. }
  177. // 播放视频
  178. const onPlay = function () {
  179. console.log("播放视频")
  180. }
  181. // 物联设备
  182. let equipmentTotal = ref({})
  183. // 物联设备类型统计
  184. let interDevice = ref([])
  185. // 智慧教室
  186. let carouselData = ref([
  187. ])
  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. equipmentTotal.value = status
  204. // 物联设备类型数据
  205. console.log('sadui12u31',category);
  206. //截取数组前6项
  207. interDevice.value = category;
  208. // 互动教室
  209. carouselData.value = monitor;
  210. carouselData.value.map((res)=>{
  211. console.log('sadhi2',res.activeMonitor);
  212. res.activeMonitor.array.map(array =>{
  213. //视频转码
  214. getvideo({
  215. "rtsp": array.src,
  216. }).then((res)=>{
  217. console.log('sadnuq21',res.data);
  218. console.log('sadnuq2121',res.data.httpFlv);
  219. // array.src='http://kbs-dokdo.gscdn.com/dokdo_300/_definst_/dokdo_300.stream/playlist.m3u8'
  220. array.src=res.data.httpFlv
  221. })
  222. })
  223. res.activeMonitor.array1.map(array1 =>{
  224. console.log('asdui1231',array1);
  225. //视频转码
  226. getvideo({
  227. "rtsp": array1.src,
  228. }).then((res)=>{
  229. console.log('sadnuq212123s2',res.data);
  230. // array1.src='http://kbs-dokdo.gscdn.com/dokdo_300/_definst_/dokdo_300.stream/playlist.m3u8'
  231. array1.src=res.data.httpFlv
  232. })
  233. })
  234. })
  235. // setTimeout(() => {
  236. // console.log('处理后监控视频数据===',carouselData.value);
  237. // }, 2000);
  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>