From f43ef0c77c6f437bd0f7459d75168e6f77e334bb Mon Sep 17 00:00:00 2001
From: feige <feige@qq.com>
Date: 星期一, 22 十二月 2025 11:18:11 +0800
Subject: [PATCH] 修改了代码

---
 ruoyi-ui/src/views/login.vue |  216 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 214 insertions(+), 2 deletions(-)

diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue
index 8354128..1d197f8 100644
--- a/ruoyi-ui/src/views/login.vue
+++ b/ruoyi-ui/src/views/login.vue
@@ -27,7 +27,12 @@
 
 	     </div>
 	   </div>
-
+  
+      <!-- 娣诲姞QQ瀹㈡湇鎸夐挳 -->
+      <div class="qq-service-btn" @click="openQQChat">
+        <img :src="require('@/assets/image/qq.png')" alt="QQ瀹㈡湇">
+        <span>QQ瀹㈡湇</span>
+      </div>
 	    <el-dialog  :visible.sync="open" style="margin: 0px;" customClass="customWidth" width="620px">
     <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" style="margin: 0px;">
       <h3 class="title">鐧诲綍鏈兘閮藉缃�</h3>
@@ -136,6 +141,11 @@
         </el-button>
 
       </el-form-item>
+
+           <!-- 娣诲姞蹇樿瀵嗙爜鎸夐挳 -->
+           <el-form-item>
+        <el-link type="primary" @click="openForgotPasswordDialog">蹇樿瀵嗙爜</el-link>
+      </el-form-item>
 	  <el-form-item>
 		  <a href="https://www.bendudu.com:8080/profile/upload/2023/10/10/Bendudu20231010_20231010203358A033.apk">鐐瑰嚮姝ゅ涓嬭浇搴旂敤绋嬪簭</a>
 
@@ -209,6 +219,93 @@
 
 		</div>
 	</el-dialog>
