1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5feef1a1"],{"79ba":function(e,t,i){"use strict";i.r(t);var n=function(){var e=this,t=e._self._c;return t("div",{staticClass:"pt-28 p-4"},[t("div",{staticClass:"text-center"},[t("van-image",{attrs:{width:"6rem",height:"6rem",src:this.$settings.logo}}),t("p",{staticClass:"mt-5 mb-12 text-2xl"},[e._v("工程队长端")])],1),e.showLoginType?t("div",{staticClass:"text-center"},[t("van-button",{attrs:{type:"primary",size:"large",round:"",block:"","icon-prefix":"my-icon",icon:"weixin"},on:{click:e.weixinLogin}},[e._v("微信授权登录")]),t("p",{staticClass:"mt-4 text-gray-400 text-sm",staticStyle:{"font-size":"1rem","line-height":"2rem"},on:{click:e.mimaLogin}},[e._v(" 账号密码登录 ")])],1):e._e(),e.showLoginType?e._e():t("van-form",{on:{submit:e.onSubmit}},[t("van-field",{attrs:{clearable:"",label:"手机号",placeholder:"请输入手机号",type:"tel",rules:[{required:!0}]},model:{value:e.loginForm.phone,callback:function(t){e.$set(e.loginForm,"phone",t)},expression:"loginForm.phone"}}),t("van-field",{attrs:{type:"password",name:"密码",label:"密码",placeholder:"密码",rules:[{required:!0,message:"请填写密码"}]},model:{value:e.loginForm.password,callback:function(t){e.$set(e.loginForm,"password",t)},expression:"loginForm.password"}}),t("div",{staticClass:"mt-8"},[t("van-button",{attrs:{loading:e.loginLoading,disabled:e.disabled,block:"",type:"info","loading-text":"加载中...","native-type":"submit"}},[e._v(e._s(e.btnText))])],1),2==e.loginForm.login_type?t("div",[t("van-divider",{style:{borderColor:"#4B5563",paddingTop:"20px"},attrs:{"content-position":"center"}},[e._v("其它登录方式")]),t("van-icon",{staticClass:"w-full text-center inline-block",attrs:{"class-prefix":"my-icon",name:"weixin",color:"#07c160",size:"2.5rem"},on:{click:e.weixinLogin}})],1):e._e()],1)],1)},o=[],r=(i("14d9"),i("13d5"),i("b64b"),i("d3b7"),i("4d63"),i("c607"),i("ac1f"),i("2c3e"),i("25f0"),i("5319"),i("99af"),i("f0e1")),a=i("7be5");function s(e,t){return Object(r["a"])({url:a["a"].weixin+"oauth_url/".concat(e),method:"get",params:t})}function c(e,t){return Object(r["a"])({url:a["a"].weixin+"admin_info/".concat(e,"?code=").concat(t),method:"get"})}var l="Dispatch-Storage",d={get:function(e){var t=window.localStorage.getItem(l+"_"+e);return t?window.JSON.parse(t):""},set:function(e,t){window.localStorage.setItem(l+"_"+e,window.JSON.stringify(t))},del:function(e,t){window.localStorage.removeItem(l+"_"+e)}},u=i("367a"),g=(i("eaf8"),{data:function(){return{btnText:"登录",disabled:!1,wxID:1,code:"",loginLoading:!1,showLoginType:!1,countDownTime:6e4,loginForm:{phone:"",code:"",openid:"",nickname:"",sex:0,headimgurl:"",login_type:1}}},watch:{$route:{handler:function(e){var t=e.query;console.log(e.query),t&&(this.redirect=t.redirect,this.otherQuery=this.getOtherQuery(t))},immediate:!0}},created:function(){var e=this.getUrlKey("code");if(null!=e&&""!==e)return d.set("weixin_code",e),void(window.location.href=d.get("href"));this.code=d.get("weixin_code"),1===this.loginForm.login_type&&null!=this.code&&""!==this.code?this.fetchUserInfo():this.btnText="登录"},mounted:function(){d.set("href",window.location.href)},methods:{weixinLogin:function(){this.loginForm.login_type=1,s(this.wxID,{scope:"snsapi_userinfo",url:"dispatch#/login"}).then((function(e){window.location.href=e.data}))},mimaLogin:function(){this.loginForm.login_type=2,this.showLoginType=!1},fetchUserInfo:function(){var e=this;this.disabled=!0,c(this.wxID,this.code).then((function(t){if(d.del("weixin_code"),e.loginForm.openid=t.data.openid,e.loginForm.nickname=t.data.nickname,e.loginForm.sex=t.data.sex,e.loginForm.headimgurl=t.data.headimgurl,t.data.is_exists)return e.onSubmit();e.showLoginType=!1,e.btnText="绑定微信并登录",e.disabled=!1})).catch((function(){d.del("weixin_code")}))},onSubmit:function(){var e=this;this.loginLoading=!0,this.loginForm.login_type=2,this.showLoginType=!1,u["a"],this.$store.dispatch("user/login",this.loginForm).then((function(){e.$router.push({path:e.redirect||"/home",query:e.otherQuery}),e.loginLoading=!1})).catch((function(){e.loginLoading=!1}))},getUrlKey:function(e){return decodeURIComponent((new RegExp("[?|&]"+e+"=([^&;]+?)(&|#|;|$)").exec(location.href)||[,""])[1].replace(/\+/g,"%20"))||null},getOtherQuery:function(e){return Object.keys(e).reduce((function(t,i){return"redirect"!==i&&(t[i]=e[i]),t}),{})}}}),h=g,f=i("2877"),m=Object(f["a"])(h,n,o,!1,null,null,null);t["default"]=m.exports},"7be5":function(e,t,i){"use strict";var n=i("7139");t["a"]={customer:n["a"].baseApi+"api/aftersale/customer/",work:n["a"].baseApi+"worker/",weixin:n["a"].baseUrl+"api/weixin/"}},"99af":function(e,t,i){"use strict";var n=i("23e7"),o=i("d039"),r=i("e8b5"),a=i("861d"),s=i("7b0b"),c=i("07fa"),l=i("3511"),d=i("8418"),u=i("65f0"),g=i("1dde"),h=i("b622"),f=i("1212"),m=h("isConcatSpreadable"),p=f>=51||!o((function(){var e=[];return e[m]=!1,e.concat()[0]!==e})),w=function(e){if(!a(e))return!1;var t=e[m];return void 0!==t?!!t:r(e)},b=!p||!g("concat");n({target:"Array",proto:!0,arity:1,forced:b},{concat:function(e){var t,i,n,o,r,a=s(this),g=u(a,0),h=0;for(t=-1,n=arguments.length;t<n;t++)if(r=-1===t?a:arguments[t],w(r))for(o=c(r),l(h+o),i=0;i<o;i++,h++)i in r&&d(g,h,r[i]);else l(h+1),d(g,h++,r);return g.length=h,g}})}}]);
|