Showing
35 changed files
with
316 additions
and
219 deletions
| @@ -37,6 +37,7 @@ export abstract class BasicDataSource<T> implements IDataSource { | @@ -37,6 +37,7 @@ export abstract class BasicDataSource<T> implements IDataSource { | ||
| 37 | }) | 37 | }) |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | + | ||
| 40 | // 通知控制器数据增加 | 41 | // 通知控制器数据增加 |
| 41 | public notifyDataAdd(index: number): void { | 42 | public notifyDataAdd(index: number): void { |
| 42 | this.listeners.forEach(listener => { | 43 | this.listeners.forEach(listener => { |
| @@ -255,6 +255,7 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | @@ -255,6 +255,7 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | ||
| 255 | this.replaceAll() | 255 | this.replaceAll() |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | + | ||
| 258 | // 把数据全部删除,再添加全部新元素 | 259 | // 把数据全部删除,再添加全部新元素 |
| 259 | public replaceAll(...items: T[]): void { | 260 | public replaceAll(...items: T[]): void { |
| 260 | // 从数组中的0位置开始删除dataArray.length个元素,并在同一位置插入((1个或多个))新元素,返回已删除的元素。 | 261 | // 从数组中的0位置开始删除dataArray.length个元素,并在同一位置插入((1个或多个))新元素,返回已删除的元素。 |
| @@ -262,6 +263,8 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | @@ -262,6 +263,8 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | ||
| 262 | this.notifyDataReload() | 263 | this.notifyDataReload() |
| 263 | } | 264 | } |
| 264 | 265 | ||
| 266 | + | ||
| 267 | + | ||
| 265 | // 获取指定元素的下标 | 268 | // 获取指定元素的下标 |
| 266 | public getIndexOf(element: T): number { | 269 | public getIndexOf(element: T): number { |
| 267 | for (let index = 0; index < this.dataArray.length; index++) { | 270 | for (let index = 0; index < this.dataArray.length; index++) { |
| @@ -293,4 +296,13 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | @@ -293,4 +296,13 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | ||
| 293 | public reloadData(): void { | 296 | public reloadData(): void { |
| 294 | this.notifyDataReload(); | 297 | this.notifyDataReload(); |
| 295 | } | 298 | } |
| 299 | + //**********************////////// | ||
| 300 | + | ||
| 301 | + | ||
| 302 | + public clearAllData(){ | ||
| 303 | + | ||
| 304 | + this.dataArray = [] | ||
| 305 | + this.notifyDataReload(); | ||
| 306 | + } | ||
| 307 | + | ||
| 296 | } | 308 | } |
| @@ -4,48 +4,88 @@ import { ContentDTO } from '../content/ContentDTO'; | @@ -4,48 +4,88 @@ import { ContentDTO } from '../content/ContentDTO'; | ||
| 4 | import { BaseDTO } from './BaseDTO'; | 4 | import { BaseDTO } from './BaseDTO'; |
| 5 | 5 | ||
| 6 | @Observed | 6 | @Observed |
| 7 | -export class CompDTO implements BaseDTO{ | ||
| 8 | - backgroundColor: string=''; | ||
| 9 | - backgroundImgUrl: string=''; | ||
| 10 | - cityCode: string=''; | ||
| 11 | - compStyle: string=''; | ||
| 12 | - compType: string=''; | ||
| 13 | - | 7 | +export class CompDTO implements BaseDTO { |
| 8 | + backgroundColor: string = ''; | ||
| 9 | + backgroundImgUrl: string = ''; | ||
| 10 | + cityCode: string = ''; | ||
| 11 | + compStyle: string = ''; | ||
| 12 | + compType: string = ''; | ||
| 14 | // dataSourceRequest: any[]; | 13 | // dataSourceRequest: any[]; |
| 15 | - districtCode: string=''; | 14 | + districtCode: string = ''; |
| 16 | extraData?: string; | 15 | extraData?: string; |
| 17 | - hasAdInfo: number=-1; | ||
| 18 | - id: number=0; | ||
| 19 | - imgSize: string=''; | ||
| 20 | - innerUrl: string=''; | ||
| 21 | - linkUrl: string=''; | ||
| 22 | - | 16 | + hasAdInfo: number = -1; |
| 17 | + id: number = 0; | ||
| 18 | + imgSize: string = ''; | ||
| 19 | + innerUrl: string = ''; | ||
| 20 | + linkUrl: string = ''; | ||
| 23 | // meddleDataList: any[]; | 21 | // meddleDataList: any[]; |
| 24 | - name: string=''; | ||
| 25 | - objectId: string=''; // 跳转页面id? | ||
| 26 | - objectTitle: string=''; // comp标题 | 22 | + name: string = ''; |
| 23 | + objectId: string = ''; // 跳转页面id? | ||
| 24 | + objectTitle: string = ''; // comp标题 | ||
| 27 | // objectType?: string; // 跳转类型,枚举: | 25 | // objectType?: string; // 跳转类型,枚举: |
| 28 | - operDataList: ContentDTO[]=[]; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】 | 26 | + operDataList: ContentDTO[] = []; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】 |
| 29 | // pageId?: any; | 27 | // pageId?: any; |
| 30 | - posterSize: string=''; | ||
| 31 | - posterUrl: string=''; | ||
| 32 | - provinceCode: string=''; | ||
| 33 | - sortValue: number=-1; | ||
| 34 | - subType: string=''; | ||
| 35 | - imageScale: number=-1; // 封面图比例 1-4:3, 2-16:9, 3-3:2 | ||
| 36 | - audioDataList: AudioDTO[]=[]; | ||
| 37 | - titleShowPolicy: string | number=''; | ||
| 38 | - | 28 | + posterSize: string = ''; |
| 29 | + posterUrl: string = ''; | ||
| 30 | + provinceCode: string = ''; | ||
| 31 | + sortValue: number = -1; | ||
| 32 | + subType: string = ''; | ||
| 33 | + imageScale: number = -1; // 封面图比例 1-4:3, 2-16:9, 3-3:2 | ||
| 34 | + audioDataList: AudioDTO[] = []; | ||
| 35 | + titleShowPolicy: string | number = ''; | ||
| 39 | /** | 36 | /** |
| 40 | * 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING ) | 37 | * 组件内容源类型 (LIVE_HORIZONTAL_CARD\LIVE_RESERVATION\LIVE_LARGE_CARD\LIVE_END\LIVE_MONTHLY_RANKING ) |
| 41 | */ | 38 | */ |
| 42 | - dataSourceType: string=''; | ||
| 43 | - | 39 | + dataSourceType: string = ''; |
| 44 | /** | 40 | /** |
| 45 | * 信息流广告素材 | 41 | * 信息流广告素材 |
| 46 | */ | 42 | */ |
| 47 | matInfo: CompAdvMatInfoBean = {} as CompAdvMatInfoBean | 43 | matInfo: CompAdvMatInfoBean = {} as CompAdvMatInfoBean |
| 48 | - | ||
| 49 | pageId?: string; | 44 | pageId?: string; |
| 50 | objectType?: string; | 45 | objectType?: string; |
| 46 | + hasMore: number = 1 | ||
| 47 | + | ||
| 48 | + // keyGenerator相关字符串,用于刷新list布局 | ||
| 49 | + timestamp: String = '1' | ||
| 50 | + /** | ||
| 51 | + * 创建新的compbean对象 | ||
| 52 | + * @param old | ||
| 53 | + * @returns | ||
| 54 | + */ | ||
| 55 | + static createNewsBean(old: CompDTO): CompDTO { | ||
| 56 | + let comp: CompDTO = new CompDTO | ||
| 57 | + comp.compStyle = old.compStyle | ||
| 58 | + comp.compType = old.compType | ||
| 59 | + comp.operDataList = old.operDataList | ||
| 60 | + comp.extraData = old.extraData | ||
| 61 | + comp.matInfo = old.matInfo | ||
| 62 | + | ||
| 63 | + comp.backgroundColor = old.backgroundColor | ||
| 64 | + comp.backgroundImgUrl = old.backgroundImgUrl | ||
| 65 | + comp.cityCode = old.cityCode | ||
| 66 | + comp.districtCode = old.districtCode | ||
| 67 | + comp.provinceCode = old.provinceCode | ||
| 68 | + comp.hasAdInfo = old.hasAdInfo | ||
| 69 | + comp.id = old.id | ||
| 70 | + comp.imgSize = old.imgSize | ||
| 71 | + comp.innerUrl = old.innerUrl | ||
| 72 | + comp.linkUrl = old.linkUrl | ||
| 73 | + comp.name = old.name | ||
| 74 | + comp.objectId = old.objectId | ||
| 75 | + comp.objectTitle = old.objectTitle | ||
| 76 | + comp.posterSize = old.posterSize | ||
| 77 | + comp.posterUrl = old.posterUrl | ||
| 78 | + comp.sortValue = old.sortValue | ||
| 79 | + comp.subType = old.subType | ||
| 80 | + comp.imageScale = old.imageScale | ||
| 81 | + comp.audioDataList = old.audioDataList | ||
| 82 | + comp.titleShowPolicy = old.titleShowPolicy | ||
| 83 | + comp.pageId = old.pageId | ||
| 84 | + comp.extraData = old.extraData | ||
| 85 | + comp.dataSourceType = old.dataSourceType | ||
| 86 | + comp.objectType = old.objectType | ||
| 87 | + comp.hasMore = old.hasMore | ||
| 88 | + | ||
| 89 | + return comp | ||
| 90 | + } | ||
| 51 | } | 91 | } |
| @@ -26,38 +26,39 @@ import { Logger } from 'wdKit/Index'; | @@ -26,38 +26,39 @@ import { Logger } from 'wdKit/Index'; | ||
| 26 | @Component | 26 | @Component |
| 27 | export struct CardParser { | 27 | export struct CardParser { |
| 28 | @State contentDTO: ContentDTO = new ContentDTO(); | 28 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 29 | - @State compDTO: CompDTO = {} as CompDTO | 29 | + @ObjectLink compDTO: CompDTO |
| 30 | 30 | ||
| 31 | aboutToAppear(): void { | 31 | aboutToAppear(): void { |
| 32 | Logger.info('contentDTO.contentText', JSON.stringify(this.contentDTO)) | 32 | Logger.info('contentDTO.contentText', JSON.stringify(this.contentDTO)) |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | build() { | 35 | build() { |
| 36 | - this.contentBuilder(this.contentDTO, this.compDTO); | 36 | + this.contentBuilder(this.contentDTO); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | @Builder | 39 | @Builder |
| 40 | - contentBuilder(contentDTO: ContentDTO, compDTO: CompDTO) { | 40 | + contentBuilder(contentDTO: ContentDTO) { |
| 41 | + // Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) | ||
| 41 | if (!!contentDTO.contentText) { | 42 | if (!!contentDTO.contentText) { |
| 42 | SearchContentComponent({ contentDTO }) | 43 | SearchContentComponent({ contentDTO }) |
| 43 | } else { | 44 | } else { |
| 44 | if (contentDTO.appStyle === CompStyle.Card_02) { | 45 | if (contentDTO.appStyle === CompStyle.Card_02) { |
| 45 | - Card2Component({ contentDTO }) | 46 | + Card2Component({ compDTO: this.compDTO, contentDTO }) |
| 46 | } else if (contentDTO.appStyle === CompStyle.Card_03) { | 47 | } else if (contentDTO.appStyle === CompStyle.Card_03) { |
| 47 | - Card3Component({ contentDTO }) | 48 | + Card3Component({ compDTO: this.compDTO, contentDTO }) |
| 48 | } else if (contentDTO.appStyle === CompStyle.Card_04) { | 49 | } else if (contentDTO.appStyle === CompStyle.Card_04) { |
| 49 | - Card4Component({ contentDTO }) | 50 | + Card4Component({ compDTO: this.compDTO, contentDTO }) |
| 50 | } else if (contentDTO.appStyle === CompStyle.Card_05) { | 51 | } else if (contentDTO.appStyle === CompStyle.Card_05) { |
| 51 | - Card5Component({ contentDTO, titleShowPolicy: compDTO.titleShowPolicy }) | 52 | + Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy }) |
| 52 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle | 53 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle |
| 53 | .Card_13) { | 54 | .Card_13) { |
| 54 | - Card6Component({ contentDTO }) | 55 | + Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 55 | } else if (contentDTO.appStyle === CompStyle.Card_09) { | 56 | } else if (contentDTO.appStyle === CompStyle.Card_09) { |
| 56 | Card9Component({ contentDTO }) | 57 | Card9Component({ contentDTO }) |
| 57 | } else if (contentDTO.appStyle === CompStyle.Card_10) { | 58 | } else if (contentDTO.appStyle === CompStyle.Card_10) { |
| 58 | - Card10Component({ contentDTO }) | 59 | + Card10Component({ compDTO: this.compDTO, contentDTO }) |
| 59 | } else if (contentDTO.appStyle === CompStyle.Card_11) { | 60 | } else if (contentDTO.appStyle === CompStyle.Card_11) { |
| 60 | - Card11Component({ contentDTO }) | 61 | + Card11Component({ compDTO: this.compDTO, contentDTO }) |
| 61 | } else if (contentDTO.appStyle === CompStyle.Card_12) { | 62 | } else if (contentDTO.appStyle === CompStyle.Card_12) { |
| 62 | Card12Component({ contentDTO }) | 63 | Card12Component({ contentDTO }) |
| 63 | } else if (contentDTO.appStyle === CompStyle.Card_14) { | 64 | } else if (contentDTO.appStyle === CompStyle.Card_14) { |
| @@ -67,7 +68,7 @@ export struct CardParser { | @@ -67,7 +68,7 @@ export struct CardParser { | ||
| 67 | } else if (contentDTO.appStyle === CompStyle.Card_16) { | 68 | } else if (contentDTO.appStyle === CompStyle.Card_16) { |
| 68 | Card16Component({ contentDTO }) | 69 | Card16Component({ contentDTO }) |
| 69 | } else if (contentDTO.appStyle === CompStyle.Card_17) { | 70 | } else if (contentDTO.appStyle === CompStyle.Card_17) { |
| 70 | - Card17Component({ contentDTO }) | 71 | + Card17Component({ compDTO: this.compDTO, contentDTO }) |
| 71 | } else if (contentDTO.appStyle === CompStyle.Card_19) { | 72 | } else if (contentDTO.appStyle === CompStyle.Card_19) { |
| 72 | Card19Component({ contentDTO }) | 73 | Card19Component({ contentDTO }) |
| 73 | } else if (contentDTO.appStyle === CompStyle.Card_20) { | 74 | } else if (contentDTO.appStyle === CompStyle.Card_20) { |
| @@ -82,6 +83,5 @@ export struct CardParser { | @@ -82,6 +83,5 @@ export struct CardParser { | ||
| 82 | // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle | 83 | // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle |
| 83 | } | 84 | } |
| 84 | } | 85 | } |
| 85 | - | ||
| 86 | } | 86 | } |
| 87 | } | 87 | } |
| 1 | import { CompDTO } from 'wdBean'; | 1 | import { CompDTO } from 'wdBean'; |
| 2 | -import { CommonConstants, CompStyle } from 'wdConstant'; | ||
| 3 | -import { LabelComponent } from './view/LabelComponent'; | 2 | +import { CommonConstants, CompStyle } from 'wdConstant/Index'; |
| 3 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 4 | +import PageModel from '../viewmodel/PageModel'; | ||
| 5 | +import { CardParser } from './CardParser'; | ||
| 6 | +import { Card2Component } from './cardview/Card2Component'; | ||
| 7 | +import { Card5Component } from './cardview/Card5Component'; | ||
| 8 | +import { AdvCardParser } from './cardViewAdv/AdvCardParser'; | ||
| 9 | +import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; | ||
| 10 | +import { ZhGridLayout02 } from './compview/ZhGridLayout02'; | ||
| 11 | +import { ZhGridLayout03 } from './compview/ZhGridLayout03'; | ||
| 12 | +import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; | ||
| 13 | +import { ZhSingleColumn05 } from './compview/ZhSingleColumn05'; | ||
| 14 | +import { ZhSingleColumn09 } from './compview/ZhSingleColumn09'; | ||
| 15 | +import { ZhSingleRow02 } from './compview/ZhSingleRow02'; | ||
| 16 | +import { ZhSingleRow03 } from './compview/ZhSingleRow03'; | ||
| 17 | +import { ZhSingleRow04 } from './compview/ZhSingleRow04'; | ||
| 18 | +import { ZhSingleRow06 } from './compview/ZhSingleRow06'; | ||
| 4 | import { | 19 | import { |
| 5 | HorizontalStrokeCardThreeTwoRadioForMoreComponent | 20 | HorizontalStrokeCardThreeTwoRadioForMoreComponent |
| 6 | } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent'; | 21 | } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent'; |
| 7 | import { | 22 | import { |
| 8 | HorizontalStrokeCardThreeTwoRadioForOneComponent | 23 | HorizontalStrokeCardThreeTwoRadioForOneComponent |
| 9 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; | 24 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; |
| 10 | -import { ZhSingleRow02 } from './compview/ZhSingleRow02'; | ||
| 11 | -import { ZhSingleRow03 } from './compview/ZhSingleRow03'; | ||
| 12 | -import { ZhSingleRow04 } from './compview/ZhSingleRow04'; | ||
| 13 | -import { ZhSingleRow06 } from './compview/ZhSingleRow06'; | ||
| 14 | -import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; | ||
| 15 | -import { ZhSingleColumn09 } from './compview/ZhSingleColumn09'; | ||
| 16 | -import { ZhGridLayout03 } from './compview/ZhGridLayout03'; | ||
| 17 | -import { CardParser } from './CardParser'; | ||
| 18 | -import { ZhGridLayout02 } from './compview/ZhGridLayout02'; | ||
| 19 | -import { Card2Component } from './cardview/Card2Component'; | ||
| 20 | -import { Card5Component } from './cardview/Card5Component'; | ||
| 21 | -import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 22 | -import { AdvCardParser } from './cardViewAdv/AdvCardParser'; | ||
| 23 | -import PageModel from '../viewmodel/PageModel'; | 25 | +import { LabelComponent } from './view/LabelComponent'; |
| 24 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; | 26 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; |
| 25 | -import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; | ||
| 26 | 27 | ||
| 27 | /** | 28 | /** |
| 28 | * comp适配器. | 29 | * comp适配器. |
| 29 | * 首页楼层comp解析器. | 30 | * 首页楼层comp解析器. |
| 30 | */ | 31 | */ |
| 31 | -@Preview | ||
| 32 | @Component | 32 | @Component |
| 33 | export struct CompParser { | 33 | export struct CompParser { |
| 34 | - @State compDTO: CompDTO = {} as CompDTO | 34 | + @ObjectLink compDTO: CompDTO |
| 35 | @State compIndex: number = 0; | 35 | @State compIndex: number = 0; |
| 36 | @State private pageModel: PageModel = new PageModel(); | 36 | @State private pageModel: PageModel = new PageModel(); |
| 37 | 37 | ||
| @@ -39,83 +39,87 @@ export struct CompParser { | @@ -39,83 +39,87 @@ export struct CompParser { | ||
| 39 | Column() { | 39 | Column() { |
| 40 | if (this.compDTO.name != "月度排行卡") { | 40 | if (this.compDTO.name != "月度排行卡") { |
| 41 | 41 | ||
| 42 | - this.componentBuilder(this.compDTO, this.compIndex); | 42 | + this.componentBuilder(); |
| 43 | } | 43 | } |
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | @Builder | 47 | @Builder |
| 48 | - componentBuilder(compDTO: CompDTO, compIndex: number) { | ||
| 49 | - //if (compDTO.operDataList[0]?.objectType !== '3' && compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口 | ||
| 50 | - if (compDTO.compStyle === CompStyle.Label_03) { | ||
| 51 | - LabelComponent({ compDTO: compDTO }) | 48 | + componentBuilder() { |
| 49 | + | ||
| 50 | + //CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO:this.compDTO }) | ||
| 51 | + | ||
| 52 | + if (this.compDTO.operDataList[0]?.objectType !== '3' && | ||
| 53 | + this.compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口 | ||
| 54 | + if (this.compDTO.compStyle === CompStyle.Label_03) { | ||
| 55 | + LabelComponent({ compDTO: this.compDTO }) | ||
| 52 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 56 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 53 | - } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | ||
| 54 | - ZhCarouselLayout01({ compDTO: compDTO }) | 57 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { |
| 58 | + ZhCarouselLayout01({ compDTO: this.compDTO }) | ||
| 55 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 59 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 56 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && | ||
| 57 | - compDTO.imageScale === 2) { // && compDTO.name ==="横划卡" | 60 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && |
| 61 | + this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡" | ||
| 58 | 62 | ||
| 59 | - LiveHorizontalCardComponent({ compDTO: compDTO }) | 63 | + LiveHorizontalCardComponent({ compDTO: this.compDTO }) |
| 60 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 64 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 61 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 3) { | ||
| 62 | - if (compDTO.operDataList.length > 1) { | ||
| 63 | - HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: compDTO }) | 65 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && this.compDTO.imageScale === 3) { |
| 66 | + if (this.compDTO.operDataList.length > 1) { | ||
| 67 | + HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: this.compDTO }) | ||
| 64 | } else { | 68 | } else { |
| 65 | - HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) | 69 | + HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: this.compDTO }) |
| 66 | } | 70 | } |
| 67 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 71 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 68 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) { | ||
| 69 | - ZhSingleRow02({ compDTO }) | 72 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_02) { |
| 73 | + ZhSingleRow02({ compDTO: this.compDTO }) | ||
| 70 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 74 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 71 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { | ||
| 72 | - ZhSingleRow03({ compDTO: compDTO }) | 75 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) { |
| 76 | + ZhSingleRow03({ compDTO: this.compDTO }) | ||
| 73 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 77 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 74 | - } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { | ||
| 75 | - ZhGridLayout02({ compDTO: compDTO }) | 78 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { |
| 79 | + ZhGridLayout02({ compDTO: this.compDTO }) | ||
| 76 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 80 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 77 | - } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { | ||
| 78 | - ZhGridLayout03({ compDTO: compDTO }) | 81 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { |
| 82 | + ZhGridLayout03({ compDTO: this.compDTO }) | ||
| 79 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 83 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 80 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_04) { | ||
| 81 | - ZhSingleRow04({ compDTO: compDTO }) | 84 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_04) { |
| 85 | + ZhSingleRow04({ compDTO: this.compDTO }) | ||
| 82 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 86 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 83 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_05) { | 87 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_05) { |
| 84 | // ZhSingleRow05({ compDTO }) | 88 | // ZhSingleRow05({ compDTO }) |
| 85 | // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 89 | // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 86 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { | ||
| 87 | - ZhSingleRow06({ compDTO }) | 90 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) { |
| 91 | + ZhSingleRow06({ compDTO: this.compDTO }) | ||
| 88 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 92 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 89 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | 93 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) { |
| 90 | //头图卡 和comStyle 2相同, | 94 | //头图卡 和comStyle 2相同, |
| 91 | - Card5Component({ contentDTO: compDTO.operDataList[0], titleShowPolicy: compDTO.titleShowPolicy }) | 95 | + Card5Component({ contentDTO: this.compDTO.operDataList[0], titleShowPolicy: this.compDTO.titleShowPolicy }) |
| 92 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 96 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 93 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) { | 97 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) { |
| 94 | // 大图卡 | 98 | // 大图卡 |
| 95 | - Card2Component({ contentDTO: compDTO.operDataList[0] }) | 99 | + Card2Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0] }) |
| 96 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 100 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 97 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_04) { | ||
| 98 | - ZhSingleColumn04({ compDTO: compDTO }) | 101 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_04) { |
| 102 | + ZhSingleColumn04({ compDTO: this.compDTO }) | ||
| 99 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 103 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 100 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) { | 104 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_05) { |
| 101 | // ZhSingleColumn05({ compDTO: compDTO }) | 105 | // ZhSingleColumn05({ compDTO: compDTO }) |
| 102 | // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 106 | // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 103 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_09) { | ||
| 104 | - ZhSingleColumn09({ compDTO }) | 107 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) { |
| 108 | + ZhSingleColumn09({ compDTO: this.compDTO }) | ||
| 105 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 109 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 106 | - } else if (compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 | ||
| 107 | - AdvCardParser({ pageModel: this.pageModel, compDTO }) | 110 | + } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 |
| 111 | + AdvCardParser({ pageModel: this.pageModel, compDTO: this.compDTO }) | ||
| 108 | //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 }) | 112 | //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 }) |
| 109 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 113 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 110 | - } else if (!Number.isNaN(Number(compDTO.compStyle))) { | ||
| 111 | - CardParser({ contentDTO: compDTO.operDataList[0], compDTO }); | 114 | + } else if (!Number.isNaN(Number(this.compDTO.compStyle))) { |
| 115 | + CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO: this.compDTO }); | ||
| 112 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 116 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 113 | } else { | 117 | } else { |
| 114 | - Text(compDTO.compStyle) | 118 | + Text(this.compDTO.compStyle) |
| 115 | .width(CommonConstants.FULL_PARENT) | 119 | .width(CommonConstants.FULL_PARENT) |
| 116 | .padding(10) | 120 | .padding(10) |
| 117 | .onClick(() => { | 121 | .onClick(() => { |
| 118 | - if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论 | 122 | + if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论 |
| 119 | WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage) | 123 | WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage) |
| 120 | } | 124 | } |
| 121 | }) | 125 | }) |
| @@ -123,6 +127,5 @@ export struct CompParser { | @@ -123,6 +127,5 @@ export struct CompParser { | ||
| 123 | } | 127 | } |
| 124 | } | 128 | } |
| 125 | 129 | ||
| 126 | - // } | 130 | + } |
| 127 | } | 131 | } |
| 128 | - |
| 1 | -import { ContentDTO } from 'wdBean' | 1 | +import { CompDTO, ContentDTO } from 'wdBean' |
| 2 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 3 | import { DateTimeUtils } from 'wdKit/Index'; | 3 | import { DateTimeUtils } from 'wdKit/Index'; |
| 4 | 4 | ||
| 5 | @Component | 5 | @Component |
| 6 | export struct CardSourceInfo { | 6 | export struct CardSourceInfo { |
| 7 | @State contentDTO: ContentDTO = new ContentDTO(); | 7 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 8 | + @ObjectLink compDTO: CompDTO | ||
| 8 | 9 | ||
| 9 | build() { | 10 | build() { |
| 10 | Flex() { | 11 | Flex() { |
| @@ -28,13 +29,14 @@ export struct CardSourceInfo { | @@ -28,13 +29,14 @@ export struct CardSourceInfo { | ||
| 28 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 29 | } | 30 | } |
| 30 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | 31 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 |
| 31 | - if (this.contentDTO.isSearch || this.contentDTO.isCollection || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | 32 | + if (this.contentDTO.isSearch || this.contentDTO.isCollection || |
| 33 | + !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | ||
| 32 | (Number | 34 | (Number |
| 33 | .parseFloat(this | 35 | .parseFloat(this |
| 34 | .contentDTO.publishTime)) | 36 | .contentDTO.publishTime)) |
| 35 | .indexOf | 37 | .indexOf |
| 36 | ('-') === -1) { | 38 | ('-') === -1) { |
| 37 | - if(this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName || this | 39 | + if (this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName || this |
| 38 | .contentDTO.rmhPlatform !== 1 && this.contentDTO.source) { | 40 | .contentDTO.rmhPlatform !== 1 && this.contentDTO.source) { |
| 39 | Image($r("app.media.point")) | 41 | Image($r("app.media.point")) |
| 40 | .width(16) | 42 | .width(16) |
| @@ -45,16 +47,30 @@ export struct CardSourceInfo { | @@ -45,16 +47,30 @@ export struct CardSourceInfo { | ||
| 45 | .fontColor($r("app.color.color_B0B0B0")) | 47 | .fontColor($r("app.color.color_B0B0B0")) |
| 46 | .flexShrink(0) | 48 | .flexShrink(0) |
| 47 | } | 49 | } |
| 48 | - if (this.contentDTO?.interactData?.commentNum) { | ||
| 49 | - Text(`${this.contentDTO.interactData.commentNum}评`) | 50 | + if (this.getContentDtoBean()?.interactData?.commentNum) { |
| 51 | + Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`) | ||
| 50 | .fontSize($r("app.float.font_size_12")) | 52 | .fontSize($r("app.float.font_size_12")) |
| 51 | .fontColor($r("app.color.color_B0B0B0")) | 53 | .fontColor($r("app.color.color_B0B0B0")) |
| 52 | .flexShrink(0) | 54 | .flexShrink(0) |
| 53 | .margin({ left: 6 }) | 55 | .margin({ left: 6 }) |
| 54 | - .visibility(Number(this.contentDTO?.interactData?.commentNum) === 0 ? Visibility.None : Visibility.Visible) | 56 | + .visibility(Number(this.getContentDtoBean()?.interactData?.commentNum) === 0 ? Visibility.None : Visibility.Visible) |
| 55 | } | 57 | } |
| 56 | } | 58 | } |
| 57 | .width(CommonConstants.FULL_WIDTH) | 59 | .width(CommonConstants.FULL_WIDTH) |
| 58 | .margin({ top: 8 }) | 60 | .margin({ top: 8 }) |
| 59 | } | 61 | } |
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 获取稿件业务对象 | ||
| 65 | + * @returns | ||
| 66 | + */ | ||
| 67 | + private getContentDtoBean(): ContentDTO { | ||
| 68 | + if (this.compDTO == undefined) { | ||
| 69 | + return new ContentDTO | ||
| 70 | + } | ||
| 71 | + if(this.compDTO.operDataList.length == 0){ | ||
| 72 | + return new ContentDTO | ||
| 73 | + } | ||
| 74 | + return this.compDTO.operDataList[0] | ||
| 75 | + } | ||
| 60 | } | 76 | } |
| @@ -61,7 +61,6 @@ export struct CardAdvBottom { | @@ -61,7 +61,6 @@ export struct CardAdvBottom { | ||
| 61 | } | 61 | } |
| 62 | if (currentIndex >= 0) { | 62 | if (currentIndex >= 0) { |
| 63 | this.pageModel.compList.deleteItem(currentIndex) | 63 | this.pageModel.compList.deleteItem(currentIndex) |
| 64 | - this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 65 | } | 64 | } |
| 66 | } | 65 | } |
| 67 | } | 66 | } |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | -import { CompDTO, ContentDTO } from 'wdBean'; | 2 | +import { CompDTO } from 'wdBean'; |
| 3 | import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData'; | 3 | import { AdvExtraData, AdvExtraItemData } from 'wdBean/src/main/ets/bean/adv/AdvExtraData'; |
| 4 | import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; | 4 | import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; |
| 5 | import { CommonConstants } from 'wdConstant/Index'; | 5 | import { CommonConstants } from 'wdConstant/Index'; |
| 6 | import { ProcessUtils } from 'wdRouter'; | 6 | import { ProcessUtils } from 'wdRouter'; |
| 7 | import PageModel from '../../viewmodel/PageModel'; | 7 | import PageModel from '../../viewmodel/PageModel'; |
| 8 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 9 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 10 | import { CardAdvTop } from './CardAdvTop'; | 8 | import { CardAdvTop } from './CardAdvTop'; |
| 11 | 9 | ||
| 12 | const TAG: string = 'Card2Component'; | 10 | const TAG: string = 'Card2Component'; |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | -import { CompDTO, ContentDTO } from 'wdBean'; | 2 | +import { CompDTO } from 'wdBean'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import PageModel from '../../viewmodel/PageModel'; | 5 | import PageModel from '../../viewmodel/PageModel'; |
| 6 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 7 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | ||
| 8 | import { CardAdvBottom } from './CardAdvBottom'; | 6 | import { CardAdvBottom } from './CardAdvBottom'; |
| 9 | 7 | ||
| 10 | const TAG: string = 'Card2Component'; | 8 | const TAG: string = 'Card2Component'; |
| @@ -73,7 +73,6 @@ export struct CardAdvTop { | @@ -73,7 +73,6 @@ export struct CardAdvTop { | ||
| 73 | } | 73 | } |
| 74 | if (currentIndex >= 0) { | 74 | if (currentIndex >= 0) { |
| 75 | this.pageModel.compList.deleteItem(currentIndex) | 75 | this.pageModel.compList.deleteItem(currentIndex) |
| 76 | - this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 77 | } | 76 | } |
| 78 | } | 77 | } |
| 79 | } | 78 | } |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | -import { CompDTO, ContentDTO, VideoInfoDTO } from 'wdBean'; | 2 | +import { CompDTO, ContentDTO } from 'wdBean'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import PageModel from '../../viewmodel/PageModel'; | 5 | import PageModel from '../../viewmodel/PageModel'; |
| 6 | -import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 7 | -import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 6 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; |
| 8 | import { CardAdvBottom } from './CardAdvBottom'; | 7 | import { CardAdvBottom } from './CardAdvBottom'; |
| 9 | 8 | ||
| 10 | const TAG: string = 'Card2Component'; | 9 | const TAG: string = 'Card2Component'; |
| 1 | -import { ContentDTO, slideShows, VideoInfoDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO, slideShows, VideoInfoDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| @@ -16,6 +16,7 @@ const TAG: string = 'Card10Component'; | @@ -16,6 +16,7 @@ const TAG: string = 'Card10Component'; | ||
| 16 | export struct Card10Component { | 16 | export struct Card10Component { |
| 17 | @State contentDTO: ContentDTO = new ContentDTO(); | 17 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 18 | @State loadImg: boolean = false; | 18 | @State loadImg: boolean = false; |
| 19 | + @ObjectLink compDTO: CompDTO | ||
| 19 | 20 | ||
| 20 | async aboutToAppear(): Promise<void> { | 21 | async aboutToAppear(): Promise<void> { |
| 21 | this.loadImg = await onlyWifiLoadImg(); | 22 | this.loadImg = await onlyWifiLoadImg(); |
| @@ -110,8 +111,10 @@ export struct Card10Component { | @@ -110,8 +111,10 @@ export struct Card10Component { | ||
| 110 | .textIndent(item.objectType == '5' ? 38 : 0) | 111 | .textIndent(item.objectType == '5' ? 38 : 0) |
| 111 | }.alignContent(Alignment.TopStart) | 112 | }.alignContent(Alignment.TopStart) |
| 112 | 113 | ||
| 114 | + //bottom 评论等信息 | ||
| 113 | CardSourceInfo( | 115 | CardSourceInfo( |
| 114 | { | 116 | { |
| 117 | + compDTO: this.compDTO, | ||
| 115 | contentDTO: this.createContent(item) | 118 | contentDTO: this.createContent(item) |
| 116 | } | 119 | } |
| 117 | ) | 120 | ) |
| 1 | //缩略标题 | 1 | //缩略标题 |
| 2 | +import { CompDTO, ContentDTO } from 'wdBean' | ||
| 3 | +import { DateTimeUtils } from 'wdKit' | ||
| 2 | import { CommonConstants } from 'wdConstant'; | 4 | import { CommonConstants } from 'wdConstant'; |
| 3 | -import { ContentDTO } from 'wdBean'; | ||
| 4 | import { ProcessUtils } from 'wdRouter'; | 5 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 6 | import { Notes } from './notes'; | 7 | import { Notes } from './notes'; |
| @@ -14,6 +15,7 @@ const TAG = 'Card11Component'; | @@ -14,6 +15,7 @@ const TAG = 'Card11Component'; | ||
| 14 | export struct Card11Component { | 15 | export struct Card11Component { |
| 15 | @State contentDTO: ContentDTO = new ContentDTO(); | 16 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 16 | @State clicked: boolean = false; | 17 | @State clicked: boolean = false; |
| 18 | + @ObjectLink compDTO: CompDTO | ||
| 17 | 19 | ||
| 18 | build() { | 20 | build() { |
| 19 | Column() { | 21 | Column() { |
| @@ -33,7 +35,7 @@ export struct Card11Component { | @@ -33,7 +35,7 @@ export struct Card11Component { | ||
| 33 | 35 | ||
| 34 | 36 | ||
| 35 | // 评论等信息 | 37 | // 评论等信息 |
| 36 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 38 | + CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 37 | }.width(CommonConstants.FULL_WIDTH) | 39 | }.width(CommonConstants.FULL_WIDTH) |
| 38 | .padding({ | 40 | .padding({ |
| 39 | left: $r('app.float.card_comp_pagePadding_lf'), | 41 | left: $r('app.float.card_comp_pagePadding_lf'), |
| @@ -13,11 +13,10 @@ const TAG = 'Card17Component'; | @@ -13,11 +13,10 @@ const TAG = 'Card17Component'; | ||
| 13 | */ | 13 | */ |
| 14 | @Component | 14 | @Component |
| 15 | export struct Card17Component { | 15 | export struct Card17Component { |
| 16 | - @State compDTO: CompDTO = {} as CompDTO | ||
| 17 | @State contentDTO: ContentDTO = new ContentDTO(); | 16 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 18 | @State loadImg: boolean = false; | 17 | @State loadImg: boolean = false; |
| 19 | @State clicked: boolean = false; | 18 | @State clicked: boolean = false; |
| 20 | - | 19 | + @ObjectLink compDTO: CompDTO |
| 21 | async aboutToAppear(): Promise<void> { | 20 | async aboutToAppear(): Promise<void> { |
| 22 | this.loadImg = await onlyWifiLoadImg(); | 21 | this.loadImg = await onlyWifiLoadImg(); |
| 23 | } | 22 | } |
| @@ -97,7 +96,7 @@ export struct Card17Component { | @@ -97,7 +96,7 @@ export struct Card17Component { | ||
| 97 | }) | 96 | }) |
| 98 | 97 | ||
| 99 | // 评论等信息 | 98 | // 评论等信息 |
| 100 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 99 | + CardSourceInfo({compDTO:this.compDTO, contentDTO: this.contentDTO }) |
| 101 | } | 100 | } |
| 102 | .width(CommonConstants.FULL_WIDTH) | 101 | .width(CommonConstants.FULL_WIDTH) |
| 103 | .padding({ | 102 | .padding({ |
| @@ -2,7 +2,7 @@ import { ContentDTO, FullColumnImgUrlDTO, PhotoListBean } from 'wdBean'; | @@ -2,7 +2,7 @@ import { ContentDTO, FullColumnImgUrlDTO, PhotoListBean } from 'wdBean'; | ||
| 2 | import { RmhTitle } from '../cardCommon/RmhTitle' | 2 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | -import {CarderInteraction} from '../CarderInteraction' | 5 | +import { CarderInteraction } from '../CarderInteraction' |
| 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 7 | 7 | ||
| 8 | const TAG = 'Card19Component'; | 8 | const TAG = 'Card19Component'; |
| @@ -45,9 +45,9 @@ export struct Card19Component { | @@ -45,9 +45,9 @@ export struct Card19Component { | ||
| 45 | } | 45 | } |
| 46 | return photo | 46 | return photo |
| 47 | }) | 47 | }) |
| 48 | - ProcessUtils.gotoMultiPictureListPage(photoList,0) | 48 | + ProcessUtils.gotoMultiPictureListPage(photoList, 0) |
| 49 | }) | 49 | }) |
| 50 | - CarderInteraction({contentDTO: this.contentDTO}) | 50 | + CarderInteraction({ contentDTO: this.contentDTO }) |
| 51 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 51 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 52 | } | 52 | } |
| 53 | .padding({ | 53 | .padding({ |
| @@ -79,8 +79,8 @@ struct createImg { | @@ -79,8 +79,8 @@ struct createImg { | ||
| 79 | 79 | ||
| 80 | async aboutToAppear(): Promise<void> { | 80 | async aboutToAppear(): Promise<void> { |
| 81 | this.loadImg = await onlyWifiLoadImg(); | 81 | this.loadImg = await onlyWifiLoadImg(); |
| 82 | - if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 | ||
| 83 | - this.fullColumnImgUrls.splice(2,0, { | 82 | + if (this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位 |
| 83 | + this.fullColumnImgUrls.splice(2, 0, { | ||
| 84 | fullUrl: '' | 84 | fullUrl: '' |
| 85 | } as FullColumnImgUrlDTO) | 85 | } as FullColumnImgUrlDTO) |
| 86 | } | 86 | } |
| @@ -123,7 +123,6 @@ struct createImg { | @@ -123,7 +123,6 @@ struct createImg { | ||
| 123 | } | 123 | } |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | - | ||
| 127 | build() { | 126 | build() { |
| 128 | GridRow({ | 127 | GridRow({ |
| 129 | gutter: { x: 2, y: 2 } | 128 | gutter: { x: 2, y: 2 } |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | -import { ContentDTO } from 'wdBean'; | 2 | +import { CompDTO, ContentDTO } from 'wdBean'; |
| 3 | import { CommonConstants } from 'wdConstant/Index'; | 3 | import { CommonConstants } from 'wdConstant/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; |
| @@ -22,6 +22,7 @@ export struct Card2Component { | @@ -22,6 +22,7 @@ export struct Card2Component { | ||
| 22 | @State contentDTO: ContentDTO = new ContentDTO(); | 22 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 23 | @State loadImg: boolean = false; | 23 | @State loadImg: boolean = false; |
| 24 | @State clicked: boolean = false; | 24 | @State clicked: boolean = false; |
| 25 | + @ObjectLink compDTO: CompDTO | ||
| 25 | @State titleMarked: boolean = false; | 26 | @State titleMarked: boolean = false; |
| 26 | @State str01: string = ''; | 27 | @State str01: string = ''; |
| 27 | @State str02: string = ''; | 28 | @State str02: string = ''; |
| @@ -90,7 +91,7 @@ export struct Card2Component { | @@ -90,7 +91,7 @@ export struct Card2Component { | ||
| 90 | 91 | ||
| 91 | //bottom | 92 | //bottom |
| 92 | // 评论等信息 | 93 | // 评论等信息 |
| 93 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 94 | + CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 94 | } | 95 | } |
| 95 | .width(CommonConstants.FULL_WIDTH) | 96 | .width(CommonConstants.FULL_WIDTH) |
| 96 | .padding({ | 97 | .padding({ |
| 1 | -import { ContentDTO } from 'wdBean'; | ||
| 2 | import { CommonConstants } from 'wdConstant'; | 1 | import { CommonConstants } from 'wdConstant'; |
| 2 | +import { CompDTO, ContentDTO } from 'wdBean'; | ||
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 5 | import { Notes } from './notes'; | 5 | import { Notes } from './notes'; |
| @@ -12,7 +12,7 @@ import { Notes } from './notes'; | @@ -12,7 +12,7 @@ import { Notes } from './notes'; | ||
| 12 | export struct Card3Component { | 12 | export struct Card3Component { |
| 13 | @State contentDTO: ContentDTO = new ContentDTO(); | 13 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 14 | @State clicked: boolean = false; | 14 | @State clicked: boolean = false; |
| 15 | - | 15 | + @ObjectLink compDTO: CompDTO |
| 16 | build() { | 16 | build() { |
| 17 | Column() { | 17 | Column() { |
| 18 | Stack() { | 18 | Stack() { |
| @@ -27,7 +27,7 @@ export struct Card3Component { | @@ -27,7 +27,7 @@ export struct Card3Component { | ||
| 27 | }.alignContent(Alignment.TopStart) | 27 | }.alignContent(Alignment.TopStart) |
| 28 | 28 | ||
| 29 | // 评论等信息 | 29 | // 评论等信息 |
| 30 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 30 | + CardSourceInfo({compDTO:this.compDTO, contentDTO: this.contentDTO }) |
| 31 | } | 31 | } |
| 32 | .width(CommonConstants.FULL_WIDTH) | 32 | .width(CommonConstants.FULL_WIDTH) |
| 33 | .padding({ | 33 | .padding({ |
| 1 | -import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 7 | + | ||
| 7 | const TAG: string = 'Card4Component'; | 8 | const TAG: string = 'Card4Component'; |
| 8 | 9 | ||
| 9 | /** | 10 | /** |
| @@ -22,7 +23,7 @@ export struct Card4Component { | @@ -22,7 +23,7 @@ export struct Card4Component { | ||
| 22 | @State str01: string = ''; | 23 | @State str01: string = ''; |
| 23 | @State str02: string = ''; | 24 | @State str02: string = ''; |
| 24 | @State str03: string = ''; | 25 | @State str03: string = ''; |
| 25 | - | 26 | + @ObjectLink compDTO: CompDTO |
| 26 | 27 | ||
| 27 | async aboutToAppear(): Promise<void> { | 28 | async aboutToAppear(): Promise<void> { |
| 28 | this.titleInit(); | 29 | this.titleInit(); |
| @@ -96,7 +97,7 @@ export struct Card4Component { | @@ -96,7 +97,7 @@ export struct Card4Component { | ||
| 96 | ProcessUtils.processPage(this.contentDTO) | 97 | ProcessUtils.processPage(this.contentDTO) |
| 97 | }) | 98 | }) |
| 98 | //bottom 评论等信息 | 99 | //bottom 评论等信息 |
| 99 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 100 | + CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 100 | } | 101 | } |
| 101 | .width(CommonConstants.FULL_WIDTH) | 102 | .width(CommonConstants.FULL_WIDTH) |
| 102 | .padding({ | 103 | .padding({ |
| 1 | -import { ContentDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants, CompStyle } from 'wdConstant'; | 2 | import { CommonConstants, CompStyle } from 'wdConstant'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; |
| 6 | import { Notes } from './notes'; | 6 | import { Notes } from './notes'; |
| 7 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 7 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 8 | -// import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; | ||
| 9 | import { Logger } from 'wdKit/Index'; | 8 | import { Logger } from 'wdKit/Index'; |
| 10 | 9 | ||
| 11 | const TAG: string = 'Card6Component-Card13Component'; | 10 | const TAG: string = 'Card6Component-Card13Component'; |
| @@ -15,13 +14,14 @@ const TAG: string = 'Card6Component-Card13Component'; | @@ -15,13 +14,14 @@ const TAG: string = 'Card6Component-Card13Component'; | ||
| 15 | */ | 14 | */ |
| 16 | @Component | 15 | @Component |
| 17 | export struct Card6Component { | 16 | export struct Card6Component { |
| 18 | - @State contentDTO: ContentDTO = new ContentDTO(); | ||
| 19 | @State loadImg: boolean = false; | 17 | @State loadImg: boolean = false; |
| 20 | @State clicked: boolean = false; | 18 | @State clicked: boolean = false; |
| 21 | @State titleMarked: boolean = false; | 19 | @State titleMarked: boolean = false; |
| 22 | @State str01: string = ''; | 20 | @State str01: string = ''; |
| 23 | @State str02: string = ''; | 21 | @State str02: string = ''; |
| 24 | @State str03: string = ''; | 22 | @State str03: string = ''; |
| 23 | + @ObjectLink compDTO: CompDTO | ||
| 24 | + @State contentDTO: ContentDTO = new ContentDTO(); | ||
| 25 | 25 | ||
| 26 | async aboutToAppear(): Promise<void> { | 26 | async aboutToAppear(): Promise<void> { |
| 27 | Logger.info('titleInit', JSON.stringify(this.contentDTO)) | 27 | Logger.info('titleInit', JSON.stringify(this.contentDTO)) |
| @@ -87,7 +87,7 @@ export struct Card6Component { | @@ -87,7 +87,7 @@ export struct Card6Component { | ||
| 87 | 87 | ||
| 88 | 88 | ||
| 89 | //bottom 评论等信息 | 89 | //bottom 评论等信息 |
| 90 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 90 | + CardSourceInfo({ compDTO: this.compDTO,contentDTO:this.contentDTO }) |
| 91 | } | 91 | } |
| 92 | .alignItems(HorizontalAlign.Start) | 92 | .alignItems(HorizontalAlign.Start) |
| 93 | .justifyContent(FlexAlign.Start) | 93 | .justifyContent(FlexAlign.Start) |
| 1 | -import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO, FullColumnImgUrlDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant/Index'; | 2 | import { CommonConstants } from 'wdConstant/Index'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| @@ -61,7 +61,7 @@ export struct SearchContentComponent { | @@ -61,7 +61,7 @@ export struct SearchContentComponent { | ||
| 61 | ProcessUtils.processPage(this.contentDTO) | 61 | ProcessUtils.processPage(this.contentDTO) |
| 62 | }) | 62 | }) |
| 63 | //bottom 评论等信息 | 63 | //bottom 评论等信息 |
| 64 | - CardSourceInfo({ contentDTO: this.contentDTO }) | 64 | + CardSourceInfo({compDTO:new CompDTO, contentDTO: this.contentDTO }) |
| 65 | } | 65 | } |
| 66 | .width(CommonConstants.FULL_WIDTH) | 66 | .width(CommonConstants.FULL_WIDTH) |
| 67 | .padding({ | 67 | .padding({ |
| @@ -117,7 +117,7 @@ struct BrowsingHistoryPage { | @@ -117,7 +117,7 @@ struct BrowsingHistoryPage { | ||
| 117 | .margin({left:16}) | 117 | .margin({left:16}) |
| 118 | } | 118 | } |
| 119 | Column() { | 119 | Column() { |
| 120 | - BigPicCardComponent({contentDTO:compDTO}) | 120 | + BigPicCardComponent({compDTO:new CompDTO,contentDTO:compDTO}) |
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| 123 | } | 123 | } |
| @@ -4,7 +4,7 @@ import PageModel from '../../viewmodel/PageModel'; | @@ -4,7 +4,7 @@ import PageModel from '../../viewmodel/PageModel'; | ||
| 4 | import { CommonConstants, ViewType } from 'wdConstant' | 4 | import { CommonConstants, ViewType } from 'wdConstant' |
| 5 | import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' | 5 | import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' |
| 6 | import { ErrorComponent } from '../view/ErrorComponent' | 6 | import { ErrorComponent } from '../view/ErrorComponent' |
| 7 | -import { ContentDTO } from 'wdBean' | 7 | +import { CompDTO, ContentDTO } from 'wdBean' |
| 8 | import NoMoreLayout from './NoMoreLayout' | 8 | import NoMoreLayout from './NoMoreLayout' |
| 9 | import { CustomSelectUI } from '../view/CustomSelectUI'; | 9 | import { CustomSelectUI } from '../view/CustomSelectUI'; |
| 10 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | 10 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; |
| @@ -117,7 +117,7 @@ struct MyCollectionListPage { | @@ -117,7 +117,7 @@ struct MyCollectionListPage { | ||
| 117 | .margin({left:16}) | 117 | .margin({left:16}) |
| 118 | } | 118 | } |
| 119 | Column() { | 119 | Column() { |
| 120 | - BigPicCardComponent({contentDTO:compDTO}) | 120 | + BigPicCardComponent({compDTO:new CompDTO,contentDTO:compDTO}) |
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| 123 | } | 123 | } |
| @@ -14,6 +14,7 @@ import PageNoMoreLayout from './PageNoMoreLayout'; | @@ -14,6 +14,7 @@ import PageNoMoreLayout from './PageNoMoreLayout'; | ||
| 14 | import { NoMoreBean } from './NoMoreBean'; | 14 | import { NoMoreBean } from './NoMoreBean'; |
| 15 | import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean'; | 15 | import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean'; |
| 16 | import RefreshLayout from '../refresh/RefreshLayout'; | 16 | import RefreshLayout from '../refresh/RefreshLayout'; |
| 17 | +import json from '@ohos.util.json'; | ||
| 17 | 18 | ||
| 18 | const TAG = 'PageComponent'; | 19 | const TAG = 'PageComponent'; |
| 19 | 20 | ||
| @@ -80,8 +81,7 @@ export struct PageComponent { | @@ -80,8 +81,7 @@ export struct PageComponent { | ||
| 80 | } | 81 | } |
| 81 | } | 82 | } |
| 82 | }, | 83 | }, |
| 83 | - (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp | ||
| 84 | - ) | 84 | + (compDTO: CompDTO, compIndex: number) => JSON.stringify(compDTO)) |
| 85 | 85 | ||
| 86 | // 加载更多 | 86 | // 加载更多 |
| 87 | ListItem() { | 87 | ListItem() { |
| 1 | -import { ContentDTO , Action,GoldenPositionExtraBean} from 'wdBean'; | 1 | +import { ContentDTO , Action,GoldenPositionExtraBean, CompDTO} from 'wdBean'; |
| 2 | import { CommonConstants ,ViewType} from 'wdConstant'; | 2 | import { CommonConstants ,ViewType} from 'wdConstant'; |
| 3 | import PageViewModel from '../../viewmodel/PageViewModel'; | 3 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 4 | import PageModel from '../../viewmodel/PageModel'; | 4 | import PageModel from '../../viewmodel/PageModel'; |
| @@ -128,7 +128,7 @@ struct ThemeListPage { | @@ -128,7 +128,7 @@ struct ThemeListPage { | ||
| 128 | LazyForEach(this.pageModel.compList, (contentDTO: ContentDTO, contentIndex: number) => { | 128 | LazyForEach(this.pageModel.compList, (contentDTO: ContentDTO, contentIndex: number) => { |
| 129 | ListItem() { | 129 | ListItem() { |
| 130 | Column() { | 130 | Column() { |
| 131 | - CardParser({ contentDTO }); | 131 | + CardParser({compDTO:new CompDTO, contentDTO }); |
| 132 | } | 132 | } |
| 133 | } | 133 | } |
| 134 | }, | 134 | }, |
| @@ -8,7 +8,8 @@ import { | @@ -8,7 +8,8 @@ import { | ||
| 8 | AttentionBatchDTO, | 8 | AttentionBatchDTO, |
| 9 | CreatorDTO, | 9 | CreatorDTO, |
| 10 | contentListParams, | 10 | contentListParams, |
| 11 | - InteractDataDTO | 11 | + InteractDataDTO, |
| 12 | + CompDTO | ||
| 12 | } from 'wdBean'; | 13 | } from 'wdBean'; |
| 13 | import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; | 14 | import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; |
| 14 | import { channelSkeleton } from '../skeleton/channelSkeleton' | 15 | import { channelSkeleton } from '../skeleton/channelSkeleton' |
| @@ -150,7 +151,7 @@ export struct PeopleShipMainComponent { | @@ -150,7 +151,7 @@ export struct PeopleShipMainComponent { | ||
| 150 | } | 151 | } |
| 151 | ForEach(this.attentionList, (item: ContentDTO) => { | 152 | ForEach(this.attentionList, (item: ContentDTO) => { |
| 152 | ListItem() { | 153 | ListItem() { |
| 153 | - CardParser({ contentDTO: item }) | 154 | + CardParser({compDTO:new CompDTO, contentDTO: item }) |
| 154 | }.width("100%") | 155 | }.width("100%") |
| 155 | .backgroundColor(Color.Transparent) | 156 | .backgroundColor(Color.Transparent) |
| 156 | 157 |
| @@ -12,7 +12,8 @@ import { | @@ -12,7 +12,8 @@ import { | ||
| 12 | InteractDataDTO, | 12 | InteractDataDTO, |
| 13 | ArticleTypeData, | 13 | ArticleTypeData, |
| 14 | ArticleListData, | 14 | ArticleListData, |
| 15 | - PeopleShipUserDetailData | 15 | + PeopleShipUserDetailData, |
| 16 | + CompDTO | ||
| 16 | } from 'wdBean' | 17 | } from 'wdBean' |
| 17 | import { CardParser } from '../CardParser' | 18 | import { CardParser } from '../CardParser' |
| 18 | import { PageRepository } from '../../repository/PageRepository' | 19 | import { PageRepository } from '../../repository/PageRepository' |
| @@ -79,7 +80,7 @@ export struct PeopleShipHomeArticleListComponent { | @@ -79,7 +80,7 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 79 | // 下拉刷新 | 80 | // 下拉刷新 |
| 80 | ForEach(this.arr, (item: ContentDTO) => { | 81 | ForEach(this.arr, (item: ContentDTO) => { |
| 81 | ListItem() { | 82 | ListItem() { |
| 82 | - CardParser({ contentDTO: item }) | 83 | + CardParser({compDTO:new CompDTO, contentDTO: item }) |
| 83 | }.width("100%") | 84 | }.width("100%") |
| 84 | .backgroundColor(Color.Transparent) | 85 | .backgroundColor(Color.Transparent) |
| 85 | }, (item: ContentDTO, index: number) => item.objectId + index.toString()) | 86 | }, (item: ContentDTO, index: number) => item.objectId + index.toString()) |
| 1 | -import { ContentDTO } from 'wdBean/Index' | 1 | +import { CompDTO, ContentDTO } from 'wdBean/Index' |
| 2 | import { LazyDataSource, UserDataLocal } from 'wdKit/Index' | 2 | import { LazyDataSource, UserDataLocal } from 'wdKit/Index' |
| 3 | import { HttpUtils } from 'wdNetwork/Index' | 3 | import { HttpUtils } from 'wdNetwork/Index' |
| 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| @@ -96,7 +96,7 @@ export struct SearchResultComponent { | @@ -96,7 +96,7 @@ export struct SearchResultComponent { | ||
| 96 | LazyForEach(this.data, (item: ContentDTO, index: number) => { | 96 | LazyForEach(this.data, (item: ContentDTO, index: number) => { |
| 97 | ListItem() { | 97 | ListItem() { |
| 98 | Column() { | 98 | Column() { |
| 99 | - CardParser({contentDTO:item}) | 99 | + CardParser({compDTO:new CompDTO,contentDTO:item}) |
| 100 | if (index != this.data.totalCount() - 1) { | 100 | if (index != this.data.totalCount() - 1) { |
| 101 | Divider() | 101 | Divider() |
| 102 | .width('100%') | 102 | .width('100%') |
| 1 | import { | 1 | import { |
| 2 | + CompDTO, | ||
| 2 | ContentDTO, | 3 | ContentDTO, |
| 3 | contentListParams, | 4 | contentListParams, |
| 4 | FullColumnImgUrlDTO, | 5 | FullColumnImgUrlDTO, |
| @@ -243,7 +244,7 @@ export struct SearchResultContentComponent { | @@ -243,7 +244,7 @@ export struct SearchResultContentComponent { | ||
| 243 | if (this.searchType == "activity") { | 244 | if (this.searchType == "activity") { |
| 244 | ActivityItemComponent({ contentDTO: item }) | 245 | ActivityItemComponent({ contentDTO: item }) |
| 245 | } else { | 246 | } else { |
| 246 | - CardParser({ contentDTO: item }) | 247 | + CardParser({compDTO:new CompDTO, contentDTO: item }) |
| 247 | } | 248 | } |
| 248 | if (index != this.data.totalCount() - 1) { | 249 | if (index != this.data.totalCount() - 1) { |
| 249 | Divider() | 250 | Divider() |
| @@ -14,7 +14,7 @@ const TAG: string = 'BigPicCardComponent'; | @@ -14,7 +14,7 @@ const TAG: string = 'BigPicCardComponent'; | ||
| 14 | // @Entry | 14 | // @Entry |
| 15 | @Component | 15 | @Component |
| 16 | export struct BigPicCardComponent { | 16 | export struct BigPicCardComponent { |
| 17 | - @State compDTO: CompDTO = {} as CompDTO | 17 | + @ObjectLink compDTO: CompDTO |
| 18 | contentDTO: ContentDTO = new ContentDTO(); | 18 | contentDTO: ContentDTO = new ContentDTO(); |
| 19 | 19 | ||
| 20 | aboutToAppear() { | 20 | aboutToAppear() { |
| @@ -110,7 +110,7 @@ export struct BigPicCardComponent { | @@ -110,7 +110,7 @@ export struct BigPicCardComponent { | ||
| 110 | 110 | ||
| 111 | @Builder | 111 | @Builder |
| 112 | cardBuild() { | 112 | cardBuild() { |
| 113 | - CardParser({ contentDTO: this.contentDTO }); | 113 | + CardParser({ compDTO: this.compDTO, contentDTO: this.contentDTO }); |
| 114 | } | 114 | } |
| 115 | } | 115 | } |
| 116 | 116 | ||
| @@ -121,7 +121,8 @@ export struct BigPicCardComponent { | @@ -121,7 +121,8 @@ export struct BigPicCardComponent { | ||
| 121 | */ | 121 | */ |
| 122 | @Component | 122 | @Component |
| 123 | export struct myBigCard_body { | 123 | export struct myBigCard_body { |
| 124 | - private newsSrc: string = "https://k.sinaimg.cn/n/default/crawl/190/w550h440/20240118/6772-7c2385bb2741c6f88906af3514d27343.png/w700d1q75cms.jpg"; | 124 | + private newsSrc: string = |
| 125 | + "https://k.sinaimg.cn/n/default/crawl/190/w550h440/20240118/6772-7c2385bb2741c6f88906af3514d27343.png/w700d1q75cms.jpg"; | ||
| 125 | private newsTitle: string = "时政微观察丨新征程金融工作怎么干?“新年第一课”这样讲"; | 126 | private newsTitle: string = "时政微观察丨新征程金融工作怎么干?“新年第一课”这样讲"; |
| 126 | 127 | ||
| 127 | build() { | 128 | build() { |
| 1 | -import { ContentDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | import { CardParser } from '../CardParser'; | 3 | import { CardParser } from '../CardParser'; |
| 4 | 4 | ||
| @@ -29,7 +29,7 @@ export struct RecommendList { | @@ -29,7 +29,7 @@ export struct RecommendList { | ||
| 29 | } | 29 | } |
| 30 | ForEach(this.recommendList, (item: ContentDTO, index: number) => { | 30 | ForEach(this.recommendList, (item: ContentDTO, index: number) => { |
| 31 | Row() { | 31 | Row() { |
| 32 | - CardParser({ contentDTO: item }); | 32 | + CardParser({ compDTO:new CompDTO,contentDTO: item }); |
| 33 | } | 33 | } |
| 34 | if (this.recommendList.length !== index + 1) { | 34 | if (this.recommendList.length !== index + 1) { |
| 35 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 35 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| @@ -52,13 +52,13 @@ export class PageHelper { | @@ -52,13 +52,13 @@ export class PageHelper { | ||
| 52 | 52 | ||
| 53 | getPageInfo(pageModel: PageModel, pageAdvModel: PageAdModel) { | 53 | getPageInfo(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 54 | pageModel.currentPage = 1; | 54 | pageModel.currentPage = 1; |
| 55 | - if(pageModel.pageType == 1){ | ||
| 56 | - PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize,pageModel.extra).then((liveReviewDTO) => { | ||
| 57 | - if(liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0){ | 55 | + if (pageModel.pageType == 1) { |
| 56 | + PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => { | ||
| 57 | + if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) { | ||
| 58 | pageModel.viewType = ViewType.EMPTY; | 58 | pageModel.viewType = ViewType.EMPTY; |
| 59 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1; | 59 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1; |
| 60 | return; | 60 | return; |
| 61 | - }else{ | 61 | + } else { |
| 62 | //更新数据 | 62 | //更新数据 |
| 63 | pageModel.compList.addItems(liveReviewDTO.list); | 63 | pageModel.compList.addItems(liveReviewDTO.list); |
| 64 | closeRefresh(pageModel, true); | 64 | closeRefresh(pageModel, true); |
| @@ -66,7 +66,7 @@ export class PageHelper { | @@ -66,7 +66,7 @@ export class PageHelper { | ||
| 66 | }).catch((err: string | Resource) => { | 66 | }).catch((err: string | Resource) => { |
| 67 | promptAction.showToast({ message: err }); | 67 | promptAction.showToast({ message: err }); |
| 68 | }) | 68 | }) |
| 69 | - }else{ | 69 | + } else { |
| 70 | PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => { | 70 | PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => { |
| 71 | if (pageInfo == null) { | 71 | if (pageInfo == null) { |
| 72 | pageModel.viewType = ViewType.EMPTY; | 72 | pageModel.viewType = ViewType.EMPTY; |
| @@ -103,7 +103,7 @@ export class PageHelper { | @@ -103,7 +103,7 @@ export class PageHelper { | ||
| 103 | let index = pageInfo.groups.indexOf(group) | 103 | let index = pageInfo.groups.indexOf(group) |
| 104 | if (index == 0) { | 104 | if (index == 0) { |
| 105 | // 清空comp列表 | 105 | // 清空comp列表 |
| 106 | - pageModel.compList.clear() | 106 | + pageModel.compList.clearAllData() |
| 107 | } | 107 | } |
| 108 | this.getGroupData(pageModel, pageDto, index == pageInfo.groups.length - 1) | 108 | this.getGroupData(pageModel, pageDto, index == pageInfo.groups.length - 1) |
| 109 | 109 | ||
| @@ -119,7 +119,6 @@ export class PageHelper { | @@ -119,7 +119,6 @@ export class PageHelper { | ||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | private async getGroupData(pageModel: PageModel, pageDto: PageDTO, isLastGroup: boolean) { | 121 | private async getGroupData(pageModel: PageModel, pageDto: PageDTO, isLastGroup: boolean) { |
| 122 | - pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 123 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 122 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { |
| 124 | pageModel.viewType = ViewType.LOADED; | 123 | pageModel.viewType = ViewType.LOADED; |
| 125 | if (isLastGroup) { | 124 | if (isLastGroup) { |
| @@ -135,12 +134,9 @@ export class PageHelper { | @@ -135,12 +134,9 @@ export class PageHelper { | ||
| 135 | // TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上) | 134 | // TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上) |
| 136 | // TODO updateItems(sizeBefore, data),这里可能有时序问题,导致覆盖别的group数据,需要优化,考虑精准替换 | 135 | // TODO updateItems(sizeBefore, data),这里可能有时序问题,导致覆盖别的group数据,需要优化,考虑精准替换 |
| 137 | // 二次请求,批查互动数据 | 136 | // 二次请求,批查互动数据 |
| 138 | - PageViewModel.getInteractData(pageDto.compList).then((data: InteractDataDTO[]) => { | ||
| 139 | - // 刷新,替换所有数据 | ||
| 140 | - this.resetInteract(data, pageModel.compList) | ||
| 141 | - pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 142 | - pageModel.compList.reloadData() | ||
| 143 | - }) | 137 | + this.allCompBatchRequest(pageDto.compList, pageModel) |
| 138 | + | ||
| 139 | + | ||
| 144 | // content级别的展现加载丢给comp自己,这里只需要处理屏蔽分页加载,pageModel.pageScroll | 140 | // content级别的展现加载丢给comp自己,这里只需要处理屏蔽分页加载,pageModel.pageScroll |
| 145 | if (isLastGroup) { | 141 | if (isLastGroup) { |
| 146 | closeRefresh(pageModel, true); | 142 | closeRefresh(pageModel, true); |
| @@ -277,11 +273,9 @@ export class PageHelper { | @@ -277,11 +273,9 @@ export class PageHelper { | ||
| 277 | // console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " " + advPosition + " " + a + " " + b) | 273 | // console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " " + advPosition + " " + a + " " + b) |
| 278 | if (b <= pageCompSize && b >= 0) { | 274 | if (b <= pageCompSize && b >= 0) { |
| 279 | 275 | ||
| 280 | - let advComp: CompDTO = { | ||
| 281 | - compStyle: CompStyle.Card_Comp_Adv, | ||
| 282 | - matInfo: matInfo | ||
| 283 | - } as CompDTO; | ||
| 284 | - | 276 | + let advComp: CompDTO = new CompDTO; |
| 277 | + advComp.compStyle = CompStyle.Card_Comp_Adv | ||
| 278 | + advComp.matInfo = matInfo | ||
| 285 | if (pageCompSize == slotInfo.position) { | 279 | if (pageCompSize == slotInfo.position) { |
| 286 | pageCompList.add(advComp) | 280 | pageCompList.add(advComp) |
| 287 | } else { | 281 | } else { |
| @@ -307,12 +301,12 @@ export class PageHelper { | @@ -307,12 +301,12 @@ export class PageHelper { | ||
| 307 | */ | 301 | */ |
| 308 | private compLoadMore(pageModel: PageModel) { | 302 | private compLoadMore(pageModel: PageModel) { |
| 309 | //聚合页 | 303 | //聚合页 |
| 310 | - if(pageModel.pageType == 1){ | ||
| 311 | - PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize,pageModel.extra).then((liveReviewDTO) => { | ||
| 312 | - if(liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0){ | 304 | + if (pageModel.pageType == 1) { |
| 305 | + PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => { | ||
| 306 | + if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) { | ||
| 313 | pageModel.hasMore = false; | 307 | pageModel.hasMore = false; |
| 314 | return; | 308 | return; |
| 315 | - }else{ | 309 | + } else { |
| 316 | //更新数据 | 310 | //更新数据 |
| 317 | pageModel.compList.addItems(liveReviewDTO.list); | 311 | pageModel.compList.addItems(liveReviewDTO.list); |
| 318 | // 直接认为有分页,一直加载分页。直到没有数据,再停止 | 312 | // 直接认为有分页,一直加载分页。直到没有数据,再停止 |
| @@ -323,10 +317,9 @@ export class PageHelper { | @@ -323,10 +317,9 @@ export class PageHelper { | ||
| 323 | }).catch((err: string | Resource) => { | 317 | }).catch((err: string | Resource) => { |
| 324 | promptAction.showToast({ message: err }); | 318 | promptAction.showToast({ message: err }); |
| 325 | }) | 319 | }) |
| 326 | - }else{ | 320 | + } else { |
| 327 | PageViewModel.getPageData(pageModel.bizCopy()) | 321 | PageViewModel.getPageData(pageModel.bizCopy()) |
| 328 | .then((data: PageDTO) => { | 322 | .then((data: PageDTO) => { |
| 329 | - pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 330 | if (data == null || data.compList == null || data.compList.length == 0) { | 323 | if (data == null || data.compList == null || data.compList.length == 0) { |
| 331 | pageModel.hasMore = false; | 324 | pageModel.hasMore = false; |
| 332 | } else { | 325 | } else { |
| @@ -336,14 +329,8 @@ export class PageHelper { | @@ -336,14 +329,8 @@ export class PageHelper { | ||
| 336 | 329 | ||
| 337 | //移除音频 和 活动 | 330 | //移除音频 和 活动 |
| 338 | this.collectPageComp(pageModel, data) | 331 | this.collectPageComp(pageModel, data) |
| 339 | - | ||
| 340 | - // TODO 暂时屏蔽,此处代码会造成 广告逻辑错乱,只有第一页有广告数据,随着加载更多,第二页也会出现广告数据 | ||
| 341 | - PageViewModel.getInteractData(data.compList).then((data: InteractDataDTO[]) => { | ||
| 342 | - // 刷新,替换所有数据 | ||
| 343 | - this.resetInteract(data, pageModel.compList) | ||
| 344 | - pageModel.timestamp = DateTimeUtils.getTimeStamp().toString() | ||
| 345 | - pageModel.compList.reloadData() | ||
| 346 | - }) | 332 | + // 参与批查 |
| 333 | + this.allCompBatchRequest(data.compList, pageModel) | ||
| 347 | } | 334 | } |
| 348 | }).catch((err: string | Resource) => { | 335 | }).catch((err: string | Resource) => { |
| 349 | promptAction.showToast({ message: err }); | 336 | promptAction.showToast({ message: err }); |
| @@ -351,6 +338,30 @@ export class PageHelper { | @@ -351,6 +338,30 @@ export class PageHelper { | ||
| 351 | } | 338 | } |
| 352 | } | 339 | } |
| 353 | 340 | ||
| 341 | + /** | ||
| 342 | + * 信息流页面,所有稿件需要参与批查,如 批查评论、批查关注状态等接口 | ||
| 343 | + * @param compList | ||
| 344 | + * @param pageModel | ||
| 345 | + */ | ||
| 346 | + private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) { | ||
| 347 | + PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => { | ||
| 348 | + // 刷新,替换所有数据 | ||
| 349 | + this.resetInteract(data, pageModel.compList) | ||
| 350 | + }) | ||
| 351 | + | ||
| 352 | + // 测试数据 | ||
| 353 | + // setTimeout(() => { | ||
| 354 | + // let index = 1 | ||
| 355 | + // let comp = pageModel.compList.getData(index) as CompDTO | ||
| 356 | + // comp.hasMore = 0 | ||
| 357 | + // //comp.operDataList[0].newsTitle = '测试111' | ||
| 358 | + // let con :InteractDataDTO = new InteractDataDTO; | ||
| 359 | + // con.commentNum=1000 | ||
| 360 | + // comp.operDataList[0].interactData = con | ||
| 361 | + // Logger.debug("ZZZXXXXX", | ||
| 362 | + // "-----setTimeout--------->" + comp.hasMore) | ||
| 363 | + // }, 4 * 1000) | ||
| 364 | + } | ||
| 354 | 365 | ||
| 355 | /** | 366 | /** |
| 356 | * 移除comp | 367 | * 移除comp |
| @@ -359,9 +370,7 @@ export class PageHelper { | @@ -359,9 +370,7 @@ export class PageHelper { | ||
| 359 | 370 | ||
| 360 | let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器 | 371 | let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器 |
| 361 | 372 | ||
| 362 | - let datas = pageDto.compList | ||
| 363 | - for (let index = 0; index < datas.length; index++) { | ||
| 364 | - const element = datas[index]; | 373 | + pageDto.compList.forEach((element: CompDTO) => { |
| 365 | let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); | 374 | let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); |
| 366 | //移除音频 和 活动 | 375 | //移除音频 和 活动 |
| 367 | if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { | 376 | if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { |
| @@ -372,24 +381,21 @@ export class PageHelper { | @@ -372,24 +381,21 @@ export class PageHelper { | ||
| 372 | } else { | 381 | } else { |
| 373 | pageCompList.add(element) | 382 | pageCompList.add(element) |
| 374 | } | 383 | } |
| 375 | - | ||
| 376 | - } | ||
| 377 | } | 384 | } |
| 378 | 385 | ||
| 386 | + }) | ||
| 387 | + | ||
| 379 | // 记录 | 388 | // 记录 |
| 380 | pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize | 389 | pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize |
| 381 | - // console.error("ZZZXXXXX", " collectPageComp--->" + pageModel.pageTotalCompSize); | ||
| 382 | 390 | ||
| 383 | // 处理页面广告数据,投放到页面的位置 | 391 | // 处理页面广告数据,投放到页面的位置 |
| 384 | this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto); | 392 | this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto); |
| 385 | 393 | ||
| 386 | - | ||
| 387 | //遍历所有组件和稿件数据 push到页面 | 394 | //遍历所有组件和稿件数据 push到页面 |
| 388 | for (let element of pageCompList) { | 395 | for (let element of pageCompList) { |
| 389 | - pageModel.compList.push(element) | 396 | + pageModel.compList.push(CompDTO.createNewsBean(element)) |
| 390 | } | 397 | } |
| 391 | 398 | ||
| 392 | - | ||
| 393 | } | 399 | } |
| 394 | 400 | ||
| 395 | /** | 401 | /** |
| @@ -401,6 +407,7 @@ export class PageHelper { | @@ -401,6 +407,7 @@ export class PageHelper { | ||
| 401 | if (interact == null || interact.length == 0) { | 407 | if (interact == null || interact.length == 0) { |
| 402 | return | 408 | return |
| 403 | } | 409 | } |
| 410 | + let time = DateTimeUtils.getTimeStamp().toString() | ||
| 404 | interact.forEach((interactData) => { | 411 | interact.forEach((interactData) => { |
| 405 | let id = interactData.contentId; | 412 | let id = interactData.contentId; |
| 406 | outer: for (let i = 0; i < compList.totalCount(); i++) { | 413 | outer: for (let i = 0; i < compList.totalCount(); i++) { |
| @@ -415,6 +422,7 @@ export class PageHelper { | @@ -415,6 +422,7 @@ export class PageHelper { | ||
| 415 | } | 422 | } |
| 416 | if (id == content.objectId) { | 423 | if (id == content.objectId) { |
| 417 | content.interactData = interactData; | 424 | content.interactData = interactData; |
| 425 | + comp.timestamp = time | ||
| 418 | break outer; | 426 | break outer; |
| 419 | } | 427 | } |
| 420 | } | 428 | } |
| @@ -13,6 +13,7 @@ import { | @@ -13,6 +13,7 @@ import { | ||
| 13 | NavigationDetailDTO, | 13 | NavigationDetailDTO, |
| 14 | LiveRoomDataBean | 14 | LiveRoomDataBean |
| 15 | } from 'wdBean'; | 15 | } from 'wdBean'; |
| 16 | +import { CompStyle } from 'wdConstant/Index'; | ||
| 16 | 17 | ||
| 17 | import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; | 18 | import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; |
| 18 | import { ResponseDTO, } from 'wdNetwork'; | 19 | import { ResponseDTO, } from 'wdNetwork'; |
| @@ -48,14 +49,15 @@ export class PageViewModel extends BaseViewModel { | @@ -48,14 +49,15 @@ export class PageViewModel extends BaseViewModel { | ||
| 48 | return this.getNavData(); | 49 | return this.getNavData(); |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | - async getBottomNavDetailData(id:number): Promise<NavigationDetailDTO> { | 52 | + async getBottomNavDetailData(id: number): Promise<NavigationDetailDTO> { |
| 52 | Logger.info(TAG, `getBottomNavDetailData start`); | 53 | Logger.info(TAG, `getBottomNavDetailData start`); |
| 53 | return this.getNavDetailData(id); | 54 | return this.getNavDetailData(id); |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | async getBottomNavDataMock(context: Context): Promise<NavigationBodyDTO> { | 57 | async getBottomNavDataMock(context: Context): Promise<NavigationBodyDTO> { |
| 57 | Logger.info(TAG, `getBottomNavDataMock start`); | 58 | Logger.info(TAG, `getBottomNavDataMock start`); |
| 58 | - let compRes: ResponseDTO<NavigationBodyDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<NavigationBodyDTO>>(context, 'bottom_nav.json'); | 59 | + let compRes: ResponseDTO<NavigationBodyDTO> | null = |
| 60 | + await ResourcesUtils.getResourcesJson<ResponseDTO<NavigationBodyDTO>>(context, 'bottom_nav.json'); | ||
| 59 | if (!compRes || !compRes.data) { | 61 | if (!compRes || !compRes.data) { |
| 60 | Logger.info(TAG, `getBottomNavDataMock compRes bottomNavList is empty`); | 62 | Logger.info(TAG, `getBottomNavDataMock compRes bottomNavList is empty`); |
| 61 | return {} as NavigationBodyDTO | 63 | return {} as NavigationBodyDTO |
| @@ -88,7 +90,7 @@ export class PageViewModel extends BaseViewModel { | @@ -88,7 +90,7 @@ export class PageViewModel extends BaseViewModel { | ||
| 88 | }) | 90 | }) |
| 89 | } | 91 | } |
| 90 | 92 | ||
| 91 | - private getNavDetailData(id:number): Promise<NavigationDetailDTO> { | 93 | + private getNavDetailData(id: number): Promise<NavigationDetailDTO> { |
| 92 | return new Promise<NavigationDetailDTO>((success, error) => { | 94 | return new Promise<NavigationDetailDTO>((success, error) => { |
| 93 | Logger.info(TAG, `getNavData start`); | 95 | Logger.info(TAG, `getNavData start`); |
| 94 | PageRepository.fetchNavigationDetailDataApi(id).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => { | 96 | PageRepository.fetchNavigationDetailDataApi(id).then((navResDTO: ResponseDTO<NavigationDetailDTO>) => { |
| @@ -122,7 +124,8 @@ export class PageViewModel extends BaseViewModel { | @@ -122,7 +124,8 @@ export class PageViewModel extends BaseViewModel { | ||
| 122 | // 加载更多,返回无数据 | 124 | // 加载更多,返回无数据 |
| 123 | return {} as PageDTO | 125 | return {} as PageDTO |
| 124 | } | 126 | } |
| 125 | - let compRes: ResponseDTO<PageDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list0.json'); | 127 | + let compRes: ResponseDTO<PageDTO> | null = |
| 128 | + await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list0.json'); | ||
| 126 | if (!compRes || !compRes.data) { | 129 | if (!compRes || !compRes.data) { |
| 127 | Logger.info(TAG, `getCompList compRes is empty`); | 130 | Logger.info(TAG, `getCompList compRes is empty`); |
| 128 | return {} as PageDTO | 131 | return {} as PageDTO |
| @@ -164,7 +167,8 @@ export class PageViewModel extends BaseViewModel { | @@ -164,7 +167,8 @@ export class PageViewModel extends BaseViewModel { | ||
| 164 | } | 167 | } |
| 165 | 168 | ||
| 166 | private async getPageData2(context: Context): Promise<PageDTO> { | 169 | private async getPageData2(context: Context): Promise<PageDTO> { |
| 167 | - let compRes: ResponseDTO<PageDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list2.json'); | 170 | + let compRes: ResponseDTO<PageDTO> | null = |
| 171 | + await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context, 'comp_list2.json'); | ||
| 168 | if (!compRes || !compRes.data) { | 172 | if (!compRes || !compRes.data) { |
| 169 | Logger.info(TAG, `getCompList compRes is empty`); | 173 | Logger.info(TAG, `getCompList compRes is empty`); |
| 170 | return {} as PageDTO | 174 | return {} as PageDTO |
| @@ -339,7 +343,15 @@ export class PageViewModel extends BaseViewModel { | @@ -339,7 +343,15 @@ export class PageViewModel extends BaseViewModel { | ||
| 339 | param.contentList = new Array<ContentBean>(); | 343 | param.contentList = new Array<ContentBean>(); |
| 340 | compList.forEach((value) => { | 344 | compList.forEach((value) => { |
| 341 | let contentList = value.operDataList; | 345 | let contentList = value.operDataList; |
| 342 | - if (contentList != null && contentList.length > 0) { | 346 | + |
| 347 | + let letBatch = false | ||
| 348 | + // 只有稿件才能批查 | ||
| 349 | + if (!Number.isNaN(Number(value.compStyle))) { | ||
| 350 | + letBatch = true | ||
| 351 | + } | ||
| 352 | + | ||
| 353 | + if (letBatch) { | ||
| 354 | + if (contentList != null && contentList.length == 1) { // 对只有一条数据的稿件参与批查 | ||
| 343 | contentList.forEach((v) => { | 355 | contentList.forEach((v) => { |
| 344 | if (StringUtils.isNotEmpty(v.objectId)) { | 356 | if (StringUtils.isNotEmpty(v.objectId)) { |
| 345 | let bean = {} as ContentBean; | 357 | let bean = {} as ContentBean; |
| @@ -349,6 +361,7 @@ export class PageViewModel extends BaseViewModel { | @@ -349,6 +361,7 @@ export class PageViewModel extends BaseViewModel { | ||
| 349 | } | 361 | } |
| 350 | }) | 362 | }) |
| 351 | } | 363 | } |
| 364 | + } | ||
| 352 | }) | 365 | }) |
| 353 | return param; | 366 | return param; |
| 354 | } | 367 | } |
| @@ -414,7 +427,7 @@ export class PageViewModel extends BaseViewModel { | @@ -414,7 +427,7 @@ export class PageViewModel extends BaseViewModel { | ||
| 414 | }) | 427 | }) |
| 415 | } | 428 | } |
| 416 | 429 | ||
| 417 | - async postThemeList(pageNum: number, pageSize: number,extra: string) : Promise<LiveReviewDTO> { | 430 | + async postThemeList(pageNum: number, pageSize: number, extra: string): Promise<LiveReviewDTO> { |
| 418 | let bean: GoldenPositionExtraBean = JSON.parse(extra) | 431 | let bean: GoldenPositionExtraBean = JSON.parse(extra) |
| 419 | bean.pageNum = pageNum | 432 | bean.pageNum = pageNum |
| 420 | bean.pageSize = pageSize | 433 | bean.pageSize = pageSize |
| 1 | import AbilityConstant from '@ohos.app.ability.AbilityConstant'; | 1 | import AbilityConstant from '@ohos.app.ability.AbilityConstant'; |
| 2 | +import app from '@system.app'; | ||
| 2 | import hilog from '@ohos.hilog'; | 3 | import hilog from '@ohos.hilog'; |
| 3 | import UIAbility from '@ohos.app.ability.UIAbility'; | 4 | import UIAbility from '@ohos.app.ability.UIAbility'; |
| 4 | import Want from '@ohos.app.ability.Want'; | 5 | import Want from '@ohos.app.ability.Want'; |
| @@ -18,6 +19,11 @@ export default class EntryAbility extends UIAbility { | @@ -18,6 +19,11 @@ export default class EntryAbility extends UIAbility { | ||
| 18 | 19 | ||
| 19 | // 还没深色模式需求,暂直接不跟随系统。 | 20 | // 还没深色模式需求,暂直接不跟随系统。 |
| 20 | this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT); | 21 | this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT); |
| 22 | + | ||
| 23 | + | ||
| 24 | + app.setImageRawDataCacheSize(100) // 100 设置内存中缓存解码后图片的数量上限,单位为 number。 | ||
| 25 | + app.setImageCacheCount(100 * 1024 * 1024) // 设置解码前图片数据内存缓存上限为100MB。设置内存中缓存解码前图片数据的大小上限,单位为字节。 | ||
| 26 | + app.setImageFileCacheSize(100 * 1024 * 1024) // 设置图片文件缓存的大小上限,单位为字节 | ||
| 21 | } | 27 | } |
| 22 | 28 | ||
| 23 | // App活着情况下,点击推送通知进入 | 29 | // App活着情况下,点击推送通知进入 |
-
Please register or login to post a comment