New file |
| | |
| | | <!doctype html> |
| | | <html class="x-admin-sm"> |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>后台登录-X-admin2.2</title> |
| | | <meta name="renderer" content="webkit|ie-comp|ie-stand"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" /> |
| | | <meta http-equiv="Cache-Control" content="no-siteapp" /> |
| | | <link rel="stylesheet" href="./css/font.css"> |
| | | <link rel="stylesheet" href="./css/login.css"> |
| | | <link rel="stylesheet" href="./css/xadmin.css"> |
| | | <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> |
| | | <script src="./lib/layui/layui.js" charset="utf-8"></script> |
| | | <link rel="stylesheet" type="text/css" href="css/doui.min.css" /> |
| | | <script src="js/doui.min.js" type="text/javascript" charset="utf-8"></script> |
| | | <script type="text/javascript"> |
| | | doui.importLoad({ |
| | | importArray: [ |
| | | "font/iconfont.css", |
| | | "js/vue.min.js", |
| | | "js/requestHost.js" |
| | | ] |
| | | }); |
| | | </script> |
| | | <style>
|
| | | .login{
|
| | | margin: 0px auto 0 auto;
|
| | | }
|
| | | </style>
|
| | | |
| | | </head> |
| | | <body> |
| | | |
| | | <div class="login layui-anim" id="allwai"> |
| | | <div class="message">板栗快省后台管理登录</div> |
| | | <div id="darkbannerwrap"></div> |
| | | |
| | | <form class="layui-form" lay-filter="login"> |
| | | <input name="username" placeholder="用户名" type="text" lay-verify="required" class="layui-input"> |
| | | <hr class="hr15"> |
| | | <input name="pwd" lay-verify="required" placeholder="密码" type="password" class="layui-input"> |
| | | <hr class="hr15"> |
| | | |
| | | <div class="layui-form-item" style="display: flex;justify-content: flex-start;"> |
| | | <input type="text" name="yzm" lay-verify="required" autocomplete="off" placeholder="请输入验证码" class="layui-input"> |
| | | <img class="border-round cursor-pointer click-scale" style="width:120px; height:50px;margin-left: 10px;" |
| | | v-bind:src="inputThis.yzm_imgSrc" v-on:click="inputThis.imgGet()" /> |
| | | </div> |
| | | <input value="登录" lay-filter="login" style="width:100%;" type="button" v-on:click="inputThis.subClick()"> |
| | | <hr class="hr20"> |
| | | </form> |
| | | </div> |
| | | |
| | | <script> |
| | | var form = null; |
| | | $(function() { |
| | | layui.use('form', function() { |
| | | form = layui.form; |
| | | }); |
| | | |
| | | }) |
| | | </script> |
| | | <!-- 底部结束 --> |
| | | |
| | | |
| | | <script>
|
| | | var indexIframe = null;
|
| | | var vm = null; |
| | | doui.onReady({ |
| | | success: function() { |
| | | vm = new Vue({ |
| | | el: "#allwai", |
| | | // 数据 |
| | | data: { |
| | | // -------------------------------------------- 输入组件区域 |
| | | inputThis: { |
| | | username: "", // 用户名 |
| | | pwd: "", // 密码 |
| | | yzm: "", // 验证码 |
| | | yzm_imgSrc: "", // 验证码图片地址 |
| | | // 获取验证码图片地址 |
| | | imgGet: function() { |
| | | // 获取最新时间戳 |
| | | var time = new Date().getTime(); |
| | | vm.inputThis.yzm_imgSrc = gethttp() + "/admin/new/api/validate/imgcode?temp=" + time; |
| | | }, |
| | | // 登录点击 |
| | | subClick: function() { |
| | | vm.inputThis.username = $(":input[name='username']").val(); |
| | | vm.inputThis.pwd = $(":input[name='pwd']").val(); |
| | | vm.inputThis.yzm = $(":input[name='yzm']").val(); |
| | | // 输入信息验证 |
| | | if (!vm.inputThis.username || !vm.inputThis.pwd || !vm.inputThis.yzm) { |
| | | layer.msg("输入不完整"); |
| | | return false; |
| | | } |
| | | // 发送请求 |
| | | var index = layer.load(0, { |
| | | shade: false |
| | | }); |
| | | doui.request({ |
| | | type: "jsonp", |
| | | url: gethttp() + "/admin/new/api/login/adminLoginJP", |
| | | data: { |
| | | username: vm.inputThis.username, // 用户名输入 |
| | | pwd: vm.inputThis.pwd, // 密码输入 |
| | | code: vm.inputThis.yzm, // 验证码输入 |
| | | }, |
| | | fail: function(res) { |
| | | layer.close(index); |
| | | layer.msg(res.msg);
|
| | | }, |
| | | success: function(res) { |
| | | layer.close(index); |
| | | if (res.code != 0) { |
| | | layer.msg(res.msg);
|
| | | vm.inputThis.imgGet(); |
| | | } else { |
| | | // 操作人员信息 |
| | | var user = { |
| | | id: res.data.info.id, |
| | | nickName: res.data.info.name, |
| | | userName: res.data.info.account, |
| | | password: "", |
| | | }; |
| | | // 密码加密 |
| | | doui.Aes({ |
| | | type: "en", |
| | | str: res.data.info.pwd, |
| | | success: function(aesThis) { |
| | | user.password = aesThis; |
| | | } |
| | | }); |
| | | |
| | | // 本地保存登录输入(永久保存,以后都不用输入了) |
| | | doui.localStorageSet({ |
| | | key: "inputInfo", |
| | | data: user, |
| | | }); |
| | | |
| | | // 保存cookie |
| | | doui.cookieSet({ |
| | | key: "adminInfo", |
| | | data: res.data.info, |
| | | hour: 8 |
| | | }); |
| | | |
| | | if (indexIframe != null) {
|
| | | parent.layer.close(indexIframe);
|
| | | } else {
|
| | | doui.pageToUrl({
|
| | | url: "home.html" // 跳到使用页
|
| | | });
|
| | | }
|
| | | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | }, |
| | | }, |
| | | }); |
| | | |
| | | |
| | | // 获取输入记录 |
| | | doui.localStorageGet({ |
| | | key: "inputInfo", |
| | | success: function(res) { |
| | | // 用户名获取 |
| | | vm.inputThis.username = res.userName; |
| | | // 密码解密获取 |
| | | doui.Aes({ |
| | | type: "de", |
| | | str: res.password, |
| | | success: function(pass) { |
| | | vm.inputThis.pwd = pass; |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | |
| | | // 验证码图片 |
| | | vm.inputThis.imgGet();
|
| | | // document.body.style.display = "block"; |
| | | |
| | | // 获取传递过来的id
|
| | | doui.urlParam({
|
| | | success: function (res) {
|
| | | if (res.type == 2){
|
| | | indexIframe = parent.layer.getFrameIndex(window.name); //获取窗口索引
|
| | | }
|
| | | }
|
| | | }); |
| | | |
| | | } |
| | | });
|
| | | </script> |
| | | |
| | | </body> |
| | | </html> |