wenhongquan 9 лет назад
Родитель
Сommit
08ab0966bd

+ 360 - 0
VisualInspection/js/lib/sonic.js

@@ -0,0 +1,360 @@
+/*
+ * Sonic 0.3
+ * --
+ * https://github.com/padolsey/Sonic
+ */
+
+(function(){
+
+	var emptyFn = function(){};
+
+	function Sonic(d) {
+
+		this.converter = d.converter;
+
+		this.data = d.path || d.data;
+		this.imageData = [];
+
+		this.multiplier = d.multiplier || 1;
+		this.padding = d.padding || 0;
+
+		this.fps = d.fps || 25;
+
+		this.stepsPerFrame = ~~d.stepsPerFrame || 1;
+		this.trailLength = d.trailLength || 1;
+		this.pointDistance = d.pointDistance || .05;
+
+		this.domClass = d.domClass || 'sonic';
+
+		this.backgroundColor = d.backgroundColor || 'rgba(0,0,0,0)';
+		this.fillColor = d.fillColor;
+		this.strokeColor = d.strokeColor;
+
+		this.stepMethod = typeof d.step == 'string' ?
+			stepMethods[d.step] :
+			d.step || stepMethods.square;
+
+		this._setup = d.setup || emptyFn;
+		this._teardown = d.teardown || emptyFn;
+		this._preStep = d.preStep || emptyFn;
+
+		this.pixelRatio = d.pixelRatio || null;
+
+		this.width = d.width;
+		this.height = d.height;
+
+		this.fullWidth = this.width + 2 * this.padding;
+		this.fullHeight = this.height + 2 * this.padding;
+
+		this.domClass = d.domClass || 'sonic';
+
+		this.setup();
+
+	}
+
+	var argTypes = Sonic.argTypes = {
+		DIM: 1,
+		DEGREE: 2,
+		RADIUS: 3,
+		OTHER: 0
+	};
+
+	var argSignatures = Sonic.argSignatures = {
+		arc: [1, 1, 3, 2, 2, 0],
+		bezier: [1, 1, 1, 1, 1, 1, 1, 1],
+		line: [1,1,1,1]
+	};
+
+	var pathMethods = Sonic.pathMethods = {
+		bezier: function(t, p0x, p0y, p1x, p1y, c0x, c0y, c1x, c1y) {
+			
+		    t = 1-t;
+
+		    var i = 1-t,
+		        x = t*t,
+		        y = i*i,
+		        a = x*t,
+		        b = 3 * x * i,
+		        c = 3 * t * y,
+		        d = y * i;
+
+		    return [
+		        a * p0x + b * c0x + c * c1x + d * p1x,
+		        a * p0y + b * c0y + c * c1y + d * p1y
+		    ]
+
+		},
+		arc: function(t, cx, cy, radius, start, end) {
+
+		    var point = (end - start) * t + start;
+
+		    var ret = [
+		        (Math.cos(point) * radius) + cx,
+		        (Math.sin(point) * radius) + cy
+		    ];
+
+		    ret.angle = point;
+		    ret.t = t;
+
+		    return ret;
+
+		},
+		line: function(t, sx, sy, ex, ey) {
+			return [
+				(ex - sx) * t + sx,
+				(ey - sy) * t + sy
+			]
+		}
+	};
+
+	var stepMethods = Sonic.stepMethods = {
+		
+		square: function(point, i, f, color, alpha) {
+			this._.fillRect(point.x - 3, point.y - 3, 6, 6);
+		},
+
+		fader: function(point, i, f, color, alpha) {
+
+			this._.beginPath();
+
+			if (this._last) {
+				this._.moveTo(this._last.x, this._last.y);
+			}
+
+			this._.lineTo(point.x, point.y);
+			this._.closePath();
+			this._.stroke();
+
+			this._last = point;
+
+		}
+
+	}
+
+	Sonic.prototype = {
+
+		calculatePixelRatio: function(){
+
+			var devicePixelRatio = window.devicePixelRatio || 1;
+			var backingStoreRatio = this._.webkitBackingStorePixelRatio
+					|| this._.mozBackingStorePixelRatio
+					|| this._.msBackingStorePixelRatio
+					|| this._.oBackingStorePixelRatio
+					|| this._.backingStorePixelRatio
+					|| 1;
+
+			return devicePixelRatio / backingStoreRatio;
+		},
+
+		setup: function() {
+
+			var args,
+				type,
+				method,
+				value,
+				data = this.data;
+
+			this.canvas = document.createElement('canvas');
+			this._ = this.canvas.getContext('2d');
+
+			if(this.pixelRatio == null){
+				this.pixelRatio = this.calculatePixelRatio();
+			}
+
+			this.canvas.className = this.domClass;
+
+			if(this.pixelRatio != 1){
+
+				this.canvas.style.height = this.fullHeight + 'px';
+				this.canvas.style.width = this.fullWidth + 'px';
+
+				this.fullHeight *= this.pixelRatio;
+				this.fullWidth  *= this.pixelRatio;
+
+				this.canvas.height = this.fullHeight;
+				this.canvas.width = this.fullWidth;
+
+				this._.scale(this.pixelRatio, this.pixelRatio);
+
+			}   else{
+
+				this.canvas.height = this.fullHeight;
+				this.canvas.width = this.fullWidth;
+
+			}
+
+			this.points = [];
+
+			for (var i = -1, l = data.length; ++i < l;) {
+
+				args = data[i].slice(1);
+				method = data[i][0];
+
+				if (method in argSignatures) for (var a = -1, al = args.length; ++a < al;) {
+
+					type = argSignatures[method][a];
+					value = args[a];
+
+					switch (type) {
+						case argTypes.RADIUS:
+							value *= this.multiplier;
+							break;
+						case argTypes.DIM:
+							value *= this.multiplier;
+							value += this.padding;
+							break;
+						case argTypes.DEGREE:
+							value *= Math.PI/180;
+							break;
+					};
+
+					args[a] = value;
+
+				}
+
+				args.unshift(0);
+
+				for (var r, pd = this.pointDistance, t = pd; t <= 1; t += pd) {
+					
+					// Avoid crap like 0.15000000000000002
+					t = Math.round(t*1/pd) / (1/pd);
+
+					args[0] = t;
+
+					r = pathMethods[method].apply(null, args);
+
+					this.points.push({
+						x: r[0],
+						y: r[1],
+						progress: t
+					});
+
+				}
+
+			}
+
+			this.frame = 0;
+
+			if (this.converter && this.converter.setup) {
+				this.converter.setup(this);
+			}
+
+		},
+
+		prep: function(frame) {
+
+			if (frame in this.imageData) {
+				return;
+			}
+
+			this._.clearRect(0, 0, this.fullWidth, this.fullHeight);
+			this._.fillStyle = this.backgroundColor;
+			this._.fillRect(0, 0, this.fullWidth, this.fullHeight);
+
+			var points = this.points,
+				pointsLength = points.length,
+				pd = this.pointDistance,
+				point,
+				index,
+				frameD;
+
+			this._setup();
+
+			for (var i = -1, l = pointsLength*this.trailLength; ++i < l && !this.stopped;) {
+
+				index = frame + i;
+
+				point = points[index] || points[index - pointsLength];
+
+				if (!point) continue;
+
+				this.alpha = Math.round(1000*(i/(l-1)))/1000;
+
+				this._.globalAlpha = this.alpha;
+
+				if (this.fillColor) {
+					this._.fillStyle = this.fillColor;
+				}
+				if (this.strokeColor) {
+					this._.strokeStyle = this.strokeColor;
+				}
+
+				frameD = frame/(this.points.length-1);
+				indexD = i/(l-1);
+
+				this._preStep(point, indexD, frameD);
+				this.stepMethod(point, indexD, frameD);
+
+			} 
+
+			this._teardown();
+
+			this.imageData[frame] = (
+				this._.getImageData(0, 0, this.fullWidth, this.fullWidth)
+			);
+
+			return true;
+
+		},
+
+		draw: function() {
+			
+			if (!this.prep(this.frame)) {
+
+				this._.clearRect(0, 0, this.fullWidth, this.fullWidth);
+
+				this._.putImageData(
+					this.imageData[this.frame],
+					0, 0
+				);
+
+			}
+
+			if (this.converter && this.converter.step) {
+				this.converter.step(this);
+			}
+
+			if (!this.iterateFrame()) {
+				if (this.converter && this.converter.teardown) {
+					this.converter.teardown(this);
+					this.converter = null;
+				}
+			}
+
+		},
+
+		iterateFrame: function() {
+			
+			this.frame += this.stepsPerFrame;
+			
+			if (this.frame >= this.points.length) {
+				this.frame = 0;
+				return false;
+			}
+
+			return true;
+
+		},
+
+		play: function() {
+
+			this.stopped = false;
+
+			var hoc = this;
+
+			this.timer = setInterval(function(){
+				hoc.draw();
+			}, 1000 / this.fps);
+
+		},
+		stop: function() {
+
+			this.stopped = true;
+			this.timer && clearInterval(this.timer);
+
+		}
+	};
+
+	window.Sonic = Sonic;
+
+}());

