1 |
- webpackJsonp([4],{"+Nj0":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a("mvHQ"),o=a.n(n),i=(a("Ny/I"),a("7Tnr")),s=a("7+uW"),r=a("l9V+");s.a.use(i.a);var l={name:"login",data:function(){return{input_focus:!1,complite_btn_enable:!1,login_error:!1,reg_loading:!1,login_error_msg:"",next_btn_enable:!1,setp:1,formData:{username:"",password:""},aweixin:null,auths:[],cur_date:Math.round(new Date/1e3)}},created:function(){var e=this;e.site_id=e.$route.query.site_id,e.employee_id=e.$route.query.employee_id,e.$store.commit("SET_USERINFO",{}),e.$store.commit("SET_USERID",0),e.getServiceOauth(),document.body.addEventListener("blur",function(t){setTimeout(function(){t.target.parentNode.parentNode.parentNode.classList.remove("field-focus"),e.input_focus=!1},100)},!0),document.body.addEventListener("focus",function(t){t.target.parentNode.parentNode.parentNode.classList.add("field-focus"),setTimeout(function(){e.input_focus=!0},100)},!0)},watch:{formData:{handler:function(e,t){""!=e.username&&""!=e.password?this.next_btn_enable=!0:this.next_btn_enable=!1},deep:!0}},methods:{sendJoin:function(){var e=this;e.$toast.loading({mask:!0,message:"正在处理..."}),Object(r.a)({url:"/api/join/submit",method:"post",data:{employee_id:this.employee_id,site_id:this.site_id}}).then(function(t){e.$toast.clear()})},show_error:function(e){var t=this;t.login_error=!0,setTimeout(function(){t.login_error=!1},3e3),t.login_error_msg=e},getServiceOauth:function(){var e=this;window.plus&&plus.oauth.getServices(function(t){for(var a in e.auths=t,t)"weixin"==t[a].id&&(e.aweixin=t[a])},function(e){console.log(e)})},doWeixinLogin:function(){var e=this;null!=e.aweixin?e.aweixin.authorize(function(t){console.log(t),e.WeixinLogin(t.code)},function(e){plus.nativeUI.alert("授权失败:"+o()(e))},{scope:"snsapi_userinfo",state:"authorize test",appid:"wx78513a709dbea762"}):plus.nativeUI.alert("当前环境不支持微信登录")},sendLogin:function(){var e=this,t=this;t.$validator.validate().then(function(a){a?(t.$toast.loading({mask:!0,message:"正在登录..."}),e.$store.dispatch("login",{tel:t.formData.username,password:t.formData.password}).then(function(e){if(t.$toast.clear(),t.site_id>0&&t.employee_id>0&&t.sendJoin(),console.log(t.site_id,t.employee_id),1==e.code){localStorage.setItem("a-token-temp",e.data.token);var a=parseInt((new Date).valueOf()/1e3);localStorage.setItem("a-token-temp-expire",a+7200),localStorage.setItem("login-site-list",o()(e.data.account_site)),t.$toast.clear(),e.data.account_site.length>0?e.data.invitation_wait_count>0?t.$router.push({name:"registration_experience",query:{invite:1,iscompany:1}}):t.$router.push({name:"login_company_list"}):e.data.invitation_wait_count>0?t.$router.push({name:"registration_experience",query:{invite:1}}):t.$router.push({name:"registration_experience"})}else t.$toast.fail({message:e.msg,duration:1e3})}).catch(function(e){console.log(e)})):t.$notify({type:"danger",message:t.$validator.errors.items[0].msg})})},WeixinLogin:function(e){var t=this;t.$toast.loading({mask:!0,message:"正在登录..."}),this.$store.dispatch("weixin_login",{code:e,platform:"wechat"}).then(function(e){if(t.$toast.clear(),1==e.code){localStorage.setItem("a-token-temp",e.data.token);var a=parseInt((new Date).valueOf()/1e3);localStorage.setItem("a-token-temp-expire",a+7200),localStorage.setItem("login-site-list",o()(e.data.account_site)),e.data.account_site.length>0?t.$router.push({name:"login_company_list"}):t.$router.push({name:"create_company"}),t.$toast.clear()}else 1001==e.code?t.$router.push({name:"bind_weixin"}):t.$notify({message:e.msg,duration:1e3,background:"#f44"})}).catch(function(e){console.log(e)})}}},c={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"login-box-parent",staticStyle:{background:"#fff"}},[a("div",{staticClass:"login-box",class:{input_focus:e.input_focus}},[a("scroller",[a("div",{staticClass:"login-form-box",staticStyle:{"background-color":"#FFF"}},[a("div",{staticClass:"login-form-box-bg"},[a("icon",{staticClass:"login_logo_bg",attrs:{name:"login_logo_bg"}})],1),e._v(" "),a("div",{staticStyle:{height:"1rem"}}),e._v(" "),a("div",{staticClass:"login_logo"},[a("icon",{staticClass:"app_logn",attrs:{name:"logo"}})],1),e._v(" "),a("div",{staticClass:"setp1"},[a("van-cell-group",{staticStyle:{"margin-top":"0.3rem"}},[a("van-field",{directives:[{name:"validate",rawName:"v-validate",value:"required|phone",expression:"'required|phone'"}],staticClass:"tel",staticStyle:{color:"#515151","caret-color":"#26A2FF"},attrs:{"left-icon":"logo","label-class":"hidden",label:"",type:"Number",placeholder:"手机号",clearable:"",name:"手机号码"},model:{value:e.formData.username,callback:function(t){e.$set(e.formData,"username",t)},expression:"formData.username"}},[a("template",{slot:"left-icon"},[a("icon",{staticClass:"login_tel",attrs:{name:"tel"}})],1)],2),e._v(" "),a("van-field",{directives:[{name:"validate",rawName:"v-validate",value:"required|alpha_dash|min:6",expression:"'required|alpha_dash|min:6'"}],staticClass:"psw",staticStyle:{color:"#515151","caret-color":"#26A2FF"},attrs:{"label-class":"hidden","left-icon":"logo",clearable:"",label:"",type:"password",placeholder:"密码",name:"密码"},model:{value:e.formData.password,callback:function(t){e.$set(e.formData,"password",t)},expression:"formData.password"}},[e._v("\n >\n "),a("template",{slot:"left-icon"},[a("icon",{staticClass:"login_pwd",attrs:{name:"pwd"}})],1)],2),e._v(" "),a("van-field",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"},{name:"validate",rawName:"v-validate",value:"required|alpha_dash|min:6",expression:"'required|alpha_dash|min:6'"}],staticClass:"psw",staticStyle:{color:"#515151","caret-color":"#26A2FF"},attrs:{"label-class":"hidden","left-icon":"logo",label:"",type:"password",placeholder:"密码",name:"密码"},model:{value:e.formData.password,callback:function(t){e.$set(e.formData,"password",t)},expression:"formData.password"}},[e._v("\n >\n "),a("template",{slot:"left-icon"},[a("icon",{staticClass:"login_pwd",attrs:{name:"pwd"}})],1)],2)],1)],1),e._v(" "),a("div",{staticStyle:{padding:"0 0.32rem"}},[a("van-button",{staticClass:"login_button",attrs:{color:"#228bf8",loading:e.reg_loading,size:"large",disabled:!e.next_btn_enable,type:"info"},on:{click:e.sendLogin}},[e._v("登录\n ")])],1),e._v(" "),a("div",{staticClass:"reg_link_box",staticStyle:{padding:"0.2rem 0.32rem 0.2rem"}},[a("van-row",[a("van-col",{attrs:{span:"12"}},[a("div",{on:{click:function(t){return e.$router.push({name:"forget_pwd"})}}},[e._v("忘记密码")])]),e._v(" "),a("van-col",{staticStyle:{"text-align":"right"},attrs:{span:"12"}},[a("div",{on:{click:function(t){return e.$router.push({name:"reg"})}}},[e._v("注册免费试用")])])],1)],1),e._v(" "),e.auths.length>0&&e.cur_date>1592582400?a("div",{staticStyle:{"text-align":"center",padding:"0 0.32rem","letter-spacing":"0.01rem"}},[a("van-divider",[e._v("快捷登录")]),e._v(" "),a("div",{directives:[{name:"show",rawName:"v-show",value:null!=e.aweixin,expression:"aweixin != null"}],staticStyle:{display:"inline-block"},on:{click:e.doWeixinLogin}},[a("icon",{staticStyle:{width:"1.2rem"},attrs:{name:"weixindenglu"}})],1)],1):e._e()])])],1),e._v(" "),a("div",{staticClass:"footer"},[e._v("登录即代表同意\n "),a("span",{staticStyle:{color:"#28a2f1"},on:{click:function(t){return e.$router.push({name:"user_agreement"})}}},[e._v("《用户服务协议》")]),e._v("\n 与\n "),a("span",{staticStyle:{color:"#28a2f1"},on:{click:function(t){return e.$router.push({name:"privacy_agreement"})}}},[e._v("《隐私协议》")])])])},staticRenderFns:[]};var d=a("VU/8")(l,c,!1,function(e){a("xDax")},"data-v-3e3b0ba1",null);t.default=d.exports},xDax:function(e,t){}});
|