Blame view

src/index.js 3.55 KB
76d17fa3   Zhang Zhuo   更新bug -张卓
1
  import React, { Component } from 'react';
f248ca05   Zhang Zhuo   初始化版本 -张卓
2
  import ReactDOM from 'react-dom';
e2460342   Zhang Zhuo   更改 -张卓
3
  import { FlvCom, Timer, ImgCom, AreaSelete, FunAreaSelect, FunAreaSelectPlus } from "./components/index"
42886855   Zhang Zhuo   更改保存下 -张卓
4
  // import {FlvCom,Timer,ImgCom,AreaSelete,FunAreaSelect,FunAreaSelectPlus} from "../dist/index.js"
76d17fa3   Zhang Zhuo   更新bug -张卓
5
6
  class App extends Component {
      constructor() {
d47ac30f   Zhang Zhuo   更新组件区域选择 -张卓
7
8
          super();
          this.state = {
76d17fa3   Zhang Zhuo   更新bug -张卓
9
10
              imgUrl: "C:/imagelib/imgalarm/2020/12/21/192.168.166.155/192.168.166.155_00_20201221181716755_ALARM_210_9891_HEL_SNAP.jpg",
              serviceData: [[431, 55], [479, 55], [481, 107], [435, 107]],
e2460342   Zhang Zhuo   更改 -张卓
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
              arr: [
                  {
                      id: "1", title: "点位1", num: 5, serviceData: [
                          ["95.16", "13.60"],
                          ["126.40", "13.37"],
                          ["127.37", "28.82"],
                          ["95.65", "28.59"]]
                  },
                  {
                      id: "2", title: "点位2", num: 5, serviceData: [
                          ["210.34", "12.68"],
                          ["233.76", "12.68"],
                          ["234.74", "24.67"],
                          ["212.29", "24.67"]
                      ]
                  },
                  {
                      id: "3", title: "点位3", num: 5, serviceData: [
                          ["256.21", "29.51"],
                          ["283.05", "29.51"],
                          ["282.08", "41.50"],
                          ["257.19", "41.50"]
                      ]
                  },
              ],
              serviceData2: [],
42886855   Zhang Zhuo   更改保存下 -张卓
37
38
              list: [{ "id": 1608808157114,title:"点位1\n偏移量:10mm","mode": "polygon", "serviceData": [[323, 76], [336, 195], [617, 151], [452, 45]] }, { "id": 1608808178878,title:"点位1\n偏移量\nsdfas:10mm", "mode": "react", "serviceData": [[615, 379], [615, 254], [309, 254], [309, 379]] }]
              // lsit:[]
d47ac30f   Zhang Zhuo   更新组件区域选择 -张卓
39
40
          }
      }
e2460342   Zhang Zhuo   更改 -张卓
41
      changeSelect(val) {//保存后把最后一个放入这个list中储存,这样可以判断是否储存,点击的时候是否在点内
d47ac30f   Zhang Zhuo   更新组件区域选择 -张卓
42
          this.setState({
e2460342   Zhang Zhuo   更改 -张卓
43
              list:val
d47ac30f   Zhang Zhuo   更新组件区域选择 -张卓
44
45
          })
      }
42886855   Zhang Zhuo   更改保存下 -张卓
46
47
48
49
50
51
52
53
      delete(selectIndex){
          let {list} = this.state
          list = list.filter(item=>item.id!==selectIndex)
          this.setState({list:list})
      }
      err(falg,msg){
          console.log(falg,msg)
      }
76d17fa3   Zhang Zhuo   更新bug -张卓
54
      render() {
e2460342   Zhang Zhuo   更改 -张卓
55
          let { imgUrl, serviceData, serviceData2, arr, list } = this.state;
f248ca05   Zhang Zhuo   初始化版本 -张卓
56
57
          return (
              <div style={{
76d17fa3   Zhang Zhuo   更新bug -张卓
58
                  width: "1000px", height: "100%"
f248ca05   Zhang Zhuo   初始化版本 -张卓
59
              }}>
42886855   Zhang Zhuo   更改保存下 -张卓
60
                  <FunAreaSelectPlus list={list} change={(val) => { this.changeSelect(val)}} delete={(selectIndex)=>{this.delete(selectIndex)}} err={(falg,msg)=>{this.err(falg,msg)}}></FunAreaSelectPlus>
e2460342   Zhang Zhuo   更改 -张卓
61
62
63
64
65
66
67
                  {/* <button onClick={() => this.clickIt()}>添加</button> */}
                  {/* <div id="waiceng" style={{ width: "81.2%", height: "80%", position: "relative" }}>
                      {
                          arr.map(item => {
                              return (<AreaSelete key={item.id}
                                  serviceData={item.serviceData} 
                                  title={item.title+"\n偏移量:"+item.num} change={(val) => this.changeSelect(val)}></AreaSelete>)
76d17fa3   Zhang Zhuo   更新bug -张卓
68
                          })
e2460342   Zhang Zhuo   更改 -张卓
69
70
                      }
                  </div> */}
d47ac30f   Zhang Zhuo   更新组件区域选择 -张卓
71
72
73
                  {/* <ImgCom httpImg="http://112.125.25.140:8083/syboxms/getImgDataByPath"  imgUrl={imgUrl}></ImgCom> */}
                  {/* <FlvCom vidoeUrl=""></FlvCom>
                  <Timer className="timerComCssss" type="YYYY-MM-DD HH:mm:ss"></Timer>  */}
76d17fa3   Zhang Zhuo   更新bug -张卓
74
  
f248ca05   Zhang Zhuo   初始化版本 -张卓
75
76
77
78
79
80
              </div>
          )
      }
  }
  
  ReactDOM.render(<App />, document.getElementById('root'));