Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
9 changed files
with
108 additions
and
23 deletions
| @@ -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; |
| @@ -33,8 +33,6 @@ export struct FeedBackActivity { | @@ -33,8 +33,6 @@ export struct FeedBackActivity { | ||
| 33 | //添加图片 | 33 | //添加图片 |
| 34 | addPic: PhotoListBean = {itemType:1} as PhotoListBean | 34 | addPic: PhotoListBean = {itemType:1} as PhotoListBean |
| 35 | @State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[] | 35 | @State pics: PhotoListBean[] = [this.addPic] as PhotoListBean[] |
| 36 | - // 选择媒体文件的最大数目 | ||
| 37 | - selectNum = 3; | ||
| 38 | 36 | ||
| 39 | async aboutToAppear() { | 37 | async aboutToAppear() { |
| 40 | await this.getContentDetailData() | 38 | await this.getContentDetailData() |
| @@ -140,7 +138,6 @@ export struct FeedBackActivity { | @@ -140,7 +138,6 @@ export struct FeedBackActivity { | ||
| 140 | if(await FastClickUtil.isMinDelayTime()){ | 138 | if(await FastClickUtil.isMinDelayTime()){ |
| 141 | return | 139 | return |
| 142 | } | 140 | } |
| 143 | - | ||
| 144 | let temp: PhotoListBean[] = [] as PhotoListBean[] | 141 | let temp: PhotoListBean[] = [] as PhotoListBean[] |
| 145 | temp.length = this.pics.length - 1; | 142 | temp.length = this.pics.length - 1; |
| 146 | let tempIndex = 0; | 143 | let tempIndex = 0; |
| @@ -267,7 +264,8 @@ export struct FeedBackActivity { | @@ -267,7 +264,8 @@ export struct FeedBackActivity { | ||
| 267 | // 设置photoPicker的参数 | 264 | // 设置photoPicker的参数 |
| 268 | let PhotoSelectOptions = new picker.PhotoSelectOptions(); | 265 | let PhotoSelectOptions = new picker.PhotoSelectOptions(); |
| 269 | PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型 | 266 | PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型 |
| 270 | - PhotoSelectOptions.maxSelectNumber = this.selectNum; // 选择媒体文件的最大数目 | 267 | + let max = 3-this.pics.length+1 |
| 268 | + PhotoSelectOptions.maxSelectNumber = max; // 选择媒体文件的最大数目 | ||
| 271 | let mediaFlag = false; | 269 | let mediaFlag = false; |
| 272 | let photoPicker = new picker.PhotoViewPicker(); // 使用图库选择器对象前,需要先创建PhotoViewPicker实例 | 270 | let photoPicker = new picker.PhotoViewPicker(); // 使用图库选择器对象前,需要先创建PhotoViewPicker实例 |
| 273 | photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => { | 271 | photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => { |
| @@ -278,26 +276,35 @@ export struct FeedBackActivity { | @@ -278,26 +276,35 @@ export struct FeedBackActivity { | ||
| 278 | // 其中包含Array<string>类型的photoUris,为返回图库选择后的媒体文件的uri数组;还包含boolean类型的isOriginalPhoto,指示返回图库选择后的媒体文件是否为原图。 | 276 | // 其中包含Array<string>类型的photoUris,为返回图库选择后的媒体文件的uri数组;还包含boolean类型的isOriginalPhoto,指示返回图库选择后的媒体文件是否为原图。 |
| 279 | // 声明变量array,其取值为PhotoSelectResult中的数组。 | 277 | // 声明变量array,其取值为PhotoSelectResult中的数组。 |
| 280 | array = PhotoSelectResult['photoUris']; | 278 | array = PhotoSelectResult['photoUris']; |
| 281 | - let beforeLen = this.pics.length; | ||
| 282 | - let startIndex = this.pics.length-1; | 279 | + let beforeLen = this.pics.length + array.length; |
| 283 | let totalLen = this.pics.length+array.length; | 280 | let totalLen = this.pics.length+array.length; |
| 284 | if(totalLen > 3){ | 281 | if(totalLen > 3){ |
| 285 | totalLen = 3 | 282 | totalLen = 3 |
| 286 | } | 283 | } |
| 287 | - this.pics.length = totalLen; | ||
| 288 | - | 284 | + // this.pics.length = totalLen; |
| 285 | + let tempPics = [] as PhotoListBean[] | ||
| 286 | + tempPics.length = totalLen; | ||
| 287 | + let startIndex = 0; | ||
| 288 | + this.pics.forEach((value) => { | ||
| 289 | + if(value.itemType == 2){ | ||
| 290 | + value.id = startIndex | ||
| 291 | + tempPics[startIndex] = value; | ||
| 292 | + startIndex = startIndex+1; | ||
| 293 | + mediaFlag = true; | ||
| 294 | + } | ||
| 295 | + }) | ||
| 289 | array.forEach((value) => { | 296 | array.forEach((value) => { |
| 290 | let pic: PhotoListBean = {itemType:2,picPath:value} as PhotoListBean | 297 | let pic: PhotoListBean = {itemType:2,picPath:value} as PhotoListBean |
| 291 | pic.id = startIndex | 298 | pic.id = startIndex |
| 292 | - this.pics[startIndex] = pic | 299 | + tempPics[startIndex] = pic; |
| 293 | startIndex = startIndex+1; | 300 | startIndex = startIndex+1; |
| 294 | mediaFlag = true; | 301 | mediaFlag = true; |
| 295 | - Logger.info(TAG, `select image/video uri: ${value}`); | ||
| 296 | }) | 302 | }) |
| 297 | - if(this.pics.length<=3 && beforeLen != 3 && array.length != 3){ | 303 | + if(startIndex<3){ |
| 298 | this.addPic.id = startIndex | 304 | this.addPic.id = startIndex |
| 299 | - this.pics[this.pics.length-1]=this.addPic; | 305 | + tempPics[startIndex]=this.addPic; |
| 300 | } | 306 | } |
| 307 | + this.pics = tempPics; | ||
| 301 | } | 308 | } |
| 302 | if (mediaFlag) { | 309 | if (mediaFlag) { |
| 303 | this.getFilenameByUriForMedia(array); | 310 | this.getFilenameByUriForMedia(array); |
| @@ -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 | + }).width(80) | ||
| 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 } |
| @@ -411,7 +411,9 @@ export struct PaperSingleColumn999CardView { | @@ -411,7 +411,9 @@ export struct PaperSingleColumn999CardView { | ||
| 411 | result = `${minutes}分钟前`; | 411 | result = `${minutes}分钟前`; |
| 412 | } else if (hours < 24) { | 412 | } else if (hours < 24) { |
| 413 | result = `${hours}小时前`; | 413 | result = `${hours}小时前`; |
| 414 | - } else { | 414 | + } else if(hours > 24 && hours <48){ |
| 415 | + result = '1天前'; | ||
| 416 | + }else { | ||
| 415 | result = ''; | 417 | result = ''; |
| 416 | } | 418 | } |
| 417 | 419 | ||
| @@ -483,11 +485,15 @@ export struct PaperSingleColumn999CardView { | @@ -483,11 +485,15 @@ export struct PaperSingleColumn999CardView { | ||
| 483 | .fontSize(12) | 485 | .fontSize(12) |
| 484 | .fontColor('#B0B0B0') | 486 | .fontColor('#B0B0B0') |
| 485 | .margin({ left: 16 }) | 487 | .margin({ left: 16 }) |
| 488 | + | ||
| 489 | + ///不显示时间或者不显示评论 | ||
| 490 | + if (this.getPublishTime().length > 0 || this.item.objectType != '2' && this.interactData && this.interactData.commentNum && Number(this.interactData.collectNum) > 0) { | ||
| 486 | Image($r('app.media.point')) | 491 | Image($r('app.media.point')) |
| 487 | .width(16) | 492 | .width(16) |
| 488 | .height(16) | 493 | .height(16) |
| 489 | .margin({ top: 10, bottom: 10 }) | 494 | .margin({ top: 10, bottom: 10 }) |
| 490 | } | 495 | } |
| 496 | + } | ||
| 491 | 497 | ||
| 492 | Text(this.getPublishTime()) | 498 | Text(this.getPublishTime()) |
| 493 | .fontSize(12) | 499 | .fontSize(12) |
| @@ -497,7 +503,7 @@ export struct PaperSingleColumn999CardView { | @@ -497,7 +503,7 @@ export struct PaperSingleColumn999CardView { | ||
| 497 | Text(this.interactData.commentNum + "评") | 503 | Text(this.interactData.commentNum + "评") |
| 498 | .fontSize(12) | 504 | .fontSize(12) |
| 499 | .fontColor('#B0B0B0') | 505 | .fontColor('#B0B0B0') |
| 500 | - .margin({ left: 6 }) | 506 | + .margin({ left: this.getPublishTime().length >0? 6:0 }) |
| 501 | } | 507 | } |
| 502 | } | 508 | } |
| 503 | .justifyContent(FlexAlign.Start) | 509 | .justifyContent(FlexAlign.Start) |
| @@ -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 | } |
-
Please register or login to post a comment