upitem() {
console.log("1 :", 1);
let user = this.username;
let pwd = this.password;
if (user == "" || pwd == "") {
this.$toast("账号或密码不能为空!!");
} else {
let pattuser = /^[a-z]\w{2,14}$/;
let pattpwd = /^\w{2,15}$/;
if (!pattuser.test(user)) {
this.$toast("用户名必须满足字符开头,\n 且长度在2-15为之间!!");
} else {
if (!pattpwd.test(pwd)) {
this.$toast("密码必须为2-15位非特殊字符!");
} else {
var params = new urlsearchparams();
params.append("username", user);
params.append("password", pwd);
this.axios
.post("http://www.doubleb.fun/api/checklogin.php", params)
.then(res => {
if (res.data.status == "200") {
// console.log('res :', res);
this.uid = res.data.uid;
document.cookie =
"userstate=" + res.data.usertoken + "&uid=" + this.uid;
this.$toast("登录成功");
this.show = false;
// settimeout(() => {
// this.addcar();
// }, 50);
} else {
this.$toast("登录失败!! \n 请检查用户名或者密码后重新输入。");
}
console.log(res);
})
.catch(err => {
console.error(err);
});
}
}
}
}
如对本文有疑问, 点击进行留言回复!!
offset、client、scroll (width,height、left,top、X,Y)
网友评论