From 9486766c806fe1d9e082b2fd02ea1cc558f1b443 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 08 五月 2025 09:21:57 +0800
Subject: [PATCH] bug修改

---
 cloud-server-management/src/main/webapp/WEB-INF/view/password.html |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/password.html b/cloud-server-management/src/main/webapp/WEB-INF/view/password.html
index 28ef077..615ea6c 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/password.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/password.html
@@ -100,17 +100,44 @@
     var key = CryptoJS.enc.Utf8.parse("c53fd327353a09a1");
     var iv = CryptoJS.enc.Utf8.parse("3a0565e3b1d8ae3d");
 
-    function sendSMSCode() {
-        var phone  = $("#username").val()
+    function sendSMSCode(btn) {
+        var phone = $("#username").val();
+        if (!phone) {
+            alert("请输入账号");
+            return;
+        }
+        // 禁用按钮并开始倒计时
+        startCountdown(btn, 60);
+
         var ajax = new $ax(Feng.ctxPath + "/getSMSCode", function(data){
-            if(data!=null && data.code != 200){
+            if(data != null && data.code != 200){
                 alert(data.msg);
             }
         });
-        ajax.set("phone",phone);
+        ajax.set("phone", phone);
         ajax.start();
     }
 
+    // 倒计时函数
+    function startCountdown(btn, seconds) {
+        var $btn = $(btn);
+        $btn.prop('disabled', true);
+        $btn.css('background', '#ccc');
+        var count = seconds;
+        $btn.text(count + "s后重发");
+        var timer = setInterval(function() {
+            count--;
+            if (count > 0) {
+                $btn.text(count + "s后重发");
+            } else {
+                clearInterval(timer);
+                $btn.prop('disabled', false);
+                $btn.css('background', ''); // 恢复原色
+                $btn.text("获取验证码");
+            }
+        }, 1000);
+    }
+
     //aes加密
     function encrypt(context) {
         var encrypted = '';

--
Gitblit v1.7.1