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

tianai-captcha-a

v1.0.1

Published

tianai前端验证码

Downloads

5

Readme

(captcha-web-sdk)

是一个(TIANAI-CAPTCHA)验证码前端脚手架工具

原生HTML使用方法

注:tac.min.jstac.css` 作者已经打包好放到(gitee)release中,可自行下载使用

  1. 导入tac.min.jstac.cssjquery

    <link href="styles/tac.css" rel="stylesheet">
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="tac.min.js"></script>
  2. 创建一个div快用于渲染验证码

     <div id="captcha-box"></div>
  3. 在需要调用验证码的时候执行加载验证码方法

    const config = {
        // 生成接口 (必选项,必须配置, 要符合tianai-captcha默认验证码生成接口规范)
        requestCaptchaDataUrl: "/gen",
        // 验证接口 (必选项,必须配置, 要符合tianai-captcha默认验证码校验接口规范)
        validCaptchaUrl: "/check",
        // 验证码绑定的div块 (必选项,必须配置)
        bindEl: "#captcha-box",
        // 验证成功回调函数(必选项,必须配置)
        validSuccess: (res, c, tac) => {
            console.log("验证成功,后端返回的数据为", res);
            alert("验证成功");
            // 销毁验证码服务
            tac.destroyWindow();
        },
        // 验证失败的回调函数(可忽略,如果不自定义 validFail 方法时,会使用默认的)
        validFail: (res, c, tac) => {
            // 验证失败后重新拉取验证码
            tac.reloadCaptcha();
        }
    }
     // 创建 TAC 启动验证码服务,调用该方法后会在指定的div块中渲染出验证码
    new TAC(config).init();

VUE2使用方法

导入tac.min.jstac.cssjquery 后和原生使用方法调用即可

<template>
  <div class="login-div">
    <div class="kuang"><span class="kuang-left">用户名</span>天爱有情</div>
    <div class="kuang"><span class="kuang-left">密码</span>*********</div>
    <div id="login-btn" @click="loginBtn">登录</div>
    <div id="captcha-div"></div>
  </div>
</template>

<script>
    import "@/assets/captcha/css/tac.css" // 验证码css
    import "@/assets/captcha/js/jquery.min.js"; // 验证码js
    import "@/assets/captcha/js/tac.min.js"; // 验证码js
    
    export default {
        methods: {
            loginBtn() {
                // 样式配置
                const config = {
                    requestCaptchaDataUrl: "http://localhost:8083/gen/random",
                    validCaptchaUrl: "http://localhost:8083/check3",
                    bindEl: "#captcha-div",
                    // 验证成功回调函数
                    validSuccess:(res,c,tac)=> {
                        this.login();
                        tac.destroyWindow();
                    }
                }
                new window.TAC(config).init();
            },
            login() {
                alert("登录成功")
            }
        }
    }
</script>

其它框架使用方法

导入写好的tac.min.jstac.css即可, 或者把该项目复制到自己项目用使用即可

一些扩展功能

去除或者替换默认的logo

let config ={...}
let style = {logoUrl: null}// 去除logo             
//let style = {logoUrl: "/xx/xx/xxx.png"}// 替换成自定义的logo             
new TAC(config,style).init();

对滑块的按钮和背景设置为自定义的一些样式

// 这里分享一些作者自己调的样式供参考
const style =    {
    	// 按钮样式
        btnUrl: "https://minio.tianai.cloud/public/captcha-btn/btn3.png",
    	// 背景样式
        bgUrl: "https://minio.tianai.cloud/public/captcha-btn/btn3-bg.jpg",
    	// logo地址
        logoUrl: "https://minio.tianai.cloud/public/static/captcha/images/logo.png",
 		// 滑动边框样式
    	moveTrackMaskBgColor: "#f7b645",
        moveTrackMaskBorderColor: "#ef9c0d"
    }
new TAC(config,style).init();