Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yanlu
2024-05-15 16:34:35 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
628f348990bd5e80947dac85b5eb72c37607e127
628f3489
2 parents
4f67d97a
2351ac0b
Merge commit '
2351ac0b
'
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
204 additions
and
40 deletions
sight_harmony/features/wdBean/src/main/ets/bean/content/ContentDTO.ets
sight_harmony/features/wdComponent/Index.ets
sight_harmony/features/wdComponent/src/main/ets/components/CardParser.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card11Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card2Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card3Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card4Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card5Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card6Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/SearchContentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PictureLoading.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerComponent.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
sight_harmony/features/wdBean/src/main/ets/bean/content/ContentDTO.ets
View file @
628f348
...
...
@@ -61,6 +61,7 @@ export class ContentDTO implements BaseDTO {
videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的
newsSummary: string = ''; //appstyle:2 ,新闻详情
contentText?: string ='';
// 二次请求接口,返回的数据,这里组装到content里;
interactData?: InteractDataDTO;
...
...
sight_harmony/features/wdComponent/Index.ets
View file @
628f348
...
...
@@ -87,3 +87,5 @@ export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyC
export { LiveFollowComponent } from "./src/main/ets/components/cardCommon/LiveFollowComponent"
export { publishCommentModel } from './src/main/ets/components/comment/model/PublishCommentModel';
...
...
sight_harmony/features/wdComponent/src/main/ets/components/CardParser.ets
View file @
628f348
...
...
@@ -16,6 +16,8 @@ import { Card17Component } from './cardview/Card17Component';
import { Card19Component } from './cardview/Card19Component';
import { Card20Component } from './cardview/Card20Component';
import { Card21Component } from './cardview/Card21Component';
import { SearchContentComponent } from './cardview/SearchContentComponent';
import { Logger } from 'wdKit/Index';
/**
* card适配器,卡片样式汇总,依据ContentDTO#appStyle
...
...
@@ -26,12 +28,19 @@ export struct CardParser {
@State contentDTO: ContentDTO = new ContentDTO();
@State compDTO: CompDTO = {} as CompDTO
aboutToAppear(): void {
Logger.info('contentDTO.contentText', JSON.stringify(this.contentDTO))
}
build() {
this.contentBuilder(this.contentDTO, this.compDTO);
}
@Builder
contentBuilder(contentDTO: ContentDTO, compDTO: CompDTO) {
if (!!contentDTO.contentText) {
SearchContentComponent({ contentDTO })
} else {
if (contentDTO.appStyle === CompStyle.Card_02) {
Card2Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_03) {
...
...
@@ -73,4 +82,6 @@ export struct CardParser {
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card11Component.ets
View file @
628f348
//缩略标题
import { CommonConstants } from 'wdConstant'
import { ContentDTO } from 'wdBean'
import { DateTimeUtils } from 'wdKit'
import { CommonConstants } from 'wdConstant';
import { ContentDTO } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
const TAG = 'Card11Component';
/**
...
...
@@ -16,12 +17,21 @@ export struct Card11Component {
build() {
Column() {
Stack() {
if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text(this.contentDTO.newsTitle)
.fontSize($r("app.float.font_size_16"))
.fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width(CommonConstants.FULL_WIDTH)
.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
}.alignContent(Alignment.TopStart)
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
}.width(CommonConstants.FULL_WIDTH)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card2Component.ets
View file @
628f348
...
...
@@ -22,12 +22,26 @@ export struct Card2Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
// this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
if (this.contentDTO.title.includes('<em>') && this.contentDTO.title.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.newsTitle?.split('<em>')[0] || '';
this.str02 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column() {
Column() {
...
...
@@ -36,7 +50,17 @@ export struct Card2Component {
if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text(this.contentDTO.newsTitle)
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(2)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card3Component.ets
View file @
628f348
import { ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant'
import { CommonConstants } from 'wdConstant'
;
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
/**
* 卡片样式:"appStyle":"3"
...
...
@@ -14,10 +15,17 @@ export struct Card3Component {
build() {
Column() {
Stack() {
if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text(this.contentDTO.newsTitle)
.fontSize($r("app.float.font_size_16"))
.fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
.width(CommonConstants.FULL_WIDTH)
.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
}.alignContent(Alignment.TopStart)
// 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card4Component.ets
View file @
628f348
...
...
@@ -18,18 +18,41 @@ export struct Card4Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
}
titleInit() {
if (this.contentDTO.title.includes('<em>') && this.contentDTO.title.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.newsTitle?.split('<em>')[0] || '';
this.str02 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Column() {
//body
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card5Component.ets
View file @
628f348
...
...
@@ -22,13 +22,12 @@ export struct Card5Component {
build() {
Stack() {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.autoResize(true)
.borderRadius($r('app.float.image_border_radius'))
if (this.titleShowPolicy === 1) {
if (this.titleShowPolicy === 1
|| this.titleShowPolicy === null
) {
Row()
.width(CommonConstants.FULL_WIDTH)
.height(59)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card6Component.ets
View file @
628f348
...
...
@@ -6,6 +6,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
// import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { Logger } from 'wdKit/Index';
const TAG: string = 'Card6Component-Card13Component';
...
...
@@ -17,12 +18,27 @@ export struct Card6Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
Logger.info('titleInit', JSON.stringify(this.contentDTO))
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
// this.clicked = hasClicked(this.contentDTO.objectId)
}
titleInit() {
if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.title?.split('<em>')[0] || '';
this.str02 = this.contentDTO.title?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.title?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
Row() {
Column() {
...
...
@@ -44,7 +60,16 @@ export struct Card6Component {
Notes({ objectType: this.contentDTO.objectType })
}
Text(`${this.contentDTO.newsTitle}`)
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontColor(this.clicked ? 0x848484 : 0x222222)
.fontSize(16)
.lineHeight(24)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/SearchContentComponent.ets
0 → 100644
View file @
628f348
import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG: string = 'Card4Component';
/**
* 上图下文,用于搜索页命中搜索内容展示
*/
@Component
export struct SearchContentComponent {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
this.titleInit();
}
titleInit() {
this.str01 = this.contentDTO.contentText?.split('<em>')[0] || '';
this.str02 = this.contentDTO.contentText?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.contentText?.split('<em>')[1].split('</em>')[1] || '';
}
build() {
Column() {
//body
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
// 命中内容
Text(this.contentDTO.contentText) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
}
.fontSize(13)
.width(CommonConstants.FULL_PARENT)
.margin({ top: 8 })
.fontColor(0x222222)
}
.width('100%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
//bottom 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
}
}
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
View file @
628f348
...
...
@@ -453,6 +453,7 @@ export struct SearchResultContentComponent {
contentDTO.openType = '';
contentDTO.extra = '';
contentDTO.titleShow = value.data.type == "5" ? 1 : 0;
contentDTO.contentText = value.data.contentText;
return contentDTO;
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
View file @
628f348
...
...
@@ -64,7 +64,7 @@ export struct OperRowListView {
* 7:图集详情页
*/
@Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口
@Prop pageComponentType?: number = -1 //1:视频详情页 2:竖屏直播页 3:图集
@Prop pageComponentType?: number = -1 //1:视频详情页 2:竖屏直播页 3:图集
4: 横屏直播页
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@Prop operationButtonList?: string[] = ['comment', 'collect', 'share'] // 组件展示条件
@State needLike: boolean = true
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PictureLoading.ets
View file @
628f348
...
...
@@ -16,7 +16,7 @@ export struct PictureLoading {
build() {
Row() {
Image(this.imagePath)
.alt($r('app.media.
picture_loading
'))
.alt($r('app.media.
datail_imageLoading_w
'))
.width(this.imageWidth)
.aspectRatio(this.ratio)
.objectFit(ImageFit.Fill)
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerComponent.ets
View file @
628f348
...
...
@@ -38,8 +38,8 @@ export struct PlayerComponent {
}
async aboutToDisappear(): Promise<void> {
this.playerController?.pause()
this.playerController?.stop()
await this.playerController?.pause()
await this.playerController?.stop()
await this.playerController?.release()
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
628f348
...
...
@@ -151,8 +151,8 @@ export struct DetailPlayShortVideoPage {
aboutToAppear() {
this.videoLandScape = this.contentDetailData.videoInfo[0]?.videoLandScape
this.ratio = this.contentDetailData.videoInfo[0].resolutionWidth /
this.contentDetailData.videoInfo[0].resolutionHeight
this.ratio = (this.contentDetailData.videoInfo[0]?.resolutionWidth || 16) /
(this.contentDetailData.videoInfo[0]?.resolutionHeight || 9)
this.playerController.onCanplay = async () => {
this.ratio = this.playerController.videoWidth / this.playerController.videoHeight
if ((this.index == 0 || this.currentIndex === this.index) && this.switchVideoStatus) {
...
...
@@ -269,13 +269,6 @@ export struct DetailPlayShortVideoPage {
this.playerCoverBuilder()
// .height(this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? '100%' :
// this.videoLandScape === 1 ? 210 : 'auto')// .height(this.videoLandScape === 1 ? 210 : '100%')
// .width(this.videoLandScape === 1 ?
// this.playerController.videoWidth / this.playerController.videoHeight * this.windowHeight + 'px' : '100%')
// .height(this.videoLandScape === 1 ? 210 :
// this.playerController.videoHeight / this.playerController.videoWidth * this.windowWidth + 'px')
// 横屏-全屏观看
if (this.videoLandScape === 1) {
this.playerFullscreenBuilder()
...
...
@@ -283,10 +276,7 @@ export struct DetailPlayShortVideoPage {
}
.width('100%')
.height('100%')
// .width(this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ?
// this.playerController.videoWidth / this.playerController.videoHeight * this.windowHeight + 'px' : '100%')
// .height(this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? '100%' : 'auto')
.align(this.videoLandScape === 1 ? Alignment.Center : Alignment.Top)
.align(Alignment.Center)
}
...
...
@@ -312,18 +302,7 @@ export struct DetailPlayShortVideoPage {
.align(Alignment.Bottom)
.margin({ top: 280 })
.onClick(() => {
// this.displayDirection =
// this.displayDirection === DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL :
// DisplayDirection.VERTICAL
// WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
// window.Orientation.PORTRAIT :
// window.Orientation.LANDSCAPE_INVERTED)
// this.playerController.xComponentController?.setXComponentSurfaceRect({
// surfaceWidth: px2vp(this.windowHeight),
// surfaceHeight: px2vp(this.playerController.videoWidth / this.playerController.videoHeight * this.windowHeight),
// })
// 全屏方案待定
})
}
...
...
Please
register
or
login
to post a comment