6 Star 0 Fork 0

陈建宏 / 教务系统

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
login.js 4.38 KB
一键复制 编辑 原始数据 按行查看 历史
张佳豪 提交于 2020-09-28 21:27 . 张佳豪上传
$(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("操作失败,请重试!")
}
})
}
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/deemo101/education-management-system.git
git@gitee.com:deemo101/education-management-system.git
deemo101
education-management-system
教务系统
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891