Giter Club home page Giter Club logo

vue2-verify's Introduction

vue2-verify

寻求继续维护者

前端做验证码感觉其实意义不是很大,目前也用不上,所以没有继续维护下去的动力了,希望有人可以正常接手

基于https://github.com/Hibear/verify 的验证码项目
项目验证码类型请查看

支持的验证码类型

  1. 常规验证码picture 常规的验证码由数字和字母构成,用户输入不区分大小写,可变形成汉字验证。
  2. 运算验证码compute 运算验证码主要通过给出数字的加减乘运算,填写运算结果进行验证。
  3. 滑动验证码slide 通过简单的滑动即可完成验证,应用与移动端体验很好。
  4. 拼图验证码puzzle 拼图。
  5. 选字验证码pick 通过按顺序点选图中的汉字完成验证,ie浏览器要求9或以上。

请记住一件事!

纯前端是可以被别人绕过验证的!

todo

  1. 添加在线演示和修改

文档

如何使用

npm i vue2-verify

事件

参数 说明
ready 验证码初始化成功的回调函数。
success 验证码匹配成功后的回调函数。如要重新初始化:success:function(obj){obj.refresh();}。
error 验证码匹配失败后的回调函数。

常规验证码picture

参数说明

参数 说明
type 验证码type为picture或者1
width 常规验证码的宽,支持百分比形式设置,如:width:100%。
height 常规验证码的高,支持百分比形式设置,如:height:10%。
fontSize 常规验证码中的字母&数字的字体大小,默认为30px。
codeLength 常规验证码中显示的验证码个数,默认为6。

运算验证码compute

参数说明

参数 说明
type 验证码type为compute或者2
figure 运算验证码的位数,默认是100以内的数字,即两位数。如果是要设置三位数,则设置figure:1000。
arith 算法选择,支持加、减、乘。设置为1至3分别代表加减乘,0为随机切换。。
width 运算验证码的宽,支持百分比形式设置,如:width:100%。
height 运算验证码的高,支持百分比形式设置,如:height:10%。
fontSize 运算验证码中的数字的字体大小,默认为30px。
showButton 是否显示确定按钮,默认为true

滑动验证码slide

参数说明

参数 说明
type 验证码type为slide或者3
vOffset 滑动验证码的误差量,如:误差量为5px就能完成验证,设置vOffset:5。
explain 滑动条内的提示,不设置默认是:向右滑动完成验证。
barSize 其中包含了width、height两个参数,分别代表滑动条的宽度和高度,支持百分比方式设置,如:{width:'100%',height:'40px'}
showButton 是否显示确定按钮,默认为true

拼图验证码puzzle

参数说明

参数 说明
type 验证码type为puzzle或者4
mode 验证码的显示方式,弹出式pop,固定fixed,默认是:mode : 'fixed'。
vOffset 滑动验证码的误差量,默认单位是px。如:误差量为5px就能完成验证,设置vOffset:5。
vSpace 验证码图片和移动条容器的间隔,默认单位是px。如:间隔为5px,设置vSpace:5。
explain 滑动条内的提示,不设置默认是:'向右滑动完成验证'。
imgUrl 背景图片的地址,不设置默认是:'images/'。
imgName 验证码背景图的数组集合,默认从images目录中进行读取,如 ['1.jpg', '2.jpg']。
imgSize 其中包含了width、height两个参数,分别代表图片的宽度和高度,支持百分比方式设置 如:{width:'100%',height:'200px'}。
blockSize 其中包含了width、height两个参数,分别代表拼图块的宽度和高度,如:{width:'40px',height:'40px'}。。
barSize 其中包含了width、height两个参数,分别代表滑动条的宽度和高度,支持百分比方式设置,如:{width:'100%',height:'40px'}
showButton 是否显示确定按钮,默认为true

选字验证码pick

参数说明

参数 说明
type 验证码type为pick或者5
mode 验证码的显示方式,弹出式pop,固定fixed,默认是:mode : 'fixed'。
defaultNum 验证码中出现的文字数量,如要默认4个字
checkNum 验证码中要求比对的文字数量,如要按序比对2个字
vSpace 验证码图片和移动条容器的间隔,默认单位是px。
imgUrl 背景图片的地址,不设置默认是:'images/'。
imgName 验证码背景图的数组集合,默认从images目录中进行读取,如 ['1.jpg', '2.jpg']。
imgSize 其中包含了width、height两个参数,分别代表图片的宽度和高度,支持百分比方式设置 如:{width:'100%',height:'200px'}。
barSize 其中包含了width、height两个参数,分别代表滑动条的宽度和高度,支持百分比方式设置,如:{width:'100%',height:'40px'}
showButton 是否显示确定按钮,默认为true
// 基础用例

<template>
      <Verify @success="alert('success')" @error="alert('error')" :type="1"></Verify>
</template>


<script>
    import Verify from 'vue2-verify'

    export default {
        name: 'app',
        methods: {
            alert(text) {
                console.log(text)
            }
        },
        components: {
            Verify
        }
    }
</script>

vue2-verify's People

Contributors

chenweibo avatar leixuesong avatar mizuka-wu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue2-verify's Issues

使用正常,打包报错

你好,我使用验证码组件的时候正常运行,但是打包的时候就会报错,无法使用。
image

代码有毒,找了好久低版本安卓打开白屏原因

代码有毒,找了好久低版本安卓打开白屏原因是因为用了这个插件

安卓低版本,安卓5.1版本

https://github.com/mizuka-wu/vue2-verify/blob/master/src/lib/util.js
util.js最末几行代码居然加了几个 const 把const 改为var就可以了

export const _code_chars = [1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
export const _code_color1 = ['#fffff0', '#f0ffff', '#f0fff0', '#fff0f0']
export const _code_color2 = ['#FF0033', '#006699', '#993366', '#FF9900', '#66CC66', '#FF33CC']

按demo引入后,loader报错

按demo文档引入后,loader报错如下图,
image
看了issues,以往有回答说是webpack问题,所以修改了babel-loader,如下图,
image
报错依旧一样。请问是什么原因导致的呢?

IE9下报错

项目用的框架是VUE,然后在IE9之中报错语法错误,看了下,是utils.js里面的const没被转成es5,改成
var _code_chars = [1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
var _code_color1 = ['#fffff0', '#f0ffff', '#f0fff0', '#fff0f0']
var _code_color2 = ['#FF0033', '#006699', '#993366', '#FF9900', '#66CC66', '#FF33CC']
export {_code_chars,_code_color1,_code_color2} 就好了

在vue 中引入报错,找不到依赖

1 首先 通过 npm i vue2-verify 安装
2 在 所在的组件中 通过
import Verify from 'vue2-verify';
查看node_modules 有此包
但是说找不到依赖 。求解,本人新手一枚

当type设置为5时,设置图片时报错

:imgUrl="imgUrl" :imgName="imgName"我用这种形式设置背景图的时候给参数设值为imgUrl: 'src/assets/' imgName: ['back.jpg']。这个路径是有图片的,但项目启动就没有背景图的,提示也是直接显示验证失败。
我下载了这个插件的源码,在源码的App.vue里做了一样操作,背景图能正常出来,插件形式引进来做这个操作就不行了。请问有解决方法吗。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.