'使用ES6语法,改善重构前端实现'
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
/*import red from '../res/js/red'*/
|
||||
|
||||
/*const getPlats = (callback) => {
|
||||
red.getJSON("/meta/plat_list", {}, json => callback(json));
|
||||
}
|
||||
|
||||
const getTableList = (callback) => {
|
||||
red.getJSON("/meta/tablelist",{}, function (json) {
|
||||
callback(json);
|
||||
});
|
||||
}
|
||||
|
||||
const getTableDetail = ({name}, callback) => {
|
||||
red.getJSON("/meta/tableinfo",{name}, function (json) {
|
||||
callback(json);
|
||||
});
|
||||
}
|
||||
|
||||
const getServiceList = (callback) => {
|
||||
red.getJSON("/meta/service_list",{}, function (json) {
|
||||
json = red.replacePoint(json);
|
||||
callback(json);
|
||||
});
|
||||
}
|
||||
|
||||
const getServiceInfo = ({name}, callback) => {
|
||||
red.getJSON("/meta/service_info",{name}, res => {
|
||||
let row = red.replacePoint(res);
|
||||
row.shows = row.shows || [];
|
||||
row.exports = row.exports || [];
|
||||
row.imports = row.imports || [];
|
||||
row.filters = row.filters || [];
|
||||
|
||||
callback(row);
|
||||
});
|
||||
}
|
||||
|
||||
function getServiceDetail({name}, callback) {
|
||||
red.getJSON("/meta/service_detail",{name}, function (json) {
|
||||
json = red.replacePoint(json)
|
||||
callback(json);
|
||||
});
|
||||
}*/
|
||||
const meta = {
|
||||
getPlats: (callback) => {
|
||||
red.getJSON("/meta/plat_list", {}, json => callback(json));
|
||||
},
|
||||
getTableList: (callback) => {
|
||||
red.getJSON("/meta/tablelist",{}, function (json) {
|
||||
callback(json);
|
||||
});
|
||||
},
|
||||
getTableDetail: ({name}, callback) => {
|
||||
red.getJSON("/meta/tableinfo",{name}, function (json) {
|
||||
callback(json);
|
||||
});
|
||||
},
|
||||
|
||||
getServiceList: (callback) => {
|
||||
red.getJSON("/meta/service_list",{}, function (json) {
|
||||
json = red.replacePoint(json);
|
||||
callback(json);
|
||||
});
|
||||
},
|
||||
getServiceInfo: ({name}, callback) => {
|
||||
red.getJSON("/meta/service_info",{name}, res => {
|
||||
let row = red.replacePoint(res);
|
||||
row.shows = row.shows || [];
|
||||
row.exports = row.exports || [];
|
||||
row.imports = row.imports || [];
|
||||
row.filters = row.filters || [];
|
||||
|
||||
callback(row);
|
||||
});
|
||||
},
|
||||
getServiceDetail: ({name}, callback) => {
|
||||
red.getJSON("/meta/service_detail",{name}, function (json) {
|
||||
json = red.replacePoint(json)
|
||||
callback(json);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
export {
|
||||
getTableList,
|
||||
getPlats,
|
||||
getServiceDetail,
|
||||
getServiceInfo,
|
||||
getServiceList,
|
||||
getTableDetail
|
||||
}*/
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user