ProcessUtils.ets
5.96 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
import { Action, ContentDTO, Params, PhotoListBean } from 'wdBean';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { Logger } from 'wdKit';
import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
import { WDRouterRule } from '../router/WDRouterRule';
import { ContentConstants } from 'wdConstant';
// import { LiveModel } from '../viewmodel/LiveModel';
const TAG = 'ProcessUtils';
/**
* 页面跳转业务封装
*/
export class ProcessUtils {
/**
* 页面跳转
*/
static processPage(content: ContentDTO) {
if (content == null) {
Logger.error(TAG, "processPage, content is null");
return;
}
if (StringUtils.isEmpty(content.objectType)) {
Logger.error(TAG, "processPage, objectType is empty");
return;
}
let type = content.objectType;
console.log(TAG, 'objectType', `${JSON.stringify(content)}`);
switch (type) {
case ContentConstants.TYPE_NONE:
Logger.debug(TAG, "processPage, do nothing");
break;
case ContentConstants.TYPE_VOD:
Logger.debug(TAG, "processPage, nonsupport!!!");
ProcessUtils.gotoVod(content)
break;
case ContentConstants.TYPE_LIVE:
ProcessUtils.gotoLive(content)
break
case ContentConstants.TYPE_AUDIO:
ProcessUtils.gotoAudio(content)
break;
case ContentConstants.TYPE_TELETEXT:
// 图文详情,跳转h5
ProcessUtils.gotoWeb(content);
break;
case ContentConstants.TYPE_LINK:
ProcessUtils.gotoDefaultWeb(content);
break;
//图集详情页
case ContentConstants.TYPE_NINE:
ProcessUtils.gotoAtlasDetailPage(content);
break;
case ContentConstants.TYPE_SPECIAL_TOPIC:
// 专题详情,跳转h5
ProcessUtils.gotoSpecialTopic(content);
break;
//动态详情页(动态图文)
case ContentConstants.TYPE_FOURTEEN:
ProcessUtils.gotoDynamicDetailPage(content);
//动态详情页(动态视频)
case ContentConstants.TYPE_FIFTEEN:
ProcessUtils.gotoDynamicDetailPage(content);
break;
default:
break;
}
}
/**
* 动态详情页(动态视频/动态图片)
* @param content
* */
private static gotoDynamicDetailPage(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: Number.parseInt(content.objectType),
contentID: content?.objectId,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoDynamicDetailPage, ${content.objectId}`);
}
/**
* 图集详情页
* @param content
* */
public static gotoMultiPictureListPage(photoList: PhotoListBean[]) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 18,
extra: {
photoList
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoMultiPictureListPage`);
}
private static gotoSpecialTopic(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
url: content.linkUrl,
pageID: 'SPACIAL_TOPIC_PAGE',
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
private static gotoDefaultWeb(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
url: content.linkUrl,
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
}
private static gotoWeb(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
contentID: content?.objectId,
pageID: 'IMAGE_TEXT_DETAIL',
extra: {
relType: content?.relType,
relId: content?.relId,
channelId: content?.channelId,
sourcePage: '5'
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
}
private static gotoVod(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 7,
contentID: content?.objectId,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoVod, ${content.objectId}`);
}
private static async gotoLive(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 2,
contentID: content?.objectId,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoLive, ${content.objectId}`);
}
private static gotoAudio(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 13,
contentID: content?.objectId,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoAudio, ${content.objectId}`);
}
/**
* 图片预览页
* @param content
* */
private static gotoAtlasDetailPage(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 17,
contentID: content?.objectId,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoAtlasDetailPage, ${content.objectId}`);
}
}