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 🙏

© 2026 – Pkg Stats / Ryan Hefner

star-verificate-library

v1.1.8

Published

基于业务系统的验证库:短信验证、图片验证、极验证、谷歌验证等

Readme

star-verificate-library

薪火科技基于 vueiview 的二次校验库

一、极验证

配置参考地址: 官方文档

效果图:

极验证

I. 极验证实例化 new VerificateLibrary.Geetest({url, callback, [options]})
 a. url 获取极验证信息的地址
 b. callback 回调函数,参数为极验证的实例 captchaObj
 c. options 可选的极验证配置,e.g. 宽度width、语言lang
II.captchaObj实例挂载到节点

e.g. 在 `vue` 组件中使用

	import VerificateLibrary from 'star-verificate-library'

	export default {
	  name: 'Geetest',
	  data () {
	    return {
	      geetestObj: null
	    }
	  },
	  methods: {
	    geeCb (captchaObj) {
	      let hadGeetest = this.$refs.geetestBox.childNodes.length
	      if (hadGeetest) captchaObj.destroy()
	      captchaObj.appendTo(this.$refs.geetestBox)
	    },
	    geetest () {
	      if (!this.geetestObj) {
	        this.geetestObj = new VerificateLibrary.Geetest({
	          url: 'http://api.bitotc.bench.bitpay.com/uc/captcha/mm/gee',
	          callback: this.geeCb
	        })
	      }

	      this.geetestObj.validate()
	    }
	  }
	}

二、信息验证(手机验证码、邮箱验证码等)

效果图:

信息验证

I. 信息验证实例化 new VerificateLibrary.Msgtest(this.$casClient)注意此处需要传入一个casClient 实例
II. 初始化内部验证模态框 Msgtest.initModal(vue, callback, [options])
  a.vue 为一个参数为一个vue实例;
  b.callback 为校验结果的回调,其参数值类型为 Boolean;
  c.options 可选配置项,可自定义倒计时时间 e.g.{ startTime: 30 }

e.g. 在 vue 组件中使用

	import VerificateLibrary from 'star-verificate-library'

	// ...
	methods: {
	  msgTest () {
	    let msgtest = new VerificateLibrary.Msgtest(this.$casClient)
	    msgtest.initModal(this, res => {
	  	  // do something...
	    })
	  }
	}
   	// ...

: 如果需要自定义模态框,需要调用该实例的方法

  • getCasCaptcha() 获取验证码
  • checkCaptcha(code) 校验验证码 参数为 code,返回一个 Promise,值类型为 Boolean

信息验证模块 备注:

/** _ 暂缺功能: _ 1. 验证码的正则验证限制 _ 2. 国际化 _/

三、谷歌验证

效果图:

信息验证

I. 谷歌验证实例化
II. 调用验证方法

注:调用方法与前两个相似,不再赘述,参考以下使用,可传入 onSuccessonError 回调函数

// ...
 methods: {
     googleSend () {
      // 生成

      let url = this.$axios.defaults.baseURL

      this.GoogletestInstance.generate({
        url: `${url}/profile/googleAuth/send`,
        callback: this.googletestCb
      })
    },
    googleBind () {
      // 绑定
      let url = this.$axios.defaults.baseURL
      this.GoogletestInstance.bind({
        url: `${url}/profile/googleAuth/bind`,
        data: qs.stringify(this.formData),
        onSuccess: this.bindSuccess,
        onError: this.bindError
      })
    },
    bindSuccess () {
      this.$Message.success('绑定成功!')
    },
    bindError () {
      this.$Message.error('绑定失败!')
    },
    googleTest () {
      // 验证
      let casUrl = this.$casClient.basePath
      this.GoogletestInstance.check({
        casUrl,
        code: this.formCheck.code,
        tgt: window.localStorage.getItem('TGC'),
        onSuccess: this.testPass,
        onError: this.testFailed
      })
    },
    testPass () {
      this.$Message.success('验证通过!')
    },
    testFailed () {
      this.$Message.error('验证未通过!')
    }
}
// ...

四、图片验证

效果图:

图片验证

图片验证比较简单 参考以下使用

  // ...
  methods: {
    imagetest () {
      let Imagetest = new VerificateLibrary.Imagetest({
        url: 'http://api.bitotc.bench.bitpay.com/uc/captcha/mm/img'
      })
      this.imageCode = Imagetest.validate()
    }
  }
 // ...