PageViewModel.ets
762 Bytes
import { GroupDTO } from 'wdBean';
import { Logger, ResourcesUtils } from 'wdKit';
import { ResponseDTO } from 'wdNetwork';
const TAG = 'PageViewModel';
/**
* 处理返回后的数据
*/
export class PageViewModel {
/**
* Get Group data.
*
* @return {GroupDTO} compRes.data
*/
static getGroupDTO(context: Context): GroupDTO {
let compRes: ResponseDTO<GroupDTO> | null = ResourcesUtils.getResourcesJsonSync<ResponseDTO<GroupDTO>>(context, 'comp_list.json');
Logger.info(TAG, `getCompList getResourcesJson compRes : ${JSON.stringify(compRes)}`);
if (!compRes || !compRes.data) {
return {} as GroupDTO
}
return compRes.data
}
}
let pageViewModel = new PageViewModel();
export default pageViewModel as PageViewModel;