Package Exports
- tplus-api
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tplus-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
tplusApi -> T+前端网关库
模块说明
- 云账号登录/注销
- 注销拦截器
- 阿里云webtrace日志上报
编写说明
- 使用typescript
依赖模块
- mutants-microfx
- mutants-jsbridge
- mutants-log
登录 + 注销 + 拦截器 + 请求 + 阿里云日志(代码示例)
const login = async ()=>{
registerLogoutMiddleWare('loginOut',()=>{
console.log('注销后...');
});
//用户认证 获取企业列表
const user:User = await User.authentication('${username}','${password}');
//过滤企业
let tcOrgs:Array<any> = _filter(user.orgList,org=>org.orgFullName === '${orgName}');
if(tcOrgs.length > 0){
const tcOrgId:string = tcOrgs[0].orgId;
//初始化通道
await user.initChannel(tcOrgId);
//登录T+
await user.loginTplus({});
console.log('user.logined======',user);
const response = await tApi({},'${methodName}',false,false);
console.log('response======',response);
//用户注销
User.logout();
try{
const response1 = await tApi({},'${methodName}',false,false);
console.log('logout.response======',response1);
}catch(e){
//将API错误日志进行上报
serverLog('${logstore}',{eventId:'api_error',...e});
}
}
};