qqsl-common-utils
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

QQSL-COMMON-UTILS

使用tsc打包,未使用webpack

npm i qqsl-common-utils --save-dev
import * as QQSLUtils from 'qqsl-common-utils'
const token = QQSLUtils.getTokenFromUrl(location.href)

qqsl-token-utils

  1. storeTokenInCache: string => void
  2. getTokenFromCache: () => string | null
  3. removeTokenFromCache: () => void
  4. configTokenValidTime: string | number => void。string类型可以是数字+y(m/d/h),number类型为毫秒数
  5. resetTokenValidTime: ()=>void
  6. getTokenFromUrl: string => string | null
  7. createUrlWithToekn: ({ url: string, token: string, hash: string | undefined }) => string。url必须是绝对路径。
  8. const TOEKN_NAME = 'authenticationToken'
  9. const TOKEN_PREFIX = 'jhi-'
  10. const FULL_TOEKN_NAME = 'jhi-authenticationToken'

qqsl-map-utils

  1. 包含地形地图、卫星地图、行政地图、基础地图。该内容不可修改,只能调用getMapLayer
  2. getMapLayer = (LayerEnum) => AMap.TileLayer[]
const mapLayer: AMap.TileLayer[] = getMapLayer(LayerEnum);
mapApi.setLayers(mapLayer); //获取到图层后使用高德地图实例直接设置即可
  1. 设置行政区边界样式:createBoundaryStyle = () => AMap.Polygon.Options
  2. 递归取得市县行政区边界:
getRegionOptionsInPromise = (
  name: string, //城市名
  districtSearch: any, // 高德地图返回给你的districtSearch对象
  setGonOption?: () => AMap.Polygon.Options  // 支持自定义面options
) => Promise<AMap.Polygon.Options[]>
// resolve()会返回AMap.Polygon.Options[]
// reject会返回空数组[]
  1. export enum LayerEnum
  2. export interface ILayer
enum LayerEnum {
  NORMAL,
  TERRAIN,
  SATELLITE,
}
interface ILayer {
  name: LayerEnum;
  nameC: string;
}

Readme

Keywords

none

Package Sidebar

Install

npm i qqsl-common-utils

Weekly Downloads

2

Version

1.1.2

License

ISC

Unpacked Size

23.4 kB

Total Files

11

Last publish

Collaborators

  • wangkaiyuan1995