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

uniondrug

v1.4.48

Published

### 1.安装 ``` npm install uniondrug ``` ### 2.提示 登录方法unionLogin()会自动把token保留在Cookie的union_token中, 也会返回完整的response可以手动再处理。

Readme

Usage

1.安装

npm install uniondrug

2.提示

登录方法unionLogin()会自动把token保留在Cookie的union_token中, 也会返回完整的response可以手动再处理。

如果登录渠道是wechat,还会保留在wechat_token(含openid信息)中, 所以获取token最好也要使用通用方法getToken()来获取。

3.使用(示例)

import uniondrug from 'uniondrug';

//获取token
//会根据浏览器环境取wechat_token(含openid信息)或者union_token
uniondrug.getToken()

//手动跳转统一登录界面 非公共登录页一般不需要用到
uniondrug.navigatorToUnionLogin();

//无感登陆 如果不传参数,那么会取当前url中的参数。
uniondrug.unionLogin({loginType:'wanda',
                       needForceLogin:'0',
                        code:this.$route.query.code,})
            .then(response=>{
                console.log('response',response);
            });
/**
 *  1.必传字段 loginType  (mobile,encrypted,lptoken,weixin,wanda,ylapp,ydbapp,fesco,ght,qyWechat)
 *  2.needForceLogin
 *        传'0'代表授权失败不会自动跳转
 *        公共登录页可以传入'0',然后自己处理授权失败
 *        普通工程可以不传,授权失败自动跳转到公共手动登录页
 *  3.loginType对应类型下的参数

 *
 * loginType=mobile
 * @param {string}  mobile  - 手机号
 * @param {string}  code    - 验证码
 * @param {string} 可选  [type]    - wechat——微信;QJB——企建部;GHT——工会通;WANDA——万达;qywechat-企业微信
 * @param {string} 可选 [openid]   - 微信渠道openid
 * @param {string} 可选 [memberSource]   - memberSource
 * https://xxx.uniondrug.cn/index.html?loginType=mobile&mobile=xxx&code=xxx&type=xxx&openid=xxx&memberSource=



 *
 * loginType=encrypted

 * @param encryptedMobile   {string}            手机号加密字符串
 * @param code              {string}            微信code
 * https://xxx.uniondrug.cn/index.html?loginType=encrypted&encryptedMobile=xxx&code=xxx




 * loginType === lptoken
 *
 * @param token     {string}            令牌中心(token.module)的token
 * @param code      {string}            微信code
 * https://xxx.uniondrug.cn/index.html?loginType=lptoken&token=xxx&code=xxx




 * loginType === weixin
 *
 * @param code  {string}                微信code
 * https://xxx.uniondrug.cn/index.html?loginType=weixin&code=xxx



 * loginType === wanda
 *
 * @param code  {string}                万达 auth code
 * https://xxx.uniondrug.cn/index.html?loginType=wanda&code=xxx



 * loginType === ylapp
 *
 * @param token     {string}            药联app传的token
 * https://xxx.uniondrug.cn/index.html?loginType=ylapp&token=xxx



 * loginType === ydbapp
 *
 * @param token     {string}            药店宝app传的token
 * https://xxx.uniondrug.cn/index.html?loginType=ydbapp&token=xxx



 * loginType === fesco
 *
 * @param name      {string}            name
 * @param mobile    {string}            mobile
 * @param card      {string}            card
 * @param token     {string}            Fesco传入的验证token
 * https://xxx.uniondrug.cn/index.html?loginType=fesco&name=xxx&mobile=xxx&card=xxx&token=xxx


 * loginType === yiyao
 *
 * @param openid        {string}            openid
 * https://xxx.uniondrug.cn/index.html?loginType=yiyao&openId=xxx

 * loginType === qyWechat
 *
 * @param code  {string}            企业code
 * https://xxx.uniondrug.cn/index.html?loginType=qyWechat&code=xxx
 */