Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
张善主
2024-04-15 10:34:41 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ee7696932b68066e797fe5f3a0146cf98ca8415d
ee769693
1 parent
767f00fc
feat(人民号频道):增加推荐接口
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
9 deletions
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/PageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
sight_harmony/features/wdComponent/src/main/ets/utils/PullDownRefresh.ets
sight_harmony/features/wdComponent/src/main/ets/utils/PullUpLoadMore.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageViewModel.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
ee76969
...
...
@@ -35,6 +35,10 @@ export class HttpUrlUtils {
*/
static readonly COMP_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo";
/**
* 展现comp接口(推荐)
*/
static readonly COMP_REC_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo";
/**
* 详情页面详情接口
*/
static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail";
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/PageComponent.ets
View file @
ee76969
...
...
@@ -159,7 +159,7 @@ export struct PageComponent {
// pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
for (const group of pageInfo.groups) {
this.pageDto = await PageViewModel.getPageData(this.pageModel.pageId, `${group.id}`, this.pageModel.channelId
, this.pageModel.currentPage, this.pageModel.pageSize, getContext(this))
, this.pageModel.currentPage, this.pageModel.pageSize,
group.groupStrategy,
getContext(this))
this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
this.pageDto.compList.forEach((comp) => {
...
...
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
View file @
ee76969
...
...
@@ -45,8 +45,15 @@ export class PageRepository {
return url;
}
static getCompInfoUrl(pageId: string, groupId: string, channelId: string, currentPage: number, pageSize: number) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMP_PATH;
static getCompInfoUrl(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number, pageSize: number) {
let url = HttpUrlUtils.getHost();
if(1 == groupStrategy){
//推荐
url = url + HttpUrlUtils.COMP_REC_PATH;
}else{
//非推荐
url = url + HttpUrlUtils.COMP_PATH;
}
// TODO 暂定只请求第一页,后续对接分页加载,参数再调整 first_load?
url = url + "?channelStrategy=2&loadStrategy=first_load"
+ "&districtCode=" + HttpUrlUtils.getDistrictCode()
...
...
@@ -180,8 +187,8 @@ export class PageRepository {
return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers)
};
static fetchPageData(pageId: string, groupId: string, channelId: string, currentPage: number, pageSize: number) {
let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId, currentPage, pageSize)
static fetchPageData(pageId: string, groupId: string, channelId: string,groupStrategy:number, currentPage: number, pageSize: number) {
let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId,groupStrategy, currentPage, pageSize)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageDTO>>(url, headers)
};
...
...
sight_harmony/features/wdComponent/src/main/ets/utils/PullDownRefresh.ets
View file @
ee76969
...
...
@@ -72,7 +72,7 @@ export function touchUpPullRefresh(pageModel: PageModel) {
setTimeout(() => {
let self: PageModel = pageModel;
PageViewModel.getPageData(self.pageId, self.groupId, self.channelId, self.currentPage, self.pageSize, getContext())
PageViewModel.getPageData(self.pageId, self.groupId, self.channelId, self.currentPage, self.pageSize,
self.groupStrategy,
getContext())
.then((data: PageDTO) => {
self.timestamp = DateTimeUtils.getTimeStamp().toString()
if (data == null || data.compList == null || data.compList.length == 0) {
...
...
sight_harmony/features/wdComponent/src/main/ets/utils/PullUpLoadMore.ets
View file @
ee76969
...
...
@@ -28,7 +28,7 @@ export function touchUpLoadMore(model: PageModel) {
self.isLoading = true;
setTimeout(() => {
closeLoadMore(model);
PageViewModel.getPageData(self.pageId, self.groupId, self.channelId, self.currentPage, self.pageSize, getContext())
PageViewModel.getPageData(self.pageId, self.groupId, self.channelId, self.currentPage, self.pageSize,
self.groupStrategy,
getContext())
.then((data: PageDTO) => {
self.timestamp = DateTimeUtils.getTimeStamp().toString()
if (data == null || data.compList == null || data.compList.length == 0) {
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageViewModel.ets
View file @
ee76969
...
...
@@ -141,13 +141,13 @@ export class PageViewModel extends BaseViewModel {
}
async getPageData(pageId: string, groupId: string, channelId: string, currentPage: number
, pageSize: number, context: Context): Promise<PageDTO> {
, pageSize: number,
groupStrategy:number,
context: Context): Promise<PageDTO> {
Logger.debug(TAG, 'getPageData pageId: ' + pageId);
if (mock_switch) {
return this.getPageData1(currentPage, context);
}
return new Promise<PageDTO>((success, error) => {
PageRepository.fetchPageData(pageId, groupId, channelId, currentPage, pageSize)
PageRepository.fetchPageData(pageId, groupId, channelId,
groupStrategy,
currentPage, pageSize)
.then((resDTO: ResponseDTO<PageDTO>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getNavData then resDTO is empty');
...
...
Please
register
or
login
to post a comment