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
zhenghy
2024-05-15 15:26:30 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
66bd8968fa36e55b5fdcee9a46d4868615c78fc7
66bd8968
2 parents
f2a32af1
ab5fc85b
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
219 additions
and
43 deletions
sight_harmony/features/wdBean/src/main/ets/bean/content/ContentDTO.ets
sight_harmony/features/wdComponent/src/main/ets/components/CardParser.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/RmhTitle.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card17Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card2Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card4Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/SearchContentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhGridLayout02.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/viewModel/LiveModel.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/TabComponent.ets
sight_harmony/features/wdBean/src/main/ets/bean/content/ContentDTO.ets
View file @
66bd896
...
...
@@ -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/src/main/ets/components/CardParser.ets
View file @
66bd896
...
...
@@ -16,6 +16,7 @@ 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';
/**
* card适配器,卡片样式汇总,依据ContentDTO#appStyle
...
...
@@ -32,6 +33,9 @@ export struct CardParser {
@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 +77,6 @@ export struct CardParser {
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/RmhTitle.ets
View file @
66bd896
...
...
@@ -96,10 +96,10 @@ export struct RmhTitle {
build() {
Flex() {
Stack() {
Image(this.rmhInfo.rmhHeadUrl)
Image(this.rmhInfo
?
.rmhHeadUrl)
.width(36)
.height(36).borderRadius(50)
Image(this.rmhInfo.authIcon)
Image(this.rmhInfo
?
.authIcon)
.width(14)
.height(14)
.borderRadius(50)
...
...
@@ -109,7 +109,7 @@ export struct RmhTitle {
.flexShrink(0)
Column() {
Text(this.rmhInfo.rmhName)
Text(this.rmhInfo
?
.rmhName)
.fontSize($r('app.float.font_size_13'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
...
...
@@ -122,13 +122,13 @@ export struct RmhTitle {
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
}
if (this.publishTime && this.rmhInfo.rmhDesc) {
if (this.publishTime && this.rmhInfo
?
.rmhDesc) {
Image($r('app.media.point'))
.width(16)
.height(16)
}
}
Text(this.rmhInfo.rmhDesc)
Text(this.rmhInfo
?
.rmhDesc)
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.maxLines(1)
...
...
@@ -141,7 +141,7 @@ export struct RmhTitle {
}
Blank()
if (this.rmhInfo.cnIsAttention) {
if (this.rmhInfo
?
.cnIsAttention) {
Row() {
if (Number(this.followStatus) === 0) {
Image($r('app.media.rmh_follow'))
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card17Component.ets
View file @
66bd896
...
...
@@ -40,7 +40,7 @@ export struct Card17Component {
this.contentDTO.fullColumnImgUrls.length > 0 ? this.contentDTO.fullColumnImgUrls[0].url : '' : '')
.backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.
aspectRatio(16 /
9)
.
height(160)// .aspectRatio(CompUtils.ASPECT_RATIO_16_
9)
.borderRadius({
topLeft: $r('app.float.image_border_radius'),
bottomLeft: $r('app.float.image_border_radius'),
...
...
@@ -52,7 +52,7 @@ export struct Card17Component {
this.contentDTO.fullColumnImgUrls.length > 1 ? this.contentDTO.fullColumnImgUrls[1].url : '' : '')
.backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.
aspectRatio(16 /
9)
.
height(79)// .aspectRatio(CompUtils.ASPECT_RATIO_16_
9)
.margin({ bottom: 1 })
.borderRadius({
topRight: $r('app.float.image_border_radius'),
...
...
@@ -69,7 +69,7 @@ export struct Card17Component {
this.contentDTO.fullColumnImgUrls.length > 2 ? this.contentDTO.fullColumnImgUrls[2].url : '' : '')
.backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.
aspectRatio(16 /
9)
.
height(79)// .aspectRatio(CompUtils.ASPECT_RATIO_16_
9)
.margin({ top: 1 })
.borderRadius({
bottomRight: $r('app.float.image_border_radius'),
...
...
@@ -108,3 +108,11 @@ export struct Card17Component {
})
}
}
// 全局公共样式
@Styles
function ImageSize() {
.padding({ right: 18, left: 18 })
.width('100%')
.margin({ top: 10 })
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card2Component.ets
View file @
66bd896
...
...
@@ -22,10 +22,24 @@ 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.loadImg = await onlyWifiLoadImg();
// this.clicked = hasClicked(this.contentDTO.objectId)
this.titleInit();
}
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() {
...
...
@@ -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/Card4Component.ets
View file @
66bd896
...
...
@@ -18,10 +18,24 @@ 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.loadImg = await onlyWifiLoadImg();
this.titleInit();
}
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() {
...
...
@@ -29,7 +43,16 @@ export struct Card4Component {
//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/SearchContentComponent.ets
0 → 100644
View file @
66bd896
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/compview/ZhGridLayout02.ets
View file @
66bd896
import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { Logger
, LazyDataSource
} from 'wdKit/Index';
import { Logger } from 'wdKit/Index';
import { ProcessUtils } from 'wdRouter';
import PageViewModel from '../../viewmodel/PageViewModel';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
...
...
@@ -8,6 +8,7 @@ import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG = 'Zh_Grid_Layout-02';
const FULL_PARENT: string = '100%';
let listSize: number = 2;
/**
* 双图卡
* 枚举值Zh_Grid_Layout-02
...
...
@@ -20,6 +21,8 @@ export struct ZhGridLayout02 {
@State operDataList: ContentDTO[] = []
@State loadImg: boolean = false;
@State liveRoomList: LiveRoomDataBean[] = []
currentPage = 1
pageSize = 12
async aboutToAppear(): Promise<void> {
Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle)
...
...
@@ -33,9 +36,6 @@ export struct ZhGridLayout02 {
this.loadImg = await onlyWifiLoadImg();
}
currentPage = 1
pageSize = 12
build() {
Column() {
Scroll() {
...
...
@@ -51,7 +51,7 @@ export struct ZhGridLayout02 {
.fontWeight(600)
}
.justifyContent(FlexAlign.Start)
.margin({ top:
8
, bottom: 8 })
.margin({ top:
16
, bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
GridRow({
...
...
@@ -101,7 +101,7 @@ export struct ZhGridLayout02 {
@Builder
buildItemCard(item: ContentDTO) {
Column() {
Stack({
alignContent: Alignment.BottomEnd
}) {
Stack({
alignContent: Alignment.BottomEnd
}) {
Image(this.loadImg ? item.fullColumnImgUrls[0].url : '')
.backgroundColor(0xf5f5f5)
.width('100%')
...
...
@@ -114,12 +114,13 @@ export struct ZhGridLayout02 {
.fontColor(Color.White)
.margin({
right: '5vp',
bottom:'5vp'
bottom:
'5vp'
})
}
}
Text(item.newsTitle)
.margin({
top:'5'
})
.margin({
top: '5'
})
.fontSize(13)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
...
...
@@ -130,14 +131,6 @@ export struct ZhGridLayout02 {
})
}
private getLiveDetailIds(list: ContentDTO[]): string {
let idList: string[] = []
list.forEach(item => {
idList.push(item.objectId)
});
return idList.join(',')
}
// 获取评论数
async getLiveRoomDataInfo(list: ContentDTO[]) {
const reserveIds = this.getLiveDetailIds(list)
...
...
@@ -145,7 +138,7 @@ export struct ZhGridLayout02 {
if (result && result.length > 0) {
this.liveRoomList.push(...result)
}
}).catch(() =>{
}).catch(() =>
{
})
}
...
...
@@ -160,16 +153,6 @@ export struct ZhGridLayout02 {
return ''
}
private computeShowNum(count: number): string {
if (count >= 10000) {
let num = ( count / 10000).toFixed(1)
if (Number(num.substring(num.length-1)) == 0) {
num = num.substring(0, num.length-2)
}
return num + '万人参加'
}
return `${count}人参加`
}
addItems() {
Logger.debug(TAG, 'addItems')
this.currentPage++
...
...
@@ -179,6 +162,25 @@ export struct ZhGridLayout02 {
Logger.debug(TAG, 'addItems after: ' + this.operDataList.length)
})
}
private getLiveDetailIds(list: ContentDTO[]): string {
let idList: string[] = []
list.forEach(item => {
idList.push(item.objectId)
});
return idList.join(',')
}
private computeShowNum(count: number): string {
if (count >= 10000) {
let num = (count / 10000).toFixed(1)
if (Number(num.substring(num.length - 1)) == 0) {
num = num.substring(0, num.length - 2)
}
return num + '万人参加'
}
return `${count}人参加`
}
}
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/viewModel/LiveModel.ets
View file @
66bd896
...
...
@@ -49,7 +49,7 @@ export class LiveModel {
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", error.
toString()
)
Logger.debug(TAG + ":error ", error.
message
)
})
})
}
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/TabComponent.ets
View file @
66bd896
...
...
@@ -26,6 +26,7 @@ export struct TabComponent {
}
build() {
Stack({alignContent: Alignment.TopStart}) {
Tabs({ barPosition: BarPosition.Start, index: this.currentIndex, controller: this.controller }) {
ForEach(this.tabs, (item: string, index: number) => {
TabContent() {
...
...
@@ -36,7 +37,7 @@ export struct TabComponent {
} else if ('大家聊' === item) {
TabChatComponent()
}
}.tabBar(this.tabBuilder(index, item))
}
.backgroundColor('#F5F5F5')
}, (item: string, index: number) => {
return item + index
...
...
@@ -45,13 +46,37 @@ export struct TabComponent {
.layoutWeight(1)
.vertical(false)
.barMode(BarMode.Fixed)
.barWidth(70 * this.tabs.length)
.barHeight(48)
.animationDuration(100)
.onChange((index: number) => {
this.currentIndex = index
})
.backgroundColor(Color.White)
// 页签
Row() {
Scroll() {
Row({space: '24vp'}) {
ForEach(this.tabs, (item: string, index: number) => {
this.tabBuilder(index, item)
})
}
.width('100%')
.justifyContent(FlexAlign.Center)
}
.backgroundColor(Color.White)
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
}
.backgroundColor(Color.White)
.height('48vp')
.alignItems(VerticalAlign.Bottom)
.width('100%')
}.layoutWeight(1)
}
@Builder
...
...
@@ -60,7 +85,7 @@ export struct TabComponent {
Text(name)
.margin({ top: 6 })
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.fontSize('18
f
p')
.fontSize('18
v
p')
.fontWeight(this.currentIndex === index ? 600 : 400)
Divider()
.strokeWidth(2)
...
...
@@ -68,7 +93,13 @@ export struct TabComponent {
.width(15)
.color('#CB0000')
.visibility(this.currentIndex === index ? Visibility.Visible : Visibility.Hidden)
}.width('100%')
}.justifyContent(FlexAlign.Center)
.constraintSize({ minWidth: 35 })
.height('48vp')
.onClick(() => {
this.controller.changeIndex(index)
this.currentIndex = index
})
}
aboutToDisappear(): void {
...
...
Please
register
or
login
to post a comment