吴学文 пре 6 година
родитељ
комит
99d4a25570
1 измењених фајлова са 20 додато и 1 уклоњено
  1. 20 1
      java110-front/src/main/resources/static/js/core.js

+ 20 - 1
java110-front/src/main/resources/static/js/core.js

@@ -331,4 +331,23 @@
         number:"number"
     }
 
-})(window.vc)
+})(window.vc)
+
+/**
+toast
+**/
+(function(vc){
+    vc.toast = function Toast(msg,duration){
+                     duration=isNaN(duration)?3000:duration;
+                     var m = document.createElement('div');
+                     m.innerHTML = msg;
+                     m.style.cssText="max-width:60%;min-width: 150px;padding:0 14px;height: 40px;color: rgb(255, 255, 255);line-height: 40px;text-align: center;border-radius: 4px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.7);font-size: 16px;";
+                     document.body.appendChild(m);
+                     setTimeout(function() {
+                       var d = 0.5;
+                       m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
+                       m.style.opacity = '0';
+                       setTimeout(function() { document.body.removeChild(m) }, d * 1000);
+                     }, duration);
+                   }
+})(window.vc);