wangliang_wd

feat:优化早晚报

... ... @@ -13,6 +13,11 @@ export class ContentConstants {
*/
static readonly TYPE_LIVE: string = "2";
/**
* 3:活动
*/
static readonly TYPE_Activity: string = "3";
static readonly TYPE_FOUR: string = "4";
/**
* 5:专题详情
... ...
... ... @@ -106,7 +106,7 @@ export class ProcessUtils {
case ContentConstants.TYPE_AUDIO:
ProcessUtils.gotoAudio(content)
break;
case ContentConstants.TYPE_TELETEXT:
case ContentConstants.TYPE_TELETEXT:case ContentConstants.TYPE_Activity:
// 图文详情,跳转h5
if (content?.linkUrl) { //有 linkUrl 走专题页展示逻辑
ProcessUtils.gotoSpecialTopic(content,true)
... ...
... ... @@ -6,7 +6,7 @@ export interface TopicInfo {
commentFlag: number;
commentPreviewFlag: number;
commentShowFlag: number;
// frontFlag?: any;
frontFlag: number;
frontLinkObject?: FrontLinkObject;
posterFlag: number;
posterUrl: string;
... ...
... ... @@ -23,6 +23,9 @@ import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel
import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel'
import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
import {TrackConstants,TrackParamConvert}from 'wdTracking/Index'
import { ColorUtils } from '../../utils/ColorUtils';
const TAG = 'MorningEveningPaperComponent';
... ... @@ -200,13 +203,18 @@ export struct MorningEveningPaperComponent {
const imageSource: image.ImageSource | undefined = await getPicture(imageUrl)
if (imageSource) {
if (imageSource && this.pageInfoBean.topicInfo.frontFlag === 1) {
this.pickColor(imageSource)
} else {
this.mixedBgColor = this.pageInfoBean.backgroundColor
if (this.pageInfoBean.topicInfo.topicPattern === 1) {
this.mixedBgColor = '#66BDBD'
}else if(this.pageInfoBean.topicInfo.topicPattern === 2){
this.mixedBgColor = '#E78E17'
}else {
this.mixedBgColor = '#2F2170'
}
}
}
private async pickColor(imageSource: image.ImageSource | undefined) {
... ... @@ -216,6 +224,7 @@ export struct MorningEveningPaperComponent {
let color = colorPicker.getMainColorSync();
Logger.debug(TAG, "compInfoBean compStyle = " + color)
color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
// 将取色器选取的color示例转换为十六进制颜色代码
this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16);
Logger.debug(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
... ... @@ -230,9 +239,15 @@ export struct MorningEveningPaperComponent {
// WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
onPageShow(){
TrackingPageBrowseUtils.TrackingPageBrowseExposureStart()
}
onPageHide() {
this.status = PlayerConstants.STATUS_PAUSE;
this.playerController?.pause();
TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd('','',TrackParamConvert.pageInfoBean_ParamType(this.pageInfoBean))
}
build() {
... ...
import { FrontLinkObject } from 'wdBean';
import { ContentDTO, FrontLinkObject } from 'wdBean';
import { ProcessUtils } from 'wdRouter/Index';
/**
* 早晚报,topic
... ... @@ -47,7 +48,15 @@ export struct topicInfoView {
.backgroundColor($r('app.color.color_99636363'))
.margin({ top: 8, left: 16, right: 16, bottom: 16 })
.borderRadius(2)
// .backgroundColor(Color.Red)
.onClick(()=>{
if (this.frontLinkObject) {
let contentDTO :ContentDTO = new ContentDTO();
contentDTO.objectType = this.frontLinkObject?.newsType.toString()
contentDTO.objectId = this.frontLinkObject?.newsId
contentDTO.linkUrl = this.frontLinkObject?.linkUrl
ProcessUtils.processPage(contentDTO)
}
})
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
... ...
... ... @@ -173,4 +173,47 @@ export class ColorUtils {
alpha: (color & 0xFF000000) >> 24
}
}
public static getMorningEveningPaperRgb(color: ColorRgb): ColorRgb{
// RGB颜色取值范围是0~255,需要转换为0~1的浮点数
const red: number = color.red / MAX_RGB_VALUE;
const green: number = color.green / MAX_RGB_VALUE;
const blue: number = color.blue / MAX_RGB_VALUE;
const max: number = Math.max(red, green, blue);
const min: number = Math.min(red, green, blue);
const delta: number = max - min;
// 色调
let hue: number = 0;
// 饱和度
let saturation: number = 0;
// 明度
let value: number = 0;
// 计算hue值
if (max === min) {
hue = 0;
} else if (Math.abs(max - red) < Number.EPSILON) {
hue = (green >= blue ? ((green - blue) / delta) * 60 : ((green - blue) / delta) * 60 + 360);
} else if (Math.abs(max - green) < Number.EPSILON) {
hue = (((blue - red) / delta) + 2) * 60;
} else if (Math.abs(max - blue) < Number.EPSILON) {
hue = (((red - green) / delta) + 4) * 60;
}
// 计算saturation值
saturation = 0.9;
// 计算value值
value = 0.3;
return ColorUtils.hsv2rgb({
hue: hue,
saturation: saturation,
value: value,
alpha: color.alpha
})
}
}
\ No newline at end of file
... ...
... ... @@ -196,8 +196,8 @@ struct LaunchAdvertisingPage {
contentTrackingDict(){
this.pageParam = {
'adType':'0',
'adId':this.model.launchAdInfo[0].matInfo.id.toString(),
'adName':this.model.launchAdInfo[0].matInfo.advTitle,
'adId':this.model.launchAdInfo[0]?.matInfo.id.toString(),
'adName':this.model.launchAdInfo[0]?.matInfo.advTitle,
'regionName':'0'
}
}
... ...