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

iot-axios2

v1.1.12

Published

kaifangpingtai-vue2

Readme

iot-vue项目脚手架工具

介绍

基于axios封装,适用于iot-开放平台项目的http请求插件。

安装

Vue2版本:npm install iot-axios2

Vue3版本:npm install iot-axios

说明

入参

1>autoerror:string (兼容header_isPromptAbnormalInfo)

0:代表以前旧写法(默认值)

1:自动提示后台异常信息(Message提示)

2:不自动提示后台异常信息,用来请求中自定义catch方法

3:自动提示后台异常信息(MessageBox.alert提示)

注:如果需要1、3自动提示,自行引入elementUI/element-plus样式

2>hnoloading:bool

false:请求时自动显示loading(默认值)

true:请求时不显示loading

3>encryptLevel:string

0:参数为json类型数据(默认值)

1:参数为application/x-www-form-urlencoded类型数据

2:参数为multipart/form-data类型数据

4>headSignLog:bool

false:不打印header参数antiReplaySign(默认值)

true:打印header参数antiReplaySign

5>headDevice:number

0:不携带设备调用接口中的header默认配置项

1:携带设备调用接口中得header默认配置项

6>noLogin:bool

false:接口403需要自动跳转登录(默认值)

true:接口403不需要自动跳转登录

7>noHeadSign:bool

false:增加防重放、灰度等参数(默认值)

true:不增加防重放、灰度等参数

8>qiCustormCode:string | number

'00000': 默认值

其他:自定义请求成功状态码

9>qiCustormStatus: string

'retCode': 默认值

其他:自定义请求状态key值

10>qiCustormMsg: string

'retInfo': 默认值

其他:自定义请求失败错误信息key值

登录过期回调函数:window.loginDateCallback

使用

1>iotAxios:正常axios库

2>iotExtpost:

请求地址为:/managecenter-api/ext/${serveName}/post 的请求,参数(params,serveName):

params: 请求入参

serveName:地址中${serveName}的值,默认为hardware

3>iotExtget:

请求地址为:/managecenter-api/ext/${serveName}/get 的请求,参数(params,serveName):

params: 请求入参

serveName:地址中${serveName}的值,默认为hardware

示例

import { axiosapi } from '@/assets/js/api';
import { iotAxios, iotExtpost, iotExtget} from 'iot-axios2';
export default {
  name: 'App',
  created () {
    //iotAxios
    iotAxios({
      method: 'post',
      url: `${axiosapi}/intelligenceapp/user/app/list`,
      data: {
        pageNum: 1,
        pageSize: 10,
        queryParam: '',
        hnoloading: true
      }
    }).then((res) => {
      console.log(res)
    })
    //iotExtpost
    iotExtpost({
      autoerror: 1,
      url: '/modelType/appTypeInfoList'
    }).then((res) => {
      console.log(res)
    })
    //iotExtget
    iotExtget({
      headSignLog: 1,
      url: '/modelType/appTypeInfoList'
    }).then((res) => {
      console.log(res)
    })
  }
}

封装

window.loginDateCallback = function(){	//登录过期时会自动调用
  let curPath = window.location.href
  if(curPath) {
    const route = `./index.html#/login?backurl=${encodeURIComponent(curPath)}`
    if(top!=self) {
      window.parent.location.replace(route)
    } else {
      window.location.replace(route)
    }
  }
}

import { iotAxios } from 'iot-axios2'
const env = process.env.NODE_ENV  
export const baseapi = env === 'development' ? '/apiprod' : ''
/**
  * @description: 封装请求类
  * @param {method} method 请求方式
  * @param {path} path 请求路径
  * @param {params} params 参数
  * @param {headers} headers 请求头
  */
export const iotRequest = (method, path, params, headers) => {
  if (method.toLowerCase() === 'get') {
    return iotAxios.get(baseapi + path, { params: params }, headers)
  } else {
    return iotAxios.post(baseapi + path, params, headers)
  }
}

// 使用
import { iotRequest } from '@/apis/api'
export const fnLogout = (params) => {
  return iotRequest('post', '/developercenter-api/index/logout', params)
}