1、使用Promise,重写red.getJSON /red.post, 解决"回调地狱"问题

2、修改 数据源管理/平台信息管理
This commit is contained in:
2019-04-04 17:47:29 +08:00
parent 3de47eea46
commit 696222fcf0
15 changed files with 283 additions and 38 deletions

View File

@@ -102,10 +102,11 @@
<script src="../res/js/red.js" defer></script>
<script src="../res/libs/axios.min.js" defer></script>
<script src="../api/meta.js"></script>
<script src="../api/plat.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script type="module">
import { login } from '../api/user.js'
let { getPlats } = meta;
let { platList } = plat;
var vm = new Vue({
el: ".login",
@@ -122,14 +123,15 @@
loginCheck: function ({username, pwd}) {
login({username, pwd}, function (json) {
if (json.code == 0) {
getPlats(function (json) {
platList().then(res => {
let rows = res.rows
red.showMsg({msg:"请选择业务平台"})
vm.sysPlats = json;
vm.sysPlats = rows;
if (!vm.sysPlat) {
vm.sysPlat = json[0];
vm.sysPlat = rows[0];
}
red.setData("sysPlats", json);
red.setData("sysPlats", rows);
setTimeout(function () {
vm.choose = true;
}, 500);