123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Layui</title>
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
- <link rel="stylesheet" href="layui/css/layui.css" media="all">
- <link rel="stylesheet" href="css/index.css" media="all">
- </head>
- <body>
- <div class="layui-fluid container">
- <div class="layui-row top">
- <div class="layui-col-lg12">
- </div>
- </div>
- <div class="layui-row layui-col-space10 content">
- <div class="layui-col-lg3 item">
- <div class="task">
- </div>
- </div>
- <div class="layui-col-lg6 item">
- <div class="task" id="XScannerContainer">
- </div>
- </div>
- <div class="layui-col-lg3 item">
- <div class="task">
- <button type="button" class="layui-btn layui-btn-normal" onclick="OpenDwSource()">开始扫描</button>
- </div>
- </div>
- </div>
- <div class="layui-row">
- <div class="layui-col-lg12 bottom"></div>
- </div>
- </div>
- <script src="js/xscan.js" charset="utf-8"></script>
- <!-- 注意:如果你直接复制所有代码到本地,上述 JS 路径需要改成你本地的 -->
- <script>
- layui.use(['form'], function () {
- var form = layui.form
- layer = layui.layer
- //自定义验证规则
- form.verify({
- username: function (value) {
- console.log(value)
- if (value.length < 1) {
- return '请输入用户名!';
- }
- }
- , password: [
- /^[\S]{6,12}$/
- , '密码必须6到12位,且不能出现空格!'
- ]
- });
- //监听提交
- form.on('submit(login)', function (data) {
- var data = form.val("login")
- LayuiPostJson({
- url: LOGINAPI,
- data: data
- }).then(res => {
- localStorage.setItem("token",res.access_token)
- }).catch(err => {
- layer.msg("账号或密码错误!")
- })
- return false;
- });
- });
- </script>
- </body>
- </html>
|