Browse Source

遮罩层

zhangjinkun 6 years ago
parent
commit
abc2c22656

+ 22 - 0
src/web/res/js/com.js

@@ -99,4 +99,26 @@ com.pushArry=function(arr1,arr2){
 	  }
 	}
 	return arr1
+}
+
+com.maskShow=function(title){
+	var change=function(){
+		if(title){
+			$("#maskTitle").text(title);
+		}else{
+			$("#maskTitle").text("加载中");
+		}
+		var width=$(window).width();
+		var height=$("body").height();
+		$(".mask>.box").css("left",width/4);
+		$(".mask").removeClass("hide").css("height",height);
+	}
+	$(window).resize(function(){
+		change();
+	});
+	change();
+}
+com.maskHide=function(){
+	$(".mask").addClass("hide");
+	$(window).unbind("resize");
 }

+ 36 - 0
src/web/templates/admin/com_mask.html

@@ -0,0 +1,36 @@
+{{ define "mask" }}
+<style> 
+.mask {
+  width: 100%;
+  top: 0;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  z-index: 99999;
+  position: absolute;
+  background: rgba(0, 0, 0, 0.5);
+}
+.mask > .box {
+  position: absolute;
+  width: 50%;
+  top: 35%;
+}
+</style> 
+<div class="mask hide" >
+	<div class="box box-danger">
+	  <div class="box-header">
+	        <h3 class="box-title" id="maskTitle">加载中</h3>
+		    <div onclick="com.maskHide();" style="cursor:pointer;float:right;font-weight:600;z-index: 9999;position: relative;">X</div>
+	  </div>
+      <div class="box-body">
+        正在加载数据,请稍后......
+      </div>
+      <!-- /.box-body -->
+      <!-- Loading (remove the following to stop the loading)-->
+      <div class="overlay">
+        <i class="fa fa-refresh fa-spin"></i>
+      </div>
+      <!-- end loading -->
+    </div>
+</div>
+{{ end }}

+ 11 - 6
src/web/templates/admin/distribution.html

@@ -50,6 +50,7 @@
 </div>
 	
 <!-- footer -->
+{{template "mask"}}
 {{template "dialog"}}
 {{template "footer"}}
 
@@ -172,7 +173,7 @@ $(function () {
 })
 function del(_id){
 	showConfirm("确定释放实例?", function() {
-		$.ajax({
+        $.ajax({
 			url:"/admin/distribution/deleteInstance",
 			type:"post",
 			data:{"InstanceId":_id},
@@ -188,14 +189,14 @@ function del(_id){
 }
 function upInstanceIds(){
     showConfirm("更新实例?", function() {
-    	$.ajax({
+    	com.maskShow("正在更新实例...");
+		$.ajax({
     		url:"/admin/distribution/upstatus",
     		type:"post",
     		success:function(r){
-    			if(r.rep){				
+    			if(r.rep){			
     				ttable.ajax.reload();
-    			}else{
-    				showTip("更新实例", 1000, function() {});
+                    com.maskHide();
     			}
     		}
     	})
@@ -204,12 +205,14 @@ function upInstanceIds(){
 
 function deploy(){
     showConfirm("部署应用?", function() {
+       com.maskShow("正在部署应用...");
        $.ajax({
     		url:"/admin/distribution/deploy",
     		type:"post",
     		success:function(r){
     			if(r.rep){				
     				ttable.ajax.reload();
+                    com.maskHide();
     			}else{
     				showTip("部署失败", 1000, function() {});
     			}
@@ -220,12 +223,14 @@ function deploy(){
 
 function rangetask(){
     showConfirm("启动抽取?", function() {
-       $.ajax({
+        com.maskShow("正在部署应用...");
+        $.ajax({
     		url:"/admin/distribution/rangetask",
     		type:"post",
     		success:function(r){
     			if(r.rep){				
     				ttable.ajax.reload();
+                    com.maskHide();
     			}else{
     				showTip("启动抽取失败", 1000, function() {});
     			}