Showing
30 changed files
with
457 additions
and
114 deletions
| @@ -207,6 +207,11 @@ export class HttpUrlUtils { | @@ -207,6 +207,11 @@ export class HttpUrlUtils { | ||
| 207 | * 直播详情-大家聊列表 | 207 | * 直播详情-大家聊列表 |
| 208 | */ | 208 | */ |
| 209 | static readonly LIVE_CHAT_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/chat/list"; | 209 | static readonly LIVE_CHAT_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/chat/list"; |
| 210 | + | ||
| 211 | + /** | ||
| 212 | + * C端评论列表 竖屏直播间 | ||
| 213 | + */ | ||
| 214 | + static readonly LIVE_COMMENTS_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/comments/list"; | ||
| 210 | /** | 215 | /** |
| 211 | * 直播详情-直播数据 | 216 | * 直播详情-直播数据 |
| 212 | */ | 217 | */ |
| @@ -655,6 +660,16 @@ export class HttpUrlUtils { | @@ -655,6 +660,16 @@ export class HttpUrlUtils { | ||
| 655 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_CHAT_LIST_PATH | 660 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_CHAT_LIST_PATH |
| 656 | return url | 661 | return url |
| 657 | } | 662 | } |
| 663 | + | ||
| 664 | + /** | ||
| 665 | + * 竖屏直播间 聊天信息接口 | ||
| 666 | + * @returns | ||
| 667 | + */ | ||
| 668 | + static getLiveCommentListUrl() { | ||
| 669 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_COMMENTS_LIST_PATH | ||
| 670 | + return url | ||
| 671 | + } | ||
| 672 | + | ||
| 658 | // 直播详情-直播数据 | 673 | // 直播详情-直播数据 |
| 659 | static getLiveRoomDataUrl() { | 674 | static getLiveRoomDataUrl() { |
| 660 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_DATA_PATH | 675 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_DATA_PATH |
| @@ -32,6 +32,10 @@ export struct CardParser { | @@ -32,6 +32,10 @@ export struct CardParser { | ||
| 32 | pageShowTime:number = 0; | 32 | pageShowTime:number = 0; |
| 33 | pageHideTime:number = 0; | 33 | pageHideTime:number = 0; |
| 34 | 34 | ||
| 35 | + aboutToAppear(): void { | ||
| 36 | + console.log('CardParser-', JSON.stringify(this.contentDTO)) | ||
| 37 | + } | ||
| 38 | + | ||
| 35 | onPageShow() { | 39 | onPageShow() { |
| 36 | this.pageShowTime = DateTimeUtils.getTimeStamp() | 40 | this.pageShowTime = DateTimeUtils.getTimeStamp() |
| 37 | } | 41 | } |
| @@ -44,6 +44,7 @@ export struct CompParser { | @@ -44,6 +44,7 @@ export struct CompParser { | ||
| 44 | aboutToAppear(): void { | 44 | aboutToAppear(): void { |
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | + | ||
| 47 | console.log('CompParser-compDTO', JSON.stringify(this.compDTO)) | 48 | console.log('CompParser-compDTO', JSON.stringify(this.compDTO)) |
| 48 | // 轮播图屏蔽音频类型稿件 | 49 | // 轮播图屏蔽音频类型稿件 |
| 49 | if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | 50 | if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { |
| @@ -93,7 +94,7 @@ export struct CompParser { | @@ -93,7 +94,7 @@ export struct CompParser { | ||
| 93 | this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡" | 94 | this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡" |
| 94 | 95 | ||
| 95 | LiveHorizontalCardComponent({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 96 | LiveHorizontalCardComponent({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) |
| 96 | - Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) | 97 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 97 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && this.compDTO.imageScale === 3) { | 98 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && this.compDTO.imageScale === 3) { |
| 98 | if (this.compDTO.operDataList.length > 1) { | 99 | if (this.compDTO.operDataList.length > 1) { |
| 99 | HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 100 | HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) |
| @@ -103,7 +104,7 @@ export struct CompParser { | @@ -103,7 +104,7 @@ export struct CompParser { | ||
| 103 | Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) | 104 | Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) |
| 104 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_02) { | 105 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_02) { |
| 105 | ZhSingleRow02({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 106 | ZhSingleRow02({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) |
| 106 | - Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) | 107 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 107 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) { | 108 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) { |
| 108 | ZhSingleRow03({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) | 109 | ZhSingleRow03({ compDTO: this.compDTO, pageId: this.pageId, pageName: this.pageName }) |
| 109 | Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) | 110 | Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) |
| @@ -229,7 +229,7 @@ export struct CardMediaInfo { | @@ -229,7 +229,7 @@ export struct CardMediaInfo { | ||
| 229 | @Extend(Text) | 229 | @Extend(Text) |
| 230 | function mediaText() { | 230 | function mediaText() { |
| 231 | .fontColor($r('app.color.color_fff')) | 231 | .fontColor($r('app.color.color_fff')) |
| 232 | - .fontSize($r('app.float.font_size_14')) | 232 | + .fontSize($r('app.float.font_size_13')) |
| 233 | .lineHeight(18) | 233 | .lineHeight(18) |
| 234 | .textShadow({ | 234 | .textShadow({ |
| 235 | radius: 2, | 235 | radius: 2, |
| @@ -39,13 +39,16 @@ export struct Card11Component { | @@ -39,13 +39,16 @@ export struct Card11Component { | ||
| 39 | Column() { | 39 | Column() { |
| 40 | Stack() { | 40 | Stack() { |
| 41 | if(this.contentDTO.objectType == '5'){ | 41 | if(this.contentDTO.objectType == '5'){ |
| 42 | - Notes({ objectType: this.contentDTO.objectType }).height(20).align(Alignment.Center) | 42 | + Notes({ objectType: this.contentDTO.objectType }).height(28).align(Alignment.Center) |
| 43 | } else { | 43 | } else { |
| 44 | if (this.contentDTO.seoTags) { | 44 | if (this.contentDTO.seoTags) { |
| 45 | - Notes({ newTags: this.contentDTO.seoTags }).height(20).align(Alignment.Center) | 45 | + Notes({ newTags: this.contentDTO.seoTags }).height(28).align(Alignment.Center) |
| 46 | } | 46 | } |
| 47 | if (this.contentDTO.newTags) { | 47 | if (this.contentDTO.newTags) { |
| 48 | - Notes({ newTags: this.contentDTO.newTags }).height(20).align(Alignment.Center) | 48 | + Notes({ newTags: this.contentDTO.newTags }).height(28).align(Alignment.Center) |
| 49 | + } | ||
| 50 | + if (this.contentDTO.top === 1) { | ||
| 51 | + Notes({ newTags: '置顶' }).height(28).align(Alignment.Center) | ||
| 49 | } | 52 | } |
| 50 | } | 53 | } |
| 51 | Text() { | 54 | Text() { |
| @@ -70,7 +73,7 @@ export struct Card11Component { | @@ -70,7 +73,7 @@ export struct Card11Component { | ||
| 70 | .width(CommonConstants.FULL_WIDTH) | 73 | .width(CommonConstants.FULL_WIDTH) |
| 71 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && | 74 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && |
| 72 | (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 : | 75 | (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 : |
| 73 | - ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 : | 76 | + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5' || this.contentDTO.top === 1) ? 35 : |
| 74 | 0 ) | 77 | 0 ) |
| 75 | 78 | ||
| 76 | }.alignContent(Alignment.TopStart) | 79 | }.alignContent(Alignment.TopStart) |
| @@ -69,6 +69,9 @@ export struct Card2Component { | @@ -69,6 +69,9 @@ export struct Card2Component { | ||
| 69 | if (this.contentDTO.newTags) { | 69 | if (this.contentDTO.newTags) { |
| 70 | Notes({ newTags: this.contentDTO.newTags }).height(29).align(Alignment.Center) | 70 | Notes({ newTags: this.contentDTO.newTags }).height(29).align(Alignment.Center) |
| 71 | } | 71 | } |
| 72 | + if (this.contentDTO.top === 1) { | ||
| 73 | + Notes({ newTags: '置顶' }).height(29).align(Alignment.Center) | ||
| 74 | + } | ||
| 72 | } | 75 | } |
| 73 | //新闻标题 | 76 | //新闻标题 |
| 74 | // if (this.contentDTO.newTags) { | 77 | // if (this.contentDTO.newTags) { |
| @@ -101,7 +104,7 @@ export struct Card2Component { | @@ -101,7 +104,7 @@ export struct Card2Component { | ||
| 101 | .align(Alignment.Start) | 104 | .align(Alignment.Start) |
| 102 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && | 105 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && |
| 103 | (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 : | 106 | (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 : |
| 104 | - ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 : | 107 | + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5' || this.contentDTO.top === 1) ? 35 : |
| 105 | 0 ) | 108 | 0 ) |
| 106 | }.alignContent(Alignment.TopStart) | 109 | }.alignContent(Alignment.TopStart) |
| 107 | 110 |
| @@ -50,6 +50,9 @@ export struct Card3Component { | @@ -50,6 +50,9 @@ export struct Card3Component { | ||
| 50 | if (this.contentDTO.newTags) { | 50 | if (this.contentDTO.newTags) { |
| 51 | Notes({ newTags: this.contentDTO.newTags }).height(29).align(Alignment.Center) | 51 | Notes({ newTags: this.contentDTO.newTags }).height(29).align(Alignment.Center) |
| 52 | } | 52 | } |
| 53 | + if (this.contentDTO.top === 1) { | ||
| 54 | + Notes({ newTags: '置顶' }).height(29).align(Alignment.Center) | ||
| 55 | + } | ||
| 53 | } | 56 | } |
| 54 | Text() { | 57 | Text() { |
| 55 | if (this.titleMarked) { | 58 | if (this.titleMarked) { |
| @@ -71,7 +74,7 @@ export struct Card3Component { | @@ -71,7 +74,7 @@ export struct Card3Component { | ||
| 71 | .width(CommonConstants.FULL_WIDTH) | 74 | .width(CommonConstants.FULL_WIDTH) |
| 72 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && | 75 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && |
| 73 | (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 : | 76 | (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 : |
| 74 | - ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 : | 77 | + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5' || this.contentDTO.top === 1) ? 35 : |
| 75 | 0 ) | 78 | 0 ) |
| 76 | }.alignContent(Alignment.TopStart) | 79 | }.alignContent(Alignment.TopStart) |
| 77 | 80 |
| @@ -55,6 +55,9 @@ export struct Card4Component { | @@ -55,6 +55,9 @@ export struct Card4Component { | ||
| 55 | if (this.contentDTO.newTags) { | 55 | if (this.contentDTO.newTags) { |
| 56 | Notes({ newTags: this.contentDTO.newTags }).height(19).align(Alignment.Center) | 56 | Notes({ newTags: this.contentDTO.newTags }).height(19).align(Alignment.Center) |
| 57 | } | 57 | } |
| 58 | + if (this.contentDTO.top === 1) { | ||
| 59 | + Notes({ newTags: '置顶' }).height(20).align(Alignment.Center) | ||
| 60 | + } | ||
| 58 | } | 61 | } |
| 59 | Text() { | 62 | Text() { |
| 60 | if (this.titleMarked) { | 63 | if (this.titleMarked) { |
| @@ -76,7 +79,7 @@ export struct Card4Component { | @@ -76,7 +79,7 @@ export struct Card4Component { | ||
| 76 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 79 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 77 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && | 80 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && |
| 78 | (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 : | 81 | (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 : |
| 79 | - ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 : | 82 | + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5' || this.contentDTO.top === 1) ? 35 : |
| 80 | 0 ) | 83 | 0 ) |
| 81 | }.alignContent(Alignment.TopStart) | 84 | }.alignContent(Alignment.TopStart) |
| 82 | //新闻标题 | 85 | //新闻标题 |
| @@ -82,6 +82,9 @@ export struct Card5Component { | @@ -82,6 +82,9 @@ export struct Card5Component { | ||
| 82 | if (this.contentDTO.newTags) { | 82 | if (this.contentDTO.newTags) { |
| 83 | Notes({ newTags: this.contentDTO.newTags }).height(20).align(Alignment.Center) | 83 | Notes({ newTags: this.contentDTO.newTags }).height(20).align(Alignment.Center) |
| 84 | } | 84 | } |
| 85 | + if (this.contentDTO.top === 1) { | ||
| 86 | + Notes({ newTags: '置顶' }).height(20).align(Alignment.Center) | ||
| 87 | + } | ||
| 85 | } | 88 | } |
| 86 | 89 | ||
| 87 | Text() { | 90 | Text() { |
| @@ -106,7 +109,7 @@ export struct Card5Component { | @@ -106,7 +109,7 @@ export struct Card5Component { | ||
| 106 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 109 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| 107 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && | 110 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && |
| 108 | (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 : | 111 | (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 : |
| 109 | - ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 : | 112 | + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5' || this.contentDTO.top === 1) ? 35 : |
| 110 | 0 ) | 113 | 0 ) |
| 111 | }.alignContent(Alignment.TopStart) | 114 | }.alignContent(Alignment.TopStart) |
| 112 | } | 115 | } |
| @@ -18,6 +18,7 @@ const TAG: string = 'Card6Component-Card13Component'; | @@ -18,6 +18,7 @@ const TAG: string = 'Card6Component-Card13Component'; | ||
| 18 | @Component | 18 | @Component |
| 19 | export struct Card6Component { | 19 | export struct Card6Component { |
| 20 | @State pageId: string = ''; | 20 | @State pageId: string = ''; |
| 21 | + @State textHeight: number = 0 ; //获取文本的高度 | ||
| 21 | @State pageName: string = ''; | 22 | @State pageName: string = ''; |
| 22 | @State loadImg: boolean = false; | 23 | @State loadImg: boolean = false; |
| 23 | @State clicked: boolean = false; | 24 | @State clicked: boolean = false; |
| @@ -61,9 +62,14 @@ export struct Card6Component { | @@ -61,9 +62,14 @@ export struct Card6Component { | ||
| 61 | if (this.contentDTO.newTags) { | 62 | if (this.contentDTO.newTags) { |
| 62 | Notes({ newTags: this.contentDTO.newTags }).height(28).align(Alignment.Center) | 63 | Notes({ newTags: this.contentDTO.newTags }).height(28).align(Alignment.Center) |
| 63 | } | 64 | } |
| 65 | + if (this.contentDTO.top === 1) { | ||
| 66 | + Notes({ newTags: '置顶' }).height(28).align(Alignment.Center) | ||
| 64 | } | 67 | } |
| 68 | + } | ||
| 69 | + | ||
| 70 | + Text() | ||
| 71 | + { | ||
| 65 | 72 | ||
| 66 | - Text() { | ||
| 67 | if (this.titleMarked) { | 73 | if (this.titleMarked) { |
| 68 | ForEach(this.textArr, (textItem: textItem) => { | 74 | ForEach(this.textArr, (textItem: textItem) => { |
| 69 | if (textItem.isRed) { | 75 | if (textItem.isRed) { |
| @@ -77,19 +83,20 @@ export struct Card6Component { | @@ -77,19 +83,20 @@ export struct Card6Component { | ||
| 77 | Span(this.contentDTO.newsTitle) | 83 | Span(this.contentDTO.newsTitle) |
| 78 | } | 84 | } |
| 79 | } | 85 | } |
| 86 | + | ||
| 80 | .fontColor(this.clicked ? 0x848484 : 0x222222) | 87 | .fontColor(this.clicked ? 0x848484 : 0x222222) |
| 81 | .fontSize(18) | 88 | .fontSize(18) |
| 82 | .lineHeight(27) | 89 | .lineHeight(27) |
| 83 | .fontWeight(FontWeight.Normal) | 90 | .fontWeight(FontWeight.Normal) |
| 84 | - .maxLines(3) | 91 | + .maxLines(2) |
| 85 | .alignSelf(ItemAlign.Start) | 92 | .alignSelf(ItemAlign.Start) |
| 86 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 93 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| 87 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && | 94 | .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && |
| 88 | (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 : | 95 | (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5 ? 58 : |
| 89 | - ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 : | 96 | + ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5' || this.contentDTO.top === 1) ? 35 : |
| 90 | 0 ) | 97 | 0 ) |
| 91 | }.alignContent(Alignment.TopStart) | 98 | }.alignContent(Alignment.TopStart) |
| 92 | - // .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 60: 156) | 99 | + |
| 93 | 100 | ||
| 94 | } | 101 | } |
| 95 | .justifyContent(FlexAlign.Start) | 102 | .justifyContent(FlexAlign.Start) |
| @@ -98,8 +105,12 @@ export struct Card6Component { | @@ -98,8 +105,12 @@ export struct Card6Component { | ||
| 98 | CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) | 105 | CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 99 | 106 | ||
| 100 | } | 107 | } |
| 108 | + | ||
| 101 | .alignItems(HorizontalAlign.Start) | 109 | .alignItems(HorizontalAlign.Start) |
| 102 | - .justifyContent(FlexAlign.Start) | 110 | + .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78: 156) |
| 111 | + | ||
| 112 | + | ||
| 113 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 103 | .width('64%') | 114 | .width('64%') |
| 104 | 115 | ||
| 105 | 116 | ||
| @@ -132,3 +143,4 @@ export struct Card6Component { | @@ -132,3 +143,4 @@ export struct Card6Component { | ||
| 132 | .alignItems(VerticalAlign.Top) | 143 | .alignItems(VerticalAlign.Top) |
| 133 | } | 144 | } |
| 134 | } | 145 | } |
| 146 | + |
| @@ -98,6 +98,9 @@ export struct Card9Component { | @@ -98,6 +98,9 @@ export struct Card9Component { | ||
| 98 | if (this.contentDTO.newTags) { | 98 | if (this.contentDTO.newTags) { |
| 99 | Notes({ newTags: this.contentDTO.newTags }).height(20).align(Alignment.Center) | 99 | Notes({ newTags: this.contentDTO.newTags }).height(20).align(Alignment.Center) |
| 100 | } | 100 | } |
| 101 | + if (this.contentDTO.top === 1) { | ||
| 102 | + Notes({ newTags: '置顶' }).height(20).align(Alignment.Center) | ||
| 103 | + } | ||
| 101 | } | 104 | } |
| 102 | 105 | ||
| 103 | }.alignContent(Alignment.BottomStart) | 106 | }.alignContent(Alignment.BottomStart) |
| @@ -40,6 +40,7 @@ export struct ZhSingleRow02 { | @@ -40,6 +40,7 @@ export struct ZhSingleRow02 { | ||
| 40 | } | 40 | } |
| 41 | .listDirection(Axis.Horizontal) | 41 | .listDirection(Axis.Horizontal) |
| 42 | .scrollBar(BarState.Off) | 42 | .scrollBar(BarState.Off) |
| 43 | + .edgeEffect(EdgeEffect.None) | ||
| 43 | } | 44 | } |
| 44 | .width(CommonConstants.FULL_WIDTH) | 45 | .width(CommonConstants.FULL_WIDTH) |
| 45 | .height(208) | 46 | .height(208) |
| @@ -11,7 +11,6 @@ import { | @@ -11,7 +11,6 @@ import { | ||
| 11 | import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO' | 11 | import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO' |
| 12 | import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO' | 12 | import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO' |
| 13 | import { LazyDataSource, StringUtils, UserDataLocal } from 'wdKit/Index' | 13 | import { LazyDataSource, StringUtils, UserDataLocal } from 'wdKit/Index' |
| 14 | -import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 15 | import MinePageDatasModel from '../../model/MinePageDatasModel' | 14 | import MinePageDatasModel from '../../model/MinePageDatasModel' |
| 16 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 15 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 17 | import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' | 16 | import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' |
| @@ -30,6 +29,7 @@ import { SearchCreatorComponent } from './SearchCreatorComponent' | @@ -30,6 +29,7 @@ import { SearchCreatorComponent } from './SearchCreatorComponent' | ||
| 30 | import { JSON } from '@kit.ArkTS' | 29 | import { JSON } from '@kit.ArkTS' |
| 31 | import { MoreComponent } from '../cardview/MoreComponent' | 30 | import { MoreComponent } from '../cardview/MoreComponent' |
| 32 | import { Card9Component } from '../cardview/Card9Component' | 31 | import { Card9Component } from '../cardview/Card9Component' |
| 32 | +import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' | ||
| 33 | 33 | ||
| 34 | const TAG = "SearchResultContentComponent" | 34 | const TAG = "SearchResultContentComponent" |
| 35 | 35 | ||
| @@ -46,6 +46,12 @@ export struct SearchResultContentComponent { | @@ -46,6 +46,12 @@ export struct SearchResultContentComponent { | ||
| 46 | curPageNum: number = 1; | 46 | curPageNum: number = 1; |
| 47 | @State bean: FollowListDetailItem = new FollowListDetailItem("", "", "", "", "", "", "", "", "", -1, -1, "") | 47 | @State bean: FollowListDetailItem = new FollowListDetailItem("", "", "", "", "", "", "", "", "", -1, -1, "") |
| 48 | scroller: Scroller = new Scroller() | 48 | scroller: Scroller = new Scroller() |
| 49 | + private scroller2: Scroller = new Scroller() | ||
| 50 | + @State ellipseW: number = 0 | ||
| 51 | + @State moreWidth:number = 20 | ||
| 52 | + @State listLeft: number = 0 | ||
| 53 | + @State isEnd: boolean = false | ||
| 54 | + | ||
| 49 | 55 | ||
| 50 | aboutToAppear(): void { | 56 | aboutToAppear(): void { |
| 51 | if (this.searchType == "全部") { | 57 | if (this.searchType == "全部") { |
| @@ -243,7 +249,7 @@ export struct SearchResultContentComponent { | @@ -243,7 +249,7 @@ export struct SearchResultContentComponent { | ||
| 243 | if (this.count == 0) { | 249 | if (this.count == 0) { |
| 244 | ListHasNoMoreDataUI({ style: 2 }) | 250 | ListHasNoMoreDataUI({ style: 2 }) |
| 245 | } else { | 251 | } else { |
| 246 | - List() { | 252 | + List({scroller:this.scroller2}) { |
| 247 | if (this.data_rmh != null && this.data_rmh.length > 0){ | 253 | if (this.data_rmh != null && this.data_rmh.length > 0){ |
| 248 | if (this.data_rmh.length === 1){ | 254 | if (this.data_rmh.length === 1){ |
| 249 | ListItem(){ | 255 | ListItem(){ |
| @@ -306,7 +312,8 @@ export struct SearchResultContentComponent { | @@ -306,7 +312,8 @@ export struct SearchResultContentComponent { | ||
| 306 | 312 | ||
| 307 | @Builder | 313 | @Builder |
| 308 | SearchListUI() { | 314 | SearchListUI() { |
| 309 | - List({space:'8lpx'}) { | 315 | + List({initialIndex: 0,space:'8lpx',scroller: this.scroller}) { |
| 316 | + ListItemGroup(){ | ||
| 310 | ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { | 317 | ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { |
| 311 | ListItem() { | 318 | ListItem() { |
| 312 | SearchCreatorComponent({item:item}) | 319 | SearchCreatorComponent({item:item}) |
| @@ -314,36 +321,61 @@ export struct SearchResultContentComponent { | @@ -314,36 +321,61 @@ export struct SearchResultContentComponent { | ||
| 314 | .width('150lpx') | 321 | .width('150lpx') |
| 315 | .height('100%') | 322 | .height('100%') |
| 316 | }) | 323 | }) |
| 324 | + }.offset({ left: this.listLeft }) | ||
| 317 | 325 | ||
| 318 | ListItem(){ | 326 | ListItem(){ |
| 319 | - Column(){ | ||
| 320 | - Text("查看更多") | ||
| 321 | - .width('19lpx') | ||
| 322 | - .fontSize('19lpx') | ||
| 323 | - .fontWeight('400lpx') | ||
| 324 | - .lineHeight('27lpx') | ||
| 325 | - .fontColor($r('app.color.color_9E9E9E')) | ||
| 326 | - }.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'}) | ||
| 327 | - .height('180lpx') | ||
| 328 | - .width('77lpx') | ||
| 329 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 330 | - .justifyContent(FlexAlign.Center) | ||
| 331 | - | 327 | + this.itemEnd() |
| 332 | }.height('100%') | 328 | }.height('100%') |
| 333 | .margin({left:'23lpx'}) | 329 | .margin({left:'23lpx'}) |
| 334 | - .onClick(()=>{ | ||
| 335 | - let params: Params = { | ||
| 336 | - pageID: this.keywords | ||
| 337 | } | 330 | } |
| 338 | - WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params) | ||
| 339 | - }) | ||
| 340 | - } | ||
| 341 | - .cachedCount(6) | ||
| 342 | .edgeEffect(EdgeEffect.None) | 331 | .edgeEffect(EdgeEffect.None) |
| 343 | .scrollBar(BarState.Off) | 332 | .scrollBar(BarState.Off) |
| 344 | .listDirection(Axis.Horizontal) | 333 | .listDirection(Axis.Horizontal) |
| 345 | .width('100%') | 334 | .width('100%') |
| 346 | .height('219lpx') | 335 | .height('219lpx') |
| 336 | + .onReachEnd(() => { | ||
| 337 | + this.isEnd = true | ||
| 338 | + console.log(TAG,'is end') | ||
| 339 | + }) | ||
| 340 | + .onScrollFrameBegin((offset: number, state: ScrollState) => { | ||
| 341 | + console.log(TAG,'offset', offset) | ||
| 342 | + if (!this.scroller.isAtEnd()) { | ||
| 343 | + this.isEnd = false | ||
| 344 | + } | ||
| 345 | + if (this.ellipseW > 0) { | ||
| 346 | + return { offsetRemain: 0 } | ||
| 347 | + } | ||
| 348 | + return { offsetRemain: offset } | ||
| 349 | + }) | ||
| 350 | + .parallelGesture( | ||
| 351 | + PanGesture({ direction: PanDirection.Horizontal, distance: 1 }) | ||
| 352 | + .onActionStart((event: GestureEvent) => { | ||
| 353 | + console.info(TAG,'Pan start') | ||
| 354 | + }) | ||
| 355 | + .onActionUpdate((event: GestureEvent) => { | ||
| 356 | + if (event && this.isEnd) { | ||
| 357 | + // console.log('event.offsetX',event.offsetX) | ||
| 358 | + this.listLeft = event.offsetX < -60 ? -60 : event.offsetX > 0 ? 0 : event.offsetX | ||
| 359 | + this.ellipseW = (-this.listLeft) / 1.5 | ||
| 360 | + | ||
| 361 | + console.log(TAG,"this.ellipseW==>" + this.ellipseW) | ||
| 362 | + } | ||
| 363 | + }) | ||
| 364 | + .onActionEnd((event: GestureEvent) => { | ||
| 365 | + console.info(TAG,'Pan end') | ||
| 366 | + this.listLeft = 0 | ||
| 367 | + // this.moreWidth = 20 | ||
| 368 | + | ||
| 369 | + if (event.offsetX < 0 && this.ellipseW >=20) { | ||
| 370 | + console.log(TAG,'跳转') | ||
| 371 | + let params: Params = { | ||
| 372 | + pageID: this.keywords | ||
| 373 | + } | ||
| 374 | + WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params) | ||
| 375 | + } | ||
| 376 | + this.ellipseW = 0 | ||
| 377 | + }) | ||
| 378 | + ) | ||
| 347 | 379 | ||
| 348 | Divider() | 380 | Divider() |
| 349 | .width('100%') | 381 | .width('100%') |
| @@ -352,6 +384,32 @@ export struct SearchResultContentComponent { | @@ -352,6 +384,32 @@ export struct SearchResultContentComponent { | ||
| 352 | .strokeWidth('12lpx') | 384 | .strokeWidth('12lpx') |
| 353 | } | 385 | } |
| 354 | 386 | ||
| 387 | + | ||
| 388 | + @Builder | ||
| 389 | + itemEnd() { | ||
| 390 | + Row() { | ||
| 391 | + Ellipse() | ||
| 392 | + .width(2* this.ellipseW) | ||
| 393 | + .height('100%') | ||
| 394 | + .fill('rgb(240,235,238)') | ||
| 395 | + .position({ left: -this.ellipseW, top: 0 }) | ||
| 396 | + | ||
| 397 | + Column(){ | ||
| 398 | + Text(this.ellipseW === 0 ? '' : this.ellipseW < 20? '查看更多' : '松手查看') | ||
| 399 | + .width('19lpx') | ||
| 400 | + .fontSize('19lpx') | ||
| 401 | + .fontWeight('400lpx') | ||
| 402 | + .lineHeight('27lpx') | ||
| 403 | + .fontColor("#9E9E9E") | ||
| 404 | + } | ||
| 405 | + .height('100%') | ||
| 406 | + .width(this.moreWidth) | ||
| 407 | + .backgroundColor("#EDEDED") | ||
| 408 | + .justifyContent(FlexAlign.Center) | ||
| 409 | + } | ||
| 410 | + .height('100%') | ||
| 411 | + } | ||
| 412 | + | ||
| 355 | private dataTransform(rem:CreatorDetailResponseItem[],value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO { | 413 | private dataTransform(rem:CreatorDetailResponseItem[],value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO { |
| 356 | let rmhInfo = this.getRmhInfo(rem,value) | 414 | let rmhInfo = this.getRmhInfo(rem,value) |
| 357 | console.log('获取photos',JSON.stringify(photos)) | 415 | console.log('获取photos',JSON.stringify(photos)) |
| @@ -9,6 +9,8 @@ import { | @@ -9,6 +9,8 @@ import { | ||
| 9 | } from 'wdBean'; | 9 | } from 'wdBean'; |
| 10 | import { LiveModel } from '../../viewmodel/LiveModel'; | 10 | import { LiveModel } from '../../viewmodel/LiveModel'; |
| 11 | import { HttpUtils } from 'wdNetwork/Index'; | 11 | import { HttpUtils } from 'wdNetwork/Index'; |
| 12 | +import vibrator from '@ohos.vibrator'; | ||
| 13 | +import { BusinessError } from '@ohos.base'; | ||
| 12 | 14 | ||
| 13 | const TAG = 'LiveLikeComponent'; | 15 | const TAG = 'LiveLikeComponent'; |
| 14 | 16 | ||
| @@ -106,38 +108,63 @@ export struct LiveLikeComponent { | @@ -106,38 +108,63 @@ export struct LiveLikeComponent { | ||
| 106 | 108 | ||
| 107 | @Builder | 109 | @Builder |
| 108 | likeCompStyle() { | 110 | likeCompStyle() { |
| 109 | - Stack({ alignContent: Alignment.Bottom }) { | 111 | + Stack({ alignContent: Alignment.TopEnd }) { |
| 110 | Column() { | 112 | Column() { |
| 111 | Image(this.transLikeStyle().url) | 113 | Image(this.transLikeStyle().url) |
| 112 | .width(24) | 114 | .width(24) |
| 113 | .height(24) | 115 | .height(24) |
| 114 | - .onClick(() => { | ||
| 115 | - this.clickButtonEvent() | ||
| 116 | - }) | ||
| 117 | } | 116 | } |
| 118 | .justifyContent(FlexAlign.Center) | 117 | .justifyContent(FlexAlign.Center) |
| 119 | .width(36) | 118 | .width(36) |
| 120 | .height(36) | 119 | .height(36) |
| 121 | .borderRadius(18) | 120 | .borderRadius(18) |
| 122 | .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5') | 121 | .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : this.pageComponentType === 8 ? Color.Transparent : '#FFF5F5F5') |
| 123 | - Row() { | ||
| 124 | - Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) | ||
| 125 | - .fontSize(8) | ||
| 126 | - .fontColor(Color.White) | ||
| 127 | - .padding({ left: 8, right: 2 }) | 122 | + if (this.likeCount != 0) { |
| 123 | + RelativeContainer() { | ||
| 124 | + Image(this.styleType == 1 ? $r('app.media.comment_icon_number_bg') : $r('app.media.ic_like_back_Select')) | ||
| 125 | + .objectFit(ImageFit.Fill) | ||
| 126 | + .resizable({ | ||
| 127 | + slice: { | ||
| 128 | + top: 1, | ||
| 129 | + left: 20, | ||
| 130 | + right: 1, | ||
| 131 | + bottom: 1 | ||
| 128 | } | 132 | } |
| 133 | + }) | ||
| 134 | + .alignRules({ | ||
| 135 | + top: { anchor: "Text", align: VerticalAlign.Top }, | ||
| 136 | + left: { anchor: "Text", align: HorizontalAlign.Start }, | ||
| 137 | + right: { anchor: "Text", align: HorizontalAlign.End }, | ||
| 138 | + bottom: { anchor: "Text", align: VerticalAlign.Bottom }, | ||
| 139 | + }) | ||
| 140 | + .id("Image") | ||
| 141 | + | ||
| 142 | + Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))// Text("44444444") | ||
| 143 | + .fontSize(8) | ||
| 144 | + .fontColor('#ffffff')// .backgroundColor('#ED2800') | ||
| 129 | .height(12) | 145 | .height(12) |
| 130 | - .alignItems(VerticalAlign.Center) | ||
| 131 | - .position({ x: '100%', y: 10 }) | ||
| 132 | - .markAnchor({ x: '100%' }) | ||
| 133 | - .backgroundImage($r('app.media.ic_like_back')) | ||
| 134 | - .backgroundImageSize({height: 13}) | 146 | + .textAlign(TextAlign.Center) |
| 147 | + .alignRules({ | ||
| 148 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 149 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 150 | + })// .margin({left: 4,right:4 | ||
| 151 | + // }) | ||
| 152 | + /*动态计算文字宽度*/ | ||
| 135 | .width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) + | 153 | .width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) + |
| 136 | - 12) | 154 | + 12)// .backgroundColor(Color.Green) |
| 155 | + .id("Text") | ||
| 137 | .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden) | 156 | .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden) |
| 138 | } | 157 | } |
| 158 | + .offset({ | ||
| 159 | + x: 18 | ||
| 160 | + }) | ||
| 161 | + } | ||
| 162 | + } | ||
| 139 | .width(36) | 163 | .width(36) |
| 140 | - .height(42) | 164 | + .height(36) |
| 165 | + .onClick(() => { | ||
| 166 | + this.clickButtonEvent() | ||
| 167 | + }) | ||
| 141 | .visibility(this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible) | 168 | .visibility(this.likesStyle == 'empty' || !this.openLikes ? Visibility.None : Visibility.Visible) |
| 142 | 169 | ||
| 143 | } | 170 | } |
| @@ -164,6 +191,25 @@ export struct LiveLikeComponent { | @@ -164,6 +191,25 @@ export struct LiveLikeComponent { | ||
| 164 | this.LiveModel.getLiveRoomNumberLike(this.likeBean['contentId'], 1, HttpUtils.getDeviceId()).then((data) => { | 191 | this.LiveModel.getLiveRoomNumberLike(this.likeBean['contentId'], 1, HttpUtils.getDeviceId()).then((data) => { |
| 165 | 192 | ||
| 166 | console.log(TAG, '点赞接口调用成功', JSON.stringify(data)) | 193 | console.log(TAG, '点赞接口调用成功', JSON.stringify(data)) |
| 194 | + try { | ||
| 195 | + // 触发马达振动 | ||
| 196 | + vibrator.startVibration({ | ||
| 197 | + type: 'time', | ||
| 198 | + duration: 100, | ||
| 199 | + }, { | ||
| 200 | + id: 0, | ||
| 201 | + usage: 'alarm' | ||
| 202 | + }, (error: BusinessError) => { | ||
| 203 | + if (error) { | ||
| 204 | + console.error(`Failed to start vibration. Code: ${error.code}, message: ${error.message}`); | ||
| 205 | + return; | ||
| 206 | + } | ||
| 207 | + console.info('Succeed in starting vibration'); | ||
| 208 | + }); | ||
| 209 | + } catch (err) { | ||
| 210 | + let e: BusinessError = err as BusinessError; | ||
| 211 | + console.error(`An unexpected error occurred. Code: ${e.code}, message: ${e.message}`); | ||
| 212 | + } | ||
| 167 | this.likeCount++ | 213 | this.likeCount++ |
| 168 | 214 | ||
| 169 | }).catch(() => { | 215 | }).catch(() => { |
| @@ -12,6 +12,9 @@ | @@ -12,6 +12,9 @@ | ||
| 12 | "requestPermissions": [ | 12 | "requestPermissions": [ |
| 13 | { | 13 | { |
| 14 | "name": "ohos.permission.INTERNET" | 14 | "name": "ohos.permission.INTERNET" |
| 15 | + }, | ||
| 16 | + { | ||
| 17 | + "name": "ohos.permission.VIBRATE" | ||
| 15 | } | 18 | } |
| 16 | ], | 19 | ], |
| 17 | "pages": "$profile:main_pages" | 20 | "pages": "$profile:main_pages" |
| @@ -4,7 +4,7 @@ import router from '@ohos.router'; | @@ -4,7 +4,7 @@ import router from '@ohos.router'; | ||
| 4 | 4 | ||
| 5 | import { DetailPlayLivePage } from './DetailPlayLivePage'; | 5 | import { DetailPlayLivePage } from './DetailPlayLivePage'; |
| 6 | import { DetailPlayVLivePage } from './DetailPlayVLivePage'; | 6 | import { DetailPlayVLivePage } from './DetailPlayVLivePage'; |
| 7 | -import { Logger } from 'wdKit/Index'; | 7 | +import { Logger, ToastUtils } from 'wdKit/Index'; |
| 8 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; | 8 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; |
| 9 | 9 | ||
| 10 | const TAG = 'DetailPlayLiveCommon' | 10 | const TAG = 'DetailPlayLiveCommon' |
| @@ -68,19 +68,34 @@ export struct DetailPlayLiveCommon { | @@ -68,19 +68,34 @@ export struct DetailPlayLiveCommon { | ||
| 68 | */ | 68 | */ |
| 69 | getContentDetail() { | 69 | getContentDetail() { |
| 70 | this.liveViewModel.getContentDetail(this.contentId, this.relId, this.relType) | 70 | this.liveViewModel.getContentDetail(this.contentId, this.relId, this.relType) |
| 71 | - .then((data: Array<ContentDetailDTO>) => { | 71 | + .then(async (data: Array<ContentDetailDTO>) => { |
| 72 | console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data)) | 72 | console.log(TAG, '查询视频详情用于评论展示 getContentDetail:', JSON.stringify(data)) |
| 73 | if (data) { | 73 | if (data) { |
| 74 | let detailData = data[0] | 74 | let detailData = data[0] |
| 75 | + //人民号类型单独获取直播地址 | ||
| 76 | + if (detailData.rmhPlatform === 1) { | ||
| 77 | + | ||
| 78 | + let vliveId = detailData.liveInfo.vlive[0].vliveId as string | ||
| 79 | + console.error(TAG, 'vliveId==' + vliveId) | ||
| 80 | + let pullStreamAddressData = await this.liveViewModel.getLiveRoomPullAddress(vliveId) as GetPullAddressBean | ||
| 81 | + | ||
| 82 | + if (pullStreamAddressData) { | ||
| 83 | + console.log(TAG, ' GetPullAddressBean:', JSON.stringify(pullStreamAddressData)) | ||
| 84 | + let m3u8uUrl = pullStreamAddressData.transCode[0].m3u8Url | ||
| 85 | + detailData.liveInfo.vlive[0].liveUrl = m3u8uUrl | ||
| 86 | + this.playUrl = m3u8uUrl | ||
| 87 | + console.log(TAG, ' GetPullAddressBean:', m3u8uUrl) | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + } | ||
| 91 | + | ||
| 75 | this.liveLandscape = | 92 | this.liveLandscape = |
| 76 | - detailData?.liveInfo?.liveLandScape //String(this.contentDetailData?.liveInfo?.liveLandScape || '') | 93 | + detailData?.liveInfo?.liveLandScape |
| 77 | 94 | ||
| 78 | this.liveState = detailData.liveInfo?.liveState | 95 | this.liveState = detailData.liveInfo?.liveState |
| 79 | 96 | ||
| 80 | - | ||
| 81 | this.contentDetailData = data[0] | 97 | this.contentDetailData = data[0] |
| 82 | 98 | ||
| 83 | - console.log(TAG, '查询视频详情用于评论展示 openComment:', detailData.openComment) | ||
| 84 | this.publishCommentModel.targetId = String(detailData?.newsId || '') | 99 | this.publishCommentModel.targetId = String(detailData?.newsId || '') |
| 85 | this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '') | 100 | this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '') |
| 86 | this.publishCommentModel.targetTitle = detailData?.newsTitle | 101 | this.publishCommentModel.targetTitle = detailData?.newsTitle |
| @@ -100,39 +115,19 @@ export struct DetailPlayLiveCommon { | @@ -100,39 +115,19 @@ export struct DetailPlayLiveCommon { | ||
| 100 | this.playUrl = detailData.liveInfo.vlive[0].replayUri | 115 | this.playUrl = detailData.liveInfo.vlive[0].replayUri |
| 101 | } | 116 | } |
| 102 | 117 | ||
| 103 | - //人民号类型单独获取直播地址 | ||
| 104 | - if (detailData.rmhPlatform === 1) { | ||
| 105 | - | ||
| 106 | - let vliveId = detailData.liveInfo.vlive[0].vliveId as string | ||
| 107 | - console.error(TAG, 'vliveId==' + vliveId) | ||
| 108 | - this.liveViewModel.getLiveRoomPullAddress(vliveId) | ||
| 109 | - .then((data: GetPullAddressBean) => { | ||
| 110 | - console.log(TAG, ' GetPullAddressBean:', JSON.stringify(data)) | ||
| 111 | - | ||
| 112 | - }) | ||
| 113 | 118 | ||
| 119 | + } else { | ||
| 120 | + ToastUtils.shortToast('内容不存在') | ||
| 121 | + router.back() | ||
| 114 | } | 122 | } |
| 123 | + },()=>{ | ||
| 124 | + ToastUtils.shortToast('内容不存在') | ||
| 125 | + router.back() | ||
| 115 | 126 | ||
| 116 | - } | ||
| 117 | }) | 127 | }) |
| 118 | } | 128 | } |
| 119 | 129 | ||
| 120 | - // /** | ||
| 121 | - // * | ||
| 122 | - // * @returns true : 沉浸式;false : 非沉浸式 | ||
| 123 | - // */ | ||
| 124 | - // isImmersionLive(): boolean { | ||
| 125 | - // | ||
| 126 | - // let flag = false | ||
| 127 | - // | ||
| 128 | - // if (this.liveState === 'wait' || this.liveLandscape === 'news') { | ||
| 129 | - // flag = false | ||
| 130 | - // } else if (this.liveLandscape === 'general') { | ||
| 131 | - // flag = true | ||
| 132 | - // } | ||
| 133 | - // | ||
| 134 | - // return flag | ||
| 135 | - // } | 130 | + |
| 136 | 131 | ||
| 137 | onPageShow() { | 132 | onPageShow() { |
| 138 | this.pageShow = Math.random() | 133 | this.pageShow = Math.random() |
| @@ -93,10 +93,11 @@ export struct DetailPlayVLivePage { | @@ -93,10 +93,11 @@ export struct DetailPlayVLivePage { | ||
| 93 | .aspectRatio(1) | 93 | .aspectRatio(1) |
| 94 | .visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden) | 94 | .visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden) |
| 95 | .position({ x: '100%', y: '100%' }) | 95 | .position({ x: '100%', y: '100%' }) |
| 96 | - .markAnchor({ x: 56, y: 56 }) | 96 | + .markAnchor({ x: 56, y: this.bottomSafeHeight }) |
| 97 | .onClick(() => { | 97 | .onClick(() => { |
| 98 | this.swiperController.showNext() | 98 | this.swiperController.showNext() |
| 99 | }) | 99 | }) |
| 100 | + | ||
| 100 | } | 101 | } |
| 101 | } | 102 | } |
| 102 | .height('100%') | 103 | .height('100%') |
| @@ -127,6 +127,42 @@ export class LiveModel { | @@ -127,6 +127,42 @@ export class LiveModel { | ||
| 127 | }) | 127 | }) |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * C端评论列表 竖屏直播间 | ||
| 133 | + * @param pageNum | ||
| 134 | + * @param mLiveId | ||
| 135 | + * @param liveId | ||
| 136 | + * @param pageSize | ||
| 137 | + * @returns | ||
| 138 | + */ | ||
| 139 | + getLiveCommentList(pageNum: number, mLiveId: string, liveId: string, pageSize: number) { | ||
| 140 | + let params: Record<string, string> = {}; | ||
| 141 | + params['pageNum'] = pageNum + '' | ||
| 142 | + params['mLiveId'] = mLiveId | ||
| 143 | + params['liveId'] = liveId | ||
| 144 | + params['pageSize'] = pageSize + '' | ||
| 145 | + return new Promise<LiveRoomBean>((success, fail) => { | ||
| 146 | + HttpRequest.post<ResponseDTO<LiveRoomBean>>( | ||
| 147 | + HttpUrlUtils.getLiveCommentListUrl(), | ||
| 148 | + params, | ||
| 149 | + ).then((data: ResponseDTO<LiveRoomBean>) => { | ||
| 150 | + if (!data || !data.data) { | ||
| 151 | + fail("数据为空") | ||
| 152 | + return | ||
| 153 | + } | ||
| 154 | + if (data.code != 0) { | ||
| 155 | + fail(data.message) | ||
| 156 | + return | ||
| 157 | + } | ||
| 158 | + success(data.data) | ||
| 159 | + }, (error: Error) => { | ||
| 160 | + fail(error.message) | ||
| 161 | + Logger.debug(TAG + ":error ", error.toString()) | ||
| 162 | + }) | ||
| 163 | + }) | ||
| 164 | + } | ||
| 165 | + | ||
| 130 | /** | 166 | /** |
| 131 | * 获取直播数据 | 167 | * 获取直播数据 |
| 132 | * @param liveId | 168 | * @param liveId |
| @@ -30,14 +30,7 @@ export class LiveViewModel { | @@ -30,14 +30,7 @@ export class LiveViewModel { | ||
| 30 | 30 | ||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | - getLiveRoomPullAddress(vliveId:string){ | ||
| 34 | - // return new Promise<GetPullAddressBean>((success, fail) => { | ||
| 35 | - // this.liveModel.getContentDetail(contentId, relId, relType).then((data) => { | ||
| 36 | - // success(data) | ||
| 37 | - // }).catch((message: string) => { | ||
| 38 | - // fail(message) | ||
| 39 | - // }) | ||
| 40 | - // }) | 33 | + async getLiveRoomPullAddress(vliveId:string) : Promise<GetPullAddressBean>{ |
| 41 | 34 | ||
| 42 | return new Promise<GetPullAddressBean>((success, fail) => { | 35 | return new Promise<GetPullAddressBean>((success, fail) => { |
| 43 | ContentDetailRequest.getLiveRoomPullStream(vliveId).then(async (resDTO: ResponseDTO<GetPullAddressBean>) => { | 36 | ContentDetailRequest.getLiveRoomPullStream(vliveId).then(async (resDTO: ResponseDTO<GetPullAddressBean>) => { |
| @@ -86,6 +79,17 @@ export class LiveViewModel { | @@ -86,6 +79,17 @@ export class LiveViewModel { | ||
| 86 | }) | 79 | }) |
| 87 | } | 80 | } |
| 88 | 81 | ||
| 82 | + //C端评论列表 竖屏直播间 | ||
| 83 | + getLiveCommentList(pageNum: number, mLiveId: string, liveId: string, pageSize: number) { | ||
| 84 | + return new Promise<LiveRoomBean>((success, fail) => { | ||
| 85 | + this.liveModel.getLiveCommentList(pageNum, mLiveId, liveId, pageSize).then((data) => { | ||
| 86 | + success(data) | ||
| 87 | + }).catch((message: string) => { | ||
| 88 | + fail(message) | ||
| 89 | + }) | ||
| 90 | + }) | ||
| 91 | + } | ||
| 92 | + | ||
| 89 | //直播详情直播间数据 | 93 | //直播详情直播间数据 |
| 90 | getLiveRoomData(liveId: string) { | 94 | getLiveRoomData(liveId: string) { |
| 91 | return new Promise<LiveRoomDataBean>((success, fail) => { | 95 | return new Promise<LiveRoomDataBean>((success, fail) => { |
| @@ -15,6 +15,7 @@ export struct TopPlayComponent { | @@ -15,6 +15,7 @@ export struct TopPlayComponent { | ||
| 15 | playerController?: WDAliPlayerController | 15 | playerController?: WDAliPlayerController |
| 16 | // 预告片图片/视频url | 16 | // 预告片图片/视频url |
| 17 | @State previewUrl: string = '' | 17 | @State previewUrl: string = '' |
| 18 | + // 预告资源是否是视频资源 | ||
| 18 | @State isVideoSource: boolean = false | 19 | @State isVideoSource: boolean = false |
| 19 | //未开始 | 20 | //未开始 |
| 20 | @State isWait: boolean = false | 21 | @State isWait: boolean = false |
| @@ -61,6 +62,9 @@ export struct TopPlayComponent { | @@ -61,6 +62,9 @@ export struct TopPlayComponent { | ||
| 61 | this.updateData() | 62 | this.updateData() |
| 62 | } | 63 | } |
| 63 | 64 | ||
| 65 | + /** | ||
| 66 | + * 更新直播播放数据 | ||
| 67 | + */ | ||
| 64 | updateData() { | 68 | updateData() { |
| 65 | // 检测等待中的直播预告是否视频资源 | 69 | // 检测等待中的直播预告是否视频资源 |
| 66 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1 | 70 | if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewType === 1 |
| @@ -93,7 +97,10 @@ export struct TopPlayComponent { | @@ -93,7 +97,10 @@ export struct TopPlayComponent { | ||
| 93 | 97 | ||
| 94 | this.isEnd = this.contentDetailData?.liveInfo?.liveState === 'end' && | 98 | this.isEnd = this.contentDetailData?.liveInfo?.liveState === 'end' && |
| 95 | StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri) | 99 | StringUtils.isEmpty(this.contentDetailData?.liveInfo?.vlive[0]?.replayUri) |
| 96 | - if (!this.isWait && this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) { | 100 | + |
| 101 | + // Logger.debug(TAG, `---0------>` + this.isWait + ' ->' + this.isLoading + ' ->' + this.isEnd) | ||
| 102 | + if (!this.isWait) { | ||
| 103 | + if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.vlive.length > 0) { | ||
| 97 | let playUrl = '' | 104 | let playUrl = '' |
| 98 | if (this.contentDetailData.liveInfo.liveState == 'running') { | 105 | if (this.contentDetailData.liveInfo.liveState == 'running') { |
| 99 | playUrl = this.contentDetailData.liveInfo.vlive[0].liveUrl | 106 | playUrl = this.contentDetailData.liveInfo.vlive[0].liveUrl |
| @@ -105,17 +112,33 @@ export struct TopPlayComponent { | @@ -105,17 +112,33 @@ export struct TopPlayComponent { | ||
| 105 | this.playUrl = this.previewUrl | 112 | this.playUrl = this.previewUrl |
| 106 | this.tryToPlay() | 113 | this.tryToPlay() |
| 107 | } else { | 114 | } else { |
| 115 | + Logger.debug(TAG, `---0------>${playUrl}`) | ||
| 108 | if (StringUtils.isNotEmpty(playUrl)) { | 116 | if (StringUtils.isNotEmpty(playUrl)) { |
| 109 | - Logger.debug(TAG, `${playUrl}`) | ||
| 110 | this.playUrl = playUrl | 117 | this.playUrl = playUrl |
| 111 | this.tryToPlay() | 118 | this.tryToPlay() |
| 112 | } | 119 | } |
| 113 | } | 120 | } |
| 121 | + } else { | ||
| 122 | + this.isWait = true | ||
| 123 | + this.isLoading = true | ||
| 124 | + } | ||
| 125 | + } | ||
| 114 | 126 | ||
| 127 | + // 文字直播 running 状态 | ||
| 128 | + if (this.contentDetailData?.liveInfo?.liveWay === 1 && this.contentDetailData?.liveInfo?.liveState === 'running') { | ||
| 129 | + this.isWait = true | ||
| 130 | + this.isLoading = true | ||
| 131 | + if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) { | ||
| 132 | + this.previewUrl = this.contentDetailData.fullColumnImgUrls[0].url | ||
| 133 | + } else { | ||
| 134 | + this.previewUrl = '' | ||
| 115 | } | 135 | } |
| 116 | } | 136 | } |
| 117 | 137 | ||
| 138 | + } | ||
| 139 | + | ||
| 118 | tryToPlay() { | 140 | tryToPlay() { |
| 141 | + Logger.debug(TAG, `---1------>`) | ||
| 119 | if (!this.xComponentIsLoaded) { | 142 | if (!this.xComponentIsLoaded) { |
| 120 | Logger.debug(TAG, "需要xComponent加载完成") | 143 | Logger.debug(TAG, "需要xComponent加载完成") |
| 121 | return | 144 | return |
| @@ -136,6 +159,7 @@ export struct TopPlayComponent { | @@ -136,6 +159,7 @@ export struct TopPlayComponent { | ||
| 136 | this.isLoading = false | 159 | this.isLoading = false |
| 137 | this.isError = false | 160 | this.isError = false |
| 138 | this.xComponentIsLoaded = true | 161 | this.xComponentIsLoaded = true |
| 162 | + Logger.debug(TAG, `---onLoad------>`) | ||
| 139 | this.tryToPlay() | 163 | this.tryToPlay() |
| 140 | } | 164 | } |
| 141 | }) | 165 | }) |
| @@ -149,6 +173,7 @@ export struct TopPlayComponent { | @@ -149,6 +173,7 @@ export struct TopPlayComponent { | ||
| 149 | // 直播房间图 | 173 | // 直播房间图 |
| 150 | Image(this.previewUrl) | 174 | Image(this.previewUrl) |
| 151 | .objectFit(ImageFit.Cover) | 175 | .objectFit(ImageFit.Cover) |
| 176 | + .alt($r('app.media.live_room_image_fail')) | ||
| 152 | .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) | 177 | .visibility(this.isWait || this.isEnd ? Visibility.Visible : Visibility.None) |
| 153 | .contrast(this.isEnd ? 0.2 : 1) | 178 | .contrast(this.isEnd ? 0.2 : 1) |
| 154 | .width('100%') | 179 | .width('100%') |
| @@ -13,7 +13,9 @@ import { router } from '@kit.ArkUI' | @@ -13,7 +13,9 @@ import { router } from '@kit.ArkUI' | ||
| 13 | import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index' | 13 | import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index' |
| 14 | 14 | ||
| 15 | const TAG = "PlayerCommentComponent" | 15 | const TAG = "PlayerCommentComponent" |
| 16 | - | 16 | +/** |
| 17 | + * 沉浸式直播--- 聊天区域 | ||
| 18 | + */ | ||
| 17 | @Component | 19 | @Component |
| 18 | export struct PlayerCommentComponent { | 20 | export struct PlayerCommentComponent { |
| 19 | liveViewModel: LiveViewModel = new LiveViewModel() | 21 | liveViewModel: LiveViewModel = new LiveViewModel() |
| @@ -46,7 +48,7 @@ export struct PlayerCommentComponent { | @@ -46,7 +48,7 @@ export struct PlayerCommentComponent { | ||
| 46 | 48 | ||
| 47 | getLiveChatList() { | 49 | getLiveChatList() { |
| 48 | this.pageModel.currentPage = 1 | 50 | this.pageModel.currentPage = 1 |
| 49 | - this.liveViewModel.getLiveChatList( | 51 | + this.liveViewModel.getLiveCommentList( |
| 50 | 1, | 52 | 1, |
| 51 | this.contentDetailData?.liveInfo?.mlive?.mliveId, | 53 | this.contentDetailData?.liveInfo?.mlive?.mliveId, |
| 52 | this.contentDetailData?.newsId+'', | 54 | this.contentDetailData?.newsId+'', |
| @@ -6,7 +6,8 @@ const TAG = 'PlayerComponent' | @@ -6,7 +6,8 @@ const TAG = 'PlayerComponent' | ||
| 6 | 6 | ||
| 7 | @Component | 7 | @Component |
| 8 | export struct PlayerComponent { | 8 | export struct PlayerComponent { |
| 9 | - @Prop playerController: WDAliPlayerController; | 9 | + |
| 10 | + private playerController?: WDAliPlayerController | ||
| 10 | @Consume @Watch('updateData') contentDetailData: ContentDetailDTO | 11 | @Consume @Watch('updateData') contentDetailData: ContentDetailDTO |
| 11 | @Consume @Watch('pageShowChange') pageShow: number | 12 | @Consume @Watch('pageShowChange') pageShow: number |
| 12 | @Consume @Watch('pageHideChange') pageHide: number | 13 | @Consume @Watch('pageHideChange') pageHide: number |
| @@ -16,6 +17,7 @@ export struct PlayerComponent { | @@ -16,6 +17,7 @@ export struct PlayerComponent { | ||
| 16 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 17 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 17 | @State imgUrl: string = '' | 18 | @State imgUrl: string = '' |
| 18 | @State isWait: boolean = false | 19 | @State isWait: boolean = false |
| 20 | + // 0-横屏流画面,1-竖屏幕流画面 | ||
| 19 | @State liveStreamType: number | null = -1 | 21 | @State liveStreamType: number | null = -1 |
| 20 | @State playUrl: string = '' | 22 | @State playUrl: string = '' |
| 21 | @State isCanplay: boolean = false | 23 | @State isCanplay: boolean = false |
| @@ -3,10 +3,12 @@ import { ContentDetailDTO, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Inde | @@ -3,10 +3,12 @@ import { ContentDetailDTO, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Inde | ||
| 3 | import { LiveFollowComponent, LottieView } from 'wdComponent/Index' | 3 | import { LiveFollowComponent, LottieView } from 'wdComponent/Index' |
| 4 | import { NumberFormatterUtils } from 'wdKit/Index' | 4 | import { NumberFormatterUtils } from 'wdKit/Index' |
| 5 | 5 | ||
| 6 | +/** | ||
| 7 | + * 沉浸式直播--- 头部标题 | ||
| 8 | + */ | ||
| 6 | @Preview | 9 | @Preview |
| 7 | @Component | 10 | @Component |
| 8 | export struct PlayerTitleComponent { | 11 | export struct PlayerTitleComponent { |
| 9 | -// @Consume liveDetailsBean: LiveDetailsBean | ||
| 10 | @Consume liveRoomDataBean: LiveRoomDataBean | 12 | @Consume liveRoomDataBean: LiveRoomDataBean |
| 11 | @Consume liveState: string | 13 | @Consume liveState: string |
| 12 | @Consume contentDetailData: ContentDetailDTO | 14 | @Consume contentDetailData: ContentDetailDTO |
| 1 | -import { ContentDetailDTO } from 'wdBean/Index'; | ||
| 2 | -import { WDAliPlayerController, WDPlayerController } from 'wdPlayer/Index'; | 1 | +import { WDAliPlayerController } from 'wdPlayer/Index'; |
| 3 | import { PlayerCommentComponent } from './PlayerCommentComponent'; | 2 | import { PlayerCommentComponent } from './PlayerCommentComponent'; |
| 4 | import { PlayerTitleComponent } from './PlayerTitleComponent'; | 3 | import { PlayerTitleComponent } from './PlayerTitleComponent'; |
| 5 | import { PlayerVideoControlComponent } from './PlayerVideoControlComponent'; | 4 | import { PlayerVideoControlComponent } from './PlayerVideoControlComponent'; |
| 6 | 5 | ||
| 6 | +/** | ||
| 7 | + * 沉浸直播 --- 横滑展示组件 | ||
| 8 | + */ | ||
| 7 | @Component | 9 | @Component |
| 8 | export struct PlayerUIComponent { | 10 | export struct PlayerUIComponent { |
| 9 | private playerController?: WDAliPlayerController | 11 | private playerController?: WDAliPlayerController |
| @@ -12,10 +14,6 @@ export struct PlayerUIComponent { | @@ -12,10 +14,6 @@ export struct PlayerUIComponent { | ||
| 12 | build() { | 14 | build() { |
| 13 | Stack() { | 15 | Stack() { |
| 14 | PlayerTitleComponent() | 16 | PlayerTitleComponent() |
| 15 | - // Row() { | ||
| 16 | - // // 全屏与暂停按钮 | ||
| 17 | - // }.layoutWeight(1) | ||
| 18 | - | ||
| 19 | 17 | ||
| 20 | PlayerCommentComponent() | 18 | PlayerCommentComponent() |
| 21 | .visibility(this.isShowControl ? Visibility.Hidden : Visibility.Visible) | 19 | .visibility(this.isShowControl ? Visibility.Hidden : Visibility.Visible) |
sight_harmony/features/wdDetailPlayLive/src/main/resources/base/media/live_room_image_fail.png
0 → 100644
11.6 KB
| @@ -8,10 +8,14 @@ import PushManager, { | @@ -8,10 +8,14 @@ import PushManager, { | ||
| 8 | import { AppUtils, DeviceUtil, EmitterEventId, EmitterUtils, Logger, SPHelper } from 'wdKit/Index'; | 8 | import { AppUtils, DeviceUtil, EmitterEventId, EmitterUtils, Logger, SPHelper } from 'wdKit/Index'; |
| 9 | import { HostEnum, HostManager, HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; | 9 | import { HostEnum, HostManager, HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; |
| 10 | import { notificationManager } from '@kit.NotificationKit'; | 10 | import { notificationManager } from '@kit.NotificationKit'; |
| 11 | -import { BusinessError } from '@kit.BasicServicesKit'; | 11 | +import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit'; |
| 12 | import { SpConstants } from 'wdConstant/Index'; | 12 | import { SpConstants } from 'wdConstant/Index'; |
| 13 | import { PushContentBean, PushContentParser } from './PushContentParser'; | 13 | import { PushContentBean, PushContentParser } from './PushContentParser'; |
| 14 | import { ParamType, Tracking } from 'wdTracking/Index'; | 14 | import { ParamType, Tracking } from 'wdTracking/Index'; |
| 15 | +import { PushTransmitMessageBean, PushTransmitMessagePayloadBean } from './PushTransmitMessageBean'; | ||
| 16 | +import { JSON } from '@kit.ArkTS'; | ||
| 17 | +import wantAgent from '@ohos.app.ability.wantAgent'; | ||
| 18 | +import { WantAgent } from '@ohos.app.ability.wantAgent'; | ||
| 15 | 19 | ||
| 16 | const TAG = "GetuiPush" | 20 | const TAG = "GetuiPush" |
| 17 | 21 | ||
| @@ -209,7 +213,11 @@ export class GetuiPush { | @@ -209,7 +213,11 @@ export class GetuiPush { | ||
| 209 | return | 213 | return |
| 210 | } | 214 | } |
| 211 | if (this.lastPushContent.online) { | 215 | if (this.lastPushContent.online) { |
| 212 | - if (this.lastPushContent.want) { | 216 | + if (this.lastPushContent.localNotify == true) { |
| 217 | + Logger.debug(TAG, "推送 回执???: " + this.lastPushContent.want) | ||
| 218 | + let gtactionid = 60002;//gtactionid传⼊60002表示个推渠道消息点击了 | ||
| 219 | + PushManager.sendFeedbackMessage(this.lastPushContent.messageId || "", this.lastPushContent.taskId || "", gtactionid) | ||
| 220 | + } else if (this.lastPushContent.want) { | ||
| 213 | Logger.debug(TAG, "推送 回执: " + this.lastPushContent.want) | 221 | Logger.debug(TAG, "推送 回执: " + this.lastPushContent.want) |
| 214 | PushManager.setClickWant(this.lastPushContent.want) | 222 | PushManager.setClickWant(this.lastPushContent.want) |
| 215 | } | 223 | } |
| @@ -325,6 +333,81 @@ export class GetuiPush { | @@ -325,6 +333,81 @@ export class GetuiPush { | ||
| 325 | // */ | 333 | // */ |
| 326 | // int gtactionid = 60002;//gtactionid传⼊60002表示个推渠道消息点击了 | 334 | // int gtactionid = 60002;//gtactionid传⼊60002表示个推渠道消息点击了 |
| 327 | // boolean result = PushManager.sendFeedbackMessage(taskid, messageid, gtactionid); | 335 | // boolean result = PushManager.sendFeedbackMessage(taskid, messageid, gtactionid); |
| 336 | + this.sendLocalNotification(message) | ||
| 337 | + } | ||
| 338 | + | ||
| 339 | + private sendLocalNotification(message: GTTransmitMessage) { | ||
| 340 | + let jsonMsgObj = JSON.parse(message.payload) as PushTransmitMessageBean | ||
| 341 | + if (!jsonMsgObj) { | ||
| 342 | + return | ||
| 343 | + } | ||
| 344 | + if (jsonMsgObj && jsonMsgObj.payload) { | ||
| 345 | + jsonMsgObj.payloadObj = JSON.parse(jsonMsgObj.payload) as PushTransmitMessagePayloadBean | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + let pushLink = jsonMsgObj.payloadObj?.pushLink || "" | ||
| 349 | + | ||
| 350 | + let params: Record<string, string> = { | ||
| 351 | + "title": jsonMsgObj.title, | ||
| 352 | + "content": jsonMsgObj.body, | ||
| 353 | + "pushLink": pushLink, | ||
| 354 | + "taskid": message.taskId, | ||
| 355 | + "messageId": message.messageId, | ||
| 356 | + "gtTransmitMsgLocalNotify": "1", | ||
| 357 | + } | ||
| 358 | + | ||
| 359 | + this.getWantAgent(params, (error, want) => { | ||
| 360 | + if (error) { | ||
| 361 | + return | ||
| 362 | + } | ||
| 363 | + let notificationRequest: notificationManager.NotificationRequest = { | ||
| 364 | + id: Date.now(), | ||
| 365 | + content: { | ||
| 366 | + notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, | ||
| 367 | + normal: { | ||
| 368 | + title: jsonMsgObj.title, | ||
| 369 | + text: jsonMsgObj.body, | ||
| 370 | + } | ||
| 371 | + }, | ||
| 372 | + notificationSlotType: notificationManager.SlotType.CONTENT_INFORMATION, | ||
| 373 | + wantAgent:want, | ||
| 374 | + }; | ||
| 375 | + notificationManager.publish(notificationRequest).then(() => { | ||
| 376 | + Logger.debug(TAG, "本地发送系统通知完成") | ||
| 377 | + }).catch((err: BusinessError) => { | ||
| 378 | + Logger.debug(TAG, "本地发送系统通知失败:" + JSON.stringify(err)) | ||
| 379 | + }); | ||
| 380 | + }) | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + private getWantAgent(parameters:Record<string, string>, callback: AsyncCallback<WantAgent>) { | ||
| 384 | + | ||
| 385 | + // 通过WantAgentInfo的operationType设置动作类型 | ||
| 386 | + let wantAgentInfo:wantAgent.WantAgentInfo = { | ||
| 387 | + wants: [ | ||
| 388 | + { | ||
| 389 | + deviceId: '', | ||
| 390 | + bundleName: 'com.peopledailychina.hosactivity', | ||
| 391 | + abilityName: 'EntryAbility', | ||
| 392 | + action: 'com.test.pushaction', | ||
| 393 | + entities: [], | ||
| 394 | + uri: "rmrbapp://rmrb.app:8080/openwith", | ||
| 395 | + parameters: parameters | ||
| 396 | + } | ||
| 397 | + ], | ||
| 398 | + operationType: wantAgent.OperationType.START_ABILITY, | ||
| 399 | + requestCode: 0, | ||
| 400 | + wantAgentFlags:[wantAgent.WantAgentFlags.CONSTANT_FLAG] | ||
| 401 | + }; | ||
| 402 | + | ||
| 403 | + wantAgent.getWantAgent(wantAgentInfo, (err:BusinessError, data:WantAgent) => { | ||
| 404 | + if (err) { | ||
| 405 | + Logger.error(TAG, `Failed to get want agent. Code is ${err.code}, message is ${err.message}`) | ||
| 406 | + } | ||
| 407 | + if (callback) { | ||
| 408 | + callback(err, data) | ||
| 409 | + } | ||
| 410 | + }); | ||
| 328 | } | 411 | } |
| 329 | 412 | ||
| 330 | private uploadPushInfo(cid: string) { | 413 | private uploadPushInfo(cid: string) { |
| @@ -11,6 +11,12 @@ export interface PushContentBean { | @@ -11,6 +11,12 @@ export interface PushContentBean { | ||
| 11 | pushLink?: string // 解析want,对应pushLink参数 | 11 | pushLink?: string // 解析want,对应pushLink参数 |
| 12 | notifyTitle?: string | 12 | notifyTitle?: string |
| 13 | notifyContent?: string | 13 | notifyContent?: string |
| 14 | + | ||
| 15 | + | ||
| 16 | + // 透传消息发送的本地测试通知 | ||
| 17 | + localNotify?:boolean | ||
| 18 | + taskId?: string | ||
| 19 | + messageId?: string | ||
| 14 | } | 20 | } |
| 15 | 21 | ||
| 16 | /* | 22 | /* |
| @@ -18,6 +24,8 @@ export interface PushContentBean { | @@ -18,6 +24,8 @@ export interface PushContentBean { | ||
| 18 | * */ | 24 | * */ |
| 19 | export class PushContentParser { | 25 | export class PushContentParser { |
| 20 | 26 | ||
| 27 | + | ||
| 28 | + private static LAUNCH_PARAM_GETUI_TRANSMIT_MSG_LOCAL_NOTIFY = "gtTransmitMsgLocalNotify" | ||
| 21 | private static LAUNCH_PARAM_GETUI_DATA = "gtdata" | 29 | private static LAUNCH_PARAM_GETUI_DATA = "gtdata" |
| 22 | private static LAUNCH_PARAM_GETUI_TASKID = "taskid" | 30 | private static LAUNCH_PARAM_GETUI_TASKID = "taskid" |
| 23 | private static LAUNCH_PARAM_GETUI_NOTIFYID = "_push_notifyid" | 31 | private static LAUNCH_PARAM_GETUI_NOTIFYID = "_push_notifyid" |
| @@ -116,6 +124,21 @@ export class PushContentParser { | @@ -116,6 +124,21 @@ export class PushContentParser { | ||
| 116 | } | 124 | } |
| 117 | } | 125 | } |
| 118 | 126 | ||
| 127 | + | ||
| 128 | + // 本地发送的测试通知 | ||
| 129 | + if (want && want.parameters && want.parameters[PushContentParser.LAUNCH_PARAM_GETUI_TRANSMIT_MSG_LOCAL_NOTIFY]) { | ||
| 130 | + if (want.parameters[PushContentParser.PUSH_PARAM_PUSH_LINK]) { | ||
| 131 | + let pushLink = want.parameters[PushContentParser.PUSH_PARAM_PUSH_LINK] as string | ||
| 132 | + return { | ||
| 133 | + isPush: true, online: true, pushLink: pushLink, want: want, | ||
| 134 | + notifyTitle: want.parameters["title"] as string, | ||
| 135 | + notifyContent: want.parameters["content"] as string, | ||
| 136 | + localNotify: true, | ||
| 137 | + taskId: want.parameters["taskId"] as string, | ||
| 138 | + messageId: want.parameters["messageId"] as string, | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + } | ||
| 119 | return { | 142 | return { |
| 120 | isPush: false, online: false | 143 | isPush: false, online: false |
| 121 | } | 144 | } |
| @@ -59,7 +59,8 @@ export struct WDPlayerRenderVLiveView { | @@ -59,7 +59,8 @@ export struct WDPlayerRenderVLiveView { | ||
| 59 | 59 | ||
| 60 | this.playerController.onVideoSizeChange = (width: number, height: number) => { | 60 | this.playerController.onVideoSizeChange = (width: number, height: number) => { |
| 61 | // console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`) | 61 | // console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`) |
| 62 | - Logger.info(TAG, ` onVideoSizeChange width:${width} videoTop:${height}`) | 62 | + // Logger.info(TAG, ` onVideoSizeChange width:${width} videoTop:${height}`) |
| 63 | + console.error(TAG, ` onVideoSizeChange width:${width} videoTop:${height}`) | ||
| 63 | this.videoWidth = width; | 64 | this.videoWidth = width; |
| 64 | this.videoHeight = height; | 65 | this.videoHeight = height; |
| 65 | this.updateLayout() | 66 | this.updateLayout() |
| @@ -7,7 +7,7 @@ import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/Mine | @@ -7,7 +7,7 @@ import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/Mine | ||
| 7 | import { CompUtils, TopNavigationComponent, TopNavigationComponentNew } 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 | -import { ImageKnifeComponent, ImageKnifeOption, NONE } from '@ohos/imageknife'; | 10 | +import { ALL, ImageKnifeComponent, ImageKnifeOption, NONE } from '@ohos/imageknife'; |
| 11 | 11 | ||
| 12 | const TAG = 'BottomNavigationComponent'; | 12 | const TAG = 'BottomNavigationComponent'; |
| 13 | PersistentStorage.persistProp('channelIds', ''); | 13 | PersistentStorage.persistProp('channelIds', ''); |
| @@ -188,8 +188,8 @@ export struct BottomNavigationComponent { | @@ -188,8 +188,8 @@ export struct BottomNavigationComponent { | ||
| 188 | errorholderSrc: defaultIcon, | 188 | errorholderSrc: defaultIcon, |
| 189 | // 是否开启一级内存缓存 | 189 | // 是否开启一级内存缓存 |
| 190 | isCacheable: true, | 190 | isCacheable: true, |
| 191 | - // 磁盘缓存none | ||
| 192 | - strategy: new NONE() | 191 | + // 磁盘缓存 |
| 192 | + strategy: new ALL() | ||
| 193 | }; | 193 | }; |
| 194 | return imageKnifeOption | 194 | return imageKnifeOption |
| 195 | } | 195 | } |
| @@ -263,6 +263,7 @@ export struct BottomNavigationComponent { | @@ -263,6 +263,7 @@ export struct BottomNavigationComponent { | ||
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | onBottomNavigationDataUpdated() { | 265 | onBottomNavigationDataUpdated() { |
| 266 | + Logger.error('yyyy','onBottomNavigationDataUpdated '+JSON.stringify(this.bottomNavList)) | ||
| 266 | // Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`); | 267 | // Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`); |
| 267 | } | 268 | } |
| 268 | 269 |
-
Please register or login to post a comment