yby 2 mēneši atpakaļ
vecāks
revīzija
db0d17ce66

+ 14 - 10
web/WEB-INF/page/app/sufferer-info.jsp

@@ -157,16 +157,16 @@
 </body>
 <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.js"></script>
 <script>
+    function showAlert(message) {
+        let body = $("body");
+        let alertContainer = $("<div style='display:none; position:fixed; top:20px; left:50%; transform:translateX(-50%); background-color:#f8d7da; color:#721c24; padding:10px; border:1px solid #f5c6cb; border-radius:5px;'>");
+        body.append(alertContainer);
+        alertContainer.text(message).fadeIn();
 
-    const phoneInput = document.querySelector('input[name="phone"]');
-    phoneInput.addEventListener('input', function () {
-        const value = this.value;
-        const onlyNumbers = value.replace(/\D/g, '');
-        if (onlyNumbers.length > 11 || onlyNumbers.length < 11) {
-            this.value = onlyNumbers.slice(0, 11);
-        }
-    });
-
+        setTimeout(function () {
+            alertContainer.fadeOut();
+        }, 5000); // 3秒后自动消失
+    }
     $(document).ready(init)
     function init(){
         console.log("<%=vo.getDoctorId()%> <%=vo.getDoctorName()%> <%=vo.getDate()%> <%=vo.getTime()%>")
@@ -187,10 +187,13 @@
         var state = "NoChecked";
 
         // 检查必填字段是否有值
-        if (!name || sex === '-请选择性别-' ||!age ||!date || reimburse === '-请选择报销方式-' ||!phone) {
+        if (!name || sex === '-请选择性别-' ||!age ||!date || reimburse === '-请选择报销方式-' ||!phone ) {
             alert('请填写完整的预约信息!');
             return;
         }
+        if(phone.length !== 11){
+            showAlert("手机号输入有误")
+        }
         // 可以在这里进行数据的提交处理,假设使用 AJAX 提交到服务器
         $.ajax({
             url: '<%=path%>/addRegister/AddRegister.action', // 替换为实际的提交地址
@@ -208,6 +211,7 @@
                 doctorName: doctor_name,
                 state: state,
             },
+
             method: 'get',
             success: function(response) {
                 // 提交成功后的处理

+ 2 - 2
web/WEB-INF/page/pc/Doctor_Manage.jsp

@@ -344,9 +344,9 @@
         var info = $("#info").val();
         var power = $("input[name='power']:checked").val();
 
-        if(id==='' || name==='' || age==='' || sex==='' || selectedOption==='' || value==='' || secondDeptId===''
+        if(id==='' || name==='' || age==='' || sex === undefined || selectedOption==='' || value==='' || secondDeptId===''
            || name1==='' || secondDeptName ==='' || degree ==='' || status ==='' || phone ==='' ||
-            account ==='' || password ==='' || info ==='' || power ==='')
+            account ==='' || password ==='' || info ==='' || power === undefined )
         {
             showAlert("有空输入")
             return