+  <el-dialog :visible.sync="forgotPasswordDialogVisible" :title="forgotPasswordStep === 1 ? '蹇樿瀵嗙爜' : '閲嶇疆瀵嗙爜'" width="30%">
+    <!-- 姝ラ 1锛氳緭鍏ラ偖绠卞彂閫侀獙璇佺爜 -->
+    <div v-if="forgotPasswordStep === 1">
+      <p style="margin-bottom: 20px; color: #666;">蹇樿瀵嗙爜锛屽彲浠ラ�氳繃閭鎵惧洖锛岃杈撳叆娉ㄥ唽閭鑾峰彇楠岃瘉鐮�</p>
+      <el-form ref="forgotPasswordFormStep1" :model="forgotPasswordForm" :rules="forgotPasswordRulesStep1">
+        <el-form-item prop="nickName">
+          <el-input
+            v-model="forgotPasswordForm.nickName"
+            type="text"
+            auto-complete="off"
+            placeholder="璇疯緭鍏ョ敤鎴峰悕"
+          ></el-input>
+        </el-form-item>
+        <el-form-item prop="email">
+          <el-input
+            v-model="forgotPasswordForm.email"
+            type="text"
+            auto-complete="off"
+            placeholder="璇疯緭鍏ユ敞鍐岄偖绠�"
+          ></el-input>
+        </el-form-item>
+    
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="forgotPasswordDialogVisible = false">鍙栨秷</el-button>
+        <el-button type="primary" @click="sendVerificationCode">鍙戦�侀獙璇佺爜</el-button>
+      </span>
+    </div>
+    <!-- 姝ラ 2锛氳緭鍏ラ獙璇佺爜鍜屾柊瀵嗙爜杩涜淇敼 -->
+    <div v-else>
+      <p style="margin-bottom: 20px; color: #666;">璇疯緭鍏ユ敹鍒扮殑楠岃瘉鐮佸拰鏂板瘑鐮侀噸缃瘑鐮�</p>
+      <el-form ref="forgotPasswordFormStep2" :model="forgotPasswordForm" :rules="forgotPasswordRulesStep2">
+        <el-form-item prop="nickName">
+          <el-input
+            v-model="forgotPasswordForm.nickName"
+            type="text"
+            auto-complete="off"
+            placeholder="璇疯緭鍏ョ敤鎴峰悕"
+          ></el-input>
+        </el-form-item>
+        <el-form-item prop="code">
+          <el-input
+            v-model="forgotPasswordForm.code"
+            auto-complete="off"
+            placeholder="璇疯緭鍏ラ獙璇佺爜"
+          ></el-input>
+        </el-form-item>
+        <el-form-item prop="newPassword">
+          <el-input
+            v-model="forgotPasswordForm.newPassword"
+            type="password"
+            auto-complete="off"
+            placeholder="璇疯緭鍏ユ柊瀵嗙爜"
+          ></el-input>
+        </el-form-item>
+        <el-form-item prop="confirmNewPassword">
+          <el-input
+            v-model="forgotPasswordForm.confirmNewPassword"
+            type="password"
+            auto-complete="off"
+            placeholder="璇峰啀娆¤緭鍏ユ柊瀵嗙爜"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="goBackToStep1">杩斿洖</el-button>
+        <el-button @click="forgotPasswordDialogVisible = false">鍙栨秷</el-button>
+        <el-button type="primary" @click="submitPasswordReset">纭畾</el-button>
+      </span>
+    </div>
+  </el-dialog>
+
+  <el-dialog :visible.sync="qqDialogVisible" title="QQ瀹㈡湇" width="400px">
+  <div style="text-align: center; padding: 20px;">
+    <img :src="require('@/assets/image/qq.png')" alt="QQ瀹㈡湇" style="width: 80px; height: 80px; margin-bottom: 15px;">
+    <h3 style="margin-bottom: 15px;">瀹㈡湇QQ: 3224414357</h3>
+    <p style="margin-bottom: 20px; color: #666;">璇锋坊鍔犲ソ鍙嬪悗鍙戣捣浼氳瘽</p>
+    <div style="display: flex; justify-content: center; gap: 15px;">
+      <el-button type="primary" @click="copyQQ" plain>
+        澶嶅埗QQ鍙�
+      </el-button>
+      <el-button type="success" @click="addQQFriend">
+        娣诲姞濂藉弸
+      </el-button>
+    </div>
+  </div>
+</el-dialog>
     <!--  搴曢儴  -->
     <div class="el-login-footer" >
       <span style="color: black; "><span v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></span></span>
@@ -219,11 +316,14 @@
   <div class="gpr">
 <!-- 	   <img :key="url" :src="url" style="width:100%;height:30%"></img> -->
   </div>
+
+
+
 </div>
 </template>
 
 <script>
-import { getCodeImg,Download,register } from "@/api/login";
+import { getCodeImg,Download,register,getEmailCode, resetPassword } from "@/api/login";
 import Cookies from "js-cookie";
 import { encrypt, decrypt } from '@/utils/jsencrypt'
 
@@ -238,7 +338,54 @@
 
 	    }
 	  };
