Files
harmony/features/netease/src/main/ets/components/ItemCompMany.ets
T
2025-07-10 08:57:32 +08:00

85 lines
2.7 KiB
Plaintext

import { InterrogationBean } from '../model/ConsulModel'
import { router } from '@kit.ArkUI'
import { calculateExactAge } from '@itcast/basic'
@Preview
@Component
export struct ItemCompMany {
@Prop item:InterrogationBean;
@State isHistory:boolean = false;//是否是我已回答
@State status:string=''
aboutToAppear(): void {
}
build() {
Column() {
Row()
{
Text()
{
Span(this.item.user_status==0?$r('app.string.cancellation'):this.item.name.substring(0,1)+'**').fontColor($r('app.color.top_title'))
Span(this.item.sex==0?"(男 "+this.getYears(this.item.birthday)+"岁)":"(女 "+this.getYears(this.item.birthday)+"岁)").fontColor($r('app.color.common_gray_03'))
}.fontSize(19).layoutWeight(1)
Text(this.item.create_date?this.item.create_date.length>10?this.item.create_date.substring(0,10):this.item.create_date:'')
.fontSize(15).fontColor($r('app.color.common_gray_03')).padding({left:5})
// Text('').width(11).height(11).backgroundColor('#ffff3e3e').borderRadius(20).margin({top:-20})
// .visibility(this.isHistory?Visibility.Visible:Visibility.None)
}
Text(this.item.disease_describe)
.fontSize(14).fontColor($r('app.color.common_gray_03')).padding(9).margin({top:10})
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.backgroundColor($r('app.color.f6f6f6')).borderRadius(8)
.width('100%')
Row()
{
if(this.item.answer_num==0)
{
Text('').width(11).height(11).backgroundColor('#ffff3e3e').borderRadius(20) .textAlign(TextAlign.Start)
Text('暂未有医生回答').fontSize(12).fontColor($r('app.color.common_gray_03'))
.textAlign(TextAlign.Start).layoutWeight(1).margin({left:3})
}
else
{
Text(this.item.answer_num+'位医生已回答').fontSize(12).fontColor($r('app.color.top_title'))
.textAlign(TextAlign.Start).layoutWeight(1)
}
Text(this.item.disease_name.includes("甲、乙、丙、丁")?'肝炎':this.item.disease_name).fontSize(11).borderColor($r('app.color.top_title')).fontColor($r('app.color.top_title'))
.width(63).height(25).borderRadius(17).borderWidth(1).textAlign(TextAlign.Center).margin({left:10})
}.alignSelf(ItemAlign.Start)
.margin({top:10})
}
.width('100%')
.padding(10)
.onClick(() => {
router.pushUrl({
url: 'pages/Netease/InterrogationDetailCompPage',
params: { uuid: this.item.step1_uuid,isHistory:this.isHistory+''}
});
})
}
getYears(birthDateStr:string): number
{
const birthDate: Date = new Date(birthDateStr);
return calculateExactAge(birthDate)
}
}