首页、患者分组、审核、列表等

This commit is contained in:
xiaoxiao
2025-07-10 09:27:17 +08:00
parent 5954f51701
commit 4641e9ecee
136 changed files with 7577 additions and 171 deletions
@@ -0,0 +1,108 @@
import { FlipperOptions,FlipperView,FlipperOptionsBuilder } from '@hshare/hshare-flipper'
import { promptAction } from '@kit.ArkUI';
import { router } from '@kit.ArkUI'
import { meetingModel } from '../model/HomeModel'
import { TimestampUtil } from '@itcast/basic'
@Component
export struct FlipperComp {
@Prop bankAdBeans: meetingModel[];
@State processedData: meetingModel[] = [];
options: FlipperOptions = FlipperOptionsBuilder.getInstance()
.setHeight(56)//View高度
.setInterval(3000)//上下滚动间隔,单位为毫秒
.setAnimateParam(500)//动画持续时间,单位为毫秒
.setOnItemClicked((item: meetingModel, index: number) => {
router.pushUrl({
url: 'pages/WebView/WebPage', // 目标url
params: {url:item.liveurl,title:item.title}
})
})
.setOnItemScrolled((item: meetingModel, index: number) => {
//滚动事件
})
.build()
aboutToAppear() {
if (this.bankAdBeans.length === 1) {
this.processedData = [...this.bankAdBeans, ...this.bankAdBeans, ...this.bankAdBeans];
} else {
this.processedData = this.bankAdBeans;
}
}
build() {
Column() {
Row() {
FlipperView({
options: this.options,
sourceBeans: this.processedData,
itemContentView: (data: meetingModel, index: number) => {
this.itemContentView(data, index)
}
})
}
}
.width('100%').height('100%').backgroundColor('#F4F4F4')
}
@Builder
itemContentView(item: meetingModel, index: number) {
Stack({alignContent:Alignment.Center}){
Image($r('app.media.meeting_back_icon'))
.width('100%').height(46).margin({top:10})
Row(){
Column() {
Row({space:2}){
Image($r('app.media.meeting_live_icon')).width(30).height(13)
if (item.state === '1') {
if (TimestampUtil.isToday(item.begin_date_timestamp)) {
Image($r('app.media.meeting_begin_play_icon')).width(16).height(16)
} else {
Image($r('app.media.meeting_noPlay_icon')).width(16).height(16)
}
} else if (item.state === '0' || item.state === '3') {
if (TimestampUtil.isToday(item.begin_date_timestamp)) {
Image($r('app.media.meeting_begin_play_icon')).width(16).height(16)
} else {
Image($r('app.media.meeting_noPlay_icon')).width(16).height(16)
}
} else {
Image($r('app.media.meeting_begin_play_icon')).width(16).height(16)
}
}
Stack({alignContent:Alignment.Center}){
Image($r('app.media.meeting_timeBack_icon')).width(74).height(15).margin({top:-3})
if (item.state === '1') {
if (TimestampUtil.isToday(item.begin_date_timestamp)) {
Text('开播'+TimestampUtil.format(item.begin_date_timestamp,'HH:mm'))
.fontSize(12).fontColor(Color.White)
} else {
Text(TimestampUtil.format(item.begin_date_timestamp,'MM月dd日'))
.fontSize(12).fontColor(Color.White)
}
} else if (item.state === '0' || item.state === '3') {
if (TimestampUtil.isToday(item.begin_date_timestamp)) {
Text('开播'+TimestampUtil.format(item.begin_date_timestamp,'HH:mm'))
.fontSize(12).fontColor(Color.White)
} else {
Text(TimestampUtil.format(item.begin_date_timestamp,'MM月dd日'))
.fontSize(12).fontColor(Color.White)
}
} else {
Text('正在直播')
.fontSize(12).fontColor(Color.White)
}
}
}.margin({left:10}).alignItems(HorizontalAlign.Start)
Blank()
.width(1).height(28).margin({left:9}).backgroundColor('#C5C5C5')
Text(item.title)
.fontSize(14)
.fontColor('#333333')
.margin({left:9})
}.margin({top:10}).width('100%').height(46)
}
}
}
@@ -0,0 +1,65 @@
import { iconsModel } from '../model/HomeModel'
import { patientDbManager, PatientEntity } from '@itcast/basic';
import { promptAction } from '@kit.ArkUI';
// interface iconsModel {
// img:string;
// name:string;
// isRed:boolean;
// }
@Component
export struct HomeIconComp {
@Prop iconList: iconsModel[];
@State patientIcon: string = '';
@State patientName: string = '我的患者';
@State videoIcon: string = '';
@State videoName: string = '肝胆视频';
aboutToAppear(): void {
for (const icons of this.iconList) {
if (icons.name === '我的患者') {
this.patientIcon = icons.img;
} else if (icons.name === '肝胆视频') {
this.videoIcon = icons.img;
}
}
for (let index = 0; index < this.iconList!.length; index++) {
const iconModel = this.iconList![index] as iconsModel ;
if (index == 0) {
iconModel.isRed = true;
}
}
}
build() {
Row() {
Grid() {
ForEach(this.iconList, (item: iconsModel) => {//[{ 'img': this.patientIcon, 'name': this.patientName },{ 'img': this.videoIcon, 'name': this.videoName}]
GridItem(){
Stack() {
Column() {
Image(item.img)
.width(24).height(24)
.objectFit(ImageFit.Auto)
Text(item.name)
.fontSize(14)
.fontColor('#333333')
.margin({ top: 10 })
}.width('100%')
if (item.isRed) {
Text().backgroundColor(Color.Red).width(10).height(10).borderRadius(5)
}
}.width('25%').alignContent(Alignment.TopEnd)
}.margin({top:20,bottom:20})
.onClick(async ()=>{
const patients = await patientDbManager.getAllPatients();
console.info(`添加了 ${patients.length} 个患者`);
promptAction.showToast({message:`添加了 ${patients.length} 个患者`})
})
})
}.width('100%').backgroundColor(Color.White)
}
}
}
@@ -0,0 +1,56 @@
import { videoModel } from '../model/HomeModel'
import { router } from '@kit.ArkUI';
import { BasicConstant } from '@itcast/basic'
import { videoTools } from '../polyv/VideoUtil'
import { getDisplayWindowWidth } from 'media-player-common'
@Component
export struct HomeReplayVideoComp {
@Prop videoList: videoModel[];
@State newVideosList: videoModel[] = this.videoList.slice(0, 4);
build() {
Column() {
Row(){
Text('精彩回放')
.fontSize(17)
.fontWeight(FontWeight.Bold)
.margin({left:15})
Blank()
.layoutWeight(1)
Row(){
Text('更多 ')
.fontSize(15)
.fontColor('#999999')
Image($r('app.media.course_invoice_to_details'))
.width(15).height(15)
}.margin({right:15})
.onClick(()=>{
router.pushUrl({
url:'pages/VideoPage/VideoGandanPage',
})
})
}.height(50)
Grid(){
ForEach(this.newVideosList,(item:videoModel,index:number)=>{
GridItem(){
Column() {
Image(item.imgpath).alt($r('app.media.default_video')).width('100%').height(102)
.objectFit(ImageFit.Fill)
Text(item.name).maxLines(2).fontSize(15).fontColor('app.color.666666').textAlign(TextAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis }).width('100%').height(56).padding({left:10,top:10,right:10,bottom:10})
}.backgroundColor(Color.White)
.borderRadius(5)
.height('auto')
.clip(true)
.width('calc((100% - 45vp)/2)')
.margin({left:15,bottom:15})
.onClick(()=>{
videoTools.getVideoDetail(item.uuid)
})
}
})
}.width('100%')
}.width('100%')
}
}
@@ -0,0 +1,57 @@
import { newsModel,expertDetailModel } from '../model/HomeModel'
import { router } from '@kit.ArkUI'
@Preview
@Component
export struct HomeSwiperComp {
@Prop newslist: newsModel[];
@Prop expertData:expertDetailModel;
build() {
Column() {
Swiper() {
ForEach(this.newslist, (item: newsModel,index:number) => {
Stack({alignContent:Alignment.Center}) {
Image(item.headImg)
.objectFit(ImageFit.Fill)// 图片填充模式
.width('100%').height('100%')
if (index == 0) {
Column({space:5}){
Text(this.expertData.realName+'专家工作室')
.fontSize(19)
.fontColor(Color.White)
.margin({left:20,top:60})
Text(this.expertData.hospitalName)
.fontSize(16)
.fontColor(Color.White)
.margin({left:20})
}.width('100%').alignItems(HorizontalAlign.Start)
}
}.onClick(()=>{
if (index == 0) {
router.pushUrl({url:'pages/MinePage/EditUserDataPage'})
} else {
router.pushUrl({
url: 'pages/WebView/WebPage', // 目标url
params: {url:item.path,title:item.title}
})
}
})
}, (item: newsModel) => JSON.stringify(item))
}
.indicator(
Indicator.dot()
.itemWidth(8)
.itemHeight(8)
.selectedItemWidth(8)
.selectedItemHeight(8)
.color(Color.Gray)
.selectedColor($r('app.color.main_color'))
)
.loop(true)
.autoPlay(true)
.interval(5000)
}
.width('100%')
}
}
@@ -0,0 +1,92 @@
import { esiteModel } from '../model/HomeModel'
import { router } from '@kit.ArkUI'
@Component
export struct SpeciallyEStandingComp {
@Prop esiteArray: esiteModel[];
@State newEsiteArr: esiteModel[][] = [];
@State selectedIndex:number = 0;
aboutToAppear(): void {
this.newEsiteArr = convertTo2DArray(this.esiteArray)
}
changeGroup() {
animateTo({
duration: 500,
curve: Curve.EaseIn,
}, () => {
if (this.selectedIndex === this.newEsiteArr.length - 1) {
this.selectedIndex = 0;
} else {
this.selectedIndex++;
}
})
}
build() {
Column() {
Row(){
Text('专题E站')
.fontSize(17)
.fontWeight(FontWeight.Bold)
.margin({left:15})
Blank()
.layoutWeight(1)
if (this.newEsiteArr.length>=2) {
Row(){
Image($r('app.media.new_home_choose_icon'))
.width(15).height(15)
Text(' 换一换')
.fontSize(15)
.fontColor('#999999')
}.margin({right:15})
.onClick(()=>{
this.changeGroup();
})
}
}.height(50)
Column(){
ForEach(getSubArray(this.newEsiteArr,this.selectedIndex),(item:esiteModel,index:number)=>{
Image(item.img_path)
.objectFit(ImageFit.Cover)
.margin({left:10,top:10,right:10})
.height(45).width('95%')
.onClick(()=>{
router.pushUrl({
url: 'pages/WebView/WebPage', // 目标url
params: {url:item.url,title:item.name}
})
})
})
}.backgroundColor(Color.White).borderRadius(4).height(175).width('93%')
.margin({left:15,right:15})
}.width('100%').alignItems(HorizontalAlign.Start)
}
}
function convertTo2DArray<T extends esiteModel>(sourceArray: T[], groupSize: number = 3): T[][] {
const resultArray: T[][] = [];
for (let i = 0; i < sourceArray.length; i += groupSize) {
const group = sourceArray.slice(i, i + groupSize);
if (group.length < groupSize) {
const emptyObj: esiteModel = {} as esiteModel;
const emptyItems = Array(groupSize - group.length).fill(emptyObj) as T[];
resultArray.push([...group, ...emptyItems]);
} else {
resultArray.push(group);
}
}
return resultArray;
}
// 获取指定下标的子数组(带边界检查)
function getSubArray<T>(data: T[][], index: number): T[] {
if (index < 0 || index >= data.length) {
// 越界返回空数组(或抛异常)
return [];
}
return data[index];
}
@@ -0,0 +1,126 @@
export interface HomeModel {
code:string;
data:dataModel;
message:string;
}
export interface dataModel{
consult_list?:consultModel;
news_list?:newsModel[];
gandanfile_list?:gandanfileModel[];
isOnlineToday?:string;
has_unread?:string;
guide_ist?:guideModel[];
expertDetail?:expertDetailModel;
excellencourse_list?:excellencourseModel[];
video_list?:videoModel[];
meeting_list?:meetingModel[];
icons_list?:iconsModel[];
welfare_notice?:welfareModel;
esite_list?:esiteModel[];
sign_in?:string
}
export interface consultModel {
yetDayTotalNum:string;
count:string;
list:[];
yetDayTotalnumEPNum:string
}
export interface newsModel {
uuid:string;
title:string;
headImg:string;
color:string;
type:string;
path:string;
}
export interface gandanfileModel {
type:string;
article_uuid:string;
title:string;
tags:string;
path:string
}
export interface guideModel {
create_date:string;
guide_type_uuid:string;
guide_type:string;
guide_uuid:string;
article_uuid:string;
title:string;
tags:string;
path:string
}
export interface expertDetailModel {
photo:string;
officeName:string;
positionName:string;
hospitalName:string;
qrcode:string;
realName:string;
}
export interface excellencourseModel {
video_num:string;
discount_type:string;
account:string;
discount_price:string;
title:string;
search_second_list:string;
study_num:string;
sroll_img:string;
index_img:string;
upload_num:string;
back_bon:string;
fuli_bon:string;
special_type_name:string;
tags:string;
id:string;
}
export interface videoModel {
readnum:string;
uuid:string;
imgpath:string;
polyv_uuid:string;
public_name:string;
imgUrl:string;
note:string;
name:string;
path:string;
content:string;
}
export interface meetingModel {
title:string;
begin_date_timestamp:string;
end_date_timestamp:string;
liveurl:string;
begin_date:string;
end_date:string;
state:string;
path:string;
}
export interface iconsModel {
fixed:string;
img:string;
name:string;
isRed:boolean;
}
export interface welfareModel {
one_last_notice:boolean;
receive_notice:boolean;
}
export interface esiteModel {
url:string;
img_path:string;
name:string;
}
+176 -10
View File
@@ -1,19 +1,185 @@
import { FlipperComp } from '../components/FlipperComp'
import { HomeIconComp } from '../components/HomeIconComp'
import { HomeSwiperComp } from '../components/HomeSwiperComp'
import { SpeciallyEStandingComp } from '../components/SpeciallyEStandingComp'
import { HomeReplayVideoComp } from '../components/HomeReplayVideoComp'
import { getDisplayWindowWidth } from 'media-player-common'
import { BusinessError } from '@kit.BasicServicesKit';
import HashMap from '@ohos.util.HashMap';
import { BasicConstant,hdHttp, HdResponse ,logger,HdHomeNav} from '@itcast/basic/Index'
import { HomeModel,dataModel, newsModel,iconsModel } from '../model/HomeModel';
import { DefaultHintProWindows,SignPopWindow,HdLoadingDialog } from '@itcast/basic'
import { promptAction, router } from '@kit.ArkUI';
@Entry
@Component
export struct HomePage {
@State message: string = 'Hello World';
@State homeData:dataModel = {} as dataModel;
@State navAlpha: number = 0;
@State navBackColor: string = 'FFFFFF'
@Consume@Watch('gotoTop')
toTop:boolean;
@State hintMessage:string = '';
@State signData:Record<string,string> = {};
scroller:Scroller = new Scroller()
private hintWindowDialog!: CustomDialogController;
private signWindowDialog!:CustomDialogController;
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
private hintPopWindowDialog() {
this.hintWindowDialog = new CustomDialogController({
builder:DefaultHintProWindows({
controller:this.hintWindowDialog,
message:this.hintMessage,
cancleTitle:'',
confirmTitle:'关闭',
confirmTitleColor: '#000000',
selectedButton: (index:number)=>{
this.hintWindowDialog.close();
}
}),
alignment: DialogAlignment.Center,
cornerRadius:24,
autoCancel:false,
backgroundColor: ('rgba(0,0,0,0.5)'),
})
}
private signPopWindowDialog(){
this.signWindowDialog = new CustomDialogController({
builder:SignPopWindow({
controller:this.signWindowDialog,
signDay:'今天是我们相识的第'+this.signData.gdxzday+'天',
signWeek:this.signData.totalDay,
signMouth:this.signData.continuous_day,
signNews:this.signData.news['title'],
signHtml:this.signData.news['path'],
}),
alignment: DialogAlignment.Center,
cornerRadius:8,
autoCancel:false,
backgroundColor: Color.Transparent,
backgroundBlurStyle: BlurStyle.NONE,
})
}
gotoTop() {
this.scroller.scrollToIndex(0);
this.initData()
}
aboutToAppear(): void {
this.initData()
this.hintPopWindowDialog();
this.signPopWindowDialog();
}
initData() {
const hashMap: HashMap<string, string> = new HashMap();
this.dialog.open()
hashMap.clear();
hdHttp.httpReq<string>(BasicConstant.indexV2,hashMap).then(async (res: HdResponse<string>) => {
logger.info('Response indexV2'+res);
let json:HomeModel = JSON.parse(res+'') as HomeModel;
this.dialog.close();
this.homeData = json.data;
for (const item of this.homeData.news_list as newsModel[]) {
if (item.type == '1') {
this.navBackColor = item.color;
}
}
}).catch((err: BusinessError) => {
this.dialog.close();
})
}
getSignData() {
const hashMap: HashMap<string, string> = new HashMap();
this.dialog.open()
hashMap.clear();
hashMap.set('score_type','1');
hdHttp.httpReq<string>(BasicConstant.addBonusPoints,hashMap).then(async (res: HdResponse<string>) => {
logger.info('Response addBonusPoints'+res);
this.dialog.close();
let json:Record<string,string> = JSON.parse(res+'') as Record<string,string>;
if (json.code == '1') {
this.homeData.sign_in = '1';
this.signData = json;
this.signWindowDialog.open();
} else if (json.code == '201') {
this.homeData.sign_in = '1';
this.hintMessage = '今日已签到,每日只能签到一次。\n请明日继续哦~';
this.hintWindowDialog.open();
}
}).catch((err: BusinessError) => {
this.dialog.close();
})
}
build() {
Row() {
Column() {
Text(this.message)
.fontSize($r('app.float.page_text_font_size'))
.fontWeight(FontWeight.Bold)
.onClick(() => {
this.message = 'Welcome';
})
Stack(){
Scroll(this.scroller) {
Column() {
if (this.homeData.news_list && this.homeData.news_list.length > 0) {
HomeSwiperComp({ newslist: this.homeData.news_list, expertData: this.homeData.expertDetail })
.height(getDisplayWindowWidth().vp / 16 * 9)
}
if (this.homeData.icons_list && this.homeData.icons_list.length > 0) {
HomeIconComp({iconList:this.homeData.icons_list})
}
if (this.homeData.meeting_list && this.homeData.meeting_list.length > 0) {
FlipperComp({ bankAdBeans: this.homeData.meeting_list })
.height(56)
.backgroundColor(Color.Yellow)
}
if (this.homeData.esite_list && this.homeData.esite_list.length > 0) {
SpeciallyEStandingComp({ esiteArray: this.homeData.esite_list })
}
if (this.homeData.video_list && this.homeData.video_list.length > 0) {
HomeReplayVideoComp({ videoList: this.homeData.video_list })
}
}
}
.width('100%')
.edgeEffect(EdgeEffect.Spring)
.scrollBar(BarState.Off)
.onWillScroll(() => {
const yOffset = this.scroller.currentOffset().yOffset;
const threshold = 56;
if (yOffset <= 0) {
this.navAlpha = 0;
} else if (yOffset >= threshold) {
this.navAlpha = 1;
} else {
this.navAlpha = yOffset / threshold;
}
})
HdHomeNav({
leftIcon:this.homeData.sign_in == '0'?$r('app.media.home_no_qiandao_icon'):$r('app.media.home_qiandao_icon'),
placeholder:'搜索视频、会议',
alpha:this.navAlpha,
backColor:this.navBackColor,
leftItemAction:()=>{
this.getSignData();
},
searchItemAction:()=>{
router.pushUrl({
url:'pages/SearchPage/VideoSearchPage',
params: {
params:{'pageName':'视频'}
}
})
}
})
}
.alignContent(Alignment.Top)
.backgroundColor('#f4f4f4')
.width('100%')
.height('100%')
}
}
@@ -5,4 +5,4 @@
"value": "50fp"
}
]
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB