1.0.15 • Published 6 years ago

@hasaki-ui/hsk-corki v1.0.15

Weekly downloads
2
License
-
Repository
-
Last release
6 years ago

hsk-corki

易速点公共API库

使用

下载:

npm i --save @hasaki-ui/hsk-corki

在项目的build-config中配置:

    ...
    libraryWrapper: [
        ...
        {
            name: '@hasaki-ui/hsk-corki',
            wrapperDir: ['lib/local', 'lib/server'],
            targetDir: ['src/api/local', 'src/api/server'],
            prefix: ['pub']
        },
        ...
    }],

    ....

hsk-corki采用es6编码,使用时需要编译,所以需要配置:

    ...
    builder:{
        babel:{
            include:[
                'node_modules/_@hasaki-ui_hsk-corki',
                'node_modules/@hasaki-ui/hsk-corki'
            ]
        }
    }
    ...

如果已经配置编译所有的@hasaki-ui库,则不需要上面的编译配置

在生成的server代理文件中,需要设置当前项目的fetch对象

import Fetch from 'path/to/fetch.js';

import Obj from "./../../../node_modules/@hasaki-ui/hsk-corki/lib/server";
Obj.fetch = Fetch.getFetch(...);
export default Obj;

API

hsk-corki实现了public-app的API

LookupApi

async getLookUpValueListByType({type, language, applicationId, isEnable = true})

获取某个快码类型的快码值列表

params:

  • type 快码类型,必需

  • language 语言代码

  • applicationId 应用ID

  • isEnable 是否只加载生效的数据,默认为true

返回数据格式:

[{
    code:String, // 编码
    order:String, // 排序权重
    text:String, // 显示含义
    desc:String, // 详细描述
},...]

async getLookUpMap({language, applicationId})

获取所有快码,返回一个Map<lookup type,lookup value list>

param:

  • language 语言代码

  • applicationId 应用ID

返回数据格式:

{
    type:[{ // 类型
         code:String, // 编码
         order:String, // 排序权重
         text:String, // 显示含义
         desc:String, // 详细描述
    },...]  // value列表
    ...
}

OssApi

async getCredential()

获取OSS凭证信息

返回数据格式:

{
    securityToken:String, // 返回的Token信息
    accessKeySecret:String, // 阿里云子账户密钥
    accessKeyId:String, // 阿里云子账户ID
    expiration:String, // 令牌实效时间
}

测试

下载项目代码后,执行

npm run test

就可以运行所有的测试代码,所有的测试案例存放在test目录夹下

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago