选择医院

This commit is contained in:
XiuYun CHEN 2025-05-21 16:57:48 +08:00
parent 5aa6de62c7
commit 12bd6efea9
7 changed files with 154 additions and 63 deletions

View File

@ -46,19 +46,23 @@ export struct HdNav {
build() { build() {
Row() { Row() {
if (this.showLeftIcon) { if (this.showLeftIcon) {
Image(this.leftIcon) Row()
.size({ width: 24, height: 24 }) {
.margin({left:-5}) Image(this.leftIcon)
.onClick(() => router.back()) .size({ width: 24, height: 24 })
.fillColor($r('app.color.black')) .onClick(() => router.back())
.fillColor($r('app.color.black'))
}
.size({ width: 50, height: 50 })
} else { } else {
Blank() Blank()
.width(24) .width(50)
} }
Row() { Row() {
if (this.title) { if (this.title) {
Text(this.title) Text(this.title)
// .fontWeight(600)
.layoutWeight(1) .layoutWeight(1)
.textAlign(TextAlign.Center) .textAlign(TextAlign.Center)
.fontSize(20) .fontSize(20)
@ -74,20 +78,27 @@ export struct HdNav {
.layoutWeight(1) .layoutWeight(1)
if (this.showRightIcon) { if (this.showRightIcon) {
Image(this.rightIcon) Row()
.size({ width: 24, height: 24 }) {
.objectFit(ImageFit.Contain) Image(this.rightIcon)
.bindMenu(this.menuBuilder) .size({ width: 24, height: 24 })
.onClick(()=>this.onRightItemClick()) .objectFit(ImageFit.Contain)
.bindMenu(this.menuBuilder)
.onClick(()=>this.onRightItemClick())
}
.size({ width: 50, height: 50 })
} else if (this.showRightText) { } else if (this.showRightText) {
Text(this.rightText) Text(this.rightText)
.fontSize(16) .fontSize(16)
.fontColor(this.textColor) .fontColor(this.textColor)
.onClick(()=>this.onRightItemClick()) .onClick(()=>this.onRightItemClick())
.width(50)
.textAlign(TextAlign.Center)
// .margin({right:10}) // .margin({right:10})
} else { } else {
Blank() Blank()
.width(24) .width(50)
} }
} }
.padding({ left: 16, right: 16, top: this.topHeight }) .padding({ left: 16, right: 16, top: this.topHeight })

View File

@ -31,7 +31,7 @@ class PerfactAuth {
await this.getStore().flush() await this.getStore().flush()
} }
initUser() { initUser(phone:string) {
const json = this.getStore().getSync(AUTH_STORE_KEY, '{}') as string const json = this.getStore().getSync(AUTH_STORE_KEY, '{}') as string
AppStorage.setOrCreate(AUTH_STORE_KEY, JSON.parse(json)) AppStorage.setOrCreate(AUTH_STORE_KEY, JSON.parse(json))
} }

View File

@ -3,6 +3,7 @@ import { promptAction, router } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit'; import { BusinessError } from '@kit.BasicServicesKit';
import HashMap from '@ohos.util.HashMap'; import HashMap from '@ohos.util.HashMap';
import { DataWebModel,preferenceStore } from '@itcast/basic' import { DataWebModel,preferenceStore } from '@itcast/basic'
import {perfactAuth } from '@itcast/basic'
@Preview @Preview
@Component @Component
export struct LoginComp { export struct LoginComp {
@ -33,6 +34,8 @@ export struct LoginComp {
hashMap: HashMap<string, string> = new HashMap(); hashMap: HashMap<string, string> = new HashMap();
login() { login() {
if (this.loading) return; if (this.loading) return;
if (!this.mobile) { if (!this.mobile) {
@ -87,6 +90,7 @@ export struct LoginComp {
getSaveUserInfor(type:number,objs:LoginInfo) { getSaveUserInfor(type:number,objs:LoginInfo) {
let state:number=objs.data.state let state:number=objs.data.state
if(state!=6) { if(state!=6) {
perfactAuth.initUser(this.mobile)
router.pushUrl({ router.pushUrl({
url: 'pages/LoginPage/LoginSetInfoPage', // 目标url url: 'pages/LoginPage/LoginSetInfoPage', // 目标url
params: { params: {

View File

@ -1,5 +1,5 @@
import { BasicConstant,ExpertData, authStore,perfactAuth } from '@itcast/basic' import { BasicConstant,ExpertData, authStore,perfactAuth } from '@itcast/basic'
import { promptAction, router } from '@kit.ArkUI' import { LengthMetrics, promptAction, router } from '@kit.ArkUI'
import { EditUserDataItem } from '@itcast/basic/src/main/ets/Views/EditUserDataItem' import { EditUserDataItem } from '@itcast/basic/src/main/ets/Views/EditUserDataItem'
import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet' import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet'
import { PhotoActionSheet } from '@itcast/basic/src/main/ets/Views/PhotoActionSheet' import { PhotoActionSheet } from '@itcast/basic/src/main/ets/Views/PhotoActionSheet'
@ -39,13 +39,13 @@ interface callBackData {
export struct PerfectUserDataComp { export struct PerfectUserDataComp {
scroller: Scroller = new Scroller(); scroller: Scroller = new Scroller();
@Prop loginPhone:string = '13419527489'; @Prop loginPhone:string = '';
@State photoPath:string = BasicConstant.urlImage+authStore.getUser().photo; @State photoPath:string = BasicConstant.urlImage+authStore.getUser().photo;
@State name:string = perfactAuth.getUser('13419527489').realName?perfactAuth.getUser('13419527489').realName:'请输入姓名'; @State name:string = perfactAuth.getUser(this.loginPhone).realName?perfactAuth.getUser('13419527489').realName:'请输入姓名';
@State sex:string = perfactAuth.getUser('13419527489').sex?perfactAuth.getUser('13419527489').sex == 0 ? '男' : '女':'请选择性别'; @State sex:string = perfactAuth.getUser('13419527489').sex?perfactAuth.getUser('13419527489').sex == 0 ? '男' : '女':'请选择性别';
@State sexnum:number = perfactAuth.getUser('13419527489').sex; @State sexnum:number = perfactAuth.getUser('13419527489').sex;
@State hospatilName:string = perfactAuth.getUser('13419527489').hospitalName?'':'请选择所在医院'; @State hospatilName:string = perfactAuth.getUser(this.loginPhone).hospitalName
@State officeName:string = perfactAuth.getUser('13419527489').officeName?perfactAuth.getUser('13419527489').officeName.length>0?perfactAuth.getUser('13419527489').officeName:'请选择科室':'请选择科室'; @State officeName:string = perfactAuth.getUser('13419527489').officeName?perfactAuth.getUser('13419527489').officeName.length>0?perfactAuth.getUser('13419527489').officeName:'请选择科室':'请选择科室';
@State officeUuid:string = perfactAuth.getUser('13419527489').officeUuid; @State officeUuid:string = perfactAuth.getUser('13419527489').officeUuid;
@State officePhone:string = authStore.getUser().officePhone?perfactAuth.getUser('13419527489').officePhone.length?perfactAuth.getUser('13419527489').officePhone:'请输入所在科室的电话':'请输入所在科室的电话'; @State officePhone:string = authStore.getUser().officePhone?perfactAuth.getUser('13419527489').officePhone.length?perfactAuth.getUser('13419527489').officePhone:'请输入所在科室的电话':'请输入所在科室的电话';
@ -78,24 +78,36 @@ export struct PerfectUserDataComp {
this.initCerficatePhotoDialog(); this.initCerficatePhotoDialog();
this.initDiseaseSheetDIalog(); this.initDiseaseSheetDIalog();
authStore.initUser() this.hospatilName =JSON.stringify(perfactAuth.getUser(this.loginPhone))
console.info('个人资料=loginPhone',this.loginPhone+' 3rf '+this.hospatilName);
emitter.on({ eventId: 250516 }, () => { emitter.on({ eventId: 250516 }, () => {
this.handleSave() this.handleSave()
}) })
// 收到eventId为1的事件后执行回调函数
emitter.on({ eventId: 250517 }, (eventData: emitter.EventData) => {
console.info(`eventData: ${JSON.stringify(eventData)}`);
const params =eventData.data as Record<string, string>; // 获取传递过来的参数对象
this.hospatilName=params.name
});
} }
aboutToDisappear() { aboutToDisappear() {
emitter.off(250516) emitter.off(250516)
emitter.off(250517)
} }
private handleSave() { private handleSave() {
promptAction.showToast({ message: '您输入的个人资料已经保存,请完善所有信息后提交审核', duration: 1000 }) promptAction.showToast({ message: '您输入的个人资料已经保存,请完善所有信息后提交审核', duration: 1000 })
const userData:ExpertData = { const userData:ExpertData = {
positionName: this.positionName='请选择职称'?'':this.positionName, positionName: this.positionName=='请选择职称'?'':this.positionName,
userName: this.loginPhone, userName: this.loginPhone,
createDate: '', createDate: '',
password: '', password: '',
officeName: this.officeName='请选择科室'?'':this.officeName, officeName: this.officeName=='请选择科室'?'':this.officeName,
certificateImg: this.certificatePhoto, certificateImg: this.certificatePhoto,
birthDate: '', birthDate: '',
isStar: 0, isStar: 0,
@ -105,15 +117,15 @@ export struct PerfectUserDataComp {
photo: this.photoPath, photo: this.photoPath,
qrcode: '', qrcode: '',
mobile: this.loginPhone, mobile: this.loginPhone,
hospitalName: '', hospitalName: this.hospatilName,
officeUuid: this.officeUuid, officeUuid: this.officeUuid,
checkInfo: '', checkInfo: '',
hospitalUuid: '', hospitalUuid: '',
officePhone: this.officePhone='请输入所在科室的电话'?'':this.officePhone, officePhone: this.officePhone=='请输入所在科室的电话'?'':this.officePhone,
positionUuid: this.positionUuid, positionUuid: this.positionUuid,
sex: this.sexnum, sex: this.sexnum,
provId: 0, provId: 0,
certificate: this.certificate='请输入执业医师证号码'?'':this.certificate, certificate: this.certificate=='请输入执业医师证号码'?'':this.certificate,
realName: this.name, realName: this.name,
isEnable: 0, isEnable: 0,
isVisit: 0, isVisit: 0,
@ -128,7 +140,7 @@ export struct PerfectUserDataComp {
intro: '', intro: '',
state: 0, state: 0,
specialy: [], specialy: [],
diseaseName:this.diseaseName='请选择专长'?'':this.diseaseName, diseaseName:this.diseaseName=='请选择专长'?'':this.diseaseName,
diseaseUuid:this.diswaseUuid diseaseUuid:this.diswaseUuid
}; };
perfactAuth.setUser('13419527489',userData); perfactAuth.setUser('13419527489',userData);
@ -168,7 +180,7 @@ export struct PerfectUserDataComp {
} }
} }
}), }),
keyboardAvoidDistance: {value:-2000} as LengthMetrics, // 设置弹窗底部与键盘顶部间距单位vp keyboardAvoidDistance: LengthMetrics.vp(0), // 设置弹窗底部与键盘顶部间距单位vp
alignment: DialogAlignment.Bottom, alignment: DialogAlignment.Bottom,
customStyle: true, customStyle: true,
autoCancel: false, autoCancel: false,
@ -261,6 +273,8 @@ export struct PerfectUserDataComp {
}) })
} }
build() { build() {
Scroll(this.scroller) { Scroll(this.scroller) {
Column() { Column() {
@ -357,6 +371,6 @@ export struct PerfectUserDataComp {
} }
} }
function handleSave() { // function handleSave() {
//
} // }

View File

@ -2,8 +2,8 @@ import { hdHttp, HdResponse,BasicConstant } from '@itcast/basic'
import { promptAction, CommonModifier } from '@kit.ArkUI' import { promptAction, CommonModifier } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit'; import { BusinessError } from '@kit.BasicServicesKit';
import HashMap from '@ohos.util.HashMap'; import HashMap from '@ohos.util.HashMap';
import { it } from '@ohos/hypium'; import { router } from '@kit.ArkUI'
import { emitter } from '@kit.BasicServicesKit'
@Component @Component
export struct SelectedHospitalComp { export struct SelectedHospitalComp {
scrollerForList: Scroller = new Scroller(); scrollerForList: Scroller = new Scroller();
@ -31,11 +31,13 @@ export struct SelectedHospitalComp {
@State searchHospitals: Hospital[] = [] @State searchHospitals: Hospital[] = []
// 搜索关键词 // 搜索关键词
@Prop searchKey: string = '' @Prop searchKey: string = ''
private controller: TabsController = new TabsController();
aboutToAppear() { aboutToAppear() {
this.loadProvinces(0,0) this.loadProvinces(0,0)
// this.controller.setTabBarTranslate({ x: 20, y: 0 })
} }
// 加载省份数据 // 加载省份数据
private loadProvinces(type:number,provinceIdOrCity:number) { private loadProvinces(type:number,provinceIdOrCity:number) {
const areaListUrl:string = BasicConstant.urlExpertAPI+'areaList'; const areaListUrl:string = BasicConstant.urlExpertAPI+'areaList';
@ -98,6 +100,7 @@ export struct SelectedHospitalComp {
this.isHiddenSearchView = false; this.isHiddenSearchView = false;
this.hospitalSelectedName = '请选择'; this.hospitalSelectedName = '请选择';
this.hospitals = json.data; this.hospitals = json.data;
if (this.isHidenCity) { if (this.isHidenCity) {
this.onTabChange(2); this.onTabChange(2);
} else { } else {
@ -132,7 +135,31 @@ export struct SelectedHospitalComp {
} }
this.searchHospitalList(value,true); this.searchHospitalList(value,true);
} }
backtoEdit(item: Hospital)
{
let eventData: emitter.EventData = {
data: item
};
// 发送eventId为1的事件事件内容为eventData。
emitter.emit({ eventId: 250517 }, eventData);
router.back({ url: 'pages/LoginPage/LoginSetInfoPage'})
// router.back({ url: 'pages/LoginPage/LoginSetInfoPage',params: item})
}
otherHospitaltoBack()
{
let item={
city_name: this.districtsSelectedName,
county_id: this.cityId,
prov_id: this.provincerId,
prov_name: this.provincerSelectedName,
name:'其他医院',
county_name:this.districtsSelectedName,
uuid:'1',
city_id:this.cityId
} as Hospital
this.backtoEdit(item)
}
build() { build() {
Column() { Column() {
SearchInput((input:string)=>{ SearchInput((input:string)=>{
@ -140,17 +167,17 @@ export struct SelectedHospitalComp {
}) })
// 内容区域 // 内容区域
Tabs({ index: this.currentTabIndex,barModifier:this.tabBarModifier.align(Alignment.Start) }) { Tabs({ index:this.currentTabIndex, controller: this.controller,barModifier:this.tabBarModifier.align(Alignment.Start) }) {
// 省份列表 // 省份列表
TabContent() { TabContent() {
List() { List() {
ForEach(this.provinces, (item : ProvinceOrCiry) => { ForEach(this.provinces, (item: ProvinceOrCiry) => {
ListItem() { ListItem() {
Text(item.name) Text(item.name)
.fontColor(item.name == this.provincerSelectedName?$r('app.color.main_color'):'#666666') .fontColor(item.name == this.provincerSelectedName ? $r('app.color.main_color') : '#666666')
.fontSize(17) .fontSize(17)
.height(40) .height(40)
.margin({left:20}) .margin({ left: 20 })
.onClick(() => { .onClick(() => {
this.selections[0] = 1; this.selections[0] = 1;
this.provincerSelectedName = item.name; this.provincerSelectedName = item.name;
@ -158,14 +185,16 @@ export struct SelectedHospitalComp {
this.districtsSelectedName = ''; this.districtsSelectedName = '';
this.hospitalSelectedName = ''; this.hospitalSelectedName = '';
this.provincerId = item.id.toString(); this.provincerId = item.id.toString();
this.loadProvinces(1,item.id); this.loadProvinces(1, item.id);
}) })
} }
}) })
} }
.width('100%') .width('100%')
.height('100%') .height('100%')
}.tabBar(this.provincerSelectedName) }
.customTabbar(this.provincerSelectedName)
// 城市列表 // 城市列表
TabContent() { TabContent() {
@ -190,8 +219,8 @@ export struct SelectedHospitalComp {
} }
.width('100%') .width('100%')
.height('100%') .height('100%')
}.tabBar(this.citySelectedName) }
.customTabbar(this.citySelectedName)
// 区县列表 // 区县列表
TabContent() { TabContent() {
List() { List() {
@ -207,9 +236,20 @@ export struct SelectedHospitalComp {
// this.districtsSelectedName = item.name; // this.districtsSelectedName = item.name;
this.selections[2] = 3; this.selections[2] = 3;
//医院点击 //医院点击
this.backtoEdit(item)
}) })
} }
}) })
ListItem() {
Text('其他医院')
.fontSize(17)
.height(40)
.margin({left:20})
.onClick(()=>{
//医院点击
this.otherHospitaltoBack()
})
}
} else { } else {
ForEach(this.districts, (item: ProvinceOrCiry) => { ForEach(this.districts, (item: ProvinceOrCiry) => {
ListItem() { ListItem() {
@ -230,8 +270,8 @@ export struct SelectedHospitalComp {
} }
.width('100%') .width('100%')
.height('100%') .height('100%')
}.tabBar(this.districtsSelectedName) }
.customTabbar(this.districtsSelectedName)
if (!this.isHidenCity) { if (!this.isHidenCity) {
// 医院列表 // 医院列表
TabContent() { TabContent() {
@ -244,19 +284,39 @@ export struct SelectedHospitalComp {
.margin({left:20}) .margin({left:20})
.onClick(()=>{ .onClick(()=>{
//医院点击 //医院点击
this.backtoEdit(item)
}) })
} }
}) })
ListItem() {
Text('其他医院')
.fontSize(17)
.height(40)
.margin({left:20})
.onClick(()=>{
//医院点击
this.otherHospitaltoBack()
})
}
} }
.width('100%') .width('100%')
.height('100%') .height('100%')
}.tabBar(this.hospitalSelectedName) }
.customTabbar(this.hospitalSelectedName)
} }
} }
.onChange(index => this.onTabChange(index)) .onChange(index => {
.barWidth('100%') this.onTabChange(index)
})
.barMode(BarMode.Scrollable) .barMode(BarMode.Scrollable)
.height('100%') .height('100%')
.divider( {
strokeWidth: 1,
color: $r('app.color.common_gray_border'),
})
.layoutWeight(1)
.padding({ bottom:100 })
if (this.isHiddenSearchView) { if (this.isHiddenSearchView) {
Column() { Column() {
@ -285,22 +345,7 @@ export struct SelectedHospitalComp {
.height('100%') .height('100%')
} }
@Builder
CustomTabBuilder(title: string, index: number) {
Column() {
Text(title)
.fontSize(17)
.fontColor(this.currentTabIndex === index ? $r('app.color.main_color') : '#333333')
Divider()
.width('auto')
.height(3)
.color($r('app.color.main_color'))
.visibility(this.currentTabIndex === index ? Visibility.Visible : Visibility.Hidden)
}
.width('auto')
.width('auto')
.height(50)
}
} }
@Builder @Builder
@ -334,6 +379,20 @@ function SearchInput(onSearchInput:(input:string)=>void) {
.margin({top:10}) .margin({top:10})
.backgroundColor('#EEEEEE') .backgroundColor('#EEEEEE')
.justifyContent(FlexAlign.Start) .justifyContent(FlexAlign.Start)
}
@Extend(TabContent)
function customTabbar(name:string)
{
.tabBar(SubTabBarStyle.of(name)
.labelStyle({ unselectedColor: '#848284', selectedColor:'#8D2316' , font: { size: 17 }})
.indicator({
color: '#8D2316', //下划线颜色
height: 1, //下划线高度
marginTop:16 //下划线与文字间距
}))
.height('100%')
} }
interface RequestProvinceCallData { interface RequestProvinceCallData {

View File

@ -8,4 +8,6 @@ struct LoginPage {
LoginComp() LoginComp()
} }
} }
} }

View File

@ -1,16 +1,17 @@
import { LoginSetInfo,PerfectUserDataComp } from 'register' import { LoginSetInfo,PerfectUserDataComp } from 'register'
import { HdNav } from '@itcast/basic' import { HdNav } from '@itcast/basic'
import { router } from '@kit.ArkUI';
@Entry @Entry
@Component @Component
struct LoginSetInfoPage { struct LoginSetInfoPage {
@Prop loginInputPhone:string; @State loginInputPhone:Record<string, string> =router.getParams() as Record<string, string>;
build() { build() {
Column() { Column() {
// LoginSetInfo() // LoginSetInfo()
HdNav({ title: '完善个人资料', showRightIcon: false, showLeftIcon: true,showRightText:true,rightText:'保存' }) HdNav({ title: '完善个人资料', showRightIcon: false, showLeftIcon: true,showRightText:true,rightText:'保存' })
PerfectUserDataComp({loginPhone:this.loginInputPhone}); PerfectUserDataComp({loginPhone:this.loginInputPhone.loginInputPhone});
} }
} }
} }