Преглед на файлове

[FE] 首页直播组件更换

chenxr3 преди 4 години
родител
ревизия
feac2995cf
променени са 2 файла, в които са добавени 164 реда и са изтрити 47 реда
  1. 3 4
      security-protection-platform/src/modules/access/index.vue
  2. 161 43
      security-protection-platform/src/modules/dashboard/index.vue

+ 3 - 4
security-protection-platform/src/modules/access/index.vue

@ -42,16 +42,15 @@
42 42

43 43
    <t-table :data="data" line @selection-change="handleSelectionChange">
44 44
      <t-table-column type="selection" width="34px"></t-table-column>
45

46 45
      <t-table-column label="姓名" prop="relateEmployeeRoleName" width="60px">
47 46
      </t-table-column>
48
      <t-table-column label="员工编号" prop="code" width="80px">
47
      <t-table-column label="员工编号" prop="employeeCode" width="80px">
49 48
      </t-table-column>
50
      <t-table-column label="公司" prop="orgName" width="94px">
49
      <t-table-column label="公司" prop="organizationName" width="94px">
51 50
      </t-table-column>
52 51
      <t-table-column label="部门" prop="orgName" width="94px">
53 52
      </t-table-column>
54
      <t-table-column label="职务" prop="mainJobPosition" width="80px">
53
      <t-table-column label="职务" prop="employeePositionZh" width="80px">
55 54
      </t-table-column>
56 55
      <t-table-column label="相似度" prop="similarity" width="75px">
57 56
      </t-table-column>

+ 161 - 43
security-protection-platform/src/modules/dashboard/index.vue

@ -39,15 +39,28 @@
39 39
        <div :style="`background-image: url(${titleImgBg})`" class="title" style="width: 370px;">
40 40
          <span class="title-span">重点区域监控</span>
41 41
        </div>
42
        <video-player ref="videoPlayer" :options="videoOptions" :playsinline="true" class="vjs-custom-skin videoPlayer"></video-player>
42
        <!--        <video-player ref="videoPlayer" :options="videoOptions" :playsinline="true" class="vjs-custom-skin videoPlayer"></video-player>-->
43
        <videoPlayer
44
          ref="videoPlayer"
45
          :options="videoOptions"
46
          :playsinline="true"
47
          class="vjs-custom-skin videoPlayer"
48
        />
43 49
        <div class="videoPlayers">
44 50
          <div v-for="(item,index) in videoOptionsList" class="videoPlayer-sm" @click="videoSwitchover(item)">
45
            <video-player ref="videoPlayer"
46
                          :options="item.options"
47
                          :playsinline="true"
48
                          :style="`padding: 0 2.5% 2.5% 2%;border-radius: 5px;border: ${1-index}px solid #009bf3;`"
49
                          class="vjs-custom-skin videoPlayer">
50
            </video-player>
51
            <!--            <video-player ref="videoPlayer"-->
52
            <!--                          :options="item.options"-->
53
            <!--                          :playsinline="true"-->
54
            <!--                          :style="`padding: 0 2.5% 2.5% 2%;border-radius: 5px;border: ${1-index}px solid #009bf3;`"-->
55
            <!--                          class="vjs-custom-skin videoPlayer">-->
56
            <!--            </video-player>-->
57
            <videoPlayer
58
              ref="videoPlayer"
59
              :options="videoOptions"
60
              :playsinline="true"
61
              :style="`padding: 0 2.5% 2.5% 2%;border-radius: 5px;border: ${1-index}px solid #009bf3;`"
62
              class="vjs-custom-skin videoPlayer"
63
            />
51 64
            <div style="color: white;text-align: center;">{{ item.name }}</div>
52 65
          </div>
53 66
        </div>
@ -56,7 +69,22 @@
56 69
        <div :style="`background-image: url(${titleImgBg})`" class="title" style="width: 330px;">
57 70
          <span class="title-span">人员进出识别</span>
58 71
        </div>
59
        <img src="@/assets/images/indexT2.png" style="width: 95%;height: 95%;padding-left: 15px;padding-top: 10px;">
72
        <div v-for="(item,index) in distinguishData" :style="`background-image: url(${border})`" class="distinguish">
73
          <div class="distinguish-title"> {{ item.name }} </div>
74
          <div class="distinguish-row">
75
            <div class="similarity">
76
              <p style="opacity: 1;font-size: 12px">70%</p>
77
            </div>
78
            <img src="@/assets/images/indexT1.png" class="distinguish-col">
79
            <img src="@/assets/images/indexT1.png" class="distinguish-col">
80
            <div style="width: 40%;margin-top: 4%;height: 79%;">
81
              <div class="distinguish-col-row">王小明(00220)</div>
82
              <div class="distinguish-col-row">已佩戴口罩</div>
83
              <div class="distinguish-col-row">2021.01.05 12:11:00</div>
84
            </div>
85
          </div>
86
        </div>
87
        <!--        <img src="@/assets/images/indexT2.png" style="width: 95%;height: 95%;padding-left: 15px;padding-top: 10px;">-->
