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

slider-captcha-rc

v1.0.0

Published

一款与后端jar包配合使用的验证码生成并校验的工具。

Downloads

4

Readme

一款与后端jar包配合使用的验证码生成并校验的工具。

引用方式: npm i gobestsoft-component-slider-captcha

使用方式

import {SliderCaptcha} from 'gobestsoft-component-slider-captcha'
import "gobestsoft-component-slider-captcha/dist/gobestsoft-component-slider-captcha.cjs.development.css";

<SliderCaptcha
   request={request}
   onSuccess={async(params)=>{
        {/* 接口调用,以返回值用res接收为例*/}
        if(res === true){
          return Promise.resolve(); //验证成功
        }else{
          return Promise.reject(); //验证失败
        }
    }}
/>

如果需要在多处使用该组件,只需在项目主入口引入css即可。 其中reques为请求图片信息的接口方法。要求返回格式为:

  type request = ()=>Promise<{
    result:{
      id:string;//图片的id
      captcha:{
        backgroundImageWidth: number; //背景图宽度
        backgroundImageHeight: number; //背景图高度
        templateImageWidth: number; // 滑块图宽度
        templateImageHeight: number; // 滑块图高度
        backgroundImage: string; // 背景图地址
        templateImage: string; // 滑块图地址
      }
    }
   }>

onSuccess 为滑块拖动结束后的回调,使用方在此时调用对应的业务接口。 函数的参数params包括:图片ID,验证码信息:验证码的轨迹路径、滑动的开始和结束时间,背景的宽高。

ts类型结构为:

type params ={
  id:string; //图片id
  captchaTrack: {
    bgImageWidth: number;
    bgImageHeight: number;
    trackList: {
        x: number;
        y: number;
        type: "move" | "up" | "down";
        t: number;
    }[];
    endSlidingTime: string;
    startSlidingTime: string;
  };
}

`

​ onSuccess的返回值: ​ Promise.resolve() 验证成功 ​ Promise.reject() 验证失败

补充说明

后端jar包使用方式以及vue版本的滑动验证码参考:https://www.npmjs.com/package/slider-captcha-vue