index.vue 5.64 KB
Newer Older
1 2 3
<template>
  <div class="app-container">
    <el-row :gutter="5" type="flex" justify="space-around">
王晓倩's avatar
王晓倩 committed
4
      <el-col :lg="4" :xl="4">
5 6 7 8 9 10 11 12 13 14 15 16
        <div class="head-container">
          <el-input
            v-model="videoTree"
            placeholder="请输入监控名称"
            clearable
            size="small"
            prefix-icon="el-icon-search"
            style="margin-bottom: 20px"
          />
        </div>
        <div class="head-container">
          <el-tree
17 18
                   :data="treeData"
                   :props="treeProps"
19 20 21 22
                   :expand-on-click-node="false"
                   :filter-node-method="filterNode"
                   ref="tree"
                   default-expand-all
23 24 25
                   @node-click="nodeClick"
                   style="background-color: white; color: #606266"
          >
26
            <template slot-scope="{ node, data }" class="custom-tree-node">
27
              <span>
28 29
                <i class="iconfont" :class="[data.icon, 'tree-icon']" />
                {{ node.label }}
30
              </span>
31
            </template>
32
          </el-tree>
33
        </div>
34 35
      </el-col>

王晓倩's avatar
王晓倩 committed
36
      <el-col :lg="20" :xl="20">
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
        <el-row class="row">
          <div class="box" :class="[flag == 1 ? 'boxred' : 'boxblack']">
            <div id="newplay1" style="width:100%; height:100%;" @click="chooseWindow(1)">
              <span class="novideo">无信号</span>
            </div>
          </div>
          <div class="box" :class="[flag == 2 ? 'boxred' : 'boxblack']">
            <div id="newplay2" style="width:100%; height:100%;" @click="chooseWindow(2)">
              <span class="novideo">无信号</span>
            </div>
          </div>
        </el-row>

        <el-row class="row">
          <div class="box" :class="[flag == 3 ? 'boxred' : 'boxblack']">
            <div id="newplay3" style="width:100%; height:100%;" @click="chooseWindow(3)">
              <span class="novideo">无信号</span>
            </div>
          </div>
          <div class="box" :class="[flag == 4 ? 'boxred' : 'boxblack']">
            <div id="newplay4" style="width:100%; height:100%;" @click="chooseWindow(4)">
              <span class="novideo">无信号</span>
            </div>
          </div>
        </el-row>
      </el-col>
    </el-row>
  </div>
</template>
<style lang="scss" scped>
  .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
68
    background-color: white;
69 70
  }
  .el-tree--highlight-current .el-tree-node > .el-tree-node__content:hover {
71
    background-color: white;
72 73
    color: #454547;
  }
74
  main > div {
75 76 77
    background: #ffffff;
    height: calc(100vh - 110px) !important;
    padding: 0px 0px 0px 10px !important;
78
  }
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
  .row{
    display: flex;
    .box{
      width: 100%;
      text-align: center;
      background-color: black;
    }
  }
  .boxred{
    border: 1px solid red;
  }
  .boxblack{
    border: 1px solid white;
  }
  .novideo{
    /*padding: 147px 0px 147px 0px;
    display: block;*/
王晓倩's avatar
王晓倩 committed
96
    line-height: calc((100vh - 130px)/2);
97 98
    color: white;
  }
王晓倩's avatar
王晓倩 committed
99 100 101 102 103
  .el-icon-video-camera{
    background-repeat: no-repeat;
    background-position: center;
    background-image: url("../../../assets/images/video1.png");
    background-size: 20px;
104
  }
王晓倩's avatar
王晓倩 committed
105 106 107 108 109
  .el-icon-video-play{
    background-repeat: no-repeat;
    background-position: center;
    background-image: url("../../../assets/images/video2.png");
    background-size: 20px;
110
  }
111
</style>
王晓倩's avatar
王晓倩 committed
112

113 114 115 116 117 118 119
<script>
  export default {
    name: "Video",
    components: {
    },
    data() {
      return {
120
        videoTree: undefined,
121 122 123 124 125 126 127
        loading: false,
        playerWindow: "newplay1",
        flag: 1,
        treeData: [
          {
            name: "企业视频监控",
            level: 0,
王晓倩's avatar
王晓倩 committed
128
            icon: "el-icon-video-camera",
129 130 131 132 133 134 135 136 137 138 139
            childList: []
          }
        ],
        treeProps: {
          children: "childList",
          label: "name"
        },
        treecheckedObj: {},
        ideoController: {},
      }
    },
140 141 142 143 144 145 146
    watch: {
      // 根据名称筛选视频监控
      videoTree(val) {
        console.log("val", val)
        this.$refs.tree.filter(val);
      }
    },
147 148 149 150 151 152
    methods: {
      getTreeData() {
        let that = this;
        that.treeData[0].childList = [
          {
            name: "视频监控1",
王晓倩's avatar
王晓倩 committed
153
            icon: "el-icon-video-play",
王晓倩's avatar
王晓倩 committed
154
            deviceCode: "34020000001110000003_0200000004",
155 156
          },{
            name: "视频监控2",
王晓倩's avatar
王晓倩 committed
157
            icon: "el-icon-video-play",
王晓倩's avatar
王晓倩 committed
158
            deviceCode: "34020000001110000003_0200000005",
159 160
          },{
            name: "视频监控3",
王晓倩's avatar
王晓倩 committed
161
            icon: "el-icon-video-play",
162
            deviceCode: "stream_36_0",
163 164
          },{
            name: "视频监控4",
王晓倩's avatar
王晓倩 committed
165
            icon: "el-icon-video-play",
166
            deviceCode: "stream_37_0",
167 168 169
          }
        ];
      },
170 171 172 173 174 175
      // 筛选节点
      filterNode(value, data) {
        console.log(value, data)
        if (!value) return true;
        return data.name.indexOf(value) !== -1;
      },
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
      nodeClick(data, node, target) {
        let that = this;
        that.treecheckedObj = node.data;

        if (node.level == "2") {
          that.playerWindow = 'newplay' + that.flag;
          var player = new WasmPlayer(null, that.playerWindow, null, {Height: true});
          console.log(that.playerWindow, node.data.deviceCode)
          player.play('http://27.128.189.137:18000/flv/hls/' + that.treecheckedObj.deviceCode + '.flv', 1);
          if (that.flag < 4) {
            that.flag++;
          }
        }
      },
      chooseWindow(data) {
        this.flag = data;
        this.playerWindow = 'newplay' + this.flag;
      },
    },
    created() {
      let that = this;
      that.getTreeData();
    }
  }
</script>