- 云账号登录/注销
- 注销拦截器
- 阿里云webtrace日志上报
- 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});
}
}
};