Showing
4 changed files
with
79 additions
and
15 deletions
| @@ -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(() => { |
-
Please register or login to post a comment