;(function(){var _excluded=["returnUrl","isRegister"];function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}var __vite_style__=document.createElement('style');__vite_style__.innerHTML="._login_18sy9_1{min-height:100vh;background:url(./assets/top_bg.e8f7f58b.png) no-repeat top center,url(./assets/bottom_bg.2d0f4251.png) no-repeat bottom center;background-color:#fff;background-size:100%}._login_18sy9_1 ._loginTitle_18sy9_7{padding-top:2.66667rem;font-size:.69333rem;padding-left:.93333rem;padding-bottom:1.86667rem;line-height:.98667rem;font-weight:500}._login_18sy9_1 ._codeText_18sy9_15{color:var(--van-primary)}._login_18sy9_1 ._margin34_18sy9_18{margin:0 .90667rem}._login_18sy9_1 ._formTitle_18sy9_21{font-size:.48rem;color:#000;font-weight:500}._login_18sy9_1 .van-cell-group{margin-bottom:.93333rem}._login_18sy9_1 .van-field{padding-left:0;padding-right:0}._login_18sy9_1 .van-button+.van-button{margin-top:.53333rem;color:#000!important}\n";document.head.appendChild(__vite_style__);System.register(['./vendor-legacy.031e1374.js','./index-legacy.f25f109a.js','./index-legacy.f25f109a2.js','./index-legacy.f25f109a3.js','./index-legacy.7e8ba1cc.js','./index-legacy.637f3556.js','./validate-legacy.c1df5f0e.js','./index-legacy.1cd7b6bb.js','./index-legacy.f25f109a4.js'],function(exports){'use strict';var defineComponent,Toast,createVNode,createTextVNode,CellGroup,Row,Col,Field,CountDown,Button,ImgCode,checkPhone,removeAuth,state,request,setAuth,setLogin;return{setters:[function(module){defineComponent=module.d;Toast=module.T;createVNode=module.a;createTextVNode=module.j;CellGroup=module.C;Row=module.k;Col=module.l;Field=module.m;CountDown=module.p;Button=module.B;},function(){},function(){},function(){},function(module){ImgCode=module.I;},function(){},function(module){checkPhone=module.c;},function(module){removeAuth=module.i;state=module.s;request=module.r;setAuth=module.a;setLogin=module.b;},function(){}],execute:function execute(){var login$1="_login_18sy9_1";var loginTitle="_loginTitle_18sy9_7";var codeText="_codeText_18sy9_15";var margin34="_margin34_18sy9_18";var formTitle="_formTitle_18sy9_21";var styles={login:login$1,loginTitle:loginTitle,codeText:codeText,margin34:margin34,formTitle:formTitle};var login=exports('default',defineComponent({name:'login',data:function data(){return{loginType:'SMS',username:'',password:'',smsCode:'',countDownStatus:true,// 是否发送验证码
countDownTime:1000*120,// 倒计时时间
countDownRef:null,// 倒计时实例
imgCodeStatus:false};},computed:{codeDisable:function codeDisable(){var status=true;if(this.loginType==='PWD'){this.username&&this.password&&(status=false);}else{this.username&&this.smsCode&&(status=false);}return status;}},mounted:function mounted(){removeAuth();this.directNext();},methods:{directNext:function directNext(){if(state.user.status==='login'||state.user.status==='error'){var _this$$route$query=this.$route.query,returnUrl=_this$$route$query.returnUrl,isRegister=_this$$route$query.isRegister,rest=_objectWithoutProperties(_this$$route$query,_excluded);this.$router.replace({path:returnUrl,query:_objectSpread({},rest)});}},onLogin:function onLogin(){var _this=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var res,authentication,userCash;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;if(!(_this.loginType==='PWD')){_context.next=7;break;}_context.next=4;return request.post('/api-auth/usernameLogin',{requestType:'form',data:{username:_this.username,password:_this.password,clientId:'student',clientSecret:'student'}});case 4:res=_context.sent;_context.next=10;break;case 7:_context.next=9;return request.post('/api-auth/smsLogin',{requestType:'form',data:{clientId:'student',clientSecret:'student',phone:_this.username,smsCode:_this.smsCode}});case 9:res=_context.sent;case 10:authentication=res.data.authentication;setAuth(authentication.token_type+' '+authentication.access_token);_context.next=14;return request.get('/api-student/student/queryUserInfo',{initRequest:true// 初始化接口
});case 14:userCash=_context.sent;setLogin(userCash.data);_this.directNext();_context.next=21;break;case 19:_context.prev=19;_context.t0=_context["catch"](0);case 21:case"end":return _context.stop();}}},_callee,null,[[0,19]]);}))();},onSendCode:function onSendCode(){var _this2=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(checkPhone(_this2.username)){_context2.next=2;break;}return _context2.abrupt("return",Toast('请输入正确的手机号码'));case 2:_this2.imgCodeStatus=true;case 3:case"end":return _context2.stop();}}},_callee2);}))();},onCodeSend:function onCodeSend(){this.countDownStatus=false;this.countDownRef.start();},onFinished:function onFinished(){this.countDownStatus=true;this.countDownRef.reset();},onChange:function onChange(){if(this.loginType==='PWD'){this.loginType='SMS';}else if(this.loginType==='SMS'){this.loginType='PWD';}}},render:function render(){var _this3=this;return createVNode("div",{"class":styles.login},[createVNode("div",{"class":styles.loginTitle},[createTextVNode("\u60A8\u597D\uFF0C"),createVNode("br",null,null),createTextVNode(" \u6B22\u8FCE\u4F7F\u7528\u9177\u4E50\u79C0")]),createVNode(CellGroup,{"class":styles.margin34,"border":false},{default:function _default(){return[createVNode(Row,{"style":{marginBottom:'16px'}},{default:function _default(){return[createVNode(Col,{"span":24,"class":styles.formTitle},{default:function _default(){return[createTextVNode("\u624B\u673A\u53F7")];}}),createVNode(Col,{"span":24,"class":"van-hairline--bottom"},{default:function _default(){return[createVNode(Field,{"modelValue":_this3.username,"onUpdate:modelValue":function onUpdateModelValue($event){return _this3.username=$event;},"name":"手机号","placeholder":"请输入您的手机号","type":"tel","maxlength":11},null)];}})];}}),_this3.loginType==='PWD'?createVNode(Row,null,{default:function _default(){return[createVNode(Col,{"span":24,"class":styles.formTitle},{default:function _default(){return[createTextVNode("\u5BC6\u7801")];}}),createVNode(Col,{"span":24,"class":"van-hairline--bottom"},{default:function _default(){return[createVNode(Field,{"modelValue":_this3.password,"onUpdate:modelValue":function onUpdateModelValue($event){return _this3.password=$event;},"type":"password","name":"密码","placeholder":"请输入密码"},null)];}})];}}):createVNode(Row,null,{default:function _default(){return[createVNode(Col,{"span":24,"class":styles.formTitle},{default:function _default(){return[createTextVNode("\u9A8C\u8BC1\u7801")];}}),createVNode(Col,{"span":24,"class":"van-hairline--bottom"},{default:function _default(){return[createVNode(Field,{"modelValue":_this3.smsCode,"onUpdate:modelValue":function onUpdateModelValue($event){return _this3.smsCode=$event;},"name":"验证码","placeholder":"请输入验证码","type":"tel","maxlength":6},{button:function button(){return _this3.countDownStatus?createVNode("span",{"class":styles.codeText,"onClick":_this3.onSendCode},[createTextVNode("\u83B7\u53D6\u9A8C\u8BC1\u7801")]):createVNode(CountDown,{"ref":_this3.countDownRef,"auto-start":false,"time":_this3.countDownTime,"onFinish":_this3.onFinished,"format":"ss秒"},null);}})];}})];}})];}}),createVNode("div",{"class":styles.margin34},[createVNode(Button,{"round":true,"block":true,"type":"primary","disabled":this.codeDisable,"onClick":this.onLogin},{default:function _default(){return[createTextVNode("\u63D0\u4EA4")];}}),createVNode(Button,{"block":true,"round":true,"color":"#F5F7FB","onClick":this.onChange},{default:function _default(){return[_this3.loginType==='PWD'?'验证码登录':'密码登录'];}})]),this.imgCodeStatus?createVNode(ImgCode,{"value":this.imgCodeStatus,"onUpdate:value":function onUpdateValue($event){return _this3.imgCodeStatus=$event;},"phone":this.username,"onClose":function onClose(){_this3.imgCodeStatus=false;},"onSendCode":this.onCodeSend},null):null]);}}));}};});})();
