"use strict";const e=require("../../common/vendor.js"),c=require("../../api/login.js"),s=require("../../common/assets.js"),d=()=>String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i))==="micromessenger",g={data(){return{code:null}},onLoad(o){this.getWechatCode()},onUnload(){},mounted(){},methods:{loginByMp(){if(this.code==null)return;e.index.showLoading({title:"处理中..."});let o=this;var t={code:this.code};c.loginByWeChat(t).then(n=>{e.index.hideLoading(),n.code==200?(e.index.setStorageSync("AppToken",n.token),e.index.setStorageSync("userInfo",JSON.stringify(n.user)),e.index.$emit("refreshIM"),o.goToLanch()):e.index.showToast({title:n.msg,icon:"none"})},n=>{})},getWechatCode(){if(d){let o="wx9ea36eecd281bcd3",t=this.getUrlCode().code,n=window.location.href;t==null||t===""?window.location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+o+"&redirect_uri="+encodeURIComponent(n)+"&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect":this.code=t}},getUrlCode(){var o=location.search,t=new Object;if(o.indexOf("?")!=-1)for(var n=o.substr(1),r=n.split("&"),i=0;ia.loginByMp())}}const h=e._export_sfc(g,[["render",l]]);wx.createPage(h); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/auth/h5WxLogin.js.map