提交 92834679 编写于 作者: tony001's avatar tony001

增加视图消息基类

上级 f1ae15cb
import { Http } from '@/utils/http/http';
/**
* 视图消息组
*
* @export
* @class ViewMessageGroupService
*/
export default class ViewMessageGroupService {
/**
* 单例变量声明
*
* @private
* @static
* @type {ViewMessageGroupService}
* @memberof ViewMessageGroupService
*/
private static ViewMessageGroup: ViewMessageGroupService;
/**
* 所有视图消息组对象
*
* @private
* @static
* @type {ViewMessageGroupService}
* @memberof ViewMessageGroupService
*/
private static allViewMessageGroup:any;
/**
* 初始化实例
*
* @memberof ViewMessageGroupService
*/
constructor(opts:any = {}){
this.loadAllViewMessageGroup();
}
/**
* 获取 ViewMessageGroupService 单例对象
*
* @static
* @returns {ViewMessageGroupService}
* @memberof ViewMessageGroupService
*/
public static getInstance(): ViewMessageGroupService {
if (!ViewMessageGroupService.ViewMessageGroup) {
ViewMessageGroupService.ViewMessageGroup = new ViewMessageGroupService();
}
return this.ViewMessageGroup;
}
/**
* 获取视图消息组成员集合
*
* @returns {Promise<any></any>}
* @memberof ViewMessageGroupService
*/
public async getViewMessageDetailsByTag(tag:string):Promise<any>{
return ViewMessageGroupService.allViewMessageGroup[tag]?ViewMessageGroupService.allViewMessageGroup[tag]:[];
}
/**
* 加载应用所有视图消息组集合
*
* @returns {Promise<any></any>}
* @memberof ViewMessageGroupService
*/
public loadAllViewMessageGroup():Promise<any>{
return new Promise((resolve:any,reject:any) =>{
Http.getInstance().get('./assets/json/view-message-group.json').then((response: any) => {
if (response && response.status === 200 && response.data) {
ViewMessageGroupService.allViewMessageGroup = response.data;
resolve(response.data);
}
}).catch((error: any) => {
console.log(error);
});
})
}
}
\ No newline at end of file
/**
* 视图消息
*
* @export
* @class ViewMessage
*/
export default class ViewMessageService {
constructor(opts: any = {}) {
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册