+ 1 - 0
VisualInspection/js/mytask/check.js

@@ -51,6 +51,7 @@ function initCheck() {
             curVideo = videos[0]; 
              queryVideoList();
          }else{
+              callFunc("showvideoview", "false");
             layer.msg('该处暂无视屏!', {
                     time: 2000, //20s后自动关闭
             });

+ 98 - 96
VisualInspection/view/mytask/check.html

@@ -1,10 +1,11 @@
+<script type="text/javascript" src="/js/lib/sonic.js?__inline"></script>
 <div class="container-fluid ">
     <div class="row">
         <form class="form-horizontal">
             <div class="form-group">
-                <label for="exampleInputAccount1" class="col-sm-1" >收费站</label>
+                <label for="exampleInputAccount1" class="col-sm-1">收费站</label>
                 <div class="col-sm-2">
-                    <select class="form-control"  id="fsList" disabled="disabled">
+                    <select class="form-control" id="fsList" disabled="disabled">
                         
                     </select>
                 </div>
@@ -28,89 +29,88 @@
     <div class="row">
         <div class="col-sm-6">
             <div id="dashboard" class="dashboard dashboard-draggable" data-height="300">
-            <section class="row">
-                <div class="col-md-12">
-                <div class="panel" data-id="1">
-                    <!--<div class="panel-heading">
+                <section class="row">
+                    <div class="col-md-12">
+                        <div class="panel" data-id="1">
+                            <!--<div class="panel-heading">
                     <i class="icon icon-list"></i>
                     <span class="title">面板标题</span>
                     </div>-->
-                    
-                    <div class="panel-body" style="padding:5px;">
-                        <ul class="nav nav-secondary">
-                            <li class="active"><a data-tab href="#tabContent1" bbb="0">收费亭</a></li>
-                            <li><a data-tab href="#tabContent2" bbb="1">车道</a></li>
-                            <li><a data-tab href="#tabContent3" bbb="2">广场</a></li>
-                        </ul>      
-                        <div class="tab-content" id="tabcontent" style="height:400px;">
-                            <div class="tab-pane active" id="tabContent1" class="col-sm-12">
-                            </div>
-                            <div class="tab-pane" id="tabContent2" class="col-sm-12">
-                            </div>
-                            <div class="tab-pane" id="tabContent3" class="col-sm-12">
-                            </div>
-                        </div>
-                        <div class="row" class="col-md-12" style="padding:5px;margin-top:5px;text-align:center">
-                            <input id="ex1" class="col-md-12"  type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="0"/>
-                        </div>
-                        <div class="row" style="padding:0 10px;margin-top:5px;text-align:center">
-                            <select class="form-control" id="video_list" style="width:200px;float:left;"></select>
-                            <div class="btn-group" style="float:right;">
-                                <button type="button" class="btn btn-info" onclick="doAction('start')"><i class="icon icon-play-circle icon-2x"></i></button>
-                                <button type="button" class="btn btn-info" onclick="doAction('stop')"><i class="icon icon-pause icon-2x"></i></button>
-                                <button type="button" class="btn btn-info" onclick="doAction('fast')"><i class="icon icon-forward icon-2x"></i></button>
-                                <button type="button" class="btn btn-info" onclick="doAction('slow')"><i class="icon icon-backward icon-2x"></i></button>
-                                <button type="button" class="btn btn-success" onclick="doAction('screenshot')"><i class="icon icon-camera icon-2x"></i></button>
+
+                            <div class="panel-body" style="padding:5px;">
+                                <ul class="nav nav-secondary">
+                                    <li class="active"><a data-tab href="#tabContent1" bbb="0">收费亭</a></li>
+                                    <li><a data-tab href="#tabContent2" bbb="1">车道</a></li>
+                                    <li><a data-tab href="#tabContent3" bbb="2">广场</a></li>
+                                </ul>
+                                <div class="tab-content" id="tabcontent" style="height:400px;text-align: center;background:rgba(ff,ff,ff,0.0);">
+                                    <p style="padding-top:100px;font-size:20px">加载中...</p>
+                                    <!--<i class="icon icon-spin icon-spinner  icon-5x" style="margin-top:100px"></i>-->
+                                </div>
+                                <div class="row" class="col-md-12" style="padding:5px;margin-top:5px;text-align:center">
+                                    <input id="ex1" class="col-md-12" type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="0"
+                                    />
+                                </div>
+                                <div class="row" style="padding:0 10px;margin-top:5px;text-align:center">
+                                    <select class="form-control" id="video_list" style="width:200px;float:left;"></select>
+                                    <div class="btn-group" style="float:right;">
+                                        <button type="button" class="btn btn-info" onclick="doAction('start')"><i class="icon icon-play-circle icon-2x"></i></button>
+                                        <button type="button" class="btn btn-info" onclick="doAction('stop')"><i class="icon icon-pause icon-2x"></i></button>
+                                        <button type="button" class="btn btn-info" onclick="doAction('fast')"><i class="icon icon-forward icon-2x"></i></button>
+                                        <button type="button" class="btn btn-info" onclick="doAction('slow')"><i class="icon icon-backward icon-2x"></i></button>
+                                        <button type="button" class="btn btn-success" onclick="doAction('screenshot')"><i class="icon icon-camera icon-2x"></i></button>
+                                    </div>
+                                </div>
+                                <!--<hr>-->
+
                             </div>
                         </div>
-                        <!--<hr>-->
-                       
-                        </div>
-                    </div>
                     </div>
                 </section>
             </div>
-            
+
         </div>
         <div class="col-sm-6">
             <div id="score_datatable" style="height:350px;" data-checkable="true" data-sortable="true"></div>
             <div class="row">
                 <div id="dashboard" class="dashboard dashboard-draggable" data-height="300">
-                <div class="row" id="appeal_div" style="padding:10px;">
-                    <h3>申诉基本信息</h3>
-                    <div>
-                        <table style="width:100%;">
-                            <tr>
-                                <td width="20%">申诉时间:<label id="appeal_time"></label></td>
-                                <td width="20%">申诉原因:<label id="appeal_reason"></label></td>
-                            </tr>
-                            <tr>
-                                <td width="20%">附件:<div class="file-list" id="appeal_file_list"></div></td>
-                            </tr>
-                        </table>
+                    <div class="row" id="appeal_div" style="padding:10px;">
+                        <h3>申诉基本信息</h3>
+                        <div>
+                            <table style="width:100%;">
+                                <tr>
+                                    <td width="20%">申诉时间:<label id="appeal_time"></label></td>
+                                    <td width="20%">申诉原因:<label id="appeal_reason"></label></td>
+                                </tr>
+                                <tr>
+                                    <td width="20%">附件:
+                                        <div class="file-list" id="appeal_file_list"></div>
+                                    </td>
+                                </tr>
+                            </table>
+                        </div>
                     </div>
-                </div>
-                <div class="row" class="col-sm-11" style="margin:5px;">
-                    <button class="btn btn-primary" type="button" onclick="clearAllImg()" style="margin-right:10px;">清空</button>
-                    <button class="btn btn-danger" type="button"  onclick="showScore()" style="margin-right:10px;">评分</button>
-                    <button id="saveEditBtn" class="btn btn-warning" type="button"  onclick="saveEdit()" style="margin-right:10px;display:none;">保存修改</button>
-                    <form id="form1" runat="server" method="post" enctype="multipart/form-data" style="float:left;margin-right:10px;"> 
-                        <div> 
-                            <button id="box" class="btn btn-primary" type="button">上传</button>
-                            <div style="display:none;"> 
-                            <input type="file" name="_f" id="_f" /> 
-                            </div> 
+                    <div class="row" class="col-sm-11" style="margin:5px;">
+                        <button class="btn btn-primary" type="button" onclick="clearAllImg()" style="margin-right:10px;">清空</button>
+                        <button class="btn btn-danger" type="button" onclick="showScore()" style="margin-right:10px;">评分</button>
+                        <button id="saveEditBtn" class="btn btn-warning" type="button" onclick="saveEdit()" style="margin-right:10px;display:none;">保存修改</button>
+                        <form id="form1" runat="server" method="post" enctype="multipart/form-data" style="float:left;margin-right:10px;">
+                            <div>
+                                <button id="box" class="btn btn-primary" type="button">上传</button>
+                                <div style="display:none;">
+                                    <input type="file" name="_f" id="_f" />
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                    <div class="panel">
+                        <div class="panel-body" style="padding:5px;" class="col-sm-12">
+                            <div id="img_container" class="cards cards-borderless col-sm-12" style="height:100px;overflow:auto;">
+                            </div>
                         </div>
-                    </form>                     
-                </div>
-                <div class="panel">
-                    <div class="panel-body" style="padding:5px;" class="col-sm-12">
-                        <div id="img_container" class="cards cards-borderless col-sm-12" style="height:100px;overflow:auto;">
-                        </div>                      
                     </div>
                 </div>
-            </div>
-                
+
             </div>
             <div class="row" style="margin-top:5px;">
                 <div class="col-sm-10" id="btn_task">
@@ -131,14 +131,14 @@
     </div>
 </div>
 <div id="form-div" style="display:none;text-align:center;">
-    <link rel="import" href="/view/mytask/changePerson.html?__inline">   
-</div> 
+    <link rel="import" href="/view/mytask/changePerson.html?__inline">
+</div>
 <div id="items-div" style="display:none;text-align:center;">
-   <ul id="items_tree" class="ztree"></ul>  
+    <ul id="items_tree" class="ztree"></ul>
 </div>
 <div id="score-detail-div" style="display:none;text-align:center;">
-  <link rel="import" href="/view/mytask/scoreDetail.html?__inline"> 
-</div> 
+    <link rel="import" href="/view/mytask/scoreDetail.html?__inline">
+</div>
 <!-- 对话框HTML -->
 <div class="modal fade" id="validSubmitWin">
     <div class="modal-dialog">
@@ -148,7 +148,7 @@
                 <h4 class="modal-title">无效申请</h4>
             </div>
             <div class="modal-body">
-                <form  class="form-horizontal">
+                <form class="form-horizontal">
                     <label for="exampleInputAccount1" class="col-sm-2">无效原因</label>
                     <div class="form-group">
                         <input class="col-sm-3" type="text" id="valid-reason" class="form-control" placeholder="原因">
@@ -168,7 +168,7 @@
             <div class="form-group">
                 <label class="col-md-4 col-sm-2">原因</label>
                 <div class="col-md-6 col-sm-10">
-                        <input type="text" class="form-control" id="apply_reason" placeholder="">
+                    <input type="text" class="form-control" id="apply_reason" placeholder="">
                 </div>
             </div>
         </div>
@@ -176,35 +176,36 @@
 </div>
 <script>
     var curVideo;
-    $(document).ready(function() {
+    $(document).ready(function () {
         initCheck();
-        
 
-        $('[data-tab]').on('shown.zui.tab', function(e) {
+
+        $('[data-tab]').on('shown.zui.tab', function (e) {
             // console.log('当前被激活的标签页', $(e.target).attr('bbb'));
             // console.log('上一个标签页', e.relatedTarget);
-            var i = $(e.target).attr('bbb');           
-            var videos = $.checkTask.video_id.split(','); 
-           
+            var i = $(e.target).attr('bbb');
+            var videos = $.checkTask.video_id.split(',');
 
-            if(videos[i]){
-                curVideo = videos[i]; 
+            if (videos[i] != "" && videos[i] && typeof (videos[i]) != "undefined") {
+                curVideo = videos[i];
                 queryVideoList();
-            }else{
+            } else {
+                callFunc("showvideoview", "false");
                 layer.msg('暂无视屏!', {
                     time: 2000, //20s后自动关闭
                 });
-            } 
-           
+                callFunc("stop", "");
+            }
+
         });
 
-       
+
     });
 
-    $("#box").click(function () { 
-        return $("#_f").click(); 
-    }); 
-    $("#_f").change(function() {
+    $("#box").click(function () {
+        return $("#_f").click();
+    });
+    $("#_f").change(function () {
         UpladFile();
     });
 
@@ -215,11 +216,12 @@
         // var form = new FormData();
         // form.append("name", "hooyes");                        // 可以增加表单数据
         // form.append("file", fileObj);                           // 文件对象
-        uploadFile(fileObj, "file", function(data) {
-           
-           addPic(base_image_server_url+data.path);
-        }, function(error) {
+        uploadFile(fileObj, "file", function (data) {
+
+            addPic(base_image_server_url + data.path);
+        }, function (error) {
             console.log(error)
         });
     }
-</script>
+
+</script>

+ 8 - 8
VisualInspection_server/src/main/resources/application.properties

@@ -2,8 +2,8 @@ server.port=8089
 spring.thymeleaf.cache=false
 context.listener.classes=com.xintong.SystemInit
 
-master.datasource.url = jdbc:mysql://10.112.0.199:3306/visualinspection?useUnicode=true&characterEncoding=utf-8
-#master.datasource.url = jdbc:mysql://git.topm.win:6381/visualinspection?useUnicode=true&characterEncoding=utf-8
+#master.datasource.url = jdbc:mysql://10.112.0.199:3306/visualinspection?useUnicode=true&characterEncoding=utf-8
+master.datasource.url = jdbc:mysql://git.topm.win:6381/visualinspection?useUnicode=true&characterEncoding=utf-8
 #master.datasource.url = jdbc:mysql://192.168.8.236:3306/visualinspection?useUnicode=true&characterEncoding=utf-8
 master.datasource.username = root
 master.datasource.password = root
@@ -11,8 +11,8 @@ master.datasource.driver-class-name = com.mysql.jdbc.Driver
 master.mapper-locations=classpath:com/xintong/visualinspection/mapper/master/*.xml
 
 ## \u7528\u6237\u6570\u636e\u6e90\u914d\u7f6e
-cluster.datasource.url=jdbc:mysql://10.112.0.199:3306/yanhai?useUnicode=true&characterEncoding=utf8
-#cluster.datasource.url=jdbc:mysql://git.topm.win:6381/yanhai?useUnicode=true&characterEncoding=utf8
+#cluster.datasource.url=jdbc:mysql://10.112.0.199:3306/yanhai?useUnicode=true&characterEncoding=utf8
+cluster.datasource.url=jdbc:mysql://git.topm.win:6381/yanhai?useUnicode=true&characterEncoding=utf8
 cluster.datasource.username=root
 cluster.datasource.password=root
 cluster.datasource.driver-class-name = com.mysql.jdbc.Driver
@@ -53,11 +53,11 @@ spring.datasource.useGlobalDataSourceStat=true
 # Redis\u6570\u636e\u5e93\u7d22\u5f15\uff08\u9ed8\u8ba4\u4e3a0\uff09
 spring.redis.database=0  
 # Redis\u670d\u52a1\u5668\u5730\u5740
-spring.redis.host=10.112.0.199
-#spring.redis.host=git.topm.win
+#spring.redis.host=10.112.0.199
+spring.redis.host=git.topm.win
 # Redis\u670d\u52a1\u5668\u8fde\u63a5\u7aef\u53e3
-#spring.redis.port=6380
-spring.redis.port=6379 
+spring.redis.port=6380
+#spring.redis.port=6379 
 # Redis\u670d\u52a1\u5668\u8fde\u63a5\u5bc6\u7801\uff08\u9ed8\u8ba4\u4e3a\u7a7a\uff09
 spring.redis.password=xintong
 # \u8fde\u63a5\u6c60\u6700\u5927\u8fde\u63a5\u6570\uff08\u4f7f\u7528\u8d1f\u503c\u8868\u793a\u6ca1\u6709\u9650\u5236\uff09