verifySlider.js 5.8 KB

12345678910
  1. require('../../../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/annex/components/verify/verifySlider/verifySlider"],{"03fc":function(t,e,i){"use strict";var n=i("f28f"),o=i.n(n);o.a},"19e2":function(t,e,i){"use strict";i.r(e);var n=i("e194"),o=i.n(n);for(var a in n)["default"].indexOf(a)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(a);e["default"]=o.a},3258:function(t,e,i){"use strict";i.r(e);var n=i("6c15"),o=i("19e2");for(var a in o)["default"].indexOf(a)<0&&function(t){i.d(e,t,(function(){return o[t]}))}(a);i("03fc");var s=i("f0c5"),r=Object(s["a"])(o["default"],n["b"],n["c"],!1,null,"b0658e76",null,!1,n["a"],void 0);e["default"]=r.exports},"6c15":function(t,e,i){"use strict";i.d(e,"b",(function(){return n})),i.d(e,"c",(function(){return o})),i.d(e,"a",(function(){}));var n=function(){var t=this.$createElement,e=(this._self._c,"2"===this.type?parseInt(this.imgSize.height):null),i="2"===this.type?Math.floor(47*parseInt(this.imgSize.width)/310):null,n="2"===this.type?parseInt(this.imgSize.height):null;this.$mp.data=Object.assign({},{$root:{m0:e,g0:i,m1:n}})},o=[]},e194:function(t,e,i){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=i("67e3"),o=i("5743"),a={name:"VerifySlide",props:{captchaType:{type:String},type:{type:String,default:"1"},mode:{type:String,default:"fixed"},vSpace:{type:Number,default:5},explain:{type:String,default:"向右滑动完成验证"},imgSize:{type:Object,default:function(){return{width:"310px",height:"155px"}}},blockSize:{type:Object,default:function(){return{width:"50px",height:"50px"}}},barSize:{type:Object,default:function(){return{width:"100%",height:"40px"}}},defaultImg:{type:String,default:""}},data:function(){return{secretKey:"",passFalg:!1,backImgBase:"",blockBackImgBase:"",backToken:"",startMoveTime:"",endMovetime:"",tipsBackColor:"",tipWords:"",text:"",finishText:"",setSize:{imgHeight:0,imgWidth:0,barHeight:0,barWidth:0},top:0,left:0,moveBlockLeft:void 0,leftBarWidth:void 0,moveBlockBackgroundColor:void 0,leftBarBorderColor:"#ddd",iconColor:void 0,iconClass:"icon-right",status:!1,isEnd:!1,showRefresh:!0,transitionLeft:"",transitionWidth:""}},methods:{init:function(){var t=this;this.text=this.explain,this.getPictrue(),this.$nextTick((function(){t.$parent.$emit("ready",t)}))},start:function(t){this.startMoveTime=(new Date).getTime(),0==this.isEnd&&(this.text="",this.moveBlockBackgroundColor="#337ab7",this.leftBarBorderColor="#337AB7",this.iconColor="#fff",t.stopPropagation(),this.status=!0)},move:function(e){var i,n,o=this,a=t.createSelectorQuery().in(this);this.barArea=a.select(".verify-bar-area"),this.barArea.boundingClientRect((function(t){if(i=Math.ceil(t.left),n=Math.ceil(t.width),o.status&&0==o.isEnd){if(e.touches)a=Math.ceil(e.touches[0].pageX);else var a=Math.ceil(e.clientX);var s=a-i;"1"!==o.type&&s>=n-parseInt(parseInt(o.blockSize.width)/2)-2&&(s=n-parseInt(parseInt(o.blockSize.width)/2)-2),s<=0&&(s=parseInt(parseInt(o.blockSize.width)/2)),o.moveBlockLeft=s-parseInt(parseInt(o.blockSize.width)/2)+"px",o.leftBarWidth=s-parseInt(parseInt(o.blockSize.width)/2)+"px"}})).exec()},end:function(){var t=this;this.endMovetime=(new Date).getTime();if(this.status&&0==this.isEnd){if("1"!==this.type){var e=parseInt((this.moveBlockLeft||"").replace("px",""));e=310*e/parseInt(this.imgSize.width);var i=this.secretKey?(0,n.aesEncrypt)(this.backToken+"---"+JSON.stringify({x:e,y:5}),this.secretKey):this.backToken+"---"+JSON.stringify({x:e,y:5}),a={captchaType:this.captchaType,pointJson:this.secretKey?(0,n.aesEncrypt)(JSON.stringify({x:e,y:5}),this.secretKey):JSON.stringify({x:e,y:5}),token:this.backToken};(0,o.ajcaptchaCheck)(a).then((function(e){e.data;t.moveBlockBackgroundColor="#5cb85c",t.leftBarBorderColor="#5cb85c",t.iconColor="#fff",t.iconClass="icon-check",t.showRefresh=!0,t.isEnd=!0,setTimeout((function(){"pop"==t.mode&&(t.$parent.clickShow=!1),t.refresh()}),1500),t.passFalg=!0,t.tipWords="".concat(((t.endMovetime-t.startMoveTime)/1e3).toFixed(2),"s验证成功"),setTimeout((function(){t.tipWords="",t.$emit("success",{captchaVerification:i})}),1e3)})).catch((function(e){t.moveBlockBackgroundColor="#d9534f",t.leftBarBorderColor="#d9534f",t.iconColor="#fff",t.iconClass="icon-close",t.passFalg=!1,setTimeout((function(){t.refresh()}),1e3),t.$parent.$emit("error",t),t.tipWords="验证失败",setTimeout((function(){t.tipWords=""}),1e3)}))}this.status=!1}},refresh:function(){var t=this;this.showRefresh=!0,this.finishText="",this.transitionLeft="left .3s",this.moveBlockLeft=0,this.leftBarWidth=!1,this.transitionWidth="width .3s",this.leftBarBorderColor="#ddd",this.moveBlockBackgroundColor="#fff",this.iconColor="#000",this.iconClass="icon-right",this.getPictrue(),this.isEnd=!1,setTimeout((function(){t.transitionWidth="",t.transitionLeft="",t.text=t.explain}),300)},getLeft:function(t){var e=0;while(t)e+=t.offsetLeft,t=t.offsetParent;var i=e;return i},getPictrue:function(){var e=this,i={captchaType:this.captchaType,clientUid:t.getStorageSync("slider"),ts:Date.now()};(0,o.getAjcaptcha)(i).then((function(t){var i=t.data;e.backImgBase=i.originalImageBase64,e.blockBackImgBase=i.jigsawImageBase64,e.backToken=i.token,e.secretKey=i.secretKey})).catch((function(){e.backImgBase=null,e.blockBackImgBase=null}))}},watch:{type:{immediate:!0,handler:function(){this.init()}}},mounted:function(){}};e.default=a}).call(this,i("543d")["default"])},f28f:function(t,e,i){}}]);
  2. ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
  3. 'pages/annex/components/verify/verifySlider/verifySlider-create-component',
  4. {
  5. 'pages/annex/components/verify/verifySlider/verifySlider-create-component':(function(module, exports, __webpack_require__){
  6. __webpack_require__('543d')['createComponent'](__webpack_require__("3258"))
  7. })
  8. },
  9. [['pages/annex/components/verify/verifySlider/verifySlider-create-component']]
  10. ]);