当前位置: 首页 > news >正文

东莞品牌做网站连锁门店管理系统

东莞品牌做网站,连锁门店管理系统,软件工程好找工作吗,湖州哪里做网站uniapp、vue实现滑动拼图验证码 实际开发工作中#xff0c;在登陆的时候需要短信验证码#xff0c;但容易引起爬虫行为#xff0c;需要用到反爬虫验证码#xff0c;今天介绍一下拼图验证码#xff0c;解决验证码反爬虫中的滑动验证码反爬虫。滑动拼图验证码是在滑块验证码…uniapp、vue实现滑动拼图验证码 实际开发工作中在登陆的时候需要短信验证码但容易引起爬虫行为需要用到反爬虫验证码今天介绍一下拼图验证码解决验证码反爬虫中的滑动验证码反爬虫。滑动拼图验证码是在滑块验证码的基础上增加了一个随机滑动距离用户需要将滑块滑到拼图的缺口处使拼图完整才能通过校验。平台兼容性H5、微信小程序、字节、百度、qq等。 实际开发工作中在登陆的时候需要短信验证码但容易引起爬虫行为需要用到反爬虫验证码今天介绍一下拼图验证码解决验证码反爬虫中的滑动验证码反爬虫。原理 滑动拼图验证码是在滑块验证码的基础上增加了一个随机滑动距离用户需要将滑块滑到拼图的缺口处使拼图完整才能通过校验。 一、不对接口版本 平台兼容性H5、微信小程序、字节、百度XXX.vue文件引入 template标签中引入 slider-verify :isShowsliderVerifyFLag touchSliderResultverifyResult refverifyElement/slider-verify script标签中引入组件 import sliderVerify from /components/slider-verify/slider-verify.vue;//组件存放的路径export default {components: {slider-verify: sliderVerify},data() {return {sliderVerifyFLag: false //滑块验证};},onLoad() {},methods: {// 滑块验证结果回调函数verifyResult(res) {this.sliderVerifyFLag false;if (res) { //校验通过}else{// 校验失败,点击关闭按钮}}} }; slider-verify.vue文件代码 templateview classslider-verify-box v-ifisShowview classverifyBoxview classslider-title图形验证/viewview classslide-contentview classslide-tips拖动下方滑块完成拼图/viewview classslider-pintuimage idpintuImg :src/static/images/slider-verify/ img .jpg classpintu/imageview classpintukuai :style{ top: top px, left: oldx px }image :src/static/images/slider-verify/ img .jpg :style{ top: - top px, left: - left px}/image/viewview classyinying :style{ top: top px, left: left px }/view/viewview classslider-movearea touchendendTouchMovemovable-area :animationtruemovable-view :xx directionhorizontal changestartMove/movable-view/movable-areaview classhuadao拖动左边滑块完成上方拼图/view/view/viewview classslider-btn-groupview classslider-btn tapcloseSlider关闭/viewview classslider-btn slide-btn-refresh taprefreshVerify刷新/view/view/view/view /templatescript export default {name: slider-verify,props: {isShow: true},data() {return {x: 0, //初始距离oldx: 0, //移动的距离img: 1, //显示哪张图片left: 0, //随机拼图的最终X轴距离top: 0, //拼图的top距离};},watch: {// 每次打开重新刷新拼图isShow(newValue, oldValue) {if(newValue){this.refreshVerify(); //刷新}}},mounted() {var that this;that.refreshVerify();},methods: {//刷新验证refreshVerify() {var gl Math.random().toFixed(2);this.left uni.upx2px(560) * gl uni.upx2px(280) ? uni.upx2px(280) : uni.upx2px(560) * gl uni.upx2px(150); //生成随机X轴最终距离this.top uni.upx2px(190) * gl; //生成随机Y轴初始距离if (gl 0.2) {this.img 1;}if (gl 0.2 gl 0.4) {this.img 2;}if (gl 0.4 gl 0.6) {this.img 3;}if (gl 0.6 gl 0.8) {this.img 4;}if (gl 0.8 gl 1) {this.img 5;}this.resetMove(); //重置阴影位置},/* 滑动中 */startMove(e) {this.oldx e.detail.x;},/* 滑动结束 */endTouchMove() {var that this;if (Math.abs(that.oldx - that.left) 5) {uni.showToast({title: 验证成功,duration: 2500,success() {that.$emit(touchSliderResult, true);}});} else {that.refreshVerify();}},/* 重置阴影位置 */resetMove() {this.x 1;this.oldx 1;setTimeout(() {this.x 0;this.oldx 0;}, 300);},// 关闭closeSlider(){this.$emit(touchSliderResult, false);} } }; /scriptstyle langless .slider-verify-box {position: fixed;top: 0;left: 0;width: 100%;height: 100%;background-color: rgba(0, 0, 0, 0.5);z-index: 999; } .verifyBox {position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);// width: 85%;background-color: #fff;border-radius: 20upx;box-shadow: 0 0 5upx rgba(0, 0, 0);.slider-title {font-size: 36upx;text-align: center;padding: 1em 0;color: rgba(2, 20, 33, 0.85);border-bottom: 1px solid rgba(2, 20, 33, 0.15);}.slide-content {width: 560rpx;padding: 0 1em;margin: 0 auto;.slide-tips {font-size: 28rpx;color: rgba(2, 20, 33, 0.45);padding: 0.5em 0;}.slider-pintu {position: relative;width: 100%;border-radius: 10rpx;overflow: hidden;.pintu {width: 560rpx;height: 315rpx;display: block;margin: 0 auto;}.pintukuai {position: absolute;top: 0;left: 0;width: 120rpx;height: 120rpx;z-index: 100;box-shadow: 0 0 5upx rgba(0, 0, 0, 0.3);overflow: hidden;image {display: block;position: absolute;top: 0;left: 0;width: 560rpx;height: 315rpx;}}}.yinying {position: absolute;width: 120rpx;height: 120rpx;background-color: rgba(0, 0, 0, 0.5);}} }.slider-movearea {position: relative;height: 80upx;width: 100%;margin: 25upx auto;movable-area {height: 80upx;width: 100%;movable-view {width: 80upx;height: 80upx;border-radius: 50%;background-color: #007cff;background-image: url(../../static/images/slider-verify/icon-button-normal.png);background-repeat: no-repeat;background-size: auto 30upx;background-position: center;position: relative;z-index: 100;}} }.huadao {width: 100%;height: 66upx;line-height: 66upx;background: #eee;box-shadow: inset 0 0 5upx #ccc;border-radius: 40rpx;color: #999;text-align: center;box-sizing: border-box;position: absolute;top: 7rpx;left: 0;font-size: 28rpx;z-index: 99; }.slider-btn-group{width: 100%;display: flex;justify-content: center;align-items: center;border-top: 1px solid rgba(2, 20, 33, 0.15);.slider-btn{flex: 1;height: 100rpx;line-height: 100rpx;text-align: center;font-size: 36rpx;color:rgba(2,20,33,0.85);:active{opacity: 0.8;}}.slide-btn-refresh{color:rgba(14,107,176,1);border-left: 1px solid rgba(2, 20, 33, 0.15);} } /style二、对接口版本 平台兼容性H5、微信小程序、字节、百度、qq等XXX.vue文件引入 template标签中引入 view tapgetCode() 获取验证码/view validationPT classsetVef refvefCode VefCodeTruegetVefCodeTrue :inputPhonemobile themedialog/validationPT script标签中引入组件 import validationPT from /components/validationPT/validationPT.vueexport default {components: {slider-verify: sliderVerify},data() {},onLoad() {},methods: {// 效验手机号getCode() {this.getCodePT();},//获取弹窗getCodePT(msg) {this.$refs.vefCode.GetSlideBlockApi(); //调用图片接口获取验证图片this.$refs.vefCode.clkOpenRef(); //验证通过打开拼图验证this.$refs.vefCode.initial();//重置},// 滑块验证结果回调函数//拼图验证是否成功getVefCodeTrue(msg) {this.VefInfosBk msg;if (msg.Res true) {//获取验证码} },} }; validationPT.vue文件代码 templateview :class[{frame--dialog:theme}]view classframeBg v-showshowModal stylez-index:10/viewview classframework v-ifisVefCodeview classboxTopTitletext图形验证码/texttext classcuIcon-close font16 fontB clickclkCloseRef/text/viewview classboxImgview classcutImgSet :classisAnimation?animation::style{top:CutImgYpx, left: blockLeft px}image :srcCutImg stylecursor:pointer; width: 40px;height: 40px;z-index: 10;/image/viewimage :srcBGImg styleborder-radius:8px; width: 300px;height: 150px;/imageview classreset clickclkNexttext classcuIcon-refresh font16 text-white/text/view/viewview classcheckBoxview classcheckBarview classslide :classbgColSet?active:view :classmoveBac (isAnimation? animation:)(bgColSet? moveBacError:):stylewidth:(isSuccess ? 300 : blockLeft)px;/viewview :class(bgColSet?swiperTipsError:swiperTips) (!isSuccess? paddingL40:)text v-if!isSuccess请拖动滑块验证/texttext v-ifisSuccess classcuIcon-check margin-right-sm fontB/texttext v-ifisSuccess验证成功/text/viewview v-if!isSuccess:classswiperBlock (bgColSet? errorBlock: successBlock)(isAnimation? animation:) :styleleft:blockLeftpx refsliderBtn touchstarttouchstartHandlemousedownstartMove touchmove.stop.preventtouchmoveHandletouchendtouchendHandle!-- #ifndef MP-BAIDU --image v-if!bgColSet :srcImgUrl Images/doubleArrow.svg modewidthFixstylewidth: 16px;/imagetext v-else classcuIcon-close font16 text-white/text!-- #endif --!-- #ifdef MP-BAIDU --text v-ifbgColSet classcuIcon-close font16 text-white/text!-- #endif --/view/view/view/view/view/view /template scriptexport default {props: {inputPhone: ,theme: {type: String,},swiperColor: {type: String,default: rgba(21, 132, 223, 0.08)},title: {type: String,default: 人机校验},barWidth: {type: Number,default: 300}},data() {return {ImgUrl: this.hostwapUrl,BGImg: ,CutImg: ,CutImgY: ,MarkCode: , //验证拼图是否成功用,bgColSet: false, //拼图是否验证成功isSuccess: false, //是否验证成功isVefCode: false,showModal: false,startInfo: {},blockLeft: 0,//随机拼图的最终X轴距离isAnimation: false,msgType: ,}},computed: {trueMoveableW: function() {return this.barWidth - 40}},methods: {//获取图片接口GetSlideBlockApi() {let that this;uni.request({url: url,//获取拼图接口data: data,//需要传给接口的参数headers: {Accept: application/json; charsetutf-8},dataType: json,method: GET,success: (res) {this.BGImg ;//大图this.CutImg ;//拼图this.CutImgY 0;//接口位置},complete: () {}})},//手指按下touchstartHandle({changedTouches}) {if (this.isSuccess) {return}this.isAnimation falsethis.startInfo changedTouches[0]},// 手指移动touchmoveHandle({changedTouches}) {if (this.isSuccess) {return}let blockLeft changedTouches[0].clientX - this.startInfo.clientXlet blockLeftRpx blockLeft;if (blockLeftRpx 0) {this.blockLeft 0} else {this.blockLeft blockLeftRpx this.trueMoveableW ? blockLeftRpx : this.trueMoveableW}},// 手指离开touchendHandle(e) {if (this.isSuccess) {return}this.CheckSlideBlockApi();},//验证图片接口CheckSlideBlockApi() {let that this;uni.request({url: url,//接口名称data: data,//接口需要的参数headers: {Accept: application/json; charsetutf-8},dataType: json,method: POST,success: (res) {let infos {}if (res.data.IsOK true) {//成功that.isSuccess true;infos {Res: res.data.Results,};//返回传给父组件的值判断是否成功setTimeout(() {that.bgColSet false;that.$emit(VefCodeTrue, infos)that.isVefCode false;that.showModal false;}, 1000);} else {that.bgColSet true;that.isSuccess false;that.GetSlideBlockApi();that.isAnimation truelet timeid setTimeout(() {clearTimeout(timeid)that.isAnimation falsethat.bgColSet false;}, 500)that.blockLeft 0;}},complete: () {}})},/* 鼠标按住滑块后初始化移动监听记录初始位置 */startMove(e) {e.preventDefault() //禁止图片img拖动的解决方法e e || window.event;this.moveStart e.pageX || e.targetTouches[0].pageX;this.addMouseMoveListener();},/* 鼠标滑块移动 */moving(e) {// e.preventDefault() //禁止图片img拖动的解决方法let self this;e e || window.event;let moveX (e.pageX || e.targetTouches[0].pageX);let d moveX - self.moveStart;let w self.dataWidth;let PL_Size this.puzzleSize;let padding this.padding;if (self.moveStart ) {return ;}if (d 0 || d w - padding - PL_Size) {return ;}if (d 260) {self.blockLeft d}},/* 鼠标移动结束验证并回调 */moveEnd(e) {let self this;e e || window.event;let moveEnd_X (e.pageX || e.changedTouches[0].pageX) - self.moveStart;if (moveEnd_X 0) {self.CheckSlideBlockApi(); //验证拼图是否成功}self.moveStart ;document.removeEventListener(mousemove, self.moving);document.removeEventListener(mouseup, self.moveEnd);},/* 鼠标全局绑定滑块移动与滑动结束移动过程中鼠标可在页面任何位置 */addMouseMoveListener() {let self this;document.addEventListener(mousemove, self.moving);document.addEventListener(mouseup, self.moveEnd);},//换一张clkNext() {this.GetSlideBlockApi();},// 重置滑块位置initial() {this.blockLeft 0;this.bgColSet false;this.isSuccess false;},clkCloseRef() {this.showModal false;this.isVefCode false;},clkOpenRef(msg) {this.showModal true;this.isVefCode true;},}} /script style langscss typetext/css relstylesheet scopedscoped.framework {box-sizing: border-box;width: 332px;height: 270px;background: #fff;margin: 24px auto;z-index: 11;position: relative;padding: 0 16px;user-select: none;border-radius: 16px;}.framework .boxTopTitle {height: 48px;line-height: 48px;display: flex;justify-content: space-between;}.framework .boxImg {width: 300px;height: 150px;background: #fff;margin-bottom: 16px;border-radius: 8px;position: relative;}.reset {position: absolute;top: 0;right: 0;background-color: rgba(0, 0, 0, 0.24);border-radius: 0 8px 0 8px;padding: 0 12px;line-height: 32px;}.cutImgSet {position: absolute;}.frame--dialog {.framework {// margin: 38vh auto;z-index: 88888888;position: fixed;// top: 25vh;transform: translateX(-50%);left: 50%;}.frameBg {position: fixed;top: 0;left: 0;width: 100%;height: 100%;background-color: rgba(0, 0, 0, 0.24);z-index: 8887 !important;}}.checkBox .checkBar {width: 100%;padding: 0px;}.slide {box-sizing: border-box;width: 100%;height: 40px;line-height: 40px;border-radius: 8px;background-color: #FFFFFF;position: relative;font-size: 13px;overflow: hidden;border: 1px solid rgba(65, 157, 231, 0.56);}.slide.active {border: 1px solid #FA7F7F;}.moveBac {background-color: rgba(21, 132, 223, 0.08);width: 100%;height: 100%;}.moveBacError {background-color: rgba(216, 63, 63, 0.08) !important;}.swiperTips {box-sizing: border-box;position: absolute;left: 0;top: 0;width: 100%;color: rgba(255, 255, 255, 0.24);text-align: center;background: -webkit-gradient(linear, left top, right top, color-stop(0, #0076D6), color-stop(.4, #0076D6), color-stop(.5, #fff), color-stop(.6, #0076D6), color-stop(1, #0076D6));animation: tipsBlinkan 3s infinite;-webkit-background-clip: text;-webkit-text-fill-color: transparent;line-height: 40px;}.swiperTipsError {box-sizing: border-box;position: absolute;left: 0;top: 0;width: 100%;text-align: center;color: rgba(255, 255, 255, 0.24);background: -webkit-gradient(linear, left top, right top, color-stop(0, #FA7F7F), color-stop(.4, #FA7F7F), color-stop(.5, #fff), color-stop(.6, #FA7F7F), color-stop(1, #FA7F7F));animation: tipsBlinkan 3s infinite;-webkit-background-clip: text;-webkit-text-fill-color: transparent;line-height: 40px;}.swiperBlock {width: 40px;height: 40px;border-radius: 8px;/* #ifdef MP-BAIDU */background-repeat: no-repeat;background-size: 16px;background-position: center;/* #endif */display: flex;justify-content: center;align-items: center;position: absolute;left: 0px;top: -1px;}.successBlock {background-color: #0076D6;/* #ifdef MP-BAIDU */background-image: url(https://m.by56.com/Images/doubleArrow.svg);/* #endif */}.errorBlock {background-color: #FA7F7F !important;}.paddingL40 {padding-left: 40px;}.animation {transition: all 0.5s;}keyframes tipsBlinkan {0% {background-position: -100px 0;}100% {background-position: 100px 0;}} /style
文章转载自:
http://www.morning.bpmfn.cn.gov.cn.bpmfn.cn
http://www.morning.qfnrx.cn.gov.cn.qfnrx.cn
http://www.morning.qblcm.cn.gov.cn.qblcm.cn
http://www.morning.xhqr.cn.gov.cn.xhqr.cn
http://www.morning.hxxwq.cn.gov.cn.hxxwq.cn
http://www.morning.nwqyq.cn.gov.cn.nwqyq.cn
http://www.morning.dnbhd.cn.gov.cn.dnbhd.cn
http://www.morning.jqllx.cn.gov.cn.jqllx.cn
http://www.morning.zffps.cn.gov.cn.zffps.cn
http://www.morning.cspwj.cn.gov.cn.cspwj.cn
http://www.morning.fbmjw.cn.gov.cn.fbmjw.cn
http://www.morning.cndxl.cn.gov.cn.cndxl.cn
http://www.morning.gstmn.cn.gov.cn.gstmn.cn
http://www.morning.kjgrg.cn.gov.cn.kjgrg.cn
http://www.morning.rbzd.cn.gov.cn.rbzd.cn
http://www.morning.rdkgw.cn.gov.cn.rdkgw.cn
http://www.morning.yrnyz.cn.gov.cn.yrnyz.cn
http://www.morning.crqpl.cn.gov.cn.crqpl.cn
http://www.morning.pxlsh.cn.gov.cn.pxlsh.cn
http://www.morning.kgcss.cn.gov.cn.kgcss.cn
http://www.morning.hwbmn.cn.gov.cn.hwbmn.cn
http://www.morning.qxwrd.cn.gov.cn.qxwrd.cn
http://www.morning.rqrxh.cn.gov.cn.rqrxh.cn
http://www.morning.xxlz.cn.gov.cn.xxlz.cn
http://www.morning.skkln.cn.gov.cn.skkln.cn
http://www.morning.gwzfj.cn.gov.cn.gwzfj.cn
http://www.morning.hfrbt.cn.gov.cn.hfrbt.cn
http://www.morning.dpppx.cn.gov.cn.dpppx.cn
http://www.morning.kqbjy.cn.gov.cn.kqbjy.cn
http://www.morning.gkdhf.cn.gov.cn.gkdhf.cn
http://www.morning.qsy39.cn.gov.cn.qsy39.cn
http://www.morning.khdw.cn.gov.cn.khdw.cn
http://www.morning.rhmt.cn.gov.cn.rhmt.cn
http://www.morning.trlhc.cn.gov.cn.trlhc.cn
http://www.morning.wztnh.cn.gov.cn.wztnh.cn
http://www.morning.rkhhl.cn.gov.cn.rkhhl.cn
http://www.morning.zmwzg.cn.gov.cn.zmwzg.cn
http://www.morning.jfxdy.cn.gov.cn.jfxdy.cn
http://www.morning.rqqn.cn.gov.cn.rqqn.cn
http://www.morning.mywnk.cn.gov.cn.mywnk.cn
http://www.morning.nstml.cn.gov.cn.nstml.cn
http://www.morning.djpgc.cn.gov.cn.djpgc.cn
http://www.morning.mnccq.cn.gov.cn.mnccq.cn
http://www.morning.sjmxh.cn.gov.cn.sjmxh.cn
http://www.morning.tlfmr.cn.gov.cn.tlfmr.cn
http://www.morning.npbkx.cn.gov.cn.npbkx.cn
http://www.morning.nyqnk.cn.gov.cn.nyqnk.cn
http://www.morning.hqrkq.cn.gov.cn.hqrkq.cn
http://www.morning.muzishu.com.gov.cn.muzishu.com
http://www.morning.pgcmz.cn.gov.cn.pgcmz.cn
http://www.morning.fllfz.cn.gov.cn.fllfz.cn
http://www.morning.mrgby.cn.gov.cn.mrgby.cn
http://www.morning.dspqc.cn.gov.cn.dspqc.cn
http://www.morning.kjlhb.cn.gov.cn.kjlhb.cn
http://www.morning.xbdrc.cn.gov.cn.xbdrc.cn
http://www.morning.xknmn.cn.gov.cn.xknmn.cn
http://www.morning.pabxcp.com.gov.cn.pabxcp.com
http://www.morning.lnbcg.cn.gov.cn.lnbcg.cn
http://www.morning.qkdbz.cn.gov.cn.qkdbz.cn
http://www.morning.yhjlg.cn.gov.cn.yhjlg.cn
http://www.morning.zxqyd.cn.gov.cn.zxqyd.cn
http://www.morning.lskrg.cn.gov.cn.lskrg.cn
http://www.morning.mzhhr.cn.gov.cn.mzhhr.cn
http://www.morning.hmxrs.cn.gov.cn.hmxrs.cn
http://www.morning.xnltz.cn.gov.cn.xnltz.cn
http://www.morning.mbnhr.cn.gov.cn.mbnhr.cn
http://www.morning.tbqxh.cn.gov.cn.tbqxh.cn
http://www.morning.yggwn.cn.gov.cn.yggwn.cn
http://www.morning.zdydj.cn.gov.cn.zdydj.cn
http://www.morning.fqklt.cn.gov.cn.fqklt.cn
http://www.morning.wjjsg.cn.gov.cn.wjjsg.cn
http://www.morning.kyfnh.cn.gov.cn.kyfnh.cn
http://www.morning.tnhg.cn.gov.cn.tnhg.cn
http://www.morning.jkmjm.cn.gov.cn.jkmjm.cn
http://www.morning.dbxss.cn.gov.cn.dbxss.cn
http://www.morning.xkjqg.cn.gov.cn.xkjqg.cn
http://www.morning.tqgx.cn.gov.cn.tqgx.cn
http://www.morning.bbrf.cn.gov.cn.bbrf.cn
http://www.morning.rbjp.cn.gov.cn.rbjp.cn
http://www.morning.fgtls.cn.gov.cn.fgtls.cn
http://www.tj-hxxt.cn/news/257116.html

