Showing
5 changed files
with
24 additions
and
66 deletions
| @@ -77,11 +77,6 @@ export struct CardMediaInfo { | @@ -77,11 +77,6 @@ export struct CardMediaInfo { | ||
| 77 | .width(14) | 77 | .width(14) |
| 78 | .height(14) | 78 | .height(14) |
| 79 | .margin({ right: 3 }) | 79 | .margin({ right: 3 }) |
| 80 | - .shadow({ | ||
| 81 | - radius: 2, | ||
| 82 | - color: 'rgba(0,0,0,0.3)', | ||
| 83 | - offsetY: 2 | ||
| 84 | - }) | ||
| 85 | } | 80 | } |
| 86 | } | 81 | } |
| 87 | 82 |
| @@ -5,51 +5,49 @@ import { DateTimeUtils } from 'wdKit/Index'; | @@ -5,51 +5,49 @@ import { DateTimeUtils } from 'wdKit/Index'; | ||
| 5 | @Component | 5 | @Component |
| 6 | export struct CardSourceInfo { | 6 | export struct CardSourceInfo { |
| 7 | @State contentDTO: ContentDTO = {} as ContentDTO; | 7 | @State contentDTO: ContentDTO = {} as ContentDTO; |
| 8 | + | ||
| 8 | build() { | 9 | build() { |
| 9 | Flex() { | 10 | Flex() { |
| 10 | - if(this.contentDTO.corner) { | 11 | + if (this.contentDTO.corner) { |
| 11 | Text(this.contentDTO.corner) | 12 | Text(this.contentDTO.corner) |
| 12 | .fontSize($r("app.float.font_size_12")) | 13 | .fontSize($r("app.float.font_size_12")) |
| 13 | .fontColor($r("app.color.color_ED2800")) | 14 | .fontColor($r("app.color.color_ED2800")) |
| 14 | - .margin({right: 2}) | 15 | + .margin({ right: 2 }) |
| 15 | } | 16 | } |
| 16 | - if(this.contentDTO.rmhPlatform === 1) { | 17 | + if (this.contentDTO.rmhPlatform === 1) { |
| 17 | Text(this.contentDTO.rmhInfo.rmhName) | 18 | Text(this.contentDTO.rmhInfo.rmhName) |
| 18 | .fontSize($r("app.float.font_size_12")) | 19 | .fontSize($r("app.float.font_size_12")) |
| 19 | .fontColor($r("app.color.color_B0B0B0")) | 20 | .fontColor($r("app.color.color_B0B0B0")) |
| 20 | .maxLines(1) | 21 | .maxLines(1) |
| 21 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 22 | - Image($r("app.media.point")) | ||
| 23 | - .width(16) | ||
| 24 | - .height(16) | ||
| 25 | - } else if(this.contentDTO.source) { | 22 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 23 | + } else if (this.contentDTO.source) { | ||
| 26 | Text(`${this.contentDTO.source}`) | 24 | Text(`${this.contentDTO.source}`) |
| 27 | .fontSize($r("app.float.font_size_12")) | 25 | .fontSize($r("app.float.font_size_12")) |
| 28 | .fontColor($r("app.color.color_B0B0B0")) | 26 | .fontColor($r("app.color.color_B0B0B0")) |
| 29 | .maxLines(1) | 27 | .maxLines(1) |
| 30 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | 28 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 31 | } | 29 | } |
| 32 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | 30 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 |
| 33 | - if(this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | 31 | + if (this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime |
| 34 | (Number | 32 | (Number |
| 35 | .parseFloat(this | 33 | .parseFloat(this |
| 36 | - .contentDTO.publishTime)) | 34 | + .contentDTO.publishTime)) |
| 37 | .indexOf | 35 | .indexOf |
| 38 | - ('-') === -1) { | 36 | + ('-') === -1) { |
| 39 | Image($r("app.media.point")) | 37 | Image($r("app.media.point")) |
| 40 | .width(16) | 38 | .width(16) |
| 41 | .height(16) | 39 | .height(16) |
| 42 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | 40 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 43 | .fontSize($r("app.float.font_size_12")) | 41 | .fontSize($r("app.float.font_size_12")) |
| 44 | .fontColor($r("app.color.color_B0B0B0")) | 42 | .fontColor($r("app.color.color_B0B0B0")) |
| 45 | - .margin({ right: 6 }) | ||
| 46 | .flexShrink(0) | 43 | .flexShrink(0) |
| 47 | } | 44 | } |
| 48 | - if(this.contentDTO?.interactData?.commentNum) { | 45 | + if (this.contentDTO?.interactData?.commentNum) { |
| 49 | Text(`${this.contentDTO.interactData.commentNum}评`) | 46 | Text(`${this.contentDTO.interactData.commentNum}评`) |
| 50 | .fontSize($r("app.float.font_size_12")) | 47 | .fontSize($r("app.float.font_size_12")) |
| 51 | .fontColor($r("app.color.color_B0B0B0")) | 48 | .fontColor($r("app.color.color_B0B0B0")) |
| 52 | .flexShrink(0) | 49 | .flexShrink(0) |
| 50 | + .margin({ left: 6 }) | ||
| 53 | } | 51 | } |
| 54 | } | 52 | } |
| 55 | .width(CommonConstants.FULL_WIDTH) | 53 | .width(CommonConstants.FULL_WIDTH) |
| 1 | // 视频直播横划卡16:9 | 1 | // 视频直播横划卡16:9 |
| 2 | -import { LiveVideoTypeComponent } from './LiveVideoTypeComponent' | ||
| 3 | import { LiveHorizontalCardForOneComponent } from './LiveHorizontalCardForOneComponent' | 2 | import { LiveHorizontalCardForOneComponent } from './LiveHorizontalCardForOneComponent' |
| 4 | import { Action, CompDTO, ContentDTO, Params } from 'wdBean' | 3 | import { Action, CompDTO, ContentDTO, Params } from 'wdBean' |
| 5 | import { CommonConstants } from 'wdConstant' | 4 | import { CommonConstants } from 'wdConstant' |
| 6 | import { WDRouterRule } from 'wdRouter/Index' | 5 | import { WDRouterRule } from 'wdRouter/Index' |
| 7 | - | 6 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 8 | @Component | 7 | @Component |
| 9 | export struct LiveHorizontalCardComponent { | 8 | export struct LiveHorizontalCardComponent { |
| 10 | @State compDTO: CompDTO = {} as CompDTO | 9 | @State compDTO: CompDTO = {} as CompDTO |
| @@ -60,19 +59,9 @@ export struct LiveHorizontalCardComponent { | @@ -60,19 +59,9 @@ export struct LiveHorizontalCardComponent { | ||
| 60 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) | 59 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) |
| 61 | .borderRadius(4) | 60 | .borderRadius(4) |
| 62 | .objectFit(ImageFit.Cover) | 61 | .objectFit(ImageFit.Cover) |
| 63 | - if (item.objectType === '2' && item.liveInfo && item.liveInfo.liveState === 'running') { | ||
| 64 | - LiveVideoTypeComponent({ nType: 0, name: '直播中' }) | ||
| 65 | - .padding({ | ||
| 66 | - bottom: 4, | ||
| 67 | - right: 4 | ||
| 68 | - }) | ||
| 69 | - } else if (item.objectType === '1' && item.videoInfo) { | ||
| 70 | - LiveVideoTypeComponent({ nType: 1, name: item.videoInfo.videoDuration + "" }) | ||
| 71 | - .padding({ | ||
| 72 | - bottom: 4, | ||
| 73 | - right: 4 | ||
| 74 | - }) | ||
| 75 | - } | 62 | + CardMediaInfo({ |
| 63 | + contentDTO: item | ||
| 64 | + }) | ||
| 76 | } | 65 | } |
| 77 | 66 | ||
| 78 | Text(item.newsTitle) | 67 | Text(item.newsTitle) |
| 1 | // 视频直播横划卡16:9/1个 | 1 | // 视频直播横划卡16:9/1个 |
| 2 | import { CommonConstants } from 'wdConstant' | 2 | import { CommonConstants } from 'wdConstant' |
| 3 | import { ContentDTO } from 'wdBean' | 3 | import { ContentDTO } from 'wdBean' |
| 4 | -import { LiveVideoTypeComponent } from './LiveVideoTypeComponent' | ||
| 5 | - | 4 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | @Component | 5 | @Component |
| 7 | export struct LiveHorizontalCardForOneComponent { | 6 | export struct LiveHorizontalCardForOneComponent { |
| 8 | @State contentDTO: ContentDTO = {} as ContentDTO | 7 | @State contentDTO: ContentDTO = {} as ContentDTO |
| @@ -15,21 +14,9 @@ export struct LiveHorizontalCardForOneComponent { | @@ -15,21 +14,9 @@ export struct LiveHorizontalCardForOneComponent { | ||
| 15 | .width(CommonConstants.FULL_WIDTH) | 14 | .width(CommonConstants.FULL_WIDTH) |
| 16 | .borderRadius(4) | 15 | .borderRadius(4) |
| 17 | .objectFit(ImageFit.Cover) | 16 | .objectFit(ImageFit.Cover) |
| 18 | - if (this.contentDTO.objectType === '2' | ||
| 19 | - && this.contentDTO.liveInfo | ||
| 20 | - && this.contentDTO.liveInfo.liveState === 'running') { | ||
| 21 | - LiveVideoTypeComponent({ nType: 0, name: '直播中' }) | ||
| 22 | - .padding({ | ||
| 23 | - bottom: 2, | ||
| 24 | - right: 2 | ||
| 25 | - }) | ||
| 26 | - } else if (this.contentDTO.objectType === '1' && this.contentDTO.videoInfo) { | ||
| 27 | - LiveVideoTypeComponent({ nType: 1, name: this.contentDTO.videoInfo.videoDuration + '' ?? '00:00' }) | ||
| 28 | - .padding({ | ||
| 29 | - bottom: 2, | ||
| 30 | - right: 2 | ||
| 31 | - }) | ||
| 32 | - } | 17 | + CardMediaInfo({ |
| 18 | + contentDTO: this.contentDTO | ||
| 19 | + }) | ||
| 33 | } | 20 | } |
| 34 | 21 | ||
| 35 | Text(this.contentDTO.newsTitle) | 22 | Text(this.contentDTO.newsTitle) |
| 1 | // 视频直播直播预约 | 1 | // 视频直播直播预约 |
| 2 | -import { LiveVideoTypeComponent } from './LiveVideoTypeComponent' | ||
| 3 | import { LiveHorizontalCardForOneComponent } from './LiveHorizontalCardForOneComponent' | 2 | import { LiveHorizontalCardForOneComponent } from './LiveHorizontalCardForOneComponent' |
| 4 | import { CompDTO, ContentDTO } from 'wdBean' | 3 | import { CompDTO, ContentDTO } from 'wdBean' |
| 5 | import { CommonConstants } from 'wdConstant' | 4 | import { CommonConstants } from 'wdConstant' |
| 6 | import { StringUtils } from 'wdKit/Index' | 5 | import { StringUtils } from 'wdKit/Index' |
| 7 | - | 6 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 8 | @Component | 7 | @Component |
| 9 | export struct LiveHorizontalReservationComponent { | 8 | export struct LiveHorizontalReservationComponent { |
| 10 | @State compDTO: CompDTO = {} as CompDTO | 9 | @State compDTO: CompDTO = {} as CompDTO |
| @@ -51,19 +50,9 @@ export struct LiveHorizontalReservationComponent { | @@ -51,19 +50,9 @@ export struct LiveHorizontalReservationComponent { | ||
| 51 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) | 50 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) |
| 52 | .borderRadius(4) | 51 | .borderRadius(4) |
| 53 | .objectFit(ImageFit.Cover) | 52 | .objectFit(ImageFit.Cover) |
| 54 | - if (item.objectType === '2' && item.liveInfo && item.liveInfo.liveState === 'running') { | ||
| 55 | - LiveVideoTypeComponent({ nType: 0, name: '直播中' }) | ||
| 56 | - .padding({ | ||
| 57 | - bottom: 4, | ||
| 58 | - right: 4 | ||
| 59 | - }) | ||
| 60 | - } else if (item.objectType === '1' && item.videoInfo) { | ||
| 61 | - LiveVideoTypeComponent({ nType: 1, name: item.videoInfo.videoDuration + "" }) | ||
| 62 | - .padding({ | ||
| 63 | - bottom: 4, | ||
| 64 | - right: 4 | ||
| 65 | - }) | ||
| 66 | - } | 53 | + CardMediaInfo({ |
| 54 | + contentDTO: item | ||
| 55 | + }) | ||
| 67 | } | 56 | } |
| 68 | 57 | ||
| 69 | Text(item.newsTitle) | 58 | Text(item.newsTitle) |
-
Please register or login to post a comment