douaojie

Merge remote-tracking branch 'origin/main'

# Conflicts:
#	sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card5Component.ets
Showing 33 changed files with 455 additions and 441 deletions
... ... @@ -27,35 +27,51 @@ export struct PaperTitleComponent {
Row() {
// 在 29 * 18 的矩形框中绘制一个三角形,起点(0, 0),经过(0, 18),经过(20, 18),终点(29, 0)
Polygon({ width: 29, height: 18 })
.points([[0, 0], [0, 18], [20, 18], [29, 0]])// .fill(Color.White)
.fillOpacity(0.2)
.fill(Color.White)
// Polygon({ width: 29, height: 18 })
// .points([[0, 0], [0, 18], [20, 18], [29, 0]])// .fill(Color.White)
// .fillOpacity(0.2)
// .fill(Color.White)
// .linearGradient({
// direction: GradientDirection.Right,
// colors: [[0xffffff, 1.0], [0xffffff, 0.75], [0xffffff, 0.5], [0xffffff, 0.0], [0xffffff, 0.0]]
// })
Row()
.width('29vp')
.height('18vp')
.clip(new Path({
commands: `M0 0 H${vp2px(29)} L${vp2px(20)} ${vp2px(18)} L0 ${vp2px(18)} Z`
}))
.linearGradient({
direction: GradientDirection.Right, // 渐变方向
repeating: false, // 渐变颜色是否重复
colors: [[0x1affffff, 0.0],[0x1affffff, 0.3], [0x33ffffff, 0.6], [0x4dffffff,1]] // 数组末尾元素占比小于1时满足重复着色效果
})
Text(this.title ?? "")
.margin({ left: 5 })
.fontSize(20)
.margin({ left: 10 })
.fontSize(22)
.fontColor($r('app.color.white'))
.fontWeight(900)
.maxLines(1)
Text(this.subTitle ?? '')// Text('2024年\n1月16日')
// .width(50)
.margin({ left: 5 })
.fontSize(8)
.margin({ left: 6 })
.fontSize(10)
.fontColor($r('app.color.white'))
.maxLines(2)
.textAlign(TextAlign.End)
this.rightDecorateBuilder()
// .linearGradient({
// direction: GradientDirection.Right,
// colors: [[0x4Dffffff, 1.0], [0x4Dffffff, 0.75], [0x4Dffffff, 0.5], [0x4Dffffff, 0.75], [0x1ffffff, 0.0]]
// })
Image($r('app.media.bg_event_status_end'))
.height($r('app.float.top_arrow_size'))
.width(100)
.visibility(Visibility.None)
// Image($r('app.media.bg_event_status_end'))
// .height($r('app.float.top_arrow_size'))
// .width(100)
// .visibility(Visibility.None)
}
.height('100%')
.alignItems(VerticalAlign.Center)
... ... @@ -87,7 +103,7 @@ export struct PaperTitleComponent {
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('img_share')
.margin({ right: 13 })
.margin({ right: 16 })
.onClick(() => {
ToastUtils.showToast('分享为公共方法,待开发', 1000)
})
... ... @@ -105,19 +121,32 @@ export struct PaperTitleComponent {
@Builder
rightDecorateBuilder() {
Row() {
Polygon({ width: 20, height: 18 })
.points([[8, 0], [0, 18], [20, 18], [20, 0]])// .fill(Color.White)
.fillOpacity(0.3)
.fill(Color.White)
Rect({ width: 80, height: 18 })// .fillOpacity(0.3)
.fill(Color.White)
.fillOpacity(0.01)
Row()
.width('100vp')
.height('18vp')
.clip(new Path({
commands: `M${vp2px(9)} 0 H${vp2px(91)} V${vp2px(18)} L0 ${vp2px(18)} Z`
}))
.linearGradient({
direction: GradientDirection.Right,
colors: [[0x4Dffffff, 1.0], [0x4Dffffff, 0.75], [0x4Dffffff, 0.5], [0x40ffffff, 0.25], [0x1ffffff, 0.0]]
direction: GradientDirection.Right, // 渐变方向
repeating: false, // 渐变颜色是否重复
colors: [[0x4dffffff, 0.0], [0x33ffffff, 0.3], [0x1affffff,0.6], [0x03ffffff,1]] // 数组末尾元素占比小于1时满足重复着色效果
})
}
.margin({ left: 6 })
.margin({ left:8, right: 0})
// Row() {
// Polygon({ width: 20, height: 18 })
// .points([[8, 0], [0, 18], [20, 18], [20, 0]])// .fill(Color.White)
// .fillOpacity(0.3)
// .fill(Color.White)
// Rect({ width: 80, height: 18 })// .fillOpacity(0.3)
// .fill(Color.White)
// .fillOpacity(0.01)
// .linearGradient({
// direction: GradientDirection.Right,
// colors: [[0x4Dffffff, 1.0], [0x4Dffffff, 0.75], [0x4Dffffff, 0.5], [0x40ffffff, 0.25], [0x1ffffff, 0.0]]
// })
// }
// .margin({ left: 6 })
}
}
\ No newline at end of file
... ...
... ... @@ -4,6 +4,7 @@ import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
/**
* 大专题卡--CompStyle: 10
... ... @@ -14,6 +15,11 @@ const TAG: string = 'Card10Component';
@Component
export struct Card10Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
Column() {
... ... @@ -32,7 +38,8 @@ export struct Card10Component {
}
// 大图
Stack() {
Image(this.contentDTO && this.contentDTO.coverUrl)
Image(this.loadImg ? this.contentDTO?.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.borderRadius({
topLeft: $r('app.float.image_border_radius'),
... ... @@ -117,7 +124,8 @@ export struct Card10Component {
// 右侧图片
if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
Stack() {
Image(item.fullColumnImgUrls[0].url)
Image(this.loadImg ? item.fullColumnImgUrls[0].url : '')
.backgroundColor(0xf5f5f5)
.width(117)
.height(78)
.objectFit(ImageFit.Cover)
... ...
... ... @@ -4,6 +4,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG = 'Card14Component';
... ... @@ -12,41 +13,11 @@ const TAG = 'Card14Component';
*/
@Component
export struct Card14Component {
@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: '好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》',
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;
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
... ... @@ -69,7 +40,8 @@ export struct Card14Component {
.margin({right: 12})
.flexBasis(214)
Image(this.contentDTO.coverUrl)
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.flexBasis(117)
.height(78)
.borderRadius($r('app.float.image_border_radius'))
... ...
... ... @@ -4,6 +4,7 @@ import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG: string = 'Card15Component';
... ... @@ -16,45 +17,13 @@ const TAG: string = 'Card15Component';
*/
@Component
export struct Card15Component {
@State contentDTO: ContentDTO = {
// appStyle: '15',
// coverType: 1,
// objectType: '9',
// coverUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90',
// fullColumnImgUrls: [
// {
// landscape: 2,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90',
// weight: 1170
// }
// ],
// newsTitle: '押解画面公开!被湖北民警从柬埔寨押解回国被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们的130名涉赌诈嫌疑人是他们',
// publishTime: '1712993333000',
// rmhInfo: {
// authIcon: '',
// authTitle: '',
// authTitle2: '',
// banControl: 0,
// cnIsAttention: 1,
// rmhDesc: '中共武汉市委机关报长江日报官方人民号',
// rmhHeadUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
// rmhId: '4255270',
// rmhName: '长江日报',
// userId: '513696944662469',
// userType: '3'
// },
// videoInfo: {
// firstFrameImageUri: '',
// videoDuration: 12,
// // videoLandscape: 2,
// videoUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/video/2024/0413/VL20Z09ISBEKXZU_963672027208609792.mp4'
// },
// photoNum: '9',
// voiceInfo: {
// voiceDuration: 12
// }
} as ContentDTO;
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
Column() {
... ... @@ -71,7 +40,8 @@ export struct Card15Component {
}
//大图
Stack() {
Image(this.contentDTO.coverUrl)
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.borderRadius($r('app.float.image_border_radius'))
//播放状态+时长
CardMediaInfo({
... ...
... ... @@ -4,6 +4,7 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG = 'Card16Component';
... ... @@ -18,8 +19,10 @@ interface fullColumnImgUrlItem {
@Component
export struct Card16Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
... ... @@ -41,7 +44,11 @@ export struct Card16Component {
if (this.contentDTO.fullColumnImgUrls?.length > 0) {
Flex() {
ForEach(this.contentDTO.fullColumnImgUrls.slice(0, 3), (item: fullColumnImgUrlItem, index: number) => {
Image(item.url).flexBasis(113).height(75).margin({ right: index > 1 ? 0 : 2 })
Image(this.loadImg ? item.url : '')
.backgroundColor(0xf5f5f5)
.flexBasis(113)
.height(75)
.margin({ right: index > 1 ? 0 : 2 })
})
}
}
... ... @@ -70,6 +77,11 @@ interface radiusType {
@Component
struct createImg {
@Prop contentDTO: ContentDTO
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
GridRow() {
... ... @@ -79,7 +91,8 @@ struct createImg {
span: { xs: 12 }
}) {
Stack() {
Image(this.contentDTO.coverUrl)
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius($r('app.float.image_border_radius'))
... ... @@ -93,7 +106,8 @@ struct createImg {
span: { xs: 6 }
}) {
Stack() {
Image(this.contentDTO.coverUrl)
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.contentDTO })
... ...
... ... @@ -5,6 +5,8 @@ import { DateTimeUtils } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG = 'Card17Component';
/**
... ... @@ -14,6 +16,12 @@ const TAG = 'Card17Component';
export struct Card17Component {
@State compDTO: CompDTO = {} as CompDTO
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
Column({ space: 8 }) {
... ... @@ -29,8 +37,8 @@ export struct Card17Component {
// 三个图,
GridRow({ gutter: 2 }) {
GridCol({ span: { xs: 8 } }) {
Image(this.contentDTO.fullColumnImgUrls.length > 0 ?this.contentDTO.fullColumnImgUrls[0].url:'')
.backgroundColor('#f5f5f5')
Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 0 ?this.contentDTO.fullColumnImgUrls[0].url:'' : '')
.backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius({
... ... @@ -40,8 +48,8 @@ export struct Card17Component {
}
GridCol({ span: { xs: 4 } }) {
Image(this.contentDTO.fullColumnImgUrls.length > 1? this.contentDTO.fullColumnImgUrls[1].url:'')
.backgroundColor('#f5f5f5')
Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 1? this.contentDTO.fullColumnImgUrls[1].url:'' : '')
.backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.margin({ bottom: 1 })
... ... @@ -56,8 +64,8 @@ export struct Card17Component {
}
GridCol({ span: { xs: 4 } }) {
Image(this.contentDTO.fullColumnImgUrls.length > 2? this.contentDTO.fullColumnImgUrls[2].url:'')
.backgroundColor('#f5f5f5')
Image(this.loadImg ? this.contentDTO.fullColumnImgUrls.length > 2? this.contentDTO.fullColumnImgUrls[2].url:'' : '')
.backgroundColor(this.loadImg ? '#f5f5f5' : 0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.margin({ top: 1 })
... ...
... ... @@ -3,6 +3,7 @@ import { RmhTitle } from '../cardCommon/RmhTitle'
import { ProcessUtils } from 'wdRouter';
import { CommonConstants } from 'wdConstant/Index';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG = 'Card19Component';
... ... @@ -12,69 +13,8 @@ const TAG = 'Card19Component';
@Component
export struct Card19Component {
@State contentDTO: ContentDTO = {
// appStyle: '19',
// 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_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_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_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日下午,@合肥交警 包河大队走进辖区建筑工地为驾驶员、安全员们开展春季交通安全主题宣传活动。活动中,交警结合涉工程运输车、渣土车交通事故案例,详细讲解行驶注意事项,并普及了“一盔一带”“右转必停”等安全常识,要求驾驶员牢固树立交通安全意识,自觉遵守交通法律法规,确保出行安全。',
// publishTime: '1711185754000',
// relType: '1',
// rmhInfo: {
// authIcon: '',
// authTitle: '',
// authTitle2: '',
// banControl: 0,
// cnIsAttention: 1,
// cnIsComment: 1,
// cnIsLike: 1,
// cnMainControl: 1,
// cnShareControl: 1,
// posterShareControl: 1,
// rmhDesc: '合肥市公安局官方人民号',
// rmhHeadUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
// rmhId: '4255290',
// rmhName: '合肥警方',
// userId: '513697181730757',
// userType: '2'
// }
} as ContentDTO
aboutToAppear(): void {
}
build() {
Column() {
// rmh信息
... ... @@ -132,13 +72,17 @@ struct createImg {
@Prop fullColumnImgUrls: FullColumnImgUrlDTO[]
@State picWidth: number = 0;
@State picHeight: number = 0;
aboutToAppear(): void {
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
this.fullColumnImgUrls.splice(2,0, {
fullUrl: ''
} as FullColumnImgUrlDTO)
}
}
caclImageRadius(index: number) {
let radius: radiusType = {
topLeft: index === 0 ? $r('app.float.image_border_radius') : 0,
... ... @@ -191,13 +135,14 @@ struct createImg {
alignContent: Alignment.BottomEnd
}) {
if (this.getPicType() === 1) {
Image(item.fullUrl)
Image(this.loadImg ? item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
// .height(172)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
} else if (this.getPicType() === 2) {
Image(item.fullUrl)
Image(this.loadImg ? item.fullUrl : '')
// .width('100%')
.height(305)
.autoResize(true)
... ... @@ -223,7 +168,8 @@ struct createImg {
GridCol({
span: { xs: 8 }
}) {
Image(item.fullUrl)
Image(this.loadImg ? item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.borderRadius(this.caclImageRadius(index))
.autoResize(true)
... ... @@ -238,7 +184,8 @@ struct createImg {
GridCol({
span: { xs: 4 }
}) {
Image(item.fullUrl)
Image(this.loadImg ? item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
}
... ... @@ -246,7 +193,8 @@ struct createImg {
GridCol({
span: { sm: 4, lg: 3 }
}) {
Image(item.fullUrl)
Image(this.loadImg ? item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.aspectRatio(1)
.borderRadius(this.caclImageRadius(index))
}
... ...
... ... @@ -4,6 +4,8 @@ import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG = 'Card20Component';
/**
... ... @@ -12,37 +14,6 @@ const TAG = 'Card20Component';
@Component
export struct Card20Component {
@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: '好玩!》',
// 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 {
... ... @@ -90,6 +61,12 @@ interface radiusType {
@Component
struct createImg {
@Prop contentDTO: ContentDTO
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
GridRow() {
... ... @@ -99,7 +76,8 @@ struct createImg {
span: { xs: 12 }
}) {
Stack() {
Image(this.contentDTO.coverUrl)
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius($r('app.float.image_border_radius'))
... ... @@ -116,7 +94,8 @@ struct createImg {
span: { xs: 6 }
}) {
Stack() {
Image(this.contentDTO.coverUrl)
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.contentDTO })
... ...
... ... @@ -4,6 +4,8 @@ import { ProcessUtils } from 'wdRouter';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import {CarderInteraction} from '../CarderInteraction'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG: string = 'Card6Component-Card13Component';
/**
... ... @@ -12,6 +14,11 @@ const TAG: string = 'Card6Component-Card13Component';
@Component
export struct Card21Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
Column() {
... ... @@ -32,7 +39,8 @@ export struct Card21Component {
GridItem() {
Stack() {
Image(this.contentDTO.coverUrl)
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.contentDTO })
... ...
... ... @@ -5,6 +5,7 @@ import { ProcessUtils } from 'wdRouter';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG: string = 'Card2Component';
... ... @@ -17,21 +18,12 @@ const TAG: string = 'Card2Component';
*/
@Component
export struct Card2Component {
@State contentDTO: ContentDTO = {
// appStyle: '2',
// objectType: '1',
// coverUrl:
// 'https://rmrbcmsonline.peopleapp.com/upload/image/202404/202404141115457926.png?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90',
// newsTitle: '又见花开!新疆伊犁花海延绵清新怡人',
// publishTime: '1713067227000',
// source: '荔枝新闻',
// videoInfo: {
// videoDuration: 25,
// videoLandscape: 1,
// videoUrl:
// 'https://rmrbcmsonline.peopleapp.com/upload/video/mp4/202404/1713064515901314d148763996.mp4'
// }
} as ContentDTO;
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
Column() {
... ... @@ -53,10 +45,11 @@ export struct Card2Component {
//大图
Stack() {
Image(this.contentDTO.coverUrl)
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius($r('app.float.image_border_radius'))
.backgroundColor(0xf5f5f5)
//播放状态+时长
CardMediaInfo({
contentDTO: this.contentDTO
... ...
... ... @@ -3,6 +3,7 @@ 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';
/**
... ... @@ -14,62 +15,12 @@ const TAG: string = 'Card4Component';
*/
@Component
export struct Card4Component {
@State contentDTO: ContentDTO = {
// appStyle: '4',
// fullColumnImgUrls: [
// {
// format: null,
// fullUrl: '',
// height: 187,
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118198_0c20f7c31c7b4eca6b0d0871e7771c62.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90',
// weight: 248
// },
// {
// format: null,
// fullUrl: '',
// height: 187,
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118198_0c20f7c31c7b4eca6b0d0871e7771c62.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90',
// weight: 248
// },
// {
// format: null,
// fullUrl: '',
// height: 187,
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118200_d10309bee894a67311e6c8f77df676d4.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90',
// weight: 248
// },
// {
// format: null,
// fullUrl: '',
// height: 187,
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/article_resource/image/1648118202_f33743e452fb69ee2c45c18a56eccdf6.png?x-oss-process=image/resize,m_fill,h_160,w_240/quality,q_90',
// weight: 248
// }
// ],
// newsTitle: '科普:如何发现家中是否有白蚁危害?丨又到白蚁分飞季②',
// rmhInfo: {
// authIcon:
// 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/blue.png',
// authTitle: '封面新闻',
// rmhDesc: '封面新闻,亿万年轻人的生活方式。',
// rmhHeadUrl:
// 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221212/122faff796.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
// rmhId: '2016608',
// rmhName: '封面新闻',
// userId: '522390888224390',
// userType: '2'
// },
// source: '头条号',
// publishTime: '1651204607000',
} as ContentDTO;
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
Column() {
... ... @@ -88,7 +39,8 @@ export struct Card4Component {
ForEach(this.contentDTO.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => {
if (index < 3) {
GridCol({ span: { xs: 4 } }) {
Image(item.url)
Image(this.loadImg ? item.url : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.aspectRatio(113 / 75)
.borderRadius({
... ...
import { ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from './notes';
const TAG: string = 'Card5Component';
... ... @@ -11,33 +12,30 @@ const TAG: string = 'Card5Component';
// @Entry
@Component
export struct Card5Component {
@State contentDTO: ContentDTO = {
// coverSize: '850*478',
// coverType: 1,
// coverUrl:
// 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240323/image/display/54ce2de0d20842839e96a644c78361b7.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
// linkUrl:
// 'https://pd-people-uat.pdnews.cn/h/atv/collect/1000000472?hiddenNavigator=1',
// newsTitle: '今天是周日,天气阴天,明天是周一。',
// objectType: '6'
} as ContentDTO;
@State contentDTO: ContentDTO = {} as ContentDTO;
@State titleShowPolicy: number | string = 1
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
Stack() {
Image(this.contentDTO.coverUrl)
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 || this.contentDTO.titleShow === 1) && this.contentDTO.newsTitle) {
// Row()
// .width(CommonConstants.FULL_WIDTH)
// .height(59)
// .linearGradient({
// colors: [
// ['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]
// ]
// })
Row()
.width(CommonConstants.FULL_WIDTH)
.height(59)
.linearGradient({
colors: [
['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]
]
})
Row() {
Stack() {
if (this.contentDTO.objectType == '5') {
... ...
... ... @@ -4,6 +4,7 @@ import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG: string = 'Card6Component-Card13Component';
... ... @@ -13,6 +14,11 @@ const TAG: string = 'Card6Component-Card13Component';
@Component
export struct Card6Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
Row() {
... ... @@ -57,8 +63,8 @@ export struct Card6Component {
.width('58%')
Stack() {
Image(this.contentDTO.coverUrl)
.backgroundColor($r('app.color.color_B0B0B0'))
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor( this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.borderRadius(5)
.aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180)
... ...
... ... @@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant';
import { DateTimeUtils } from 'wdKit';
import { ProcessUtils } from 'wdRouter';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
/**
* 时间链卡--CompStyle: 09
... ... @@ -12,6 +13,11 @@ const TAG: string = 'Card9Component';
@Component
export struct Card9Component {
@State contentDTO: ContentDTO = {} as ContentDTO;
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
Column() {
... ... @@ -27,7 +33,8 @@ export struct Card9Component {
}
// 大图
Stack() {
Image(this.contentDTO.coverUrl)
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.borderRadius({
topLeft: $r('app.float.image_border_radius'),
... ... @@ -127,7 +134,8 @@ export struct Card9Component {
.alignSelf(ItemAlign.Center)
.margin({ left: 12 })
if (item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
Image(item.fullColumnImgUrls[0].url)
Image(this.loadImg? item.fullColumnImgUrls[0].url : '')
.backgroundColor(0xf5f5f5)
.width(90)
.height(60)
.borderRadius($r('app.float.image_border_radius'))
... ...
... ... @@ -4,7 +4,8 @@ import { BreakPointType, Logger } from 'wdKit';
import { CompUtils } from '../../utils/CompUtils';
import { ProcessUtils } from 'wdRouter';
import { EmptyComponent } from '../view/EmptyComponent';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG = 'Zh_Carousel_Layout-01';
... ... @@ -163,13 +164,19 @@ export struct ZhCarouselLayout01 {
struct CarouselLayout01CardView {
private item: ContentDTO = {} as ContentDTO;
private length: number = 1; // 轮播图数量
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
Stack() {
Image(this.item.coverUrl)
Image(this.loadImg ? this.item.coverUrl : '')
.width(CommonConstants.FULL_PARENT)
.height(CommonConstants.FULL_PARENT)
.objectFit(ImageFit.Cover)
.backgroundColor(0xf5f5f5)
Row()
.width(CommonConstants.FULL_PARENT)
... ...
... ... @@ -3,6 +3,7 @@ import { CommonConstants } from 'wdConstant/Index';
import { Logger } from 'wdKit/Index';
import { ProcessUtils } from 'wdRouter';
import PageViewModel from '../../viewmodel/PageViewModel';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG = 'Zh_Grid_Layout-02';
const FULL_PARENT: string = '100%';
... ... @@ -18,18 +19,22 @@ let listSize: number = 2;
export struct ZhGridLayout02 {
@State compDTO: CompDTO = {} as CompDTO
@State operDataList: ContentDTO[] = []
currentPage = 1
pageSize = 12
@State loadImg: boolean = false;
aboutToAppear() {
async aboutToAppear(): Promise<void> {
Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle)
this.currentPage = 1
PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => {
this.operDataList = []
this.operDataList.push(...liveReviewDTO.list)
})
this.loadImg = await onlyWifiLoadImg();
}
currentPage = 1
pageSize = 12
build() {
Column() {
Scroll() {
... ... @@ -96,7 +101,8 @@ export struct ZhGridLayout02 {
@Builder
buildItemCard(item: ContentDTO) {
Column() {
Image(item.fullColumnImgUrls[0].url)
Image(this.loadImg ? item.fullColumnImgUrls[0].url : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.height(95)
.borderRadius(4)
... ...
... ... @@ -3,6 +3,7 @@ import { CompStyle } from 'wdConstant';
import { Logger } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG = 'Zh_Grid_Layout-03';
const FULL_PARENT: string = '100%';
... ... @@ -18,11 +19,13 @@ let listSize: number = 4;
@Component
export struct ZhGridLayout03 {
@State compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
aboutToAppear() {
async aboutToAppear(): Promise<void> {
if (this.compDTO.operDataList) {
listSize = this.compDTO.operDataList.length > 5 ? 4 : this.compDTO.operDataList.length;
}
this.loadImg = await onlyWifiLoadImg();
}
build() {
... ... @@ -52,7 +55,8 @@ export struct ZhGridLayout03 {
@Builder
buildItemCard(item: ContentDTO) {
Column() {
Image(item.coverUrl)
Image(this.loadImg ? item.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width(44)
.aspectRatio(1 / 1)
.margin({
... ...
... ... @@ -4,7 +4,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index';
import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
import { CommonConstants } from 'wdConstant/Index';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
/**
* 兴趣卡
* Zh_Single_Column-09
... ... @@ -18,12 +18,13 @@ export struct ZhSingleColumn09 {
@State activeIndexs: Array<number> = []
@State operDataList: ContentDTO[] = this.compDTO?.operDataList || []
@State selfClosed: Boolean = false;
@State loadImg: boolean = false;
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
this.operDataList = this.shuffleArray(this.compDTO?.operDataList)
}
getItemWidth(index: number) {
if (index % 4 === 0 || index % 4 === 3) {
return 80
... ... @@ -84,7 +85,8 @@ export struct ZhSingleColumn09 {
ForEach(this.operDataList, (item: ContentDTO, index: number) => {
GridItem() {
Stack({alignContent: Alignment.TopEnd}) {
Image(item.coverUrl)
Image(this.loadImg ? item.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.height('100%')
Text(item.newsTitle)
... ...
... ... @@ -5,6 +5,7 @@ import { PageRepository } from '../../repository/PageRepository';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { HttpUtils } from 'wdNetwork/Index';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
/**
* 小视频横划卡
... ... @@ -104,13 +105,21 @@ function textOverflowStyle(maxLine: number) {
struct CreatorItem {
@Prop item: ContentDTO
@State rmhIsAttention: number = 0
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
ListItem() {
Column() {
Stack({ alignContent: Alignment.Bottom }) {
Image(this.item.coverUrl)
Image(this.loadImg ? this.item.coverUrl : '')
.width(156)
.height(208)
.backgroundColor(0xf5f5f5)
Row()
.width(156)
.height(80)
... ...
... ... @@ -4,9 +4,11 @@ import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../../repository/PageRepository';
import { ProcessUtils } from 'wdRouter';
import { HttpUtils } from 'wdNetwork/Index';
import { DateTimeUtils } from 'wdKit';
import { DateTimeUtils, SPHelper } from 'wdKit';
import { LiveModel } from '../../viewmodel/LiveModel'
import { Logger, ToastUtils } from 'wdKit';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { SpConstants } from 'wdConstant/Index'
/**
* 直播预约卡
... ... @@ -32,12 +34,15 @@ export struct ZhSingleRow03 {
@State isEndEdge: boolean = false;
// @State reserveStatus: reserveItem[] = []
@State reservedIds: string[] = [];
scroller: Scroller = new Scroller()
@State loadImg: boolean = false;
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
this.getReserveState();
this.loadImg = await onlyWifiLoadImg();
}
scroller: Scroller = new Scroller()
// 请求所有预约状态
async getReserveState() {
const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => {
... ... @@ -63,6 +68,13 @@ export struct ZhSingleRow03 {
// 预约/取消预约
async bookAndCancel(relationId: string, liveId: string, isSubscribe: boolean) {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
const res = await LiveModel.liveAppointment(relationId.toString(), liveId.toString(), isSubscribe);
if (res.code == 0) {
ToastUtils.shortToast(isSubscribe ? '预约成功' : '取消预约成功')
... ... @@ -128,10 +140,12 @@ export struct ZhSingleRow03 {
ItemCard(item: ContentDTO) {
Column() {
Row() {
Image(item.coverUrl)
Image(this.loadImg ? item.coverUrl : '')
.width(106)
.height(60)
.margin({right: 12})
.backgroundColor(0xf5f5f5)
Text(item.newsTitle)
.width(154)
.height(60)
... ... @@ -256,11 +270,17 @@ function textOverflowStyle(maxLine: number) {
struct CreatorItem {
@Prop item: ContentDTO
@State rmhIsAttention: number = 0
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
ListItem() {
Column() {
Stack({ alignContent: Alignment.Bottom }) {
Image(this.item.coverUrl)
Image(this.loadImg ? this.item.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width(156)
.height(208)
Row()
... ...
... ... @@ -35,7 +35,7 @@ export struct FollowThirdTabsComponent{
Text(item.directoryName)
.fontSize('27lpx')
.fontWeight(this.currentIndex === index ? "600lpx" : "400lpx")
.fontWeight(this.currentIndex === index ? 600 : 400)
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.lineHeight('35lpx')
.backgroundImage($r('app.media.ic_collect_mid'))
... ...
... ... @@ -517,7 +517,7 @@ export struct PaperSingleColumn999CardView {
}
}
.backgroundColor(Color.White)
.margin({ bottom: 5, left: 12, right: 12 })
.margin({ bottom: 14, left: 12, right: 12 })
.borderRadius(4)
.onClick(() => {
ProcessUtils.processPage(this.item)
... ...
... ... @@ -13,8 +13,20 @@ const LOCAL_CHANNEL: string = '地方频道'
const TAG: string = 'ChannelSubscriptionLayout'
@CustomDialog
struct ChannelDialog {
// @Entry
@Component
struct ChannelSubscriptionLayout {
@State indexSettingArray: string [] = ['推荐', '热点']
//当前选中的频道
@Link currentTopNavSelectedIndex: number;
@Prop homeChannelList: TopNavDTO []
@Prop indexSettingChannelId: number
@Link myChannelList: TopNavDTO []
@Link moreChannelList: TopNavDTO []
@Link localChannelList: TopNavDTO []
@Link channelIds: number []
@StorageLink('channelIds') storeChannelIds: string = ''
@State isShow: boolean = false
@State dragItem: number = -1
private dragRefOffsetX: number = 0
private dragRefOffsetY: number = 0
... ... @@ -25,26 +37,40 @@ struct ChannelDialog {
@State indexSettingTabIndex: number = 0
@State isEditIng: boolean = false
@State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO
@Link currentTopNavSelectedIndex: number
@Link myChannelList: TopNavDTO[]
@Link moreChannelList: TopNavDTO[]
@Link localChannelList: TopNavDTO[]
@Link homeChannelList: TopNavDTO[]
@Link indexSettingChannelId: number
controller?: CustomDialogController
confirm: (index: number) => void = () => {
}
changeChannelIndex: (index1: number, index2: number) => void = () => {
}
delChannelItem: (index: number) => void = () => {
}
addChannelItem: (item: TopNavDTO) => void = () => {
changeTab: (index: number) => void = () => {
}
aboutToAppear() {
this.currentTopNavSelectedItem = this.myChannelList[this.currentTopNavSelectedIndex]
}
//交换我的频道数组中的位置
changeChannelIndex(index1: number, index2: number) {
let tmp = this.myChannelList.splice(index1, 1)
let channelIdTmp = this.channelIds.splice(index1, 1)
this.myChannelList.splice(index2, 0, tmp[0])
this.channelIds.splice(index2, 0, channelIdTmp[0])
this.storeChannelIds = this.channelIds.join(',')
}
//删除频道
delChannelItem(index: number){
let item = this.myChannelList.splice(index, 1)[0]
this.channelIds.splice(index, 1)
this.storeChannelIds = this.channelIds.join(',')
if (item.moreChannel === '1') {
this.moreChannelList.unshift(item)
}
if (item.localChannel === '1') {
this.localChannelList.unshift(item)
}
}
// 添加频道
addChannelItem(item: TopNavDTO){
this.channelIds.push(item.channelId)
this.myChannelList.push(item)
this.storeChannelIds = this.channelIds.join(',')
}
itemMove(index: number, newIndex: number): void {
let targetItem = this.myChannelList[newIndex]
if (!(targetItem?.headlinesOn === 1 || targetItem?.movePermitted === 0 || targetItem?.homeChannel === '1')) {
... ... @@ -176,7 +202,8 @@ struct ChannelDialog {
}
}
build() {
@Builder
sheetBuilder() {
Column() {
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
Image($r('app.media.icon_ren_min_ri_bao'))
... ... @@ -185,7 +212,7 @@ struct ChannelDialog {
Image($r('app.media.close_button'))
.width(24)
.onClick(() => {
this.controller?.close()
this.isShow = false
})
}
.width('100%')
... ... @@ -310,8 +337,8 @@ struct ChannelDialog {
this.delChannelItem(index)
}
} else {
this.confirm(index)
this.controller?.close()
this.changeTab(index)
this.isShow = false
}
}),
LongPressGesture({ repeat: true })
... ... @@ -464,73 +491,6 @@ struct ChannelDialog {
})
.backgroundColor('#ffffff')
}
}
// @Entry
@Component
struct ChannelSubscriptionLayout {
@State indexSettingArray: string [] = ['推荐', '热点']
//当前选中的频道
@Link currentTopNavSelectedIndex: number;
@Prop homeChannelList: TopNavDTO []
@Prop indexSettingChannelId: number
@Link myChannelList: TopNavDTO []
@Link moreChannelList: TopNavDTO []
@Link localChannelList: TopNavDTO []
@Link channelIds: number []
@StorageLink('channelIds') storeChannelIds: string = ''
changeTab: (index: number) => void = () => {
}
//频道弹窗点击切换频道
onAccept = (index: number) => {
this.changeTab(index)
}
//交换我的频道数组中的位置
changeChannelIndex = (index1: number, index2: number) => {
let tmp = this.myChannelList.splice(index1, 1)
let channelIdTmp = this.channelIds.splice(index1, 1)
this.myChannelList.splice(index2, 0, tmp[0])
this.channelIds.splice(index2, 0, channelIdTmp[0])
this.storeChannelIds = this.channelIds.join(',')
}
//删除频道
delChannelItem = (index: number) => {
let item = this.myChannelList.splice(index, 1)[0]
this.channelIds.splice(index, 1)
this.storeChannelIds = this.channelIds.join(',')
if (item.moreChannel === '1') {
this.moreChannelList.unshift(item)
}
if (item.localChannel === '1') {
this.localChannelList.unshift(item)
}
}
// 添加频道
addChannelItem = (item: TopNavDTO) => {
this.channelIds.push(item.channelId)
this.myChannelList.push(item)
this.storeChannelIds = this.channelIds.join(',')
}
dialogController: CustomDialogController | null = new CustomDialogController({
builder: ChannelDialog({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
indexSettingChannelId: $indexSettingChannelId,
homeChannelList: $homeChannelList,
myChannelList: $myChannelList,
moreChannelList: $moreChannelList,
localChannelList: $localChannelList,
confirm: this.onAccept,
changeChannelIndex: this.changeChannelIndex,
delChannelItem: this.delChannelItem,
addChannelItem: this.addChannelItem
}),
alignment: DialogAlignment.TopEnd,
customStyle: true,
})
aboutToDisappear() {
this.dialogController = null // 将dialogController置空
}
build() {
Row() {
... ... @@ -542,10 +502,9 @@ struct ChannelSubscriptionLayout {
.justifyContent(FlexAlign.Center)
.backgroundColor(Color.White)
.onClick(() => {
if (this.dialogController != null) {
this.dialogController.open()
}
this.isShow = true
})
.bindContentCover(this.isShow, this.sheetBuilder())
}
}
... ...
import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean';
import { LazyDataSource, Logger, SPHelper } from 'wdKit';
import { SpConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { DisplayUtils, LazyDataSource, Logger, SPHelper } from 'wdKit';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
import { PageComponent } from './PageComponent';
import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent';
import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent';
import { WDRouterPage, WDRouterRule } from 'wdRouter'
import { channelSkeleton } from '../skeleton/channelSkeleton'
import { channelSkeleton } from '../skeleton/channelSkeleton';
const TAG = 'TopNavigationComponent';
... ... @@ -253,6 +251,8 @@ export struct TopNavigationComponent {
}, (navItem: TopNavDTO) => JSON.stringify(navItem));
}
.barHeight($r('app.float.top_tab_bar_height'))
.height(this._currentNavIndex == 0 ? DisplayUtils.getDeviceHeight() - vp2px(48.3) :
'100%')
.barMode(BarMode.Scrollable)
.vertical(false)
.barBackgroundColor(this.barBackgroundColor)
... ...
... ... @@ -8,10 +8,18 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { LiveModel } from '../../viewmodel/LiveModel'
import { ContentConstants } from '../../constants/ContentConstants'
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
@Component
export struct LiveHorizontalCardComponent {
@State compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
Column() {
... ... @@ -63,7 +71,8 @@ export struct LiveHorizontalCardComponent {
ListItem() {
Column() {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(item.coverUrl)
Image(this.loadImg ? item.coverUrl : '')
.backgroundColor(0xf5f5f5)
.aspectRatio(16 / 9)
.width(this.compDTO.operDataList.length == 2 ? 210 : 150)
.borderRadius(4)
... ...
import { NetworkUtil, SPHelper } from 'wdKit';
import { SpConstants } from 'wdConstant';
async function onlyWifiLoadImg() : Promise<boolean> {
let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_IMAGE_SWITCH, '') || false;
let isNetConnected = NetworkUtil.isNetConnected();
let netWorkStatus = NetworkUtil.getNetworkType();
if (isNetConnected) {
if (netWorkStatus === NetworkUtil.TYPE_WIFI) {
return true;
} else {
if (loadImageOnlyWifiSwitch) {
return false
} else {
return true;
}
}
} else {
return false;
}
}
export { onlyWifiLoadImg }
\ No newline at end of file
... ...
... ... @@ -7,6 +7,9 @@ import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel'
import { ViewType } from 'wdConstant/Index'
import { LiveViewModel } from '../../viewModel/LiveViewModel'
import { TabChatItemComponent } from './TabChatItemComponent'
import { Logger } from 'wdKit';
const TAG: string = 'TabChatComponent';
@Component
export struct TabChatComponent {
... ... @@ -84,6 +87,7 @@ export struct TabChatComponent {
20,)
.then(
(data) => {
Logger.debug(TAG, `${JSON.stringify(data)}`)
if (data.barrageResponses && data.barrageResponses.length > 0) {
this.pageModel.viewType = ViewType.LOADED;
this.liveChatList.push(...data.barrageResponses)
... ... @@ -98,7 +102,8 @@ export struct TabChatComponent {
}
},
() => {
Logger.debug(TAG, `error`)
this.pageModel.viewType = ViewType.ERROR;
})
}
... ...
import { LiveRoomItemBean } from 'wdBean/Index'
import { LiveRoomItemBean, Action, PhotoListBean, Params } from 'wdBean/Index'
import { StringUtils } from 'wdKit/Index'
// import { Action, LiveRoomItemBean, Params, PhotoListBean } from 'wdBean/Index'
import { WDRouterRule } from 'wdRouter'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
@Component
export struct TabChatItemComponent {
... ... @@ -14,6 +17,8 @@ export struct TabChatItemComponent {
.borderRadius(90)
.width(24)
.height(24)
Column() {
Row() {
Text() {
Span(this.item.senderUserName + ': ')
.fontColor('#666666')
... ... @@ -27,11 +32,58 @@ export struct TabChatItemComponent {
.fontWeight(400)
}
.alignItems(VerticalAlign.Top)
if (this.item.dataType == 'ZH_TEXT_AND_IMAGE_MSG' && this.item.pictureUrls && this.item.pictureUrls.length > 0) {
Image(this.item.pictureUrls[0])
.width(`100%`)
.objectFit(ImageFit.Contain)
.borderRadius(4)
.margin({
top: 10
})
.onClick(() => {
this.gotoMultipleListImagePage(this.item.pictureUrls[0])
})
}
}
.margin({
left: 8,
right: 8
})
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}
.alignItems(VerticalAlign.Top)
.padding({
left: 15,
top: 15,
right: 15
})
}
/**
* 大图列表页
* @param content
* */
gotoMultipleListImagePage(imgUrl: string) {
const photoList: PhotoListBean[] = []
photoList.push({
width: 0,
height: 0,
picPath: imgUrl,
picDesc: ''
})
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 18,
extra: {
photoList: photoList,
swiperIndex: 0,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
aboutToDisappear(): void {
... ...
... ... @@ -9,6 +9,10 @@ import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLay
import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout'
import { StringUtils } from 'wdKit/Index'
import { LiveViewModel } from '../../viewModel/LiveViewModel'
import { Logger } from 'wdKit'
const TAG: string = 'TabLiveComponent';
@Component
export struct TabLiveComponent {
... ... @@ -86,6 +90,7 @@ export struct TabLiveComponent {
20)
.then(
(data) => {
Logger.debug(TAG, `${JSON.stringify(data)}`)
if (data.barrageResponses && data.barrageResponses.length > 0) {
/**
* 在直播聊天添加一条新内容逻辑:
... ... @@ -119,6 +124,8 @@ export struct TabLiveComponent {
}
},
() => {
Logger.debug(TAG, `Error`)
this.pageModel.viewType = ViewType.ERROR;
})
}
... ...
... ... @@ -88,15 +88,15 @@ export struct TabLiveItemComponent {
if (this.item.pictureUrls.length > 1) {
Image(itemSub)
.width(`${100 / this.item.pictureUrls.length}%`)
.height(70)
.objectFit(ImageFit.Auto)
// .height(70)
.objectFit(ImageFit.Contain)
.borderRadius(4)
} else {
Image(itemSub)
.width(`100%`)
// .aspectRatio(this.getAspectRation())
.height(177)
.objectFit(ImageFit.Auto)
// .height(177)
.objectFit(ImageFit.Contain)
.borderRadius(4)
}
}.onClick(() => {
... ...
... ... @@ -10,6 +10,7 @@ export struct PlayerProgressView {
@Consume isOpenDetail: boolean
@Consume isDragging: boolean
@State status: number = PlayerConstants.STATUS_START;
@State videoDuration: number = this.contentDetailData?.videoInfo?.[0]?.videoDuration || 1
aboutToAppear() {
if (this.playerController) {
... ... @@ -25,9 +26,9 @@ export struct PlayerProgressView {
build() {
Column() {
Text() {
Span(DateTimeUtils.secondToTime(Math.floor(this.progressVal / 100 * this.contentDetailData.videoInfo[0].videoDuration)))
Span(DateTimeUtils.secondToTime(Math.floor(this.progressVal / 100 * this.videoDuration)))
Span(' / ')
Span(DateTimeUtils.secondToTime(this.contentDetailData.videoInfo[0].videoDuration || 0))
Span(DateTimeUtils.secondToTime(this.videoDuration))
}
.fontSize(24)
.fontColor(Color.White)
... ... @@ -40,12 +41,16 @@ export struct PlayerProgressView {
step: 0.01,
// style: SliderStyle.OutSet
})
.blockColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.play_block_color') : Color.Transparent)
.trackColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.pause_track_color') : $r('app.color.play_track_color'))
.selectedColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.pause_selected_color') : $r('app.color.play_selected_color'))
.blockColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? $r('app.color.play_block_color') :
Color.Transparent)
.trackColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ?
$r('app.color.pause_track_color') : $r('app.color.play_track_color'))
.selectedColor(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ?
$r('app.color.pause_selected_color') : $r('app.color.play_selected_color'))
.trackThickness(this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? 4 : 1)
.blockStyle({
type: this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? SliderBlockType.IMAGE : SliderBlockType.DEFAULT,
type: this.status === PlayerConstants.STATUS_PAUSE || this.isDragging ? SliderBlockType.IMAGE :
SliderBlockType.DEFAULT,
image: $r('app.media.ic_player_block')
})
.blockSize({ width: 18, height: 12 })
... ...
... ... @@ -56,6 +56,7 @@ struct ModifyPasswordPage {
Row() {
Row() {
TextInput({ placeholder: "请输入原密码" })
.passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")})
.placeholderColor("#CCCCCC")
.type(InputType.Password)
.showPasswordIcon(true)
... ... @@ -78,6 +79,7 @@ struct ModifyPasswordPage {
Row() {
Row() {
TextInput({ placeholder: "请输入新密码" })
.passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")})
.placeholderColor("#CCCCCC")
.type(InputType.Password)
.showPasswordIcon(true)
... ... @@ -102,6 +104,7 @@ struct ModifyPasswordPage {
TextInput({ placeholder: "再次输入新密码" })
.placeholderColor("#CCCCCC")
.type(InputType.Password)
.passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")})
.showPasswordIcon(true)
.backgroundColor('#00000000')
.onChange((value: string) => {
... ... @@ -120,18 +123,23 @@ struct ModifyPasswordPage {
.alignItems(VerticalAlign.Center)
Column() {
Text("提示:密码长度6-20位,需答谢字母、小写字母、数字、特殊字符中组合三种及三种以上组成").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
Text("提示:密码长度6~20,需大写字母、小写字母、数字、特殊符合中组合三种及三种以上").fontSize(12).maxLines(3).fontColor(0x999999).padding({top:'10lpx'})
}
.width('100%')
.height('85lpx')
.alignItems(HorizontalAlign.Start)
Row() {
Button("确认", { type: ButtonType.Normal, stateEffect: true })
Button( { type: ButtonType.Normal, stateEffect: true }){
Text("确认")
.fontColor("#fff")
.fontSize("35lpx")
.lineHeight("50lpx")
.opacity(this.btnStatus ?1:0.5)
}
.width('100%')
.height('80lpx')
.backgroundColor(this.btnStatus ? '#da3e22' : '#e5856d')
.fontColor('#fff')
.backgroundColor(this.btnStatus ? '#ED2800' : '#99ED2800')
.borderRadius('4vp')
.onClick(() => {
if(this.btnStatus){
... ... @@ -157,6 +165,7 @@ struct ModifyPasswordPage {
}.padding({top:"92lpx",left:"48lpx",right:"48lpx"})
}.titleMode(NavigationTitleMode.Mini)
.backButtonIcon($r("app.media.login_back_icon"))
.title('')
}
... ... @@ -193,3 +202,5 @@ struct ModifyPasswordPage {
this.dialogToast.open()
}
}
... ...
... ... @@ -200,6 +200,7 @@ export struct SettingPasswordLayout {
Row() {
TextInput({ placeholder: item.inputPlacholder })
.placeholderColor("#CCCCCC")
.passwordIcon({onIconSrc:$r("app.media.login_password_on"),offIconSrc:$r("app.media.login_password_off")})
.type(InputType.Password)
.showPasswordIcon(true)
.backgroundColor('#00000000')
... ...