login.js 1.05 KB
function login(){
  layui.use('layer', function () {
    layer.open({
      type: 1,
      title: '登陆信息',
      shadeClose: false,
      area: ['500px', '320px'],
      scrollbar: false,
      skin: 'confimInfo',
      content: '<div class="loginINfo">'
        + '<ul>'
        + '<li><span><a class="require">*</a>用户名</span>:<input id="userName"></li>'
        + '<li><span><a class="require">*</a>密码</span>:<input id="IDcard"></li>'
        + '</ul>'
        + '<div class="btns">'
        +'<button type="button" id="loginButton">登陆</button>'
        +'<button type="button" id="registerButton">注册</button></div>'
        + '</div>'
    });
  })
}
// 时间委托解决冒泡
$(document).off().on('click', 'p', function(){
    //所执行的代码
  login()
});
// 点击登陆的时候
$(document).on('click', '#loginButton', function(){
  layer.closeAll()
});
// 点击注册的时候
$(document).on('click', '#registerButton', function(){
  // layer.closeAll()
  window.open(`${localhostPaht}/staticViews/register.html`,'_self')
});