wangliang_wd

feat:优化早晚报

@@ -13,6 +13,11 @@ export class ContentConstants { @@ -13,6 +13,11 @@ export class ContentConstants {
13 */ 13 */
14 static readonly TYPE_LIVE: string = "2"; 14 static readonly TYPE_LIVE: string = "2";
15 15
  16 + /**
  17 + * 3:活动
  18 + */
  19 + static readonly TYPE_Activity: string = "3";
  20 +
16 static readonly TYPE_FOUR: string = "4"; 21 static readonly TYPE_FOUR: string = "4";
17 /** 22 /**
18 * 5:专题详情 23 * 5:专题详情
@@ -106,7 +106,7 @@ export class ProcessUtils { @@ -106,7 +106,7 @@ export class ProcessUtils {
106 case ContentConstants.TYPE_AUDIO: 106 case ContentConstants.TYPE_AUDIO:
107 ProcessUtils.gotoAudio(content) 107 ProcessUtils.gotoAudio(content)
108 break; 108 break;
109 - case ContentConstants.TYPE_TELETEXT: 109 + case ContentConstants.TYPE_TELETEXT:case ContentConstants.TYPE_Activity:
110 // 图文详情,跳转h5 110 // 图文详情,跳转h5
111 if (content?.linkUrl) { //有 linkUrl 走专题页展示逻辑 111 if (content?.linkUrl) { //有 linkUrl 走专题页展示逻辑
112 ProcessUtils.gotoSpecialTopic(content,true) 112 ProcessUtils.gotoSpecialTopic(content,true)
@@ -6,7 +6,7 @@ export interface TopicInfo { @@ -6,7 +6,7 @@ export interface TopicInfo {
6 commentFlag: number; 6 commentFlag: number;
7 commentPreviewFlag: number; 7 commentPreviewFlag: number;
8 commentShowFlag: number; 8 commentShowFlag: number;
9 - // frontFlag?: any; 9 + frontFlag: number;
10 frontLinkObject?: FrontLinkObject; 10 frontLinkObject?: FrontLinkObject;
11 posterFlag: number; 11 posterFlag: number;
12 posterUrl: string; 12 posterUrl: string;
@@ -23,6 +23,9 @@ import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel @@ -23,6 +23,9 @@ import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel
23 import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel' 23 import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel'
24 import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare' 24 import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare'
25 import { common } from '@kit.AbilityKit'; 25 import { common } from '@kit.AbilityKit';
  26 +import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils'
  27 +import {TrackConstants,TrackParamConvert}from 'wdTracking/Index'
  28 +import { ColorUtils } from '../../utils/ColorUtils';
26 29
27 const TAG = 'MorningEveningPaperComponent'; 30 const TAG = 'MorningEveningPaperComponent';
28 31
@@ -200,13 +203,18 @@ export struct MorningEveningPaperComponent { @@ -200,13 +203,18 @@ export struct MorningEveningPaperComponent {
200 203
201 const imageSource: image.ImageSource | undefined = await getPicture(imageUrl) 204 const imageSource: image.ImageSource | undefined = await getPicture(imageUrl)
202 205
203 - if (imageSource) { 206 + if (imageSource && this.pageInfoBean.topicInfo.frontFlag === 1) {
204 this.pickColor(imageSource) 207 this.pickColor(imageSource)
205 208
206 } else { 209 } else {
207 - this.mixedBgColor = this.pageInfoBean.backgroundColor 210 + if (this.pageInfoBean.topicInfo.topicPattern === 1) {
  211 + this.mixedBgColor = '#66BDBD'
  212 + }else if(this.pageInfoBean.topicInfo.topicPattern === 2){
  213 + this.mixedBgColor = '#E78E17'
  214 + }else {
  215 + this.mixedBgColor = '#2F2170'
  216 + }
208 } 217 }
209 -  
210 } 218 }
211 219
212 private async pickColor(imageSource: image.ImageSource | undefined) { 220 private async pickColor(imageSource: image.ImageSource | undefined) {
@@ -216,6 +224,7 @@ export struct MorningEveningPaperComponent { @@ -216,6 +224,7 @@ export struct MorningEveningPaperComponent {
216 let color = colorPicker.getMainColorSync(); 224 let color = colorPicker.getMainColorSync();
217 Logger.debug(TAG, "compInfoBean compStyle = " + color) 225 Logger.debug(TAG, "compInfoBean compStyle = " + color)
218 226
  227 + color = ColorUtils.getMorningEveningPaperRgb({red:color.red,green:color.green,blue:color.blue,alpha:color.alpha})
219 // 将取色器选取的color示例转换为十六进制颜色代码 228 // 将取色器选取的color示例转换为十六进制颜色代码
220 this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16); 229 this.mixedBgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16);
221 Logger.debug(TAG, "compInfoBean compStyle = " + this.mixedBgColor) 230 Logger.debug(TAG, "compInfoBean compStyle = " + this.mixedBgColor)
@@ -230,9 +239,15 @@ export struct MorningEveningPaperComponent { @@ -230,9 +239,15 @@ export struct MorningEveningPaperComponent {
230 // WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) 239 // WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
231 } 240 }
232 241
  242 + onPageShow(){
  243 + TrackingPageBrowseUtils.TrackingPageBrowseExposureStart()
  244 + }
  245 +
233 onPageHide() { 246 onPageHide() {
234 this.status = PlayerConstants.STATUS_PAUSE; 247 this.status = PlayerConstants.STATUS_PAUSE;
235 this.playerController?.pause(); 248 this.playerController?.pause();
  249 +
  250 + TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd('','',TrackParamConvert.pageInfoBean_ParamType(this.pageInfoBean))
236 } 251 }
237 252
238 build() { 253 build() {
1 -import { FrontLinkObject } from 'wdBean'; 1 +import { ContentDTO, FrontLinkObject } from 'wdBean';
  2 +import { ProcessUtils } from 'wdRouter/Index';
2 3
3 /** 4 /**
4 * 早晚报,topic 5 * 早晚报,topic
@@ -47,7 +48,15 @@ export struct topicInfoView { @@ -47,7 +48,15 @@ export struct topicInfoView {
47 .backgroundColor($r('app.color.color_99636363')) 48 .backgroundColor($r('app.color.color_99636363'))
48 .margin({ top: 8, left: 16, right: 16, bottom: 16 }) 49 .margin({ top: 8, left: 16, right: 16, bottom: 16 })
49 .borderRadius(2) 50 .borderRadius(2)
50 - // .backgroundColor(Color.Red) 51 + .onClick(()=>{
  52 + if (this.frontLinkObject) {
  53 + let contentDTO :ContentDTO = new ContentDTO();
  54 + contentDTO.objectType = this.frontLinkObject?.newsType.toString()
  55 + contentDTO.objectId = this.frontLinkObject?.newsId
  56 + contentDTO.linkUrl = this.frontLinkObject?.linkUrl
  57 + ProcessUtils.processPage(contentDTO)
  58 + }
  59 + })
51 .alignRules({ 60 .alignRules({
52 left: { anchor: "__container__", align: HorizontalAlign.Start }, 61 left: { anchor: "__container__", align: HorizontalAlign.Start },
53 bottom: { anchor: "__container__", align: VerticalAlign.Bottom } 62 bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
@@ -173,4 +173,47 @@ export class ColorUtils { @@ -173,4 +173,47 @@ export class ColorUtils {
173 alpha: (color & 0xFF000000) >> 24 173 alpha: (color & 0xFF000000) >> 24
174 } 174 }
175 } 175 }
  176 +
  177 +
  178 + public static getMorningEveningPaperRgb(color: ColorRgb): ColorRgb{
  179 + // RGB颜色取值范围是0~255,需要转换为0~1的浮点数
  180 + const red: number = color.red / MAX_RGB_VALUE;
  181 + const green: number = color.green / MAX_RGB_VALUE;
  182 + const blue: number = color.blue / MAX_RGB_VALUE;
  183 +
  184 + const max: number = Math.max(red, green, blue);
  185 + const min: number = Math.min(red, green, blue);
  186 + const delta: number = max - min;
  187 +
  188 + // 色调
  189 + let hue: number = 0;
  190 + // 饱和度
  191 + let saturation: number = 0;
  192 + // 明度
  193 + let value: number = 0;
  194 + // 计算hue值
  195 + if (max === min) {
  196 + hue = 0;
  197 + } else if (Math.abs(max - red) < Number.EPSILON) {
  198 + hue = (green >= blue ? ((green - blue) / delta) * 60 : ((green - blue) / delta) * 60 + 360);
  199 + } else if (Math.abs(max - green) < Number.EPSILON) {
  200 + hue = (((blue - red) / delta) + 2) * 60;
  201 + } else if (Math.abs(max - blue) < Number.EPSILON) {
  202 + hue = (((red - green) / delta) + 4) * 60;
  203 + }
  204 +
  205 + // 计算saturation值
  206 + saturation = 0.9;
  207 + // 计算value值
  208 + value = 0.3;
  209 +
  210 + return ColorUtils.hsv2rgb({
  211 + hue: hue,
  212 + saturation: saturation,
  213 + value: value,
  214 + alpha: color.alpha
  215 + })
  216 +
  217 + }
  218 +
176 } 219 }
@@ -196,8 +196,8 @@ struct LaunchAdvertisingPage { @@ -196,8 +196,8 @@ struct LaunchAdvertisingPage {
196 contentTrackingDict(){ 196 contentTrackingDict(){
197 this.pageParam = { 197 this.pageParam = {
198 'adType':'0', 198 'adType':'0',
199 - 'adId':this.model.launchAdInfo[0].matInfo.id.toString(),  
200 - 'adName':this.model.launchAdInfo[0].matInfo.advTitle, 199 + 'adId':this.model.launchAdInfo[0]?.matInfo.id.toString(),
  200 + 'adName':this.model.launchAdInfo[0]?.matInfo.advTitle,
201 'regionName':'0' 201 'regionName':'0'
202 } 202 }
203 } 203 }