'使用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

@@ -100,10 +100,13 @@
<script src="../res/zui/lib/jquery/jquery.js"></script>
<script src="../res/zui/js/zui.js"></script>
<script src="../res/js/red.js"></script>
<!--<script src="../api/user.js"></script>//-->
<!--<script src="../api/user.js"></script>-->
<!--<script src="../api/meta.js"></script>-->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script>
//import { login } from '../api/user.js'
<script type="module">
import { login,logout } from '../api/user.js'
import { getPlats } from '../api/meta.js'
var vm = new Vue({
el: ".login",
data: {
@@ -117,23 +120,26 @@
},
methods: {
loginCheck: function ({username, pwd}) {
/*login({username, pwd}).then(res => {
console.log("res", res)
});*/
$.post("/user/login", {username, pwd}, function (json) {
login({username, pwd}, function (json) {
if (json.code == 0) {
vm.loadPlats();
red.showMsg({msg:"请选择业务平台"})
setTimeout(function () {
vm.choose = true;
//location.href = "/";
}, 500);
getPlats(function (json) {
red.showMsg({msg:"请选择业务平台"})
vm.sysPlats = json;
if (!vm.sysPlat) {
vm.sysPlat = json[0];
}
red.setData("sysPlats", json);
setTimeout(function () {
vm.choose = true;
}, 500);
})
} else {
red.showMsg({msg: json.message})
}
});
},
loadPlats: function () {
/*loadPlats: function () {
var para = {
doc:"sys_plat",
shows: JSON.stringify(["_id", "_key", "name", "token","remark", "status"])
@@ -145,7 +151,7 @@
}
red.setData("sysPlats", json);
});
},
},*/
goIndex: function () {
if (!this.sysPlat) {
red.showMsg({msg:"请选择选择业务平台", type:"error"});