liyubing

feat(信息流):处理二次请求批查获取的数据 响应稿件页面

Showing 35 changed files with 316 additions and 219 deletions
... ... @@ -37,6 +37,7 @@ export abstract class BasicDataSource<T> implements IDataSource {
})
}
// 通知控制器数据增加
public notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
... ...
... ... @@ -255,6 +255,7 @@ export class LazyDataSource<T> extends BasicDataSource<T> {
this.replaceAll()
}
// 把数据全部删除,再添加全部新元素
public replaceAll(...items: T[]): void {
// 从数组中的0位置开始删除dataArray.length个元素,并在同一位置插入((1个或多个))新元素,返回已删除的元素。
... ... @@ -262,6 +263,8 @@ export class LazyDataSource<T> extends BasicDataSource<T> {
this.notifyDataReload()
}
// 获取指定元素的下标
public getIndexOf(element: T): number {
for (let index = 0; index < this.dataArray.length; index++) {
... ... @@ -293,4 +296,13 @@ export class LazyDataSource<T> extends BasicDataSource<T> {
public reloadData(): void {
this.notifyDataReload();
}
//**********************//////////
public clearAllData(){
this.dataArray = []
this.notifyDataReload();
}
}
\ No newline at end of file
... ...
import { CompAdvMatInfoBean } from '../adv/CompAdvInfoBean';
import { AudioDTO } from '../content/AudioDTO';
import { ContentDTO } from '../content/ContentDTO';
export interface BaseDTO {
... ...
... ... @@ -4,48 +4,88 @@ import { ContentDTO } from '../content/ContentDTO';
import { BaseDTO } from './BaseDTO';
@Observed
export class CompDTO implements BaseDTO{
backgroundColor: string='';
backgroundImgUrl: string='';
cityCode: string='';
compStyle: string='';
compType: string='';
export class CompDTO implements BaseDTO {
backgroundColor: string = '';
backgroundImgUrl: string = '';
cityCode: string = '';
compStyle: string = '';
compType: string = '';
// dataSourceRequest: any[];
districtCode: string='';
districtCode: string = '';
extraData?: string;
hasAdInfo: number=-1;
id: number=0;
imgSize: string='';
innerUrl: string='';
linkUrl: string='';
hasAdInfo: number = -1;
id: number = 0;
imgSize: string = '';
innerUrl: string = '';
linkUrl: string = '';
// meddleDataList: any[];
name: string='';
objectId: string=''; // 跳转页面id?
objectTitle: string=''; // comp标题
name: string = '';
objectId: string = ''; // 跳转页面id?
objectTitle: string = ''; // comp标题
// objectType?: string; // 跳转类型,枚举:
operDataList: ContentDTO[]=[]; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】
operDataList: ContentDTO[] = []; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】
// pageId?: any;
posterSize: string='';
posterUrl: string='';
provinceCode: string='';
sortValue: number=-1;
subType: string='';
imageScale: number=-1; // 封面图比例 1-4:3, 2-16:9, 3-3:2
audioDataList: AudioDTO[]=[];
titleShowPolicy: string | number='';
posterSize: string = '';
posterUrl: string = '';
provinceCode: string = '';
sortValue: number = -1;
subType: string = '';
imageScale: number = -1; // 封面图比例 1-4:3, 2-16:9, 3-3:2
audioDataList: AudioDTO[] = [];
titleShowPolicy: string | number = '';
/**
* 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING )
*/
dataSourceType: string='';
dataSourceType: string = '';
/**
* 信息流广告素材
*/
matInfo: CompAdvMatInfoBean = {} as CompAdvMatInfoBean
pageId?: string;
objectType?: string;
hasMore: number = 1
// keyGenerator相关字符串,用于刷新list布局
timestamp: String = '1'
/**
* 创建新的compbean对象
* @param old
* @returns
*/
static createNewsBean(old: CompDTO): CompDTO {
let comp: CompDTO = new CompDTO
comp.compStyle = old.compStyle
comp.compType = old.compType
comp.operDataList = old.operDataList
comp.extraData = old.extraData
comp.matInfo = old.matInfo
comp.backgroundColor = old.backgroundColor
comp.backgroundImgUrl = old.backgroundImgUrl
comp.cityCode = old.cityCode
comp.districtCode = old.districtCode
comp.provinceCode = old.provinceCode
comp.hasAdInfo = old.hasAdInfo
comp.id = old.id
comp.imgSize = old.imgSize
comp.innerUrl = old.innerUrl
comp.linkUrl = old.linkUrl
comp.name = old.name
comp.objectId = old.objectId
comp.objectTitle = old.objectTitle
comp.posterSize = old.posterSize
comp.posterUrl = old.posterUrl
comp.sortValue = old.sortValue
comp.subType = old.subType
comp.imageScale = old.imageScale
comp.audioDataList = old.audioDataList
comp.titleShowPolicy = old.titleShowPolicy
comp.pageId = old.pageId
comp.extraData = old.extraData
comp.dataSourceType = old.dataSourceType
comp.objectType = old.objectType
comp.hasMore = old.hasMore
return comp
}
}
\ No newline at end of file
... ...
/**
* 批查接口查询互动相关数据,返回数据bean
*/
@Observed
export class InteractDataDTO {
collectNum: number | string = 0;
commentNum: number | string = 0;
... ...
... ... @@ -26,38 +26,39 @@ import { Logger } from 'wdKit/Index';
@Component
export struct CardParser {
@State contentDTO: ContentDTO = new ContentDTO();
@State compDTO: CompDTO = {} as CompDTO
@ObjectLink compDTO: CompDTO
aboutToAppear(): void {
Logger.info('contentDTO.contentText', JSON.stringify(this.contentDTO))
}
build() {
this.contentBuilder(this.contentDTO, this.compDTO);
this.contentBuilder(this.contentDTO);
}
@Builder
contentBuilder(contentDTO: ContentDTO, compDTO: CompDTO) {
contentBuilder(contentDTO: ContentDTO) {
// Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO })
if (!!contentDTO.contentText) {
SearchContentComponent({ contentDTO })
} else {
if (contentDTO.appStyle === CompStyle.Card_02) {
Card2Component({ contentDTO })
Card2Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_03) {
Card3Component({ contentDTO })
Card3Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_04) {
Card4Component({ contentDTO })
Card4Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_05) {
Card5Component({ contentDTO, titleShowPolicy: compDTO.titleShowPolicy })
Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy })
} else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle
.Card_13) {
Card6Component({ contentDTO })
Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_09) {
Card9Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_10) {
Card10Component({ contentDTO })
Card10Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_11) {
Card11Component({ contentDTO })
Card11Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_12) {
Card12Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_14) {
... ... @@ -67,7 +68,7 @@ export struct CardParser {
} else if (contentDTO.appStyle === CompStyle.Card_16) {
Card16Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_17) {
Card17Component({ contentDTO })
Card17Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_19) {
Card19Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_20) {
... ... @@ -82,6 +83,5 @@ export struct CardParser {
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
}
}
\ No newline at end of file
... ...
import { CompDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { LabelComponent } from './view/LabelComponent';
import { CommonConstants, CompStyle } from 'wdConstant/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import PageModel from '../viewmodel/PageModel';
import { CardParser } from './CardParser';
import { Card2Component } from './cardview/Card2Component';
import { Card5Component } from './cardview/Card5Component';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
import { ZhGridLayout02 } from './compview/ZhGridLayout02';
import { ZhGridLayout03 } from './compview/ZhGridLayout03';
import { ZhSingleColumn04 } from './compview/ZhSingleColumn04';
import { ZhSingleColumn05 } from './compview/ZhSingleColumn05';
import { ZhSingleColumn09 } from './compview/ZhSingleColumn09';
import { ZhSingleRow02 } from './compview/ZhSingleRow02';
import { ZhSingleRow03 } from './compview/ZhSingleRow03';
import { ZhSingleRow04 } from './compview/ZhSingleRow04';
import { ZhSingleRow06 } from './compview/ZhSingleRow06';
import {
HorizontalStrokeCardThreeTwoRadioForMoreComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
import {
HorizontalStrokeCardThreeTwoRadioForOneComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import { ZhSingleRow02 } from './compview/ZhSingleRow02';
import { ZhSingleRow03 } from './compview/ZhSingleRow03';
import { ZhSingleRow04 } from './compview/ZhSingleRow04';
import { ZhSingleRow06 } from './compview/ZhSingleRow06';
import { ZhSingleColumn04 } from './compview/ZhSingleColumn04';
import { ZhSingleColumn09 } from './compview/ZhSingleColumn09';
import { ZhGridLayout03 } from './compview/ZhGridLayout03';
import { CardParser } from './CardParser';
import { ZhGridLayout02 } from './compview/ZhGridLayout02';
import { Card2Component } from './cardview/Card2Component';
import { Card5Component } from './cardview/Card5Component';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
import PageModel from '../viewmodel/PageModel';
import { LabelComponent } from './view/LabelComponent';
import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
/**
* comp适配器.
* 首页楼层comp解析器.
*/
@Preview
@Component
export struct CompParser {
@State compDTO: CompDTO = {} as CompDTO
@ObjectLink compDTO: CompDTO
@State compIndex: number = 0;
@State private pageModel: PageModel = new PageModel();
... ... @@ -39,83 +39,87 @@ export struct CompParser {
Column() {
if (this.compDTO.name != "月度排行卡") {
this.componentBuilder(this.compDTO, this.compIndex);
this.componentBuilder();
}
}
}
@Builder
componentBuilder(compDTO: CompDTO, compIndex: number) {
//if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
componentBuilder() {
//CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO:this.compDTO })
if (this.compDTO.operDataList[0]?.objectType !== '3' &&
this.compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (this.compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
ZhCarouselLayout01({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
ZhCarouselLayout01({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 &&
compDTO.imageScale === 2) { // && compDTO.name ==="横划卡"
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 &&
this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡"
LiveHorizontalCardComponent({ compDTO: compDTO })
LiveHorizontalCardComponent({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) {
if (compDTO.operDataList.length > 1) {
HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && this.compDTO.imageScale === 3) {
if (this.compDTO.operDataList.length > 1) {
HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: this.compDTO })
} else {
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO })
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: this.compDTO })
}
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
ZhSingleRow02({ compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
ZhSingleRow02({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
ZhSingleRow03({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
ZhSingleRow03({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
ZhGridLayout02({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
ZhGridLayout02({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
ZhGridLayout03({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
ZhGridLayout03({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
ZhSingleRow04({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
ZhSingleRow04({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
// ZhSingleRow05({ compDTO })
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
ZhSingleRow06({ compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
ZhSingleRow06({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
//头图卡 和comStyle 2相同,
Card5Component({ contentDTO: compDTO.operDataList[0], titleShowPolicy: compDTO.titleShowPolicy })
Card5Component({ contentDTO: this.compDTO.operDataList[0], titleShowPolicy: this.compDTO.titleShowPolicy })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
// 大图卡
Card2Component({ contentDTO: compDTO.operDataList[0] })
Card2Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0] })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
ZhSingleColumn04({ compDTO: compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
ZhSingleColumn04({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
// ZhSingleColumn05({ compDTO: compDTO })
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
ZhSingleColumn09({ compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
ZhSingleColumn09({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
AdvCardParser({ pageModel: this.pageModel, compDTO })
} else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
AdvCardParser({ pageModel: this.pageModel, compDTO: this.compDTO })
//Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (!Number.isNaN(Number(compDTO.compStyle))) {
CardParser({ contentDTO: compDTO.operDataList[0], compDTO });
} else if (!Number.isNaN(Number(this.compDTO.compStyle))) {
CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO: this.compDTO });
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else {
Text(compDTO.compStyle)
Text(this.compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
.onClick(() => {
if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论
if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论
WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
}
})
... ... @@ -123,6 +127,5 @@ export struct CompParser {
}
}
// }
}
}
\ No newline at end of file
... ...
import { ContentDTO } from 'wdBean'
import { CompDTO, ContentDTO } from 'wdBean'
import { CommonConstants } from 'wdConstant/Index';
import { DateTimeUtils } from 'wdKit/Index';
@Component
export struct CardSourceInfo {
@State contentDTO: ContentDTO = new ContentDTO();
@ObjectLink compDTO: CompDTO
build() {
Flex() {
... ... @@ -28,13 +29,14 @@ export struct CardSourceInfo {
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
// 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
if (this.contentDTO.isSearch || this.contentDTO.isCollection || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime
if (this.contentDTO.isSearch || this.contentDTO.isCollection ||
!this.contentDTO.isSearch && DateTimeUtils.getCommentTime
(Number
.parseFloat(this
.contentDTO.publishTime))
.indexOf
('-') === -1) {
if(this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName || this
if (this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName || this
.contentDTO.rmhPlatform !== 1 && this.contentDTO.source) {
Image($r("app.media.point"))
.width(16)
... ... @@ -45,16 +47,30 @@ export struct CardSourceInfo {
.fontColor($r("app.color.color_B0B0B0"))
.flexShrink(0)
}
if (this.contentDTO?.interactData?.commentNum) {
Text(`${this.contentDTO.interactData.commentNum}评`)
if (this.getContentDtoBean()?.interactData?.commentNum) {
Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.flexShrink(0)
.margin({ left: 6 })
.visibility(Number(this.contentDTO?.interactData?.commentNum) === 0 ? Visibility.None : Visibility.Visible)
.visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None : Visibility.Visible)
}
}
.width(CommonConstants.FULL_WIDTH)
.margin({ top: 8 })
}
/**
* 获取稿件业务对象
* @returns
*/
private getContentDtoBean(): ContentDTO {
if (this.compDTO == undefined) {
return new ContentDTO
}
if(this.compDTO.operDataList.length == 0){
return new ContentDTO
}
return this.compDTO.operDataList[0]
}
}
\ No newline at end of file
... ...
... ... @@ -61,7 +61,6 @@ export struct CardAdvBottom {
}
if (currentIndex >= 0) {
this.pageModel.compList.deleteItem(currentIndex)
this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
}
}
}
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CompDTO } from 'wdBean';
import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvTop } from './CardAdvTop';
const TAG: string = 'Card2Component';
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO } from 'wdBean';
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
... ...
... ... @@ -73,7 +73,6 @@ export struct CardAdvTop {
}
if (currentIndex >= 0) {
this.pageModel.compList.deleteItem(currentIndex)
this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
}
}
}
... ...
//全标题 "appStyle":"2",
import { CompDTO, ContentDTO, VideoInfoDTO } from 'wdBean';
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import PageModel from '../../viewmodel/PageModel';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { CardAdvBottom } from './CardAdvBottom';
const TAG: string = 'Card2Component';
... ...
import { ContentDTO, slideShows, VideoInfoDTO } from 'wdBean';
import { CompDTO, ContentDTO, slideShows, VideoInfoDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
... ... @@ -16,6 +16,7 @@ const TAG: string = 'Card10Component';
export struct Card10Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@ObjectLink compDTO: CompDTO
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -110,8 +111,10 @@ export struct Card10Component {
.textIndent(item.objectType == '5' ? 38 : 0)
}.alignContent(Alignment.TopStart)
//bottom 评论等信息
CardSourceInfo(
{
compDTO: this.compDTO,
contentDTO: this.createContent(item)
}
)
... ...
//缩略标题
import { CompDTO, ContentDTO } from 'wdBean'
import { DateTimeUtils } from 'wdKit'
import { CommonConstants } from 'wdConstant';
import { ContentDTO } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
... ... @@ -14,6 +15,7 @@ const TAG = 'Card11Component';
export struct Card11Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State clicked: boolean = false;
@ObjectLink compDTO: CompDTO
build() {
Column() {
... ... @@ -33,7 +35,7 @@ export struct Card11Component {
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO })
}.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
... ...
... ... @@ -13,11 +13,10 @@ const TAG = 'Card17Component';
*/
@Component
export struct Card17Component {
@State compDTO: CompDTO = {} as CompDTO
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@ObjectLink compDTO: CompDTO
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
... ... @@ -97,7 +96,7 @@ export struct Card17Component {
})
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({compDTO:this.compDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ...
... ... @@ -2,7 +2,7 @@ import { ContentDTO, FullColumnImgUrlDTO, PhotoListBean } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { ProcessUtils } from 'wdRouter';
import { CommonConstants } from 'wdConstant/Index';
import {CarderInteraction} from '../CarderInteraction'
import { CarderInteraction } from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG = 'Card19Component';
... ... @@ -45,9 +45,9 @@ export struct Card19Component {
}
return photo
})
ProcessUtils.gotoMultiPictureListPage(photoList,0)
ProcessUtils.gotoMultiPictureListPage(photoList, 0)
})
CarderInteraction({contentDTO: this.contentDTO})
CarderInteraction({ contentDTO: this.contentDTO })
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ... @@ -79,8 +79,8 @@ struct createImg {
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
this.fullColumnImgUrls.splice(2,0, {
if (this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
this.fullColumnImgUrls.splice(2, 0, {
fullUrl: ''
} as FullColumnImgUrlDTO)
}
... ... @@ -123,7 +123,6 @@ struct createImg {
}
}
build() {
GridRow({
gutter: { x: 2, y: 2 }
... ...
//全标题 "appStyle":"2",
import { ContentDTO } from 'wdBean';
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
... ... @@ -22,6 +22,7 @@ export struct Card2Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@ObjectLink compDTO: CompDTO
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
... ... @@ -90,7 +91,7 @@ export struct Card2Component {
//bottom
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { CompDTO, ContentDTO } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
... ... @@ -12,7 +12,7 @@ import { Notes } from './notes';
export struct Card3Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State clicked: boolean = false;
@ObjectLink compDTO: CompDTO
build() {
Column() {
Stack() {
... ... @@ -27,7 +27,7 @@ export struct Card3Component {
}.alignContent(Alignment.TopStart)
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({compDTO:this.compDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ...
import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { CompDTO, ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG: string = 'Card4Component';
/**
... ... @@ -22,7 +23,7 @@ export struct Card4Component {
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
@ObjectLink compDTO: CompDTO
async aboutToAppear(): Promise<void> {
this.titleInit();
... ... @@ -96,7 +97,7 @@ export struct Card4Component {
ProcessUtils.processPage(this.contentDTO)
})
//bottom 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ...
import { ContentDTO } from 'wdBean';
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
// import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { Logger } from 'wdKit/Index';
const TAG: string = 'Card6Component-Card13Component';
... ... @@ -15,13 +14,14 @@ const TAG: string = 'Card6Component-Card13Component';
*/
@Component
export struct Card6Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
@ObjectLink compDTO: CompDTO
@State contentDTO: ContentDTO = new ContentDTO();
async aboutToAppear(): Promise<void> {
Logger.info('titleInit', JSON.stringify(this.contentDTO))
... ... @@ -87,7 +87,7 @@ export struct Card6Component {
//bottom 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({ compDTO: this.compDTO,contentDTO:this.contentDTO })
}
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Start)
... ...
import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { CompDTO, ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
... ... @@ -61,7 +61,7 @@ export struct SearchContentComponent {
ProcessUtils.processPage(this.contentDTO)
})
//bottom 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
CardSourceInfo({compDTO:new CompDTO, contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
... ...
... ... @@ -117,7 +117,7 @@ struct BrowsingHistoryPage {
.margin({left:16})
}
Column() {
BigPicCardComponent({contentDTO:compDTO})
BigPicCardComponent({compDTO:new CompDTO,contentDTO:compDTO})
}
}
}
... ...
... ... @@ -4,7 +4,7 @@ import PageModel from '../../viewmodel/PageModel';
import { CommonConstants, ViewType } from 'wdConstant'
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
import { ErrorComponent } from '../view/ErrorComponent'
import { ContentDTO } from 'wdBean'
import { CompDTO, ContentDTO } from 'wdBean'
import NoMoreLayout from './NoMoreLayout'
import { CustomSelectUI } from '../view/CustomSelectUI';
import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
... ... @@ -117,7 +117,7 @@ struct MyCollectionListPage {
.margin({left:16})
}
Column() {
BigPicCardComponent({contentDTO:compDTO})
BigPicCardComponent({compDTO:new CompDTO,contentDTO:compDTO})
}
}
}
... ...
... ... @@ -14,6 +14,7 @@ import PageNoMoreLayout from './PageNoMoreLayout';
import { NoMoreBean } from './NoMoreBean';
import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean';
import RefreshLayout from '../refresh/RefreshLayout';
import json from '@ohos.util.json';
const TAG = 'PageComponent';
... ... @@ -80,8 +81,7 @@ export struct PageComponent {
}
}
},
(compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp
)
(compDTO: CompDTO, compIndex: number) => JSON.stringify(compDTO))
// 加载更多
ListItem() {
... ...
import { ContentDTO , Action,GoldenPositionExtraBean} from 'wdBean';
import { ContentDTO , Action,GoldenPositionExtraBean, CompDTO} from 'wdBean';
import { CommonConstants ,ViewType} from 'wdConstant';
import PageViewModel from '../../viewmodel/PageViewModel';
import PageModel from '../../viewmodel/PageModel';
... ... @@ -128,7 +128,7 @@ struct ThemeListPage {
LazyForEach(this.pageModel.compList, (contentDTO: ContentDTO, contentIndex: number) => {
ListItem() {
Column() {
CardParser({ contentDTO });
CardParser({compDTO:new CompDTO, contentDTO });
}
}
},
... ...
... ... @@ -8,7 +8,8 @@ import {
AttentionBatchDTO,
CreatorDTO,
contentListParams,
InteractDataDTO
InteractDataDTO,
CompDTO
} from 'wdBean';
import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType';
import { channelSkeleton } from '../skeleton/channelSkeleton'
... ... @@ -150,7 +151,7 @@ export struct PeopleShipMainComponent {
}
ForEach(this.attentionList, (item: ContentDTO) => {
ListItem() {
CardParser({ contentDTO: item })
CardParser({compDTO:new CompDTO, contentDTO: item })
}.width("100%")
.backgroundColor(Color.Transparent)
... ...
... ... @@ -12,7 +12,8 @@ import {
InteractDataDTO,
ArticleTypeData,
ArticleListData,
PeopleShipUserDetailData
PeopleShipUserDetailData,
CompDTO
} from 'wdBean'
import { CardParser } from '../CardParser'
import { PageRepository } from '../../repository/PageRepository'
... ... @@ -79,7 +80,7 @@ export struct PeopleShipHomeArticleListComponent {
// 下拉刷新
ForEach(this.arr, (item: ContentDTO) => {
ListItem() {
CardParser({ contentDTO: item })
CardParser({compDTO:new CompDTO, contentDTO: item })
}.width("100%")
.backgroundColor(Color.Transparent)
}, (item: ContentDTO, index: number) => item.objectId + index.toString())
... ...
import { ContentDTO } from 'wdBean/Index'
import { CompDTO, ContentDTO } from 'wdBean/Index'
import { LazyDataSource, UserDataLocal } from 'wdKit/Index'
import { HttpUtils } from 'wdNetwork/Index'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
... ... @@ -96,7 +96,7 @@ export struct SearchResultComponent {
LazyForEach(this.data, (item: ContentDTO, index: number) => {
ListItem() {
Column() {
CardParser({contentDTO:item})
CardParser({compDTO:new CompDTO,contentDTO:item})
if (index != this.data.totalCount() - 1) {
Divider()
.width('100%')
... ...
import {
CompDTO,
ContentDTO,
contentListParams,
FullColumnImgUrlDTO,
... ... @@ -243,7 +244,7 @@ export struct SearchResultContentComponent {
if (this.searchType == "activity") {
ActivityItemComponent({ contentDTO: item })
} else {
CardParser({ contentDTO: item })
CardParser({compDTO:new CompDTO, contentDTO: item })
}
if (index != this.data.totalCount() - 1) {
Divider()
... ...
... ... @@ -14,7 +14,7 @@ const TAG: string = 'BigPicCardComponent';
// @Entry
@Component
export struct BigPicCardComponent {
@State compDTO: CompDTO = {} as CompDTO
@ObjectLink compDTO: CompDTO
contentDTO: ContentDTO = new ContentDTO();
aboutToAppear() {
... ... @@ -110,7 +110,7 @@ export struct BigPicCardComponent {
@Builder
cardBuild() {
CardParser({ contentDTO: this.contentDTO });
CardParser({ compDTO: this.compDTO, contentDTO: this.contentDTO });
}
}
... ... @@ -121,7 +121,8 @@ export struct BigPicCardComponent {
*/
@Component
export struct myBigCard_body {
private newsSrc: string = "https://k.sinaimg.cn/n/default/crawl/190/w550h440/20240118/6772-7c2385bb2741c6f88906af3514d27343.png/w700d1q75cms.jpg";
private newsSrc: string =
"https://k.sinaimg.cn/n/default/crawl/190/w550h440/20240118/6772-7c2385bb2741c6f88906af3514d27343.png/w700d1q75cms.jpg";
private newsTitle: string = "时政微观察丨新征程金融工作怎么干?“新年第一课”这样讲";
build() {
... ...
import { ContentDTO } from 'wdBean';
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { CardParser } from '../CardParser';
... ... @@ -29,7 +29,7 @@ export struct RecommendList {
}
ForEach(this.recommendList, (item: ContentDTO, index: number) => {
Row() {
CardParser({ contentDTO: item });
CardParser({ compDTO:new CompDTO,contentDTO: item });
}
if (this.recommendList.length !== index + 1) {
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
... ...
... ... @@ -52,13 +52,13 @@ export class PageHelper {
getPageInfo(pageModel: PageModel, pageAdvModel: PageAdModel) {
pageModel.currentPage = 1;
if(pageModel.pageType == 1){
PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize,pageModel.extra).then((liveReviewDTO) => {
if(liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0){
if (pageModel.pageType == 1) {
PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => {
if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) {
pageModel.viewType = ViewType.EMPTY;
pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1;
return;
}else{
} else {
//更新数据
pageModel.compList.addItems(liveReviewDTO.list);
closeRefresh(pageModel, true);
... ... @@ -66,7 +66,7 @@ export class PageHelper {
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
})
}else{
} else {
PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => {
if (pageInfo == null) {
pageModel.viewType = ViewType.EMPTY;
... ... @@ -103,7 +103,7 @@ export class PageHelper {
let index = pageInfo.groups.indexOf(group)
if (index == 0) {
// 清空comp列表
pageModel.compList.clear()
pageModel.compList.clearAllData()
}
this.getGroupData(pageModel, pageDto, index == pageInfo.groups.length - 1)
... ... @@ -119,7 +119,6 @@ export class PageHelper {
}
private async getGroupData(pageModel: PageModel, pageDto: PageDTO, isLastGroup: boolean) {
pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
if (pageDto && pageDto.compList && pageDto.compList.length > 0) {
pageModel.viewType = ViewType.LOADED;
if (isLastGroup) {
... ... @@ -135,12 +134,9 @@ export class PageHelper {
// TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上)
// TODO updateItems(sizeBefore, data),这里可能有时序问题,导致覆盖别的group数据,需要优化,考虑精准替换
// 二次请求,批查互动数据
PageViewModel.getInteractData(pageDto.compList).then((data: InteractDataDTO[]) => {
// 刷新,替换所有数据
this.resetInteract(data, pageModel.compList)
pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
pageModel.compList.reloadData()
})
this.allCompBatchRequest(pageDto.compList, pageModel)
// content级别的展现加载丢给comp自己,这里只需要处理屏蔽分页加载,pageModel.pageScroll
if (isLastGroup) {
closeRefresh(pageModel, true);
... ... @@ -277,11 +273,9 @@ export class PageHelper {
// console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " " + advPosition + " " + a + " " + b)
if (b <= pageCompSize && b >= 0) {
let advComp: CompDTO = {
compStyle: CompStyle.Card_Comp_Adv,
matInfo: matInfo
} as CompDTO;
let advComp: CompDTO = new CompDTO;
advComp.compStyle = CompStyle.Card_Comp_Adv
advComp.matInfo = matInfo
if (pageCompSize == slotInfo.position) {
pageCompList.add(advComp)
} else {
... ... @@ -307,12 +301,12 @@ export class PageHelper {
*/
private compLoadMore(pageModel: PageModel) {
//聚合页
if(pageModel.pageType == 1){
PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize,pageModel.extra).then((liveReviewDTO) => {
if(liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0){
if (pageModel.pageType == 1) {
PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => {
if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) {
pageModel.hasMore = false;
return;
}else{
} else {
//更新数据
pageModel.compList.addItems(liveReviewDTO.list);
// 直接认为有分页,一直加载分页。直到没有数据,再停止
... ... @@ -323,10 +317,9 @@ export class PageHelper {
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
})
}else{
} else {
PageViewModel.getPageData(pageModel.bizCopy())
.then((data: PageDTO) => {
pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
if (data == null || data.compList == null || data.compList.length == 0) {
pageModel.hasMore = false;
} else {
... ... @@ -336,14 +329,8 @@ export class PageHelper {
//移除音频 和 活动
this.collectPageComp(pageModel, data)
// TODO 暂时屏蔽,此处代码会造成 广告逻辑错乱,只有第一页有广告数据,随着加载更多,第二页也会出现广告数据
PageViewModel.getInteractData(data.compList).then((data: InteractDataDTO[]) => {
// 刷新,替换所有数据
this.resetInteract(data, pageModel.compList)
pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
pageModel.compList.reloadData()
})
// 参与批查
this.allCompBatchRequest(data.compList, pageModel)
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
... ... @@ -351,6 +338,30 @@ export class PageHelper {
}
}
/**
* 信息流页面,所有稿件需要参与批查,如 批查评论、批查关注状态等接口
* @param compList
* @param pageModel
*/
private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) {
PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => {
// 刷新,替换所有数据
this.resetInteract(data, pageModel.compList)
})
// 测试数据
// setTimeout(() => {
// let index = 1
// let comp = pageModel.compList.getData(index) as CompDTO
// comp.hasMore = 0
// //comp.operDataList[0].newsTitle = '测试111'
// let con :InteractDataDTO = new InteractDataDTO;
// con.commentNum=1000
// comp.operDataList[0].interactData = con
// Logger.debug("ZZZXXXXX",
// "-----setTimeout--------->" + comp.hasMore)
// }, 4 * 1000)
}
/**
* 移除comp
... ... @@ -359,9 +370,7 @@ export class PageHelper {
let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器
let datas = pageDto.compList
for (let index = 0; index < datas.length; index++) {
const element = datas[index];
pageDto.compList.forEach((element: CompDTO) => {
let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0);
//移除音频 和 活动
if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) {
... ... @@ -372,24 +381,21 @@ export class PageHelper {
} else {
pageCompList.add(element)
}
}
}
})
// 记录
pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize
// console.error("ZZZXXXXX", " collectPageComp--->" + pageModel.pageTotalCompSize);
// 处理页面广告数据,投放到页面的位置
this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto);
//遍历所有组件和稿件数据 push到页面
for (let element of pageCompList) {
pageModel.compList.push(element)
pageModel.compList.push(CompDTO.createNewsBean(element))
}
}
/**
... ... @@ -401,6 +407,7 @@ export class PageHelper {
if (interact == null || interact.length == 0) {
return
}
let time = DateTimeUtils.getTimeStamp().toString()
interact.forEach((interactData) => {
let id = interactData.contentId;
outer: for (let i = 0; i < compList.totalCount(); i++) {
... ... @@ -415,6 +422,7 @@ export class PageHelper {
}
if (id == content.objectId) {
content.interactData = interactData;
comp.timestamp = time
break outer;
}
}
... ...
... ... @@ -13,6 +13,7 @@ import {
NavigationDetailDTO,
LiveRoomDataBean
} from 'wdBean';
import { CompStyle } from 'wdConstant/Index';
import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit';
import { ResponseDTO, } from 'wdNetwork';
... ... @@ -48,14 +49,15 @@ export class PageViewModel extends BaseViewModel {
return this.getNavData();
}
async getBottomNavDetailData(id:number): Promise<NavigationDetailDTO> {
async getBottomNavDetailData(id: number): Promise<NavigationDetailDTO> {
Logger.info(TAG, `getBottomNavDetailData start`);
return this.getNavDetailData(id);
}
async getBottomNavDataMock(context: Context): Promise<NavigationBodyDTO> {
Logger.info(TAG, `getBottomNavDataMock start`);
let compRes: ResponseDTO<NavigationBodyDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<NavigationBodyDTO>>(context, 'bottom_nav.json');
let compRes: ResponseDTO<NavigationBodyDTO> | null =
await ResourcesUtils.getResourcesJson<ResponseDTO<NavigationBodyDTO>>(context, 'bottom_nav.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getBottomNavDataMock compRes bottomNavList is empty`);
return {} as NavigationBodyDTO
... ... @@ -88,7 +90,7 @@ export class PageViewModel extends BaseViewModel {
})
}
private getNavDetailData(id:number): Promise<NavigationDetailDTO> {
private getNavDetailData(id: number): Promise<NavigationDetailDTO> {
return new Promise<NavigationDetailDTO>((success, error) => {
Logger.info(TAG, `getNavData start`);
PageRepository.fetchNavigationDetailDataApi(id).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => {
... ... @@ -122,7 +124,8 @@ export class PageViewModel extends BaseViewModel {
// 加载更多,返回无数据
return {} as PageDTO
}
let compRes: ResponseDTO<PageDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list0.json');
let compRes: ResponseDTO<PageDTO> | null =
await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list0.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getCompList compRes is empty`);
return {} as PageDTO
... ... @@ -164,7 +167,8 @@ export class PageViewModel extends BaseViewModel {
}
private async getPageData2(context: Context): Promise<PageDTO> {
let compRes: ResponseDTO<PageDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list2.json');
let compRes: ResponseDTO<PageDTO> | null =
await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list2.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getCompList compRes is empty`);
return {} as PageDTO
... ... @@ -339,7 +343,15 @@ export class PageViewModel extends BaseViewModel {
param.contentList = new Array<ContentBean>();
compList.forEach((value) => {
let contentList = value.operDataList;
if (contentList != null && contentList.length > 0) {
let letBatch = false
// 只有稿件才能批查
if (!Number.isNaN(Number(value.compStyle))) {
letBatch = true
}
if (letBatch) {
if (contentList != null && contentList.length == 1) { // 对只有一条数据的稿件参与批查
contentList.forEach((v) => {
if (StringUtils.isNotEmpty(v.objectId)) {
let bean = {} as ContentBean;
... ... @@ -349,6 +361,7 @@ export class PageViewModel extends BaseViewModel {
}
})
}
}
})
return param;
}
... ... @@ -414,7 +427,7 @@ export class PageViewModel extends BaseViewModel {
})
}
async postThemeList(pageNum: number, pageSize: number,extra: string) : Promise<LiveReviewDTO> {
async postThemeList(pageNum: number, pageSize: number, extra: string): Promise<LiveReviewDTO> {
let bean: GoldenPositionExtraBean = JSON.parse(extra)
bean.pageNum = pageNum
bean.pageSize = pageSize
... ...
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
import app from '@system.app';
import hilog from '@ohos.hilog';
import UIAbility from '@ohos.app.ability.UIAbility';
import Want from '@ohos.app.ability.Want';
... ... @@ -18,6 +19,11 @@ export default class EntryAbility extends UIAbility {
// 还没深色模式需求,暂直接不跟随系统。
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT);
app.setImageRawDataCacheSize(100) // 100 设置内存中缓存解码后图片的数量上限,单位为 number。
app.setImageCacheCount(100 * 1024 * 1024) // 设置解码前图片数据内存缓存上限为100MB。设置内存中缓存解码前图片数据的大小上限,单位为字节。
app.setImageFileCacheSize(100 * 1024 * 1024) // 设置图片文件缓存的大小上限,单位为字节
}
// App活着情况下,点击推送通知进入
... ...