+    const validateEmail = (rule, value, callback) => {
+      const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+      if (!value) {
+        return callback(new Error('璇疯緭鍏ラ偖绠�'));
+      }
+      if (!emailRegex.test(value)) {
+        return callback(new Error('璇疯緭鍏ユ纭殑閭鏍煎紡'));
+      }
+      callback();
+    };
+    const equalToNewPassword = (rule, value, callback) => {
+      if (this.forgotPasswordForm.newPassword !== value) {
+        callback(new Error("涓ゆ杈撳叆鐨勬柊瀵嗙爜涓嶄竴鑷�"));
+      } else {
+        callback();
+      }
+    };
     return {
+       // ... existing code ...
+       nnme: '',
+       forgotPasswordDialogVisible: false,
+      forgotPasswordStep: 1, // 1 琛ㄧず杈撳叆閭姝ラ锛�2 琛ㄧず杈撳叆楠岃瘉鐮佸拰鏂板瘑鐮佹楠�
+      forgotPasswordForm: {
+        nickName: '',
+        email: '',
+        code: '',
+        newPassword: '',
+        confirmNewPassword: ''
+      },
+      forgotPasswordRulesStep1: {
+        email: [
+          { validator: validateEmail, trigger: 'blur' }
+        ]
+      },
+      forgotPasswordRulesStep2: {
+        code: [
+          { required: true, trigger: 'blur', message: '璇疯緭鍏ラ獙璇佺爜' }
+        ],
+        newPassword: [
+          { required: true, trigger: 'blur', message: '璇疯緭鍏ユ柊瀵嗙爜' },
+          { min: 5, max: 20, message: '鏂板瘑鐮侀暱搴﹀繀椤讳粙浜� 5 鍜� 20 涔嬮棿', trigger: 'blur' }
+        ],
+        confirmNewPassword: [
+          { required: true, trigger: 'blur', message: '璇峰啀娆¤緭鍏ユ柊瀵嗙爜' },
+          { validator: equalToNewPassword, trigger: 'blur' }
+        ]
+      },
+      qqDialogVisible: false,
 	  url: require('../assets/images/index.png'),
 		openRegister: false,
     avatar: undefined,
@@ -311,6 +458,71 @@
     this.getCookie();
   },
   methods: {
+    openForgotPasswordDialog() {
+      this.forgotPasswordDialogVisible = true;
+      this.forgotPasswordStep = 1;
+      this.forgotPasswordForm = {
+        nickName: '',
+        email: '',
+        code: '',
+        newPassword: '',
+        confirmNewPassword: ''
+      };
+    },
+    sendVerificationCode() {
+      this.nnme = this.forgotPasswordForm.nickName;
+      this.$refs.forgotPasswordFormStep1.validate(valid => {
+        if (valid) {
+          getEmailCode({ nickName:this.forgotPasswordForm.nickName, email: this.forgotPasswordForm.email }).then(() => {
+            this.$message.success('楠岃瘉鐮佸凡鍙戦�佽嚦鎮ㄧ殑閭锛岃鏌ユ敹');
+            this.forgotPasswordStep = 2;
+          }).catch(() => {
+            this.$message.error('楠岃瘉鐮佸彂閫佸け璐ワ紝璇烽噸璇�');
+          });
+        }
+      });
+    },
+    submitPasswordReset() {
+      this.$refs.forgotPasswordFormStep2.validate(valid => {
+        if (valid) {
+          var formData = new FormData();
+          formData.append('nickName', this.forgotPasswordForm.nickName); 
+          formData.append('verificationCode', this.forgotPasswordForm.code);
+          formData.append('newPassword', this.forgotPasswordForm.newPassword);
+          resetPassword(formData).then(() => {
+            this.$message.success('瀵嗙爜淇敼鎴愬姛');
+            this.forgotPasswordDialogVisible = false;
+          }).catch(() => {
+            this.$message.error('瀵嗙爜淇敼澶辫触锛岃閲嶈瘯');
+          });
+        }
+      });
+    },
+    goBackToStep1() {
+      this.forgotPasswordStep = 1;
+    },
+
+    openQQChat() {
+    this.qqDialogVisible = true;
+  },
+    copyQQ() {
+    const qq = '3224414357';
+    navigator.clipboard.writeText(qq).then(() => {
+      this.$message.success('QQ鍙峰凡澶嶅埗鍒板壀璐存澘');
+    }).catch(() => {
+      // 鍏煎涓嶆敮鎸乧lipboard API鐨勬祻瑙堝櫒
+      const input = document.createElement('input');
+      input.value = qq;
+      document.body.appendChild(input);
+      input.select();
+      document.execCommand('copy');
+      document.body.removeChild(input);
+      this.$message.success('QQ鍙峰凡澶嶅埗');
+    });
+  },
+  addQQFriend() {
+    window.open('tencent://message/?Menu=yes&uin=3224414357&Site=xxx&Service=10&sigT=10&sigU=10', '_blank');
+  },
 	  handleRegister() {
 		  //alert(this.registerForm.nickname)
 	    this.$refs.registerForm.validate(valid => {

--
Gitblit v1.9.1