import { MeetingItemModel,ItemModel } from '../model/ItemModel' import { router } from '@kit.ArkUI' @Preview @Component export struct ItemCompPast { item: MeetingItemModel = new MeetingItemModel({} as ItemModel) @State timeColor:ResourceStr=$r('app.color.ee432f') @State status:string='' aboutToAppear(): void { this.getMeetingStatus() } build() { Column() { Text().height(1).width('100%') RelativeContainer(){ Column() { Text(this.item.title) .maxLines(2).fontSize(15).fontColor(Color.Black).textAlign(TextAlign.Start) .textOverflow({ overflow: TextOverflow.Ellipsis }).id('title').width('100%') Row(){ Image($r('app.media.meetingtime')).width(13).height(13) Text(this.getTime(this.item.begin_date,this.item.end_date)).fontSize(14) .fontColor($r('app.color.999999')).margin({left:10}) Blank() Image($r('app.media.meetinglocation')).width(15).height(15) Text(this.item.location).fontSize(14) .fontColor($r('app.color.999999')).margin({left:10}) } .width('100%') .margin({top:6}) }.height(75).justifyContent(FlexAlign.Center).margin({left:15,right:15}) } .height(75).clip(true) .backgroundColor(Color.White) }.backgroundColor($r('app.color.e4e4e4')) .width('100%').clip(true) .onClick(() => { router.pushUrl({ url: 'pages/WebView/WebPage', params: { url: this.item.path ,title:'会议详情'} }); }) } getTime(str1:string, str2:string) { if (str1.substring(0, 10)==(str2.substring(0, 10))) { return str1.replaceAll("-", ".").substring(0, 10).toString(); } return str1.replaceAll("-", ".").substring(0, 10)+"-"+str2.replaceAll("-", ".").substring(0, 10) } getMeetingStatus() { if(this.item.count%4==0) { this.timeColor=$r('app.color.ee432f') } else if(this.item.count%4==1) { this.timeColor=$r('app.color.f9b928') } else if(this.item.count%4==2) { this.timeColor=$r('app.color.63ccc7') } else { this.timeColor=$r('app.color.99d750') } if('1'==this.item.status) { this.status='预告' } else if('2'==this.item.status) { this.status='直播中' } else if('3'==this.item.status) { this.status='已结束' } else if('4'==this.item.status) { this.status='回放中' } else { this.status='' } } } interface extraData { name: string }