hiatmp-core

1.1.3 • Public • Published

hiatmp-core 工程介绍

hiatmp-core 工程中存放各子系统公用的资源,包括图标、工具类、自定义组件。

图标

图标存放在 lib/assets/目录下,通过如下方式引入:

import icon_add from 'hiatmp-core/lib/assets/images/common/icon_add.png'

工具类

工具类存放在lib/utils/目录下,通过如下方式引入:

import request from 'hiatmp-core/lib/utils/request'
 
//查询违法数据
export async function query(params){
  return request('api/illegaldata/queryList',{
    method:'POST',
    body:JSON.stringify(params)
  })
}

下面是所有工具类清单:

  • request :封装fetch方法,添加身份验证功能。所有后台请求方法都需要调用这个接口,不允许自定义实现。
/**
 * Requests a URL, returning a promise.
 *
 * @param  {string} url       The URL we want to request
 * @param  {object} [options] The options we want to pass to "fetch"
 * @return {object}           An object containing either "data" or "err"
 */
 export default function request(url, options) {}

自定义组件

  • AuthContext : 按钮权限验证组件,实现按钮权限的控制。平台中的增删改查等按钮需用该组件包装起来,实现权限控制。
    • props
    AuthContext.PropTypes = {
      opercode: PropTypes.string.isRequired, //操作编码
    };
    • 调用示例:
     import AuthContext from 'hiatmp-core/lib/components/AuthContext';
     function IndexPage() {
       return (
         <div style={{ width: '300px', height: '300px' }}>
           <AuthContext opercode="02010201">
             <Button icon="plus-circle-o" type="ghost">添加</Button>
           </AuthContext>
         </div>
       );
     }
    
  • HiMap : 地图组件,封装HiMap地图开发接口。
    • props:
    HiMap.PropTypes = {
      maptype: PropTypes.string, // 地图类型,如:'pgis' 、 'arcgis'
      onready: PropTypes.func.isRequired, //回调函数,返回_MapApp对象
    };
    • 调用示例:
     import HiMap from 'hiatmp-core/lib/components/HiMap';
     function IndexPage() {
       let _MapApp;
       function onready(map) {
         _MapApp = map;
       }
       return (
           <div style={{ width: '300px', height: '300px' }}>
             <HiMap onready={onready} maptype="pgis" />
           </div>
       );
     }
    

Readme

Keywords

none

Package Sidebar

Install

npm i hiatmp-core

Weekly Downloads

6

Version

1.1.3

License

ISC

Last publish

Collaborators

  • xiaobinggg