平安校园
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

773 rader
17 KiB

  1. <template>
  2. <view class="inspectionCenter">
  3. <view v-show="showVideo" class="poupBox">
  4. <view class="videoHeader">
  5. </view>
  6. <view class="contentBox">
  7. <view class="closeBox">
  8. <view class="title">
  9. {{sensorName+'(' + sensorId + ')'}}
  10. </view>
  11. <view class="closes" @click="closeDialog">
  12. <u-icon name="close-circle-fill" color="#ccc" size="22"></u-icon>
  13. </view>
  14. </view>
  15. <view class="botbox">
  16. <view id="url-player-test"></view>
  17. </view>
  18. </view>
  19. <view class="bottom-content">
  20. </view>
  21. </view>
  22. <view class="searchBox">
  23. <view class="searchLine">
  24. <view class="searchLabels" @click="showTree">
  25. <image v-show="isShowSearch==false" src="@/static/image/earlyWarning/group.png" mode="">
  26. </image>
  27. <image v-show="isShowSearch" src="@/static/image/earlyWarning/group2.png" mode="">
  28. </image>
  29. <text class="labels">选择分组</text>
  30. <view class="values">{{this.searchForm.groupName}}</view>
  31. </view>
  32. <view class="arrow">
  33. <image v-show="isShowSearch==false" src="@/static/image/earlyWarning/arrow1.png" mode="">
  34. </image>
  35. <image v-show="isShowSearch" src="@/static/image/earlyWarning/arrow2.png" mode=""></image>
  36. </view>
  37. </view>
  38. <view @click="isShowSearch=false" class="searchDialog" v-if="isShowSearch">
  39. <view class="content" @click.stop="isSelect">
  40. <u-row justify="space-between" gutter="10">
  41. <u-col span="7">
  42. <view class="demo-layout">
  43. <view class="left-layout">
  44. <text>{{'警告类型'}}</text>
  45. </view>
  46. <view class="right-layout">
  47. <image style="width: 30rpx;height:30rpx;"
  48. src="@/static/image/earlyWarning/arrowRight.png" mode=""></image>
  49. </view>
  50. </view>
  51. </u-col>
  52. <u-col span="5">
  53. <view class="demo-layout" @click="toOpenSelect">
  54. <view class="left-layout">
  55. <text>{{'处理状态'}}</text>
  56. </view>
  57. <view class="right-layout">
  58. <image style="width: 30rpx;height:30rpx;"
  59. src="@/static/image/earlyWarning/arrowRight.png" mode=""></image>
  60. </view>
  61. </view>
  62. </u-col>
  63. </u-row>
  64. <view class="btnBox">
  65. <view class="leftBtn" @click="clearform">
  66. 重置
  67. </view>
  68. <view class="rightBtn" @click="onsubmit">
  69. 确认
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="tableBox">
  76. <u-empty marginTop="100rpx" :show="monitorList.length == 0&&status == 'nomore'" mode="list"
  77. text="暂无数据"></u-empty>
  78. <u-list @scrolltolower="scrolltolower" style="height: calc(100% - 0rpx);">
  79. <u-list-item v-for="(item, index) in monitorList" :key="index">
  80. <view class="liBox">
  81. <view class="topCard">
  82. <view class="pic">
  83. <image :src="item.snapshotUrl" mode="aspectFill"></image>
  84. <view class="resolvingPower">
  85. {{item.resWidth}}*{{item.resHeight}}
  86. </view>
  87. </view>
  88. <view class="rightCard">
  89. <view class="firstCard">
  90. <view class="schoolName">
  91. 摄像头ID:{{item.sensorId}}
  92. </view>
  93. </view>
  94. <view class="secondCard">
  95. <view class="txt">
  96. 摄像头名称:{{item.sensorName}}
  97. </view>
  98. </view>
  99. <view class="thirdCard">
  100. <view class="txt">
  101. 设备IP:{{item.directUrlIp}}
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. <view class="btoCard">
  107. <view class="leftBox btoBox">
  108. <image src="@/static/image/earlyWarning/school.png" mode=""></image>
  109. <view class="txt">
  110. 所属学校:演示学校
  111. </view>
  112. </view>
  113. <view class="rightBox btoBox" @click="startClick(item.sensorId,item.sensorName)">
  114. <view class="txt">
  115. 播放
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </u-list-item>
  121. <u-loadmore :status="status" />
  122. </u-list>
  123. </view>
  124. <!-- <web-view :webview-styles="styles" src="/hybrid/html/players.html"></web-view> -->
  125. <!-- <u-modal :show="showVideo" :title="videoTitle" :closeOnClickOverlay="false" :showCancelButton="true"
  126. @confirm="confirmVideo" @cancel="cancelVideo">
  127. <view class="slot-content">
  128. <cover-view style="width: 100%;height:500px">
  129. </cover-view>
  130. </view>
  131. </u-modal> -->
  132. <tki-tree ref="tkitree" title="摄像头分组" :showChild="showChild" :selectParent="selectParent" :multiple="multiple"
  133. :range="treelist" :foldAll="flod" rangeKey="name" @confirm="treeConfirm" @cancel="treeCancel"></tki-tree>
  134. </view>
  135. </template>
  136. <script>
  137. import tkiTree from '@/components/tki-tree/tki-tree.vue';
  138. import {
  139. groupList, //获取摄像头分组
  140. list, //获取摄像头列表
  141. startUrl, //说去视频地址
  142. stopUrl //停止视频流获取
  143. } from '@/api/monitor/index.js'
  144. export default {
  145. components: {
  146. tkiTree
  147. },
  148. data() {
  149. return {
  150. styles: {
  151. width: '100%',
  152. height: '100%',
  153. zIndex: '999999999999999999999999999'
  154. // bottom: '56px'
  155. },
  156. showVideo: false,
  157. videoTitle: '',
  158. isShowSearch: false,
  159. searchForm: {
  160. groupName: '全部',
  161. groupId: '',
  162. pageNum: 1,
  163. pageSize: 10
  164. },
  165. monitorList: [],
  166. isLoading: false,
  167. status: 'loadmore', //loading正在加载 loadmore加载更多 nomore没有更多了
  168. treelist: [],
  169. multiple: false, //是否多选
  170. selectParent: true, //父级可选择
  171. flod: false, //折叠
  172. showChild: true,
  173. player: null,
  174. sensorId: '',
  175. sensorName: '',
  176. videoUrl: '',
  177. streamId: '',
  178. videoToken: '',
  179. }
  180. },
  181. watch: {
  182. },
  183. mounted() {
  184. },
  185. onLoad() {
  186. this.getGroupList()
  187. // 获取列表数据
  188. this.loadmore()
  189. },
  190. onUnload() {
  191. if (this.showVideo) {
  192. this.closeDialog()
  193. }
  194. },
  195. onPullDownRefresh() {
  196. uni.stopPullDownRefresh()
  197. this.status = 'loadmore'
  198. this.searchForm.pageNum = 1;
  199. this.monitorList = []
  200. this.loadmore()
  201. },
  202. methods: {
  203. setVideo() {
  204. let that = this;
  205. this.loadWebPlayerSDK().then(() => {
  206. // 如果需要使用自定义组件,打开以下注释
  207. // this.loadComponent().then(() => {
  208. this.player = new Aliplayer({
  209. id: "url-player-test",
  210. source: this.videoUrl,
  211. width: "100%",
  212. height: "100%",
  213. isLive: true,
  214. rtsFallback: true,
  215. rtsFallbackType: 'HLS',
  216. }, function(player) {
  217. player.mute()
  218. });
  219. this.player.one('canplay', function() {
  220. // console.log('canplay', this.player.tag);
  221. that.player.tag.play();
  222. });
  223. // }).catch((e) => { console.log("加载组件失败", e) })
  224. }).catch((e) => {
  225. console.log("加载播放器SDK失败", e);
  226. });
  227. },
  228. closeDialog() {
  229. if (this.player) {
  230. this.player.dispose();
  231. }
  232. this.showVideo = false;
  233. // let params = {
  234. // sensorId: this.sensorId,
  235. // streamId: this.streamId,
  236. // videoToken: this.videoToken
  237. // };
  238. // stopUrl(params).then(res => {
  239. // })
  240. },
  241. loadWebPlayerSDK() {
  242. return new Promise((resolve, reject) => {
  243. const s_tag = document.createElement('script'); // 引入播放器js
  244. s_tag.type = 'text/javascript';
  245. s_tag.src = 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.25.1/aliplayer-min.js'
  246. // s_tag.src = 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/aliplayer-min.js';
  247. s_tag.charset = 'utf-8';
  248. s_tag.onload = () => {
  249. resolve();
  250. }
  251. document.body.appendChild(s_tag);
  252. const l_tag = document.createElement('link'); // 引入播放器css
  253. l_tag.rel = 'stylesheet';
  254. l_tag.href =
  255. 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.25.1/skins/default/aliplayer-min.css'
  256. // 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/skins/default/aliplayer-min.css';
  257. document.body.appendChild(l_tag);
  258. });
  259. },
  260. loadComponent() {
  261. return new Promise((resolve, reject) => {
  262. const s_tag = document.createElement('script');
  263. s_tag.type = 'text/javascript';
  264. // 需要先下载组件 js 文件,放到项目 /static/ 目录下
  265. // 下载地址:https://github.com/aliyunvideo/AliyunPlayer_Web/blob/master/customComponents/dist/aliplayer-components/aliplayercomponents-1.0.9.min.js
  266. s_tag.src = './static/aliplayercomponents-1.0.9.min.js';
  267. s_tag.charset = 'utf-8';
  268. s_tag.onload = () => {
  269. resolve();
  270. }
  271. document.body.appendChild(s_tag);
  272. });
  273. },
  274. addAttribute(data) { // tree结构递归添加属性
  275. for (var i = 0; i < data.length; i++) {
  276. data[i].isShow = false
  277. data[i].name = data[i].title
  278. if (data[i].children && data[i].children.length > 0) {
  279. this.addAttribute(data[i].children)
  280. }
  281. }
  282. return data
  283. },
  284. // 确定回调事件
  285. treeConfirm(e) {
  286. this.searchForm.groupName = e[0].name;
  287. this.searchForm.groupId = e[0].id;
  288. this.status = 'loadmore'
  289. this.searchForm.pageNum = 1;
  290. this.monitorList = []
  291. this.loadmore()
  292. },
  293. // 取消回调事件
  294. treeCancel(e) {
  295. // console.log(e)
  296. },
  297. // 显示树形选择器
  298. showTree() {
  299. this.$refs.tkitree._show();
  300. },
  301. cancelVideo() {
  302. this.showVideo = false;
  303. },
  304. getGroupList() {
  305. groupList({}).then((res) => {
  306. if (res.code == 200) {
  307. this.treelist = [...[{
  308. id: "",
  309. name: "全部",
  310. checked: true
  311. }], ...res.data];
  312. }
  313. });
  314. },
  315. // 获取视频地址
  316. startClick(id, name) {
  317. this.sensorId = id;
  318. this.sensorName = name;
  319. this.showVideo = true;
  320. // startUrl({
  321. // sensorId: id
  322. // }).then(res => {
  323. // let {
  324. // code,
  325. // data
  326. // } = res;
  327. // if (code == 200) {
  328. // if (this.sensorId == 'SXT001') {
  329. // this.videoUrl = 'http://123.57.209.16:8004/video/1.mp4'
  330. // } else if (this.sensorId == 'SXT002') {
  331. // this.videoUrl = 'http://123.57.209.16:8004/video/5.mp4'
  332. // } else if (this.sensorId == 'SXT003') {
  333. // this.videoUrl = 'http://123.57.209.16:8004/video/2.mp4'
  334. // }
  335. // // this.videoUrl = data.rtsPullStreamUrls[0].url;
  336. // this.streamId = data.streamId;
  337. // this.videoToken = data.videoToken;
  338. // this.setVideo()
  339. // }
  340. // })
  341. if (this.sensorId == 'SXT001') {
  342. this.videoUrl = 'http://123.57.209.16:8004/video/1.mp4'
  343. } else if (this.sensorId == 'SXT002') {
  344. this.videoUrl = 'http://123.57.209.16:8004/video/5.mp4'
  345. } else if (this.sensorId == 'SXT003') {
  346. this.videoUrl = 'http://123.57.209.16:8004/video/2.mp4'
  347. }
  348. // this.videoUrl = data.rtsPullStreamUrls[0].url;
  349. this.setVideo()
  350. },
  351. confirmVideo() {
  352. this.showVideo = false;
  353. },
  354. isSelect() {
  355. },
  356. scrolltolower() {
  357. if (this.status == 'loading' || this.status == 'nomore') {
  358. return;
  359. }
  360. this.searchForm.pageNum += 1;
  361. this.loadmore()
  362. },
  363. loadmore() {
  364. if (this.status != 'loadmore') return
  365. this.status = 'loading'
  366. this.isLoading = true;
  367. list(this.searchForm).then(res => {
  368. if (res?.code === 200) {
  369. this.monitorList = [...this.monitorList, ...res?.data?.list];
  370. this.isLoading = false;
  371. // 获取到的总条数>=接口总条数
  372. if (this.monitorList.length >= res.data.total) {
  373. this.status = 'nomore'
  374. } else {
  375. this.status = 'loadmore'
  376. }
  377. }
  378. })
  379. }
  380. }
  381. }
  382. </script>
  383. <style lang="scss" scoped>
  384. .container {
  385. padding: 20px;
  386. font-size: 14px;
  387. height: 800px;
  388. }
  389. // .contentBox {
  390. // height: calc(100% - 375rpx);
  391. .inspectionCenter {
  392. width: 100%;
  393. height: calc(100% - 88rpx);
  394. position: relative;
  395. .u-modal__title {
  396. color: #000000;
  397. }
  398. .poupBox {
  399. height: 100vh;
  400. position: absolute;
  401. left: 0;
  402. top: 0;
  403. width: 100%;
  404. z-index: 100000000000000;
  405. // background: red;
  406. background: rgba(0, 0, 0, 0.5);
  407. .videoHeader {
  408. height: 255rpx;
  409. }
  410. .contentBox {
  411. // z-index: 1000000;
  412. width: 100%;
  413. height: 590rpx;
  414. background: #000;
  415. // margin: 50rpx auto;
  416. .closeBox {
  417. text-align: right;
  418. height: 80rpx;
  419. display: flex;
  420. justify-content: space-between;
  421. align-items: center;
  422. padding: 0 25rpx;
  423. background: #fff;
  424. .title {
  425. font-weight: 700;
  426. font-size: 28rpx;
  427. }
  428. .closes {
  429. // background: #ccc;
  430. }
  431. }
  432. .botbox {
  433. height: calc(100% - 80rpx);
  434. }
  435. }
  436. .bottom-content {
  437. height: calc(100% - 590rpx -255rpx);
  438. }
  439. }
  440. }
  441. .searchBox {
  442. // height: calc(100% - 360rpx);
  443. position: relative;
  444. .searchLine {
  445. height: 88rpx;
  446. display: flex;
  447. align-items: center;
  448. justify-content: space-between;
  449. padding: 0 15px;
  450. box-sizing: border-box;
  451. background: #fff;
  452. font-size: 28rpx;
  453. .searchLabels {
  454. display: flex;
  455. align-items: center;
  456. width: calc(100% - 34rpx);
  457. image {
  458. width: 40rpx;
  459. height: 40rpx;
  460. flex-shrink: 1;
  461. }
  462. .labels {
  463. width: 120rpx;
  464. display: block;
  465. color: #333333;
  466. margin-left: 10rpx;
  467. flex-shrink: 1;
  468. }
  469. .values {
  470. width: calc(100% - 40rpx - 120rpx);
  471. color: #2388FF;
  472. font-weight: 700;
  473. margin-left: 18rpx;
  474. overflow: hidden;
  475. word-wrap: break-word;
  476. white-space: pre-wrap;
  477. display: -webkit-box;
  478. -webkit-box-orient: vertical;
  479. -webkit-line-clamp: 1;
  480. }
  481. }
  482. .arrow {
  483. // text-align: right;
  484. // flex-shrink: 1;
  485. image {
  486. width: 34rpx;
  487. height: 34rpx;
  488. }
  489. }
  490. .leftSearchBox {
  491. display: flex;
  492. align-items: center;
  493. width: calc(100% - 40px);
  494. .searchLabel {
  495. flex-shrink: 1;
  496. color: #333333;
  497. width: 80px;
  498. }
  499. .searchValue {
  500. width: calc(100% - 60px);
  501. margin-left: 10px;
  502. color: #2388FF;
  503. overflow: hidden;
  504. word-wrap: break-word;
  505. white-space: pre-wrap;
  506. display: -webkit-box;
  507. -webkit-box-orient: vertical;
  508. -webkit-line-clamp: 1;
  509. }
  510. }
  511. }
  512. .searchDialog {
  513. position: absolute;
  514. z-index: 990;
  515. top: 89rpx;
  516. width: 100%;
  517. height: calc(100vh - 375rpx - 100rpx);
  518. font-size: 26rpx;
  519. background: rgba(0, 0, 0, 0.2);
  520. .content {
  521. background: #FFFFFF;
  522. padding: 15px;
  523. box-sizing: border-box;
  524. border-top: 1px solid rgba(0, 0, 0, 0.1);
  525. .demo-layout {
  526. height: 80rpx;
  527. border-radius: 8rpx;
  528. background: #F5F5F5;
  529. display: flex;
  530. justify-content: space-between;
  531. align-items: center;
  532. padding: 0 10px;
  533. box-sizing: border-box;
  534. .left-layout {
  535. color: #777777;
  536. }
  537. .right-layout {}
  538. .startBox {
  539. color: #777777;
  540. }
  541. text {
  542. color: #777777;
  543. }
  544. .endBox {
  545. color: #777777;
  546. }
  547. .timeIcon {}
  548. }
  549. }
  550. .btnBox {
  551. display: flex;
  552. align-items: center;
  553. margin-top: 15px;
  554. .leftBtn {
  555. width: 50%;
  556. height: 74rpx;
  557. line-height: 74rpx;
  558. border: 1px solid #BABABA;
  559. border-radius: 12rpx;
  560. color: #333333;
  561. text-align: center;
  562. }
  563. .rightBtn {
  564. width: 50%;
  565. height: 74rpx;
  566. line-height: 74rpx;
  567. border: 1px solid #2388FF;
  568. border-radius: 12rpx;
  569. color: #fff;
  570. text-align: center;
  571. background: #2388FF;
  572. margin-left: 15rpx;
  573. }
  574. }
  575. }
  576. }
  577. .tableBox {
  578. height: 100%;
  579. padding: 0 30rpx;
  580. box-sizing: border-box;
  581. .liBox {
  582. background: #fff;
  583. padding: 24rpx 30rpx;
  584. box-sizing: border-box;
  585. border-radius: 20rpx;
  586. margin-top: 30rpx;
  587. .topCard {
  588. display: flex;
  589. align-items: center;
  590. .pic {
  591. position: relative;
  592. width: 268rpx;
  593. height: 201rpx;
  594. image {
  595. width: 268rpx;
  596. height: 201rpx;
  597. border-radius: 4px;
  598. }
  599. .resolvingPower {
  600. position: absolute;
  601. top: 15rpx;
  602. right: 15rpx;
  603. background: #000000;
  604. color: #fff;
  605. padding: 8rpx;
  606. box-sizing: border-box;
  607. font-size: 20rpx;
  608. border-radius: 4rpx;
  609. font-family: 'PingFang SC';
  610. }
  611. }
  612. .rightCard {
  613. margin-left: 20rpx;
  614. .firstCard {
  615. display: flex;
  616. justify-content: space-between;
  617. align-items: center;
  618. margin-bottom: 60rpx;
  619. .schoolName {
  620. font-size: 32rpx;
  621. font-family: 'PingFang SC';
  622. font-weight: 700;
  623. color: #333333;
  624. overflow: hidden;
  625. word-wrap: break-word;
  626. white-space: pre-wrap;
  627. // font-size: 14px;
  628. display: -webkit-box;
  629. -webkit-box-orient: vertical;
  630. -webkit-line-clamp: 1;
  631. }
  632. }
  633. .secondCard,
  634. .thirdCard {
  635. display: flex;
  636. align-items: center;
  637. margin-top: 16rpx;
  638. .txt {
  639. font-size: 26rpx;
  640. font-family: 'PingFang SC';
  641. color: #333333;
  642. }
  643. }
  644. }
  645. }
  646. .btoCard {
  647. border-top: 1px solid rgba(0, 0, 0, 0.1);
  648. margin-top: 24rpx;
  649. padding: 24rpx 0 0 0;
  650. display: flex;
  651. justify-content: space-between;
  652. align-items: center;
  653. .btoBox {
  654. // width: 33.3%;
  655. display: flex;
  656. justify-content: center;
  657. align-items: center;
  658. position: relative;
  659. font-size: 26rpx;
  660. color: #333;
  661. font-family: 'PingFang SC';
  662. image {
  663. width: 36rpx;
  664. height: 36rpx;
  665. margin-right: 15rpx;
  666. }
  667. }
  668. .rightBox {
  669. width: 120rpx;
  670. height: 60rpx;
  671. background: #2388FF;
  672. color: #fff;
  673. border-radius: 80rpx;
  674. }
  675. }
  676. }
  677. }
  678. // }
  679. </style>