From 5954aa0f9f982bba46843bf0dcc835f5efa2b667 Mon Sep 17 00:00:00 2001 From: feige <791364011@qq.com> Date: 星期日, 10 十一月 2024 22:20:09 +0800 Subject: [PATCH] 修改bug --- ruoyi-ui/src/views/login.vue | 71 ++++++++++++++++++++++------------- 1 files changed, 45 insertions(+), 26 deletions(-) diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue index 0e1fd66..e1fb05a 100644 --- a/ruoyi-ui/src/views/login.vue +++ b/ruoyi-ui/src/views/login.vue @@ -37,9 +37,9 @@ </div></div> <div class="yonghuming" style="">鐢ㄦ埛鍚�</div> - <el-form-item prop="username" style="width: 380px; height: 48px; "> + <el-form-item prop="nickName" style="width: 380px; height: 48px; "> <el-input - v-model="loginForm.username" + v-model="loginForm.nickName" type="text" auto-complete="off" placeholder="璇疯緭鍏ョ敤鎴峰悕" @@ -150,8 +150,8 @@ <div class="register"> <el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form"> <h3 class="title">鏂扮敤鎴锋敞鍐�</h3> - <el-form-item prop="username"> - <el-input v-model="registerForm.username" type="text" auto-complete="off" placeholder="璐﹀彿"> + <el-form-item prop="nickname"> + <el-input v-model="registerForm.nickname" type="text" auto-complete="off" placeholder="璐﹀彿"> <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" /> </el-input> </el-form-item> @@ -216,12 +216,14 @@ </div> </div> - <div class="gpr"></div> + <div class="gpr"> +<!-- <img :key="url" :src="url" style="width:100%;height:30%"></img> --> + </div> </div> </template> <script> -import { getCodeImg,Download } from "@/api/login"; +import { getCodeImg,Download,register } from "@/api/login"; import Cookies from "js-cookie"; import { encrypt, decrypt } from '@/utils/jsencrypt' @@ -236,20 +238,21 @@ } }; return { + url: require('../assets/images/index.png'), openRegister: false, open: false, codeUrl: "", loginForm: { // username: "admin", // password: "admin123", - username: "", + nickName: "", password: "", rememberMe: false, code: "", uuid: "" }, loginRules: { - username: [ + nickName: [ { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�" } ], password: [ @@ -261,23 +264,23 @@ // 楠岃瘉鐮佸紑鍏� captchaEnabled: true, // 娉ㄥ唽寮�鍏� - register: true, + // register: true, redirect: undefined, registerForm: { - username: "", + nickname: "", password: "", confirmPassword: "", code: "", uuid: "" }, registerRules: { - username: [ + nickname: [ { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�" }, - { min: 2, max: 20, message: '鐢ㄦ埛璐﹀彿闀垮害蹇呴』浠嬩簬 2 鍜� 20 涔嬮棿', trigger: 'blur' } + // { min: 2, max: 20, message: '鐢ㄦ埛璐﹀彿闀垮害蹇呴』浠嬩簬 2 鍜� 20 涔嬮棿', trigger: 'blur' } ], password: [ { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勫瘑鐮�" }, @@ -306,16 +309,19 @@ }, methods: { handleRegister() { + //alert(this.registerForm.nickname) this.$refs.registerForm.validate(valid => { if (valid) { this.loading = true; + //alert(this.registerForm.nickname) register(this.registerForm).then(res => { - const username = this.registerForm.username; - this.$alert("<font color='red'>鎭枩浣狅紝鎮ㄧ殑璐﹀彿 " + username + " 娉ㄥ唽鎴愬姛锛�</font>", '绯荤粺鎻愮ず', { + const nickName = this.registerForm.nickname; + this.$alert("<font color='red'>鎭枩浣狅紝鎮ㄧ殑璐﹀彿 " + nickName + " 娉ㄥ唽鎴愬姛锛�</font>", '绯荤粺鎻愮ず', { dangerouslyUseHTMLString: true, type: 'success' }).then(() => { - this.$router.push("/login"); + this.openRegister = false; + // this.$router.push("/login"); }).catch(() => {}); }).catch(() => { this.loading = false; @@ -335,20 +341,21 @@ getCode() { getCodeImg().then(res => { - + this.captchaEnabled = res.data.captchaEnabled === undefined ? true : res.captchaEnabled; if (this.captchaEnabled) { this.codeUrl = "data:image/gif;base64," + res.data.img; this.loginForm.uuid = res.data.uuid; + this.registerForm.uuid = res.data.uuid; } }); }, getCookie() { - const username = Cookies.get("username"); + const nickName = Cookies.get("nickName"); const password = Cookies.get("password"); const rememberMe = Cookies.get('rememberMe') this.loginForm = { - username: username === undefined ? this.loginForm.username : username, + nickName: nickName === undefined ? this.loginForm.nickName : nickName, password: password === undefined ? this.loginForm.password : decrypt(password), rememberMe: rememberMe === undefined ? false : Boolean(rememberMe) }; @@ -358,14 +365,15 @@ if (valid) { this.loading = true; if (this.loginForm.rememberMe) { - Cookies.set("username", this.loginForm.username, { expires: 30 }); + Cookies.set("nickName", this.loginForm.nickName, { expires: 30 }); Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 }); Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 }); } else { - Cookies.remove("username"); + Cookies.remove("nickName"); Cookies.remove("password"); Cookies.remove('rememberMe'); } + // alert(this.loginForm.nickName) this.$store.dispatch("Login", this.loginForm).then(() => { this.$router.push({ path: this.redirect || "/" }).catch(()=>{}); }).catch(() => { @@ -384,20 +392,31 @@ <style rel="stylesheet/scss" lang="scss"> .gpr{ width:100%; - height:600px; - background: no-repeat center/40% url("../assets/images/Group 132.png"); + // height:1000px; + + //background: no-repeat center/100% url("../assets/images/index.png"); } .customWidth{ width:40%; // 璁剧疆寮瑰嚭妗嗗搴︾殑鏁板�� } .topHeight{ height: 40px; + margin-right: 20px; + top:5px; + position: absolute; } .Group_132{ + // background-image: url("../assets/images/index.png"); + + + // background: no-repeat center/40% url("../assets/images/Group 132.png"); - height: 100%; - width: 100%; + // height: 1200px; + min-width: 1300px; + width: 100vw; + height: 100vh; + background-color: #FEF7FC; //background-position: 49.5% 16.2% ; // background-position: 81.7px 71.3px; @@ -409,9 +428,9 @@ display: flex; justify-content: flex-end; align-items: center; - height: 100%; + // height: 60px; width: 100%; - background: no-repeat center/40% url("../assets/images/login_logo.png"); + background: no-repeat center/100% url("../assets/images/index.png"); background-color: #FEF7FC; -- Gitblit v1.9.1