Message.ets
2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { Action } from './Action';
interface IImgItem {
pic: string
width: number
height: number
}
export interface IImgListData {
imgIndex: number
imgArr: IImgItem[]
}
interface dataObject {
// dataSource:
// 1、图文详情数据
// 2、英文端跳转推荐内容数据
// 3、显示图片预览
// 4、专题pageinfo数据
// 5、专题comp运营位点击跳转(传给App记录浏览历史)
// 6、图文详情引用内容跳转
// 7、专题分享海报图上的数据列表(H5可选第一页前5条运营位数据)
// 8、活动投稿 文章跳转
// 9、活动投稿 视频跳转
// 10、活动投稿 动态跳转
// 11、活动投稿 图集跳转
dataSource: WDH5WebDataSource
operateType?: string
webViewHeight?: string
dataJson?: string
appInnerLink?: string
method?: string
url?: string
parameters?: object
videoUrl?: string
positionWidth?: string
positionHeight?: string
positionLeft?: string
positionTop?: string
videoLandscape?: string
imgListData?: string
}
/**
* 消息Message
*/
export class Message {
callbackId: string = ""; //callbackId
responseId: string = ""; //responseId
responseData: string = ""; //responseData
data?: dataObject; //data of message
handlerName: string = ""; //name of handler
/**
* TODO 待验证
* @returns
*/
toJson(): string {
let jsonString: string = JSON.stringify(this)
return jsonString
}
/**
* TODO 待验证
* @param jsonStr
* @returns
*/
toList(jsonStr: string): Array<Message> {
return JSON.parse(jsonStr)
}
}
export enum WDH5WebDataSource {
WDH5WebDataSourceUnknown = 0,
WDH5WebDataSourceImageTextDetail = 1,
WDH5WebDataSourceContentInfo = 2,
WDH5WebDataSourcePictures = 3,
WDH5WebDataSourceTopicPageInfo = 4,
WDH5WebDataSourceCompPositionData = 5,
WDH5WebDataSourceArticleRefDataJump = 6,
WDH5WebDataSourceSharePosterListDatas = 7,
WDH5WebDataSourcePartinActivityPublishArticle = 8,
WDH5WebDataSourcePartinActivityPublishVideo = 9,
WDH5WebDataSourcePartinActivityPublishDynamic = 10,
WDH5WebDataSourcePartinActivityPublishPicture = 11,
}