张善主

Merge remote-tracking branch 'origin/main'

Showing 42 changed files with 366 additions and 113 deletions
... ... @@ -3,7 +3,7 @@
*/
export const enum CompStyle {
Label_03 = 'Label-03', // 标题卡:icon+文字
Label_03 = 'Label-03', // 标题卡:icon+文字
Carousel_Layout_02 = 'Carousel_Layout-02', // 直播轮播卡:直播
Single_Row_02 = 'Zh_Single_Row-02', // 通用横划卡:视频、直播、专题
Single_Row_03 = 'Single_Row-03', // 直播横划卡:直播
... ...
... ... @@ -5,12 +5,15 @@ import { BaseDTO } from './BaseDTO';
@Observed
export class CompDTO implements BaseDTO {
expIds: string = '';
itemId: string = '';
contentText?: string = '';
backgroundColor: string = '';
backgroundImgUrl: string = '';
cityCode: string = '';
compStyle: string = '';
compType: string = '';
cardItemId: string = '';
// dataSourceRequest: any[];
districtCode: string = '';
extraData?: string;
... ... @@ -44,7 +47,7 @@ export class CompDTO implements BaseDTO {
matInfo: CompAdvMatInfoBean = new CompAdvMatInfoBean
pageId?: string;
objectType?: string;
hasMore: number = 1
hasMore: number = 1;
// keyGenerator相关字符串,用于刷新list布局
timestamp: String = '1'
... ...
... ... @@ -11,12 +11,15 @@ import { LiveRoomDataBean } from '../live/LiveRoomDataBean';
@Observed
export class ContentDTO implements BaseDTO {
expIds: string = '';
itemId: string = '';
shareFlag?: string = '1';
appStyle: string = '';
cityCode: string = '';
coverSize: string = '';
coverType: number = -1;
coverUrl: string = '';
cnsTraceId: string = ''
description: string = '';
districtCode: string = '';
endTime: string = '';
... ... @@ -45,6 +48,8 @@ export class ContentDTO implements BaseDTO {
startTime: string = '';
subType: string = '';
subtitle: string = '';
sceneId: string = '';
subSceneId: string = '';
title: string = '';
vImageUrl: string = '';
screenType: string = '';
... ...
... ... @@ -23,6 +23,8 @@ import { SearchContentComponent } from './cardview/SearchContentComponent';
*/
@Component
export struct CardParser {
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@ObjectLink compDTO: CompDTO
... ... @@ -34,39 +36,39 @@ export struct CardParser {
contentBuilder(contentDTO: ContentDTO) {
// Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO })
if (!!contentDTO.contentText) {
SearchContentComponent({ contentDTO })
SearchContentComponent({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
} else {
if (contentDTO.appStyle === CompStyle.Card_02) {
Card2Component({ compDTO: this.compDTO, contentDTO })
Card2Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_03) {
Card3Component({ compDTO: this.compDTO, contentDTO })
Card3Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_04) {
Card4Component({ compDTO: this.compDTO, contentDTO })
Card4Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_05) {
Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy})
Card5Component({ compDTO: this.compDTO, contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy, pageId: this.pageId, pageName: this.pageName})
} else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle
.Card_13) {
Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO })
Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_10) {
Card10Component({ compDTO: this.compDTO, contentDTO })
Card10Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_11) {
Card11Component({ compDTO: this.compDTO, contentDTO })
Card11Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_12) {
Card12Component({ contentDTO })
Card12Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_14) {
Card14Component({ contentDTO })
Card14Component({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_15) {
Card15Component({ contentDTO })
Card15Component({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_16) {
Card16Component({ contentDTO })
Card16Component({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_17) {
Card17Component({ compDTO: this.compDTO, contentDTO })
Card17Component({ compDTO: this.compDTO, contentDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_19) {
Card19Component({ contentDTO })
Card19Component({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_20) {
Card20Component({ contentDTO })
Card20Component({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
} else if (contentDTO.appStyle === CompStyle.Card_21) {
Card21Component({ contentDTO })
Card21Component({ contentDTO, compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
} else {
// todo:组件未实现 / Component Not Implemented
// Text(contentDTO.appStyle)
... ...
... ... @@ -33,6 +33,8 @@ import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'
*/
@Component
export struct CompParser {
@State pageId: string = '';
@State pageName: string = '';
@ObjectLink compDTO: CompDTO
@State compIndex: number = 0;
@State private pageModel: PageModel = new PageModel();
... ... @@ -71,26 +73,26 @@ export struct CompParser {
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
if (this.compDTO.operDataList.length > this.audioItems.length) {
ZhCarouselLayout01({ compDTO: this.compDTO })
ZhCarouselLayout01({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
}
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 &&
this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡"
LiveHorizontalCardComponent({ compDTO: this.compDTO })
LiveHorizontalCardComponent({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && this.compDTO.imageScale === 3) {
if (this.compDTO.operDataList.length > 1) {
HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: this.compDTO })
HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
} else {
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: this.compDTO })
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
}
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
ZhSingleRow02({ compDTO: this.compDTO })
ZhSingleRow02({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
ZhSingleRow03({ compDTO: this.compDTO })
ZhSingleRow03({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { //双列流小视频,一行两图卡 ->标题
//ZhGridLayout02({ compDTO: this.compDTO })
... ... @@ -98,34 +100,34 @@ export struct CompParser {
// Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Card_Comp_Zh_Grid_Layout_02) { //双列流小视频,一行两图卡
ZhGridLayout02NewsContent({ compDTO: this.compDTO, operDataList: this.compDTO.operDataList })
ZhGridLayout02NewsContent({ compDTO: this.compDTO, operDataList: this.compDTO.operDataList, pageId: this.pageId, pageName: this.pageName })
} else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
ZhGridLayout03({ compDTO: this.compDTO })
ZhGridLayout03({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
ZhSingleRow04({ compDTO: this.compDTO })
ZhSingleRow04({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
// ZhSingleRow05({ compDTO })
// Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
ZhSingleRow06({ compDTO: this.compDTO })
ZhSingleRow06({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
//头图卡 和comStyle 2相同,
Card5Component({ contentDTO: this.compDTO.operDataList[0], titleShowPolicy: this.compDTO.titleShowPolicy })
Card5Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0], titleShowPolicy: this.compDTO.titleShowPolicy, pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
// 大图卡
Card2Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0] })
Card2Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0], pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Card_09) {
//时间链卡
Card9Component({ contentDTO:this.compDTO.operDataList[0] })
Card9Component({ compDTO: this.compDTO, contentDTO:this.compDTO.operDataList[0], pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
ZhSingleColumn04({ compDTO: this.compDTO })
ZhSingleColumn04({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
// ZhSingleColumn05({ compDTO: compDTO })
... ... @@ -140,7 +142,7 @@ export struct CompParser {
//Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 0, right: 0 })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (!Number.isNaN(Number(this.compDTO.compStyle))) {
CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO: this.compDTO });
CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName });
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else {
// Text(this.compDTO.compStyle)
... ...
... ... @@ -5,6 +5,7 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { InfomationCardClick } from '../../utils/infomationCardClick'
/**
* 大专题卡--CompStyle: 10
... ... @@ -14,6 +15,8 @@ const TAG: string = 'Card10Component';
@Preview
@Component
export struct Card10Component {
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@ObjectLink compDTO: CompDTO
... ... @@ -57,6 +60,7 @@ export struct Card10Component {
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 19 })
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
ProcessUtils.processPage(this.contentDTO)
})
}
... ... @@ -70,6 +74,7 @@ export struct Card10Component {
topRight: $r('app.float.image_border_radius')
})
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
ProcessUtils.processPage(this.contentDTO)
})
if (this.contentDTO.objectType == '5') {
... ... @@ -102,6 +107,7 @@ export struct Card10Component {
.justifyContent(FlexAlign.Center)
.margin({ top: 5 })
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
ProcessUtils.processPage(this.contentDTO)
})
}
... ...
... ... @@ -6,6 +6,7 @@ import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG = 'Card11Component';
... ... @@ -14,6 +15,8 @@ const TAG = 'Card11Component';
*/
@Component
export struct Card11Component {
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State clicked: boolean = false;
@ObjectLink compDTO: CompDTO
... ... @@ -78,6 +81,7 @@ export struct Card11Component {
})
.backgroundColor($r("app.color.white"))
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
import { ContentDTO } from 'wdBean';
import { ContentDTO, CompDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import {CarderInteraction} from '../CarderInteraction'
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG = 'Card12Component';
... ... @@ -13,6 +14,9 @@ const TAG = 'Card12Component';
*/
@Component
export struct Card12Component {
@ObjectLink compDTO: CompDTO
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State clicked: boolean = false;
@State titleMarked: boolean = false;
... ... @@ -70,6 +74,7 @@ export struct Card12Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
import { ContentDTO } from 'wdBean';
import { ContentDTO, CompDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
... ... @@ -6,6 +6,7 @@ import { ProcessUtils } from 'wdRouter';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG = 'Card14Component';
... ... @@ -14,6 +15,9 @@ const TAG = 'Card14Component';
*/
@Component
export struct Card14Component {
@ObjectLink compDTO: CompDTO
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
... ... @@ -89,6 +93,7 @@ export struct Card14Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
import { ContentDTO } from 'wdBean';
import { ContentDTO, CompDTO } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
... ... @@ -6,6 +6,7 @@ import { CommonConstants } from 'wdConstant/Index';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG: string = 'Card15Component';
... ... @@ -18,6 +19,9 @@ const TAG: string = 'Card15Component';
*/
@Component
export struct Card15Component {
@ObjectLink compDTO: CompDTO
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
... ... @@ -87,6 +91,7 @@ export struct Card15Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
import { ContentDTO } from 'wdBean';
import { ContentDTO, CompDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
... ... @@ -6,6 +6,7 @@ import { ProcessUtils } from 'wdRouter';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG = 'Card16Component';
... ... @@ -19,6 +20,9 @@ interface fullColumnImgUrlItem {
*/
@Component
export struct Card16Component {
@ObjectLink compDTO: CompDTO
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
... ... @@ -88,6 +92,7 @@ export struct Card16Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
... ... @@ -6,6 +6,7 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG = 'Card17Component';
... ... @@ -14,6 +15,8 @@ const TAG = 'Card17Component';
*/
@Component
export struct Card17Component {
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
... ... @@ -106,6 +109,7 @@ export struct Card17Component {
}
.width(CommonConstants.FULL_WIDTH)
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
let taskAction: Action = {
... ...
import { ContentDTO, FullColumnImgUrlDTO, PhotoListBean } from 'wdBean';
import { ContentDTO, FullColumnImgUrlDTO, PhotoListBean, CompDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { ProcessUtils } from 'wdRouter';
import { CommonConstants } from 'wdConstant/Index';
import { CarderInteraction } from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG = 'Card19Component';
... ... @@ -13,6 +14,9 @@ const TAG = 'Card19Component';
*/
@Component
export struct Card19Component {
@ObjectLink compDTO: CompDTO
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO()
@State clicked: boolean = false;
@State titleMarked: boolean = false;
... ... @@ -58,6 +62,7 @@ export struct Card19Component {
.width(CommonConstants.FULL_WIDTH)
.lineHeight(25)
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
... ... @@ -75,6 +80,7 @@ export struct Card19Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
import { ContentDTO } from 'wdBean';
import { ContentDTO, CompDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
... ... @@ -6,6 +6,7 @@ import { ProcessUtils } from 'wdRouter';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG = 'Card20Component';
... ... @@ -14,6 +15,9 @@ const TAG = 'Card20Component';
*/
@Component
export struct Card20Component {
@ObjectLink compDTO: CompDTO
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State clicked: boolean = false;
@State titleMarked: boolean = false;
... ... @@ -72,6 +76,7 @@ export struct Card20Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ... @@ -98,7 +103,7 @@ struct createImg {
build() {
GridRow() {
if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) {
if (this.contentDTO.fullColumnImgUrls[0].landscape === 1 || this.contentDTO.fullColumnImgUrls[0].weight > this.contentDTO.fullColumnImgUrls[0].height) {
// 横屏
GridCol({
span: { xs: 12 }
... ...
import { ContentDTO } from 'wdBean';
import { ContentDTO, CompDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { RmhTitle } from '../cardCommon/RmhTitle'
... ... @@ -6,6 +6,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG: string = 'Card6Component-Card13Component';
... ... @@ -14,6 +15,9 @@ const TAG: string = 'Card6Component-Card13Component';
*/
@Component
export struct Card21Component {
@ObjectLink compDTO: CompDTO
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
... ... @@ -80,6 +84,7 @@ export struct Card21Component {
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
... ... @@ -6,8 +6,9 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick';
const TAG: string = 'Card2Component';
/**
... ... @@ -19,6 +20,8 @@ const TAG: string = 'Card2Component';
*/
@Component
export struct Card2Component {
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
... ... @@ -111,6 +114,7 @@ export struct Card2Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
... ... @@ -4,6 +4,8 @@ import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
/**
* 卡片样式:"appStyle":"3"
... ... @@ -11,6 +13,8 @@ import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
*/
@Component
export struct Card3Component {
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State clicked: boolean = false;
@ObjectLink compDTO: CompDTO
... ... @@ -71,6 +75,7 @@ export struct Card3Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
... ... @@ -6,6 +6,8 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from './notes';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG: string = 'Card4Component';
/**
... ... @@ -17,6 +19,8 @@ const TAG: string = 'Card4Component';
*/
@Component
export struct Card4Component {
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
... ... @@ -106,6 +110,7 @@ export struct Card4Component {
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
... ... @@ -4,6 +4,8 @@ import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from './notes';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG: string = 'Card5Component';
... ... @@ -12,7 +14,10 @@ const TAG: string = 'Card5Component';
*/
@Component
export struct Card5Component {
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@ObjectLink compDTO: CompDTO
@Prop titleShowPolicy: number | string
@State loadImg: boolean = false;
@State clicked: boolean = false;
... ... @@ -96,6 +101,7 @@ export struct Card5Component {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
... ... @@ -7,6 +7,7 @@ import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Logger } from 'wdKit/Index';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG: string = 'Card6Component-Card13Component';
... ... @@ -15,6 +16,8 @@ const TAG: string = 'Card6Component-Card13Component';
*/
@Component
export struct Card6Component {
@State pageId: string = '';
@State pageName: string = '';
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
... ... @@ -104,6 +107,7 @@ export struct Card6Component {
}
}
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
import { ContentDTO, slideShows } from 'wdBean';
import { ContentDTO, slideShows, CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { DateTimeUtils } from 'wdKit';
import { ProcessUtils } from 'wdRouter';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
/**
* 时间链卡--CompStyle: 09
... ... @@ -13,6 +14,9 @@ const TAG: string = 'Card9Component';
@Component
export struct Card9Component {
@ObjectLink compDTO: CompDTO
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
// @State loadImg: boolean = true;
@State clicked: boolean = false;
... ... @@ -22,6 +26,7 @@ export struct Card9Component {
@State str03: string = '';
async aboutToAppear(): Promise<void> {
console.log('Card9Component', JSON.stringify(this.contentDTO))
this.titleInit();
// this.loadImg = await onlyWifiLoadImg();
this.clicked = hasClicked(this.contentDTO.objectId)
... ... @@ -112,6 +117,7 @@ export struct Card9Component {
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
persistentStorage(this.contentDTO.objectId);
ProcessUtils.processPage(this.contentDTO)
... ...
/**
* More_Comp
*/
import { ContentDTO } from 'wdBean/Index';
const TAG: string = 'Card9Component';
const TAG: string = 'More_Comp';
@Entry
@Component
... ...
... ... @@ -4,6 +4,8 @@ import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG: string = 'Card4Component';
/**
... ... @@ -11,6 +13,9 @@ const TAG: string = 'Card4Component';
*/
@Component
export struct SearchContentComponent {
@ObjectLink compDTO: CompDTO
@State pageId: string = '';
@State pageName: string = '';
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
... ... @@ -57,6 +62,7 @@ export struct SearchContentComponent {
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
... ...
... ... @@ -7,6 +7,7 @@ import { EmptyComponent } from '../view/EmptyComponent';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from '../cardview/notes';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG = 'Zh_Carousel_Layout-01';
... ... @@ -41,6 +42,8 @@ class MyDataSource implements IDataSource {
@Component
export struct ZhCarouselLayout01 {
@State pageId: string = '';
@State pageName: string = '';
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string =
BreakpointConstants.BREAKPOINT_XS;
@State compDTO: CompDTO = {} as CompDTO
... ... @@ -149,6 +152,7 @@ export struct ZhCarouselLayout01 {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.compDTO.operDataList[this.swiperIndex], this.pageId, this.pageName)
Logger.info(TAG, `ZhCarouselLayout01 onClick event index: ${this.swiperIndex}`);
ProcessUtils.processPage(this.compDTO.operDataList[this.swiperIndex])
})
... ...
... ... @@ -4,6 +4,7 @@ import { Logger } from 'wdKit/Index';
import { ProcessUtils } from 'wdRouter';
import PageViewModel from '../../viewmodel/PageViewModel';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { InfomationCardClick } from '../../utils/infomationCardClick'
let listSize: number = 2;
... ... @@ -13,6 +14,8 @@ let listSize: number = 2;
*/
@Component
export struct ZhGridLayout02NewsContent {
@State pageId: string = '';
@State pageName: string = '';
@ObjectLink compDTO: CompDTO
@State operDataList: ContentDTO[] = []
@State loadImg: boolean = false;
... ... @@ -74,6 +77,7 @@ export struct ZhGridLayout02NewsContent {
}
.width('100%')
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
ProcessUtils.processPage(item)
})
}
... ...
... ... @@ -4,6 +4,7 @@ import { Logger } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG = 'Zh_Grid_Layout-03';
const FULL_PARENT: string = '100%';
... ... @@ -18,6 +19,8 @@ let listSize: number = 4;
@Preview
@Component
export struct ZhGridLayout03 {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
... ... @@ -73,6 +76,7 @@ export struct ZhGridLayout03 {
}
.width('100%')
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
if (item.objectType === '11') {
ProcessUtils.jumpChannelTab(item.objectId, item.pageId, item.newsTitle)
} else {
... ...
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG = 'Zh_Single_Column-04';
... ... @@ -10,6 +11,8 @@ const TAG = 'Zh_Single_Column-04';
*/
@Component
export struct ZhSingleColumn04 {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
operDataList: ContentDTO[] = [
// {newsTitle: "民检普法课堂:正当防卫是什么正当防卫是什么正当防卫是什么正当防卫是什么?", tagWord: 1} as ContentDTO,
... ... @@ -83,6 +86,7 @@ export struct ZhSingleColumn04 {
.backgroundImage($r('app.media.rmh_theme_bg'))
.backgroundImageSize({ width: CommonConstants.FULL_WIDTH, height: CommonConstants.FULL_WIDTH })
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
ProcessUtils.processPage(item)
})
}
... ...
import { CommonConstants } from 'wdConstant';
import { Action, CompDTO, Params } from 'wdBean';
import { WDRouterRule } from 'wdRouter';
import { InfomationCardClick } from '../../utils/infomationCardClick'
const TAG = 'Zh_Single_Column-05';
... ... @@ -10,6 +11,8 @@ const TAG = 'Zh_Single_Column-05';
*/
@Component
export struct ZhSingleColumn05 {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
build() {
... ... @@ -29,6 +32,7 @@ export struct ZhSingleColumn05 {
.justifyContent(FlexAlign.Center)
.borderRadius($r('app.float.button_border_radius'))
.onClick(() => {
// InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
... ...
... ... @@ -6,6 +6,7 @@ import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { HttpUtils } from 'wdNetwork/Index';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { InfomationCardClick } from '../../utils/infomationCardClick'
/**
* 小视频横划卡
... ... @@ -15,6 +16,8 @@ const TAG = 'Zh_Single_Row-02'
@Component
export struct ZhSingleRow02 {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
build() {
... ... @@ -26,7 +29,11 @@ export struct ZhSingleRow02 {
List() {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
CreatorItem({
item
item,
index,
compDTO: this.compDTO,
pageId: this.pageId,
pageName: this.pageName
})
.margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0})
})
... ... @@ -69,11 +76,6 @@ export struct ZhSingleRow02 {
Image($r("app.media.more"))
.width(14)
.height(14)
.onClick(() => {
// TODO 跳转的页面,定义的入参可能不合理。推荐id: 41
let params = {'index': "1"} as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
})
}
.padding({
right: $r('app.float.card_comp_pagePadding_lf'),
... ... @@ -103,7 +105,11 @@ function textOverflowStyle(maxLine: number) {
@Component
struct CreatorItem {
@Prop pageId: string = '';
@Prop pageName: string = '';
@Prop compDTO: CompDTO
@Prop item: ContentDTO
@Prop index: number
@State rmhIsAttention: number = 0
@State loadImg: boolean = false;
... ... @@ -143,6 +149,7 @@ struct CreatorItem {
.borderRadius($r('app.float.image_border_radius'))
}
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, this.item, this.pageId, this.pageName)
ProcessUtils.processPage(this.item)
})
}
... ...
... ... @@ -9,6 +9,7 @@ import { LiveModel } from '../../viewmodel/LiveModel'
import { Logger, ToastUtils } from 'wdKit';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { SpConstants } from 'wdConstant/Index'
import { InfomationCardClick } from '../../utils/infomationCardClick';
/**
* 直播预约卡
... ... @@ -25,6 +26,8 @@ interface reserveReqItem {
@Entry
@Component
export struct ZhSingleRow03 {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
@State isEndEdge: boolean = false;
// @State reserveStatus: reserveItem[] = []
... ... @@ -197,6 +200,7 @@ export struct ZhSingleRow03 {
.backgroundColor(0xf9f9f9)
.margin({right: 8})
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
ProcessUtils.processPage(item)
})
}
... ...
... ... @@ -2,6 +2,7 @@ import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { DateTimeUtils } from 'wdKit';
import { ProcessUtils } from 'wdRouter';
import { InfomationCardClick } from '../../utils/infomationCardClick';
/**
* 本地精选卡
... ... @@ -10,6 +11,8 @@ import { ProcessUtils } from 'wdRouter';
@Component
export struct ZhSingleRow04 {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
build() {
... ... @@ -71,6 +74,7 @@ export struct ZhSingleRow04 {
top: 6
})
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
ProcessUtils.processPage(item)
})
}
... ...
... ... @@ -4,6 +4,7 @@ import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
import { CommonConstants } from 'wdConstant/Index';
import { HttpUtils } from 'wdNetwork/Index';
import { InfomationCardClick } from '../../utils/infomationCardClick';
/**
* 人民号横划卡
... ... @@ -14,6 +15,8 @@ const TAG = 'Zh_Single_Row-05'
@Entry
@Component
export struct ZhSingleRow05 {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {
// objectTitle: '创作者推荐',
// operDataList: [
... ... @@ -83,8 +86,8 @@ export struct ZhSingleRow05 {
.height(14)
.onClick(() => {
// TODO 跳转的页面,定义的入参可能不合理。推荐id: 41
let params = {'index': "1"} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
// let params = {'index': "1"} as Record<string, string>;
// WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
})
}
.padding({
... ...
... ... @@ -10,6 +10,7 @@ import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailV
import commentViewModel from '../../components/comment/viewmodel/CommentViewModel';
import { commentItemModel } from '../../components/comment/model/CommentModel'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { InfomationCardClick } from '../../utils/infomationCardClick';
/**
* 精选评论卡
... ... @@ -19,6 +20,8 @@ const TAG = 'Zh_Single_Row-06'
@Entry
@Component
export struct ZhSingleRow06 {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
@State newsStatusOfUser: batchLikeAndCollectResult = {
likeStatus: '0'
... ... @@ -143,8 +146,6 @@ export struct ZhSingleRow06 {
Text(Number(this.newsStatusOfUser?.likeStatus) == 1 ? '已赞' : '点赞')
.fontSize(15)
.fontColor(0x999999)
.onClick(() => {
})
}
.onClick(() => {
this.toggleLikeStatus()
... ... @@ -160,6 +161,9 @@ export struct ZhSingleRow06 {
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r('app.color.white'))
.onClick(() => {
InfomationCardClick.track(this.compDTO, this.compDTO.operDataList[0], this.pageId, this.pageName)
})
}
@Builder
... ...
... ... @@ -546,45 +546,45 @@ export struct TopNavigationComponent {
return null
}
private getTextInfo(index: number): Record<string, number> {
let strJson = getInspectorByKey(index.toString())
try {
let obj: Record<string, string> = JSON.parse(strJson)
let rectInfo: number[][] = JSON.parse('[' + obj.$rect + ']')
return { 'left': px2vp(rectInfo[0][0]), 'width': px2vp(rectInfo[1][0] - rectInfo[0][0]) }
} catch (error) {
return { 'left': 0, 'width': 0 }
}
}
private getCurrentIndicatorInfo(index: number, event: TabsAnimationEvent): Record<string, number> {
let nextIndex = index
if (index > 0 && event.currentOffset > 0) {
nextIndex--
} else if (index < 3 && event.currentOffset < 0) {
nextIndex++
}
let indexInfo = this.getTextInfo(index)
let nextIndexInfo = this.getTextInfo(nextIndex)
let swipeRatio = Math.abs(event.currentOffset / this.tabsWidth)
let currentIndex = swipeRatio > 0.5 ? nextIndex : index // 页面滑动超过一半,tabBar切换到下一页。
let currentLeft = indexInfo.left + (nextIndexInfo.left - indexInfo.left) * swipeRatio
let currentWidth = indexInfo.width + (nextIndexInfo.width - indexInfo.width) * swipeRatio
return { 'index': currentIndex, 'left': currentLeft, 'width': currentWidth }
}
private startAnimateTo(duration: number, leftMargin: number, width: number) {
animateTo({
duration: duration, // 动画时长
curve: Curve.Linear, // 动画曲线
iterations: 1, // 播放次数
playMode: PlayMode.Normal, // 动画模式
onFinish: () => {
console.info('play end')
}
}, () => {
this.indicatorLeftMargin = leftMargin
this.indicatorWidth = width
})
}
// private getTextInfo(index: number): Record<string, number> {
// let strJson = getInspectorByKey(index.toString())
// try {
// let obj: Record<string, string> = JSON.parse(strJson)
// let rectInfo: number[][] = JSON.parse('[' + obj.$rect + ']')
// return { 'left': px2vp(rectInfo[0][0]), 'width': px2vp(rectInfo[1][0] - rectInfo[0][0]) }
// } catch (error) {
// return { 'left': 0, 'width': 0 }
// }
// }
//
// private getCurrentIndicatorInfo(index: number, event: TabsAnimationEvent): Record<string, number> {
// let nextIndex = index
// if (index > 0 && event.currentOffset > 0) {
// nextIndex--
// } else if (index < 3 && event.currentOffset < 0) {
// nextIndex++
// }
// let indexInfo = this.getTextInfo(index)
// let nextIndexInfo = this.getTextInfo(nextIndex)
// let swipeRatio = Math.abs(event.currentOffset / this.tabsWidth)
// let currentIndex = swipeRatio > 0.5 ? nextIndex : index // 页面滑动超过一半,tabBar切换到下一页。
// let currentLeft = indexInfo.left + (nextIndexInfo.left - indexInfo.left) * swipeRatio
// let currentWidth = indexInfo.width + (nextIndexInfo.width - indexInfo.width) * swipeRatio
// return { 'index': currentIndex, 'left': currentLeft, 'width': currentWidth }
// }
// private startAnimateTo(duration: number, leftMargin: number, width: number) {
// animateTo({
// duration: duration, // 动画时长
// curve: Curve.Linear, // 动画曲线
// iterations: 1, // 播放次数
// playMode: PlayMode.Normal, // 动画模式
// onFinish: () => {
// console.info('play end')
// }
// }, () => {
// this.indicatorLeftMargin = leftMargin
// this.indicatorWidth = width
// })
// }
}
\ No newline at end of file
... ...
import { CommonConstants } from 'wdConstant'
import { ContentDTO, CompDTO, Action, Params } from 'wdBean'
import { ProcessUtils, WDRouterRule, WDRouterPage } from 'wdRouter';
import { InfomationCardClick } from '../../utils/infomationCardClick';
@Component
export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
@State compDTO: CompDTO = {} as CompDTO
@State pageId: string = '';
@State pageName: string = '';
build() {
Column() {
... ... @@ -76,6 +79,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
.padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 })
// .offset({x:16})
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
ProcessUtils.processPage(item)
})
})
... ...
... ... @@ -3,9 +3,12 @@ import { WDRouterRule } from 'wdRouter/Index'
import { Logger } from 'wdKit/Index'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { LiveModel } from '../../viewmodel/LiveModel'
import { InfomationCardClick } from '../../utils/infomationCardClick';
@Component
export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
@State clicked: boolean = false;
... ... @@ -64,6 +67,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
.onClick(() => {
InfomationCardClick.track(this.compDTO, this.compDTO.operDataList[0], this.pageId, this.pageName)
this.clicked = true;
this.gotoLive(this.compDTO?.operDataList[0])
})
... ...
... ... @@ -9,10 +9,13 @@ import { LiveModel } from '../../viewmodel/LiveModel'
import { ContentConstants } from '../../constants/ContentConstants'
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { InfomationCardClick } from '../../utils/infomationCardClick';
@Component
export struct LiveHorizontalCardComponent {
@State pageId: string = '';
@State pageName: string = '';
@State compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
... ... @@ -95,6 +98,7 @@ export struct LiveHorizontalCardComponent {
}
.padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 })
.onClick(() => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
if (item.objectType != '0') {
console.log(item.objectId)
this.gotoLive(item)
... ...
import { TrackingContent, TrackConstants, ParamType } from 'wdTracking';
import { CompDTO, ContentDTO } from 'wdBean';
export class InfomationCardClick {
private static getLiveState(contentDTO: ContentDTO) {
if (contentDTO?.liveInfo?.liveState === 'wait') {
return 'liveSubscribe'
} else if (contentDTO?.liveInfo?.liveState === 'running') {
return 'livePlaying'
} else if (contentDTO?.liveInfo?.liveState === 'end') {
return 'liveEnd'
} else {
return ''
}
}
private static getSummaryType(objectType: string) {
let summaryType: string = ''
switch(objectType) {
case '2':
summaryType = 'liveTopic';
break;
case '8':
summaryType = 'articleTopic';
break;
case '13':
summaryType = 'audioTopic';
break;
// case '':
// summaryType = 'talkTopic';
// break;
// case '':
// summaryType = 'morningAndEveningNewsTopic';
// break;
// case '':
// summaryType = 'timeAxisTopic';
// break;
default:
summaryType = '';
break;
}
return summaryType;
}
public static track(compDTO: CompDTO, contentDTO: ContentDTO, pageId: string, pageName: string): void {
try {
const extParams: ParamType = {
'action': 'detailPageShow',
'shareChannel': '',
'duration': 0,
'contentName': contentDTO.newsTitle,
'contentType': contentDTO.objectType,
// 'contentClassify': '' // 废除
'contentId': contentDTO.objectId,
// 'compId': contentDTO.relId,
'contentStyle': contentDTO.appStyle,
'liveType': InfomationCardClick.getLiveState(contentDTO),
'channelSourceId': contentDTO.channelId,
'contentShowChannelId': contentDTO.channelId,
// 'contentShowChannelName': '',
'linkUrl': contentDTO.linkUrl,
'regionName': 2, // 信息流:2
'componentType': compDTO.compStyle,
'sceneId': contentDTO.sceneId,
'subSceneId': contentDTO.subSceneId,
'cnsTraceId': contentDTO.cnsTraceId,
'cardItemId': compDTO.cardItemId,
'itemId': compDTO.itemId || contentDTO.itemId,
'expIds': compDTO.expIds || contentDTO.expIds
}
if (contentDTO.objectType === '5') {
extParams['summaryId'] = contentDTO.objectId;
extParams['summaryType'] = InfomationCardClick.getSummaryType(contentDTO.objectType);
extParams['specialLink'] = contentDTO.linkUrl;
}
if (contentDTO.objectType === '2') {
extParams['liveStreamType'] = contentDTO?.liveInfo.vrType === 0 ? 1 : 2;
extParams['vliveId'] = contentDTO.objectId;
extParams['vliveName'] = contentDTO.newsTitle;
extParams['liveMode'] = 1;
}
if (contentDTO.rmhPlatform === 1) {
extParams['saAuthorName'] = contentDTO.rmhInfo?.rmhName;
extParams['saAuthorId'] = contentDTO.rmhInfo?.rmhId;
} else if (contentDTO.source) {
extParams['saAuthorName'] = contentDTO.source;
}
console.log('InfomationCardClick-params:', JSON.stringify(extParams))
TrackingContent.common(TrackConstants.EventType.Click, pageId, pageName, extParams)
} catch (err) {
console.log('InfomationCardClick-err', JSON.stringify(err))
}
}
}
\ No newline at end of file
... ...
... ... @@ -83,23 +83,30 @@ export struct DetailPlayLiveCommon {
* 获取直播信息,可区分横竖屏直播
*/
getLiveDetails() {
this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType)
.then(
(data) => {
if (data.length > 0) {
this.liveDetailsBean = data[0]
this.liveState = this.liveDetailsBean.liveInfo?.liveState
this.liveStyle = this.liveDetailsBean.liveInfo.liveStyle
if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
//todo 不加setTimeOut ,接口返回的数据 就没法让PlayerComponent #@Consume @Watch('updateData') liveDetailsBean 的updateData方法运行
setTimeout(() => {
this.liveDetailsBean = data[0]
}, 10)
this.liveState = data[0].liveInfo?.liveState
this.liveStyle = data[0].liveInfo.liveStyle
if (data[0].fullColumnImgUrls && data[0].fullColumnImgUrls.length > 0) {
this.imgUrl = data[0].fullColumnImgUrls[0].url
}
if (this.liveDetailsBean.liveInfo.liveState == 'end') {
this.playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
if (data[0].liveInfo.liveState == 'end') {
this.playUrl = data[0].liveInfo.vlive[0].replayUri
}
console.log(TAG, 'getLiveDetails:', JSON.stringify((this.liveDetailsBean)))
// console.log(TAG, 'getLiveDetails:', JSON.stringify((this.liveDetailsBean)))
}
},
() => {
... ...
... ... @@ -36,6 +36,7 @@ export struct DetailPlayVLivePage {
aboutToAppear(): void {
this.openFullScreen()
this.getLiveRoomData()
}
aboutToDisappear(): void {
... ...
... ... @@ -21,6 +21,7 @@ export struct PlayerComponent {
@State playUrl: string = ''
@State isCanplay: boolean = false
pageShowChange() {
this.playerController?.play()
}
... ... @@ -30,15 +31,10 @@ export struct PlayerComponent {
}
aboutToAppear(): void {
console.log(TAG, 'aboutToAppear')
this.playerController.onCanplay = () => {
console.log('可以播放了')
this.playerController?.play()
this.isCanplay = true
}
}
async aboutToDisappear(): Promise<void> {
await this.playerController?.pause()
await this.playerController?.stop()
await this.playerController?.release()
... ... @@ -63,7 +59,6 @@ export struct PlayerComponent {
this.liveStreamType = liveStreamType
this.playUrl = playUrl
}
}
... ... @@ -75,6 +70,7 @@ export struct PlayerComponent {
WDPlayerRenderVLiveView({
playerController: this.playerController,
onLoad: () => {
this.isCanplay = true
this.playerController?.firstPlay(this.playUrl);
}
})
... ... @@ -82,12 +78,14 @@ export struct PlayerComponent {
AliPlayerRenderView({
playerController: this.playerController,
onLoad: () => {
this.isCanplay = true
this.playerController?.firstPlay(this.playUrl);
}
}).margin({ top: 195 }).height(211)
}
PictureLoading().visibility(this.isCanplay ? Visibility.None : Visibility.Visible)
}
.height('100%')
.width('100%')
... ... @@ -98,8 +96,11 @@ export struct PlayerComponent {
this.isShowControl = !this.isShowControl
}
})
}
.height('100%')
.width('100%')
}
}
\ No newline at end of file
... ...
... ... @@ -137,7 +137,6 @@ export class WDAliPlayerController {
onStateChanged: (status: number) => {
this.avPlayerStatus = status
Logger.debug(TAG, "status update:" + `${this.getStatusStringWith(status)}`)
switch (status) {
case initalized: {
//this.avPlayer?.prepare();
... ...