(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/public/wxLogin"],{"0407":function(e,n,t){"use strict";t.r(n);var o=t("16e8"),c=t("bd4f");for(var a in c)"default"!==a&&function(e){t.d(n,e,(function(){return c[e]}))}(a);t("1187");var i,r=t("f0c5"),u=Object(r["a"])(c["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],i);n["default"]=u.exports},1187:function(e,n,t){"use strict";var o=t("2874"),c=t.n(o);c.a},"16e8":function(e,n,t){"use strict";var o;t.d(n,"b",(function(){return c})),t.d(n,"c",(function(){return a})),t.d(n,"a",(function(){return o}));var c=function(){var e=this,n=e.$createElement;e._self._c},a=[]},2874:function(e,n,t){},bd4f:function(e,n,t){"use strict";t.r(n);var o=t("c885"),c=t.n(o);for(var a in o)"default"!==a&&function(e){t.d(n,e,(function(){return o[e]}))}(a);n["default"]=c.a},c885:function(e,n,t){"use strict";(function(e){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var o=t("8639"),c=t("7eca"),a=t("26cb"),i=t("13d4");function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function u(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?r(Object(t),!0).forEach((function(n){s(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):r(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var d={data:function(){return{userInfo:{},code:"",loding:!1,MaskShow:!1,logo:""}},onLoad:function(e){this.loadData(),wx.getStorageSync("userinfo")&&wx.navigateBack({delta:2})},methods:u(u({},(0,a.mapMutations)("user",["setUserInfo","login"])),{},{loadData:function(){this.getlogo()},getlogo:function(){var n=this;e.hideLoading(),(0,o.get_logo)({}).then((function(e){var t=e.data;n.logo=t.logo_url,console.log(t,"000000")}))},userInfoData:function(n){var t=this;this.loding||e.showModal({title:"温馨提示",content:"亲，授权微信登录后才能正常使用小程序功能",success:function(n){if(n.confirm)wx.getUserProfile({desc:"用于完善会员资料",success:function(e){wx.setStorageSync("userinfo",e),t.userInfo=e,t.loadMp()},fail:function(n){e.showToast({title:"您拒绝了请求,不能正常使用小程序",icon:"error",duration:2e3})}});else if(n.cancel)return void e.showToast({title:"您拒绝了请求,不能正常使用小程序",icon:"error",duration:2e3})}})},loadMp:function(n){var t=this;t.loding=!0;var c=t.userInfo,a=e.getStorageSync("spread")||"",i=e.getStorageSync("puid")||"";e.showLoading({title:"授权中",mask:!0}),wx.login({success:function(n){(0,o.wechatMpAuth)({code:n.code,iv:c.iv,encryptedData:c.encryptedData,spread_spid:a,spread_code:i}).then((function(e){var n=e.data;t.loding=!1,t.wchatAuth(n),console.log(n,"000000000000")})).catch((function(n){t.loding=!1,e.hideLoading()}))},fill:function(e){t.loding=!1,console.log(e)}})},wchatAuth:function(n){var t=this,o=e.getStorageSync("puid");e.setStorageSync("token",n.token),(0,i.getUserInfo)({}).then((function(e){t.login(),t.setUserInfo(e.data),o&&(0,c.spread)({puid:o}),t.ToIndex()})).catch((function(n){e.hideLoading()}))},ToIndex:function(){var n=e.getStorageSync("present")||"/pages/index/index";"pages/product/product"==n&&(n="/pages/index/index"),e.switchTab({url:n,fail:function(t){e.navigateTo({url:n,fail:function(n){e.navigateTo({url:"/pages/index/index"})}})}})},PhoneNumber:function(n){var t=this;t.MaskShow=!1,t.iv=n.detail.iv,t.encryptedData=n.detail.encryptedData,e.setStorageSync("code",t.code),(0,i.bangding)({flag:1,cache_key:t.cache_key,code:t.code,iv:t.iv,encryptedData:t.encryptedData}).then((function(e){1==e.data.is_bind?(console.log("bangding1"),(0,i.bangding)({flag:1,cache_key:t.cache_key,code:t.code,iv:t.iv,encryptedData:t.encryptedData,step:1}).then((function(e){t.GetUser(),t.$api.msg(e.msg),t.$nextTick((function(){t.ToIndex()}))})).catch((function(e){console.log(e)}))):(console.log("bangding2"),t.$api.msg(e.msg),t.GetUser(),t.$api.msg(e.msg),t.$nextTick((function(){t.ToIndex()})))}))},GetUser:function(){var n=this;(0,i.getUserInfo)({}).then((function(t){var o=t.data;n.setUserInfo(o),console.log(o,11),console.log(e.getStorageSync("userInfo"),55)})).catch((function(e){console.log(e)}))}})};n.default=d}).call(this,t("543d")["default"])},ea5b:function(e,n,t){"use strict";(function(e){t("856e");o(t("66fd"));var n=o(t("0407"));function o(e){return e&&e.__esModule?e:{default:e}}wx.__webpack_require_UNI_MP_PLUGIN__=t,e(n.default)}).call(this,t("543d")["createPage"])}},[["ea5b","common/runtime","common/vendor"]]]);