From e1aa0ecffbabd618c71e4ad94370fb8dffe6ee1c Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期日, 21 一月 2024 20:54:49 +0800 Subject: [PATCH] 优化 --- src/views/systemSetting/baseSetting/user/components/password/index.vue | 45 +++++++++++++++++++++------------------------ 1 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/views/systemSetting/baseSetting/user/components/password/index.vue b/src/views/systemSetting/baseSetting/user/components/password/index.vue index 2a7eb82..1be0752 100644 --- a/src/views/systemSetting/baseSetting/user/components/password/index.vue +++ b/src/views/systemSetting/baseSetting/user/components/password/index.vue @@ -3,15 +3,15 @@ <el-form ref="pwd" label-width="140px" autoComplete="on" :model="user" :rules="passrules"> <!-- 鍒濆瀵嗙爜 --> <el-form-item class="optionItem" label="鍒濆瀵嗙爜:" prop="password"> - <el-input v-model="user.password" type="password" placeholder="璇峰~鍐欏垵濮嬪瘑鐮�"></el-input> + <el-input v-model="user.password" type="password" placeholder="璇峰~鍐欏垵濮嬪瘑鐮�" show-password></el-input> </el-form-item> <!-- 鏂板瘑鐮� --> <el-form-item class="optionItem" label="鏂板瘑鐮�:" prop="newPwd"> - <el-input v-model="user.newPwd" type="password" placeholder="璇峰~鍐欐柊瀵嗙爜"></el-input> + <el-input v-model="user.newPwd" type="password" placeholder="璇峰~鍐欐柊瀵嗙爜" show-password></el-input> </el-form-item> <!-- 鏂板瘑鐮� --> <el-form-item class="optionItem" label="纭鏂板瘑鐮�:" prop="secondPwd"> - <el-input v-model="user.secondPwd" type="password" placeholder="纭鎮ㄧ殑鏂板瘑鐮�"></el-input> + <el-input v-model="user.secondPwd" type="password" placeholder="纭鎮ㄧ殑鏂板瘑鐮�" show-password></el-input> </el-form-item> </el-form> @@ -32,24 +32,21 @@ } } const checkNewPwd = (rule, value, callback) => { - if (!value) { - callback(new Error('鏂板瘑鐮佷笉鑳戒负绌�')) - } else if (value === this.user.password) { - callback(new Error('鏂板瘑鐮佷笉鑳藉拰鏃у瘑鐮佷竴鏍�')) - } else { - callback(); - } - } + var rep =/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,16}$/; + if (!rep.test(value) ) { + callback(new Error("瀵嗙爜闀垮害8鍒�16浣嶄笖瀵嗙爜涓殑瀛楃蹇呴』鍖呭惈瀛楁瘝澶у啓鍜屽瓧姣嶅皬鍐欏拰蹇呴』鍖呭惈鏁板瓧锛屼笉鑳藉寘鍚┖鏍�")); + } else { + callback(); + } + }; + const checkSame = (rule, value, callback) => { - if (!value) { - callback(new Error('纭瀵嗙爜涓嶈兘涓虹┖')) - } else if (value !== this.user.newPwd) { - console.log(111); - callback(new Error('鎮ㄨ緭鍏ョ殑涓ゆ瀵嗙爜缁撴灉涓嶅悓')); - } else { - - callback(); - } + var rep =/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,16}$/; + if (!rep.test(value) ) { + callback(new Error("瀵嗙爜闀垮害8鍒�16浣嶄笖瀵嗙爜涓殑瀛楃蹇呴』鍖呭惈瀛楁瘝澶у啓鍜屽瓧姣嶅皬鍐欏拰蹇呴』鍖呭惈鏁板瓧锛屼笉鑳藉寘鍚┖鏍�")); + } else { + callback(); + } } return { user: { @@ -132,10 +129,10 @@ .password { padding: 50px 100px; - ::v-deep .el-input__inner { - background-color: #09152f; - border: 1px solid #17324c; - } + // ::v-deep .el-input__inner { + // background-color: #09152f; + // border: 1px solid #17324c; + // } .pwd-footer { display: flex; -- Gitblit v1.8.0