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

@qse/edu-login

v1.8.12

Published

教育公共登录工具,根据环境自动判断登录方式

Downloads

6

Readme

教育公共登录

教育公共登录工具,根据环境自动判断登录方式

支持钉钉跳转浏览器、浏览器、钉钉、支付宝、微信

安装

请在私库里下载安装

npm i @qse/edu-login

使用

import { eduLogin } from '@qse/edu-login'

async function main() {
  const config = await eduLogin()

  // 也可以选择开发环境登录方式,返回默认配置的登录人信息
  const config = await eduLogin(true)
}

登录方式

以下说明按登录优先级排序

  • 链接上加 webskip=1 参数可以默认人员免校验登录,直接返回默认配置的登录人信息,
  • 链接上加 token=xxx 参数,可实现登录信息交换,例如钉钉->浏览器,必须要有局校关系。token 登录目前仅支持 https 协议
  • iframeparent_user 属性,直接返回父页面登录信息
  • 微信登录、支付宝登录、钉钉登录
  • 最后使用有权限校验的浏览器登录

特性

  • 钉钉环境自动加载 ddjsapi
  • 链接有 vconsole=1 参数时,加载 VConsole 模块
  • 链接上加 webskip=1 参数可以默认人员免校验登录,再指定 corpId uid campusid 参数可以实现精确人员登录

测试

以下代码仅用来测试登录效果,实际只需调用eduLogin()即可

import { eduLogin } from '@qse/edu-login'
import React, { useState, useEffect } from 'react'
export default function App() {
  const [config, setConfig] = useState()

  useEffect(() => {
    const fn = async () => {
      try {
        const res = await eduLogin()
        setConfig(JSON.stringify(res, null, 2))
      } catch (e) {
        console.error(e)
        setConfig(`${e.name}:${e.message}`)
      }
    }
    fn()
  }, [])

  const s = (search: string) => {
    window.location.search = search
  }

  const logout = () => {
    document.cookie = '__TTOKEN=;expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'
    document.cookie =
      'JSESSIONID=;expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'
  }

  return (
    <div>
      <button onClick={() => s('webskip=1')}>webskip默认人员登录</button>
      <button onClick={() => logout()}>清空登录信息</button>
      <h5>登录结果(其他登录方式需要在各自环境中测试)</h5>
      <pre>{config}</pre>
    </div>
  )
}

开发

# 开发
yarn start

# 发布npm
yarn release

# 部署文档
yarn deploy