From 4292b2f657082259c7440c019e02970c0c69f793 Mon Sep 17 00:00:00 2001 From: jyt <1592211625@qq.com> Date: Fri, 27 May 2022 18:00:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E4=BD=8F=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/page/login/userlogin.vue | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/page/login/userlogin.vue b/src/page/login/userlogin.vue index df27afe..8285f25 100644 --- a/src/page/login/userlogin.vue +++ b/src/page/login/userlogin.vue @@ -46,6 +46,7 @@ ref="verify" /> + 记住密码 0) { + let arr = document.cookie.split("; "); + for (let i = 0; i < arr.length; i++) { + let arr2 = arr[i].split("="); + console.log(arr2) + if (arr2[0] === "username") { + this.loginForm.username = arr2[1]; + } else if (arr2[0] === "password") { + this.loginForm.password = arr2[1]; + this.rememberPwd = true; + } + } + } + }, showPassword() { this.passwordType == "" ? (this.passwordType = "password") @@ -132,6 +162,12 @@ export default { } else if (res.data.length == 1) { let idx = res.data[0].orgType; localStorage.setItem("orgType", idx); + console.log("登陆成功啦!!!") + if (this.rememberPwd) { + this.setCookie(this.loginForm.username, this.loginForm.password, 7); + } else { + this.setCookie("", "", -1); + } // 给定一个判断是否可以跳转的东西 localStorage.setItem("backFlag", false); // 当他只有质控后台时,不需要多余操作