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

@zat-design-pro-component/pro-login

v1.0.23

Published

基于 antd@4 版本开发

Downloads

40

Readme

快速上手

基于 antd@4 版本开发

安装

npm 或 yarn 安装

# npm
$ npm install @zat-design-pro-component/prologin --save

# yarn
$ yarn add @zat-design-pro-component/prologin

使用

  1. 可通过 npm 包进行引用

import { useEffect, useReducer, useState } from 'react';
import { ProLogin } from '@zat-design-pro-component/prologin';
import { accountLogin } from '@/services/login';
import QRcode from '../../assets/QRcode.png';

const Login = () => {
  const query = new URLSearchParams(window.location.search);
  const redirectUrl = query.get('redirectUrl') || query.get('target') || '';
  const [errorMsg, setErrorMsg] = useState('');
  const [QRCodeImg, setQRCodeImg] = useState('');

  const redirect = () => {
    window.location.replace(window.decodeURIComponent(redirectUrl));
  };
  const isLogin = () => {
    return false;
  };

  const fetchQR = () => {
    setQRCodeImg(QRcode);
  };

  const handleGetVerificationCode = () => {};

  const handleLogin = (value: any) => {
    // TODO
    accountLogin({
      loginName: value.username,
      passwd: value.password,
    }).then((res) => {
      if (res.code === '0') {
        const userInfo: UserInfo = {
          userName: res.data.name,
          companyName: res.data?.companyName,
          custId: res.data.custId,
          token: res.data.za_itid,
          orgCustId: res.data?.za_orgCustId,
          menu: [],
        };
        localStorage.setItem('userInfo', JSON.stringify(userInfo));
        setTimeout(() => {
          redirect();
        }, 100);
      } else {
        setErrorMsg(res.message);
      }
    });
  };
  const handleRegister = () => {};
  const handleNextStep = () => {
    return true;
  };
  const handleUpdatePwd = () => {
    return true;
  };

  const handleSwitchLoginType = () => {
    setErrorMsg('');
  };

  useEffect(() => {
    // 检查是否已经登录已经登录则跳转redirecturl页面
    if (isLogin()) {
      redirect();
      return;
    }
    fetchQR();
  }, []);

  return (
    <ProLogin
      title="系统名称"
      subTitle="一句话简介系统带来的价值、好处或功能特点"
      // carousel={[imageOne]}
      notice="【公告】基于公司信息安全管理和安全审计管理规定,目前正在各职场逐步实施部署网络准"
      errorMessage={errorMsg}
      showReturn
      // logo={logo}
      hasQuickLogin
      hasRegister
      QRCode={QRCodeImg}
      hasSliderValidate
      registerType="phone"
      retrievePwdType={['phone', 'email']}
      registered={false}
      onGetVerificationCode={handleGetVerificationCode}
      onLogin={handleLogin}
      onRegister={handleRegister}
      onNextStep={handleNextStep}
      onUpdatePwd={handleUpdatePwd}
      validateScene=""
      QRType="weChat"
      showAutoLogin={false}
      showMobileAreaCode={false}
      copyrightPdf="dsaf"
      privacyPdf="ddddd"
      showInviteCode={false}
      onSwitchLoginType={handleSwitchLoginType}
    />
  );
};

export default Login;

组件库打包发布

npm run build

npm publish --registry https://registry.npmjs.org --access=public