wangliang_wd

feat:优化预约列表

... ... @@ -115,7 +115,6 @@ export struct WdWebLocalComponent {
}
.width(this.positionWidth)
.height(this.positionHeight)
.backgroundColor(Color.Red)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
})
... ...
... ... @@ -9,7 +9,9 @@ import { MyCustomDialog } from '../../reusable/MyCustomDialog'
export struct AppointmentListChildComponent {
@ObjectLink item: MineAppointmentItem
@State loadImg: boolean = false;
confirmCallback: (item: MineAppointmentItem) => void = () => {
}
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
... ... @@ -29,161 +31,163 @@ export struct AppointmentListChildComponent {
})
build() {
Column() {
Stack() {
Image(this.loadImg ? this.item?.imageUrl[0] : '')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.width('100%')
.aspectRatio(16 / 9)
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
// if (this.item.isAppointment){
Column() {
Stack() {
Image(this.loadImg ? this.item?.imageUrl[0] : '')
.backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5)
.width('100%')
.aspectRatio(16 / 9)
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
if (this.item.status == "wait") {
if (this.item.status == "wait") {
Row() {
Row() {
Image($r('app.media.reserve_icon'))
.width('27lpx')
.height('27lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.margin({right:"6lpx"})
Text("预约")
.fontWeight(400)
.fontSize('23lpx')
.textShadow({
radius: 2,
color: `rgba(0,0,0,0.3)`,
offsetY:2,
offsetX:0
})
.fontColor($r('app.color.white'))
.lineHeight('31lpx')
.layoutWeight(1)
.textAlign(TextAlign.Start)
}.width('94lpx')
.margin({ bottom: '15lpx', right: '15lpx' })
.alignItems(VerticalAlign.Center)
}.width('100%')
.height('100%')
.alignItems(VerticalAlign.Bottom)
.justifyContent(FlexAlign.End)
}
}.width('100%')
.height('376lpx')
Column() {
Text(this.item.title)
.fontWeight('400lpx')
.fontSize('33lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('48lpx')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: '23lpx' })
.textAlign(TextAlign.Start)
.width('100%')
Row() {
Row() {
Image($r('app.media.reserve_icon'))
.width('27lpx')
.height('27lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.margin({right:"6lpx"})
if (this.item.status == "end") {
Image($r('app.media.play_status_history_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width('38lpx')
.height('38lpx')
.margin({ right: '12lpx' })
Text('已结束').fontColor($r('app.color.color_999999'))
.fontWeight('500lpx')
.fontSize('23lpx')
}else if(this.item.status == "running"){
Image($r('app.media.play_status_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width('38lpx')
.height('38lpx')
.margin({ right: '12lpx' })
Text('已开始').fontColor($r('app.color.color_999999'))
.fontWeight('500lpx')
.fontSize('23lpx')
} else {
Image($r('app.media.play_status_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width('38lpx')
.height('38lpx')
.margin({ right: '12lpx' })
Text(this.item.timePre).fontColor($r('app.color.color_ED2800'))
.fontWeight('500lpx')
.fontSize('23lpx')
Image($r('app.media.point_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width('12lpx')
.height('31lpx')
.margin({ right: '4lpx' })
Text(`${this.item.timeBack}开始`).fontColor($r('app.color.color_ED2800'))
.fontWeight('500lpx')
.fontSize('23lpx')
.lineHeight('31lpx')
}
}
.padding({ left: '19lpx', right: '19lpx' })
.height('46lpx')
.alignItems(VerticalAlign.Center)
.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius('4lpx')
Text("预约")
Blank()
.layoutWeight(1)
if (this.item.status === "wait") {
Text(this.item.isAppointment ? "已预约" : "预约")
.fontWeight(400)
.fontSize('23lpx')
.textShadow({
radius: 2,
color: `rgba(0,0,0,0.3)`,
offsetY:2,
offsetX:0
})
.fontColor($r('app.color.white'))
.backgroundColor(this.item.isAppointment ? $r('app.color.color_F5F5F5') : $r('app.color.color_ED2800'))
.fontColor(this.item.isAppointment ? $r('app.color.color_CCCCCC') : $r('app.color.white'))
.lineHeight('31lpx')
.layoutWeight(1)
.textAlign(TextAlign.Start)
}.width('94lpx')
.margin({ bottom: '15lpx', right: '15lpx' })
.alignItems(VerticalAlign.Center)
}.width('100%')
.height('100%')
.alignItems(VerticalAlign.Bottom)
.justifyContent(FlexAlign.End)
}
}.width('100%')
.height('376lpx')
Column() {
Text(this.item.title)
.fontWeight('400lpx')
.fontSize('33lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('48lpx')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: '23lpx' })
.textAlign(TextAlign.Start)
.width('100%')
Row() {
Row() {
if (this.item.status == "end") {
Image($r('app.media.play_status_history_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width('38lpx')
.height('38lpx')
.margin({ right: '12lpx' })
Text('已结束').fontColor($r('app.color.color_999999'))
.fontWeight('500lpx')
.fontSize('23lpx')
.textAlign(TextAlign.Center)
.width('100lpx')
.height('46lpx')
.borderRadius('6lpx')
.onClick(() => {
this.dialogController.open()
})
}else if(this.item.status == "running"){
Image($r('app.media.play_status_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width('38lpx')
.height('38lpx')
.margin({ right: '12lpx' })
Text('已开始').fontColor($r('app.color.color_999999'))
.fontWeight('500lpx')
Text("去观看" )
.fontWeight(400)
.fontSize('23lpx')
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.white'))
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
.width('100lpx')
.height('46lpx')
.borderRadius('6lpx')
} else {
Image($r('app.media.play_status_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width('38lpx')
.height('38lpx')
.margin({ right: '12lpx' })
Text(this.item.timePre).fontColor($r('app.color.color_ED2800'))
.fontWeight('500lpx')
.fontSize('23lpx')
Image($r('app.media.point_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width('12lpx')
.height('31lpx')
.margin({ right: '4lpx' })
Text(`${this.item.timeBack}开始`).fontColor($r('app.color.color_ED2800'))
.fontWeight('500lpx')
Text("看回放")
.fontWeight(400)
.fontSize('23lpx')
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.white'))
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
.width('100lpx')
.height('46lpx')
.borderRadius('6lpx')
}
}
.padding({ left: '19lpx', right: '19lpx' })
.height('46lpx')
.alignItems(VerticalAlign.Center)
.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius('4lpx')
Blank()
.layoutWeight(1)
if (this.item.status === "wait") {
Text(this.item.isAppointment ? "已预约" : "预约")
.fontWeight(400)
.fontSize('23lpx')
.backgroundColor(this.item.isAppointment ? $r('app.color.color_F5F5F5') : $r('app.color.color_ED2800'))
.fontColor(this.item.isAppointment ? $r('app.color.color_CCCCCC') : $r('app.color.white'))
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
.width('100lpx')
.height('46lpx')
.borderRadius('6lpx')
.onClick(() => {
this.dialogController.open()
})
}else if(this.item.status == "running"){
Text("去观看" )
.fontWeight(400)
.fontSize('23lpx')
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.white'))
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
.width('100lpx')
.height('46lpx')
.borderRadius('6lpx')
} else {
Text("看回放")
.fontWeight(400)
.fontSize('23lpx')
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.white'))
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
.width('100lpx')
.height('46lpx')
.borderRadius('6lpx')
}
}
}
.padding({
left: '23lpx',
right: '23lpx',
top: '15lpx',
bottom: '23lpx'
})
}.margin({ left: 10, right: 10 })
.backgroundColor($r('app.color.white'))
.borderRadius('8lpx')
.padding({
left: '23lpx',
right: '23lpx',
top: '15lpx',
bottom: '23lpx'
})
}.margin({ left: 10, right: 10 })
.backgroundColor($r('app.color.white'))
.borderRadius('8lpx')
// }
}
onCancel() {
... ... @@ -200,8 +204,9 @@ export struct AppointmentListChildComponent {
MinePageDatasModel.getAppointmentOperation(item, getContext(this)).then((value) => {
if (value != null) {
if (value.code === 0 || value.code.toString() === "0") {
this.item.isAppointment = !this.item.isAppointment
// this.item.isAppointment = !this.item.isAppointment
this.confirmCallback(this.item)
if(!this.item.isAppointment){
TrackingButton.click("mySavedLivePageUnSubscribe",TrackConstants.PageName.My_Saved_Live,TrackConstants.PageName.My_Saved_Live)
}
... ...
... ... @@ -101,7 +101,10 @@ export struct AppointmentListUI {
List({ space:6,scroller: this.scroller }) {
LazyForEach(this.data, (item: MineAppointmentItem, index: number) => {
ListItem() {
AppointmentListChildComponent({ item: item })
AppointmentListChildComponent({ item: item,confirmCallback:((deleteItem) =>{
this.data.deleteItem(this.data.getIndexOf(deleteItem))
this.count = this.data.totalCount()
})})
}
.onClick(() => {
let contentDTO = getParams(item)
... ...