🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@hbgj/common

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@hbgj/common

hbgj 公共功能

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
3
Created
Source

公共功能汇总

npm npm npm bundle size Travis (.org)

本组件依赖 Promise

引入Promise支持推荐做法

暂时不支持个别组件按需加载,价值不大

METHODS

methodparamsTypereturndescription
App.getTicketListJSONurl生成机票列表页链接
App.getTicketDetailJSONurl生成机票详情页链接
App.getCouponsListnullurl生成优惠券列表页链接
App.getHomenullurl生成首页链接

Usage

  • npm i @hbgj/common
  • 引入api,你的环境需要有Promise支持

机票列表

    // 你可能需@babel/polyfill 但不推荐此做法
    // import "@babel/polyfill";
    
    import Common from "@hbgj/common";
    const { Config, Util, App } = Common;
    let params = _.extend({}, {
          scty: "PEK", // 出发地三字码
          ecty: "SHA", // 目的地三字码
          date: "2019-12-01", // 去程
          fdate: "2019-12-11", // 返程
          cabin: "4" // // 4 经济舱,7 公务舱
        });
    // type  0 国际 1 国内
    const url = App.getTicketList(params, {type: 0 });

机票详情

    
    import Common from "@hbgj/common";
    const { App } = Common;
    let params = _.extend({}, {
      dep: "出发地三字码",
      arr: "目的地三字码",
      date: "2019-12-01", // 去程
      fdate: "2019-12-11", // 返程
      analyseSourceEntry: "统计参数",
      no: '航班号,仅在app内使用',
      shareid: '仅在h5中使用'
    });
    // type  0 国际 1 国内
    const url = App.getTicketDetail(params, {type: 0 });

webpack管理项目 增加promise支持

  • 安装依赖
    npm i -S es6-promise
  • 修改webpack配置

    plugins: [
        new webpack.ProvidePlugin({
            Promise: ['es6-promise', 'Promise']
        }),
        ...
    ]

FAQs

Package last updated on 28 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts