wxLogin.js 3.6 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/public/wxLogin"],{"34f9":function(e,t,n){},"623b":function(e,t,n){"use strict";n.r(t);var o=n("e4bd"),r=n.n(o);for(var c in o)"default"!==c&&function(e){n.d(t,e,(function(){return o[e]}))}(c);t["default"]=r.a},6593:function(e,t,n){"use strict";var o=n("34f9"),r=n.n(o);r.a},e4bd:function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n("3287"),r=n("ecb8"),c=n("b71f"),i=n("26cb");function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var s={data:function(){return{userInfo:{},code:"",isclick:!1}},onLoad:function(e){this.loadData()},computed:{},methods:u(u({},(0,i.mapMutations)("user",["login","setUserInfo"])),{},{loadData:function(){var e=this;(0,r.loginWinxinMp)().then((function(){wx.login({success:function(t){console.log(t,"loginWinxinMp"),e.code=t.code},fill:function(e){console.log(e)}})}))},userInfoData:function(){var t=this;t.isclick||(t.isclick=!0,wx.getUserProfile({desc:"用于完善会员资料",success:function(n){console.log(n,"that.userInfo+++++++++++++++++++"),t.userInfo=n,e.showLoading({title:"授权中",mask:!0}),t.loadMp()},fail:function(n){t.isclick=!1,e.showToast({title:"您拒绝了请求,不能正常使用小程序",icon:"error",duration:2e3})}}))},loadMp:function(){var t=this,n=t.userInfo;console.log(n);var o=e.getStorageSync("spread")||"",r=e.getStorageSync("spread_code")||"";(0,c.wechatMpAuth)({code:t.code,iv:n.iv,encryptedData:n.encryptedData,spread_spid:o,spread_code:r}).then((function(e){var n=e.data;t.wchatAuth(n),console.log(n,"wechatMpAuth++++++++++++++++++++++++++")})).catch((function(e){}))},wchatAuth:function(t){var n=this;e.setStorageSync("token",t.token),console.log(t.token,"token++++++++++++++"),(0,o.getUserInfo)({}).then((function(t){console.log("userInfo+++++++++++",t),n.login(),e.hideLoading(),n.setUserInfo(t.data);var o=e.getStorageSync("present")||"/pages/index/index";"pages/shop/product"==o&&(o="/pages/index/index"),e.switchTab({url:o,fail:function(t){e.navigateTo({url:o,fail:function(t){e.navigateTo({url:"/pages/index/index"})}})}})}))}})};t.default=s}).call(this,n("543d")["default"])},ef2a:function(e,t,n){"use strict";n.r(t);var o=n("f86f"),r=n("623b");for(var c in r)"default"!==c&&function(e){n.d(t,e,(function(){return r[e]}))}(c);n("6593");var i,a=n("f0c5"),u=Object(a["a"])(r["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],i);t["default"]=u.exports},f86f:function(e,t,n){"use strict";var o;n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return c})),n.d(t,"a",(function(){return o}));var r=function(){var e=this,t=e.$createElement;e._self._c;e._isMounted||(e.e0=function(t){!e.isclick&&e.userInfoData()})},c=[]},fd85:function(e,t,n){"use strict";(function(e){n("30ba");o(n("66fd"));var t=o(n("ef2a"));function o(e){return e&&e.__esModule?e:{default:e}}wx.__webpack_require_UNI_MP_PLUGIN__=n,e(t.default)}).call(this,n("543d")["createPage"])}},[["fd85","common/runtime","common/vendor"]]]);