Files
meta-kit/root/user/login.html
2019-03-07 10:24:29 +08:00

127 lines
5.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登录 - MetaKit</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/zui/1.8.1/css/zui.min.css">
<link rel="stylesheet" href="../res/css/zui-theme.css">
<link rel="stylesheet" href="../res/css/red-kit.css">
</head>
<body style="padding-top: 100px" class="">
<div class="container-fixed-sm login">
<div class="modal-dialog" v-show="!choose" style="width: 400px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
<h4 class="modal-title">登陆管理系统</h4>
</div>
<div class="modal-body">
<form class="form-horizontal">
<div class="form-group">
<label for="username" class="col-sm-2">用户名</label>
<div class="col-md-10">
<input v-model="row.username" class="form-control" id="username" placeholder="请输入 用户名">
</div>
</div>
<div class="form-group">
<label for="pwd" class="col-sm-2">密码</label>
<div class="col-md-10">
<input v-model="row.pwd" class="form-control" id="pwd" placeholder="请输入 密码">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button @click="loginCheck(row)" type="button" class="btn btn-primary">确定</button>
</div>
</div>
</div>
<div class="modal-dialog" v-show="choose" style="width: 400px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
<h4 class="modal-title">选择业务平台</h4>
</div>
<div class="modal-body">
<form class="form-horizontal">
<div class="form-group">
<label for="username" class="col-md-3">业务平台</label>
<div class="col-md-8">
<select v-model="sysPlat" class="form-control">
<option v-for="item in sysPlats" :value="item" v-text="item.name"></option>
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<!--<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>-->
<button @click="goIndex()" type="button" class="btn btn-primary btn-block">确定选择 <span v-text="[sysPlat.name]"></span></button>
</div>
</div>
</div>
</div>
<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="https://cdn.jsdelivr.net/npm/vue"></script>
<script>
var vm = new Vue({
el: ".login",
data: {
row:{},
sysPlat: red.getData("sysPlat"),
sysPlats: [],
choose: false
},
watch: {
},
methods: {
loginCheck: function (row) {
$.post("/user/login", row, function (json) {
if (json.code == 0) {
vm.loadPlats();
red.showMsg({msg:"请选择业务平台"})
setTimeout(function () {
vm.choose = true;
//location.href = "/";
}, 500);
} else {
red.showMsg({msg: json.message})
}
});
},
loadPlats: function () {
var para = {
doc:"sys_plat",
shows: JSON.stringify(["_id", "_key", "name", "token","remark", "status"])
};
red.getJSON("/meta/find", para, function (json) {
vm.sysPlats = json.rows;
if (!vm.sysPlat) {
vm.sysPlat = json.rows[0];
}
red.setData("sysPlats", json.rows);
});
},
goIndex: function () {
if (!this.sysPlat) {
red.showMsg({msg:"请选择选择业务平台", type:"error"});
return false;
}
red.setData("sysPlat", this.sysPlat);
location.href = "/";
}
},
mounted: function () {
}
});
</script>
</body>
</html>