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

lazy-slide-captcha_bxxhobo

v1.0.5

Published

滑动验证模块,配合接口使用,原版lazy-slide-captcha,添加图片滑动

Downloads

2

Readme

LazySlideCaptcha前端组件使用

安装

npm i lazy-slide-captcha_bxxhobo

项目引入

输入图片说明

import LazySlideCaptcha from 'lazy-slide-captcha_bxxhobo'
import 'lazy-slide-captcha/dist/lazy-slide-captcha.css';

Vue.use(LazySlideCaptcha);

页面使用

<template>
  <div class="hello">
    <lazy-slide-captcha
      ref="captcha"
      :width="width"
      :height="height"
      :show-refresh="true"
      :fail-tip="failTip"
      :success-tip="successTip"
      @finish="handleFinish"
      @refresh="generate"
    >
    </lazy-slide-captcha>
  </div>
</template>

<script>
import axios from 'axios';

export default {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  data () {
    return {
      requestId: undefined,
      failTip: '',
      successTip: '',
      // width,height保持与552 * 344同比例即可
      width: 340,
      height: 212
    }
  },
  mounted () {
    this.generate()
  },
  methods: {
    generate () {
      // 改变内部状态,标识生成请求开始
      this.$refs.captcha.startRequestGenerate()

      axios.get('https://localhost:7179/api/captcha/gen')
        .then((response) => {
          this.requestId = response.data.id
          // 改变内部状态,标识生成请求结束,同时设定background,slider图像
          this.$refs.captcha.endRequestGenerate(response.data.backgroundImage, response.data.sliderImage)
        })
        .catch((error) => {
          console.log(error);
          // 标识生成请求结束
          this.$refs.captcha.endRequestGenerate(null, null)
        });
    },
    handleFinish (data) {
      // 改变内部状态,标识验证请求开始
      this.$refs.captcha.startRequestVerify()

      axios.post(`https://localhost:7179/api/captcha/check?id=${this.requestId}`, data)
        .then((response) => {
          let success = response.data.result === 0
          // 验证失败时显示信息
          this.failTip = response.data.result == 1 ? '验证未通过,拖动滑块将悬浮图像正确合并' : '验证超时, 请重新操作'
          // 验证通过时显示信息
          this.successTip = '验证通过,超过80%用户'
          // 改变内部状态,标识验证请求结束,同时设定是否成功状态
          this.$refs.captcha.endRequestVerify(success)

          if (!success) {
            setTimeout(() => {
              this.generate()
            }, 1000)
          }
        })
        .catch((error) => {
          console.log(error);
          this.failTip = '服务异常,请稍后重试'
          // 标识验证请求结束
          this.$refs.captcha.endRequestVerify(false)
        });
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>