liyubing

Merge remote-tracking branch 'origin/main'

@@ -13,8 +13,20 @@ const LOCAL_CHANNEL: string = '地方频道' @@ -13,8 +13,20 @@ const LOCAL_CHANNEL: string = '地方频道'
13 13
14 const TAG: string = 'ChannelSubscriptionLayout' 14 const TAG: string = 'ChannelSubscriptionLayout'
15 15
16 -@CustomDialog  
17 -struct ChannelDialog { 16 +// @Entry
  17 +@Component
  18 +struct ChannelSubscriptionLayout {
  19 + @State indexSettingArray: string [] = ['推荐', '热点']
  20 + //当前选中的频道
  21 + @Link currentTopNavSelectedIndex: number;
  22 + @Prop homeChannelList: TopNavDTO []
  23 + @Prop indexSettingChannelId: number
  24 + @Link myChannelList: TopNavDTO []
  25 + @Link moreChannelList: TopNavDTO []
  26 + @Link localChannelList: TopNavDTO []
  27 + @Link channelIds: number []
  28 + @StorageLink('channelIds') storeChannelIds: string = ''
  29 + @State isShow: boolean = false
18 @State dragItem: number = -1 30 @State dragItem: number = -1
19 private dragRefOffsetX: number = 0 31 private dragRefOffsetX: number = 0
20 private dragRefOffsetY: number = 0 32 private dragRefOffsetY: number = 0
@@ -25,26 +37,40 @@ struct ChannelDialog { @@ -25,26 +37,40 @@ struct ChannelDialog {
25 @State indexSettingTabIndex: number = 0 37 @State indexSettingTabIndex: number = 0
26 @State isEditIng: boolean = false 38 @State isEditIng: boolean = false
27 @State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO 39 @State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO
28 - @Link currentTopNavSelectedIndex: number  
29 - @Link myChannelList: TopNavDTO[]  
30 - @Link moreChannelList: TopNavDTO[]  
31 - @Link localChannelList: TopNavDTO[]  
32 - @Link homeChannelList: TopNavDTO[]  
33 - @Link indexSettingChannelId: number  
34 - controller?: CustomDialogController  
35 - confirm: (index: number) => void = () => {  
36 - }  
37 - changeChannelIndex: (index1: number, index2: number) => void = () => {  
38 - }  
39 - delChannelItem: (index: number) => void = () => {  
40 - }  
41 - addChannelItem: (item: TopNavDTO) => void = () => { 40 + changeTab: (index: number) => void = () => {
42 } 41 }
43 42
44 aboutToAppear() { 43 aboutToAppear() {
45 this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex] 44 this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex]
46 } 45 }
47 46
  47 + //交换我的频道数组中的位置
  48 + changeChannelIndex(index1: number, index2: number) {
  49 + let tmp = this.myChannelList.splice(index1, 1)
  50 + let channelIdTmp = this.channelIds.splice(index1, 1)
  51 + this.myChannelList.splice(index2, 0, tmp[0])
  52 + this.channelIds.splice(index2, 0, channelIdTmp[0])
  53 + this.storeChannelIds = this.channelIds.join(',')
  54 + }
  55 + //删除频道
  56 + delChannelItem(index: number){
  57 + let item = this.myChannelList.splice(index, 1)[0]
  58 + this.channelIds.splice(index, 1)
  59 + this.storeChannelIds = this.channelIds.join(',')
  60 + if (item.moreChannel === '1') {
  61 + this.moreChannelList.unshift(item)
  62 + }
  63 + if (item.localChannel === '1') {
  64 + this.localChannelList.unshift(item)
  65 + }
  66 + }
  67 + // 添加频道
  68 + addChannelItem(item: TopNavDTO){
  69 + this.channelIds.push(item.channelId)
  70 + this.myChannelList.push(item)
  71 + this.storeChannelIds = this.channelIds.join(',')
  72 + }
  73 +
48 itemMove(index: number, newIndex: number): void { 74 itemMove(index: number, newIndex: number): void {
49 let targetItem = this.myChannelList[newIndex] 75 let targetItem = this.myChannelList[newIndex]
50 if (!(targetItem?.headlinesOn === 1 || targetItem?.movePermitted === 0 || targetItem?.homeChannel === '1')) { 76 if (!(targetItem?.headlinesOn === 1 || targetItem?.movePermitted === 0 || targetItem?.homeChannel === '1')) {
@@ -176,7 +202,8 @@ struct ChannelDialog { @@ -176,7 +202,8 @@ struct ChannelDialog {
176 } 202 }
177 } 203 }
178 204
179 - build() { 205 + @Builder
  206 + sheetBuilder() {
180 Column() { 207 Column() {
181 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { 208 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
182 Image($r('app.media.icon_ren_min_ri_bao')) 209 Image($r('app.media.icon_ren_min_ri_bao'))
@@ -185,7 +212,7 @@ struct ChannelDialog { @@ -185,7 +212,7 @@ struct ChannelDialog {
185 Image($r('app.media.close_button')) 212 Image($r('app.media.close_button'))
186 .width(24) 213 .width(24)
187 .onClick(() => { 214 .onClick(() => {
188 - this.controller?.close() 215 + this.isShow = false
189 }) 216 })
190 } 217 }
191 .width('100%') 218 .width('100%')
@@ -310,8 +337,8 @@ struct ChannelDialog { @@ -310,8 +337,8 @@ struct ChannelDialog {
310 this.delChannelItem(index) 337 this.delChannelItem(index)
311 } 338 }
312 } else { 339 } else {
313 - this.confirm(index)  
314 - this.controller?.close() 340 + this.changeTab(index)
  341 + this.isShow = false
315 } 342 }
316 }), 343 }),
317 LongPressGesture({ repeat: true }) 344 LongPressGesture({ repeat: true })
@@ -464,73 +491,6 @@ struct ChannelDialog { @@ -464,73 +491,6 @@ struct ChannelDialog {
464 }) 491 })
465 .backgroundColor('#ffffff') 492 .backgroundColor('#ffffff')
466 } 493 }
467 -}  
468 -  
469 -// @Entry  
470 -@Component  
471 -struct ChannelSubscriptionLayout {  
472 - @State indexSettingArray: string [] = ['推荐', '热点']  
473 - //当前选中的频道  
474 - @Link currentTopNavSelectedIndex: number;  
475 - @Prop homeChannelList: TopNavDTO []  
476 - @Prop indexSettingChannelId: number  
477 - @Link myChannelList: TopNavDTO []  
478 - @Link moreChannelList: TopNavDTO []  
479 - @Link localChannelList: TopNavDTO []  
480 - @Link channelIds: number []  
481 - @StorageLink('channelIds') storeChannelIds: string = ''  
482 - changeTab: (index: number) => void = () => {  
483 - }  
484 - //频道弹窗点击切换频道  
485 - onAccept = (index: number) => {  
486 - this.changeTab(index)  
487 - }  
488 - //交换我的频道数组中的位置  
489 - changeChannelIndex = (index1: number, index2: number) => {  
490 - let tmp = this.myChannelList.splice(index1, 1)  
491 - let channelIdTmp = this.channelIds.splice(index1, 1)  
492 - this.myChannelList.splice(index2, 0, tmp[0])  
493 - this.channelIds.splice(index2, 0, channelIdTmp[0])  
494 - this.storeChannelIds = this.channelIds.join(',')  
495 - }  
496 - //删除频道  
497 - delChannelItem = (index: number) => {  
498 - let item = this.myChannelList.splice(index, 1)[0]  
499 - this.channelIds.splice(index, 1)  
500 - this.storeChannelIds = this.channelIds.join(',')  
501 - if (item.moreChannel === '1') {  
502 - this.moreChannelList.unshift(item)  
503 - }  
504 - if (item.localChannel === '1') {  
505 - this.localChannelList.unshift(item)  
506 - }  
507 - }  
508 - // 添加频道  
509 - addChannelItem = (item: TopNavDTO) => {  
510 - this.channelIds.push(item.channelId)  
511 - this.myChannelList.push(item)  
512 - this.storeChannelIds = this.channelIds.join(',')  
513 - }  
514 - dialogController: CustomDialogController | null = new CustomDialogController({  
515 - builder: ChannelDialog({  
516 - currentTopNavSelectedIndex: $currentTopNavSelectedIndex,  
517 - indexSettingChannelId: $indexSettingChannelId,  
518 - homeChannelList: $homeChannelList,  
519 - myChannelList: $myChannelList,  
520 - moreChannelList: $moreChannelList,  
521 - localChannelList: $localChannelList,  
522 - confirm: this.onAccept,  
523 - changeChannelIndex: this.changeChannelIndex,  
524 - delChannelItem: this.delChannelItem,  
525 - addChannelItem: this.addChannelItem  
526 - }),  
527 - alignment: DialogAlignment.TopEnd,  
528 - customStyle: true,  
529 - })  
530 -  
531 - aboutToDisappear() {  
532 - this.dialogController = null // 将dialogController置空  
533 - }  
534 494
535 build() { 495 build() {
536 Row() { 496 Row() {
@@ -542,10 +502,9 @@ struct ChannelSubscriptionLayout { @@ -542,10 +502,9 @@ struct ChannelSubscriptionLayout {
542 .justifyContent(FlexAlign.Center) 502 .justifyContent(FlexAlign.Center)
543 .backgroundColor(Color.White) 503 .backgroundColor(Color.White)
544 .onClick(() => { 504 .onClick(() => {
545 - if (this.dialogController != null) {  
546 - this.dialogController.open()  
547 - } 505 + this.isShow = true
548 }) 506 })
  507 + .bindContentCover(this.isShow, this.sheetBuilder())
549 } 508 }
550 } 509 }
551 510
@@ -7,6 +7,9 @@ import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' @@ -7,6 +7,9 @@ import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel'
7 import { ViewType } from 'wdConstant/Index' 7 import { ViewType } from 'wdConstant/Index'
8 import { LiveViewModel } from '../../viewModel/LiveViewModel' 8 import { LiveViewModel } from '../../viewModel/LiveViewModel'
9 import { TabChatItemComponent } from './TabChatItemComponent' 9 import { TabChatItemComponent } from './TabChatItemComponent'
  10 +import { Logger } from 'wdKit';
  11 +
  12 +const TAG: string = 'TabChatComponent';
10 13
11 @Component 14 @Component
12 export struct TabChatComponent { 15 export struct TabChatComponent {
@@ -84,6 +87,7 @@ export struct TabChatComponent { @@ -84,6 +87,7 @@ export struct TabChatComponent {
84 20,) 87 20,)
85 .then( 88 .then(
86 (data) => { 89 (data) => {
  90 + Logger.debug(TAG, `${JSON.stringify(data)}`)
87 if (data.barrageResponses && data.barrageResponses.length > 0) { 91 if (data.barrageResponses && data.barrageResponses.length > 0) {
88 this.pageModel.viewType = ViewType.LOADED; 92 this.pageModel.viewType = ViewType.LOADED;
89 this.liveChatList.push(...data.barrageResponses) 93 this.liveChatList.push(...data.barrageResponses)
@@ -98,7 +102,8 @@ export struct TabChatComponent { @@ -98,7 +102,8 @@ export struct TabChatComponent {
98 } 102 }
99 }, 103 },
100 () => { 104 () => {
101 - 105 + Logger.debug(TAG, `error`)
  106 + this.pageModel.viewType = ViewType.ERROR;
102 }) 107 })
103 } 108 }
104 109
1 -import { LiveRoomItemBean } from 'wdBean/Index' 1 +import { LiveRoomItemBean, Action, PhotoListBean, Params } from 'wdBean/Index'
2 import { StringUtils } from 'wdKit/Index' 2 import { StringUtils } from 'wdKit/Index'
  3 +// import { Action, LiveRoomItemBean, Params, PhotoListBean } from 'wdBean/Index'
  4 +import { WDRouterRule } from 'wdRouter'
  5 +import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
3 6
4 @Component 7 @Component
5 export struct TabChatItemComponent { 8 export struct TabChatItemComponent {
@@ -14,17 +17,40 @@ export struct TabChatItemComponent { @@ -14,17 +17,40 @@ export struct TabChatItemComponent {
14 .borderRadius(90) 17 .borderRadius(90)
15 .width(24) 18 .width(24)
16 .height(24) 19 .height(24)
17 - Text() {  
18 - Span(this.item.senderUserName + ': ')  
19 - .fontColor('#666666')  
20 - Span(this.item.text)  
21 - .fontColor('#222222') 20 + Column() {
  21 + Row() {
  22 + Text() {
  23 + Span(this.item.senderUserName + ': ')
  24 + .fontColor('#666666')
  25 + Span(this.item.text)
  26 + .fontColor('#222222')
  27 + }
  28 + .margin({ left: 8 })
  29 + .lineHeight(20)
  30 + .layoutWeight(1)
  31 + .fontSize('14fp')
  32 + .fontWeight(400)
  33 + }
  34 + .alignItems(VerticalAlign.Top)
  35 + if (this.item.dataType == 'ZH_TEXT_AND_IMAGE_MSG' && this.item.pictureUrls && this.item.pictureUrls.length > 0) {
  36 + Image(this.item.pictureUrls[0])
  37 + .width(`100%`)
  38 + .objectFit(ImageFit.Contain)
  39 + .borderRadius(4)
  40 + .margin({
  41 + top: 10
  42 + })
  43 + .onClick(() => {
  44 + this.gotoMultipleListImagePage(this.item.pictureUrls[0])
  45 + })
  46 + }
22 } 47 }
23 - .margin({ left: 8 })  
24 - .lineHeight(20) 48 + .margin({
  49 + left: 8,
  50 + right: 8
  51 + })
25 .layoutWeight(1) 52 .layoutWeight(1)
26 - .fontSize('14fp')  
27 - .fontWeight(400) 53 + .alignItems(HorizontalAlign.Start)
28 } 54 }
29 .alignItems(VerticalAlign.Top) 55 .alignItems(VerticalAlign.Top)
30 .padding({ 56 .padding({
@@ -32,6 +58,32 @@ export struct TabChatItemComponent { @@ -32,6 +58,32 @@ export struct TabChatItemComponent {
32 top: 15, 58 top: 15,
33 right: 15 59 right: 15
34 }) 60 })
  61 +
  62 + }
  63 +
  64 + /**
  65 + * 大图列表页
  66 + * @param content
  67 + * */
  68 + gotoMultipleListImagePage(imgUrl: string) {
  69 + const photoList: PhotoListBean[] = []
  70 + photoList.push({
  71 + width: 0,
  72 + height: 0,
  73 + picPath: imgUrl,
  74 + picDesc: ''
  75 + })
  76 + let taskAction: Action = {
  77 + type: 'JUMP_DETAIL_PAGE',
  78 + params: {
  79 + detailPageType: 18,
  80 + extra: {
  81 + photoList: photoList,
  82 + swiperIndex: 0,
  83 + } as ExtraDTO
  84 + } as Params,
  85 + };
  86 + WDRouterRule.jumpWithAction(taskAction)
35 } 87 }
36 88
37 aboutToDisappear(): void { 89 aboutToDisappear(): void {
@@ -9,6 +9,10 @@ import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLay @@ -9,6 +9,10 @@ import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLay
9 import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout' 9 import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout'
10 import { StringUtils } from 'wdKit/Index' 10 import { StringUtils } from 'wdKit/Index'
11 import { LiveViewModel } from '../../viewModel/LiveViewModel' 11 import { LiveViewModel } from '../../viewModel/LiveViewModel'
  12 +import { Logger } from 'wdKit'
  13 +
  14 +const TAG: string = 'TabLiveComponent';
  15 +
12 16
13 @Component 17 @Component
14 export struct TabLiveComponent { 18 export struct TabLiveComponent {
@@ -86,6 +90,7 @@ export struct TabLiveComponent { @@ -86,6 +90,7 @@ export struct TabLiveComponent {
86 20) 90 20)
87 .then( 91 .then(
88 (data) => { 92 (data) => {
  93 + Logger.debug(TAG, `${JSON.stringify(data)}`)
89 if (data.barrageResponses && data.barrageResponses.length > 0) { 94 if (data.barrageResponses && data.barrageResponses.length > 0) {
90 /** 95 /**
91 * 在直播聊天添加一条新内容逻辑: 96 * 在直播聊天添加一条新内容逻辑:
@@ -119,6 +124,8 @@ export struct TabLiveComponent { @@ -119,6 +124,8 @@ export struct TabLiveComponent {
119 } 124 }
120 }, 125 },
121 () => { 126 () => {
  127 + Logger.debug(TAG, `Error`)
  128 + this.pageModel.viewType = ViewType.ERROR;
122 129
123 }) 130 })
124 } 131 }
@@ -88,15 +88,15 @@ export struct TabLiveItemComponent { @@ -88,15 +88,15 @@ export struct TabLiveItemComponent {
88 if (this.item.pictureUrls.length > 1) { 88 if (this.item.pictureUrls.length > 1) {
89 Image(itemSub) 89 Image(itemSub)
90 .width(`${100 / this.item.pictureUrls.length}%`) 90 .width(`${100 / this.item.pictureUrls.length}%`)
91 - .height(70)  
92 - .objectFit(ImageFit.Auto) 91 + // .height(70)
  92 + .objectFit(ImageFit.Contain)
93 .borderRadius(4) 93 .borderRadius(4)
94 } else { 94 } else {
95 Image(itemSub) 95 Image(itemSub)
96 .width(`100%`) 96 .width(`100%`)
97 // .aspectRatio(this.getAspectRation()) 97 // .aspectRatio(this.getAspectRation())
98 - .height(177)  
99 - .objectFit(ImageFit.Auto) 98 + // .height(177)
  99 + .objectFit(ImageFit.Contain)
100 .borderRadius(4) 100 .borderRadius(4)
101 } 101 }
102 }.onClick(() => { 102 }.onClick(() => {