npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-social-captcha

v0.1.1

Published

> 一个集极验验证、腾讯验证的vue组件

Downloads

584

Readme

vue-social-captcha

一个集极验验证、腾讯验证的vue组件

截图

依赖

安装

$ npm install vue-social-captcha -S

使用

main.js 文件中引入插件并注册

# main.js
import captcha from 'vue-social-captcha'
Vue.use(captcha)

在项目中使用 vue-social-captcha

<template>
    <div id="app">
        <Captcha
            id="Captcha"
            scene="Login"
            type="Geetest"
            :parm="captchaOption"
            @callback="captchaNotice"
            url="http://pay.test.com/admin/captcha/"
        >
            <input id="Captcha" type="button" value="登陆"/>
        </Captcha>
    </div>
</template>

<script>
export default {
    name: 'app',
    data () {
        return {
            captchaOption: {
                // 各平台的参数,具体请参阅个平台文档
                // 以下为腾讯验证码的参数
                // appid: '',
                // 以下为极验验证码的参数
                product: 'bind',
            }
        }
    },
    methods: {
        // 回调监听
        // status: 1成功,2验证中,0失败
        // res: 三方返回的原始数据
        captchaNotice(status, res){
            console.log(status)
            console.log(res)
        }
    }
}
</script>

props属性

通过以下属性来设置你的验证码

| 属性 | 说明 | 类型 | 默认值 | 必须 | | ------------ | ------------ | ------------ | ------------ | ------------ | | parm | 验证码参数(请参阅各平台文档) | Object | 无 | 是 | | url | 后端验证地址,返回格式请参阅下面的【数据返回格式】 | String | 无 | 是 | | type | 验证码类型,可选参数 TencentCaptcha Geetest | String | 无 | 是 | | id | 绑定元素id | String | 无 | 是 | | scene | 使用场景,会传递给后端,主要用于后端业务逻辑 | String | 无 | 是 |

服务端Url请求

请求

url请求时会附带以下两个参数到服务端,以便于业务逻辑开发。

{
    g_type: 'TencentCaptcha',
    g_scene: 'Login',
}

数据返回格式

服务端返回参数主要有三个,分别是code msg data

| 属性 | 说明 | 必须 | | ------------ | ------------ | ------------ | | code | 验证码状态,有2个值,1为成功,0为失败 | 必须 | | msg | 说明文本 | 否 | | data | 当验证码类型为Geetest时该数据必须 | 否 |

例:

// 极验验证
{
    "code":1,
    "msg":"验证成功",
    "data":
    {
        "success":1,
        "gt":"29e4e065c7ba05ff77ba896e5d577f89",
        "challenge":"bd26076b3afe9ed3c17738f3f8a7eec7",
        "new_captcha":1
    }
}
// 腾讯验证
{
    "code":1,
    "msg":"验证成功"
}

相关资源