代码拉取完成,页面将自动刷新
$(function () {
toastr.options = {
"closeButton": false,
"debug": false,
"positionClass": "toast-top-center",
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "3000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
}
})
var obj = new Vue({
el: '.container',
data: {
adminID: '',
adminPwd: '',
stuID: '',
stuPwd: '',
teaID: '',
teaPwd: ''
},
methods: {
stulogin: function () {
var data = {
id: this.stuID,
pwd: this.stuPwd
}
if (this.stuID === "" || this.stuPwd === "") {
toastr.warning("请完整填写登录信息!");
return false;
}
$.ajax({
url: 'http://39.108.76.139:8080/studentLogin',
type: 'post',
contentType: 'application/json',
data: JSON.stringify(data),
success: function (data, status, request) {
if (data.code === 0) {
toastr.success(data.msg);
localStorage.setItem("stutoken", request.getResponseHeader("token"));
localStorage.setItem("stuname", data.data.stuName);
setTimeout(function () {
location.href = "stu_index.html";
}, 1000);
} else {
toastr.error(data.msg);
}
},
error: function () {
toastr.error("操作失败,请重试!")
}
})
},
tealogin: function () {
var data = {
id: this.teaID,
pwd: this.teaPwd
}
if (this.teaID === "" || this.teaPwd === "") {
toastr.warning("请完整填写登录信息!");
return false;
}
$.ajax({
url: 'http://39.108.76.139:8080/teacherLogin',
type: 'post',
contentType: 'application/json',
data: JSON.stringify(data),
success: function (data, status, request) {
if (data.code === 0) {
toastr.success(data.msg);
localStorage.setItem("teatoken", request.getResponseHeader("token"));
localStorage.setItem("teaname", data.data.teaName);
setTimeout(function () {
location.href = "tea_index.html";
}, 1000);
} else {
toastr.error(data.msg);
}
},
error: function () {
toastr.error("操作失败,请重试!")
}
})
},
adlogin: function () {
var data = {
id: this.adminID,
pwd: this.adminPwd
}
if (this.adminID === "" || this.adminPwd === "") {
toastr.warning("请完整填写登录信息!");
return false;
}
$.ajax({
url: 'http://39.108.76.139:8080/adminLogin',
type: 'post',
contentType: 'application/json',
data: JSON.stringify(data),
success: function (data, status, request) {
if (data.code === 0) {
toastr.success(data.msg);
localStorage.setItem("adtoken", request.getResponseHeader("token"));
localStorage.setItem("adname", data.data.adName);
setTimeout(function () {
location.href = "ad_index.html";
}, 1000);
} else {
toastr.error(data.msg);
}
},
error: function () {
toastr.error("操作失败,请重试!")
}
})
}
}
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。