login-legacy.8ef45196.js 15 KB

12345678
  1. ;(function(){var _excluded=["returnUrl","isRegister"];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;}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);});};}var __vite_style__=document.createElement('style');__vite_style__.innerHTML="._imgCode_mywmt_1{padding:.42667rem}._imgCode_mywmt_1 ._codeTitle_mywmt_4{text-align:center;font-size:.42667rem;color:#4f4f4f;margin:0;padding-bottom:.42667rem}._imgCode_mywmt_1 ._img_mywmt_1{display:flex;align-items:center;justify-content:center}._imgCode_mywmt_1 ._imgChange_mywmt_16{display:block;color:#aaa;font-size:.32rem;text-align:center;padding-top:.13333rem}._imgCode_mywmt_1 ._field_mywmt_23{background:#F4F4F4;padding:.26667rem .32rem!important}._imgCodePopup_mywmt_27{width:90%;border-radius:.13333rem;overflow:inherit}._imgCodePopup_mywmt_27 .van-popup__close-icon{top:-.98667rem!important;right:0!important;font-size:.66667rem;color:#fff}._login_1rn8k_1{min-height:100vh;background:url(./assets/top_bg.e8f7f58b.png) no-repeat top center;background-color:#fff;background-size:100%}._login_1rn8k_1 ._loginTitle_1rn8k_7{padding-top:2.66667rem;font-size:.69333rem;padding-left:.93333rem;padding-bottom:1.86667rem;line-height:.98667rem;font-weight:500}._login_1rn8k_1 ._codeText_1rn8k_15{color:var(--van-primary)}._login_1rn8k_1 ._margin34_1rn8k_18{margin:0 .90667rem}._login_1rn8k_1 ._formTitle_1rn8k_21{font-size:.48rem;color:#000;font-weight:500}._login_1rn8k_1 .van-cell-group{margin-bottom:.93333rem}._login_1rn8k_1 .van-field{padding-left:0;padding-right:0}._login_1rn8k_1 .van-button+.van-button{margin-top:.53333rem;color:#000!important}\n";document.head.appendChild(__vite_style__);System.register(['./vendor-legacy.73abbe39.js','./index-legacy.f25f109a.js','./index-legacy.f25f109a2.js','./index-legacy.f25f109a3.js','./index-legacy.637f3556.js','./index-legacy.f25f109a4.js','./index-legacy.4b2d517a.js','./validate-legacy.6f96259a.js'],function(exports){'use strict';var defineComponent,Toast,createVNode,Popup,createTextVNode,Row,Col,Field,Image,Loading,useCountDown,CellGroup,Fragment,Button,state,request,removeAuth,setAuth,setLogin,checkPhone;return{setters:[function(module){defineComponent=module.d;Toast=module.T;createVNode=module.b;Popup=module.P;createTextVNode=module.j;Row=module.k;Col=module.C;Field=module.l;Image=module.I;Loading=module.L;useCountDown=module.u;CellGroup=module.m;Fragment=module.F;Button=module.B;},function(){},function(){},function(){},function(){},function(){},function(module){state=module.s;request=module.r;removeAuth=module.a;setAuth=module.b;setLogin=module.c;},function(module){checkPhone=module.c;}],execute:function execute(){var imgCode="_imgCode_mywmt_1";var codeTitle="_codeTitle_mywmt_4";var img="_img_mywmt_1";var imgChange="_imgChange_mywmt_16";var field="_field_mywmt_23";var imgCodePopup="_imgCodePopup_mywmt_27";var styles$1={imgCode:imgCode,codeTitle:codeTitle,img:img,imgChange:imgChange,field:field,imgCodePopup:imgCodePopup};var ImgCode=defineComponent({name:'imgCode',props:{value:Boolean,phone:[String,Number],onClose:{type:Function,// (...args: any[]) => any) | undefined
  2. default:function _default(){}},onSendCode:{type:Function,default:function _default(){}}},data:function data(){var origin=window.location.origin;return{showStatus:false,identifyingCode:origin+state.platformApi+'/code/getLoginImage?phone='+this.phone,code:null};},mounted:function mounted(){this.showStatus=this.value;},watch:{value:function value(val){this.showStatus=val;},code:function code(val){if(val.length>=4){this.checkVerifyLoginImage();}}},methods:{updateIdentifyingCode:function updateIdentifyingCode(){var _this=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var origin;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:// 刷新token
  3. origin=window.location.origin;_this.identifyingCode="".concat(origin).concat(state.platformApi,"/code/getLoginImage?phone=").concat(_this.phone,"&token=").concat(Math.random());case 2:case"end":return _context.stop();}}},_callee);}))();},checkVerifyLoginImage:function checkVerifyLoginImage(){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:_context2.prev=0;if(!(_this2.code.length<4)){_context2.next=3;break;}return _context2.abrupt("return");case 3:_context2.next=5;return request.post("".concat(state.platformApi,"/code/verifyLoginImage"),{requestType:'form',data:{phone:_this2.phone,code:_this2.code}});case 5:_context2.next=7;return request.post("".concat(state.platformApi,"/code/sendSms"),{requestType:'form',data:{mobile:_this2.phone,type:'LOGIN'}});case 7:Toast('验证码已发送');_this2.onClose();_this2.onSendCode();_context2.next=15;break;case 12:_context2.prev=12;_context2.t0=_context2["catch"](0);_this2.updateIdentifyingCode();case 15:case"end":return _context2.stop();}}},_callee2,null,[[0,12]]);}))();}},render:function render(){var _this3=this;return(// @ts-ignore
  4. createVNode(Popup,{"show":this.showStatus,"class":styles$1.imgCodePopup,"closeOnClickOverlay":false,"onClose":function onClose(){_this3.onClose();},"closeable":true,"closeIcon":"close"},{default:function _default(){return[createVNode("div",{"class":styles$1.imgCode},[createVNode("p",{"class":styles$1.codeTitle},[createTextVNode("\u8F93\u5165\u56FE\u5F62\u9A8C\u8BC1\u7801")]),createVNode(Row,null,{default:function _default(){return[createVNode(Col,{"span":"14"},{default:function _default(){return[createVNode(Field,{"placeholder":"请输入验证码","modelValue":_this3.code,"onUpdate:modelValue":function onUpdateModelValue($event){return _this3.code=$event;},"class":styles$1.field},null)];}}),createVNode(Col,{"span":"10","class":styles$1.img},{default:function _default(){return[createVNode(Image,{"src":_this3.identifyingCode,"onClick":function onClick(){return _this3.updateIdentifyingCode();}},{loading:function loading(){return createVNode(Loading,{"type":"spinner","size":"20"},null);}})];}})];}}),createVNode(Row,{"style":{display:'flex',justifyContent:'end'}},{default:function _default(){return[createVNode(Col,{"span":"10"},{default:function _default(){return[createVNode("span",{"class":styles$1.imgChange,"onClick":function onClick(){return _this3.updateIdentifyingCode();}},[createTextVNode("\u770B\u4E0D\u6E05\uFF1F\u6362\u4E00\u6362")])];}})];}})])];}}));}});var login$1="_login_1rn8k_1";var loginTitle="_loginTitle_1rn8k_7";var codeText="_codeText_1rn8k_15";var margin34="_margin34_1rn8k_18";var formTitle="_formTitle_1rn8k_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,// 是否发送验证码
  5. countDownTime:1000*120,// 倒计时时间
  6. countDownRef:null,// 倒计时实例
  7. 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 _this4=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee3(){var res,authentication,userCash;return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.prev=0;if(!(_this4.loginType==='PWD')){_context3.next=7;break;}_context3.next=4;return request.post('/api-auth/usernameLogin',{requestType:'form',data:{username:_this4.username,password:_this4.password,clientId:'student',clientSecret:'student'}});case 4:res=_context3.sent;_context3.next=10;break;case 7:_context3.next=9;return request.post('/api-auth/smsLogin',{requestType:'form',data:{clientId:'student',clientSecret:'student',phone:_this4.username,smsCode:_this4.smsCode}});case 9:res=_context3.sent;case 10:authentication=res.data.authentication;setAuth(authentication.token_type+' '+authentication.access_token);_context3.next=14;return request.get('/api-student/student/queryUserInfo',{initRequest:true// 初始化接口
  8. });case 14:userCash=_context3.sent;setLogin(userCash.data);_this4.directNext();_context3.next=21;break;case 19:_context3.prev=19;_context3.t0=_context3["catch"](0);case 21:case"end":return _context3.stop();}}},_callee3,null,[[0,19]]);}))();},onSendCode:function onSendCode(){var _this5=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee4(){return regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:if(checkPhone(_this5.username)){_context4.next=2;break;}return _context4.abrupt("return",Toast('请输入正确的手机号码'));case 2:_this5.imgCodeStatus=true;case 3:case"end":return _context4.stop();}}},_callee4);}))();},onCodeSend:function onCodeSend(){this.countDownStatus=false;this.countDownRef=useCountDown({time:this.countDownTime,onFinish:this.onFinished});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 _this6=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\u7BA1\u4E50\u8FF7")]),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":_this6.username,"onUpdate:modelValue":function onUpdateModelValue($event){return _this6.username=$event;},"name":"手机号","placeholder":"请输入您的手机号","type":"tel","maxlength":11},null)];}})];}}),_this6.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":_this6.password,"onUpdate:modelValue":function onUpdateModelValue($event){return _this6.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":_this6.smsCode,"onUpdate:modelValue":function onUpdateModelValue($event){return _this6.smsCode=$event;},"name":"验证码","placeholder":"请输入验证码","type":"tel","maxlength":6},{button:function button(){var _this6$countDownRef;return _this6.countDownStatus?createVNode("span",{"class":styles.codeText,"onClick":_this6.onSendCode},[createTextVNode("\u83B7\u53D6\u9A8C\u8BC1\u7801")]):createVNode(Fragment,null,[Number(((((_this6$countDownRef=_this6.countDownRef)===null||_this6$countDownRef===void 0?void 0:_this6$countDownRef.current.total)||0)/1000).toFixed()),createTextVNode("\u79D2")]);}})];}})];}})];}}),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[_this6.loginType==='PWD'?'验证码登录':'密码登录'];}})]),this.imgCodeStatus?createVNode(ImgCode,{"value":this.imgCodeStatus,"onUpdate:value":function onUpdateValue($event){return _this6.imgCodeStatus=$event;},"phone":this.username,"onClose":function onClose(){_this6.imgCodeStatus=false;},"onSendCode":this.onCodeSend},null):null]);}}));}};});})();