qqsl-common-utils
v1.1.2
Published
使用tsc打包,未使用webpack
Downloads
4
Readme
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
- storeTokenInCache: string => void
- getTokenFromCache: () => string | null
- removeTokenFromCache: () => void
- configTokenValidTime: string | number => void。string类型可以是数字+y(m/d/h),number类型为毫秒数
- resetTokenValidTime: ()=>void
- getTokenFromUrl: string => string | null
- createUrlWithToekn: ({ url: string, token: string, hash: string | undefined }) => string。url必须是绝对路径。
- const TOEKN_NAME = 'authenticationToken'
- const TOKEN_PREFIX = 'jhi-'
- const FULL_TOEKN_NAME = 'jhi-authenticationToken'
qqsl-map-utils
- 包含地形地图、卫星地图、行政地图、基础地图。该内容不可修改,只能调用getMapLayer
- getMapLayer = (LayerEnum) => AMap.TileLayer[]
const mapLayer: AMap.TileLayer[] = getMapLayer(LayerEnum);
mapApi.setLayers(mapLayer); //获取到图层后使用高德地图实例直接设置即可
- 设置行政区边界样式:createBoundaryStyle = () => AMap.Polygon.Options
- 递归取得市县行政区边界:
getRegionOptionsInPromise = (
name: string, //城市名
districtSearch: any, // 高德地图返回给你的districtSearch对象
setGonOption?: () => AMap.Polygon.Options // 支持自定义面options
) => Promise<AMap.Polygon.Options[]>
// resolve()会返回AMap.Polygon.Options[]
// reject会返回空数组[]
- export enum LayerEnum
- export interface ILayer
enum LayerEnum {
NORMAL,
TERRAIN,
SATELLITE,
}
interface ILayer {
name: LayerEnum;
nameC: string;
}