相关文章:

  • 做任务的网站深圳营销网站
  • 商城模板建站价格青海军区战备建设局网站
  • 3m网站源码从域名角度看网站建设注意事项
  • 2010年青海省建设厅网站大网站怎样选域名
  • dw制作简单网站模板下载网站风格分类
  • 知名的网站制作公司需要多少钱广告网站设计
  • 兰州seo整站优化服务商为什么建设部网站进不去
  • 延安市违法建设举报网站手机编程软件哪个好
  • 天河区做网站公司企业网站模板建站流程
  • 类似站酷的设计类网站做网贷网站多少钱
  • 装修设计公司网站家在深圳光明业主论坛
  • 创建一个网站网站空间费用企业网站必须备案吗
  • 建站必须要域名吗点评网站分站设计
  • 环境设计排版素材网站新公司做网站怎么做
  • 哈尔滨手机网站建设建设工程施工合同管理的原则
  • 专业模板网站制作服务什么网站详情页做的好
  • 寿光市建设局网站做视频网站应该选什么服务器
  • 公司网站建设需推广wordpress自带搜索
  • 网站主办单位变更wordpress 您没有足够的权限
  • 网站建设项目验收报告wordpress插件地图标记
  • 音乐盒网站源码北京传媒公司排行榜
  • 网站设置不能通过链接访问美食网站建设实施方案
  • 视频网站开发工程师全媒体运营技巧和工具
  • 南昌 网站制作html基本结构代码
  • 门户网站的区别网站编辑信息怎么做
  • dfv印花图案设计网站怎么在家开网店挣钱呢
  • 重庆公司企业网站建设网站建设计划表模板下载
  • 阿里云 拦截网站个人网站备案拍照
  • 农业网站建设能自己做头像的网站
  • 定制做网站报价品展示设计网站