| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- ;
- layui.define(['form','util'], function (e) {
- var s = layui.$,
- util = layui.util,
- form = layui.form;
- form.on('submit(layui-btn-login)', function(data){
- s.post('check.html',data.field,function(r){
- layer.msg(r.msg,{time:1000,end:function(){
- if (!r.code) {
- var rdata = r.data;
- location.href = rdata.jump_url;
- }
- }});
- })
- return false;
- })
- form.on('submit(layui-btn-register)',function(data){
- var index = layer.load(1, {
- shade: [0.5,'#999'] //0.1透明度的白色背景
- });
- s.post('register.html',data.field,function(r){
- layer.close(index);
- layer.msg(r.msg,{time:1000,end:function(){
- if(!r.code){
- var rdata = r.data;
- location.href = rdata.jump_url;
- }
- }})
- })
- return false;
- })
- form.on('submit(layui-btn-forget)',function(data){
- s.post('forget.html',data.field,function(r){
- layer.msg(r.msg,{time:1000,end:function(){
- if(!r.code){
- location.href = 'login.html';
- }
- }})
- })
- return false;
- })
- s('.layui-btn-sendsms').on('click',function(){
- if (typeof(s(this).attr("disabled")) !="undefined") {
- return false;
- }
- var mobile = s('input[name=mobile]').val();
- if (s.trim(mobile) == '') {
- layer.msg('手机号码不能为空');
- return false;
- }
- var that = this;
- s.post('sendsms.html',{mobile:mobile},function(r){
- layer.msg(r.msg,{time:1000,end:function(){
- if (!r.code) {
- var serverTime = new Date().getTime();
- var endTime = serverTime + 59999;
- util.countdown(endTime, serverTime, function(date, serverTime, timer){
- if (date[3] == 0) {
- s(that).text('获取验证码');
- s('.layui-btn-sendsms').removeAttr('disabled');
- }else{
- s(that).text(date[3] + ' 秒后可重发');
- s('.layui-btn-sendsms').attr('disabled','disabled');
- }
- });
- }
- }})
- })
- })
- s('input[name="name"]').on('input',function(){
- s('.name-close').show();
- })
-
- var login = function(){
- s('.layui-fluid').css('height',document.body.clientHeight+'px');
- }
- login.prototype.eyeopen = function(obj) {
- s(obj).attr('onclick','layui.login.eyeclose(this)');
- s(obj).attr('src','/index/images/eye.png')
- s('input[name="password"]').attr('type','text')
- };
- login.prototype.eyeclose = function(obj) {
- s(obj).attr('onclick','layui.login.eyeopen(this)');
- s(obj).attr('src','/index/images/eye_close.png')
- s('input[name="password"]').attr('type','password')
- };
- login.prototype.clear = function(obj){
- s('input[name="name"]').val('')
- s(obj).hide();
- }
- e('login', new login())
- });
|