function bindweixin(){var r=$("#oldpwd").val();if(r){}else{myAlert("需要输入密码！");return}var o;$("#myModalEditInfo").off("hide.bs.modal").on("hide.bs.modal",function(){$("#myModalEditInfo").off("hide.bs.modal");clearInterval(o);hideEditInfo()});$.post("wxQR",{case:"getwxqr"},function(e){var i=myJSONParse(e,"bindweixin");if(i.msg==="ok"){$(".myweixin").removeClass("nodisplay");$("#myweixinQR").attr("src","https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket="+encodeURI(i.info.ticket));var t=6e4;clearInterval(o);o=setInterval(function(){t-=1e3;if(t<=0){clearInterval(o);hideEditInfo();myAlert("绑定未成功，请稍后重试！")}$.post("wxQR",{case:"bindwx",id:cfm(i.id+"",n),code:cfm(r,m)},function(e){var i=myJSONParse(e,"bindwx");if(i.msg==="ok"){if(i.info==="bindwx"){clearInterval(o);hideEditInfo();myAlert("绑定成功！")}}else{clearInterval(o);hideEditInfo();myAlert(i.msg)}})},1e3)}else{myAlert(i.msg)}})}function hideEditInfo(){$(".myweixin").addClass("nodisplay");$("#myweixinQR").attr("src","");$("#myModalEditInfo").modal("hide")}function hideOtherLogin(){$("#myQR").attr("src","");$("#myOtherLogin").modal("hide")}function unbindweixin(){var e=$("#oldpwd").val();if(e){}else{myAlert("需要输入密码！");return}$.post("wxQR",{case:"unbindwx",code:cfm(e,m)},function(e){var i=myJSONParse(e,"unbindweixin");if(i.msg==="ok"){myAlert("取消微信绑定成功！")}else{myAlert(i.msg)}})}function wxlogin(t){var r=$("#unit").val();if(r){}else{myAlert("需要输入单元名称！");return}var o;$("#myOtherLogin").off("hide.bs.modal").on("hide.bs.modal",function(){$("#myOtherLogin").off("hide.bs.modal");clearInterval(o);hideOtherLogin()});$.post("wxQR",{case:"getwxqr",unit:r},function(e){var i=myJSONParse(e,"wxloginqr");if(i.msg==="ok"){$("#myOtherLogin").modal("show");$("#myQR").attr("src","https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket="+encodeURI(i.info.ticket));var n=6e4;clearInterval(o);o=setInterval(function(){n-=1e3;if(n<=0){clearInterval(o);hideOtherLogin()}$.post("wxQR",{case:"wxlogin",id:cfn(i.id+"","n"),unit:r},function(e){var i=myJSONParse(e,"wxlogin");if(i.msg==="ok"){if(i.info==="loginok"){clearInterval(o);if(t){window.location.href=t}}}else{clearInterval(o);hideOtherLogin();myAlert(i.msg)}})},1e3)}else{myAlert(i.msg)}})}function hideWXReg(){$("#myRegQR").attr("src","");$("#myWxReg").modal("hide")}function wxreguser(){var t=$("#unit").val();if(t){}else{myAlert("需要输入单元名称！");return}var r=prompt("请输入注册姓名或昵称：","");if(r){}else{myAlert("需要输入注册姓名！");return}var o=prompt("请设定登录密码：","");if(o){}else{myAlert("需要设定一个登录密码！");return}var a;$("#myWxReg").off("hide.bs.modal").on("hide.bs.modal",function(){$("#myWxReg").off("hide.bs.modal");clearInterval(a);hideWXReg()});$.post("wxQR",{case:"getwxqr",unit:t},function(e){var i=myJSONParse(e,"wxregqr");if(i.msg==="ok"){$("#nickname").val(r);$("#mypwd").val(o);$("#myWxReg").modal("show");$("#myRegQR").attr("src","https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket="+encodeURI(i.info.ticket));var n=6e4;clearInterval(a);a=setInterval(function(){n-=1e3;if(n<=0){clearInterval(a);hideWXReg()}$.post("wxQR",{case:"wxreguser",id:cfn(i.id+"","n"),unit:t,nickname:$("#nickname").val(),mypwd:cfn($("#mypwd").val()+"","m")},function(e){var i=myJSONParse(e,"wxreguser");if(i.msg==="ok"){if(i.info==="reguserok"){clearInterval(a);hideWXReg();myAlert("注册成功，请用微信扫码登陆！");wxlogin("login.html")}}else{clearInterval(a);hideWXReg();myAlert(i.msg)}})},1e3)}else{myAlert(i.msg)}})}