限时免费试用:欢迎注册 api.bigmodel.org ,快速体验大模型 API 接入服务。
当前位置:首页 >开发者 >网站框架 >小程序

小程序扫码登陆网站设计思路

分类:小程序时间:2018-11-12浏览:3539

function Wreset(){
	var w = $(window).width();
	var yzmw = $(".login .line").width() - 140;
	if($(".yzm").is(":visible") && w > 640){
		$(".login").css({"height":"365px","margin-top":"-230px"});
	}
	else{
		$(".login").removeAttr("style")
	}
	$(".login .yzm .inputtxt").width(yzmw);
}
$(function(){
	Wreset();
	var setTime = '';
	$.get('/public?name=app&fun=login_qrcode', function(res){
		if (res.status){
			$('#qrcode').qrcode({
                                    render: "canvas", //也可以替换为table
                                    width: 150,
                                    height: 150,
                                    text: res.msg
                                });
			$('.entrance').show();
		}
	}).error(function(res,textStatus,errorThrown) {
		if (res.status == 404){
			$('.entrance').hide();
		}
	});
	function controlTime(){
		$.get('/public?name=app&fun=is_scan_ok',function(res) {
			if(res.status){
				layer.msg('扫码成功,请稍后...',{icon:1});
				clearInterval(setTime);
				loginAdmin(res.msg);
			}
		});
	}
	function loginAdmin(key){
		$.get('/public?name=app&fun=set_login',{secret_key:key},function(res) {
			layer.msg(res.msg,{icon:res.status?1:2})
			if (res.status){
				layer.msg('正在安全登录中,请稍后...',{time:0,shade: [0.4,'#fff'],icon:16});
				setTimeout(function(){
					location.href = '/';
				},1000);
			}
		});
	}
})
window.onresize=function(){
	Wreset();
}




本站文章如未注明出处均为原创,转载请注明出处,如有侵权请邮件联系站长。
0/500
Share your thoughts respectfully.