tab切换刷新

This commit is contained in:
XiuYun CHEN 2025-07-31 11:58:34 +08:00
parent 7d5a604665
commit 7618c0337d
20 changed files with 232 additions and 122 deletions

View File

@ -116,6 +116,7 @@ export class BasicConstant {
static readonly hospitalList= BasicConstant.urlExpertApp+"hospitalList";//添加职业地点-医院列表 static readonly hospitalList= BasicConstant.urlExpertApp+"hospitalList";//添加职业地点-医院列表
static readonly addWorkPlace= BasicConstant.urlExpertApp+"addWorkPlace";//执业地点-增加 static readonly addWorkPlace= BasicConstant.urlExpertApp+"addWorkPlace";//执业地点-增加
static readonly editWorkPlace= BasicConstant.urlExpertApp+"editWorkPlace";//执业地点-修改 static readonly editWorkPlace= BasicConstant.urlExpertApp+"editWorkPlace";//执业地点-修改
static readonly addInterrogationAnswer= BasicConstant.urlExpertAPI+"addInterrogationAnswer";// 一问多答 回答
static readonly province=['全国','北京市','天津市','河北省','山西省' static readonly province=['全国','北京市','天津市','河北省','山西省'
,'内蒙古自治区','辽宁省','吉林省','黑龙江省','上海市','江苏省','浙江省' ,'内蒙古自治区','辽宁省','吉林省','黑龙江省','上海市','江苏省','浙江省'
,'安徽省','福建省','江西省','山东省','河南省','湖北省','湖南省','广东省', ,'安徽省','福建省','江西省','山东省','河南省','湖北省','湖南省','广东省',

View File

@ -14,8 +14,8 @@ export struct ListComp {
list: ItemModel[] = [] list: ItemModel[] = []
controller = new HdListController() controller = new HdListController()
scroller: Scroller = new Scroller() scroller: Scroller = new Scroller()
@Consume@Watch('gotoTop') // @Consume@Watch('gotoTop')
toTop:boolean; // toTop:boolean;
@State @State
page: number = 1 page: number = 1
@State @State

View File

@ -12,8 +12,8 @@ export struct ListCompGandan {
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量 @State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
@Prop@Watch('onUpdate') sort:string='2' @Prop@Watch('onUpdate') sort:string='2'
@Consume@Watch('gotoTop') // @Consume@Watch('gotoTop')
toTop:boolean; // toTop:boolean;
@Prop@Watch('onUpdate') @Prop@Watch('onUpdate')
type_uuid:string='' type_uuid:string=''
@Prop@Watch('onUpdate') keywords:string='' @Prop@Watch('onUpdate') keywords:string=''

View File

@ -17,8 +17,8 @@ export struct HomePage {
@State homeData:dataModel = {} as dataModel; @State homeData:dataModel = {} as dataModel;
@State navAlpha: number = 0; @State navAlpha: number = 0;
@State navBackColor: string = 'FFFFFF' @State navBackColor: string = 'FFFFFF'
@Consume@Watch('gotoTop') // @Consume@Watch('gotoTop')
toTop:boolean; // toTop:boolean;
@State hintMessage:string = ''; @State hintMessage:string = '';
@State signData:Record<string,string> = {}; @State signData:Record<string,string> = {};

View File

@ -36,8 +36,8 @@ export struct HeaderView {
@Prop heroArray:Array<object> = []; @Prop heroArray:Array<object> = [];
@Prop expertData:object | string= new Object; @Prop expertData:object | string= new Object;
@State clickHeroId:string = ''; @State clickHeroId:string = '';
@Consume@Watch('gotoTop') // @Consume@Watch('gotoTop')
toTop:boolean; // toTop:boolean;
private scrollerForList: Scroller = new Scroller() private scrollerForList: Scroller = new Scroller()
dialogController: CustomDialogController = new CustomDialogController({ dialogController: CustomDialogController = new CustomDialogController({

View File

@ -20,8 +20,8 @@ interface requestCallBack {
export struct OneSection { export struct OneSection {
@State sectionTitle: string = "随访服务"; @State sectionTitle: string = "随访服务";
@State currentIndex: number = 0; @State currentIndex: number = 0;
@Consume@Watch('gotoTop') // @Consume@Watch('gotoTop')
toTop:boolean; // toTop:boolean;
@State oneSectionList: Array<MyPageSectionClass> = [ @State oneSectionList: Array<MyPageSectionClass> = [
new MyPageSectionClass('oneItem', $r('app.media.my_page_patientAudit'), '患者审核', 'pages/PatientsPage/PatientPages',false), new MyPageSectionClass('oneItem', $r('app.media.my_page_patientAudit'), '患者审核', 'pages/PatientsPage/PatientPages',false),

View File

@ -5,6 +5,7 @@ import { promptAction, router } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit'; import { BusinessError } from '@kit.BasicServicesKit';
import { EmptyViewComp,HdLoadingDialog } from '@itcast/basic' import { EmptyViewComp,HdLoadingDialog } from '@itcast/basic'
import HashMap from '@ohos.util.HashMap'; import HashMap from '@ohos.util.HashMap';
import { HMLifecycleState, HMRouterMgr } from '@hadss/hmrouter';
@Component @Component
@ -32,6 +33,18 @@ export struct ListCompMany {
customStyle: true, customStyle: true,
alignment: DialogAlignment.Center alignment: DialogAlignment.Center
}) })
private lifecycleOwner = HMRouterMgr.getCurrentLifecycleOwner()
private handleCallback = () => {
this.initData(0)
}
aboutToAppear() {
this.lifecycleOwner?.addObserver(HMLifecycleState.onShown,this.handleCallback)
}
aboutToDisappear(): void {
this.lifecycleOwner?.removeObserver(HMLifecycleState.onShown,this.handleCallback)
}
onUpdate() { onUpdate() {
this.onRefresh() this.onRefresh()

View File

@ -1,6 +1,4 @@
import { hdHttp, HdResponse, BasicConstant, ExpertData, authStore, BaseBean, HdLoadingDialog, import { hdHttp, HdResponse, BasicConstant, BaseBean, HdLoadingDialog, } from '@itcast/basic'
TimestampUtil,
preferenceStore} from '@itcast/basic'
import { BusinessError } from '@kit.BasicServicesKit'; import { BusinessError } from '@kit.BasicServicesKit';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import { HdNav ,DatePickerDialog} from '@itcast/basic'; import { HdNav ,DatePickerDialog} from '@itcast/basic';
@ -8,9 +6,6 @@ import { LengthMetrics, router } from '@kit.ArkUI';
import { HMRouter, HMRouterMgr } from '@hadss/hmrouter'; import { HMRouter, HMRouterMgr } from '@hadss/hmrouter';
import { HashMap } from '@kit.ArkTS'; import { HashMap } from '@kit.ArkTS';
import { StringIsEmpty } from '@nimkit/common'; import { StringIsEmpty } from '@nimkit/common';
import { DateListBean } from '../model/StopOutPatientListModel';
import { data } from '@kit.TelephonyKit';
import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet';
import { ListOut, ListWorkPlaceBean } from '../model/ListOutPatientModel'; import { ListOut, ListWorkPlaceBean } from '../model/ListOutPatientModel';

View File

@ -1,7 +1,7 @@
import { import {
BaseBean, BaseBean,
BasicConstant, EmptyViewComp, hdHttp, HdLoadingDialog, HdNav, HdResponse, HdSearchNav } from '@itcast/basic' BasicConstant, EmptyViewComp, hdHttp, HdLoadingDialog, HdNav, HdResponse, HdSearchNav } from '@itcast/basic'
import { HMRouter, HMRouterMgr, HMRouterPathCallback, HMRouterPathInfo } from '@hadss/hmrouter' import { HMLifecycleState, HMRouter, HMRouterMgr, HMRouterPathCallback, HMRouterPathInfo } from '@hadss/hmrouter'
import { PullToRefreshLayout, RefreshController } from 'refreshlib' import { PullToRefreshLayout, RefreshController } from 'refreshlib'
import { HashMap } from '@kit.ArkTS'; import { HashMap } from '@kit.ArkTS';
import { BusinessError } from '@kit.BasicServicesKit'; import { BusinessError } from '@kit.BasicServicesKit';
@ -26,8 +26,16 @@ export struct ArrangementsComp {
@Watch('deleteOutPatient') @Watch('deleteOutPatient')
delete: boolean=false delete: boolean=false
@State deleteUuid:string='' @State deleteUuid:string=''
private lifecycleOwner = HMRouterMgr.getCurrentLifecycleOwner()
private handleCallback = () => {
this.getList();
}
aboutToAppear() { aboutToAppear() {
this.getList(); this.getList();
this.lifecycleOwner?.addObserver(HMLifecycleState.onShown,this.handleCallback)
}
aboutToDisappear(): void {
this.lifecycleOwner?.removeObserver(HMLifecycleState.onShown,this.handleCallback)
} }
getList() { getList() {
const hashMap: HashMap<string, string> = new HashMap(); const hashMap: HashMap<string, string> = new HashMap();

View File

@ -20,6 +20,7 @@ export struct InterrogationDetailComp {
@State createDate: string='' ; @State createDate: string='' ;
@State content: string='' ; @State content: string='' ;
@State diseaseName: string='' ; @State diseaseName: string='' ;
@State step1_uuid: string='' ;
@State imgListurl:string[]=[] @State imgListurl:string[]=[]
@State sex:number=0 @State sex:number=0
@State birthday: string='' ; @State birthday: string='' ;
@ -55,6 +56,7 @@ export struct InterrogationDetailComp {
this.createDate=json.data.create_date this.createDate=json.data.create_date
this.content=json.data.disease_describe this.content=json.data.disease_describe
this.diseaseName=json.data.disease_name this.diseaseName=json.data.disease_name
this.step1_uuid=json.data.step1_uuid
if(json.data.imgs!=null) if(json.data.imgs!=null)
{ {
this.imgListurl = [...json.data.imgs.split(",")] this.imgListurl = [...json.data.imgs.split(",")]
@ -267,7 +269,7 @@ export struct InterrogationDetailComp {
{ {
router.pushUrl({ router.pushUrl({
url: 'pages/Netease/MyOpinionPage', url: 'pages/Netease/MyOpinionPage',
params: { uuid:this.params.uuid,isHistory:this.params.isHistory} params: { uuid:this.params.uuid,isHistory:this.params.isHistory,step1_uuid:this.step1_uuid}
}); });
} }
else else

View File

@ -10,6 +10,7 @@ import { promptAction, router } from "@kit.ArkUI"
import { PerfactInputSheet } from "@itcast/basic/src/main/ets/Views/PerfactInputSheet" import { PerfactInputSheet } from "@itcast/basic/src/main/ets/Views/PerfactInputSheet"
import { BusinessError } from "@kit.BasicServicesKit" import { BusinessError } from "@kit.BasicServicesKit"
import { HashMap } from "@kit.ArkTS" import { HashMap } from "@kit.ArkTS"
import { StringIsEmpty } from "@nimkit/common"
@Component @Component
export struct MyOpinionComp { export struct MyOpinionComp {
@ -175,20 +176,20 @@ export struct MyOpinionComp {
.backgroundColor($r('app.color.patient_theme')) .backgroundColor($r('app.color.patient_theme'))
.fontColor(Color.White) .fontColor(Color.White)
.onClick(() => { .onClick(() => {
if(StringIsEmpty(this.text)||this.text.length<5)
{
promptAction.showToast({ message: '意见至少5个字' })
return
}
if(this.params.isHistory =='false') if(this.params.isHistory =='false')
{ {
// router.pushUrl({
// url: 'pages/Netease/MyOpinionPage', this.addInterrogationAnswer()
// params: { uuid:this.params.uuid,isHistory:this.params.isHistory}
// });
} }
else else
{ {
this.updateInterrogationAnswer() this.updateInterrogationAnswer()
// router.pushUrl({
// url: 'pages/Netease/MyOpinionPage',
// params: { uuid:this.params.uuid,isHistory:this.params.isHistory,myAnswer:this.getMyanswer(this.AnswerList)}
// });
} }
}) })
} }
@ -232,6 +233,25 @@ export struct MyOpinionComp {
// let req = new rcp.Request("http://example.com", "POST", headers, simpleForm, cookies, transferRange, configuration); // let req = new rcp.Request("http://example.com", "POST", headers, simpleForm, cookies, transferRange, configuration);
} }
async addInterrogationAnswer() {
this.dialog.open()
this.hashMap.clear();
this.hashMap.set("note",this.text);
this.hashMap.set('step1_uuid', this.params.step1_uuid)
this.hashMap.set('imgsBean',this.assembleBase64Images(this.base64Array))
hdHttp.httpReqObject<string>(BasicConstant.addInterrogationAnswer,this.hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close()
let json:Record<string,string> = JSON.parse(res+'') as Record<string,string>;
promptAction.showToast({ message: json.message })
if(json.code == '200') {
router.back()
}
}).catch((err: BusinessError) => {
this.dialog.close()
})
// let req = new rcp.Request("http://example.com", "POST", headers, simpleForm, cookies, transferRange, configuration);
}
changeToImg( imgListurl:string[]) { changeToImg( imgListurl:string[]) {
let imgListtmps:ViewImageInfo[]=[] let imgListtmps:ViewImageInfo[]=[]
imgListurl.forEach((url: string) => { imgListurl.forEach((url: string) => {
@ -282,6 +302,7 @@ interface param{
uuid:string, uuid:string,
isHistory:string, isHistory:string,
myAnswer:AnswerListBean myAnswer:AnswerListBean
step1_uuid:string
} }

View File

@ -19,8 +19,6 @@ export struct OutpatientComp {
TabBarOutComp({activeIndex:this.activeIndex}); TabBarOutComp({activeIndex:this.activeIndex});
}.width('100%') }.width('100%')
.height('100%') .height('100%')

View File

@ -241,7 +241,9 @@ export struct PatientListComp {
.width('100%') .width('100%')
.align(Alignment.Start) .align(Alignment.Start)
.onClick(() => { .onClick(() => {
router.pushUrl({
url:'pages/PatientsPage/PatientPages'
})
}) })
ListItem() { ListItem() {
Row() { Row() {
@ -289,7 +291,9 @@ export struct PatientListComp {
.width('100%') .width('100%')
.align(Alignment.Start) .align(Alignment.Start)
.onClick(() => { .onClick(() => {
router.pushUrl({
url:'pages/PatientsPage/PatientsGroupPage'
})
}) })
ForEach(this.regionDataGroupsList, (regionDataGroups: Groups, index) => { ForEach(this.regionDataGroupsList, (regionDataGroups: Groups, index) => {
@ -339,7 +343,9 @@ export struct PatientListComp {
.height(24) .height(24)
.margin({ left:10 }) .margin({ left:10 })
.alignSelf(ItemAlign.End) .alignSelf(ItemAlign.End)
.onClick(() => {
HMRouterMgr.push({pageUrl: 'PatientCommonSettingComp',param:{"title":"患者详情","patient_uuid":regionData.uuid}})
})
Text(regionData.join_date ?"随访于"+ regionData.join_date.split(" ")[0] :'') Text(regionData.join_date ?"随访于"+ regionData.join_date.split(" ")[0] :'')
.fontSize(12) .fontSize(12)
.fontColor($r('app.color.666666')) .fontColor($r('app.color.666666'))
@ -358,7 +364,7 @@ export struct PatientListComp {
.width('100%') .width('100%')
.align(Alignment.Start) .align(Alignment.Start)
.onClick(() => { .onClick(() => {
HMRouterMgr.push({pageUrl:'PatientDetailsComp',param:{"patient_uuid":regionData.uuid}})
}) })
.gesture( .gesture(
LongPressGesture({ LongPressGesture({

View File

@ -6,7 +6,7 @@ import { BusinessError } from '@kit.BasicServicesKit';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import { HdNav ,DatePickerDialog} from '@itcast/basic'; import { HdNav ,DatePickerDialog} from '@itcast/basic';
import { LengthMetrics, router } from '@kit.ArkUI'; import { LengthMetrics, router } from '@kit.ArkUI';
import { HMRouter, HMRouterMgr } from '@hadss/hmrouter'; import { HMLifecycleState, HMRouter, HMRouterMgr } from '@hadss/hmrouter';
import { HashMap } from '@kit.ArkTS'; import { HashMap } from '@kit.ArkTS';
import { StringIsEmpty } from '@nimkit/common'; import { StringIsEmpty } from '@nimkit/common';
import { DateListBean } from '../model/StopOutPatientListModel'; import { DateListBean } from '../model/StopOutPatientListModel';
@ -114,13 +114,20 @@ export struct Practicelocation {
height: '100%' height: '100%'
}) })
} }
aboutToAppear(): void { private lifecycleOwner = HMRouterMgr.getCurrentLifecycleOwner()
private handleCallback = () => {
this.getList() this.getList()
this.initDialog()
} }
aboutToAppear() {
this.getList()
this.initDialog()
this.lifecycleOwner?.addObserver(HMLifecycleState.onShown,this.handleCallback)
}
aboutToDisappear(): void {
this.lifecycleOwner?.removeObserver(HMLifecycleState.onShown,this.handleCallback)
}
build() { build() {
Column() { Column() {

View File

@ -1,7 +1,7 @@
import { import {
BaseBean, BaseBean,
BasicConstant, EmptyViewComp, hdHttp, HdLoadingDialog, HdNav, HdResponse, HdSearchNav } from '@itcast/basic' BasicConstant, EmptyViewComp, hdHttp, HdLoadingDialog, HdNav, HdResponse, HdSearchNav } from '@itcast/basic'
import { HMRouter, HMRouterMgr } from '@hadss/hmrouter' import { HMLifecycleState, HMRouter, HMRouterMgr } from '@hadss/hmrouter'
import { HashMap } from '@kit.ArkTS'; import { HashMap } from '@kit.ArkTS';
import { BusinessError } from '@kit.BasicServicesKit'; import { BusinessError } from '@kit.BasicServicesKit';
import { promptAction } from '@kit.ArkUI'; import { promptAction } from '@kit.ArkUI';
@ -21,12 +21,21 @@ export struct StopNoticeComp {
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量 @State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
@State empty:string='暂无数据' @State empty:string='暂无数据'
@State stopnum:number=0 @State stopnum:number=0
onEvent?: (data: number) => void; // 声明回调函数
private lifecycleOwner = HMRouterMgr.getCurrentLifecycleOwner()
private handleCallback = () => {
this.getList();
}
aboutToAppear() { aboutToAppear() {
this.getList();
this.getList(); this.lifecycleOwner?.addObserver(HMLifecycleState.onShown,this.handleCallback)
} }
aboutToDisappear(): void {
this.lifecycleOwner?.removeObserver(HMLifecycleState.onShown,this.handleCallback)
}
@State @State
@Watch('deleteStopOutPatient') @Watch('deleteStopOutPatient')
delete: boolean=false delete: boolean=false
@ -44,6 +53,7 @@ export struct StopNoticeComp {
{ {
this.data = json.data; this.data = json.data;
this.stopnum=json.data.length this.stopnum=json.data.length
this.onEvent?.(this.stopnum); // 触发回调并传参
} }
if (this.data.length > 0) { if (this.data.length > 0) {

View File

@ -9,7 +9,7 @@ export struct TabBarConsultationComp {
// pathStack: NavPathStack = new NavPathStack() // pathStack: NavPathStack = new NavPathStack()
@StorageProp('bottomHeight') @StorageProp('bottomHeight')
bottomHeight: number = 0 bottomHeight: number = 0
@Link activeIndex: number @State activeIndex: number=0
aboutToAppear() { aboutToAppear() {
@ -17,9 +17,9 @@ export struct TabBarConsultationComp {
@Builder @Builder
TabBarBuilder(item: TabBarCompModel, index: number) { TabBarBuilder(item: string, index: number) {
Column({ space: BasicConstant.SPACE_SM }) { Column({ space: BasicConstant.SPACE_SM }) {
Text(item.label) Text(item)
.fontSize(16) .fontSize(16)
.fontColor(this.activeIndex === index ? Color.White:$r('app.color.common_gray_03') ) .fontColor(this.activeIndex === index ? Color.White:$r('app.color.common_gray_03') )
.backgroundColor(this.activeIndex === index ? $r('app.color.top_title'):Color.White) .backgroundColor(this.activeIndex === index ? $r('app.color.top_title'):Color.White)
@ -38,21 +38,25 @@ export struct TabBarConsultationComp {
Tabs({ Tabs({
index: this.activeIndex index: this.activeIndex
}) { }) {
ForEach(TabBarItems, (item: TabBarCompModel, index: number) => {
TabContent() { TabContent() {
if (index === 0) if (this.activeIndex === 0)
{ {
QuictDoctorComp() QuictDoctorComp()
} }
else if(index === 1)
{
ManyForOneComp()
}
} }
.tabBar(this.TabBarBuilder(item, index)) .tabBar(this.TabBarBuilder('快速问医生', 0))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}) TabContent() {
if (this.activeIndex === 1)
{
ManyForOneComp()
}
}
.tabBar(this.TabBarBuilder('多对一解惑', 1))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
} }
.layoutWeight(1) .layoutWeight(1)
.divider({ strokeWidth: $r('app.float.common_border_width'), color: $r('app.color.common_gray_border') }) .divider({ strokeWidth: $r('app.float.common_border_width'), color: $r('app.color.common_gray_border') })
@ -63,6 +67,34 @@ export struct TabBarConsultationComp {
.onTabBarClick((index) => { .onTabBarClick((index) => {
this.activeIndex = index this.activeIndex = index
}) })
// Tabs({
// index: this.activeIndex
// }) {
// ForEach(TabBarItems, (item: TabBarCompModel, index: number) => {
// TabContent() {
// if (index === 0)
// {
// QuictDoctorComp()
// }
// else if(index === 1)
// {
// ManyForOneComp()
// }
//
// }
// .tabBar(this.TabBarBuilder(item, index))
// .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
// })
// }
// .layoutWeight(1)
// .divider({ strokeWidth: $r('app.float.common_border_width'), color: $r('app.color.common_gray_border') })
// .barPosition(BarPosition.End)
// .barHeight(50)
// .scrollable(false)
// .margin({ bottom: this.bottomHeight })
// .onTabBarClick((index) => {
// this.activeIndex = index
// })
} }
.width('100%') .width('100%')
.height('100%') .height('100%')

View File

@ -3,13 +3,12 @@ import { BasicConstant, hdHttp,HdNav, HdResponse } from '@itcast/basic'
import { ListCompPublic } from '../components/ListCompPublic' import { ListCompPublic } from '../components/ListCompPublic'
import { ListCompMany } from '../components/ListCompMany' import { ListCompMany } from '../components/ListCompMany'
import { StopNoticeComp } from './StopNoticeComp' import { StopNoticeComp } from './StopNoticeComp'
import { HMRouterMgr } from '@hadss/hmrouter' import { HMLifecycleState, HMRouterMgr } from '@hadss/hmrouter'
import { HashMap } from '@kit.ArkTS' import { HashMap } from '@kit.ArkTS'
import { BusinessError } from '@kit.BasicServicesKit' import { BusinessError } from '@kit.BasicServicesKit'
import { PatientNoticeModel } from '../model/PatientNoticeModel' import { PatientNoticeModel } from '../model/PatientNoticeModel'
import { promptAction } from '@kit.ArkUI' import { promptAction } from '@kit.ArkUI'
import { ArrangementsComp } from './ArrangementsComp' import { ArrangementsComp } from './ArrangementsComp'
import { StopOutPatientListModel } from '../model/StopOutPatientListModel'
import { ListWorkPlaceBean } from '../model/ListOutPatientModel' import { ListWorkPlaceBean } from '../model/ListOutPatientModel'
@Component @Component
@ -23,17 +22,28 @@ export struct TabBarOutComp {
@State textInfo:string='发布新的停诊' @State textInfo:string='发布新的停诊'
@State stopnum: number = 0 @State stopnum: number = 0
@State worknum: number = 0 @State worknum: number = 0
private lifecycleOwner = HMRouterMgr.getCurrentLifecycleOwner()
private handleCallback = () => {
this.mailanNoticeGet()
this.listWorkPlace()
}
aboutToAppear() { aboutToAppear() {
this.mailanNoticeGet() this.mailanNoticeGet()
this.stopOutPatientList()
this.listWorkPlace() this.listWorkPlace()
this.lifecycleOwner?.addObserver(HMLifecycleState.onShown,this.handleCallback)
}
aboutToDisappear(): void {
this.lifecycleOwner?.removeObserver(HMLifecycleState.onShown,this.handleCallback)
} }
@Builder @Builder
TabBarBuilder(item: TabBarCompModel, index: number) { TabBarBuilder(item: string, index: number) {
Row() { Row() {
Text(item.label) Text(item)
.fontSize(16) .fontSize(16)
.fontColor(this.activeIndex === index ? $r('app.color.top_title'):$r('app.color.common_gray_03') ) .fontColor(this.activeIndex === index ? $r('app.color.top_title'):$r('app.color.common_gray_03') )
.animation({ duration: 300 }) .animation({ duration: 300 })
@ -58,25 +68,23 @@ export struct TabBarOutComp {
Tabs({ Tabs({
index: this.activeIndex index: this.activeIndex
}) { }) {
ForEach(TabBarItems, (item: TabBarCompModel, index: number) => {
TabContent() { TabContent() {
if (index==0) if (this.activeIndex==0)
{ {
StopNoticeComp({ onEvent:(data:number)=> {
StopNoticeComp() this.stopnum = data; // 接收子组件数据
} })
} }
else if(index==1)
{
ArrangementsComp()
}
} }
.tabBar(this.TabBarBuilder(item, index)) .tabBar(this.TabBarBuilder('停诊公告', 0))
TabContent() {
if(this.activeIndex==1)
}) {
ArrangementsComp()
}
}
.tabBar(this.TabBarBuilder('门诊安排', 1))
} }
.layoutWeight(1) .layoutWeight(1)
.divider({ strokeWidth: $r('app.float.common_border_width'), color: $r('app.color.common_gray_border') }) .divider({ strokeWidth: $r('app.float.common_border_width'), color: $r('app.color.common_gray_border') })
@ -96,6 +104,7 @@ export struct TabBarOutComp {
}) })
Column() Column()
{ {
Text(this.textInfo).height(42).width(168).fontSize(17) Text(this.textInfo).height(42).width(168).fontSize(17)
@ -178,23 +187,7 @@ export struct TabBarOutComp {
} }
stopOutPatientList() {
const hashMap: HashMap<string, string> = new HashMap();
hdHttp.httpReq<string>(BasicConstant.stopOutPatientList,hashMap).then(async (res: HdResponse<string>) => {
let json:StopOutPatientListModel = JSON.parse(res+'') as StopOutPatientListModel;
if(json.code == '200') {
if(json.data!=null)
{
this.stopnum=json.data.length
}
}
}).catch((err: BusinessError) => {
console.info(`Response fails: ${err}`);
})
}
listWorkPlace() { listWorkPlace() {
const hashMap: HashMap<string, string> = new HashMap(); const hashMap: HashMap<string, string> = new HashMap();

View File

@ -18,9 +18,9 @@ export struct TabBarTopComp {
@Builder @Builder
TabBarBuilder(item: TabBarCompModel, index: number) { TabBarBuilder(item: string, index: number) {
Row() { Row() {
Text(item.label) Text(item)
.fontSize(16) .fontSize(16)
.fontColor(this.activeIndex === index ? $r('app.color.top_title'):$r('app.color.common_gray_03') ) .fontColor(this.activeIndex === index ? $r('app.color.top_title'):$r('app.color.common_gray_03') )
.animation({ duration: 300 }) .animation({ duration: 300 })
@ -38,15 +38,14 @@ export struct TabBarTopComp {
Column() Column()
{ {
Tabs({ Tabs({
index: this.activeIndex index: this.activeIndex
}) { }) {
ForEach(TabBarItems, (item: TabBarCompModel, index: number) => {
TabContent() { TabContent() {
if (this.type==0) if (this.type==0)
{ {
ListCompPublic({isHistory:this.isHistory}) ListCompPublic({isHistory:this.isHistory})
} }
else if(this.type==1) else if(this.type==1)
@ -56,10 +55,22 @@ export struct TabBarTopComp {
} }
} }
.tabBar(this.TabBarBuilder(item, index)) .tabBar(this.TabBarBuilder('新的咨询', 0))
TabContent() {
if (this.type==0)
{
ListCompPublic({isHistory:this.isHistory})
}
else if(this.type==1)
{
ListCompMany({isHistory:this.isHistory})
}
}
.tabBar(this.TabBarBuilder('我已回答', 1))
})
} }
.layoutWeight(1) .layoutWeight(1)
.divider({ strokeWidth: $r('app.float.common_border_width'), color: $r('app.color.common_gray_border') }) .divider({ strokeWidth: $r('app.float.common_border_width'), color: $r('app.color.common_gray_border') })
@ -78,6 +89,7 @@ export struct TabBarTopComp {
} }
}) })
} }

View File

@ -15,23 +15,7 @@ class NavModifier extends AttributeUpdater<NavigationAttribute> {
struct PublicConsultationPage { struct PublicConsultationPage {
// pathStack: NavPathStack = new NavPathStack() // pathStack: NavPathStack = new NavPathStack()
modifier: NavModifier = new NavModifier() modifier: NavModifier = new NavModifier()
@State
@Watch('onChangeIndex')
activeIndex: number = 0
aboutToAppear(): void {
}
onChangeIndex() {
}
onPageShow(): void {
this.onChangeIndex()
}
onPageHide(): void {
this.onChangeIndex()
}
build() { build() {
// Navigation(this.pathStack) { // Navigation(this.pathStack) {
Column() Column()
@ -46,7 +30,7 @@ struct PublicConsultationPage {
}) })
{ {
Flex() { Flex() {
TabBarConsultationComp({ activeIndex: this.activeIndex}) TabBarConsultationComp()
} }
.backgroundColor($r('app.color.white')) .backgroundColor($r('app.color.white'))
} }

View File

@ -4,7 +4,6 @@ import { TabBarCompModel } from '../../models/TabBarCompModel'
import { TabBarItems } from '../../contants/TabBarItems' import { TabBarItems } from '../../contants/TabBarItems'
import { BasicConstant,AESEncryptionDecryption,authStore,preferenceStore } from '@itcast/basic' import { BasicConstant,AESEncryptionDecryption,authStore,preferenceStore } from '@itcast/basic'
import mediaquery from '@ohos.mediaquery'; import mediaquery from '@ohos.mediaquery';
import { MessageComp } from 'netease'
@Component @Component
export struct TabBarComp { export struct TabBarComp {
@ -15,8 +14,8 @@ export struct TabBarComp {
@State @State
isLandscape: boolean = false isLandscape: boolean = false
listenerScreen = mediaquery.matchMediaSync('(orientation: landscape) and (device-type: tablet)') listenerScreen = mediaquery.matchMediaSync('(orientation: landscape) and (device-type: tablet)')
@Provide // @Provide
toTop:boolean=false; // toTop:boolean=false;
aboutToAppear() { aboutToAppear() {
this.getPolyid() this.getPolyid()
this.listenerScreen.on('change', (mediaQueryResult) => { this.listenerScreen.on('change', (mediaQueryResult) => {
@ -48,26 +47,55 @@ export struct TabBarComp {
Tabs({ Tabs({
index: this.activeIndex index: this.activeIndex
}) { }) {
ForEach(TabBarItems, (item: TabBarCompModel, index: number) => {
TabContent() { TabContent() {
if (index === 0) HomePage() if (this.activeIndex === 0) HomePage()
else if (index === 1) VideoPage()
else if (index === 2) VideoGandan()
else MyHomePage()
} }
.tabBar(this.TabBarBuilder(item, index)) .tabBar(this.TabBarBuilder( {
defaultIcon: $r('app.media.home_default_icon'),
activeIcon: $r('app.media.home_selected_icon'),
label: '首页'
}, 0))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
}) TabContent() {
if (this.activeIndex === 1) VideoPage()
}
.tabBar(this.TabBarBuilder({
defaultIcon: $r('app.media.home_my_meeting_nor'),
activeIcon: $r('app.media.home_my_meeting_sel'),
label: '会议·直播'
}, 1))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
TabContent() {
if (this.activeIndex === 2) VideoGandan()
}
.tabBar(this.TabBarBuilder({
defaultIcon: $r('app.media.video_tabbar_icon'),
activeIcon: $r('app.media.video_tabbar_selected_icon'),
label: '视频'
}, 2))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
TabContent() {
if (this.activeIndex === 3) MyHomePage()
}
.tabBar(this.TabBarBuilder({
defaultIcon: $r('app.media.my_tabbar_icon'),
activeIcon: $r('app.media.my_tabbar_selected_icon'),
label: '我的'
}, 3))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
} }
.divider({ strokeWidth: $r('app.float.common_border_width'), color: $r('app.color.common_gray_border') }) .divider({ strokeWidth: $r('app.float.common_border_width'), color: $r('app.color.common_gray_border') })
.vertical(this.isLandscape) .vertical(this.isLandscape)
.barPosition(this.isLandscape ? BarPosition.Start : BarPosition.End) .barPosition(this.isLandscape ? BarPosition.Start : BarPosition.End)
.onTabBarClick((index) => { .onTabBarClick((index) => {
this.activeIndex = index this.activeIndex = index
this.toTop=!this.toTop
}) })
.barHeight(this.isLandscape ? $r('app.float.tab_bar_item_height_lg') : $r('app.float.tab_bar_item_height_sm')) .barHeight(this.isLandscape ? $r('app.float.tab_bar_item_height_lg') : $r('app.float.tab_bar_item_height_sm'))
.scrollable(false) .scrollable(false)
.margin({ bottom: this.bottomHeight }) .margin({ bottom: this.bottomHeight })
} }
} }