60 88
      </div>
61 89
    </div>
62 90
  </div>
@ -66,13 +94,15 @@
66 94
import imgBg from '@/assets/images/indexTop.png'
67 95
import titleImgBg from '@/assets/images/indexTitle.png'
68 96
import polygon from '@/assets/images/polygon.png'
97
import border from '@/assets/images/border.png'
69 98
import echarts from 'echarts'
70 99
import dasapi from '@/api/dashboard'
71 100
import sysapi from '@/api/system'
72 101
import 'video.js/dist/video-js.css'
73 102
import 'vue-video-player/src/custom-theme.css'
74
import { videoPlayer } from 'vue-video-player'
103
// import { videoPlayer } from 'vue-video-player'
75 104
import 'videojs-flash'
105
import VideoPlayer from '@/components/VideoPlayer'
76 106
77 107
export default {
78 108
  filters: {
@ -107,22 +137,55 @@ export default {
107 137
    }
108 138
  },
109 139
  components: {
110
    videoPlayer
140
    VideoPlayer
111 141
  },
112 142
  data() {
113 143
    return {
114 144
      nowDate: new Date(),
115
      videoOptions: {},
145
      videoOptions: {
146
        autoplay: true, // 如果true,浏览器准备好时开始回放。
147
        muted: true, // 默认情况下将会消除任何音频。
148
        loop: false, // 导致视频一结束就重新开始。
149
        preload: 'auto', // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
150
        language: 'zh-CN',
151
        aspectRatio: '16:10', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
152
        // fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
153
        // 是否流体自适应容器宽高
154
        fluid: true,
155
        // // 设置视频播放器的显示宽度(以像素为单位)
156
        // width: '100px',
157
        // // 设置视频播放器的显示高度(以像素为单位)
158
        // height: '400px',
159
        sources: [{
160
          withCredentials: false,
161
          type: 'application/x-mpegURL', // 这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目
162
          src: 'http://10.19.90.34:1080/live/1.m3u8' // url地址
163
        }],
164
        flash: { hls: { withCredentials: false } },
165
        html5: { hls: { withCredentials: false } },
166
        notSupportedMessage: '此视频暂无法播放,请稍后再试', // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
167
        controlBar: {
168
          timeDivider: false,
169
          durationDisplay: false,
170
          remainingTimeDisplay: false,
171
          fullscreenToggle: false // 全屏按钮
172
        }
173
      },
116 174
      videoOptionsList: [],
117 175
      imgBg: imgBg,
118 176
      titleImgBg: titleImgBg,
119 177
      polygon: polygon,
178
      border: border,
120 179
      attendanceData: [],
121 180
      population: 0,
122 181
      alarmDataX: [],
123 182
      alarmDataY: [],
124 183
      topData: [],
125
      topData1: []
184
      topData1: [],
185
      distinguishData: [{name: '1风场', url: '@/assets/images/indexT1.png', url2: '@/assets/images/indexT1.png'},
186
        {name: '2风场', url: '@/assets/images/indexT1.png', url2: '@/assets/images/indexT1.png'},
187
        {name: '3风场', url: '@/assets/images/indexT1.png', url2: '@/assets/images/indexT1.png'},
188
        {name: '2风场', url: '@/assets/images/indexT1.png', url2: '@/assets/images/indexT1.png'}]
126 189
    }
127 190
  },
128 191
  computed: {
@ -139,32 +202,32 @@ export default {
139 202
  methods: {
140 203
    initVideo() {
141 204
      sysapi.getTerminalRel(2).then(res => {
142
        this.videoOptions = {
143
          live: true,
144
          autoplay: true,
145
          fluid: false,
146
          height: document.documentElement.clientHeight * 0.60,
147
          notSupportedMessage: '暂时无法播放',
148
          controlBar: {
149
            timeDivider: false,
150
            durationDisplay: false,
151
            remainingTimeDisplay: false,
152
            fullscreenToggle: true // 全屏按钮
153
          },
154
          techOrder: ['flash'],
155
          flash: {
156
            hls: { withCredentials: false },
157
            swf: 'static/video-js.swf' // 引入静态文件swf
158
          },
159
          sources: [{ // 流配置,数组形式,会根据兼容顺序自动切换
160
            type: 'rtmp/mp4',
161
            src: res.data.data[0].videoUrl
162
          }]
163
        }
205
        // this.videoOptions = {
206
        //   live: true,
207
        //   autoplay: true,
208
        //   fluid: false,
209
        //   height: document.documentElement.clientHeight * 0.60,
210
        //   notSupportedMessage: '暂时无法播放',
211
        //   controlBar: {
212
        //     timeDivider: false,
213
        //     durationDisplay: false,
214
        //     remainingTimeDisplay: false,
215
        //     fullscreenToggle: true // 全屏按钮
216
        //   },
217
        //   techOrder: ['flash'],
218
        //   flash: {
219
        //     hls: { withCredentials: false },
220
        //     swf: 'static/video-js.swf' // 引入静态文件swf
221
        //   },
222
        //   sources: [{ // 流配置,数组形式,会根据兼容顺序自动切换
223
        //     type: 'rtmp/mp4',
224
        //     src: res.data.data[0].videoUrl
225
        //   }]
226
        // }
164 227
        this.videoOptionsList = []
165 228
        res.data.data.forEach(e => {
166 229
          this.videoOptionsList.push({
167
            options:{
230
            options: {
168 231
              live: true,
169 232
              autoplay: true,
170 233
              fluid: false,
@ -186,11 +249,11 @@ export default {
186 249
        })
187 250
      })
188 251
    },
189
    videoSwitchover(itme){
252
    videoSwitchover(itme) {
190 253
      this.videoOptions.sources = itme.options.sources
191 254
    },
192 255
    gotoSystem() {
193
      this.$router.push({name:'videoSurveillance'})
256
      this.$router.push({name: 'videoSurveillance'})
194 257
    },
195 258
    initAttendance() {
196 259
      this.attendanceData = dasapi.queryAttendanceChart().then(res => {
@ -222,7 +285,7 @@ export default {
222 285
    init24Top() {
223 286
      this.topData = dasapi.queryAlarmAnalysisTopList().then(res => {
224 287
        this.topData = []
225
        for (var i = 0; i < 4; i++) {
288
        for (var i = 0; i < 5; i++) {
226 289
          if (res.data[i]) {
227 290
            this.topData.push(res.data[i])
228 291
          }
@ -302,10 +365,10 @@ export default {
302 365
      var option = null
303 366
      var gridWidth = 320 // 可以根据canvas的宽度和grid的right,left,width进行计算
304 367
      var fontsize = 12 // 字体大小
305
      var wordNum = parseInt((gridWidth / this.alarmDataX.length) / fontsize);
368
      var wordNum = parseInt((gridWidth / this.alarmDataX.length) / fontsize)
306 369
      var flag = 0
307 370
      this.alarmDataX.forEach(value => {
308
        if (value){
371
        if (value) {
309 372
          var strs = value.split('')
310 373
          var str = ''
311 374
          for (var i = 0, s; s = strs[i++];) {
@ -352,6 +415,7 @@ export default {
352 415
        yAxis: [
353 416
          {
354 417
            type: 'value',
418
            minInterval: 1,
355 419
            axisLabel: {
356 420
              show: true,
357 421
              textStyle: {
@ -383,7 +447,7 @@ export default {
383 447
                  show: true, // 是否展示
384 448
                  position: 'top', // 在上方显示
385 449
                  formatter: function(name) {
386
                    return name.value + ''
450
                    return name.value + ''
387 451
                  },
388 452
                  textStyle: {
389 453
                    fontSize: 14,
@ -470,7 +534,7 @@ export default {
470 534
          .top4-row{
471 535
            border: 0 none;
472 536
            border-bottom: 2px dotted #00466b;
473
            height: 20%;
537
            height: 16%;
474 538
            .col-6{
475 539
              display: flex;
476 540
              .polygon{
@ -479,7 +543,7 @@ export default {
479 543
                align-items: center;
480 544
                text-align: center;
481 545
                height: 100%;
482
                width: 16%;
546
                width: 15%;
483 547
              }
484 548
            }
485 549
          }
@ -499,6 +563,60 @@ export default {
499 563
      border-radius: 5px;
500 564
      background-color: #011d40; /* 浏览器不支持的时候显示 */
501 565
      box-shadow: 0 0 30px -10px #009bf3 inset;
566
      .distinguish{
567
        -moz-background-size:100% 100%;
568
        background-size:100% 100%;
569
        width: 88%;
570
        height: 22%;
571
        margin-left: 6%;
572
        margin-top: 3%;
573
        padding-left: 1%;
574
        padding-right: 1%;
575
        padding-top: 1%;
576
        padding-bottom: 1%;
577
        .distinguish-title{
578
          align-items: center;
579
          text-align: center;
580
          height: 28px;
581
          width: 100%;
582
          margin: 0 auto;
583
          font-size: 16px;
584
          color: #00d8f3;
585
          //background-color: #003C74; 100%
586
          background: linear-gradient(to right, #011d40,#003C74,#011D40);
587
        }
588
        .distinguish-row{
589
          display: flex;
590
          color: #00d8f3;
591
          width: 100%;
592
          height: 100%;
593
          position: relative;
594
          .similarity{
595
            position: absolute;
596
            left:22%;
597
            top:27%;
598
            border: 2px solid  #00d8f3;
599
            width: 30px;
600
            height: 30px;
601
            background: #090404;
602
            opacity: 0.5;
603
            border-radius: 50%;
604
            padding-top: 1%;
605
          }
606
          .distinguish-col{
607
            width: 27%;
608
            margin-top: 2%;
609
            height: 70%;
610
          }
611
          .distinguish-col-row{
612
            padding-left: 5%;
613
            height: 30%;
614
            width: 130%;
615
            color: white;
616
            font-size: 14px;
617
          }
618
        }
619
      }
502 620
    }
503 621
  }
504 622
  .title{