| | |
| | | verifyCodeImage = new ResponseEntity<>(ValidateCodeFactory.outputImage(200, 80, verifyCode), HttpStatus.OK); |
| | | |
| | | //将验证码存入Redis中 |
| | | CommonCache.setValue(pd.getSessionId()+"_validateCode",verifyCode,CommonCache.defaultExpireTime); |
| | | CommonCache.setValue(pd.getSessionId()+"_validateCode",verifyCode.toLowerCase(),CommonCache.defaultExpireTime); |
| | | |
| | | }catch (Exception e){ |
| | | logger.error("生成验证码失败,",e); |
| | |
| | | |
| | | String code = CommonCache.getValue(pd.getSessionId()+"_validateCode"); |
| | | |
| | | if(JSONObject.parseObject(pd.getReqData()).getString("validateCode").equals(code)){ |
| | | if(JSONObject.parseObject(pd.getReqData()).getString("validateCode").toLowerCase().equals(code)){ |
| | | verifyResult = new ResponseEntity<>("成功", HttpStatus.OK); |
| | | }else{ |
| | | pd.setToken(""); |
| | | verifyResult = new ResponseEntity<>("验证码错误", HttpStatus.INTERNAL_SERVER_ERROR); |
| | | } |
| | | |
| | |
| | | }, |
| | | methods:{ |
| | | doLogin(){ |
| | | vc.http.call( |
| | | vc.http.post( |
| | | 'login', |
| | | 'doLogin', |
| | | JSON.stringify(vc.component.loginInfo), |
| | |
| | | methods:{ |
| | | getMenus:function(){ |
| | | var param = { |
| | | msg:this.message |
| | | params:{ |
| | | msg:this.message |
| | | } |
| | | |
| | | } |
| | | //发送get请求 |
| | | vc.http.call('menu', |
| | | vc.http.get('menu', |
| | | 'getMenus', |
| | | param, |
| | | { |
| | | emulateJSON:true |
| | | },function(json){ |
| | | function(json,res){ |
| | | vm.menus = vm.refreshMenuActive(JSON.parse(json),0); |
| | | },function(){ |
| | | },function(errInfo,error){ |
| | | console.log('请求失败处理'); |
| | | } |
| | | ); |
| | |
| | | }; |
| | | |
| | | //发送get请求 |
| | | vc.http.call('nav', |
| | | vc.http.get('nav', |
| | | 'getNavData', |
| | | param, |
| | | { |
| | | emulateJSON:true |
| | | },function(json){ |
| | | function(json){ |
| | | vm.nav = JSON.parse(json); |
| | | },function(){ |
| | | console.log('请求失败处理'); |
| | |
| | | msg:this.message |
| | | } |
| | | //发送get请求 |
| | | vc.http.call('vue_test', |
| | | vc.http.get('vue_test', |
| | | 'getTestVersion', |
| | | param, |
| | | { |
| | | emulateJSON:true |
| | | },function(json){ |
| | | function(json){ |
| | | vm.version = json; |
| | | },function(){ |
| | | console.log('请求失败处理'); |
| | |
| | | vc.extends({ |
| | | data:{ |
| | | validateCode:'', |
| | | codeImage:'/callComponent/validate-code/generateValidateCode', |
| | | codeImage:'', |
| | | }, |
| | | _initMethod:function(){ |
| | | console.log("validate-code _initMethod 方法调用"); |
| | | vc.component.generateCode(); |
| | | |
| | | }, |
| | |
| | | methods:{ |
| | | generateCode(){ |
| | | var param = { |
| | | _uId:'123' |
| | | } |
| | | vc.http.call('validate-code','generateValidateCode',param, |
| | | { |
| | | emulateJSON:true |
| | | }, |
| | | params:{ |
| | | _uId:'123' |
| | | } |
| | | }; |
| | | console.log("validate-code generateCode",param); |
| | | vc.http.get('validate-code','generateValidateCode', |
| | | param, |
| | | function(json,res){ |
| | | //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); |
| | | if(res.status == 200){ |
| | |
| | | **/ |
| | | (function(vc){ |
| | | vc.http = { |
| | | call:function(componentCode,componentMethod,param,options,successCallback,errorCallback){ |
| | | console.log(successCallback); |
| | | post:function(componentCode,componentMethod,param,options,successCallback,errorCallback){ |
| | | Vue.http.post('/callComponent/'+componentCode +"/"+componentMethod, param, options) |
| | | .then(function(res){ |
| | | successCallback(res.bodyText,res); |
| | | }, function(error){ |
| | | errorCallback(error.bodyText,error); |
| | | }); |
| | | } |
| | | }, |
| | | get:function(componentCode,componentMethod,param,successCallback,errorCallback){ |
| | | Vue.http.get('/callComponent/'+componentCode +"/"+componentMethod, param) |
| | | .then(function(res){ |
| | | successCallback(res.bodyText,res); |
| | | }, function(error){ |
| | | errorCallback(error.bodyText,error); |
| | | }); |
| | | } |
| | | |
| | | }; |
| | | |
| | |
| | | <vc:create name="nav"></vc:create> |
| | | </div> |
| | | |
| | | <div id="component"> |
| | | |
| | | </div> |
| | | |
| | | |
| | | <vc:create name="copyright"></vc:create> |
| | | |