Merge remote-tracking branch 'origin/main'
# Conflicts: # sight_harmony/features/wdComponent/src/main/ets/components/cardview/MoreComponent.ets
Showing
51 changed files
with
1527 additions
and
268 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) |
| @@ -175,3 +175,6 @@ export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; | @@ -175,3 +175,6 @@ export { ReserveItemBean } from './src/main/ets/bean/live/ReserveItemBean'; | ||
| 175 | 175 | ||
| 176 | 176 | ||
| 177 | export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; | 177 | export { FeedbackTypeBean } from './src/main/ets/bean/detail/FeedbackTypeBean'; |
| 178 | +export { FeedBackParams } from './src/main/ets/bean/content/FeedBackParams'; | ||
| 179 | + | ||
| 180 | + |
| @@ -90,6 +90,8 @@ export class ContentDTO implements BaseDTO { | @@ -90,6 +90,8 @@ export class ContentDTO implements BaseDTO { | ||
| 90 | // 链接类型: 0:无链接;1:内链(文章);2:外链 | 90 | // 链接类型: 0:无链接;1:内链(文章);2:外链 |
| 91 | openType: string = ''; | 91 | openType: string = ''; |
| 92 | extra: string = '' | 92 | extra: string = '' |
| 93 | + sameContentList:ContentDTO[] = [] | ||
| 94 | + sameContentListJson:string = "" | ||
| 93 | /* | 95 | /* |
| 94 | 本地辅助字段 | 96 | 本地辅助字段 |
| 95 | */ | 97 | */ |
| @@ -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; |
| @@ -16,6 +16,8 @@ export { LikeComponent } from "./src/main/ets/components/view/LikeComponent" | @@ -16,6 +16,8 @@ export { LikeComponent } from "./src/main/ets/components/view/LikeComponent" | ||
| 16 | 16 | ||
| 17 | export { TopNavigationComponent } from "./src/main/ets/components/page/TopNavigationComponent" | 17 | export { TopNavigationComponent } from "./src/main/ets/components/page/TopNavigationComponent" |
| 18 | 18 | ||
| 19 | +export { TopNavigationComponentNew } from "./src/main/ets/components/page/TopNavigationComponentNew" | ||
| 20 | + | ||
| 19 | export { LabelComponent } from "./src/main/ets/components/view/LabelComponent" | 21 | export { LabelComponent } from "./src/main/ets/components/view/LabelComponent" |
| 20 | 22 | ||
| 21 | export { BannerComponent } from "./src/main/ets/components/view/BannerComponent" | 23 | export { BannerComponent } from "./src/main/ets/components/view/BannerComponent" |
| 1 | -import { FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; | 1 | +import { FeedBackParams, FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; |
| 2 | import { AppUtils, | 2 | import { AppUtils, |
| 3 | DeviceUtil, | 3 | DeviceUtil, |
| 4 | FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'; | 4 | FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'; |
| @@ -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() |
| @@ -60,9 +58,9 @@ export struct FeedBackActivity { | @@ -60,9 +58,9 @@ export struct FeedBackActivity { | ||
| 60 | GridCol({ | 58 | GridCol({ |
| 61 | }) { | 59 | }) { |
| 62 | Row(){ | 60 | Row(){ |
| 63 | - Toggle({ type: ToggleType.Checkbox, isOn: false }) | 61 | + Toggle({ type: ToggleType.Checkbox, isOn: feedbackTypeBean.isSelect }) |
| 64 | .onChange((select) => { | 62 | .onChange((select) => { |
| 65 | - feedbackTypeBean.isselect = select | 63 | + feedbackTypeBean.isSelect = select |
| 66 | this.canSubmit = this.checkSubmit() | 64 | this.canSubmit = this.checkSubmit() |
| 67 | }) | 65 | }) |
| 68 | Text(feedbackTypeBean.classifyName) | 66 | Text(feedbackTypeBean.classifyName) |
| @@ -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); |
| @@ -325,8 +332,8 @@ export struct FeedBackActivity { | @@ -325,8 +332,8 @@ export struct FeedBackActivity { | ||
| 325 | //问题类型必选 | 332 | //问题类型必选 |
| 326 | let selectType = "" | 333 | let selectType = "" |
| 327 | this.feedbackTypeBeans.forEach((value) => { | 334 | this.feedbackTypeBeans.forEach((value) => { |
| 328 | - if(value.isselect){ | ||
| 329 | - selectType = selectType+"," | 335 | + if(value.isSelect){ |
| 336 | + selectType = selectType+value.id+"," | ||
| 330 | } | 337 | } |
| 331 | }) | 338 | }) |
| 332 | if(!StringUtils.isEmpty(selectType)){ | 339 | if(!StringUtils.isEmpty(selectType)){ |
| @@ -343,29 +350,31 @@ export struct FeedBackActivity { | @@ -343,29 +350,31 @@ export struct FeedBackActivity { | ||
| 343 | } | 350 | } |
| 344 | 351 | ||
| 345 | try { | 352 | try { |
| 346 | - let map: HashMap<String,String> = {} as HashMap<String,String> | ||
| 347 | - //反馈内容 | ||
| 348 | - map.set("content", this.contact); | ||
| 349 | - //投诉类型 id | ||
| 350 | - map.set("classifyFlagIds", selectType); | ||
| 351 | - if(!StringUtils.isEmpty(this.email)){ | 353 | + let feedBackParams: FeedBackParams = { |
| 354 | + //反馈内容 | ||
| 355 | + "content": this.contact, | ||
| 356 | + //投诉类型 id | ||
| 357 | + "classifyFlagIds": selectType, | ||
| 358 | + //设备 | ||
| 359 | + "appVersion": "V" + AppUtils.getAppVersionName(), | ||
| 360 | + "appDevice": "harmony" + DeviceUtil.getDisplayVersion() + " " + DeviceUtil.getProductModel() | ||
| 361 | + } as FeedBackParams | ||
| 352 | //邮箱 | 362 | //邮箱 |
| 353 | - map.set("userContact", this.email); | 363 | + if(!StringUtils.isEmpty(this.email)){ |
| 364 | + feedBackParams.userContact = this.email | ||
| 354 | } | 365 | } |
| 355 | //用户名称 | 366 | //用户名称 |
| 356 | - if (!StringUtils.isEmpty(UserDataLocal.getUserName())) { | ||
| 357 | - map.set("userName", UserDataLocal.getUserName()); | 367 | + if(!StringUtils.isEmpty(UserDataLocal.getUserName())){ |
| 368 | + feedBackParams.userName = UserDataLocal.getUserName() | ||
| 358 | } | 369 | } |
| 359 | - //设备 | ||
| 360 | - map.set("appVersion", "V" + AppUtils.getAppVersionName()); | ||
| 361 | - map.set("appDevice", "harmony" + DeviceUtil.getDisplayVersion() + " " + DeviceUtil.getProductModel()); | 370 | + |
| 362 | // //投诉图片 | 371 | // //投诉图片 |
| 363 | // if (imageUrl.size() > 0) { | 372 | // if (imageUrl.size() > 0) { |
| 364 | // String[] str = imageUrl.toArray(new String[imageUrl.size()]); | 373 | // String[] str = imageUrl.toArray(new String[imageUrl.size()]); |
| 365 | // map.set("imageUrls", str); | 374 | // map.set("imageUrls", str); |
| 366 | // } | 375 | // } |
| 367 | - await MultiPictureDetailViewModel.feedBackCommit(map) | ||
| 368 | - | 376 | + await MultiPictureDetailViewModel.feedBackCommit(feedBackParams) |
| 377 | + router.back(); | ||
| 369 | } catch (exception) { | 378 | } catch (exception) { |
| 370 | console.log('请求失败',JSON.stringify(exception)) | 379 | console.log('请求失败',JSON.stringify(exception)) |
| 371 | } | 380 | } |
| @@ -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 } |
| @@ -138,6 +138,7 @@ export struct SpacialTopicPageComponent { | @@ -138,6 +138,7 @@ export struct SpacialTopicPageComponent { | ||
| 138 | contentDetailData: this.contentDetailData, | 138 | contentDetailData: this.contentDetailData, |
| 139 | publishCommentModel: this.publishCommentModel, | 139 | publishCommentModel: this.publishCommentModel, |
| 140 | operationButtonList: this.operationButtonList, | 140 | operationButtonList: this.operationButtonList, |
| 141 | + styleType: 1, | ||
| 141 | }) | 142 | }) |
| 142 | } | 143 | } |
| 143 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 144 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| @@ -43,9 +43,9 @@ export struct Card11Component { | @@ -43,9 +43,9 @@ export struct Card11Component { | ||
| 43 | Column() { | 43 | Column() { |
| 44 | Stack() { | 44 | Stack() { |
| 45 | if (this.contentDTO.newTags) { | 45 | if (this.contentDTO.newTags) { |
| 46 | - Notes({ newTags: this.contentDTO.newTags }).height(27).align(Alignment.Center) | 46 | + Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center) |
| 47 | } else if (this.contentDTO.objectType == '5') { | 47 | } else if (this.contentDTO.objectType == '5') { |
| 48 | - Notes({ objectType: this.contentDTO.objectType }).height(27).align(Alignment.Center) | 48 | + Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center) |
| 49 | } | 49 | } |
| 50 | Text() { | 50 | Text() { |
| 51 | if (this.titleMarked) { | 51 | if (this.titleMarked) { |
| @@ -52,9 +52,11 @@ export struct Card2Component { | @@ -52,9 +52,11 @@ export struct Card2Component { | ||
| 52 | Stack() { | 52 | Stack() { |
| 53 | //新闻标题 | 53 | //新闻标题 |
| 54 | if (this.contentDTO.newTags) { | 54 | if (this.contentDTO.newTags) { |
| 55 | - Notes({ newTags: this.contentDTO.newTags }) | 55 | + Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center) |
| 56 | + //Notes({ newTags: this.contentDTO.newTags }) | ||
| 56 | } else if (this.contentDTO.objectType == '5') { | 57 | } else if (this.contentDTO.objectType == '5') { |
| 57 | - Notes({ objectType: this.contentDTO.objectType }) | 58 | + Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center) |
| 59 | + //Notes({ objectType: this.contentDTO.objectType }) | ||
| 58 | } | 60 | } |
| 59 | 61 | ||
| 60 | Text() { | 62 | Text() { |
| @@ -49,29 +49,32 @@ export struct Card4Component { | @@ -49,29 +49,32 @@ export struct Card4Component { | ||
| 49 | Column() { | 49 | Column() { |
| 50 | //body | 50 | //body |
| 51 | Column() { | 51 | Column() { |
| 52 | - //新闻标题 | ||
| 53 | - if (this.contentDTO.newTags) { | ||
| 54 | - Notes({ newTags: this.contentDTO.newTags }) | ||
| 55 | - } else if (this.contentDTO.objectType == '5') { | ||
| 56 | - Notes({ objectType: this.contentDTO.objectType }) | ||
| 57 | - } | ||
| 58 | - Text() { | ||
| 59 | - if (this.titleMarked) { | ||
| 60 | - Span(this.str01) | ||
| 61 | - Span(this.str02) | ||
| 62 | - .fontColor(0xED2800) | ||
| 63 | - Span(this.str03) | ||
| 64 | - } else { | ||
| 65 | - Span(this.contentDTO.newsTitle) | 52 | + Stack() { |
| 53 | + if (this.contentDTO.newTags) { | ||
| 54 | + Notes({ newTags: this.contentDTO.newTags }).height(19).align(Alignment.Center) | ||
| 55 | + } else if (this.contentDTO.objectType == '5') { | ||
| 56 | + Notes({ objectType: this.contentDTO.objectType }).height(19).align(Alignment.Center) | ||
| 57 | + } | ||
| 58 | + Text() { | ||
| 59 | + if (this.titleMarked) { | ||
| 60 | + Span(this.str01) | ||
| 61 | + Span(this.str02) | ||
| 62 | + .fontColor(0xED2800) | ||
| 63 | + Span(this.str03) | ||
| 64 | + } else { | ||
| 65 | + Span(this.contentDTO.newsTitle) | ||
| 66 | + } | ||
| 66 | } | 67 | } |
| 67 | - } | ||
| 68 | .fontSize($r('app.float.font_size_18')) | 68 | .fontSize($r('app.float.font_size_18')) |
| 69 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 69 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 70 | .maxLines(3) | 70 | .maxLines(3) |
| 71 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 71 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 72 | - .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 73 | - (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 74 | - this.contentDTO.objectType == '5' ? 30 : 0) | 72 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| 73 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 74 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 75 | + }.alignContent(Alignment.TopStart) | ||
| 76 | + //新闻标题 | ||
| 77 | + | ||
| 75 | //三图 | 78 | //三图 |
| 76 | Stack(){ | 79 | Stack(){ |
| 77 | Row() { | 80 | Row() { |
| @@ -6,6 +6,7 @@ const TAG: string = 'More_Comp'; | @@ -6,6 +6,7 @@ const TAG: string = 'More_Comp'; | ||
| 6 | @Entry | 6 | @Entry |
| 7 | @Component | 7 | @Component |
| 8 | export struct MoreComponent { | 8 | export struct MoreComponent { |
| 9 | + @State contentDTO: ContentDTO = new ContentDTO(); | ||
| 9 | 10 | ||
| 10 | build() { | 11 | build() { |
| 11 | Row() { | 12 | Row() { |
| @@ -206,7 +206,7 @@ struct CarouselLayout01CardView { | @@ -206,7 +206,7 @@ struct CarouselLayout01CardView { | ||
| 206 | Blank() | 206 | Blank() |
| 207 | // 文本信息 | 207 | // 文本信息 |
| 208 | Stack() { | 208 | Stack() { |
| 209 | - if (this.item.objectType == '5') { | 209 | + if (this.item.objectType == '5' || this.item.objectType == '6') { |
| 210 | Notes({ objectType: this.item.objectType }) | 210 | Notes({ objectType: this.item.objectType }) |
| 211 | } | 211 | } |
| 212 | Text(`${this.item.corner}${this.item.newsTitle}`) | 212 | Text(`${this.item.corner}${this.item.newsTitle}`) |
| @@ -38,25 +38,32 @@ export struct AppointmentListChildComponent { | @@ -38,25 +38,32 @@ export struct AppointmentListChildComponent { | ||
| 38 | .interpolation(ImageInterpolation.High) | 38 | .interpolation(ImageInterpolation.High) |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | - if (this.item.relType === 1) { | 41 | + if (this.item.status == "wait") { |
| 42 | Row() { | 42 | Row() { |
| 43 | Row() { | 43 | Row() { |
| 44 | Image($r('app.media.reserve_icon')) | 44 | Image($r('app.media.reserve_icon')) |
| 45 | - .width('42lpx') | ||
| 46 | - .height('35lpx') | 45 | + .width('27lpx') |
| 46 | + .height('27lpx') | ||
| 47 | .objectFit(ImageFit.Auto) | 47 | .objectFit(ImageFit.Auto) |
| 48 | .interpolation(ImageInterpolation.High) | 48 | .interpolation(ImageInterpolation.High) |
| 49 | + .margin({right:"6lpx"}) | ||
| 49 | 50 | ||
| 50 | Text("预约") | 51 | Text("预约") |
| 51 | .fontWeight(400) | 52 | .fontWeight(400) |
| 52 | - .fontSize('21lpx') | ||
| 53 | - .backgroundColor($r('app.color.color_4D000000')) | 53 | + .fontSize('23lpx') |
| 54 | + .textShadow({ | ||
| 55 | + radius: 2, | ||
| 56 | + color: `rgba(0,0,0,0.3)`, | ||
| 57 | + offsetY:2, | ||
| 58 | + offsetX:0 | ||
| 59 | + }) | ||
| 54 | .fontColor($r('app.color.white')) | 60 | .fontColor($r('app.color.white')) |
| 55 | .lineHeight('31lpx') | 61 | .lineHeight('31lpx') |
| 56 | .layoutWeight(1) | 62 | .layoutWeight(1) |
| 57 | - .textAlign(TextAlign.Center) | 63 | + .textAlign(TextAlign.Start) |
| 58 | }.width('94lpx') | 64 | }.width('94lpx') |
| 59 | .margin({ bottom: '15lpx', right: '15lpx' }) | 65 | .margin({ bottom: '15lpx', right: '15lpx' }) |
| 66 | + .alignItems(VerticalAlign.Center) | ||
| 60 | }.width('100%') | 67 | }.width('100%') |
| 61 | .height('100%') | 68 | .height('100%') |
| 62 | .alignItems(VerticalAlign.Bottom) | 69 | .alignItems(VerticalAlign.Bottom) |
| @@ -78,7 +85,7 @@ export struct AppointmentListChildComponent { | @@ -78,7 +85,7 @@ export struct AppointmentListChildComponent { | ||
| 78 | .width('100%') | 85 | .width('100%') |
| 79 | Row() { | 86 | Row() { |
| 80 | Row() { | 87 | Row() { |
| 81 | - if (this.item.relType === 2) { | 88 | + if (this.item.status == "end") { |
| 82 | Image($r('app.media.play_status_history_icon')) | 89 | Image($r('app.media.play_status_history_icon')) |
| 83 | .objectFit(ImageFit.Auto) | 90 | .objectFit(ImageFit.Auto) |
| 84 | .interpolation(ImageInterpolation.High) | 91 | .interpolation(ImageInterpolation.High) |
| @@ -88,6 +95,16 @@ export struct AppointmentListChildComponent { | @@ -88,6 +95,16 @@ export struct AppointmentListChildComponent { | ||
| 88 | Text('已结束').fontColor($r('app.color.color_999999')) | 95 | Text('已结束').fontColor($r('app.color.color_999999')) |
| 89 | .fontWeight('500lpx') | 96 | .fontWeight('500lpx') |
| 90 | .fontSize('23lpx') | 97 | .fontSize('23lpx') |
| 98 | + }else if(this.item.status == "running"){ | ||
| 99 | + Image($r('app.media.play_status_icon')) | ||
| 100 | + .objectFit(ImageFit.Auto) | ||
| 101 | + .interpolation(ImageInterpolation.High) | ||
| 102 | + .width('38lpx') | ||
| 103 | + .height('38lpx') | ||
| 104 | + .margin({ right: '12lpx' }) | ||
| 105 | + Text('已开始').fontColor($r('app.color.color_999999')) | ||
| 106 | + .fontWeight('500lpx') | ||
| 107 | + .fontSize('23lpx') | ||
| 91 | } else { | 108 | } else { |
| 92 | Image($r('app.media.play_status_icon')) | 109 | Image($r('app.media.play_status_icon')) |
| 93 | .objectFit(ImageFit.Auto) | 110 | .objectFit(ImageFit.Auto) |
| @@ -118,7 +135,7 @@ export struct AppointmentListChildComponent { | @@ -118,7 +135,7 @@ export struct AppointmentListChildComponent { | ||
| 118 | 135 | ||
| 119 | Blank() | 136 | Blank() |
| 120 | .layoutWeight(1) | 137 | .layoutWeight(1) |
| 121 | - if (this.item.relType === 1) { | 138 | + if (this.item.status === "wait") { |
| 122 | Text(this.item.isAppointment ? "已预约" : "预约") | 139 | Text(this.item.isAppointment ? "已预约" : "预约") |
| 123 | .fontWeight(400) | 140 | .fontWeight(400) |
| 124 | .fontSize('23lpx') | 141 | .fontSize('23lpx') |
| @@ -132,8 +149,19 @@ export struct AppointmentListChildComponent { | @@ -132,8 +149,19 @@ export struct AppointmentListChildComponent { | ||
| 132 | .onClick(() => { | 149 | .onClick(() => { |
| 133 | this.dialogController.open() | 150 | this.dialogController.open() |
| 134 | }) | 151 | }) |
| 152 | + }else if(this.item.status == "running"){ | ||
| 153 | + Text("去观看" ) | ||
| 154 | + .fontWeight(400) | ||
| 155 | + .fontSize('23lpx') | ||
| 156 | + .backgroundColor($r('app.color.color_ED2800')) | ||
| 157 | + .fontColor($r('app.color.white')) | ||
| 158 | + .lineHeight('31lpx') | ||
| 159 | + .textAlign(TextAlign.Center) | ||
| 160 | + .width('100lpx') | ||
| 161 | + .height('46lpx') | ||
| 162 | + .borderRadius('6lpx') | ||
| 135 | } else { | 163 | } else { |
| 136 | - Text(this.item.relType === 2 ? "去观看" : "看回放") | 164 | + Text("看回放") |
| 137 | .fontWeight(400) | 165 | .fontWeight(400) |
| 138 | .fontSize('23lpx') | 166 | .fontSize('23lpx') |
| 139 | .backgroundColor($r('app.color.color_ED2800')) | 167 | .backgroundColor($r('app.color.color_ED2800')) |
| @@ -7,17 +7,20 @@ import MinePageDatasModel from '../../../model/MinePageDatasModel'; | @@ -7,17 +7,20 @@ import MinePageDatasModel from '../../../model/MinePageDatasModel'; | ||
| 7 | import { EmptyComponent } from '../../view/EmptyComponent'; | 7 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 8 | import { Action } from 'wdBean/Index'; | 8 | import { Action } from 'wdBean/Index'; |
| 9 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 9 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 10 | +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | ||
| 10 | 11 | ||
| 11 | const TAG = "AppointmentListUI" | 12 | const TAG = "AppointmentListUI" |
| 12 | 13 | ||
| 13 | @Component | 14 | @Component |
| 14 | export struct AppointmentListUI { | 15 | export struct AppointmentListUI { |
| 15 | @State data: LazyDataSource<MineAppointmentItem> = new LazyDataSource(); | 16 | @State data: LazyDataSource<MineAppointmentItem> = new LazyDataSource(); |
| 17 | + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 16 | @State count: number = 0; | 18 | @State count: number = 0; |
| 17 | @State isLoading: boolean = false | 19 | @State isLoading: boolean = false |
| 18 | @State hasMore: boolean = true | 20 | @State hasMore: boolean = true |
| 19 | curPageNum: number = 1; | 21 | curPageNum: number = 1; |
| 20 | @State isGetRequest: boolean = false | 22 | @State isGetRequest: boolean = false |
| 23 | + private scroller: Scroller = new Scroller(); | ||
| 21 | 24 | ||
| 22 | aboutToAppear() { | 25 | aboutToAppear() { |
| 23 | this.getNewPageData() | 26 | this.getNewPageData() |
| @@ -26,7 +29,7 @@ export struct AppointmentListUI { | @@ -26,7 +29,7 @@ export struct AppointmentListUI { | ||
| 26 | build() { | 29 | build() { |
| 27 | Column() { | 30 | Column() { |
| 28 | //标题栏目 | 31 | //标题栏目 |
| 29 | - CustomTitleUI({ titleName: "预约列表" }) | 32 | + CustomTitleUI({ titleName: "我的预约" }) |
| 30 | if (this.count == 0) { | 33 | if (this.count == 0) { |
| 31 | if (this.isGetRequest == true) { | 34 | if (this.isGetRequest == true) { |
| 32 | EmptyComponent({ emptyType: 10 }) | 35 | EmptyComponent({ emptyType: 10 }) |
| @@ -35,45 +38,29 @@ export struct AppointmentListUI { | @@ -35,45 +38,29 @@ export struct AppointmentListUI { | ||
| 35 | } | 38 | } |
| 36 | 39 | ||
| 37 | } else { | 40 | } else { |
| 38 | - //刷新控件 TODO | ||
| 39 | - //List | ||
| 40 | - List({ space: '6lpx' }) { | ||
| 41 | - LazyForEach(this.data, (item: MineAppointmentItem, index: number) => { | ||
| 42 | - ListItem() { | ||
| 43 | - AppointmentListChildComponent({ item: item }) | ||
| 44 | - } | ||
| 45 | - .onClick(() => { | ||
| 46 | - //TODO 跳转 | ||
| 47 | - let action = { | ||
| 48 | - type:"2", | ||
| 49 | - params:{ | ||
| 50 | - extra:{ | ||
| 51 | - relId:item.relId, | ||
| 52 | - relType:item.relType.toString() | ||
| 53 | - }, | ||
| 54 | - contentID:item.liveId.toString() | ||
| 55 | - } | ||
| 56 | - } as Action | ||
| 57 | - WDRouterRule.jumpWithPage(WDRouterPage.detailPlayLiveCommon, action) | ||
| 58 | - }) | ||
| 59 | - }, (item: MineAppointmentItem, index: number) => index.toString()) | ||
| 60 | 41 | ||
| 61 | - //没有更多数据 显示提示 | ||
| 62 | - if (!this.hasMore) { | ||
| 63 | - ListItem() { | ||
| 64 | - ListHasNoMoreDataUI() | 42 | + CustomPullToRefresh({ |
| 43 | + alldata:this.data, | ||
| 44 | + scroller:this.scroller, | ||
| 45 | + customList:()=>{ | ||
| 46 | + this.ListLayout() | ||
| 47 | + }, | ||
| 48 | + onRefresh:(resolve)=>{ | ||
| 49 | + this.curPageNum = 1; | ||
| 50 | + this.hasMore = true | ||
| 51 | + this.isGetRequest = false | ||
| 52 | + this.data.clear() | ||
| 53 | + | ||
| 54 | + if (!this.isLoading){ | ||
| 55 | + this.getNewPageData() | ||
| 56 | + if(resolve) resolve('刷新成功') | ||
| 57 | + } | ||
| 58 | + }, | ||
| 59 | + onLoadMore:(resolve)=> { | ||
| 60 | + if (!this.isLoading) { | ||
| 61 | + this.isLoading = true | ||
| 62 | + this.getNewPageData() | ||
| 65 | } | 63 | } |
| 66 | - } | ||
| 67 | - } | ||
| 68 | - .cachedCount(4) | ||
| 69 | - .scrollBar(BarState.Off) | ||
| 70 | - .margin({ top: '23lpx', left: '23lpx', right: '23lpx' }) | ||
| 71 | - .layoutWeight(1) | ||
| 72 | - .onReachEnd(() => { | ||
| 73 | - console.log(TAG, "触底了"); | ||
| 74 | - if (!this.isLoading) { | ||
| 75 | - //加载分页数据 | ||
| 76 | - this.getNewPageData() | ||
| 77 | } | 64 | } |
| 78 | }) | 65 | }) |
| 79 | } | 66 | } |
| @@ -83,6 +70,42 @@ export struct AppointmentListUI { | @@ -83,6 +70,42 @@ export struct AppointmentListUI { | ||
| 83 | .width('100%') | 70 | .width('100%') |
| 84 | } | 71 | } |
| 85 | 72 | ||
| 73 | + @Builder ListLayout(){ | ||
| 74 | + List({ space:6,scroller: this.scroller }) { | ||
| 75 | + LazyForEach(this.data, (item: MineAppointmentItem, index: number) => { | ||
| 76 | + ListItem() { | ||
| 77 | + AppointmentListChildComponent({ item: item }) | ||
| 78 | + } | ||
| 79 | + .onClick(() => { | ||
| 80 | + //TODO 跳转 | ||
| 81 | + let action = { | ||
| 82 | + type:"2", | ||
| 83 | + params:{ | ||
| 84 | + extra:{ | ||
| 85 | + relId:item.relId, | ||
| 86 | + relType:item.relType.toString() | ||
| 87 | + }, | ||
| 88 | + contentID:item.liveId.toString() | ||
| 89 | + } | ||
| 90 | + } as Action | ||
| 91 | + WDRouterRule.jumpWithPage(WDRouterPage.detailPlayLiveCommon, action) | ||
| 92 | + }) | ||
| 93 | + }, (item: MineAppointmentItem, index: number) => index.toString()) | ||
| 94 | + | ||
| 95 | + //没有更多数据 显示提示 | ||
| 96 | + if (!this.hasMore) { | ||
| 97 | + ListItem() { | ||
| 98 | + ListHasNoMoreDataUI() | ||
| 99 | + }.padding({bottom:px2vp(this.bottomSafeHeight) + 20}) | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + .cachedCount(4) | ||
| 103 | + .scrollBar(BarState.Off) | ||
| 104 | + .edgeEffect(EdgeEffect.None) | ||
| 105 | + .margin({ top: '23lpx', left: '23lpx', right: '23lpx'}) | ||
| 106 | + .layoutWeight(1) | ||
| 107 | + } | ||
| 108 | + | ||
| 86 | getNewPageData() { | 109 | getNewPageData() { |
| 87 | this.isLoading = true | 110 | this.isLoading = true |
| 88 | if (this.hasMore) { | 111 | if (this.hasMore) { |
| @@ -6,6 +6,8 @@ import { MessageItem } from '../../../viewmodel/MessageItem' | @@ -6,6 +6,8 @@ import { MessageItem } from '../../../viewmodel/MessageItem' | ||
| 6 | import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh' | 6 | import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh' |
| 7 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' | 7 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' |
| 8 | import { MessageListItemUI } from './MessageListItemUI' | 8 | import { MessageListItemUI } from './MessageListItemUI' |
| 9 | +import {TrackingButton,TrackConstants}from 'wdTracking/Index' | ||
| 10 | +import TrackingPageBrowseUtils from '../../../utils/TrackingPageBrowseUtils' | ||
| 9 | 11 | ||
| 10 | const TAG = "MessageListUI" | 12 | const TAG = "MessageListUI" |
| 11 | 13 | ||
| @@ -185,6 +187,7 @@ export struct MessageListUI { | @@ -185,6 +187,7 @@ export struct MessageListUI { | ||
| 185 | } | 187 | } |
| 186 | .padding({ left: "31lpx", right: "31lpx" }) | 188 | .padding({ left: "31lpx", right: "31lpx" }) |
| 187 | .onClick(() => { | 189 | .onClick(() => { |
| 190 | + this.messageCenterCommonButtonTracking(index) | ||
| 188 | switch (index) { | 191 | switch (index) { |
| 189 | case 0: //互动消息 | 192 | case 0: //互动消息 |
| 190 | if(item.unReadCount > 0){ | 193 | if(item.unReadCount > 0){ |
| @@ -210,6 +213,25 @@ export struct MessageListUI { | @@ -210,6 +213,25 @@ export struct MessageListUI { | ||
| 210 | } | 213 | } |
| 211 | } | 214 | } |
| 212 | 215 | ||
| 216 | + messageCenterCommonButtonTracking(index:number){ | ||
| 217 | + let buttonName:string = '' | ||
| 218 | + switch (index) { | ||
| 219 | + case 0: //互动消息 | ||
| 220 | + buttonName = 'myNotificationPageInteractiveMessage' | ||
| 221 | + break; | ||
| 222 | + case 1: //预约消息 | ||
| 223 | + buttonName = 'myNotificationPageAppointmentMessage' | ||
| 224 | + break; | ||
| 225 | + case 2: //历史推送 | ||
| 226 | + buttonName = 'myNotificationPageHistoricalPush' | ||
| 227 | + break; | ||
| 228 | + case 3: //系统消息 | ||
| 229 | + buttonName = 'myNotificationPageSystemMessage' | ||
| 230 | + break; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + TrackingButton.click(buttonName,TrackConstants.PageName.My_Notification,TrackConstants.PageName.My_Notification) | ||
| 234 | + } | ||
| 213 | 235 | ||
| 214 | sendEnterEvent(type:number){ | 236 | sendEnterEvent(type:number){ |
| 215 | MinePageDatasModel.sendEnterMessageData(type).then((value) => { | 237 | MinePageDatasModel.sendEnterMessageData(type).then((value) => { |
| @@ -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,10 +485,14 @@ export struct PaperSingleColumn999CardView { | @@ -483,10 +485,14 @@ export struct PaperSingleColumn999CardView { | ||
| 483 | .fontSize(12) | 485 | .fontSize(12) |
| 484 | .fontColor('#B0B0B0') | 486 | .fontColor('#B0B0B0') |
| 485 | .margin({ left: 16 }) | 487 | .margin({ left: 16 }) |
| 486 | - Image($r('app.media.point')) | ||
| 487 | - .width(16) | ||
| 488 | - .height(16) | ||
| 489 | - .margin({ top: 10, bottom: 10 }) | 488 | + |
| 489 | + ///不显示时间或者不显示评论 | ||
| 490 | + if (this.getPublishTime().length > 0 || this.item.objectType != '2' && this.interactData && this.interactData.commentNum && Number(this.interactData.collectNum) > 0) { | ||
| 491 | + Image($r('app.media.point')) | ||
| 492 | + .width(16) | ||
| 493 | + .height(16) | ||
| 494 | + .margin({ top: 10, bottom: 10 }) | ||
| 495 | + } | ||
| 490 | } | 496 | } |
| 491 | 497 | ||
| 492 | Text(this.getPublishTime()) | 498 | Text(this.getPublishTime()) |
| @@ -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) |
| @@ -6,6 +6,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter'; | @@ -6,6 +6,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 6 | import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog' | 6 | import {AreaPickerDialog} from '../view/areaPickerDialog/AreaPickerDialog' |
| 7 | import { AreaListModel } from '../../model/AreaListModel'; | 7 | import { AreaListModel } from '../../model/AreaListModel'; |
| 8 | import router from '@ohos.router'; | 8 | import router from '@ohos.router'; |
| 9 | +import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils' | ||
| 10 | +import { TrackConstants } from 'wdTracking/Index'; | ||
| 9 | 11 | ||
| 10 | @Entry | 12 | @Entry |
| 11 | @Component | 13 | @Component |
| @@ -37,6 +39,11 @@ struct EditUserInfoPage { | @@ -37,6 +39,11 @@ struct EditUserInfoPage { | ||
| 37 | 39 | ||
| 38 | onPageShow(){ | 40 | onPageShow(){ |
| 39 | this.updateUserNameAndIntroduction() | 41 | this.updateUserNameAndIntroduction() |
| 42 | + TrackingPageBrowseUtils.TrackingPageBrowseExposureStart() | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + onPageHide(): void { | ||
| 46 | + TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd(TrackConstants.PageName.Edit_Information,TrackConstants.PageName.Edit_Information) | ||
| 40 | } | 47 | } |
| 41 | 48 | ||
| 42 | build() { | 49 | build() { |
| @@ -13,6 +13,8 @@ import { contentListItemParams } from '../../model/MyCollectionModel'; | @@ -13,6 +13,8 @@ import { contentListItemParams } from '../../model/MyCollectionModel'; | ||
| 13 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | 13 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; |
| 14 | import { MyCustomDialog } from '../reusable/MyCustomDialog' | 14 | import { MyCustomDialog } from '../reusable/MyCustomDialog' |
| 15 | import { NetworkUtil } from 'wdKit/Index'; | 15 | import { NetworkUtil } from 'wdKit/Index'; |
| 16 | +import TrackingPageBrowseUtils from '../../utils/TrackingPageBrowseUtils' | ||
| 17 | +import { TrackConstants } from 'wdTracking/Index'; | ||
| 16 | 18 | ||
| 17 | @Entry | 19 | @Entry |
| 18 | @Component | 20 | @Component |
| @@ -45,6 +47,15 @@ struct MyCollectionListPage { | @@ -45,6 +47,15 @@ struct MyCollectionListPage { | ||
| 45 | 47 | ||
| 46 | aboutToAppear(){ | 48 | aboutToAppear(){ |
| 47 | this.getData() | 49 | this.getData() |
| 50 | + | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + onPageShow(){ | ||
| 54 | + TrackingPageBrowseUtils.TrackingPageBrowseExposureStart() | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + onPageHide(): void { | ||
| 58 | + TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd(TrackConstants.PageName.My_Collect,TrackConstants.PageName.My_Collect) | ||
| 48 | } | 59 | } |
| 49 | 60 | ||
| 50 | build() { | 61 | build() { |
| @@ -2,7 +2,7 @@ import { CommonConstants, ViewType } from 'wdConstant'; | @@ -2,7 +2,7 @@ import { CommonConstants, ViewType } from 'wdConstant'; | ||
| 2 | import { Logger } from 'wdKit'; | 2 | import { Logger } from 'wdKit'; |
| 3 | import { EmptyComponent } from '../view/EmptyComponent'; | 3 | import { EmptyComponent } from '../view/EmptyComponent'; |
| 4 | import PageModel from '../../viewmodel/PageModel'; | 4 | import PageModel from '../../viewmodel/PageModel'; |
| 5 | -import { autoRefresh, listTouchEvent } from '../../utils/PullDownRefresh'; | 5 | +import { autoRefresh, onActionEnd, onActionStart, onActionUpdate } from '../../utils/PullDownRefresh'; |
| 6 | import LoadMoreLayout from './LoadMoreLayout'; | 6 | import LoadMoreLayout from './LoadMoreLayout'; |
| 7 | import { CompParser } from '../CompParser'; | 7 | import { CompParser } from '../CompParser'; |
| 8 | import { CompDTO } from 'wdBean'; | 8 | import { CompDTO } from 'wdBean'; |
| @@ -14,9 +14,6 @@ import PageNoMoreLayout from './PageNoMoreLayout'; | @@ -14,9 +14,6 @@ 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'; | ||
| 18 | -import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare' | ||
| 19 | -import { common } from '@kit.AbilityKit'; | ||
| 20 | const TAG = 'PageComponent'; | 17 | const TAG = 'PageComponent'; |
| 21 | 18 | ||
| 22 | @Component | 19 | @Component |
| @@ -31,6 +28,7 @@ export struct PageComponent { | @@ -31,6 +28,7 @@ export struct PageComponent { | ||
| 31 | // 自动刷新通知 | 28 | // 自动刷新通知 |
| 32 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | 29 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 |
| 33 | private listScroller: Scroller = new Scroller(); | 30 | private listScroller: Scroller = new Scroller(); |
| 31 | + private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down }) | ||
| 34 | needload: boolean = true; | 32 | needload: boolean = true; |
| 35 | build() { | 33 | build() { |
| 36 | Column() { | 34 | Column() { |
| @@ -51,13 +49,26 @@ export struct PageComponent { | @@ -51,13 +49,26 @@ export struct PageComponent { | ||
| 51 | } | 49 | } |
| 52 | .width(CommonConstants.FULL_PARENT) | 50 | .width(CommonConstants.FULL_PARENT) |
| 53 | .height(CommonConstants.FULL_PARENT) | 51 | .height(CommonConstants.FULL_PARENT) |
| 54 | - .onTouch((event: TouchEvent | undefined) => { | ||
| 55 | - if (event) { | ||
| 56 | - if (this.pageModel.viewType === ViewType.LOADED) { | ||
| 57 | - listTouchEvent(this.pageModel, this.pageAdvModel, event); | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | - }) | 52 | + // .onTouch((event: TouchEvent | undefined) => { |
| 53 | + // if (event) { | ||
| 54 | + // if (this.pageModel.viewType === ViewType.LOADED) { | ||
| 55 | + // listTouchEvent(this.pageModel, this.pageAdvModel, event); | ||
| 56 | + // } | ||
| 57 | + // } | ||
| 58 | + // }) | ||
| 59 | + // 对接新的下拉刷新手势,替换touch事件 | ||
| 60 | + .parallelGesture( | ||
| 61 | + PanGesture(this.panOption) | ||
| 62 | + .onActionStart((event?: GestureEvent) => { | ||
| 63 | + onActionStart(this.pageModel, this.pageAdvModel, event) | ||
| 64 | + }) | ||
| 65 | + .onActionUpdate((event?: GestureEvent) => { | ||
| 66 | + onActionUpdate(this.pageModel, this.pageAdvModel, event) | ||
| 67 | + }) | ||
| 68 | + .onActionEnd(() => { | ||
| 69 | + onActionEnd(this.pageModel, this.pageAdvModel) | ||
| 70 | + }) | ||
| 71 | + ) | ||
| 61 | 72 | ||
| 62 | } | 73 | } |
| 63 | 74 |
| @@ -460,9 +460,19 @@ export struct TopNavigationComponent { | @@ -460,9 +460,19 @@ export struct TopNavigationComponent { | ||
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | /** | 462 | /** |
| 463 | + * 判断是否当前页面处理逻辑,如消息通知,只需要切换到当前底导的处理,过滤掉非当前。 | ||
| 464 | + */ | ||
| 465 | + private isCurrentPage(): boolean { | ||
| 466 | + return this._currentNavIndex === this.navIndex | ||
| 467 | + } | ||
| 468 | + | ||
| 469 | + /** | ||
| 463 | * 频道id变化,即指定频道跳转场景 | 470 | * 频道id变化,即指定频道跳转场景 |
| 464 | */ | 471 | */ |
| 465 | onAssignChannelChange() { | 472 | onAssignChannelChange() { |
| 473 | + if (!this.isCurrentPage()) { | ||
| 474 | + return | ||
| 475 | + } | ||
| 466 | let channelId = this.assignChannel.channelId | 476 | let channelId = this.assignChannel.channelId |
| 467 | let index = -1 | 477 | let index = -1 |
| 468 | if (this._currentNavIndex === 0) { | 478 | if (this._currentNavIndex === 0) { |
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponentNew.ets
0 → 100644
| 1 | +import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean'; | ||
| 2 | +import { SpConstants } from 'wdConstant'; | ||
| 3 | +import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; | ||
| 4 | +import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter'; | ||
| 5 | +import { PageComponent } from './PageComponent'; | ||
| 6 | +import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; | ||
| 7 | +import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; | ||
| 8 | +import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; | ||
| 9 | +import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; | ||
| 10 | +import { channelSkeleton } from '../skeleton/channelSkeleton'; | ||
| 11 | + | ||
| 12 | +const TAG = 'TopNavigationComponent'; | ||
| 13 | + | ||
| 14 | +PersistentStorage.persistProp('channelIds', ''); | ||
| 15 | +PersistentStorage.persistProp('indexSettingChannelId', 2002); | ||
| 16 | + | ||
| 17 | +const storage = LocalStorage.getShared(); | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * 顶部页签导航栏/顶导 | ||
| 21 | + */ | ||
| 22 | +@Entry(storage) | ||
| 23 | +@Component | ||
| 24 | +export struct TopNavigationComponentNew { | ||
| 25 | + /** | ||
| 26 | + * @deprecated | ||
| 27 | + */ | ||
| 28 | + private groupId: number = 0 | ||
| 29 | + /** | ||
| 30 | + * @deprecated TODO type判断 | ||
| 31 | + */ | ||
| 32 | + private currentBottomNavName: string = '' | ||
| 33 | + private swiperController: SwiperController = new SwiperController() | ||
| 34 | + private listScroller: Scroller = new Scroller() | ||
| 35 | + @Consume barBackgroundColor: Color | ||
| 36 | + /** | ||
| 37 | + * @deprecated | ||
| 38 | + */ | ||
| 39 | + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 40 | + /** | ||
| 41 | + * @deprecated | ||
| 42 | + */ | ||
| 43 | + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | ||
| 44 | + @Link _currentNavIndex?: number; | ||
| 45 | + // 顶导当前选中/焦点下标 | ||
| 46 | + @State currentTopNavSelectedIndex: number = 0; | ||
| 47 | + // 顶导数据 | ||
| 48 | + @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] | ||
| 49 | + @StorageProp('indexSettingChannelId') indexSettingChannelId: number = 2002 | ||
| 50 | + //我的频道id列表 | ||
| 51 | + @State channelIds: number[] = [] | ||
| 52 | + //本地缓存频道id列表 | ||
| 53 | + @StorageProp('channelIds') storageChannelIds: string = '' | ||
| 54 | + @State homeChannelList: TopNavDTO[] = [] | ||
| 55 | + // 我的频道列表 | ||
| 56 | + @State myChannelList: TopNavDTO[] = [] | ||
| 57 | + // 更多频道列表 | ||
| 58 | + @State moreChannelList: TopNavDTO[] = [] | ||
| 59 | + // 地方频道列表 | ||
| 60 | + @State localChannelList: TopNavDTO[] = [] | ||
| 61 | + readonly MAX_LINE: number = 1; | ||
| 62 | + @ObjectLink @Watch('onAssignChannelChange') assignChannel: AssignChannelParam | ||
| 63 | + // 底导传递过来的自动刷新通知 | ||
| 64 | + @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | ||
| 65 | + // 传递给page的自动刷新通知 | ||
| 66 | + @State autoRefresh2Page: number = 0 | ||
| 67 | + // 当前底导index | ||
| 68 | + @State bottomNavIndex: number = 0 | ||
| 69 | + @State animationDuration: number = 0 | ||
| 70 | + @State indicatorLeftMargin: number = 0 | ||
| 71 | + @State indicatorWidth: number = 0 | ||
| 72 | + private tabsWidth: number = 0 | ||
| 73 | + | ||
| 74 | + build() { | ||
| 75 | + Column() { | ||
| 76 | + // 频道分类list | ||
| 77 | + RelativeContainer() { | ||
| 78 | + this.tabBar() | ||
| 79 | + Swiper(this.swiperController) { | ||
| 80 | + ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList, | ||
| 81 | + (navItem: TopNavDTO, index: number) => { | ||
| 82 | + if (this.currentBottomNavName === '人民号' && navItem.name === '关注') { | ||
| 83 | + PeopleShipMainComponent({ | ||
| 84 | + currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 85 | + navIndex: index, | ||
| 86 | + pageId: navItem.pageId + '', | ||
| 87 | + channelId: navItem.channelId + '', | ||
| 88 | + }) | ||
| 89 | + } else | ||
| 90 | + if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { | ||
| 91 | + PageComponent({ | ||
| 92 | + currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 93 | + navIndex: index, | ||
| 94 | + pageId: navItem.pageId + '', | ||
| 95 | + channelId: navItem.channelId + '', | ||
| 96 | + autoRefresh: this.autoRefresh2Page | ||
| 97 | + }) | ||
| 98 | + } else { | ||
| 99 | + channelSkeleton() | ||
| 100 | + } | ||
| 101 | + }) | ||
| 102 | + } | ||
| 103 | + .loop(false) | ||
| 104 | + .indicator(false) | ||
| 105 | + .effectMode(EdgeEffect.None) | ||
| 106 | + .index(this.currentTopNavSelectedIndex) | ||
| 107 | + .cachedCount(0) | ||
| 108 | + .id('pageContent') | ||
| 109 | + .alignRules({ | ||
| 110 | + 'top': { 'anchor': 'tabList', 'align': VerticalAlign.Bottom }, | ||
| 111 | + 'middle': { 'anchor': '__container__', 'align': HorizontalAlign.Center }, | ||
| 112 | + 'bottom': { 'anchor': '__container__', 'align': VerticalAlign.Bottom } | ||
| 113 | + }) | ||
| 114 | + .onChange((index) => { | ||
| 115 | + Logger.info(TAG, `onChange index : ${index}`); | ||
| 116 | + if (this.isBroadcastByIndex(index)) { | ||
| 117 | + // 跳转到播报页面 | ||
| 118 | + ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId) | ||
| 119 | + let nextIndex = this.currentTopNavSelectedIndex > index ? index - 1 : index + 1 | ||
| 120 | + if (nextIndex < this.myChannelList.length) { | ||
| 121 | + this.changePage(nextIndex) | ||
| 122 | + } | ||
| 123 | + } else if (this.isLayoutByIndex(index)) { | ||
| 124 | + ProcessUtils.gotoENewsPaper() | ||
| 125 | + let nextIndex = this.currentTopNavSelectedIndex > index ? index - 1 : index + 1 | ||
| 126 | + if (nextIndex < this.myChannelList.length) { | ||
| 127 | + this.changePage(nextIndex) | ||
| 128 | + } | ||
| 129 | + } else { | ||
| 130 | + this.currentTopNavSelectedIndex = index; | ||
| 131 | + this.changePage(this.currentTopNavSelectedIndex) | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + }) | ||
| 135 | + } | ||
| 136 | + .width('100%') | ||
| 137 | + .height('100%') | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + @Builder | ||
| 142 | + topBar() { | ||
| 143 | + Column() { | ||
| 144 | + Row() { | ||
| 145 | + FirstTabTopSearchComponent() | ||
| 146 | + | ||
| 147 | + Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 148 | + .width(72) | ||
| 149 | + .height(29) | ||
| 150 | + .onClick(() => { | ||
| 151 | + ProcessUtils.gotoENewsPaper() | ||
| 152 | + }) | ||
| 153 | + Stack({ alignContent: Alignment.Center }) { | ||
| 154 | + Image($r('app.media.background_read_paper_home')) | ||
| 155 | + .width('100%') | ||
| 156 | + .height('100%') | ||
| 157 | + .objectFit(ImageFit.Contain) | ||
| 158 | + Row() { | ||
| 159 | + Image($r('app.media.icon_read_paper_home')) | ||
| 160 | + .width(18) | ||
| 161 | + .height(18) | ||
| 162 | + Text('早晚报') | ||
| 163 | + .fontColor("#666666") | ||
| 164 | + .fontSize($r('app.float.font_size_13')) | ||
| 165 | + } | ||
| 166 | + .alignItems(VerticalAlign.Center) | ||
| 167 | + .justifyContent(FlexAlign.Center) | ||
| 168 | + } | ||
| 169 | + .height(30) | ||
| 170 | + .width(124) | ||
| 171 | + .onClick(() => { | ||
| 172 | + if (NetworkUtil.isNetConnected()) { | ||
| 173 | + ProcessUtils.gotoMorningEveningPaper() | ||
| 174 | + } else { | ||
| 175 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 176 | + } | ||
| 177 | + }) | ||
| 178 | + }.width('100%') | ||
| 179 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 180 | + } | ||
| 181 | + .width('100%') | ||
| 182 | + .height(40) | ||
| 183 | + .padding({ top: 10 }) | ||
| 184 | + .backgroundColor($r('app.color.white')) | ||
| 185 | + .id('topBar') | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + @Builder | ||
| 189 | + tabBar() { | ||
| 190 | + // TODO 判断是否新闻tab,修改方法(,_currentNavIndex==0 都不对,需要用type)(用topStyle) | ||
| 191 | + if (this.currentBottomNavName === '新闻') { | ||
| 192 | + // 顶部搜索、日报logo、早晚报 | ||
| 193 | + this.topBar() | ||
| 194 | + ChannelSubscriptionLayout({ | ||
| 195 | + currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 196 | + indexSettingChannelId: this.indexSettingChannelId, | ||
| 197 | + homeChannelList: this.homeChannelList, | ||
| 198 | + myChannelList: $myChannelList, | ||
| 199 | + moreChannelList: $moreChannelList, | ||
| 200 | + localChannelList: $localChannelList, | ||
| 201 | + channelIds: $channelIds, | ||
| 202 | + changeTab: (index) => { | ||
| 203 | + this.changePage(index) | ||
| 204 | + } | ||
| 205 | + }) | ||
| 206 | + .id('channelManageBtn') | ||
| 207 | + .alignRules({ | ||
| 208 | + 'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom }, | ||
| 209 | + 'right': { 'anchor': '__container__', 'align': HorizontalAlign.End } | ||
| 210 | + }) | ||
| 211 | + | ||
| 212 | + List({ scroller: this.listScroller }) { | ||
| 213 | + ForEach(this.myChannelList, (navItem: TopNavDTO, index: number) => { | ||
| 214 | + ListItem() { | ||
| 215 | + this.tabBarBuilder(navItem, index) | ||
| 216 | + } | ||
| 217 | + }) | ||
| 218 | + } | ||
| 219 | + .listDirection(Axis.Horizontal) | ||
| 220 | + .scrollBar(BarState.Off) | ||
| 221 | + .edgeEffect(EdgeEffect.None) | ||
| 222 | + .padding({ left: 8, top: 6, right: 0 }) | ||
| 223 | + .height($r('app.float.top_tab_bar_height')) | ||
| 224 | + .backgroundColor(this.barBackgroundColor) | ||
| 225 | + .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 226 | + let width = Number.parseFloat(newValue.width.toString()) | ||
| 227 | + this.tabsWidth = Number.isNaN(width) ? 0 : width | ||
| 228 | + }) | ||
| 229 | + .id('tabList') | ||
| 230 | + .alignRules({ | ||
| 231 | + 'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom }, | ||
| 232 | + 'left': { 'anchor': '__container__', 'align': HorizontalAlign.Start }, | ||
| 233 | + 'right': { 'anchor': 'channelManageBtn', 'align': HorizontalAlign.Start } | ||
| 234 | + }) | ||
| 235 | + } else { | ||
| 236 | + Row() { | ||
| 237 | + Image($r('app.media.icon_search')) | ||
| 238 | + .width('24vp') | ||
| 239 | + .height('24vp') | ||
| 240 | + } | ||
| 241 | + .height('40vp') | ||
| 242 | + .width('40vp') | ||
| 243 | + .margin({ right: 10 }) | ||
| 244 | + .alignItems(VerticalAlign.Center) | ||
| 245 | + .justifyContent(FlexAlign.Center) | ||
| 246 | + .id('searchBtn') | ||
| 247 | + .alignRules({ | ||
| 248 | + 'top': { 'anchor': '__container__', 'align': VerticalAlign.Top }, | ||
| 249 | + 'right': { 'anchor': '__container__', 'align': HorizontalAlign.End } | ||
| 250 | + }) | ||
| 251 | + .onClick(() => { | ||
| 252 | + WDRouterRule.jumpWithPage(WDRouterPage.searchPage) | ||
| 253 | + }) | ||
| 254 | + | ||
| 255 | + List({ scroller: this.listScroller }) { | ||
| 256 | + ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => { | ||
| 257 | + ListItem() { | ||
| 258 | + this.tabBarBuilder(navItem, index) | ||
| 259 | + } | ||
| 260 | + }) | ||
| 261 | + } | ||
| 262 | + .listDirection(Axis.Horizontal) | ||
| 263 | + .scrollBar(BarState.Off) | ||
| 264 | + .edgeEffect(EdgeEffect.None) | ||
| 265 | + .height($r('app.float.top_tab_bar_height')) | ||
| 266 | + .backgroundColor(this.barBackgroundColor) | ||
| 267 | + .padding({ top: 6 }) | ||
| 268 | + .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 269 | + let width = Number.parseFloat(newValue.width.toString()) | ||
| 270 | + this.tabsWidth = Number.isNaN(width) ? 0 : width | ||
| 271 | + }) | ||
| 272 | + .id('tabList') | ||
| 273 | + .alignRules({ | ||
| 274 | + 'top': { 'anchor': '__container__', 'align': VerticalAlign.Top }, | ||
| 275 | + 'middle': { 'anchor': '__container__', 'align': HorizontalAlign.Center } | ||
| 276 | + }) | ||
| 277 | + } | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + @Builder | ||
| 281 | + tabBarBuilder(item: TopNavDTO, index: number) { | ||
| 282 | + Column() { | ||
| 283 | + Text(item?.name) | ||
| 284 | + .fontSize($r('app.float.selected_text_size')) | ||
| 285 | + .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal) | ||
| 286 | + .fontColor(this.currentTopNavSelectedIndex === index ? Color.Black : "#999999") | ||
| 287 | + .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') }) | ||
| 288 | + .maxLines(this.MAX_LINE) | ||
| 289 | + .id(index.toString()) | ||
| 290 | + .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 291 | + if (this.currentTopNavSelectedIndex === index && | ||
| 292 | + (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)) { | ||
| 293 | + if (newValue.position.x != undefined) { | ||
| 294 | + let positionX = Number.parseFloat(newValue.position.x.toString()) | ||
| 295 | + this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX | ||
| 296 | + } | ||
| 297 | + let width = Number.parseFloat(newValue.width.toString()) | ||
| 298 | + this.indicatorWidth = Number.isNaN(width) ? 0 : width | ||
| 299 | + } | ||
| 300 | + }) | ||
| 301 | + if (this.currentTopNavSelectedIndex === index) { | ||
| 302 | + Row() | ||
| 303 | + .width(20) | ||
| 304 | + .height(3) | ||
| 305 | + .backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat) | ||
| 306 | + .backgroundImageSize(ImageSize.Contain) | ||
| 307 | + } | ||
| 308 | + } | ||
| 309 | + .hoverEffect(HoverEffect.Highlight) | ||
| 310 | + .constraintSize({ | ||
| 311 | + minWidth: $r('app.float.top_tab_item_min_width'), | ||
| 312 | + maxWidth: $r('app.float.top_tab_item_max_width') | ||
| 313 | + }) | ||
| 314 | + // .backgroundColor(Color.Transparent) | ||
| 315 | + .padding({ | ||
| 316 | + left: $r('app.float.top_tab_item_padding_horizontal'), | ||
| 317 | + right: $r('app.float.top_tab_item_padding_horizontal'), | ||
| 318 | + bottom: 2, | ||
| 319 | + }) | ||
| 320 | + .id(`col_tabBar${index}`) | ||
| 321 | + // .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 }) | ||
| 322 | + .onClick(() => { | ||
| 323 | + Logger.debug(TAG, `onClick, index: ${index}`); | ||
| 324 | + if (this.currentTopNavSelectedIndex === index) { | ||
| 325 | + // 当前tab,单击事件 | ||
| 326 | + this.doAutoRefresh() | ||
| 327 | + } else { | ||
| 328 | + if (this.isBroadcastByIndex(index)) { | ||
| 329 | + // 跳转到播报页面 | ||
| 330 | + ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId) | ||
| 331 | + } else if (this.isLayoutByIndex(index)) { | ||
| 332 | + ProcessUtils.gotoENewsPaper() | ||
| 333 | + } else { | ||
| 334 | + this.currentTopNavSelectedIndex = index | ||
| 335 | + this.changePage(index) | ||
| 336 | + } | ||
| 337 | + } | ||
| 338 | + }) | ||
| 339 | + } | ||
| 340 | + | ||
| 341 | + private changePage(index: number) { | ||
| 342 | + this.swiperController.changeIndex(index) | ||
| 343 | + this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER) | ||
| 344 | + } | ||
| 345 | + | ||
| 346 | + //处理新闻tab顶导频道数据 | ||
| 347 | + topNavListHandle() { | ||
| 348 | + let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string | ||
| 349 | + | ||
| 350 | + let _channelIds: number [] = [] | ||
| 351 | + let _myChannelList: TopNavDTO [] = [] | ||
| 352 | + let _storageChannelIds: string [] = [] //list1 | ||
| 353 | + let defaultMyChannelList: TopNavDTO[] = [] | ||
| 354 | + let defaultList = [...this.topNavList] | ||
| 355 | + defaultList.sort((a, b) => { | ||
| 356 | + return a.num - b.num; | ||
| 357 | + }); | ||
| 358 | + | ||
| 359 | + //defaultMyChannelList | ||
| 360 | + defaultList.forEach(item => { | ||
| 361 | + if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 || | ||
| 362 | + item.headlinesOn === 1) { | ||
| 363 | + defaultMyChannelList.push(item); | ||
| 364 | + } | ||
| 365 | + if (item.defaultPermitted === 1) { | ||
| 366 | + this.homeChannelList.push(item) | ||
| 367 | + } | ||
| 368 | + }) | ||
| 369 | + | ||
| 370 | + //有缓存频道id | ||
| 371 | + if (this.storageChannelIds) { | ||
| 372 | + _storageChannelIds = this.storageChannelIds.split(',') | ||
| 373 | + } | ||
| 374 | + | ||
| 375 | + defaultMyChannelList.forEach(item => { | ||
| 376 | + item.myChannel = '1' | ||
| 377 | + if (item.defaultPermitted === 1) { | ||
| 378 | + item.homeChannel = '1' | ||
| 379 | + } | ||
| 380 | + let index = defaultList.findIndex(_item => _item.channelId === item.channelId) | ||
| 381 | + if (index !== -1) { | ||
| 382 | + defaultList.splice(index, 1) | ||
| 383 | + } | ||
| 384 | + }) | ||
| 385 | + defaultList.unshift(...defaultMyChannelList) | ||
| 386 | + | ||
| 387 | + defaultList.forEach((item, index) => { | ||
| 388 | + if (this.storageChannelIds && _storageChannelIds.includes(String(item.channelId))) { | ||
| 389 | + item.myChannel = '1' | ||
| 390 | + } | ||
| 391 | + if (item.channelType === 2) { | ||
| 392 | + if (cityName.includes(item.name)) { | ||
| 393 | + item.myChannel = '1' | ||
| 394 | + } | ||
| 395 | + item.localChannel = '1' | ||
| 396 | + } | ||
| 397 | + if (index >= 11) { | ||
| 398 | + if (item.channelType === 1) { | ||
| 399 | + item.moreChannel = '1' | ||
| 400 | + } | ||
| 401 | + } else { | ||
| 402 | + if (item.channelType === 1 && item.myChannel !== '1') { | ||
| 403 | + item.moreChannel = '1' | ||
| 404 | + } | ||
| 405 | + } | ||
| 406 | + | ||
| 407 | + //频道分类 | ||
| 408 | + if (item.name !== '播报') { //暂时隐藏播报 | ||
| 409 | + if (item.myChannel === '1') { | ||
| 410 | + _myChannelList.push(item) | ||
| 411 | + _channelIds.push(item.channelId) | ||
| 412 | + } else if (item.moreChannel === '1') { | ||
| 413 | + this.moreChannelList.push(item) | ||
| 414 | + } else if (item.localChannel === '1' && item.myChannel !== '1') { | ||
| 415 | + this.localChannelList.push(item) | ||
| 416 | + } | ||
| 417 | + } | ||
| 418 | + | ||
| 419 | + }) | ||
| 420 | + | ||
| 421 | + if (cityName) { | ||
| 422 | + let index = _myChannelList.findIndex(ele => cityName.includes(ele.name)) | ||
| 423 | + const localChannelitem = _myChannelList.splice(index, 1)[0]; | ||
| 424 | + // 将当前地区频道插入到第四个 | ||
| 425 | + _myChannelList.splice(3, 0, localChannelitem); | ||
| 426 | + } | ||
| 427 | + | ||
| 428 | + this.channelIds = _channelIds | ||
| 429 | + this.myChannelList = _myChannelList | ||
| 430 | + | ||
| 431 | + //缓存首页频道 | ||
| 432 | + let index = this.myChannelList.findIndex(_item => _item?.channelId === this.indexSettingChannelId) | ||
| 433 | + if (index > -1) { | ||
| 434 | + this.currentTopNavSelectedIndex = index | ||
| 435 | + } | ||
| 436 | + } | ||
| 437 | + | ||
| 438 | + private isBroadcast(item?: TopNavDTO): boolean { | ||
| 439 | + // TODO 用id channelId = '2066' | ||
| 440 | + return item?.name === '播报' | ||
| 441 | + } | ||
| 442 | + | ||
| 443 | + private isLayout(item?: TopNavDTO): boolean { | ||
| 444 | + // TODO 用id channelId = '2006' | ||
| 445 | + return item?.name === '版面' | ||
| 446 | + } | ||
| 447 | + | ||
| 448 | + private isBroadcastByIndex(index: number): boolean { | ||
| 449 | + let item = this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index] | ||
| 450 | + return this.isBroadcast(item) | ||
| 451 | + } | ||
| 452 | + | ||
| 453 | + private isLayoutByIndex(index: number): boolean { | ||
| 454 | + let item = this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index] | ||
| 455 | + return this.isLayout(item) | ||
| 456 | + } | ||
| 457 | + | ||
| 458 | + private isSpecialChannel(item?: TopNavDTO) { | ||
| 459 | + // 版面、播报,可以用这个判断 | ||
| 460 | + return item?.channelType === 3 | ||
| 461 | + } | ||
| 462 | + | ||
| 463 | + aboutToAppear() { | ||
| 464 | + //处理新闻tab顶导频道数据 | ||
| 465 | + this.topNavListHandle() | ||
| 466 | + this.changePage(this.currentTopNavSelectedIndex) | ||
| 467 | + } | ||
| 468 | + | ||
| 469 | + aboutToDisappear() { | ||
| 470 | + AppStorage.set('channelIds', this.channelIds.join(',')) | ||
| 471 | + } | ||
| 472 | + | ||
| 473 | + onTopNavigationDataUpdated() { | ||
| 474 | + Logger.info(TAG, | ||
| 475 | + `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); | ||
| 476 | + } | ||
| 477 | + | ||
| 478 | + onAutoRefresh() { | ||
| 479 | + if (this.bottomNavIndex != this._currentNavIndex) { | ||
| 480 | + return | ||
| 481 | + } | ||
| 482 | + // 通知page刷新 | ||
| 483 | + this.autoRefresh2Page++ | ||
| 484 | + } | ||
| 485 | + | ||
| 486 | + private doAutoRefresh() { | ||
| 487 | + // 通知page刷新 | ||
| 488 | + this.autoRefresh2Page++ | ||
| 489 | + } | ||
| 490 | + | ||
| 491 | + /** | ||
| 492 | + * 判断是否当前页面处理逻辑,如消息通知,只需要切换到当前底导的处理,过滤掉非当前。 | ||
| 493 | + */ | ||
| 494 | + private isCurrentPage(): boolean { | ||
| 495 | + return this._currentNavIndex === this.bottomNavIndex | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + /** | ||
| 499 | + * 频道id变化,即指定频道跳转场景 | ||
| 500 | + */ | ||
| 501 | + onAssignChannelChange() { | ||
| 502 | + if (!this.isCurrentPage()) { | ||
| 503 | + return | ||
| 504 | + } | ||
| 505 | + let channelId = this.assignChannel.channelId | ||
| 506 | + let index = -1 | ||
| 507 | + if (this._currentNavIndex === 0) { | ||
| 508 | + // 第一个,新闻,先拿我的,再拿其他 | ||
| 509 | + index = this.getChannelByMine(channelId) | ||
| 510 | + if (index == -1) { | ||
| 511 | + // 不在我的里,需要临时新增频道展示 | ||
| 512 | + let channel = this.getChannelByOthers(channelId) | ||
| 513 | + if (channel) { | ||
| 514 | + this.myChannelList.push(channel) | ||
| 515 | + setTimeout(() => { | ||
| 516 | + this.changePage(this.myChannelList.length - 1) | ||
| 517 | + }, 20) | ||
| 518 | + } | ||
| 519 | + } else { | ||
| 520 | + // 直接切换 | ||
| 521 | + this.changePage(index) | ||
| 522 | + } | ||
| 523 | + } else { | ||
| 524 | + index = this.getChannelByTopNav(channelId) | ||
| 525 | + if (index > -1) { | ||
| 526 | + // 找到了,直接切换,否则不处理 | ||
| 527 | + this.changePage(index) | ||
| 528 | + } | ||
| 529 | + } | ||
| 530 | + | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + /** | ||
| 534 | + * 非新闻,从topNav里拿数据 | ||
| 535 | + */ | ||
| 536 | + private getChannelByTopNav(channelId: string) { | ||
| 537 | + for (let i = 0; i < this.topNavList.length; i++) { | ||
| 538 | + let topNavDTO: TopNavDTO = this.topNavList[i] | ||
| 539 | + if (topNavDTO.channelId.toString() === channelId) { | ||
| 540 | + return i | ||
| 541 | + } | ||
| 542 | + } | ||
| 543 | + return -1 | ||
| 544 | + } | ||
| 545 | + | ||
| 546 | + /** | ||
| 547 | + * 新闻,从myChannelList里拿数据 | ||
| 548 | + */ | ||
| 549 | + private getChannelByMine(channelId: string) { | ||
| 550 | + for (let i = 0; i < this.myChannelList.length; i++) { | ||
| 551 | + let topNavDTO: TopNavDTO = this.myChannelList[i] | ||
| 552 | + if (topNavDTO?.channelId?.toString() === channelId) { | ||
| 553 | + return i | ||
| 554 | + } | ||
| 555 | + } | ||
| 556 | + return -1 | ||
| 557 | + } | ||
| 558 | + | ||
| 559 | + /** | ||
| 560 | + * 新闻,从其他里拿数据 | ||
| 561 | + */ | ||
| 562 | + private getChannelByOthers(channelId: string) { | ||
| 563 | + for (let i = 0; i < this.moreChannelList.length; i++) { | ||
| 564 | + let topNavDTO: TopNavDTO = this.moreChannelList[i] | ||
| 565 | + if (topNavDTO.channelId?.toString() === channelId) { | ||
| 566 | + return topNavDTO | ||
| 567 | + } | ||
| 568 | + } | ||
| 569 | + for (let j = 0; j < this.localChannelList.length; j++) { | ||
| 570 | + let topNavDTO: TopNavDTO = this.localChannelList[j] | ||
| 571 | + if (topNavDTO.channelId?.toString() === channelId) { | ||
| 572 | + return topNavDTO | ||
| 573 | + } | ||
| 574 | + } | ||
| 575 | + return null | ||
| 576 | + } | ||
| 577 | + | ||
| 578 | + private getTextInfo(index: number): Record<string, number> { | ||
| 579 | + let strJson = getInspectorByKey(index.toString()) | ||
| 580 | + try { | ||
| 581 | + let obj: Record<string, string> = JSON.parse(strJson) | ||
| 582 | + let rectInfo: number[][] = JSON.parse('[' + obj.$rect + ']') | ||
| 583 | + return { 'left': px2vp(rectInfo[0][0]), 'width': px2vp(rectInfo[1][0] - rectInfo[0][0]) } | ||
| 584 | + } catch (error) { | ||
| 585 | + return { 'left': 0, 'width': 0 } | ||
| 586 | + } | ||
| 587 | + } | ||
| 588 | + | ||
| 589 | + private getCurrentIndicatorInfo(index: number, event: TabsAnimationEvent): Record<string, number> { | ||
| 590 | + let nextIndex = index | ||
| 591 | + if (index > 0 && event.currentOffset > 0) { | ||
| 592 | + nextIndex-- | ||
| 593 | + } else if (index < 3 && event.currentOffset < 0) { | ||
| 594 | + nextIndex++ | ||
| 595 | + } | ||
| 596 | + let indexInfo = this.getTextInfo(index) | ||
| 597 | + let nextIndexInfo = this.getTextInfo(nextIndex) | ||
| 598 | + let swipeRatio = Math.abs(event.currentOffset / this.tabsWidth) | ||
| 599 | + let currentIndex = swipeRatio > 0.5 ? nextIndex : index // 页面滑动超过一半,tabBar切换到下一页。 | ||
| 600 | + let currentLeft = indexInfo.left + (nextIndexInfo.left - indexInfo.left) * swipeRatio | ||
| 601 | + let currentWidth = indexInfo.width + (nextIndexInfo.width - indexInfo.width) * swipeRatio | ||
| 602 | + return { 'index': currentIndex, 'left': currentLeft, 'width': currentWidth } | ||
| 603 | + } | ||
| 604 | + | ||
| 605 | + private startAnimateTo(duration: number, leftMargin: number, width: number) { | ||
| 606 | + animateTo({ | ||
| 607 | + duration: duration, // 动画时长 | ||
| 608 | + curve: Curve.Linear, // 动画曲线 | ||
| 609 | + iterations: 1, // 播放次数 | ||
| 610 | + playMode: PlayMode.Normal, // 动画模式 | ||
| 611 | + onFinish: () => { | ||
| 612 | + console.info('play end') | ||
| 613 | + } | ||
| 614 | + }, () => { | ||
| 615 | + this.indicatorLeftMargin = leftMargin | ||
| 616 | + this.indicatorWidth = width | ||
| 617 | + }) | ||
| 618 | + } | ||
| 619 | +} |
| @@ -49,7 +49,7 @@ export struct SearchComponent { | @@ -49,7 +49,7 @@ export struct SearchComponent { | ||
| 49 | getRelatedSearchContent() { | 49 | getRelatedSearchContent() { |
| 50 | if(StringUtils.isNotEmpty(this.searchText)){ | 50 | if(StringUtils.isNotEmpty(this.searchText)){ |
| 51 | SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText),getContext(this)).then((value) => { | 51 | SearcherAboutDataModel.getRelatedSearchContentData(encodeURI(this.searchText),getContext(this)).then((value) => { |
| 52 | - if (value != null) { | 52 | + if (value != null && value.length > 0) { |
| 53 | this.relatedSearchContentsData = [] | 53 | this.relatedSearchContentsData = [] |
| 54 | value.forEach(item=>{ | 54 | value.forEach(item=>{ |
| 55 | let tempValue:string = item | 55 | let tempValue:string = item |
| @@ -81,6 +81,9 @@ export struct SearchComponent { | @@ -81,6 +81,9 @@ export struct SearchComponent { | ||
| 81 | this.relatedSearchContentsData.push(new SearchRelatedItem(item,tempArr)) | 81 | this.relatedSearchContentsData.push(new SearchRelatedItem(item,tempArr)) |
| 82 | } | 82 | } |
| 83 | }) | 83 | }) |
| 84 | + }else{ | ||
| 85 | + this.hasInputContent = false | ||
| 86 | + this.relatedSearchContentsData = [] | ||
| 84 | } | 87 | } |
| 85 | }).catch((err: Error) => { | 88 | }).catch((err: Error) => { |
| 86 | console.log(TAG, JSON.stringify(err)) | 89 | console.log(TAG, JSON.stringify(err)) |
| @@ -228,7 +231,7 @@ export struct SearchComponent { | @@ -228,7 +231,7 @@ export struct SearchComponent { | ||
| 228 | Row() { | 231 | Row() { |
| 229 | //左 | 232 | //左 |
| 230 | Stack({ alignContent: Alignment.Start }) { | 233 | Stack({ alignContent: Alignment.Start }) { |
| 231 | - if (this.searchTextData != null && this.searchTextData.length > 0 && !this.hasInputContent) { | 234 | + if (this.searchTextData != null && this.searchTextData.length > 0 && !this.hasInputContent && StringUtils.isEmpty(this.searchText)) { |
| 232 | Swiper(this.swiperController) { | 235 | Swiper(this.swiperController) { |
| 233 | ForEach(this.searchTextData, (item: string, index: number) => { | 236 | ForEach(this.searchTextData, (item: string, index: number) => { |
| 234 | Text(item) | 237 | Text(item) |
| @@ -20,12 +20,16 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem' | @@ -20,12 +20,16 @@ import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem' | ||
| 20 | import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem' | 20 | import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem' |
| 21 | import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem' | 21 | import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem' |
| 22 | import { SearchResultContentData } from '../../viewmodel/SearchResultContentData' | 22 | import { SearchResultContentData } from '../../viewmodel/SearchResultContentData' |
| 23 | -import { SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' | 23 | +import { |
| 24 | + SearchDescription, | ||
| 25 | + SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' | ||
| 24 | import { CardParser } from '../CardParser' | 26 | import { CardParser } from '../CardParser' |
| 25 | import { FollowChildComponent } from '../mine/follow/FollowChildComponent' | 27 | import { FollowChildComponent } from '../mine/follow/FollowChildComponent' |
| 26 | import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI' | 28 | import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI' |
| 27 | import { ActivityItemComponent } from './ActivityItemComponent' | 29 | import { ActivityItemComponent } from './ActivityItemComponent' |
| 28 | import { SearchCreatorComponent } from './SearchCreatorComponent' | 30 | import { SearchCreatorComponent } from './SearchCreatorComponent' |
| 31 | +import { JSON } from '@kit.ArkTS' | ||
| 32 | +import { MoreComponent } from '../cardview/MoreComponent' | ||
| 29 | 33 | ||
| 30 | const TAG = "SearchResultContentComponent" | 34 | const TAG = "SearchResultContentComponent" |
| 31 | 35 | ||
| @@ -34,6 +38,7 @@ export struct SearchResultContentComponent { | @@ -34,6 +38,7 @@ export struct SearchResultContentComponent { | ||
| 34 | @State keywords: string = "" | 38 | @State keywords: string = "" |
| 35 | @State searchType: string = "" | 39 | @State searchType: string = "" |
| 36 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); | 40 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); |
| 41 | + tempList : ContentDTO[] = [] | ||
| 37 | @State data_rmh: SearchRmhDescription[] = [] | 42 | @State data_rmh: SearchRmhDescription[] = [] |
| 38 | @State count: number = -1; | 43 | @State count: number = -1; |
| 39 | @State isLoading: boolean = false | 44 | @State isLoading: boolean = false |
| @@ -62,7 +67,7 @@ export struct SearchResultContentComponent { | @@ -62,7 +67,7 @@ export struct SearchResultContentComponent { | ||
| 62 | getNewSearchResultData() { | 67 | getNewSearchResultData() { |
| 63 | this.isLoading = true | 68 | this.isLoading = true |
| 64 | if (this.hasMore) { | 69 | if (this.hasMore) { |
| 65 | - SearcherAboutDataModel.getSearchResultListData("15", `${this.curPageNum}`, this.searchType, this.keywords, | 70 | + SearcherAboutDataModel.getSearchResultListData("20", `${this.curPageNum}`, this.searchType, this.keywords, |
| 66 | getContext(this)).then((value) => { | 71 | getContext(this)).then((value) => { |
| 67 | console.log('SearcherAboutDataModel', JSON.stringify(value)) | 72 | console.log('SearcherAboutDataModel', JSON.stringify(value)) |
| 68 | if (!this.data || value.list.length == 0) { | 73 | if (!this.data || value.list.length == 0) { |
| @@ -183,9 +188,8 @@ export struct SearchResultContentComponent { | @@ -183,9 +188,8 @@ export struct SearchResultContentComponent { | ||
| 183 | resultData.list.forEach((value:SearchResultContentItem) => { | 188 | resultData.list.forEach((value:SearchResultContentItem) => { |
| 184 | creatorIdList.push(value.data.creatorId) | 189 | creatorIdList.push(value.data.creatorId) |
| 185 | }) | 190 | }) |
| 191 | + let isRemain : boolean = false | ||
| 186 | SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => { | 192 | SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => { |
| 187 | - | ||
| 188 | - | ||
| 189 | resultData.list.forEach((value) => { | 193 | resultData.list.forEach((value) => { |
| 190 | let photos: FullColumnImgUrlDTO[] = [] | 194 | let photos: FullColumnImgUrlDTO[] = [] |
| 191 | // if (value.data.appStyle === 4) { | 195 | // if (value.data.appStyle === 4) { |
| @@ -196,42 +200,98 @@ export struct SearchResultContentComponent { | @@ -196,42 +200,98 @@ export struct SearchResultContentComponent { | ||
| 196 | // } | 200 | // } |
| 197 | let contentDTO = this.dataTransform(rem,value, photos); | 201 | let contentDTO = this.dataTransform(rem,value, photos); |
| 198 | if(value.data.type != "13"){ | 202 | if(value.data.type != "13"){ |
| 199 | - this.data.push(contentDTO) | 203 | + this.tempList.push(contentDTO) |
| 204 | + if(value.data.sameContentList != null && value.data.sameContentList.length > 0) { | ||
| 205 | + let contentDTO2 = new ContentDTO(); | ||
| 206 | + contentDTO2.sameContentListJson = JSON.stringify(value.data.sameContentList) | ||
| 207 | + isRemain = true | ||
| 208 | + this.tempList.push(contentDTO2) | ||
| 209 | + } | ||
| 200 | } | 210 | } |
| 201 | }) | 211 | }) |
| 202 | - | ||
| 203 | - | 212 | + if(!isRemain){ |
| 213 | + this.tempList.forEach((value) => { | ||
| 214 | + this.data.push(value) | ||
| 215 | + }) | ||
| 216 | + this.tempList = [] | ||
| 217 | + this.data.notifyDataReload() | ||
| 218 | + this.count = this.data.totalCount() | ||
| 219 | + if (this.count < resultData.totalCount) { | ||
| 220 | + this.curPageNum++ | ||
| 221 | + } else { | ||
| 222 | + this.hasMore = false | ||
| 223 | + } | ||
| 224 | + this.isLoading = false | ||
| 225 | + }else{ | ||
| 226 | + this.dealSameContent(resultData.totalCount) | ||
| 227 | + } | ||
| 204 | }).catch((err: Error) => { | 228 | }).catch((err: Error) => { |
| 205 | console.log(TAG, JSON.stringify(err)) | 229 | console.log(TAG, JSON.stringify(err)) |
| 206 | }) | 230 | }) |
| 207 | - | ||
| 208 | - | ||
| 209 | - this.data.notifyDataReload() | ||
| 210 | - this.count = this.data.totalCount() | ||
| 211 | - if (this.data.totalCount() < resultData.totalCount) { | ||
| 212 | - this.curPageNum++ | ||
| 213 | - } else { | ||
| 214 | - this.hasMore = false | ||
| 215 | - } | 231 | + }).catch((err: Error) => { |
| 232 | + console.log(TAG, "请求失败") | ||
| 216 | this.isLoading = false | 233 | this.isLoading = false |
| 234 | + this.count = this.count === -1 ? 0 : this.count | ||
| 235 | + }) | ||
| 236 | + } | ||
| 217 | 237 | ||
| 218 | - if (this.count === 0 && resultData.list.length > 0) { | ||
| 219 | - this.count = -1 | ||
| 220 | - if (!this.isLoading) { | ||
| 221 | - //加载分页数据 | ||
| 222 | - this.getNewSearchResultData() | 238 | + async dealSameContent(count:number){ |
| 239 | + this.tempList.forEach(async (tempValue) => { | ||
| 240 | + if(StringUtils.isNotEmpty(tempValue.sameContentListJson)){ | ||
| 241 | + let data: contentListParams = { | ||
| 242 | + contentList: [] | ||
| 223 | } | 243 | } |
| 224 | - } else if (this.count <= 10 && resultData.list.length > 0) { | ||
| 225 | - if (!this.isLoading) { | ||
| 226 | - //加载分页数据 | ||
| 227 | - this.getNewSearchResultData() | 244 | + let resultData : SearchDescription[] = JSON.parse(tempValue.sameContentListJson) as SearchDescription[] |
| 245 | + if(resultData!=null){ | ||
| 246 | + resultData.forEach((item) => { | ||
| 247 | + data.contentList.push({ | ||
| 248 | + contentId: item.id + '', | ||
| 249 | + contentType: Number.parseInt(item.type) | ||
| 250 | + }) | ||
| 251 | + }) | ||
| 252 | + | ||
| 253 | + let newValue = await SearcherAboutDataModel.getInteractListData(data, getContext(this)) | ||
| 254 | + newValue.forEach((item) => { | ||
| 255 | + resultData.forEach((data) => { | ||
| 256 | + if (item.contentId == data.id) { | ||
| 257 | + data.collectNum = item.collectNum + "" | ||
| 258 | + data.commentNum = item.commentNum + "" | ||
| 259 | + data.likeNum = item.likeNum + "" | ||
| 260 | + data.readNum = item.readNum + "" | ||
| 261 | + data.shareNum = item.shareNum + "" | ||
| 262 | + } | ||
| 263 | + }) | ||
| 264 | + }) | ||
| 265 | + let creatorIdList: string[] = [] | ||
| 266 | + resultData.forEach((value:SearchDescription) => { | ||
| 267 | + creatorIdList.push(value.creatorId) | ||
| 268 | + }) | ||
| 269 | + let rem = await SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}) | ||
| 270 | + resultData.forEach((value) => { | ||
| 271 | + let photos: FullColumnImgUrlDTO[] = [] | ||
| 272 | + value.appStyleImages.split("&&").forEach((value) => { | ||
| 273 | + const resizeParams = this.extractResizeParams(value) | ||
| 274 | + photos.push({ fullUrl: value,weight:resizeParams.width,height:resizeParams.height, } as FullColumnImgUrlDTO) | ||
| 275 | + }) | ||
| 276 | + let contentDTO = this.dataTransform2(rem,value, photos); | ||
| 277 | + tempValue.sameContentList.push(contentDTO) | ||
| 278 | + }) | ||
| 228 | } | 279 | } |
| 229 | } | 280 | } |
| 230 | - }).catch((err: Error) => { | ||
| 231 | - console.log(TAG, "请求失败") | ||
| 232 | - this.isLoading = false | ||
| 233 | - this.count = this.count === -1 ? 0 : this.count | ||
| 234 | }) | 281 | }) |
| 282 | + | ||
| 283 | + this.tempList.forEach((value) => { | ||
| 284 | + this.data.push(value) | ||
| 285 | + }) | ||
| 286 | + this.tempList = [] | ||
| 287 | + this.data.notifyDataReload() | ||
| 288 | + this.count = this.data.totalCount() | ||
| 289 | + if (this.count < count) { | ||
| 290 | + this.curPageNum++ | ||
| 291 | + } else { | ||
| 292 | + this.hasMore = false | ||
| 293 | + } | ||
| 294 | + this.isLoading = false | ||
| 235 | } | 295 | } |
| 236 | 296 | ||
| 237 | build() { | 297 | build() { |
| @@ -258,6 +318,8 @@ export struct SearchResultContentComponent { | @@ -258,6 +318,8 @@ export struct SearchResultContentComponent { | ||
| 258 | Column() { | 318 | Column() { |
| 259 | if (this.searchType == "activity") { | 319 | if (this.searchType == "activity") { |
| 260 | ActivityItemComponent({ contentDTO: item }) | 320 | ActivityItemComponent({ contentDTO: item }) |
| 321 | + }else if(item.sameContentList != null && item.sameContentList.length > 0){ | ||
| 322 | + MoreComponent({ contentDTO: item }) | ||
| 261 | } else { | 323 | } else { |
| 262 | CardParser({compDTO:new CompDTO, contentDTO: item }) | 324 | CardParser({compDTO:new CompDTO, contentDTO: item }) |
| 263 | } | 325 | } |
| @@ -284,7 +346,6 @@ export struct SearchResultContentComponent { | @@ -284,7 +346,6 @@ export struct SearchResultContentComponent { | ||
| 284 | .onReachEnd(() => { | 346 | .onReachEnd(() => { |
| 285 | console.log(TAG, "触底了"); | 347 | console.log(TAG, "触底了"); |
| 286 | if (!this.isLoading) { | 348 | if (!this.isLoading) { |
| 287 | - //加载分页数据 | ||
| 288 | this.getNewSearchResultData() | 349 | this.getNewSearchResultData() |
| 289 | } | 350 | } |
| 290 | }) | 351 | }) |
| @@ -476,10 +537,94 @@ export struct SearchResultContentComponent { | @@ -476,10 +537,94 @@ export struct SearchResultContentComponent { | ||
| 476 | contentDTO.shareFlag = value.data.shareFlag | 537 | contentDTO.shareFlag = value.data.shareFlag |
| 477 | contentDTO.contentText = value.data.contentText | 538 | contentDTO.contentText = value.data.contentText |
| 478 | return contentDTO; | 539 | return contentDTO; |
| 540 | + } | ||
| 479 | 541 | ||
| 542 | + private dataTransform2(rem:CreatorDetailResponseItem[],value: SearchDescription, photos: FullColumnImgUrlDTO[]): ContentDTO { | ||
| 543 | + let rmhInfo = this.getRmhInfo2(rem,value) | ||
| 544 | + console.log('获取photos',JSON.stringify(photos)) | ||
| 545 | + console.log('获取value2',JSON.stringify(value)) | ||
| 546 | + let contentDTO = new ContentDTO(); | ||
| 547 | + contentDTO.appStyle = value.appStyle + "" | ||
| 548 | + contentDTO.cityCode = value.cityCode | ||
| 549 | + contentDTO.coverSize = "" | ||
| 550 | + contentDTO.coverType = value.type == "5" ? 1 : -1 | ||
| 551 | + contentDTO.coverUrl = | ||
| 552 | + this.searchType == "activity" ? value.zhChannelPageImg : value.appStyleImages.split("&&")[0]; | ||
| 553 | + contentDTO.description = value.description | ||
| 554 | + contentDTO.districtCode = value.districtCode | ||
| 555 | + contentDTO.endTime = value.endTime | ||
| 556 | + contentDTO.hImageUrl = "" | ||
| 557 | + contentDTO.heatValue = "" | ||
| 558 | + contentDTO.innerUrl = "" | ||
| 559 | + contentDTO.landscape = Number.parseInt(value.landscape) | ||
| 560 | + contentDTO.linkUrl = value.linkUrl | ||
| 561 | + contentDTO.openLikes = Number.parseInt(value.openLikes) | ||
| 562 | + contentDTO.openUrl = "" | ||
| 563 | + contentDTO.pageId = value.pageId | ||
| 564 | + contentDTO.programAuth = "" | ||
| 565 | + contentDTO.programId = "" | ||
| 566 | + contentDTO.programName = "" | ||
| 567 | + contentDTO.programSource = -1 | ||
| 568 | + contentDTO.programType = Number.parseInt(value.status) | ||
| 569 | + contentDTO.provinceCode = value.provinceCode | ||
| 570 | + contentDTO.showTitleEd = value.showTitleEd | ||
| 571 | + contentDTO.showTitleIng = value.showTitleIng | ||
| 572 | + contentDTO.showTitleNo = value.showTitleNo | ||
| 573 | + contentDTO.startTime = value.startTime | ||
| 574 | + contentDTO.subType = "" | ||
| 575 | + contentDTO.subtitle = "" | ||
| 576 | + contentDTO.title = value.title | ||
| 577 | + contentDTO.vImageUrl = "" | ||
| 578 | + contentDTO.screenType = "" | ||
| 579 | + contentDTO.source = StringUtils.isEmpty(value.creatorName) ? value.sourceName : value.creatorName | ||
| 580 | + contentDTO.objectId = value.id | ||
| 581 | + contentDTO.objectType = value.type | ||
| 582 | + contentDTO.channelId = value.channelId | ||
| 583 | + contentDTO.relId = value.relId | ||
| 584 | + contentDTO.relType = value.relType | ||
| 585 | + contentDTO.newsTitle = value.titleLiteral; | ||
| 586 | + contentDTO.publishTime = | ||
| 587 | + StringUtils.isNotEmpty(value.firstPublishTime) ? value.firstPublishTime : value.publishTime | ||
| 588 | + contentDTO.visitorComment = -1 | ||
| 589 | + contentDTO.fullColumnImgUrls = photos | ||
| 590 | + contentDTO.newsSummary = "" | ||
| 591 | + contentDTO.hasMore = -1 | ||
| 592 | + contentDTO.slideShows = [] | ||
| 593 | + contentDTO.voiceInfo = {} as VoiceInfoDTO | ||
| 594 | + contentDTO.tagWord = -1 | ||
| 595 | + contentDTO.isSelect = true | ||
| 596 | + contentDTO.rmhInfo = {} as RmhInfoDTO | ||
| 597 | + contentDTO.photoNum = -1 | ||
| 598 | + contentDTO.liveInfo = {} as LiveInfoDTO; | ||
| 599 | + contentDTO.videoInfo = { | ||
| 600 | + videoDuration: Number.parseInt(value.duration) | ||
| 601 | + } as VideoInfoDTO; | ||
| 602 | + | ||
| 603 | + let interact = new InteractDataDTO() | ||
| 604 | + interact.collectNum = value.collectNum | ||
| 605 | + interact.commentNum = value.commentNum | ||
| 606 | + interact.contentId = value.id | ||
| 607 | + interact.contentType = Number.parseInt(value.type) | ||
| 608 | + interact.likeNum = value.likeNum | ||
| 609 | + interact.readNum = Number.parseInt(value.readNum) | ||
| 610 | + interact.shareNum = Number.parseInt(value.shareNum) | ||
| 611 | + contentDTO.interactData = interact | ||
| 612 | + contentDTO.corner = '' | ||
| 613 | + contentDTO.rmhPlatform = 0 | ||
| 614 | + contentDTO.newTags = '' | ||
| 615 | + contentDTO.isSearch = true | ||
| 616 | + contentDTO.publishTimestamp = "" | ||
| 617 | + contentDTO.bottomNavId = ''; | ||
| 618 | + contentDTO.openType = ''; | ||
| 619 | + contentDTO.extra = ''; | ||
| 620 | + contentDTO.titleShow = value.type == "5" ? 1 : 0; | ||
| 621 | + contentDTO.rmhInfo = rmhInfo | ||
| 622 | + contentDTO.shareFlag = value.shareFlag | ||
| 623 | + contentDTO.contentText = value.contentText | ||
| 624 | + return contentDTO; | ||
| 625 | + } | ||
| 480 | 626 | ||
| 481 | 627 | ||
| 482 | - } | ||
| 483 | // 搜索数据转化rmhInfo | 628 | // 搜索数据转化rmhInfo |
| 484 | private getRmhInfo(rem:CreatorDetailResponseItem[],value:SearchResultContentItem){ | 629 | private getRmhInfo(rem:CreatorDetailResponseItem[],value:SearchResultContentItem){ |
| 485 | let obj = value.data | 630 | let obj = value.data |
| @@ -535,6 +680,65 @@ export struct SearchResultContentComponent { | @@ -535,6 +680,65 @@ export struct SearchResultContentComponent { | ||
| 535 | } | 680 | } |
| 536 | return rmhInfo | 681 | return rmhInfo |
| 537 | } | 682 | } |
| 683 | + | ||
| 684 | + // 搜索数据转化rmhInfo | ||
| 685 | + private getRmhInfo2(rem:CreatorDetailResponseItem[],value:SearchDescription){ | ||
| 686 | + let obj = value | ||
| 687 | + let rmhInfo:RmhInfoDTO = { | ||
| 688 | + rmhHeadUrl:obj.headerPhotoUrl, | ||
| 689 | + rmhName:obj.creatorName, | ||
| 690 | + rmhId:obj.creatorId, | ||
| 691 | + authIcon:obj.authIcon, | ||
| 692 | + authTitle: obj.authTitle, | ||
| 693 | + authTitle2: '', | ||
| 694 | + banControl: 0, | ||
| 695 | + cnIsAttention: 0, | ||
| 696 | + cnAttention: 0, | ||
| 697 | + cnlsComment: 0, | ||
| 698 | + cnlsLike: 0, | ||
| 699 | + cnMainControl: 0, | ||
| 700 | + cnShareControl: 0, | ||
| 701 | + cnIsComment: 0, | ||
| 702 | + cnIsLike:0, | ||
| 703 | + posterShareControl: 0, | ||
| 704 | + rmhDesc: obj.introduction, | ||
| 705 | + userId: obj.userId, | ||
| 706 | + userType: obj.userType, | ||
| 707 | + honoraryIcon:'' | ||
| 708 | + } | ||
| 709 | + if(rem.length>0){ | ||
| 710 | + rem.forEach(item=>{ | ||
| 711 | + if(item.creatorId === obj.creatorId){ | ||
| 712 | + rmhInfo = { | ||
| 713 | + rmhHeadUrl:item.headPhotoUrl, | ||
| 714 | + rmhName:item.userName, | ||
| 715 | + rmhId:item.creatorId, | ||
| 716 | + authIcon:item.authIcon, | ||
| 717 | + authTitle: item.authTitle, | ||
| 718 | + authTitle2: '', | ||
| 719 | + banControl: 0, | ||
| 720 | + cnIsAttention:item.isAttention, | ||
| 721 | + cnAttention: 0, | ||
| 722 | + cnlsComment: 0, | ||
| 723 | + cnlsLike: 0, | ||
| 724 | + cnMainControl: 0, | ||
| 725 | + cnShareControl: 0, | ||
| 726 | + cnIsComment: 0, | ||
| 727 | + cnIsLike:0, | ||
| 728 | + posterShareControl: 0, | ||
| 729 | + rmhDesc: item.introduction, | ||
| 730 | + userId: item.userId, | ||
| 731 | + userType: item.userType, | ||
| 732 | + honoraryIcon:'' | ||
| 733 | + } | ||
| 734 | + } | ||
| 735 | + }) | ||
| 736 | + } | ||
| 737 | + return rmhInfo | ||
| 738 | + } | ||
| 739 | + | ||
| 740 | + | ||
| 741 | + | ||
| 538 | private extractResizeParams(url: string) { | 742 | private extractResizeParams(url: string) { |
| 539 | const heightRegex = /h_(\d+)/; // 匹配高度参数,如h_450 | 743 | const heightRegex = /h_(\d+)/; // 匹配高度参数,如h_450 |
| 540 | const widthRegex = /w_(\d+)/; // 匹配宽度参数,如w_800 | 744 | const widthRegex = /w_(\d+)/; // 匹配宽度参数,如w_800 |
| @@ -178,43 +178,43 @@ export struct LikeComponent { | @@ -178,43 +178,43 @@ export struct LikeComponent { | ||
| 178 | .width(24) | 178 | .width(24) |
| 179 | .height(24) | 179 | .height(24) |
| 180 | if (this.likeCount > 0){ | 180 | if (this.likeCount > 0){ |
| 181 | - RelativeContainer() { | ||
| 182 | - Image(this.likeStatus ? $r('app.media.ic_like_back_Select') : $r('app.media.ic_like_back')) | ||
| 183 | - .objectFit(ImageFit.Fill) | ||
| 184 | - .resizable({ | ||
| 185 | - slice: { | ||
| 186 | - top: 1, | ||
| 187 | - left: 20, | ||
| 188 | - right: 1, | ||
| 189 | - bottom: 1 | ||
| 190 | - } | ||
| 191 | - }) | ||
| 192 | - .alignRules({ | ||
| 193 | - top: { anchor: "Text", align: VerticalAlign.Top }, | ||
| 194 | - left: { anchor: "Text", align: HorizontalAlign.Start }, | ||
| 195 | - right: { anchor: "Text", align: HorizontalAlign.End }, | ||
| 196 | - bottom: { anchor: "Text", align: VerticalAlign.Bottom }, | ||
| 197 | - }) | ||
| 198 | - .id("Image") | 181 | + RelativeContainer() { |
| 182 | + Image(this.likeStatus ? $r('app.media.ic_like_back_Select') : $r('app.media.ic_like_back')) | ||
| 183 | + .objectFit(ImageFit.Fill) | ||
| 184 | + .resizable({ | ||
| 185 | + slice: { | ||
| 186 | + top: 1, | ||
| 187 | + left: 20, | ||
| 188 | + right: 1, | ||
| 189 | + bottom: 1 | ||
| 190 | + } | ||
| 191 | + }) | ||
| 192 | + .alignRules({ | ||
| 193 | + top: { anchor: "Text", align: VerticalAlign.Top }, | ||
| 194 | + left: { anchor: "Text", align: HorizontalAlign.Start }, | ||
| 195 | + right: { anchor: "Text", align: HorizontalAlign.End }, | ||
| 196 | + bottom: { anchor: "Text", align: VerticalAlign.Bottom }, | ||
| 197 | + }) | ||
| 198 | + .id("Image") | ||
| 199 | 199 | ||
| 200 | - Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))// Text("44444444") | ||
| 201 | - .fontSize(8) | ||
| 202 | - .fontColor('#ffffff')// .backgroundColor('#ED2800') | ||
| 203 | - .height(12) | ||
| 204 | - .textAlign(TextAlign.Center) | ||
| 205 | - .alignRules({ | ||
| 206 | - top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 207 | - left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 208 | - })/*动态计算文字宽度*/ | ||
| 209 | - .width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) + | ||
| 210 | - 12)// .backgroundColor(Color.Green) | ||
| 211 | - .id("Text") | ||
| 212 | - .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden) | 200 | + Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))// Text("44444444") |
| 201 | + .fontSize(8) | ||
| 202 | + .fontColor('#ffffff')// .backgroundColor('#ED2800') | ||
| 203 | + .height(12) | ||
| 204 | + .textAlign(TextAlign.Center) | ||
| 205 | + .alignRules({ | ||
| 206 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 207 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 208 | + })/*动态计算文字宽度*/ | ||
| 209 | + .width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) + | ||
| 210 | + 12)// .backgroundColor(Color.Green) | ||
| 211 | + .id("Text") | ||
| 212 | + .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden) | ||
| 213 | + } | ||
| 214 | + .offset({ | ||
| 215 | + x: 12 | ||
| 216 | + }) | ||
| 213 | } | 217 | } |
| 214 | - .offset({ | ||
| 215 | - x: 12 | ||
| 216 | - }) | ||
| 217 | - } | ||
| 218 | 218 | ||
| 219 | // Column() { | 219 | // Column() { |
| 220 | // // Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default')) | 220 | // // Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default')) |
| @@ -259,19 +259,21 @@ export struct LikeComponent { | @@ -259,19 +259,21 @@ export struct LikeComponent { | ||
| 259 | .width(36) | 259 | .width(36) |
| 260 | .height(36) | 260 | .height(36) |
| 261 | .borderRadius(18) | 261 | .borderRadius(18) |
| 262 | - .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : '#FFF5F5F5') | 262 | + .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5') |
| 263 | Row() { | 263 | Row() { |
| 264 | Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) | 264 | Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) |
| 265 | .fontSize(8) | 265 | .fontSize(8) |
| 266 | .fontColor(Color.White) | 266 | .fontColor(Color.White) |
| 267 | - .padding({ left: 4, right: 2 }) | 267 | + .padding({ left: 8, right: 2 }) |
| 268 | } | 268 | } |
| 269 | .height(12) | 269 | .height(12) |
| 270 | .alignItems(VerticalAlign.Center) | 270 | .alignItems(VerticalAlign.Center) |
| 271 | - .position({ x: '100%', }) | 271 | + .position({ x: '100%', y: 10 }) |
| 272 | .markAnchor({ x: '100%' }) | 272 | .markAnchor({ x: '100%' }) |
| 273 | .backgroundImage($r('app.media.ic_like_back')) | 273 | .backgroundImage($r('app.media.ic_like_back')) |
| 274 | - .backgroundImageSize(ImageSize.Auto) | 274 | + .backgroundImageSize({height: 13}) |
| 275 | + .width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) + | ||
| 276 | + 12) | ||
| 275 | .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden) | 277 | .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden) |
| 276 | } | 278 | } |
| 277 | .width(36) | 279 | .width(36) |
| @@ -88,8 +88,7 @@ export struct OperRowListView { | @@ -88,8 +88,7 @@ export struct OperRowListView { | ||
| 88 | @State dialogController: CustomDialogController | null = null; | 88 | @State dialogController: CustomDialogController | null = null; |
| 89 | 89 | ||
| 90 | async aboutToAppear() { | 90 | async aboutToAppear() { |
| 91 | - console.info(TAG, '22222----', this.styleType) | ||
| 92 | - console.info(TAG, '3333----', this.needLike) | 91 | + console.info(TAG, 'this.needLike', this.needLike) |
| 93 | this.handleStyle() | 92 | this.handleStyle() |
| 94 | this.onDetailUpdated() | 93 | this.onDetailUpdated() |
| 95 | EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => { | 94 | EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => { |
| @@ -108,7 +107,7 @@ export struct OperRowListView { | @@ -108,7 +107,7 @@ export struct OperRowListView { | ||
| 108 | } | 107 | } |
| 109 | 108 | ||
| 110 | async onDetailUpdated() { | 109 | async onDetailUpdated() { |
| 111 | - console.info(TAG, '111111----', this.styleType) | 110 | + console.info(TAG, 'this.styleType', this.styleType) |
| 112 | this.handleStyle() | 111 | this.handleStyle() |
| 113 | if (!this.contentDetailData) { | 112 | if (!this.contentDetailData) { |
| 114 | return | 113 | return |
| @@ -199,7 +198,7 @@ export struct OperRowListView { | @@ -199,7 +198,7 @@ export struct OperRowListView { | ||
| 199 | .padding({ | 198 | .padding({ |
| 200 | top: 10, | 199 | top: 10, |
| 201 | // bottom: 10 | 200 | // bottom: 10 |
| 202 | - bottom: `${this.bottomSafeHeight}px` | 201 | + bottom: px2vp(this.bottomSafeHeight) |
| 203 | // bottom: 50 | 202 | // bottom: 50 |
| 204 | }) | 203 | }) |
| 205 | } | 204 | } |
| @@ -380,7 +379,7 @@ export struct OperRowListView { | @@ -380,7 +379,7 @@ export struct OperRowListView { | ||
| 380 | { | 379 | { |
| 381 | contentId: this.contentDetailData?.newsId + '', | 380 | contentId: this.contentDetailData?.newsId + '', |
| 382 | contentType: this.contentDetailData?.newsType + '', | 381 | contentType: this.contentDetailData?.newsType + '', |
| 383 | - contentRelId: this.contentDetailData?.reLInfo?.relId + '', | 382 | + contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '', |
| 384 | } | 383 | } |
| 385 | ] | 384 | ] |
| 386 | } | 385 | } |
| @@ -397,7 +396,6 @@ export struct OperRowListView { | @@ -397,7 +396,6 @@ export struct OperRowListView { | ||
| 397 | * 收藏、取消收藏 | 396 | * 收藏、取消收藏 |
| 398 | */ | 397 | */ |
| 399 | async toggleCollectStatus() { | 398 | async toggleCollectStatus() { |
| 400 | - console.log(TAG, '收藏点击') | ||
| 401 | // 未登录,跳转登录 | 399 | // 未登录,跳转登录 |
| 402 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | 400 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 403 | console.log(TAG, '收藏点击,登录', user_id) | 401 | console.log(TAG, '收藏点击,登录', user_id) |
| @@ -411,15 +409,13 @@ export struct OperRowListView { | @@ -411,15 +409,13 @@ export struct OperRowListView { | ||
| 411 | contentList: [{ | 409 | contentList: [{ |
| 412 | contentId: this.contentDetailData?.newsId + '', | 410 | contentId: this.contentDetailData?.newsId + '', |
| 413 | contentType: this.contentDetailData?.newsType + '', | 411 | contentType: this.contentDetailData?.newsType + '', |
| 414 | - relType: this.contentDetailData?.reLInfo?.relType + '', | ||
| 415 | - contentRelId: this.contentDetailData?.reLInfo?.relId + '', | 412 | + relType: this.contentDetailData?.reLInfo?.relType || '' + '', |
| 413 | + contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '', | ||
| 416 | }], | 414 | }], |
| 417 | 415 | ||
| 418 | } | 416 | } |
| 419 | - // console.log(TAG, '收藏点击', JSON.stringify(params)) | 417 | + console.log(TAG, '收藏点击', JSON.stringify(params)) |
| 420 | PageRepository.postExecuteCollectRecord(params).then(res => { | 418 | PageRepository.postExecuteCollectRecord(params).then(res => { |
| 421 | - console.log(TAG, '收藏点击 res', JSON.stringify(res)) | ||
| 422 | - console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) | ||
| 423 | if (this.newsStatusOfUser) { | 419 | if (this.newsStatusOfUser) { |
| 424 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 | 420 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 |
| 425 | if (this.newsStatusOfUser.collectStatus === 1) { | 421 | if (this.newsStatusOfUser.collectStatus === 1) { |
| @@ -427,6 +423,7 @@ export struct OperRowListView { | @@ -427,6 +423,7 @@ export struct OperRowListView { | ||
| 427 | } | 423 | } |
| 428 | this.queryContentInteractCount() | 424 | this.queryContentInteractCount() |
| 429 | } | 425 | } |
| 426 | + console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) | ||
| 430 | }) | 427 | }) |
| 431 | 428 | ||
| 432 | } | 429 | } |
| @@ -7,7 +7,7 @@ import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageB | @@ -7,7 +7,7 @@ import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageB | ||
| 7 | import MinePageDatasModel from '../model/MinePageDatasModel'; | 7 | import MinePageDatasModel from '../model/MinePageDatasModel'; |
| 8 | import { EmptyComponent } from '../components/view/EmptyComponent'; | 8 | import { EmptyComponent } from '../components/view/EmptyComponent'; |
| 9 | import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; | 9 | import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; |
| 10 | -import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | 10 | +import { TrackingPageBrowse, TrackConstants, TrackingButton } from 'wdTracking/Index'; |
| 11 | 11 | ||
| 12 | const TAG = "MineHomePage" | 12 | const TAG = "MineHomePage" |
| 13 | 13 | ||
| @@ -454,6 +454,9 @@ struct MineHomePage { | @@ -454,6 +454,9 @@ struct MineHomePage { | ||
| 454 | }, 1000); | 454 | }, 1000); |
| 455 | //route 跳转写这里 TODO | 455 | //route 跳转写这里 TODO |
| 456 | WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage) | 456 | WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage) |
| 457 | + | ||
| 458 | + //编辑资料只有个人主页 | ||
| 459 | + TrackingButton.click('mainPersonalHomePageEditorialMaterial',TrackConstants.PageName.Main_Personal,TrackConstants.PageName.Main_Personal) | ||
| 457 | } | 460 | } |
| 458 | } | 461 | } |
| 459 | getUserInfo(){ | 462 | getUserInfo(){ |
| 1 | import { MessageListUI } from '../components/mine/message/MessageListUI'; | 1 | import { MessageListUI } from '../components/mine/message/MessageListUI'; |
| 2 | - | 2 | +import {TrackConstants}from 'wdTracking/Index' |
| 3 | +import TrackingPageBrowseUtils from '../utils/TrackingPageBrowseUtils' | ||
| 3 | @Entry | 4 | @Entry |
| 4 | @Component | 5 | @Component |
| 5 | struct MineMessagePage { | 6 | struct MineMessagePage { |
| 6 | 7 | ||
| 8 | + onPageShow(): void { | ||
| 9 | + TrackingPageBrowseUtils.TrackingPageBrowseExposureStart() | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | + onPageHide(): void { | ||
| 13 | + TrackingPageBrowseUtils.TrackingPageBrowseExposureEnd(TrackConstants.PageName.My_Notification,TrackConstants.PageName.My_Notification) | ||
| 14 | + } | ||
| 15 | + | ||
| 7 | build() { | 16 | build() { |
| 8 | Column(){ | 17 | Column(){ |
| 9 | MessageListUI() | 18 | MessageListUI() |
| @@ -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 | } |
| @@ -34,8 +34,7 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | @@ -34,8 +34,7 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | ||
| 34 | intentVersion: '1.0.1', | 34 | intentVersion: '1.0.1', |
| 35 | identifier, | 35 | identifier, |
| 36 | intentActionInfo: { | 36 | intentActionInfo: { |
| 37 | - actionMode, | ||
| 38 | - currentPercentage: 50, | 37 | + actionMode |
| 39 | //目前不考虑发生时段 | 38 | //目前不考虑发生时段 |
| 40 | // executedTimeSlots: { | 39 | // executedTimeSlots: { |
| 41 | // executedEndTime: new Date().getTime(), | 40 | // executedEndTime: new Date().getTime(), |
| @@ -91,8 +90,7 @@ export function viewBlogItemInsightIntentShare(context: common.UIAbilityContext, | @@ -91,8 +90,7 @@ export function viewBlogItemInsightIntentShare(context: common.UIAbilityContext, | ||
| 91 | intentVersion: '1.0.1', | 90 | intentVersion: '1.0.1', |
| 92 | identifier, | 91 | identifier, |
| 93 | intentActionInfo: { | 92 | intentActionInfo: { |
| 94 | - actionMode: ActionMode.EXECUTED, | ||
| 95 | - currentPercentage: 50, | 93 | + actionMode: ActionMode.EXECUTED |
| 96 | }, | 94 | }, |
| 97 | intentEntityInfo: { | 95 | intentEntityInfo: { |
| 98 | entityName: 'Blog', | 96 | entityName: 'Blog', |
| @@ -138,8 +136,7 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en | @@ -138,8 +136,7 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en | ||
| 138 | intentVersion: '1.0.1', | 136 | intentVersion: '1.0.1', |
| 139 | identifier: generateUUID(), | 137 | identifier: generateUUID(), |
| 140 | intentActionInfo: { | 138 | intentActionInfo: { |
| 141 | - actionMode: ActionMode.EXECUTED, | ||
| 142 | - currentPercentage: 50, | 139 | + actionMode: ActionMode.EXECUTED |
| 143 | }, | 140 | }, |
| 144 | intentEntityInfo: { | 141 | intentEntityInfo: { |
| 145 | entityName: 'Column', | 142 | entityName: 'Column', |
| @@ -4,7 +4,87 @@ import PageModel from '../viewmodel/PageModel'; | @@ -4,7 +4,87 @@ import PageModel from '../viewmodel/PageModel'; | ||
| 4 | import PageHelper from '../viewmodel/PageHelper'; | 4 | import PageHelper from '../viewmodel/PageHelper'; |
| 5 | import PageAdModel from '../viewmodel/PageAdvModel'; | 5 | import PageAdModel from '../viewmodel/PageAdvModel'; |
| 6 | import { LoadStatus } from '../components/refresh/RefreshLayoutBean'; | 6 | import { LoadStatus } from '../components/refresh/RefreshLayoutBean'; |
| 7 | +import { Logger } from 'wdKit/Index'; | ||
| 8 | + | ||
| 9 | +/***********新的下拉、上拉手势 start **********/ | ||
| 10 | +export function onActionStart(pageModel: PageModel, pageAdvModel: PageAdModel, event?: GestureEvent) { | ||
| 11 | + if (event === undefined) { | ||
| 12 | + return | ||
| 13 | + } | ||
| 14 | + pageModel.downY = event.offsetY; | ||
| 15 | + pageModel.lastMoveY = event.offsetY; | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +export function onActionUpdate(pageModel: PageModel, pageAdvModel: PageAdModel, event?: GestureEvent) { | ||
| 19 | + if (event === undefined) { | ||
| 20 | + return | ||
| 21 | + } | ||
| 22 | + if ((pageModel.isRefreshing === true) || (pageModel.isLoading === true)) { | ||
| 23 | + return; | ||
| 24 | + } | ||
| 25 | + let isDownPull = event.offsetY - pageModel.lastMoveY > 0; | ||
| 26 | + if (((isDownPull === true) || (pageModel.isPullRefreshOperation === true)) && | ||
| 27 | + (pageModel.isCanLoadMore === false)) { | ||
| 28 | + actionUpdatePullRefresh(pageModel, event); | ||
| 29 | + } else { | ||
| 30 | + actionUpdateLoadMore(pageModel, event); | ||
| 31 | + } | ||
| 32 | + pageModel.lastMoveY = event.offsetY; | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +export function onActionEnd(pageModel: PageModel, pageAdvModel: PageAdModel) { | ||
| 36 | + if ((pageModel.isRefreshing === true) || (pageModel.isLoading === true)) { | ||
| 37 | + return; | ||
| 38 | + } | ||
| 39 | + if ((pageModel.isPullRefreshOperation === true)) { | ||
| 40 | + touchUpPullRefresh(pageModel, pageAdvModel); | ||
| 41 | + } else { | ||
| 42 | + // touchUpLoadMore(pageModel); | ||
| 43 | + } | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +export function actionUpdatePullRefresh(pageModel: PageModel, event: GestureEvent) { | ||
| 47 | + if (pageModel.startIndex === 0) { | ||
| 48 | + pageModel.isPullRefreshOperation = true; | ||
| 49 | + let height = vp2px(Const.CUSTOM_REFRESH_DECIDE_HEIGHT); | ||
| 50 | + pageModel.offsetY = event.offsetY - pageModel.downY; | ||
| 51 | + if (pageModel.offsetY >= height) { | ||
| 52 | + pullRefreshState(pageModel, RefreshState.Release); | ||
| 53 | + pageModel.offsetY = height + pageModel.offsetY * Const.Y_OFF_SET_COEFFICIENT; | ||
| 54 | + } else { | ||
| 55 | + pullRefreshState(pageModel, RefreshState.DropDown); | ||
| 56 | + } | ||
| 57 | + if (pageModel.offsetY < 0) { | ||
| 58 | + pageModel.offsetY = 0; | ||
| 59 | + pageModel.isPullRefreshOperation = false; | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +export function actionUpdateLoadMore(model: PageModel, event: GestureEvent) { | ||
| 65 | + // list size +1 | ||
| 66 | + if (model.endIndex >= model.compList.totalCount() - 3 && model.endIndex <= model.compList.totalCount()) { | ||
| 67 | + // model.offsetY = event.touches[0].y - model.downY; | ||
| 68 | + // if (Math.abs(model.offsetY) > vp2px(model.pullUpLoadHeight) / 2) { | ||
| 69 | + // model.isCanLoadMore = true; | ||
| 70 | + // model.isVisiblePullUpLoad = true; | ||
| 71 | + // model.offsetY = -vp2px(model.pullUpLoadHeight) + model.offsetY * Const.Y_OFF_SET_COEFFICIENT; | ||
| 72 | + // } | ||
| 73 | + | ||
| 74 | + // 不用分页动画,直接预加载 | ||
| 75 | + model.isCanLoadMore = true; | ||
| 76 | + model.isVisiblePullUpLoad = true; | ||
| 77 | + touchUpLoadMore(model); | ||
| 78 | + } | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +/***********新的下拉、上拉手势 end **********/ | ||
| 82 | + | ||
| 83 | + | ||
| 7 | //下拉刷新上拉加载更多组件 | 84 | //下拉刷新上拉加载更多组件 |
| 85 | +/** | ||
| 86 | + * @deprecated | ||
| 87 | + */ | ||
| 8 | export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, event: TouchEvent) { | 88 | export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, event: TouchEvent) { |
| 9 | switch (event.type) { | 89 | switch (event.type) { |
| 10 | case TouchType.Down: | 90 | case TouchType.Down: |
| @@ -16,7 +96,8 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, | @@ -16,7 +96,8 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, | ||
| 16 | return; | 96 | return; |
| 17 | } | 97 | } |
| 18 | let isDownPull = event.touches[0].y - pageModel.lastMoveY > 0; | 98 | let isDownPull = event.touches[0].y - pageModel.lastMoveY > 0; |
| 19 | - if (((isDownPull === true) || (pageModel.isPullRefreshOperation === true)) && (pageModel.isCanLoadMore === false)) { | 99 | + if (((isDownPull === true) || (pageModel.isPullRefreshOperation === true)) && |
| 100 | + (pageModel.isCanLoadMore === false)) { | ||
| 20 | // Finger movement, processing pull-down refresh. | 101 | // Finger movement, processing pull-down refresh. |
| 21 | touchMovePullRefresh(pageModel, event); | 102 | touchMovePullRefresh(pageModel, event); |
| 22 | } else { | 103 | } else { |
| @@ -44,6 +125,9 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, | @@ -44,6 +125,9 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, | ||
| 44 | } | 125 | } |
| 45 | } | 126 | } |
| 46 | 127 | ||
| 128 | +/** | ||
| 129 | + * @deprecated | ||
| 130 | + */ | ||
| 47 | export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) { | 131 | export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) { |
| 48 | if (pageModel.startIndex === 0) { | 132 | if (pageModel.startIndex === 0) { |
| 49 | pageModel.isPullRefreshOperation = true; | 133 | pageModel.isPullRefreshOperation = true; |
| 1 | +import { DateTimeUtils } from 'wdKit/Index'; | ||
| 2 | +import { ParamType, TrackingPageBrowse } from 'wdTracking/Index'; | ||
| 3 | + | ||
| 4 | +class TrackingPageBrowseUtils { | ||
| 5 | + private static instance: TrackingPageBrowseUtils | ||
| 6 | + pageShowTime:number = 0; | ||
| 7 | + pageHideTime:number = 0; | ||
| 8 | + | ||
| 9 | + /** | ||
| 10 | + * 单例模式 | ||
| 11 | + * @returns | ||
| 12 | + */ | ||
| 13 | + public static getInstance(): TrackingPageBrowseUtils { | ||
| 14 | + if (!TrackingPageBrowseUtils.instance) { | ||
| 15 | + TrackingPageBrowseUtils.instance = new TrackingPageBrowseUtils(); | ||
| 16 | + } | ||
| 17 | + return TrackingPageBrowseUtils.instance; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + TrackingPageBrowseExposureStart(){ | ||
| 21 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + TrackingPageBrowseExposureEnd(pageId: string, pageName: string,extParams?: ParamType){ | ||
| 25 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 26 | + let duration = 0 | ||
| 27 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 28 | + TrackingPageBrowse.trackCommonPageExposureEnd(pageId,pageName,duration,extParams) | ||
| 29 | + } | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +const pageBrowseUtils = TrackingPageBrowseUtils.getInstance(); | ||
| 33 | +export default pageBrowseUtils as TrackingPageBrowseUtils |
| @@ -8,11 +8,12 @@ import { ContentDetailDTO, | @@ -8,11 +8,12 @@ import { ContentDetailDTO, | ||
| 8 | postBatchAttentionStatusResult, | 8 | postBatchAttentionStatusResult, |
| 9 | postInteractBrowsOperateParams, | 9 | postInteractBrowsOperateParams, |
| 10 | InteractDataDTO, | 10 | InteractDataDTO, |
| 11 | - FeedbackTypeBean | 11 | + FeedbackTypeBean, |
| 12 | + FeedBackParams | ||
| 12 | } from 'wdBean'; | 13 | } from 'wdBean'; |
| 13 | import { PageRepository } from '../repository/PageRepository'; | 14 | import { PageRepository } from '../repository/PageRepository'; |
| 14 | import { ArrayList } from '@kit.ArkTS'; | 15 | import { ArrayList } from '@kit.ArkTS'; |
| 15 | - | 16 | +import { ToastUtils} from 'wdKit/Index'; |
| 16 | const TAG = 'MultiPictureDetailViewModel'; | 17 | const TAG = 'MultiPictureDetailViewModel'; |
| 17 | 18 | ||
| 18 | export class MultiPictureDetailViewModel { | 19 | export class MultiPictureDetailViewModel { |
| @@ -158,15 +159,16 @@ export class MultiPictureDetailViewModel { | @@ -158,15 +159,16 @@ export class MultiPictureDetailViewModel { | ||
| 158 | }) | 159 | }) |
| 159 | } | 160 | } |
| 160 | 161 | ||
| 161 | - static async feedBackCommit(params:HashMap<String,String>): Promise<ResponseDTO> { | ||
| 162 | - return new Promise<ResponseDTO>((success, error) => { | 162 | + static async feedBackCommit(params:FeedBackParams): Promise<object> { |
| 163 | + return new Promise<object>((success, error) => { | ||
| 163 | Logger.info(TAG, `fetchDetailData start`); | 164 | Logger.info(TAG, `fetchDetailData start`); |
| 164 | - WDHttp.post(HttpUrlUtils.getHost() + HttpUrlUtils.FEEDBACK_COMMIT_PATH,params).then((resDTO: ResponseDTO) => { | ||
| 165 | - | 165 | + WDHttp.post(HttpUrlUtils.getHost() + HttpUrlUtils.FEEDBACK_COMMIT_PATH,params).then((resDTO: object) => { |
| 166 | success(resDTO); | 166 | success(resDTO); |
| 167 | + ToastUtils.shortToast('反馈成功') | ||
| 167 | }).catch((err: Error) => { | 168 | }).catch((err: Error) => { |
| 168 | Logger.error(TAG, `fetchDetailData catch, error.name : ${err.name}, error.message:${err.message}`); | 169 | Logger.error(TAG, `fetchDetailData catch, error.name : ${err.name}, error.message:${err.message}`); |
| 169 | error(err); | 170 | error(err); |
| 171 | + ToastUtils.shortToast('反馈失败') | ||
| 170 | }) | 172 | }) |
| 171 | }) | 173 | }) |
| 172 | } | 174 | } |
| @@ -5,7 +5,7 @@ export class SearchResultContentItem{ | @@ -5,7 +5,7 @@ export class SearchResultContentItem{ | ||
| 5 | resultType:string = "" | 5 | resultType:string = "" |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | -class SearchDescription{ | 8 | +export class SearchDescription{ |
| 9 | likeEnable: string = "" | 9 | likeEnable: string = "" |
| 10 | previewUri: string = "" | 10 | previewUri: string = "" |
| 11 | firstFrameImageBucket: string = "" | 11 | firstFrameImageBucket: string = "" |
| @@ -178,7 +178,7 @@ class SearchDescription{ | @@ -178,7 +178,7 @@ class SearchDescription{ | ||
| 178 | likeNum: string= "" | 178 | likeNum: string= "" |
| 179 | readNum: string= "" | 179 | readNum: string= "" |
| 180 | shareNum: string= "" | 180 | shareNum: string= "" |
| 181 | - | 181 | + sameContentList:SearchDescription[] = [] |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | @Observed | 184 | @Observed |
| @@ -33,8 +33,8 @@ export struct DetailPlayLiveCommon { | @@ -33,8 +33,8 @@ export struct DetailPlayLiveCommon { | ||
| 33 | this.relId = params?.extra?.relId || ''; | 33 | this.relId = params?.extra?.relId || ''; |
| 34 | this.relType = params?.extra?.relType || ''; | 34 | this.relType = params?.extra?.relType || ''; |
| 35 | this.contentId = params?.contentID || ''; | 35 | this.contentId = params?.contentID || ''; |
| 36 | - await this.getContentDetail() | ||
| 37 | - this.getLiveDetails() | 36 | + this.getContentDetail() |
| 37 | + | ||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | build() { | 40 | build() { |
| @@ -55,8 +55,8 @@ export struct DetailPlayLiveCommon { | @@ -55,8 +55,8 @@ export struct DetailPlayLiveCommon { | ||
| 55 | /** | 55 | /** |
| 56 | * 查询视频详情用于评论展示 | 56 | * 查询视频详情用于评论展示 |
| 57 | */ | 57 | */ |
| 58 | - async getContentDetail() { | ||
| 59 | - await this.liveViewModel.getContentDetail(this.contentId, this.relId, this.relType) | 58 | + getContentDetail() { |
| 59 | + this.liveViewModel.getContentDetail(this.contentId, this.relId, this.relType) | ||
| 60 | .then((data: Array<ContentDetailDTO>) => { | 60 | .then((data: Array<ContentDetailDTO>) => { |
| 61 | console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data)) | 61 | console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data)) |
| 62 | if (data) { | 62 | if (data) { |
| @@ -72,6 +72,8 @@ export struct DetailPlayLiveCommon { | @@ -72,6 +72,8 @@ export struct DetailPlayLiveCommon { | ||
| 72 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | 72 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') |
| 73 | this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | 73 | this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') |
| 74 | this.publishCommentModel.commentContent = '' | 74 | this.publishCommentModel.commentContent = '' |
| 75 | + | ||
| 76 | + this.getLiveDetails() | ||
| 75 | // } | 77 | // } |
| 76 | } | 78 | } |
| 77 | }) | 79 | }) |
| @@ -53,17 +53,23 @@ export struct DetailPlayLivePage { | @@ -53,17 +53,23 @@ export struct DetailPlayLivePage { | ||
| 53 | console.error(TAG, 'this.publishCommentModel', this.publishCommentModel.targetId) | 53 | console.error(TAG, 'this.publishCommentModel', this.publishCommentModel.targetId) |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | + async aboutToDisappear() { | ||
| 57 | + Logger.info(TAG, `wyj-aboutToDisappear`) | ||
| 58 | + await this.playerController?.stop() | ||
| 59 | + await this.playerController?.release() | ||
| 60 | + } | ||
| 61 | + | ||
| 56 | build() { | 62 | build() { |
| 57 | Column() { | 63 | Column() { |
| 58 | TopPlayComponent({ playerController: this.playerController }) | 64 | TopPlayComponent({ playerController: this.playerController }) |
| 59 | - .layoutWeight(211) | 65 | + .height(211) |
| 60 | TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab }) | 66 | TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab }) |
| 61 | - .layoutWeight(503) | 67 | + .layoutWeight(1) |
| 62 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | 68 | .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) |
| 63 | - | ||
| 64 | OperRowListView({ | 69 | OperRowListView({ |
| 65 | componentType: 4, | 70 | componentType: 4, |
| 66 | operationButtonList: ['comment', 'collect', 'share', 'like'], | 71 | operationButtonList: ['comment', 'collect', 'share', 'like'], |
| 72 | + styleType: 1, | ||
| 67 | contentDetailData: this.contentDetailData, | 73 | contentDetailData: this.contentDetailData, |
| 68 | publishCommentModel: this.publishCommentModel, | 74 | publishCommentModel: this.publishCommentModel, |
| 69 | showCommentIcon: false, | 75 | showCommentIcon: false, |
| @@ -79,12 +85,7 @@ export struct DetailPlayLivePage { | @@ -79,12 +85,7 @@ export struct DetailPlayLivePage { | ||
| 79 | } | 85 | } |
| 80 | .height('100%') | 86 | .height('100%') |
| 81 | .width('100%') | 87 | .width('100%') |
| 82 | - } | ||
| 83 | - | ||
| 84 | - async aboutToDisappear() { | ||
| 85 | - Logger.info(TAG, `wyj-aboutToDisappear`) | ||
| 86 | - await this.playerController?.stop() | ||
| 87 | - await this.playerController?.release() | 88 | + // 设置底部绘制延伸到导航条 |
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | onPageShowCus(): void { | 91 | onPageShowCus(): void { |
| @@ -90,7 +90,7 @@ export struct DetailDialog { | @@ -90,7 +90,7 @@ export struct DetailDialog { | ||
| 90 | }).layoutWeight(1) | 90 | }).layoutWeight(1) |
| 91 | 91 | ||
| 92 | OperRowListView({ | 92 | OperRowListView({ |
| 93 | - componentType: 1, | 93 | + componentType: 4, |
| 94 | pageComponentType: 8, | 94 | pageComponentType: 8, |
| 95 | showBackIcon: false, | 95 | showBackIcon: false, |
| 96 | operationButtonList: ['comment', 'like', 'collect', 'share'], | 96 | operationButtonList: ['comment', 'like', 'collect', 'share'], |
| @@ -31,7 +31,7 @@ export struct PlayerFullScreenView { | @@ -31,7 +31,7 @@ export struct PlayerFullScreenView { | ||
| 31 | WindowModel.shared.setWindowSystemBarEnable([]) | 31 | WindowModel.shared.setWindowSystemBarEnable([]) |
| 32 | this.timer = setInterval(() => { | 32 | this.timer = setInterval(() => { |
| 33 | this.showOperator = false | 33 | this.showOperator = false |
| 34 | - }, 5) | 34 | + }, 5000) |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | aboutToDisappear(): void { | 37 | aboutToDisappear(): void { |
| @@ -41,13 +41,20 @@ export struct PlayerFullScreenView { | @@ -41,13 +41,20 @@ export struct PlayerFullScreenView { | ||
| 41 | 41 | ||
| 42 | restartTimer() { | 42 | restartTimer() { |
| 43 | clearInterval(this.timer) | 43 | clearInterval(this.timer) |
| 44 | + this.showOperator = true | ||
| 44 | this.timer = setInterval(() => { | 45 | this.timer = setInterval(() => { |
| 45 | this.showOperator = false | 46 | this.showOperator = false |
| 46 | - }, 5) | 47 | + }, 5000) |
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | build() { | 50 | build() { |
| 50 | Stack() { | 51 | Stack() { |
| 52 | + Row() { | ||
| 53 | + }.height('100%').width('100%') | ||
| 54 | + .onClick(() => { | ||
| 55 | + this.restartTimer() | ||
| 56 | + }) | ||
| 57 | + | ||
| 51 | this.headerBuilder() | 58 | this.headerBuilder() |
| 52 | 59 | ||
| 53 | this.bottomBuilder() | 60 | this.bottomBuilder() |
| @@ -55,9 +62,7 @@ export struct PlayerFullScreenView { | @@ -55,9 +62,7 @@ export struct PlayerFullScreenView { | ||
| 55 | .zIndex(99999) | 62 | .zIndex(99999) |
| 56 | .height('100%') | 63 | .height('100%') |
| 57 | .width('100%') | 64 | .width('100%') |
| 58 | - .onClick(() => { | ||
| 59 | - this.restartTimer() | ||
| 60 | - }) | 65 | + |
| 61 | } | 66 | } |
| 62 | 67 | ||
| 63 | @Builder | 68 | @Builder |
| @@ -94,6 +99,8 @@ export struct PlayerFullScreenView { | @@ -94,6 +99,8 @@ export struct PlayerFullScreenView { | ||
| 94 | .alignItems(VerticalAlign.Center) | 99 | .alignItems(VerticalAlign.Center) |
| 95 | .justifyContent(FlexAlign.SpaceBetween) | 100 | .justifyContent(FlexAlign.SpaceBetween) |
| 96 | .padding({ left: 40, right: 40 }) | 101 | .padding({ left: 40, right: 40 }) |
| 102 | + .animation({ duration: 2000 }) | ||
| 103 | + .visibility(this.showOperator ? Visibility.Visible : Visibility.Hidden) | ||
| 97 | .linearGradient({ | 104 | .linearGradient({ |
| 98 | direction: GradientDirection.Bottom, // 渐变方向 | 105 | direction: GradientDirection.Bottom, // 渐变方向 |
| 99 | colors: [['rgba(0,0,0,0.5)', 0], | 106 | colors: [['rgba(0,0,0,0.5)', 0], |
| @@ -152,6 +159,8 @@ export struct PlayerFullScreenView { | @@ -152,6 +159,8 @@ export struct PlayerFullScreenView { | ||
| 152 | .markAnchor({ y: '100%' }) | 159 | .markAnchor({ y: '100%' }) |
| 153 | .align(Alignment.Bottom) | 160 | .align(Alignment.Bottom) |
| 154 | .padding({ left: 40, right: 40 }) | 161 | .padding({ left: 40, right: 40 }) |
| 162 | + .animation({ duration: 2000 }) | ||
| 163 | + .visibility(this.showOperator ? Visibility.Visible : Visibility.Hidden) | ||
| 155 | .linearGradient({ | 164 | .linearGradient({ |
| 156 | direction: GradientDirection.Bottom, // 渐变方向 | 165 | direction: GradientDirection.Bottom, // 渐变方向 |
| 157 | colors: [['rgba(0,0,0,0.5)', 0], | 166 | colors: [['rgba(0,0,0,0.5)', 0], |
| @@ -91,8 +91,8 @@ export struct PlayerRightView { | @@ -91,8 +91,8 @@ export struct PlayerRightView { | ||
| 91 | contentList: [{ | 91 | contentList: [{ |
| 92 | contentId: this.contentDetailData?.newsId + '', | 92 | contentId: this.contentDetailData?.newsId + '', |
| 93 | contentType: this.contentDetailData?.newsType + '', | 93 | contentType: this.contentDetailData?.newsType + '', |
| 94 | - relType: this.contentDetailData?.reLInfo?.relType + '', | ||
| 95 | - contentRelId: this.contentDetailData?.reLInfo?.relId + '', | 94 | + relType: this.contentDetailData?.reLInfo?.relType || '' + '', |
| 95 | + contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '', | ||
| 96 | }], | 96 | }], |
| 97 | 97 | ||
| 98 | } | 98 | } |
| 1 | -import { CompInfoBean, ContentDetailDTO, ContentDTO, PageInfoDTO } from 'wdBean/Index'; | 1 | +import { CompInfoBean, ContentDetailDTO, ContentDTO, PageInfoBean, PageInfoDTO } from 'wdBean/Index'; |
| 2 | import { ParamType } from './PublicParams'; | 2 | import { ParamType } from './PublicParams'; |
| 3 | +import { TrackConstants } from './TrackConstants'; | ||
| 3 | import { TrackingUtils } from './TrackingUtils'; | 4 | import { TrackingUtils } from './TrackingUtils'; |
| 4 | 5 | ||
| 5 | export class TrackParamConvert { | 6 | export class TrackParamConvert { |
| @@ -70,7 +71,7 @@ export class TrackParamConvert { | @@ -70,7 +71,7 @@ export class TrackParamConvert { | ||
| 70 | return param | 71 | return param |
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | - private static appendRecommend(detail: ContentDetailDTO, to: ParamType) { | 74 | + private static appendRecommend(detail: object, to: ParamType) { |
| 74 | 75 | ||
| 75 | //TODO: ContentDetailDTO 增加推荐字段 | 76 | //TODO: ContentDetailDTO 增加推荐字段 |
| 76 | 77 | ||
| @@ -85,4 +86,42 @@ export class TrackParamConvert { | @@ -85,4 +86,42 @@ export class TrackParamConvert { | ||
| 85 | /// 这里填写默认值,后续在action=browse时,再重写 | 86 | /// 这里填写默认值,后续在action=browse时,再重写 |
| 86 | to["duration"] = 0 | 87 | to["duration"] = 0 |
| 87 | } | 88 | } |
| 89 | + | ||
| 90 | + | ||
| 91 | + ///早晚报 专题 | ||
| 92 | + static pageInfoBean_ParamType(pageInfo: PageInfoBean) : ParamType { | ||
| 93 | + | ||
| 94 | + let topTypeString: string = ''; | ||
| 95 | + switch (pageInfo.topicInfo.topicType){ | ||
| 96 | + case 21: | ||
| 97 | + topTypeString = TrackConstants.SummaryType.Article | ||
| 98 | + break; | ||
| 99 | + case 22: | ||
| 100 | + topTypeString = TrackConstants.SummaryType.Audio | ||
| 101 | + break; | ||
| 102 | + case 23: | ||
| 103 | + topTypeString = TrackConstants.SummaryType.Live | ||
| 104 | + break; | ||
| 105 | + case 24: | ||
| 106 | + topTypeString = TrackConstants.SummaryType.Talk | ||
| 107 | + break; | ||
| 108 | + case 25: | ||
| 109 | + topTypeString = TrackConstants.SummaryType.MorningAndEveningNews | ||
| 110 | + break; | ||
| 111 | + case 26: | ||
| 112 | + topTypeString = TrackConstants.SummaryType.TimeAxis | ||
| 113 | + break; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + let param: ParamType = { | ||
| 117 | + "summaryId": pageInfo.topicInfo.topicId, | ||
| 118 | + "summaryType": topTypeString, | ||
| 119 | + "specialLink": pageInfo.topicInfo.shareUrl, | ||
| 120 | + "channelSourceId": pageInfo.name, | ||
| 121 | + "pageId": 'summaryDetailPage', | ||
| 122 | + } | ||
| 123 | + TrackParamConvert.appendRecommend(pageInfo, param) | ||
| 124 | + | ||
| 125 | + return param | ||
| 126 | + } | ||
| 88 | } | 127 | } |
| @@ -4,12 +4,8 @@ import { WDRouterPage } from 'wdRouter'; | @@ -4,12 +4,8 @@ import { WDRouterPage } from 'wdRouter'; | ||
| 4 | import { Logger, SPHelper } from 'wdKit/Index'; | 4 | import { Logger, SPHelper } from 'wdKit/Index'; |
| 5 | import { SpConstants } from 'wdConstant/Index'; | 5 | import { SpConstants } from 'wdConstant/Index'; |
| 6 | import LaunchDataModel from '../viewModel/LaunchDataModel' | 6 | import LaunchDataModel from '../viewModel/LaunchDataModel' |
| 7 | -import { LaunchModel } from '../viewModel/LaunchModel'; | ||
| 8 | -import { ifaa } from '@kit.OnlineAuthenticationKit'; | ||
| 9 | 7 | ||
| 10 | -import common from '@ohos.app.ability.common'; | ||
| 11 | -import Want from '@ohos.app.ability.Want'; | ||
| 12 | -import { BusinessError } from '@ohos.base'; | 8 | +import { ParamType, TrackConstants, TrackingButton, TrackingContent } from 'wdTracking/Index'; |
| 13 | 9 | ||
| 14 | 10 | ||
| 15 | @Entry | 11 | @Entry |
| @@ -18,6 +14,7 @@ struct LaunchAdvertisingPage { | @@ -18,6 +14,7 @@ struct LaunchAdvertisingPage { | ||
| 18 | @State time: number = 4 | 14 | @State time: number = 4 |
| 19 | timer :number = -1 | 15 | timer :number = -1 |
| 20 | @State model : LaunchDataModel = {} as LaunchDataModel | 16 | @State model : LaunchDataModel = {} as LaunchDataModel |
| 17 | + pageParam: ParamType = {} | ||
| 21 | 18 | ||
| 22 | 19 | ||
| 23 | enter() { | 20 | enter() { |
| @@ -29,7 +26,6 @@ struct LaunchAdvertisingPage { | @@ -29,7 +26,6 @@ struct LaunchAdvertisingPage { | ||
| 29 | } | 26 | } |
| 30 | 27 | ||
| 31 | aboutToAppear(): void { | 28 | aboutToAppear(): void { |
| 32 | - | ||
| 33 | let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_LAUNCH_PAGE_DATA_MODEL,'') as string | 29 | let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_LAUNCH_PAGE_DATA_MODEL,'') as string |
| 34 | let dataModel : LaunchDataModel = JSON.parse(dataModelStr) | 30 | let dataModel : LaunchDataModel = JSON.parse(dataModelStr) |
| 35 | this.model = dataModel | 31 | this.model = dataModel |
| @@ -38,7 +34,9 @@ struct LaunchAdvertisingPage { | @@ -38,7 +34,9 @@ struct LaunchAdvertisingPage { | ||
| 38 | //设置倒计时时间 | 34 | //设置倒计时时间 |
| 39 | this.time = this.model.launchAdInfo[0].displayDuration | 35 | this.time = this.model.launchAdInfo[0].displayDuration |
| 40 | } | 36 | } |
| 37 | + this.contentTrackingDict() | ||
| 41 | 38 | ||
| 39 | + this.trackingLaunchShow() | ||
| 42 | } | 40 | } |
| 43 | 41 | ||
| 44 | 42 | ||
| @@ -96,6 +94,7 @@ struct LaunchAdvertisingPage { | @@ -96,6 +94,7 @@ struct LaunchAdvertisingPage { | ||
| 96 | .backgroundColor('#80000000') | 94 | .backgroundColor('#80000000') |
| 97 | .onClick(() => { | 95 | .onClick(() => { |
| 98 | this.enter() | 96 | this.enter() |
| 97 | + this.trackingLaunchJumpOver() | ||
| 99 | }) | 98 | }) |
| 100 | } | 99 | } |
| 101 | .width('100%') | 100 | .width('100%') |
| @@ -176,13 +175,15 @@ struct LaunchAdvertisingPage { | @@ -176,13 +175,15 @@ struct LaunchAdvertisingPage { | ||
| 176 | action(){ | 175 | action(){ |
| 177 | //跳转 url linkUrl https://news.bjd.com.cn/2024/03/19/10724331.shtml | 176 | //跳转 url linkUrl https://news.bjd.com.cn/2024/03/19/10724331.shtml |
| 178 | // openType 端外 端内 打开 | 177 | // openType 端外 端内 打开 |
| 178 | + | ||
| 179 | + ///埋点 | ||
| 180 | + this.trackingLaunchClick() | ||
| 181 | + | ||
| 179 | if(this.model.launchAdInfo.length){ | 182 | if(this.model.launchAdInfo.length){ |
| 180 | if (this.model.launchAdInfo[0].matInfo.openType == '2') { | 183 | if (this.model.launchAdInfo[0].matInfo.openType == '2') { |
| 181 | //端外打开 | 184 | //端外打开 |
| 182 | - | ||
| 183 | ProcessUtils.jumpExternalWebPage(this.model.launchAdInfo[0].matInfo.linkUrl) | 185 | ProcessUtils.jumpExternalWebPage(this.model.launchAdInfo[0].matInfo.linkUrl) |
| 184 | //clearInterval(this.timer) | 186 | //clearInterval(this.timer) |
| 185 | - | ||
| 186 | }else { | 187 | }else { |
| 187 | //端内打开 | 188 | //端内打开 |
| 188 | ProcessUtils.gotoDefaultWebPage(this.model.launchAdInfo[0].matInfo.linkUrl) | 189 | ProcessUtils.gotoDefaultWebPage(this.model.launchAdInfo[0].matInfo.linkUrl) |
| @@ -192,6 +193,25 @@ struct LaunchAdvertisingPage { | @@ -192,6 +193,25 @@ struct LaunchAdvertisingPage { | ||
| 192 | } | 193 | } |
| 193 | } | 194 | } |
| 194 | 195 | ||
| 196 | + contentTrackingDict(){ | ||
| 197 | + this.pageParam = { | ||
| 198 | + 'adType':'0', | ||
| 199 | + 'adId':this.model.launchAdInfo[0]?.matInfo.id.toString(), | ||
| 200 | + 'adName':this.model.launchAdInfo[0]?.matInfo.advTitle, | ||
| 201 | + 'regionName':'0' | ||
| 202 | + } | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + trackingLaunchJumpOver(){ | ||
| 206 | + TrackingButton.click('skip_click',TrackConstants.PageName.Open_Screen,TrackConstants.PageName.Open_Screen) | ||
| 207 | + } | ||
| 208 | + | ||
| 209 | + trackingLaunchShow(){ | ||
| 210 | + TrackingContent.common(TrackConstants.EventType.Show,TrackConstants.PageName.Open_Screen,TrackConstants.PageName.Open_Screen,this.pageParam) | ||
| 211 | + } | ||
| 195 | 212 | ||
| 213 | + trackingLaunchClick(){ | ||
| 214 | + TrackingContent.common(TrackConstants.EventType.Click,TrackConstants.PageName.Open_Screen,TrackConstants.PageName.Open_Screen,this.pageParam) | ||
| 215 | + } | ||
| 196 | 216 | ||
| 197 | } | 217 | } |
| @@ -4,7 +4,7 @@ import { EmitterEventId, EmitterUtils, Logger, StringUtils } from 'wdKit'; | @@ -4,7 +4,7 @@ import { EmitterEventId, EmitterUtils, Logger, StringUtils } from 'wdKit'; | ||
| 4 | import { HttpUtils } from 'wdNetwork/Index'; | 4 | import { HttpUtils } from 'wdNetwork/Index'; |
| 5 | import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/Index'; | 5 | import HomeChannelUtils, { AssignChannelParam } from 'wdRouter/Index'; |
| 6 | import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/MinePageComponent'; | 6 | import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/MinePageComponent'; |
| 7 | -import { CompUtils, TopNavigationComponent } from 'wdComponent/Index'; | 7 | +import { CompUtils, TopNavigationComponent, TopNavigationComponentNew } from 'wdComponent/Index'; |
| 8 | import { VideoChannelPage } from './VideoChannelPage'; | 8 | import { VideoChannelPage } from './VideoChannelPage'; |
| 9 | import ChannelViewModel from 'wdComponent/src/main/ets/viewmodel/ChannelViewModel'; | 9 | import ChannelViewModel from 'wdComponent/src/main/ets/viewmodel/ChannelViewModel'; |
| 10 | 10 | ||
| @@ -17,6 +17,7 @@ let storage = LocalStorage.getShared(); | @@ -17,6 +17,7 @@ let storage = LocalStorage.getShared(); | ||
| 17 | @Entry(storage) | 17 | @Entry(storage) |
| 18 | @Component | 18 | @Component |
| 19 | export struct BottomNavigationComponent { | 19 | export struct BottomNavigationComponent { |
| 20 | + private isNewTopPage = true // TODO 顶导重构页面开关,false,则用原来的顶导 | ||
| 20 | @Provide bottomRectHeight: number = 0 | 21 | @Provide bottomRectHeight: number = 0 |
| 21 | @Provide topRectHeight: number = 0 | 22 | @Provide topRectHeight: number = 0 |
| 22 | @Provide isLayoutFullScreen: boolean = false | 23 | @Provide isLayoutFullScreen: boolean = false |
| @@ -82,15 +83,28 @@ export struct BottomNavigationComponent { | @@ -82,15 +83,28 @@ export struct BottomNavigationComponent { | ||
| 82 | autoRefresh: this.autoRefresh | 83 | autoRefresh: this.autoRefresh |
| 83 | }) | 84 | }) |
| 84 | } else { | 85 | } else { |
| 85 | - TopNavigationComponent({ | ||
| 86 | - groupId: navItem.id, | ||
| 87 | - topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | ||
| 88 | - _currentNavIndex: $currentNavIndex, | ||
| 89 | - navIndex: index, | ||
| 90 | - currentBottomNavName: navItem.name, | ||
| 91 | - assignChannel: this.assignChannel, | ||
| 92 | - autoRefresh: this.autoRefresh | ||
| 93 | - }) | 86 | + if (this.isNewTopPage) { |
| 87 | + TopNavigationComponentNew({ | ||
| 88 | + groupId: navItem.id, | ||
| 89 | + topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | ||
| 90 | + _currentNavIndex: $currentNavIndex, | ||
| 91 | + bottomNavIndex: index, | ||
| 92 | + currentBottomNavName: navItem.name, | ||
| 93 | + assignChannel: this.assignChannel, | ||
| 94 | + autoRefresh: this.autoRefresh | ||
| 95 | + }) | ||
| 96 | + } else { | ||
| 97 | + TopNavigationComponent({ | ||
| 98 | + groupId: navItem.id, | ||
| 99 | + topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | ||
| 100 | + _currentNavIndex: $currentNavIndex, | ||
| 101 | + navIndex: index, | ||
| 102 | + currentBottomNavName: navItem.name, | ||
| 103 | + assignChannel: this.assignChannel, | ||
| 104 | + autoRefresh: this.autoRefresh | ||
| 105 | + }) | ||
| 106 | + } | ||
| 107 | + | ||
| 94 | } | 108 | } |
| 95 | } | 109 | } |
| 96 | .tabBar(this.tabBarBuilder(navItem, index)) | 110 | .tabBar(this.tabBarBuilder(navItem, index)) |
| @@ -26,6 +26,7 @@ export interface NetLayerLauncherADMaterialModel{ | @@ -26,6 +26,7 @@ export interface NetLayerLauncherADMaterialModel{ | ||
| 26 | matType : string //1 video 其他 image | 26 | matType : string //1 video 其他 image |
| 27 | startStyle : number // 1 WDDisplayStyle_Full 全屏样式 其他 WDDisplayStyle_Logo 底部logo样式 | 27 | startStyle : number // 1 WDDisplayStyle_Full 全屏样式 其他 WDDisplayStyle_Logo 底部logo样式 |
| 28 | advTitle : string | 28 | advTitle : string |
| 29 | + id:number | ||
| 29 | matImageUrl : string[] //取firstObject | 30 | matImageUrl : string[] //取firstObject |
| 30 | matVideoUrl : string | 31 | matVideoUrl : string |
| 31 | 32 |
-
Please register or login to post a comment