| | |
| | | </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> |
| | | |
| | |
| | | |
| | | </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;"> |
| | |
| | | </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' |
| | | |
| | |
| | | |
| | | } |
| | | }; |
| | | 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, |
| | |
| | | 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; |
| | | }, |