Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@icreate/hb-basic-js-sdk

Package Overview
Dependencies
Maintainers
7
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@icreate/hb-basic-js-sdk

import HBBasicClient from '@icreate/hb-basic-js-sdk'

  • 0.0.10-beta.1
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
7
Weekly downloads
 
Created
Source

引入

import HBBasicClient from '@icreate/hb-basic-js-sdk'

创建请求实例

const $request = new HBBasicClient({
  baseURL: 'http://192.168.2.234:20010/HBBasicServerApi',
  appId: 'his-enjoyor',
  secrect: 'HJCq5T4VqCzVWKjzNHTYB7QaTCloPC'
})

请求、响应拦截

// 添加请求拦截
$request.httpClient.interceptors.request.use(function (config) {
  config.headers = {
    token: sessionStorage.token ?? ''
  }
  console.log(config.url, config.data)
  return config
})
// 添加响应拦截
$request.httpClient.interceptors.response.use(
  function (response) {
    // console.log(response, '自定义响应拦截0')

    if (response.code === 200) {
      console.log(response.data && JSON.parse(response.data))
      return Promise.resolve(response.data && JSON.parse(response.data))
    } else {
      Message.error(response.message)
      return Promise.reject(response)
    }
  },
  function (error) {
    Message.error('Error')
    console.log(error, '自定义响应拦截error')
    return Promise.reject(error)
  }
)

api 调用

以下为全部 api 的实现(持续集成中...),返回值皆为 promise 对象。
const base = {
  // 登录
  login: '/user/login',
  // 判断科室是否存在对应的职能
  checkDept: '/org/check/dept/fun',
  // 根据 token 获取用户信息
  getUserInfoByToken: '/user/information',
  // 获取用户所在科室与病区
  getUserDeptList: '/user/dept/list',
  //修改用户密码
  setPassWord: '/user/password/update',
  //获取用户权限科室
  getAuthDeptList: '/user/auth/dept/list',
  //获取用户特殊权限列表
  getUserSpecRightList: '/user/special/right/list',
  //CA 登录接口
  caLogin: '/user/login/ca',
  //获取应用列表
  getApplist: '/app/list',
  //特殊权限注册
  registerSpecRight: '/special/right/register',
  //注册应用菜单
  registerAppMenu: '/app/menu/register',
  //注册应用菜单功能按钮
  registerAppMenuOper: '/app/menu/oper/register',
  //获取指定用户应用菜单列表
  getAppMenuList: '/app/menu/list',
  //获取指定用户菜单下的按钮列表
  getAppMenuOperList: '/app/menu/oper/list',
  // 获取用户权限应用列表
  getAppUserRightList: '/app/user/right/list',
  //记录用户最近访问菜单
  setVisitRecord: '/app/module/visit/record/save',
  //获取用户最近访问菜单列表
  getVisitRecordList: '/app/recent/module/list',
  //获取用户常用菜单列表
  getCommonMenuList: '/common/menu/list',
  //用户常用功能菜单注册
  registerCommonMenu: '/common/menu/register',
  //取消用户常用菜单注册
  registerCommonMenuCancel: '/common/menu/cancel/register',
  //用户常用菜单排序
  sortCommonMenu: '/common/menu/sort',
  //获取机构列表
  getOrgList: '/org/list',
  //根据科室或病区获取机构信息
  getInfoByDept: '/org/information/by/dept',
  //检查两个科室或病区是否属于同一分院
  checkOrgSame: '/org/check/same',
  //判断用户是否是某个病区领导(护士长)
  checkNurseUnitLeader: '/user/check/nursing/unit/leader',
  //判断用户是否是某个科室领导(科主任)
  checkDeptLeader: '/user/check/dept/leader',
  // 根据指定流水号编码获取流水号
  getSerialNum: '/serial/number/book/get',
  //注册流水号
  registerSerialNum: '/serial/number/book/register',
  //获取字典数据分页列表
  getDictDataPage: '/dict/data/page',
  //根据菜单类别获取菜单列表
  getAppMenuCateList: '/app/menu/category/list',
  //获取应用字典数据分页列表
  getAppDictDataPage: '/app/dict/data/page',
  //获取应用参数值列表
  getAppParamList: '/app/param/list',
  //根据应用菜单编码获取已注册系统参数列表
  getSystemParamList: '/system/param/list',
  //获取系统参数值
  getSystemParamValue: '/system/param/value',
  //设置系统参数
  setSystemParam: '/system/param/settings',
  //根据应用菜单编码获取已注册本地参数列表
  getLocalParamList: '/local/param/list',
  //获取本地参数值
  getLocalParamValue: '/local/param/value',
  //本地参数设置
  setLocalParam: '/local/param/settings',
  //本地参数值设置
  setLocalParamValue: '/local/param/value/settings',
  //获取系统参数值列表
  getSystemParamValueList: '/system/param/value/list',
  //客户端验证
  checkClient: '/client/check',
  //客户端注册
  registerClient: '/client/register',
  //根据客户端编码获取客户端信息
  getClientInfo: '/client/info',
  //获取数据验证规则列表
  getDataValidRuleList: '/data/validation/rule/list',
  // 获取全局唯一ID
  getUniqueKey: '/common/key/get',
  // 包上传注册
  packageRegister: '/package/register',
  // 获取机构下全部病区科室
  getDeptListByOrg: '/org/dept/list',
  // 获取机构下全部建筑与楼层
  getOrgBuildingList: '/org/building/list',
  // 获取机构或科室下的全部医生或护士
  getOrgUserList: '/org/user/list'
  // 获取字典数据
  getDictList: '/dict/get'

}

调用案例($request.api.key(), key 为上述对象的键名,参数会有提示,请严格按照提示进行传参):
$request.api.login({ code: data.code, password: data.password })
$request.api.getUserInfoByToken({ token })

FAQs

Package last updated on 28 Sep 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc