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
wangyong_wd
2024-04-16 16:31:47 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
958575b9a42b2530044aa57e3d109316f1e32c23
958575b9
2 parents
496b1447
8e7385f3
Merge branch 'main' of
http://192.168.1.42/developOne/harmonyPool
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
258 additions
and
66 deletions
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card14Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card16Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card14Component.ets
View file @
958575b
...
...
@@ -3,46 +3,45 @@ import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
const TAG = 'Card1
2
Component';
const TAG = 'Card1
4
Component';
/**
* 人民号-动态---1
2:人民号无
图卡;
* 人民号-动态---1
4:人民号单
图卡;
*/
@Entry
@Component
export struct Card1
2
Component {
export struct Card1
4
Component {
@State contentDTO: ContentDTO = {
appStyle: '20',
coverType: 1,
coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
fullColumnImgUrls: [
{
landscape: 1,
size: 1,
url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
weight: 1600
}
],
newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
rmhInfo: {
authIcon:
'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
authTitle: '10后音乐人王烁然个人人民号',
authTitle2: '10后音乐人王烁然个人人民号',
banControl: 0,
cnIsAttention: 1,
rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
rmhName: '王烁然',
userId: '522435359667845',
userType: '2'
},
objectType: '1',
videoInfo: {
firstFrameImageUri: '',
videoDuration: 37,
videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
}
// appStyle: '20',
// coverType: 1,
// coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
// fullColumnImgUrls: [
// {
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
// weight: 1600
// }
// ],
// newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
// rmhInfo: {
// authIcon:
// 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
// authTitle: '10后音乐人王烁然个人人民号',
// authTitle2: '10后音乐人王烁然个人人民号',
// banControl: 0,
// cnIsAttention: 1,
// rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
// rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
// rmhName: '王烁然',
// userId: '522435359667845',
// userType: '2'
// },
// objectType: '1',
// videoInfo: {
// firstFrameImageUri: '',
// videoDuration: 37,
// videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
// }
} as ContentDTO;
aboutToAppear(): void {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card16Component.ets
0 → 100644
View file @
958575b
import { ContentDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
const TAG = 'Card16Component';
/**
* 人民号-动态---16:人民号三图卡;
*/
@Component
export struct Card16Component {
@State contentDTO: ContentDTO = {
appStyle: '20',
coverType: 1,
coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
fullColumnImgUrls: [
{
landscape: 1,
size: 1,
url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
weight: 1600
}
],
newsTitle: '好玩!》10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号',
rmhInfo: {
authIcon:
'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
authTitle: '10后音乐人王烁然个人人民号',
authTitle2: '10后音乐人王烁然个人人民号',
banControl: 0,
cnIsAttention: 1,
rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
rmhName: '王烁然',
userId: '522435359667845',
userType: '2'
},
objectType: '1',
videoInfo: {
firstFrameImageUri: '',
videoDuration: 37,
videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
}
} as ContentDTO;
aboutToAppear(): void {
}
build() {
Column() {
// rmh信息
RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
// 标题
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(2)
.margin({ bottom: 8 })
.lineHeight(25)
}
if (this.contentDTO.coverUrl) {
Flex() {
ForEach(this.contentDTO.coverUrl?.split(';'), (item: string) => {
Image(item).flexBasis(113).height(75).margin({right: 2})
})
}
}
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.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')
})
}
}
interface radiusType {
topLeft: number | Resource;
topRight: number | Resource;
bottomLeft: number | Resource;
bottomRight: number | Resource;
}
@Component
struct createImg {
@Prop contentDTO: ContentDTO
build() {
GridRow() {
if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) {
// 横屏
GridCol({
span: { xs: 12 }
}) {
Stack() {
Image(this.contentDTO.coverUrl)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.contentDTO })
}
.align(Alignment.BottomEnd)
}
} else {
// 竖图显示,宽度占50%,高度自适应
GridCol({
span: { xs: 6 }
}) {
Stack() {
Image(this.contentDTO.coverUrl)
.width(CommonConstants.FULL_WIDTH)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.contentDTO })
}
.align(Alignment.BottomEnd)
}
}
}
}
}
@Extend(Text)
function textOverflowStyle(maxLine: number) {
.maxLines(maxLine)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
View file @
958575b
...
...
@@ -13,37 +13,37 @@ export struct Card19Component {
// coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
// fullColumnImgUrls: [
// {
// fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/quality,q_90/auto-orient,1',
// height: 1500,
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
// weight: 2000
// },
// {
// fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1',
// height: 1500,
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_9559941
5572771225
6.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
// url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_9559941
6036241817
6.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
// weight: 2000
// },
// {
// fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1',
// height: 1280,
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
// weight: 1707
// },
// {
// fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1',
// height: 1280,
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
// weight: 1707
// }
// {
// fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1',
// height: 1500,
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
// weight: 2000
// },
// {
// fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1',
// height: 1280,
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
// weight: 1707
// },
// {
// fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/quality,q_90/auto-orient,1',
// height: 1280,
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994132109586432.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
// weight: 1707
// }
// ],
// newsSummary: '#平安建设双提升#【进工地,送安全】3月21日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。',
// newsTitle: '#平安建设双提升#【进工地,送安全】3月21日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。',
...
...
@@ -107,6 +107,8 @@ interface radiusType {
@Component
struct createImg {
@Prop fullColumnImgUrls: FullColumnImgUrlDTO[]
@State picWidth: number = 0;
@State picHeight: number = 0;
aboutToAppear(): void {
if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
this.fullColumnImgUrls.splice(2,0, {
...
...
@@ -137,18 +139,77 @@ struct createImg {
return radius
}
getPicType(){
if (this.picWidth && this.picWidth) {
if (this.picWidth / this.picHeight > 343/172) {
return 1; //横长图
} else if (this.picHeight / this.picWidth > 305/228) {
return 2; //竖长图
} else {
return 3
}
} else {
return 3; //普通图
}
}
build() {
GridRow({
gutter: { x: 2, y: 2 }
}) {
ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => {
if (this.fullColumnImgUrls.length === 1) {
GridCol({
span: { xs: 8 }
}) {
Image(item.fullUrl)
.width('100%')
.borderRadius(this.caclImageRadius(index))
if (this.getPicType() !== 3) {
GridCol({
span: this.getPicType() === 1 ? 12 : 8
}){
Stack({
alignContent: Alignment.BottomEnd
}) {
if (this.getPicType() === 1) {
Image(item.fullUrl)
.width('100%')
.height(172)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
} else if (this.getPicType() === 2) {
Image(item.fullUrl)
.width('100%')
.height(305)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
}
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(14)
.height(14)
.margin({right: 4})
Text('长图')
.fontSize(12)
.fontWeight(400)
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.padding({bottom: 9})
}
}
} else {
GridCol({
span: { xs: 8 }
}) {
Image(item.fullUrl)
.width('100%')
.borderRadius(this.caclImageRadius(index))
.autoResize(true)
.opacity(!this.picWidth && !this.picHeight ? 0 : 1)
.onComplete(callback => {
this.picWidth = callback?.width || 0;
this.picHeight = callback?.height || 0;
})
}
}
} else if (this.fullColumnImgUrls.length === 4) {
GridCol({
...
...
Please
register
or
login
to post a comment