index.js 6.6 KB

1
  1. require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/users/wechat_login/index"],{"2fe6":function(t,e,n){},"44a9":function(t,e,n){"use strict";var i=n("2fe6"),o=n.n(i);o.a},"70d8":function(t,e,n){"use strict";n.r(e);var i=n("d5d5"),o=n.n(i);for(var a in i)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(a);e["default"]=o.a},"83b4":function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){}));var i=function(){var t=this,e=t.$createElement,n=(t._self._c,t.$t("商城登录")),i=t.configData.wechat_auth_switch&&t.bindPhone?t.$t("授权登录"):null,o=!t.configData.wechat_auth_switch||t.bindPhone||t.bindPhone?null:t.$t("授权登录"),a=t.configData.phone_auth_switch?t.$t("手机号登录"):null,c=t.canGetPrivacySetting?null:t.$t("已阅读并同意"),s=t.canGetPrivacySetting?null:t.$t("《用户协议》"),u=t.canGetPrivacySetting?null:t.$t("与"),r=t.canGetPrivacySetting?null:t.$t("《隐私协议》");t._isMounted||(t.e0=function(e){t.inAnimation=!1}),t.$mp.data=Object.assign({},{$root:{m0:n,m1:i,m2:o,m3:a,m4:c,m5:s,m6:u,m7:r}})},o=[]},9365:function(t,e,n){"use strict";(function(t,e){var i=n("47a9");n("2ea2");i(n("3240"));var o=i(n("f789"));t.__webpack_require_UNI_MP_PLUGIN__=n,e(o.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])},d5d5:function(t,e,n){"use strict";(function(t,i){var o=n("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=n("2e42"),c=(n("3b12"),n("a05e")),s=o(n("b202")),u=(o(n("192a")),o(n("0cf0"))),r=(o(n("192a")),n("9ad6")),d=(n("c8ec"),o(n("c13a"))),h=getApp(),l=t.getSystemInfoSync().statusBarHeight+"px",f={mixins:[u.default],data:function(){return{imgHost:r.HTTP_REQUEST_URL,isUp:!1,canClose:!0,phone:"",statusBarHeight:l,isHome:!1,isPhoneBox:!1,protocol:!1,isShow:!1,isLogin:!1,logoUrl:"",code:"",authKey:"",options:"",userInfo:{},codeNum:0,canUseGetUserProfile:!1,canGetPrivacySetting:!1,inAnimation:!1,colorStatus:t.getStorageSync("color_status"),mp_is_new:this.$Cache.get("MP_VERSION_ISNEW")||!1,configData:d.default.get("BASIC_CONFIG"),bindPhone:!1}},components:{mobileLogin:function(){Promise.all([n.e("common/vendor"),n.e("pages/users/components/login_mobile/index")]).then(function(){return resolve(n("05b7"))}.bind(null,n)).catch(n.oe)},routinePhone:function(){n.e("pages/users/components/login_mobile/routine_phone").then(function(){return resolve(n("c0fc"))}.bind(null,n)).catch(n.oe)},editUserModal:function(){Promise.all([n.e("common/vendor"),n.e("components/eidtUserModal/index")]).then(function(){return resolve(n("6696"))}.bind(null,n)).catch(n.oe)},privacyAgreementPopup:function(){n.e("components/privacyAgreementPopup/index").then(function(){return resolve(n("3674"))}.bind(null,n)).catch(n.oe)}},onLoad:function(e){t.getUserProfile&&(this.canUseGetUserProfile=!0),i.getPrivacySetting&&(this.canGetPrivacySetting=!0);this.userLogin();var n=getCurrentPages(),o=n[n.length-2];o&&"pages/order_addcart/order_addcart"==o.route?this.isHome=!0:this.isHome=!1},methods:{wechatAuthLogin:function(e,n){var i=this;t.showLoading({title:this.$t("正在登录中")}),(0,a.wechatAuthLogin)(e).then((function(e){if(t.hideLoading(),e.data.bindPhone)i.authKey=e.data.key,t.navigateTo({url:"/pages/users/binding_phone/index?authKey=".concat(i.authKey,"&backUrl=").concat(n)});else{var o=e.data.expires_time-i.$Cache.time();i.$store.commit("LOGIN",{token:e.data.token,time:o}),i.getUserInfo(0,n)}})).catch((function(e){t.hideLoading(),t.showToast({title:e,icon:"none",duration:2e3})}))},onAgree:function(){this.protocol=!0},userLogin:function(){var e=this;s.default.getCode().then((function(n){(0,a.authType)({code:n,spread_spid:h.globalData.spid,spread_code:h.globalData.code}).then((function(n){t.hideLoading(),e.authKey=n.data.key,e.bindPhone=n.data.bindPhone})).catch((function(e){t.hideLoading(),t.showToast({title:e,icon:"none",duration:2e3})}))})).catch((function(t){}))},getAuthLogin:function(){var e=this;this.authKey&&(this.protocol?(t.showLoading({title:this.$t("正在登录中")}),(0,a.authLogin)({key:this.authKey}).then((function(t){var n=t.data.expires_time-e.$Cache.time();e.$store.commit("LOGIN",{token:t.data.token,time:n}),e.getUserInfo(t.data.bindName)})).catch((function(e){t.hideLoading(),t.showToast({title:e,icon:"none",duration:2e3})}))):t.showToast({title:this.$t("请先阅读并同意协议"),icon:"none",duration:2e3}))},ChangeIsDefault:function(t){this.$set(this,"protocol",!this.protocol)},editSuccess:function(){this.isShow=!1},phoneLogin:function(){t.navigateTo({url:"/pages/users/binding_phone/index?authKey=".concat(this.authKey,"&pageType=0")})},closeEdit:function(){this.isShow=!1,this.$util.Tips({title:this.$t("登录成功"),icon:"success"},{tab:3})},onReject:function(){t.navigateBack()},back:function(){this.isLogin&&this.$store.commit("LOGIN",{token:"",time:0}),t.navigateBack()},home:function(){t.switchTab({url:"/pages/index/index"})},maskClose:function(t){this.isUp=!1,t&&(this.isShow=!0)},bindPhoneClose:function(t){this.isPhoneBox=!1,t.isStatus&&this.getUserInfo(t.new_user)},getphonenumber:function(e){var n=this;this.protocol?(t.showLoading({title:this.$t("正在登录中")}),s.default.getCode().then((function(t){n.getUserPhoneNumber(e.detail.encryptedData,e.detail.iv,t)})).catch((function(e){t.$emit("closePage",!1),t.hideLoading()}))):t.showToast({title:this.$t("请先阅读并同意协议"),icon:"none",duration:2e3})},getUserPhoneNumber:function(e,n,i){var o=this;(0,a.routineBindingPhone)({encryptedData:e,iv:n,code:i,spread_spid:h.globalData.spid,spread_code:h.globalData.code,agent_id:h.globalData.agent_id,key:this.authKey}).then((function(t){var e=t.data.expires_time-o.$Cache.time();o.$store.commit("LOGIN",{token:t.data.token,time:e}),o.$Cache.clear("snsapiKey"),o.getUserInfo(t.data.bindName)})).catch((function(e){t.hideLoading()}))},getUserInfo:function(e,n){var i=this,o=this;(0,c.getUserInfo)().then((function(n){t.hideLoading(),o.userInfo=n.data,o.$store.commit("SETUID",n.data.uid),o.$store.commit("UPDATE_USERINFO",n.data),e?i.isShow=!0:o.$util.Tips({title:o.$t("登录成功"),icon:"success"},{tab:3})})).catch((function(e){t.hideLoading(),t.showToast({title:e.msg,icon:"none",duration:2e3})}))},privacy:function(e){t.navigateTo({url:"/pages/users/privacy/index?type="+e})}}};e.default=f}).call(this,n("df3c")["default"],n("3223")["default"])},f789:function(t,e,n){"use strict";n.r(e);var i=n("83b4"),o=n("70d8");for(var a in o)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(a);n("44a9");var c=n("828b"),s=Object(c["a"])(o["default"],i["b"],i["c"],!1,null,null,null,!1,i["a"],void 0);e["default"]=s.exports}},[["9365","common/runtime","common/vendor"]]]);