Files
ClassContent/历届学生/17届课程/blog/dist/public/js/admin/user.js
2024-09-27 02:06:13 +08:00

34 lines
846 B
JavaScript

$(".submitLogin").click(function() {
var userName = $("input[type='text']").val()
var userPassword = $("input[type='password']").val()
if(userName.length == 0 || userPassword.length ==0) {
alert("账户密码为空")
} else {
$.ajax({
url: 'http://127.0.0.1:3000/admin/api/login',
type: 'POST',
headers: {
token: '645e8c56a66e32792f224730fd238711'
},
data: {
name: userName,
pwd: userPassword
},
success: function(res) {
if (res.status == 200) {
location.href = "/admin/home"
} else {
alert(res.message)
}
},
error: function(err) {
}
})
}
});