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

winning-request

v1.0.9

Published

request for winning-finance

Downloads

10

Readme

wining-request

费用域基于axois封装的request插件

安装

将npm源切换为winning

npm install @winning-plugin/request -S

或者

yarn add @winning-plugin/request -S

使用

@winning-plugin/request 本质上为一个js类,核心功能提供了生成和后端交互的方法,

1、 初始化

import Request from '@winning-plugin/request'
import { Message } from 'element-ui'

export const request = new Request({
  baseURL: 'http://172.16.6.213:41200' || '/finance-mdm',
  Message,
  isAddSoid: false
})

export default request

2、 生成请求

/** 本服务计费 */
import request from '...'
export const addOriginService = request.temp(url, {
  failTxt: '本服务计费设置添加失败!',
  successTxt: '本服务计费设置添加成功!',
  warning: false,
  refixFn: function (data) {
  	...
	return data
  },
  checkFn: function (data) {
	 ...
	 return data
	}
})

3、页面中调用

import { addOriginService } from '...'
addOriginService({
	...  // 入参
}, [{
	... // 个性化配置 (非必需,可覆盖之前的配置信息)
}]).then(res => {
...
})

配置说明(config)

考虑同一个api在不同的页面有不同的应用场景,winning-request 提供了三层配置场景,你可以在初始化生成请求方法页面方法调用、后面的配置参数会覆盖之前的配置。

| Param Name | Required | Description | |--------|----------|-------------| | Message | 是 | 统一报错的方法 | | devBaseUrl | 否 | 本地开发接口前缀,不传的话为空字符串 | | proBaseUrl | 否 | 打包后的接口前缀,不传的话为空字符串 | |isAddSoid | 否 |是否统一加hospitalSOID, 默认为 true | |warning| 否| 接口出错时是否提示,默认为ture | |login| 否| 是否需要登录,默认为true | |refixFn|否| 在请求发出前对入参重新定义的方式,无默认值| |checkFn| 否| 在请求发出前,对入参进行校验的方法,未通过则取消请求,无默认值| |checkWarning| 否| 当checkFn 未通过时,是否提示错误信息, 默认为true|