yuliang 5 年 前
コミット
41e763397d

+ 58 - 1
whepi-ui/templates/home/frag.foot.ftl

@@ -13,4 +13,61 @@
 <script src="${s3('/jquery-weui/1.2.1/js/jquery-weui.min.js')}"></script>
 <script src="${s3('/jquery-weui/1.2.1/js/swiper.min.js')}"></script>
 <script src="${s3('/jquery-weui/1.2.1/js/city-picker.min.js')}"></script>
-<#--<script src="https://www.w3cways.com/demo/vconsole/vconsole.min.js?v=2.2.0"></script>-->
+<#--<script src="https://www.w3cways.com/demo/vconsole/vconsole.min.js?v=2.2.0"></script>-->
+<script>
+
+    Window.prototype.alert = function(){
+        //创建一个大盒子
+        var box = document.createElement("div");
+        //创建一个关闭按钮
+        var button = document.createElement("button");
+        //定义一个对象保存样式
+        var boxName = {
+            width:"500px",
+            height:"180px",
+            backgroundColor:"#f8f8f8",
+            border:"1px solid #ccc",
+            position:"absolute",
+            top:"50%",
+            left:"50%",
+            margin:"-90px 0 0 -250px",
+            zIndex:"999",
+            textAlign:"center",
+            lineHeight:"180px"
+        }
+        //给元素添加元素
+        for(var k in boxName){
+            box.style[k] = boxName[k];
+        }
+        //把创建的元素添加到body中
+        document.body.appendChild(box);
+        //把alert传入的内容添加到box中
+        if(arguments[0]){
+            box.innerHTML = arguments[0];
+        }
+        button.innerHTML = "关闭";
+        //定义按钮样式
+        var btnName = {
+            border:"1px solid #ccc",
+            backgroundColor:"#fff",
+            width:"70px",
+            height:"30px",
+            textAlign:"center",
+            lineHeight:"30px",
+            outline:"none",
+            position:"absolute",
+            bottom:"10px",
+            right:"20px",
+        }
+        for(var j in btnName){
+            button.style[j] = btnName[j];
+        }
+        //把按钮添加到box中
+        box.appendChild(button);
+        //给按钮添加单击事件
+        button.addEventListener("click",function(){
+            box.style.display = "none";
+        })
+    }
+
+</script>

+ 1 - 1
whepi-ui/templates/home/home.ftl

@@ -123,7 +123,7 @@
     }
 
     function xiaoQuItemClick(v) {
-        /*alert(v.taskId)*/
+        /*$.alert(v.taskId)*/
         if ($('#titlteZs')[0].style.display == 'none') {
             $('#notitle').toggle();
             $('#titlteZs')[0].style.display = '';

+ 3 - 3
whepi-ui/templates/home/qiuzhu.ftl

@@ -216,7 +216,7 @@
              $("#qzf4").val()*/
         var taskTitle = $("#Qzinput").val();
         if (!taskTitle) {
-            alert("请输入求助标题!")
+            $.alert("请输入求助标题!")
             $('#notPlay').hidden = 'hidden';
             $('#play')[0].style.display = '';
             // $('#notPlay').style=='hidden'
@@ -224,12 +224,12 @@
         }
         var taskTarget = $("#qzf2").val();
         if (!taskTarget) {
-            alert("请输入求助目标!")
+            $.alert("请输入求助目标!")
             return false;
         }
         var remark = $("#remarks").val();
         if (!remark) {
-            alert("请输入求助内容!")
+            $.alert("请输入求助内容!")
             return false;
         }
 

+ 1 - 1
whepi-ui/templates/home/qiuzhu.js

@@ -33,7 +33,7 @@ function timestampToTime(timestamp) {
 function family_init() {
   /*$('#family').on('click',function () {
     $('#familyDisplay')[0].style.display == '';
-    alert($('#familyDisplay')[0].style.display == 'none')
+    $.alert($('#familyDisplay')[0].style.display == 'none')
     if($('#familyDisplay')[0].style.display == 'none'){
       $('#notPlay').toggle();
 

+ 6 - 6
whepi-ui/templates/home/ribao.js

@@ -379,28 +379,28 @@ function ribaoCommit() {
   var others = $("#shuruqita").val() == undefined ? "" : $("#shuruqita").val();
 
   if (userName == undefined || userName == '') {
-    alert("请填写姓名");
+    $.alert("请填写姓名");
     return;
   }
   if (grender == 0) {
-    alert("请填写性别");
+    $.alert("请填写性别");
     return;
   }
   if (age == undefined || age == '') {
-    alert("请填写年龄");
+    $.alert("请填写年龄");
     return;
   }
   if (age > 150 || age < 0) {
-    alert("请填写正确的年龄");
+    $.alert("请填写正确的年龄");
     return;
   }
 
   if (temperature <= 0) {
-    alert("请填写体温");
+    $.alert("请填写体温");
     return;
   }
   if (temperature > 50 || temperature < 30) {
-    alert("请填写正确的体温");
+    $.alert("请填写正确的体温");
     return;
   }
 

+ 1 - 1
whepi-ui/templates/user/changeRole.ftl

@@ -57,7 +57,7 @@
     function login() {
         var userType = $('input:radio:checked').val();
         if (!userType) {
-            alert("请选择用户角色!")
+            $.alert("请选择用户角色!")
             return false;
         }
         window.location.href = "/user/homeIndex.html?userId=" + $("#userId").val() + "&userType=" + userType;

+ 6 - 6
whepi-ui/templates/user/home.ftl

@@ -463,27 +463,27 @@
         var userType = $('input:radio:checked').val();
         var city = $("#city").val();
         if (!city) {
-            alert("请选择城市!")
+            $.alert("请选择城市!")
             return false;
         }
         var area = $("#area").val();
         if (!area) {
-            alert("请选择区/县!")
+            $.alert("请选择区/县!")
             return false;
         }
         var uptownId = $("#uptownId").val();
         if (!uptownId) {
-            alert("请选择小区!")
+            $.alert("请选择小区!")
             return false;
         }
         var unitId = $("#unitId").val();
         var doorplate = $("#doorplate").val().trim();
         if (!unitId) {
-            alert("栋/单元!")
+            $.alert("栋/单元!")
             return false;
         }
         if (!doorplate) {
-            alert("请选择门牌信息!")
+            $.alert("请选择门牌信息!")
             return false;
         }
         console.log(city)
@@ -499,7 +499,7 @@
                 "doorplate": doorplate,
             },success: function (data) {
                 if (!data.success) {
-                    alert(data.msg);
+                    $.alert(data.msg);
                     return false;
                 } else {
                     $.ajax({

+ 1 - 1
whepi-ui/templates/yeweihui/qiuzhuDetail.ftl

@@ -77,7 +77,7 @@
 
         let qzcontent = $('#qz_content').val();
         if (qzcontent.length <= 0){
-            alert("请输入内容");
+            $.alert("请输入内容");
             return;
         }