From 2d881714a7b35ec6208946a06243c9db6690aff7 Mon Sep 17 00:00:00 2001 From: feige <791364011@qq.com> Date: 星期六, 23 十一月 2024 15:26:47 +0800 Subject: [PATCH] 修改性别 --- ruoyi-ui/src/views/login.vue | 361 ++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 308 insertions(+), 53 deletions(-) diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue index 3067e67..232dfa6 100644 --- a/ruoyi-ui/src/views/login.vue +++ b/ruoyi-ui/src/views/login.vue @@ -1,25 +1,45 @@ <template> + <div> + + <div class="login Group_132"> - <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" style="margin-left: 0px;margin-right: 180px;"> - <h3 class="title" style="margin-top: 80px;margin-right: 108px;margin-bottom: 0;margin-left: 109px;">娆㈣繋鏉ュ埌鏈兘閮�</h3> - <div class="second-box" style=" margin-top: 25px; - margin-left: 140px; - margin-right: 141px; -"> - <div class="little-title" style=" margin-top: 20px;"> - <h5 >鐧诲綍鍙煡鐪嬫洿澶氫俊鎭�</h5> - <h5 >鏈敞鍐岀殑璐﹀彿鐧诲綍鎴愬姛鍚庝細鑷姩娉ㄥ唽</h5></div></div> - <div class="yonghuming" style="margin-left: 99px;margin-right: 425px;">鐢ㄦ埛鍚�</div> + <div class="navbar topHeight"> + <!-- <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> - <el-form-item prop="username" style=" - width: 380px; - height: 48px; - margin-left: 96px; - margin-right: 96px; -"> + <breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/> + <top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/> + --> + <div class="right-menu"> + + + <div class="avatar-wrapper"> + <el-button @click="login"> + <img :src="avatar" class="user-avatar"> + <i class="el-icon-caret-bottom" /> + <span>鐧诲綍</span> + </el-button> + <el-button @click="openReg"> + + <span>娉ㄥ唽</span> + </el-button> + </div> + + </div> + </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> + <div class="second-box" > + <div class="little-title" style=""> + <h5>鐧诲綍鍙煡鐪嬫洿澶氫俊鎭�</h5> + </div></div> + <div class="yonghuming" style="">鐢ㄦ埛鍚�</div> + + <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="璇疯緭鍏ョ敤鎴峰悕" @@ -29,12 +49,9 @@ </el-input> </el-form-item> - <div class="mima" style=" - margin-left: 99px; - margin-right: 441px;">瀵嗙爜</div> + <div class="mima" style="">瀵嗙爜</div> <el-form-item prop="password" style=" - margin-left: 96px; - margin-right: 96px; + width: 380px; height: 48px;"> <el-input @@ -68,14 +85,14 @@ </el-form-item> - <div class="楠岃瘉鐮�" style="margin-left: 99px;margin-right: 425px;width: 48px;height: 20px;">楠岃瘉鐮�</div> - <el-form-item prop="code" v-if="captchaEnabled" style="margin-bottom: 76px;width: 520px;" > + <div class="楠岃瘉鐮�" style="width: 48px;height: 20px;">楠岃瘉鐮�</div> + <el-form-item prop="code" v-if="captchaEnabled" style="width: 380px;" > <el-input v-model="loginForm.code" auto-complete="off" placeholder="璇疯緭鍏ラ獙璇佺爜" style="width: 258px ; - margin-left: 96px " + " @@ -90,7 +107,7 @@ </div> <div class="code" @click="getCode" style="width: 24px; - margin-left: 452px; + height: 16px; font-size: 12px; font-family: Microsoft YaHei-Regular, Microsoft YaHei; @@ -104,12 +121,12 @@ <!-- <el-checkbox v-model="loginForms.rememberMe" style="margin:0px 0px 25px 0px;">璁颁綇瀵嗙爜</el-checkbox> --> - <el-form-item s style="width: 572px;height: 72px;margin-bottom: 75px;background: rgba(239,113,155,0.8);"> + <el-form-item style="width: 300px;height: 72px;background: rgba(239,113,155,0.8);border:1px solid red"> <el-button :loading="loading" - style="width: 572px;height: 72px; background: rgba(239,113,155,0.8);" + style="width: 300px;height: 72px; background: rgba(239,113,155,0.8);" size="medium" type="primary" @click.native.prevent="handleLogin" @@ -117,41 +134,127 @@ <span v-if="!loading" style="width: 97px;height: 62px;">鐧诲綍</span> <span v-else>鐧� 褰� 涓�...</span> </el-button> - <div style="float: right; - height:94px;" v-if="register"> - <router-link class="link-type" :to="'/register'">绔嬪嵆娉ㄥ唽</router-link> - </div> + </el-form-item> + <el-form-item> + <a href="https://www.bendudu.com:8080/profile/upload/2023/10/10/Bendudu20231010_20231010203358A033.apk">鐐瑰嚮姝ゅ涓嬭浇搴旂敤绋嬪簭</a> + + </el-form-item> </el-form> + </el-dialog> + + + + + <el-dialog :visible.sync="openRegister" customClass="customWidth" width="450px"> + <div class="register"> + <el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form"> + <h3 class="title">鏂扮敤鎴锋敞鍐�</h3> + <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> + <el-form-item prop="password"> + <el-input + v-model="registerForm.password" + type="password" + auto-complete="off" + placeholder="瀵嗙爜" + @keyup.enter.native="handleRegister" + > + <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" /> + </el-input> + </el-form-item> + <el-form-item prop="confirmPassword"> + <el-input + v-model="registerForm.confirmPassword" + type="password" + auto-complete="off" + placeholder="纭瀵嗙爜" + @keyup.enter.native="handleRegister" + > + <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" /> + </el-input> + </el-form-item> + <el-form-item prop="code" v-if="captchaEnabled"> + <el-input + v-model="registerForm.code" + auto-complete="off" + placeholder="楠岃瘉鐮�" + style="width: 63%" + @keyup.enter.native="handleRegister" + > + <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" /> + </el-input> + <div class="register-code"> + <img :src="codeUrl" @click="getCode" class="register-code-img"/> + </div> + </el-form-item> + <el-form-item style="width:100%;"> + <el-button + :loading="loadingr" + size="medium" + type="primary" + style="width:100%;" + @click.native.prevent="handleRegister" + > + <span v-if="!loadingr">娉� 鍐�</span> + <span v-else>娉� 鍐� 涓�...</span> + </el-button> + + </el-form-item> + </el-form> + <!-- 搴曢儴 --> + + </div> + </el-dialog> <!-- 搴曢儴 --> <div class="el-login-footer" > - <span style="color: black; ">Copyright 漏 GDUT All Rights Reserved.<sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn></span> - <a href="https://beian.miit.gov.cn/" target="_blank" style="color: black; ">绮CP澶�2023050334鍙�<sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn>鍏畨澶囨鍙�44010402003045</a> + <span style="color: black; ">Copyright 漏 GDUT All Rights Reserved.<span v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></span></span> + <a href="https://beian.miit.gov.cn/" target="_blank" style="color: black; ">绮CP澶�2023050334鍙�<span v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></span>鍏畨澶囨鍙�44010402003045</a> </div> </div> + + <div class="gpr"> +<!-- <img :key="url" :src="url" style="width:100%;height:30%"></img> --> + </div> +</div> </template> <script> -import { getCodeImg } from "@/api/login"; +import { getCodeImg,Download,register } from "@/api/login"; import Cookies from "js-cookie"; import { encrypt, decrypt } from '@/utils/jsencrypt' export default { name: "Login", data() { + const equalToPassword = (rule, value, callback) => { + if (this.registerForm.password !== value) { + callback(new Error("涓ゆ杈撳叆鐨勫瘑鐮佷笉涓�鑷�")); + } else { + callback(); + + } + }; return { + url: require('../assets/images/index.png'), + openRegister: false, + avatar: undefined, + open: false, codeUrl: "", loginForm: { // username: "admin", // password: "admin123", - username: "", + nickName: "", password: "", rememberMe: false, code: "", uuid: "" }, loginRules: { - username: [ + nickName: [ { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�" } ], password: [ @@ -160,11 +263,39 @@ code: [{ required: true, trigger: "change", message: "璇疯緭鍏ラ獙璇佺爜" }] }, loading: false, + loadingr: false, // 楠岃瘉鐮佸紑鍏� captchaEnabled: true, // 娉ㄥ唽寮�鍏� - register: true, - redirect: undefined + // register: true, + redirect: undefined, + + + + + registerForm: { + nickname: "", + password: "", + confirmPassword: "", + code: "", + uuid: "" + }, + registerRules: { + nickname: [ + { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�" }, + // { min: 2, max: 20, message: '鐢ㄦ埛璐﹀彿闀垮害蹇呴』浠嬩簬 2 鍜� 20 涔嬮棿', trigger: 'blur' } + ], + password: [ + { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勫瘑鐮�" }, + { min: 5, max: 20, message: '鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜� 20 涔嬮棿', trigger: 'blur' } + ], + confirmPassword: [ + { required: true, trigger: "blur", message: "璇峰啀娆¤緭鍏ユ偍鐨勫瘑鐮�" }, + { required: true, validator: equalToPassword, trigger: "blur" } + ], + code: [{ required: true, trigger: "change", message: "璇疯緭鍏ラ獙璇佺爜" }] + }, + }; }, watch: { @@ -180,21 +311,56 @@ this.getCookie(); }, methods: { + handleRegister() { + //alert(this.registerForm.nickname) + this.$refs.registerForm.validate(valid => { + if (valid) { + this.loadingr = false; + //alert(this.registerForm.nickname) + register(this.registerForm).then(res => { + const nickName = this.registerForm.nickname; + this.$alert("<font color='red'>鎭枩浣狅紝鎮ㄧ殑璐﹀彿 " + nickName + " 娉ㄥ唽鎴愬姛锛�</font>", '绯荤粺鎻愮ず', { + dangerouslyUseHTMLString: true, + type: 'success' + }).then(() => { + this.openRegister = false; + this.resetForm("registerForm"); + // this.$router.push("/login"); + + }).catch(() => {}); + }).catch(() => { + this.loadingr = true; + if (this.captchaEnabled) { + this.getCode(); + } + }) + } + }); + }, + openReg(){ + this.openRegister = true; + }, + login(){ + this.open = true; + }, 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) }; @@ -204,14 +370,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(() => { @@ -228,10 +395,33 @@ </script> <style rel="stylesheet/scss" lang="scss"> +.gpr{ + width:100%; + // 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; @@ -243,17 +433,17 @@ display: flex; justify-content: flex-end; align-items: center; - height: 100%; + // height: 60px; width: 100%; - background: no-repeat center/40% url("../assets/images/Group 221.png"); + background: no-repeat center/100% url("../assets/images/index.png"); background-color: #FEF7FC; - background-position: 183px 145px; + //background-image: url("../assets/images/login-background.jpg"); //background-size: cover; } .title { - margin: 109px 0 108px 0 ; + width:355px; height: 58px; font-size: 44px; @@ -326,8 +516,8 @@ border-radius: 6px; background: #FEF7FC; width: 572px; - padding: 25px 25px 5px 25px; - margin: 211px 142px 237px 1206px; + height:660px; + .el-input { height: 48px; input { @@ -349,7 +539,7 @@ width: 108px; height: 48px; float: right; - margin-right: 46px; + img { @@ -377,6 +567,71 @@ } .code { - margin-left: 452px; + +} + +.register { + display: flex; + justify-content: center; + align-items: center; + height: 100%; + //background-image: url("../assets/images/login-background.jpg"); + + width:400px; + background-color: #FEF7FC; + + //background-size: cover; +} +.title { + margin: 0px auto 30px auto; + text-align: center; + color: #707070; +} + +.register-form { + border-radius: 6px; + background: #ffffff; + width: 400px; + padding: 25px 25px 5px 25px; + .el-input { + height: 38px; + input { + height: 38px; + } + } + .input-icon { + height: 39px; + width: 14px; + margin-left: 2px; + } +} +.register-tip { + font-size: 13px; + text-align: center; + color: #bfbfbf; +} +.register-code { + width: 33%; + height: 38px; + float: right; + img { + cursor: pointer; + vertical-align: middle; + } +} +.el-register-footer { + height: 40px; + line-height: 40px; + position: fixed; + bottom: 0; + width: 100%; + text-align: center; + color: #fff; + font-family: Arial; + font-size: 12px; + letter-spacing: 1px; +} +.register-code-img { + height: 38px; } </style> -- Gitblit v1.9.1