1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-385c1232"],{"35b5":function(e,t,n){"use strict";var i=n("1854");t["a"]={customer:i["a"].baseApi+"api/aftersale/customer/",work:i["a"].baseApi+"worker/",weixin:i["a"].baseUrl+"api/weixin/"}},"477d":function(e,t,n){"use strict";var i="Work-Storage";t["a"]={get:function(e){var t=window.localStorage.getItem(i+"_"+e);return t?window.JSON.parse(t):""},set:function(e,t){window.localStorage.setItem(i+"_"+e,window.JSON.stringify(t))},del:function(e,t){window.localStorage.removeItem(i+"_"+e)}}},"4df46":function(e,t,n){"use strict";n.r(t);var i=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=(n("14d9"),n("13d5"),n("b64b"),n("d3b7"),n("4d63"),n("c607"),n("ac1f"),n("2c3e"),n("25f0"),n("5319"),n("99af"),n("9f4c")),a=n("35b5");function c(e,t){return Object(r["a"])({url:a["a"].weixin+"oauth_url/".concat(e),method:"get",params:t})}function s(e,t){return Object(r["a"])({url:a["a"].weixin+"admin_info/".concat(e,"?code=").concat(t),method:"get"})}var l=n("477d"),d=n("2779"),u=(n("eaf8"),{data:function(){return{btnText:"登录",disabled:!1,wxID:1,code:"",loginLoading:!1,showLoginType:!0,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 l["a"].set("weixin_code",e),void(window.location.href=l["a"].get("href"));this.code=l["a"].get("weixin_code"),1===this.loginForm.login_type&&null!=this.code&&""!==this.code?this.fetchUserInfo():this.btnText="登录"},mounted:function(){l["a"].set("href",window.location.href)},methods:{weixinLogin:function(){this.loginForm.login_type=1,c(this.wxID,{scope:"snsapi_userinfo",url:"final#/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,s(this.wxID,this.code).then((function(t){if(l["a"].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(){l["a"].del("weixin_code")}))},onSubmit:function(){var e=this;this.loginLoading=!0,d["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,n){return"redirect"!==n&&(t[n]=e[n]),t}),{})}}}),g=u,h=n("2877"),f=Object(h["a"])(g,i,o,!1,null,null,null);t["default"]=f.exports},"99af":function(e,t,n){"use strict";var i=n("23e7"),o=n("d039"),r=n("e8b5"),a=n("861d"),c=n("7b0b"),s=n("07fa"),l=n("3511"),d=n("8418"),u=n("65f0"),g=n("1dde"),h=n("b622"),f=n("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");i({target:"Array",proto:!0,arity:1,forced:b},{concat:function(e){var t,n,i,o,r,a=c(this),g=u(a,0),h=0;for(t=-1,i=arguments.length;t<i;t++)if(r=-1===t?a:arguments[t],w(r))for(o=s(r),l(h+o),n=0;n<o;n++,h++)n in r&&d(g,h,r[n]);else l(h+1),d(g,h++,r);return g.length=h,g}})}}]);
|