'使用ES6语法,改善重构前端实现'

This commit is contained in:
2019-04-03 11:10:00 +08:00
parent d1156cc940
commit 853ed30ffb
6 changed files with 165 additions and 74 deletions

View File

@@ -1,9 +1,18 @@
//import red from '../res/js/red'
const login = ({username, pwd}) => {
return {username};
const login = ({username, pwd}, callback) => {
$.post("/user/login", {username, pwd}, function (json) {
callback(json);
});
}
const logout = () => {
red.getJSON("/user/logout",{}, function () {
red.showMsg({msg:"退出成功"});
setTimeout(() => {
location.href = "/user/login.html";
}, 2000)
})
}
}
export {login, logout}