注册资料

This commit is contained in:
xiaoxiao
2025-05-20 14:23:03 +08:00
parent f821535e18
commit 09a6f13e1d
80 changed files with 1102 additions and 1038 deletions
+2 -8
View File
@@ -1,15 +1,9 @@
export { MyHomePage } from './src/main/ets/pages/MyHomePage'
export { ChangePasswordComp } from './src/main/ets/view/ChangePasswordComp'
export { ForgetPasswordComp } from './src/main/ets/view/ForgetPasswordComp'
export { ChangePhoneComp } from './src/main/ets/view/ChangePhoneComp'
export { ChooseEmailComp } from './src/main/ets/view/ChooseEmailComp'
export { ChooseOfficePhoneComp } from './src/main/ets/view/ChooseOfficePhoneComp'
export { EditUserDataComp } from './src/main/ets/view/EditUserDataComp'
export { SpecialitySelectedSheet } from './src/main/ets/view/SpecialitySelectedSheet'
export { EditUserDataItem } from '@itcast/basic/src/main/ets/Views/EditUserDataItem'
export { SpecialitySelectedSheet } from '@itcast/basic/src/main/ets/Views/SpecialitySelectedSheet'
@@ -1,25 +0,0 @@
type DateFormat = 'YYYY-MM-DD' | 'MM/DD/YYYY' | 'DD-MMM-YYYY' | 'YYYY年MM月DD日' | 'YYYYMMDD';
export function formatDate(date: Date,pattern:DateFormat = 'YYYY-MM-DD'): string {
const padZero = (num: number): string => num.toString().padStart(2, '0');
const year = date.getFullYear();
const month = padZero(date.getMonth() + 1); // 月份修正[7,8](@ref)
const day = padZero(date.getDate());
// 模式映射逻辑(核心补全部分)
switch (pattern) {
case 'YYYY-MM-DD':
return `${year}-${month}-${day}`;
case 'MM/DD/YYYY':
return `${month}/${day}/${year}`;
case 'DD-MMM-YYYY':
const months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
return `${day}-${months[date.getMonth()]}-${year}`; // 月份缩写处理[4](@ref)
case 'YYYY年MM月DD日':
return `${year}年${month}月${day}日`; // 中文格式[5](@ref)
case 'YYYYMMDD':
return `${year}${month}${day}`; // 紧凑格式
default:
throw new Error(`Unsupported format pattern: ${pattern}`);
}
}
@@ -1,73 +0,0 @@
import { formatDate } from '../util/DateUtils'
import { authStore } from '@itcast/basic'
@CustomDialog
export struct DatePickerDialog {
@Prop selectedDateString:string = formatDate(new Date(),'YYYY-MM-DD');
controller: CustomDialogController;
// 添加回调函数属性
private dateSelected: (date: string) => void = () => {};
// 修改构造函数
constructor(controller: CustomDialogController, dateSelected: (date: string) => void) {
super();
this.controller = controller;
this.dateSelected = dateSelected;
}
// 初始化日期范围(示例为1930-至今)
private dateOptions: DatePickerOptions = {
start: new Date('1930-01-01'),
end: new Date(this.selectedDateString),
selected: new Date(authStore.getUser().birthDate?authStore.getUser().birthDate:'1930-01-01'),
}
build() {
Column() {
// 操作按钮区域
Row({space:70}) {
Button('取消')
.layoutWeight(1)
.backgroundColor(Color.Transparent)
.fontColor($r('app.color.main_color'))
.backgroundColor(Color.White)
.width(80)
.onClick(() => {
this.controller.close()
})
Text('请选择出生日期')
.fontSize(15)
.fontColor('#666666')
Button('确定')
.layoutWeight(1)
.backgroundColor(Color.Transparent)
.fontColor($r('app.color.main_color'))
.backgroundColor(Color.White)
.width(80)
.onClick(() => {
this.controller.close()
this.dateSelected(this.selectedDateString)
})
}
.height(40)
// 日期选择器主体
DatePicker(this.dateOptions)
.lunar(false) // 禁用农历显示[1](@ref)
.selectedTextStyle({
color: '#007AFF',
font: { size: 20, weight: FontWeight.Medium }
})
.onDateChange((selected:Date)=>{
this.selectedDateString = formatDate(selected,'YYYY-MM-DD');
console.info('select current date is: ' + formatDate(selected,'YYYY-MM-DD'));
})
}
.width('100%')
.height(240)
.backgroundColor(Color.White)
}
}
@@ -2,12 +2,12 @@ import { hdHttp, HdResponse,BasicConstant,ExpertData, authStore, ChangeUtil } f
import HashMap from '@ohos.util.HashMap'
import { BusinessError } from '@kit.BasicServicesKit';
import { promptAction, router } from '@kit.ArkUI'
import { EditUserDataItem } from './EditUserDataItem'
import { PhotoActionSheet } from './PhotoActionSheet'
import { DatePickerDialog } from './DatePickerDialog'
import { OfficeSelectedSheet } from './OfficeSelectedSheet'
import { PositionSelectedSheet } from './PositionSelectedSheet'
import { SpecialitySelectedSheet } from './SpecialitySelectedSheet'
import { EditUserDataItem } from '@itcast/basic/src/main/ets/Views/EditUserDataItem'
import { PhotoActionSheet } from '@itcast/basic/src/main/ets/Views/PhotoActionSheet'
import { DatePickerDialog } from '@itcast/basic/src/main/ets/Views//DatePickerDialog'
import { OfficeSelectedSheet } from '@itcast/basic/src/main/ets/Views//OfficeSelectedSheet'
import { PositionSelectedSheet } from '@itcast/basic/src/main/ets/Views//PositionSelectedSheet'
import { SpecialitySelectedSheet } from '@itcast/basic/src/main/ets/Views//SpecialitySelectedSheet'
import { http } from '@kit.NetworkKit';
import { rcp } from '@kit.RemoteCommunicationKit';
interface extraData {
@@ -1,72 +0,0 @@
@Component
export struct EditUserDataItem {
private label: string = ''
private required: boolean = false
@Prop content: string = ''
private hasArrow: boolean = false
build() {
Column() {
Row() {
Row() {
Text(this.label)
.fontSize(16)
.fontColor('#333333')
.margin({ left: 15 })
if (this.required) {
Text('*')
.margin({ left: 0 })
.fontSize(16)
.fontColor($r('app.color.main_color'))
}
}
.layoutWeight(1)//权重自定义
.justifyContent(FlexAlign.Start)
Row({space:5}) {
if (this.label == '头像') {
Image(this.content)
.alt($r('app.media.userPhoto_default'))
.onComplete(() => console.log('图片加载完成'))
.onError(() => console.error('图片加载失败'+this.content))
.width(40)
.height(40)
.margin({ right: this.hasArrow?0:10 })
.borderRadius(8)
} else if (this.label == '执业医师证图片或胸牌') {
Image(this.content)
.onComplete(() => console.log('图片加载完成'))
.onError(() => console.error('图片加载失败'+this.content))
.width(60)
.height(40)
.margin({ right: this.hasArrow?0:10 })
} else {
Text(this.content)
.fontSize(14)
.fontColor('#333333')
.width('60%')
.textOverflow({ overflow: TextOverflow.Ellipsis })
.maxLines(1)
.margin({right: this.hasArrow?0:10 })
.textAlign(TextAlign.End)
}
if (this.hasArrow) {
Image($r('sys.media.ohos_ic_public_arrow_right'))
.width(15)
.height(15)
.margin({ right: 10 })
}
}
.justifyContent(FlexAlign.End)
}
.height(50)
.alignItems(VerticalAlign.Center)
Divider()
.color('#F4F4F4')
.strokeWidth(1)
.height(1)
.margin({ left: 10, top: 0 })
}
}
}
@@ -1,6 +1,6 @@
import { hdHttp, HdResponse,BasicConstant,ExpertData, authStore,RequestDefaultModel } from '@itcast/basic'
import { BusinessError } from '@kit.BasicServicesKit';
import { HeroPopWindow } from '../view/HeroPopWindow'
import { HeroPopWindow } from '@itcast/basic/src/main/ets/Views/HeroPopWindow'
import HashMap from '@ohos.util.HashMap'
import { router } from '@kit.ArkUI'
@@ -1,112 +0,0 @@
import { hdHttp, HdResponse,BasicConstant, logger,RequestDefaultModel, Data } from '@itcast/basic'
import { promptAction } from '@kit.ArkUI'
import HashMap from '@ohos.util.HashMap';
import { BusinessError } from '@kit.BasicServicesKit';
import { authStore } from '@itcast/basic'
interface DefaultData {
}
@CustomDialog
export struct HeroPopWindow {
@Prop heroId:string = '';
@State detailsData:object = new Object;
private years: string[] = ['2019年英雄榜','2018年英雄榜','2017年英雄榜','2016年英雄榜','2015年英雄榜'];
controller: CustomDialogController;
heroDetailsRequestUrl:string = BasicConstant.urlExpertAPI+'gethonorDetail'
hashMap: HashMap<string, string> = new HashMap();
updateHeroDetailsAction(){
this.hashMap.set('id',this.heroId);
hdHttp.httpReq<string>(this.heroDetailsRequestUrl,this.hashMap).then(async (res: HdResponse<string>) => {
let json:RequestDefaultModel = JSON.parse(res+'') as RequestDefaultModel;
if(json.code=='1') {
this.detailsData = json.data;
} else {
console.error('英雄榜失败:'+json.message)
promptAction.showToast({ message: json.message, duration: 1000 })
}
}).catch((err: BusinessError) => {
console.info(`Response fail: ${err}`);
})
}
build() {
Stack() {
//半透明黑色背景
Column().width('100%').height('100%').backgroundColor('#50000000')
//弹窗主体
Column() {
//头部图标
Image($r('app.media.heroPop_headericon'))
.width(80)
.height(80)
.margin({top:-25})
.zIndex(2)
//标题和正文范围
Column() {
Text('肝胆英雄榜')
.fontSize(20)
.fontColor('#673986')
.margin({top:20})
Grid() {
ForEach(this.years,(item:string)=>{
GridItem({style:GridItemStyle.PLAIN}) {
Text(item)
.fontSize(10)
.fontColor(Color.Black)
.backgroundColor(Color.White) // 添加背景色确保可见
.textAlign(TextAlign.Center)
.width('100%') // 确保文本容器宽度
}
.height(20)
.width('48%')
.padding(5)
.borderRadius(10)
.borderWidth(1)
.borderColor(Color.Red)
})
}
.columnsGap(10)
.rowsGap(10)
.padding(10)
.width('100%')
.height('auto')
Text('感谢有您,一路相伴。"肝胆英雄榜"是由国内最具影响力的肝胆病互联网线上服务平台-\n' +
'肝胆相照依据肝胆病医生在各自领域年度所做工作,综合评选出来的最认可的"肝胆好医生",授予证书并赠送精美感恩好礼。\n' +
'目前"肝胆英雄榜"荣誉包括:"护肝大使"护肝新量""公益之星""科普达入"、"视频之星"、"人气科室"及"宣传之星"等。')
.fontSize(12)
.fontColor('#666666')
.textAlign(TextAlign.Start)
.lineHeight(20)
.width('90%')
.margin({bottom:10})
}
.zIndex(1)
.margin({top:-10,bottom:10})
.justifyContent(FlexAlign.Center)
.backgroundColor(Color.White)
.borderRadius(16)
.height('auto')
.width('90%')
//删除按钮
Button() {
Image($r('app.media.heropop_delete'))
.width(30)
.height(30)
}
.zIndex(3)
.position({ x: '88%', y: 10 })
.onClick(() => this.controller.close())
}
.width('90%')
.backgroundImage($r('app.media.heroPop_bg'))
.backgroundImageSize(ImageSize.Cover)
.borderRadius(16)
}
}
}
@@ -1,111 +0,0 @@
import { hdHttp, HdResponse,BasicConstant, logger,RequestDefaultModel, Data } from '@itcast/basic'
import { promptAction } from '@kit.ArkUI'
import HashMap from '@ohos.util.HashMap';
import { BusinessError } from '@kit.BasicServicesKit';
import { authStore } from '@itcast/basic'
interface DefaultData {
'officeName':string;
'officeUuid':string;
}
@CustomDialog
export struct OfficeSelectedSheet {
controller: CustomDialogController;
@State officeNameArr:Array<string> = [];
private officeArr:Array<DefaultData> = [];
@State selectedModel:DefaultData = { officeName: '', officeUuid: '' };
@State selectedIndex:number = 0;
// 添加回调函数属性
private officeSelected: (name:string , uuid:string) => void = () => {};
// 修改构造函数
constructor(controller: CustomDialogController, officeSelected: (name: string,uuid:string) => void) {
super();
this.controller = controller;
this.officeSelected = officeSelected;
}
officeRequestUrl:string = BasicConstant.urlExpert+'officeList'
hashMap: HashMap<string, string> = new HashMap();
aboutToAppear(): void {
this.uploadOffice();
}
uploadOffice() {
hdHttp.httpReq<string>(this.officeRequestUrl,this.hashMap).then(async (res: HdResponse<string>) => {
let json:RequestDefaultModel = JSON.parse(res+'') as RequestDefaultModel;
if(json.code=='1') {
this.officeArr = json.data as DefaultData[];
this.officeNameArr = json.data.map(item => item.officeName);
console.log('科室名称数组:', this.officeNameArr);
for (let index = 0; index < this.officeNameArr.length; index++) {
const officeObject = this.officeArr[index] as DefaultData;
const name = this.officeNameArr[index];
if (name == authStore.getUser().officeName) {
this.selectedIndex = index;
this.selectedModel = {officeName:name,officeUuid:officeObject.officeUuid}
}
}
} else {
console.error('科室数据失败:'+json.message)
promptAction.showToast({ message: json.message, duration: 1000 })
}
}).catch((err: BusinessError) => {
console.info(`Response fail: ${err}`);
})
}
build() {
Column() {
// 操作按钮区域
Row({space:70}) {
Button('取消')
.layoutWeight(1)
// .backgroundColor(Color.Transparent)
.fontColor($r('app.color.main_color'))
.backgroundColor(Color.White)
.width(80)
.onClick(() => {
this.controller.close()
})
Text('请选择科室')
.fontSize(15)
.fontColor('#666666')
Button('确定')
.layoutWeight(1)
.fontColor($r('app.color.main_color'))
.backgroundColor(Color.White)
.width(80)
.onClick(() => {
this.controller.close()
this.officeSelected(this.selectedModel.officeName, this.selectedModel.officeUuid);
})
}
.height(40)
TextPicker({
range:this.officeNameArr,
selected:this.selectedIndex
})
.selectedTextStyle({
color: '#007AFF',
font: { size: 20, weight: FontWeight.Medium }
})
.onChange((name: string | string[], index: number | number[]) => {
// 处理单列选择场景
if (typeof index === "number" && this.officeArr[index]) {
this.selectedModel = this.officeArr[index];
}
})
}
.width('100%')
.height(240)
.backgroundColor(Color.White)
}
}
@@ -1,145 +0,0 @@
import picker from '@ohos.file.picker';
import { BusinessError } from '@ohos.base';
import photoAccessHelper from '@ohos.file.photoAccessHelper';
import common from '@ohos.app.ability.common';
import { cameraPicker, camera } from '@kit.CameraKit'
import { abilityAccessCtrl } from '@kit.AbilityKit';
@CustomDialog
export struct PhotoActionSheet {
controller: CustomDialogController;
// 添加回调函数属性
private onPhotoSelected: (uri: string) => void = () => {};
// 修改构造函数
constructor(controller: CustomDialogController, onPhotoSelected: (uri: string) => void) {
super();
this.controller = controller;
this.onPhotoSelected = onPhotoSelected;
}
async checkCameraPermission(): Promise<boolean> {
const atManager = abilityAccessCtrl.createAtManager();
const grantStatus = await atManager.checkAccessToken(
globalThis.abilityContext.applicationInfo.accessTokenId,
'ohos.permission.CAMERA'
);
return grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED;
}
build() {
Column() {
// 操作按钮区域
Column() {
Row() {
// 拍摄照片按钮
Column() {
Image($r('app.media.icon_camera'))
.width(40)
.height(40)
Text('拍摄照片')
.fontSize(15)
.margin({top:10})
.fontColor($r('app.color.main_color'))
}
.width('50%')
.height(80)
.onClick(() => {
const context = getContext() as common.UIAbilityContext;
const cameras = camera.getCameraManager(context).getSupportedCameras();
cameras.forEach(device => {
console.log('Camera type:', device.cameraPosition);
});
this.openSystemCamera();
this.animateHide();
})
.padding(20)
// 相册照片按钮
Column() {
Image($r('app.media.ixon_album'))
.width(40)
.height(40)
Text('相册照片')
.fontSize(15)
.margin({top:10})
.fontColor($r('app.color.main_color'))
}
.width('50%')
.height(80)
.onClick(() => {
this.selectPhoto();
this.animateHide()
})
.padding(20)
}
}
.backgroundColor(Color.White)
Divider()
.color('#999999')
.strokeWidth(5)
.height(5)
.margin({top:20})
// 取消按钮
Button('取消')
.width('100%')
.height(50)
.fontColor('#999999')
.backgroundColor(Color.White)
.onClick(() => this.animateHide())
}
.width('100%')
.height(150)
.backgroundColor(Color.White)
}
animateHide() {
this.controller.close();
}
// 打开相机
private async openSystemCamera() {
try {
const pickerProfile: cameraPicker.PickerProfile = {
cameraPosition: camera.CameraPosition.CAMERA_POSITION_BACK,
videoDuration: 15 // 录像时设置最大时长(秒)
};
const result = await cameraPicker.pick(
getContext(),
[cameraPicker.PickerMediaType.PHOTO], // 可替换为VIDEO
pickerProfile
);
if (result.resultCode === 0) {
console.log('Photo URI:', result.resultUri);
// 处理拍摄结果
}
} catch (error) {
console.error('Camera error:', error.code);
}
}
// 资源被选中回调,返回资源的信息,以及选中方式
private selectPhoto() {
let photoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 1;
let photoViewPicker = new picker.PhotoViewPicker();
photoViewPicker.select(photoSelectOptions)
.then((photoSelectResult) => {
console.info('PhotoViewPicker.select successfully, photoSelectResult uri: ' +
JSON.stringify(photoSelectResult));
if (photoSelectResult.photoUris && photoSelectResult.photoUris.length > 0) {
this.onPhotoSelected(photoSelectResult.photoUris[0]);
}
})
.catch((err: BusinessError) => {
console.error('PhotoViewPicker.select failed with err: ' + err);
});
}
}
@@ -1,113 +0,0 @@
import { hdHttp, HdResponse,BasicConstant,RequestDefaultModel } from '@itcast/basic'
import { promptAction } from '@kit.ArkUI'
import HashMap from '@ohos.util.HashMap';
import { BusinessError } from '@kit.BasicServicesKit';
import { authStore } from '@itcast/basic'
interface DefaultData {
'name':string;
'uuid':string;
}
@CustomDialog
export struct PositionSelectedSheet {
controller: CustomDialogController;
@State officeNameArr:Array<string> = [];
private officeArr:Array<DefaultData> = [];
@Prop selectedOffice:object = new Object;
@State selectedModel:DefaultData = { name: '', uuid: '' };
@State selectedIndex:number = 0;
// 添加回调函数属性
private officeSelected: (name:string , uuid:string) => void = () => {};
// 修改构造函数
constructor(controller: CustomDialogController, officeSelected: (name: string,uuid:string) => void) {
super();
this.controller = controller;
this.officeSelected = officeSelected;
}
officeRequestUrl:string = BasicConstant.urlExpert+'positionList'
hashMap: HashMap<string, string> = new HashMap();
aboutToAppear(): void {
this.uploadOffice();
}
uploadOffice() {
hdHttp.httpReq<string>(this.officeRequestUrl,this.hashMap).then(async (res: HdResponse<string>) => {
let json:RequestDefaultModel = JSON.parse(res+'') as RequestDefaultModel;
if(json.code=='1') {
this.officeArr = json.data as DefaultData[];
this.officeNameArr = json.data.map(item => item.name);
for (let index = 0; index < this.officeNameArr.length; index++) {
const object = this.officeArr[index] as DefaultData;
const nameIndex = this.officeNameArr[index];
if (nameIndex == authStore.getUser().positionName) {
this.selectedIndex = index;
this.selectedModel = {name:nameIndex,uuid:object.uuid}
}
}
console.log('职称名称数组:', this.officeNameArr);
} else {
console.error('职称数据失败:'+json.message)
promptAction.showToast({ message: json.message, duration: 1000 })
}
}).catch((err: BusinessError) => {
console.info(`Response fail: ${err}`);
})
}
build() {
Column() {
// 操作按钮区域
Row({space:70}) {
Button('取消')
.layoutWeight(1)
.backgroundColor(Color.Transparent)
.fontColor($r('app.color.main_color'))
.backgroundColor(Color.White)
.width(80)
.onClick(() => {
this.controller.close()
})
Text('请选择职称')
.fontSize(15)
.fontColor('#666666')
Button('确定')
.layoutWeight(1)
.backgroundColor(Color.Transparent)
.fontColor($r('app.color.main_color'))
.backgroundColor(Color.White)
.width(80)
.onClick(() => {
this.controller.close()
this.officeSelected(this.selectedModel.name, this.selectedModel.uuid);
})
}
.height(40)
TextPicker({
range:this.officeNameArr,
selected:this.selectedIndex
})
.selectedTextStyle({
color: '#007AFF',
font: { size: 20, weight: FontWeight.Medium }
})
.onChange((name: string | string[], index: number | number[]) => {
// 处理单列选择场景
if (typeof index === "number" && this.officeArr[index]) {
this.selectedModel = this.officeArr[index];
}
})
}
.width('100%')
.height(240)
.backgroundColor(Color.White)
}
}
@@ -1,132 +0,0 @@
import { hdHttp, HdResponse,BasicConstant,RequestDefaultModel } from '@itcast/basic'
import HashMap from '@ohos.util.HashMap';
import { promptAction } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit';
interface DefaultData {
'name':string;
'uuid':string;
}
@CustomDialog
export struct SpecialitySelectedSheet {
controller: CustomDialogController;
@State specialityArr:Array<DefaultData> = [];
@State specialityNameArr:Array<string> = [];
@State selectedTags: Array<string> = [];
// 添加回调函数属性
private specialitySelected: (seletedTags:string) => void = () => {};
// 修改构造函数
constructor(controller: CustomDialogController, specialitySelected: (seletedTags:string) => void) {
super();
this.controller = controller;
this.specialitySelected = specialitySelected;
}
aboutToAppear(): void {
this.uploadSpeciality();
}
uploadSpeciality() {
const officeRequestUrl:string = BasicConstant.urlExpert+'disease'
const hashMap: HashMap<string, string> = new HashMap();
hdHttp.httpReq<string>(officeRequestUrl,hashMap).then(async (res: HdResponse<string>) => {
let json:RequestDefaultModel = JSON.parse(res+'') as RequestDefaultModel;
if(json.code=='1') {
this.specialityArr = json.data as DefaultData[];
this.specialityNameArr = json.data.map(item => item.name);
console.log('请求专长接口成功,信息:', this.specialityArr);
} else {
console.error('请求专长接口失败:'+json.message)
promptAction.showToast({ message: json.message, duration: 1000 })
}
}).catch((err: BusinessError) => {
console.info(`Response fail: ${err}`);
})
}
build() {
Column() {
// 操作按钮区域
Row({space:70}) {
Button('取消')
.layoutWeight(1)
.backgroundColor(Color.Transparent)
.fontColor($r('app.color.main_color'))
.backgroundColor(Color.White)
.width(80)
.onClick(() => {
this.controller.close()
})
Text('请选择专长')
.fontSize(15)
.fontColor('#666666')
Button('确定')
.layoutWeight(1)
.backgroundColor(Color.Transparent)
.fontColor($r('app.color.main_color'))
.backgroundColor(Color.White)
.width(80)
.onClick(() => {
this.controller.close()
// 拼接为逗号分隔字符串
const diseaseName = this.selectedTags.join(',');
console.log('当前选中标签的uuid字符串:', diseaseName);
this.specialitySelected(diseaseName);
})
}
.height(40)
Grid() {
ForEach(this.specialityArr, (data: DefaultData) => {
GridItem() {
// 单个标签组件
Text(data.name)
.fontSize(12)
.width('100%')
.height(30)
.textAlign(TextAlign.Center)
.backgroundColor(this.isSelected(data.uuid) ? '#b58078' : '#FFFFFF')
.onClick(() => {
this.handleTagClick(data.uuid)
})
}
.height(30)
.width('25%') // 四等分宽度
.borderWidth(1)
.borderColor(Color.Gray)
})
}
}
.width('100%')
.height(240)
.backgroundColor(Color.White)
}
// 判断是否选中
private isSelected(uuid: string): boolean {
return this.selectedTags.includes(uuid)
}
private handleTagClick(uuid: string) {
const index = this.selectedTags.indexOf(uuid);
if (index === -1) {
// 添加选中(限制最多10个)
if (this.selectedTags.length >= 10) {
promptAction.showToast({ message: '最多可选择十项!', duration: 1000 });
return;
}
this.selectedTags = [...this.selectedTags, uuid];
} else {
// 取消选中
const newSelected = [...this.selectedTags];
newSelected.splice(index, 1);
this.selectedTags = newSelected;
}
console.log('当前选中标签:', this.selectedTags)
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

+2 -2
View File
@@ -1,7 +1,7 @@
export { MainPage } from './src/main/ets/components/MainPage';
export { GuidePage } from './src/main/ets/view/GuidePage'
export { LoginComp } from './src/main/ets/view/LoginComp'
export { WebHeightPage } from './src/main/ets/view/WebHeightPage'
export { LoginSetInfo } from './src/main/ets/view/LoginSetInfo'
export { PerfectUserDataComp } from './src/main/ets/view/PerfectUserDataComp'
export { SelectedHospitalComp } from './src/main/ets/view/SelectedHospitalComp'
+11 -1
View File
@@ -5,7 +5,8 @@
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@itcast/basic@../../commons/basic": "@itcast/basic@../../commons/basic"
"@itcast/basic@../../commons/basic": "@itcast/basic@../../commons/basic",
"mypage@../mypage": "mypage@../mypage"
},
"packages": {
"@itcast/basic@../../commons/basic": {
@@ -13,6 +14,15 @@
"version": "1.0.0",
"resolved": "../../commons/basic",
"registryType": "local"
},
"mypage@../mypage": {
"name": "mypage",
"version": "1.0.0",
"resolved": "../mypage",
"registryType": "local",
"dependencies": {
"@itcast/basic": "file:../../commons/basic"
}
}
}
}
+1 -1
View File
@@ -6,6 +6,6 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@itcast/basic": "file:../../commons/basic"
"@itcast/basic": "file:../../commons/basic",
}
}
@@ -41,18 +41,14 @@ export struct LoginComp {
if (!ChangeUtil.isMobileNum(this.mobile)) {
return promptAction.showToast({ message: "手机号码不正确" })
}
if(this.isPassLogin)
{
if(this.isPassLogin) {
if (!this.code) {
return promptAction.showToast({ message: '密码不为空' })
}
if (!ChangeUtil.isPassword(this.code)) {
return promptAction.showToast({ message: "请输入6-16位字母、数字组合密码" })
}
}
else
{
} else {
if (!this.current_code) {
return promptAction.showToast({ message: '请输入验证码' })
}
@@ -64,13 +60,10 @@ export struct LoginComp {
this.loading = true
this.hashMap.clear();
this.hashMap.set('mobile',this.mobile)
if(this.isPassLogin)
{
if(this.isPassLogin) {
this.hashMap.set('password',this.code)
this.loginUrl=BasicConstant.urlExpertAPI+'login'
}
else
{
} else {
this.hashMap.set('sms',this.current_code)
this.loginUrl=BasicConstant.urlExpertAPI+'umSmsLogin'
}
@@ -80,46 +73,39 @@ export struct LoginComp {
logger.info('Response login'+res);
console.info(`Response login succeeded: ${res}`);
let json:LoginInfo = JSON.parse(res+'') as LoginInfo;
if(json.code=='1')
{
if(json.code=='1') {
this.getSaveUserInfor(1,json)
}
else
{
} else {
promptAction.showToast({ message: json.message, duration: 1000 })
}
}).catch((err: BusinessError) => {
this.loading = false
console.info(`Response login fail: ${err}`);
})
}
getSaveUserInfor(type:number,objs:LoginInfo)
{
authStore.setUser(objs.data)
promptAction.showToast({ message: '登录成功', duration: 1000 })
// emitter.emit({ eventId: 100401 })
getSaveUserInfor(type:number,objs:LoginInfo) {
let state:number=objs.data.state
logger.info('Response state'+state);
if(state!=6)
{
if(state!=6) {
router.pushUrl({
url: 'pages/LoginPage/LoginSetInfoPage', // 目标url
params: {
loginInputPhone:this.mobile
}
})
}
else
{
} else {
authStore.setUser(objs.data)
// emitter.emit({ eventId: 100401 })
logger.info('Response state'+state);
promptAction.showToast({ message: '登录成功', duration: 1000 })
preferenceStore.setItemBoolean('isLogin',true)
router.replaceUrl({
url: 'pages/Home', // 目标url
})
}
}
getMessage()
{
getMessage() {
if (!this.mobile) {
return promptAction.showToast({ message: '手机号码不为空' })
}
@@ -5,11 +5,11 @@ import { ComponentContent } from '@kit.ArkUI';
@Component
export struct LoginSetInfo{
scroller: Scroller = new Scroller();
@State
@Prop
realName:string=''
@State
@Prop
officePhone:string=''
@State
@Prop
certificate:string='111111111'
@State titleName: string = ""
private ctx: UIContext = this.getUIContext();
@@ -139,7 +139,6 @@ function customStyleR() {
@Builder
function buildText( title: string ) {
Column() {
Row(){
Text('取消')
@@ -166,7 +165,6 @@ function buildText( title: string ) {
case '':
break
}
})
} .width('100%')
.padding(10)
@@ -175,5 +173,7 @@ function buildText( title: string ) {
.padding(10)
.backgroundColor($r('app.color.white'))
.borderRadius(0)
.onChange((value:string)=>{
})
}.backgroundColor('#FFF0F0F0')
}
@@ -0,0 +1,362 @@
import { BasicConstant,ExpertData, authStore,perfactAuth } from '@itcast/basic'
import { promptAction, router } from '@kit.ArkUI'
import { EditUserDataItem } from '@itcast/basic/src/main/ets/Views/EditUserDataItem'
import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet'
import { PhotoActionSheet } from '@itcast/basic/src/main/ets/Views/PhotoActionSheet'
import { SexSelectedSheet } from '@itcast/basic/src/main/ets/Views/SexSelectedSheet'
import { OfficeSelectedSheet } from '@itcast/basic/src/main/ets/Views/OfficeSelectedSheet'
import { PositionSelectedSheet } from '@itcast/basic/src/main/ets/Views/PositionSelectedSheet'
import { SpecialitySelectedSheet } from '@itcast/basic/src/main/ets/Views/SpecialitySelectedSheet'
import { emitter } from '@kit.BasicServicesKit'
interface extraData {
uuid: string
}
interface updateExtraData {
uuid: string,
userName: string,
birthDate: string,
type: string,
photo: string,
certificateImg: string,
positionUuid: string,
officeUuid: string,
officeName: string,
diseaseUuids: string
}
interface callBackData {
expert:ExpertData,
code:number,
message:string,
specialy:[],
data:ExpertData,
special:[]
}
@Component
export struct PerfectUserDataComp {
scroller: Scroller = new Scroller();
@Prop loginPhone:string = '13419527489';
@State photoPath:string = BasicConstant.urlImage+authStore.getUser().photo;
@State name:string = perfactAuth.getUser('13419527489').realName?perfactAuth.getUser('13419527489').realName:'请输入姓名';
@State sex:string = perfactAuth.getUser('13419527489').sex?perfactAuth.getUser('13419527489').sex == 0 ? '男' : '女':'请选择性别';
@State sexnum:number = perfactAuth.getUser('13419527489').sex;
@State hospatilName:string = perfactAuth.getUser('13419527489').hospitalName?'':'请选择所在医院';
@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 officePhone:string = authStore.getUser().officePhone?perfactAuth.getUser('13419527489').officePhone.length?perfactAuth.getUser('13419527489').officePhone:'请输入所在科室的电话':'请输入所在科室的电话';
@State positionName:string = authStore.getUser().positionName?perfactAuth.getUser('13419527489').positionName.length>0?perfactAuth.getUser('13419527489').positionName:'请选择职称':'请选择职称';
@State positionUuid:string = authStore.getUser().positionUuid;
@State certificate:string = authStore.getUser().certificate?perfactAuth.getUser('13419527489').certificate.length>0?perfactAuth.getUser('13419527489').certificate:'请输入执业医师证号码':'请输入执业医师证号码';
@State certificatePhoto:string = BasicConstant.urlImage+perfactAuth.getUser('13419527489').certificateImg;
// @State diseaseName:string = authStore.getUser().diseaseName?authStore.getUser().diseaseName.length>0?authStore.getUser().diseaseName:'请选择专长':'请选择专长';
// @State diswaseUuid:string = authStore.getUser().diseaseName;
@State diseaseName:string = '请选择专长';
@State diswaseUuid:string = '';
@State inputTitle:string = '';
@State inputPlaceholder:string = '';
private photoSheetDialog!: CustomDialogController;
private officePickerDialog!: CustomDialogController;
private positionPickerDialog!: CustomDialogController;
private certificatePhotoSheetDialog!: CustomDialogController;
private diseaseSheetDialog!:CustomDialogController;
private sexSheetDilog!:CustomDialogController;
private perfactInputSheet!:CustomDialogController;
aboutToAppear() {
this.initSexDialog();
this.initPhotoDialog();
this.initPerfactInputDialog();
this.initOfficePickerDialog();
this.initPositionPickerDialog();
this.initCerficatePhotoDialog();
this.initDiseaseSheetDIalog();
authStore.initUser()
emitter.on({ eventId: 250516 }, () => {
this.handleSave()
})
}
aboutToDisappear() {
emitter.off(250516)
}
private handleSave() {
promptAction.showToast({ message: '您输入的个人资料已经保存,请完善所有信息后提交审核', duration: 1000 })
const userData:ExpertData = {
positionName: this.positionName='请选择职称'?'':this.positionName,
userName: this.loginPhone,
createDate: '',
password: '',
officeName: this.officeName='请选择科室'?'':this.officeName,
certificateImg: this.certificatePhoto,
birthDate: '',
isStar: 0,
countyId: 0,
cityId: 0,
email: '',
photo: this.photoPath,
qrcode: '',
mobile: this.loginPhone,
hospitalName: '',
officeUuid: this.officeUuid,
checkInfo: '',
hospitalUuid: '',
officePhone: this.officePhone='请输入所在科室的电话'?'':this.officePhone,
positionUuid: this.positionUuid,
sex: this.sexnum,
provId: 0,
certificate: this.certificate='请输入执业医师证号码'?'':this.certificate,
realName: this.name,
isEnable: 0,
isVisit: 0,
modifyDate: '',
currentSpec: '',
deviceType: 0,
currentType: 0,
deviceSpec: '',
nation: 0,
wechat_qrcode: '',
uuid: '',
intro: '',
state: 0,
specialy: [],
diseaseName:this.diseaseName='请选择专长'?'':this.diseaseName,
diseaseUuid:this.diswaseUuid
};
perfactAuth.setUser('13419527489',userData);
console.info('个人资料=name',perfactAuth.getUser('13419527489').realName,'\n科室:',perfactAuth.getUser('13419527489').positionName);
}
initSexDialog(){
this.sexSheetDilog = new CustomDialogController({
builder:SexSelectedSheet({
controller:this.sexSheetDilog,
sexSelected:(index: number)=>{
this.sex = index == 0 ? '男' : '女';
this.sexnum = index;
}
}),
alignment: DialogAlignment.Bottom,
customStyle: true,
autoCancel: false,
backgroundColor: ('rgba(0,0,0,0.5)'),
height: '100%'
})
}
initPerfactInputDialog() {
this.perfactInputSheet = new CustomDialogController({
builder:PerfactInputSheet({
controller:this.perfactInputSheet,
inputTitle:this.inputTitle,
inputPlaceholder:this.inputPlaceholder,
inputCallBack:(input: string,title:string)=>{
if (title == '请输入姓名') {
this.name = input;
} else if (title == '请输入所在科室电话') {
this.officePhone = input;
} else if (title == '请输入执业医师资格证号码') {
this.certificate = input;
}
}
}),
keyboardAvoidDistance: {value:-2000} as LengthMetrics, // 设置弹窗底部与键盘顶部间距(单位:vp)
alignment: DialogAlignment.Bottom,
customStyle: true,
autoCancel: false,
backgroundColor: ('rgba(0,0,0,0.5)'),
height: '100%'
})
}
private initPhotoDialog() {
this.photoSheetDialog = new CustomDialogController({
builder: PhotoActionSheet({
controller: this.photoSheetDialog,
onPhotoSelected: async (uri: string) => {
this.photoPath = uri;
}
}),
alignment: DialogAlignment.Bottom,
customStyle: true,
autoCancel: false,
backgroundColor: ('rgba(0,0,0,0.5)'),
height: '100%'
});
}
private initOfficePickerDialog() {
this.officePickerDialog = new CustomDialogController({
builder:OfficeSelectedSheet({
controller:this.officePickerDialog,
officeSelected: (name:string , uuid:string) => {
this.officeName = name;
this.officeUuid = uuid;
}
}),
alignment: DialogAlignment.Bottom,
customStyle: true,
autoCancel: false,
backgroundColor: ('rgba(0,0,0,0.5)'),
height: '100%'
})
}
private initPositionPickerDialog() {
this.positionPickerDialog = new CustomDialogController({
builder:PositionSelectedSheet({
controller:this.officePickerDialog,
officeSelected: (name:string , uuid:string) => {
this.positionName = name;
this.positionUuid = uuid;
}
}),
alignment: DialogAlignment.Bottom,
customStyle: true,
autoCancel: false,
backgroundColor: ('rgba(0,0,0,0.5)'),
height: '100%'
})
}
private initCerficatePhotoDialog() {
this.certificatePhotoSheetDialog = new CustomDialogController({
builder: PhotoActionSheet({
controller: this.certificatePhotoSheetDialog,
onPhotoSelected: (url: string) => {
this.certificatePhoto = url;
console.log('Selected image URI:', url);
}
}),
alignment: DialogAlignment.Bottom,
customStyle: true,
autoCancel: false,
backgroundColor: ('rgba(0,0,0,0.5)'),
height: '100%'
});
}
private initDiseaseSheetDIalog() {
this.diseaseSheetDialog = new CustomDialogController({
builder: SpecialitySelectedSheet({
controller:this.diseaseSheetDialog,
specialitySelected: (diseaseUuids:string,diseaseName:string)=>{
this.diseaseName = diseaseName;
this.diswaseUuid = diseaseUuids;
}
}),
alignment: DialogAlignment.Bottom,
customStyle: true,
autoCancel: false,
backgroundColor: ('rgba(0,0,0,0.5)'),
height: '100%'
})
}
build() {
Scroll(this.scroller) {
Column() {
// 基本信息字段
EditUserDataItem({ label: '头像', required: false, content: this.photoPath, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.onClick(()=>this.photoSheetDialog.open())
EditUserDataItem({ label: '姓名', required: false, content: this.name, hasArrow:true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>{
this.inputTitle = '请输入姓名';
this.inputPlaceholder = this.name;
this.perfactInputSheet.open()
})
EditUserDataItem({ label: '性别', required: false, content: this.sex, hasArrow:true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>this.sexSheetDilog.open())
EditUserDataItem({ label: '医院', required: false, content: this.hospatilName, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=> {
router.pushUrl({
url: 'pages/LoginPage/SelectedHospitalPage'
})
})
EditUserDataItem({ label: '科室', required: false, content: this.officeName, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>this.officePickerDialog.open())
EditUserDataItem({ label: '科室电话', required: false, content: this.officePhone, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>{
this.inputTitle = '请输入所在科室电话';
this.inputPlaceholder = this.officePhone;
this.perfactInputSheet.open()
})
EditUserDataItem({ label: '职称', required: false, content: this.positionName, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>this.positionPickerDialog.open())
EditUserDataItem({ label: '执业医师证编号', required: false, content: this.certificate ,hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>{
this.inputTitle = '请输入执业医师资格证号码';
this.inputPlaceholder = this.certificate;
this.perfactInputSheet.open()}
)
EditUserDataItem({ label: '执业医师证图片或胸牌', required: false, content: this.certificatePhoto, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>this.certificatePhotoSheetDialog.open())
EditUserDataItem({ label: '专长(可选一到十项)', required: false, content: this.diseaseName , hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>this.diseaseSheetDialog.open())
Column() {
// 登录按钮
Button({type:ButtonType.Normal}){
Text('提交')
}
.width('95%')
.height(48)
.borderRadius(8)
.backgroundColor($r('app.color.main_color'))
.fontColor('#FFFFFF')
.fontSize(18)
.position({x:'2.5%'})
.onClick(() => {
// 提交逻辑
router.pushUrl({
url: 'pages/LoginPage/SelectedHospitalPage'
})
})
}
.width('100%')
.height(48)
.margin({top:50})
}
.width('100%')
.height('100%')
.padding(8)
.backgroundImage($r('app.media.bg_reg'))
.backgroundImageSize(ImageSize.FILL)
}
.height('auto')
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.Off)
.backgroundColor('#ffffff')
}
}
function handleSave() {
}
@@ -0,0 +1,369 @@
import { hdHttp, HdResponse,BasicConstant } from '@itcast/basic'
import { promptAction, CommonModifier } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit';
import HashMap from '@ohos.util.HashMap';
import { it } from '@ohos/hypium';
@Component
export struct SelectedHospitalComp {
scrollerForList: Scroller = new Scroller();
@State provincerSelectedName:string = '请选择';
@State provincerId:string = '';
@State citySelectedName:string = '';
@State cityId:string = '';
@State districtsSelectedName:string = '';
@State districtsId:string = '';
@State hospitalSelectedName:string = '';
@State inputSearch:string = '';
@State tabBarModifier: CommonModifier = new CommonModifier();
@State isHidenCity:boolean = false;
@State isHiddenSearchView:boolean = false;
// 当前选中的层级索引(0-省 1-市 2-区 3-医院)
@State currentTabIndex: number = 0
// 存储各层级选择状态
@State selections: number[] = [0, 1,2 ,3]
// 数据集合
@State provinces: ProvinceOrCiry[] = []
@State cities: ProvinceOrCiry[] = []
@State districts: ProvinceOrCiry[] = []
@State hospitals: Hospital[] = []
@State searchHospitals: Hospital[] = []
// 搜索关键词
@Prop searchKey: string = ''
aboutToAppear() {
this.loadProvinces(0,0)
}
// 加载省份数据
private loadProvinces(type:number,provinceIdOrCity:number) {
const areaListUrl:string = BasicConstant.urlExpertAPI+'areaList';
const hashMap: HashMap<string, string> = new HashMap();
hashMap.clear();
if (type != 0) {
hashMap.set('parent_id',provinceIdOrCity.toString())
}
hdHttp.httpReq<string>(areaListUrl,hashMap).then(async (res: HdResponse<string>) => {
console.info(`Response areaList succeeded: ${res}`);
let json:RequestProvinceCallData = JSON.parse(res+'') as RequestProvinceCallData;
if(json.code=='200') {
if (type == 0) {
this.provinces = json.data;
this.onTabChange(0)
} else if (type == 1) {
this.cities = json.data;
this.onTabChange(1);
} else if (type == 2) {
this.onTabChange(2);
if (json.data.length>0) {
this.isHidenCity = false;
this.districts = json.data;
} else {
this.isHidenCity = true;
this.searchHospitalList('',false);
}
} else {
this.searchHospitalList('',false);
}
} else {
promptAction.showToast({ message: json.msg, duration: 1000 })
}
}).catch((err: BusinessError) => {
console.info(`Response areaList fail: ${err}`);
})
}
searchHospitalList(input:string,isSearchStatus:boolean) {
const areaListUrl:string = BasicConstant.urlExpertAPI+'hospitalList';
const hashMap: HashMap<string, string> = new HashMap();
hashMap.clear();
hashMap.set('name',input);
hashMap.set('prov_id',this.provincerId);
hashMap.set('city_id',this.cityId);
hashMap.set('county_id',this.districtsId);
hdHttp.httpReq<string>(areaListUrl,hashMap).then(async (res: HdResponse<string>) => {
console.info(`Response hospitalList succeeded: ${res}`);
let json:HospitalCallData = JSON.parse(res+'') as HospitalCallData;
if(json.code=='200') {
if (isSearchStatus) {
if (json.data.length > 0) {
this.isHiddenSearchView = true;
} else {
this.isHiddenSearchView = false;
}
this.searchHospitals = json.data;
} else {
this.isHiddenSearchView = false;
this.hospitalSelectedName = '请选择';
this.hospitals = json.data;
if (this.isHidenCity) {
this.onTabChange(2);
} else {
this.onTabChange(3);
}
}
} else {
promptAction.showToast({ message: json.msg, duration: 1000 })
}
}).catch((err: BusinessError) => {
console.info(`Response hospitalList fail: ${err}`);
})
}
// Tab切换事件
private onTabChange(index: number) {
if (index < this.currentTabIndex) { // 允许回退
this.currentTabIndex = index
return
}
// 验证数据完整性
if (index === 1 && !this.selections[0]) return
if (index === 2 && !this.selections[1]) return
if (index === 3 && !this.selections[2]) return
if (index === 4 && !this.selections[3]) return
this.currentTabIndex = index
}
private handleSearchInput(value:string) {
if (value.length<0) {
return;
}
this.searchHospitalList(value,true);
}
build() {
Column() {
SearchInput((input:string)=>{
this.handleSearchInput(input);
})
// 内容区域
Tabs({ index: this.currentTabIndex,barModifier:this.tabBarModifier.align(Alignment.Start) }) {
// 省份列表
TabContent() {
List() {
ForEach(this.provinces, (item : ProvinceOrCiry) => {
ListItem() {
Text(item.name)
.fontColor(item.name == this.provincerSelectedName?$r('app.color.main_color'):'#666666')
.fontSize(17)
.height(40)
.margin({left:20})
.onClick(() => {
this.selections[0] = 1;
this.provincerSelectedName = item.name;
this.citySelectedName = '请选择'
this.districtsSelectedName = '';
this.hospitalSelectedName = '';
this.provincerId = item.id.toString();
this.loadProvinces(1,item.id);
})
}
})
}
.width('100%')
.height('100%')
}.tabBar(this.provincerSelectedName)
// 城市列表
TabContent() {
List() {
ForEach(this.cities, (item : ProvinceOrCiry) => {
ListItem() {
Text(item.name)
.fontColor(item.name == this.citySelectedName?$r('app.color.main_color'):'#666666')
.fontSize(17)
.height(40)
.margin({left:20})
.onClick(() => {
this.selections[1] = 2;
this.citySelectedName = item.name;
this.districtsSelectedName = '请选择'
this.hospitalSelectedName = '';
this.cityId = item.id.toString();
this.loadProvinces(2,item.id)
})
}
})
}
.width('100%')
.height('100%')
}.tabBar(this.citySelectedName)
// 区县列表
TabContent() {
List() {
if (this.isHidenCity) {
ForEach(this.hospitals, (item: Hospital) => {
ListItem() {
Text(item.name)
// .fontColor(item.name == this.districtsSelectedName?$r('app.color.main_color'):'#666666')
.fontSize(17)
.height(40)
.margin({left:20})
.onClick(() => {
// this.districtsSelectedName = item.name;
this.selections[2] = 3;
//医院点击
})
}
})
} else {
ForEach(this.districts, (item: ProvinceOrCiry) => {
ListItem() {
Text(item.name)
.fontColor(item.name == this.districtsSelectedName?$r('app.color.main_color'):'#666666')
.fontSize(17)
.height(40)
.margin({left:20})
.onClick(() => {
this.districtsSelectedName = item.name;
this.selections[3] = 4;
this.districtsId = item.id.toString();
this.searchHospitalList('',false);
})
}
})
}
}
.width('100%')
.height('100%')
}.tabBar(this.districtsSelectedName)
if (!this.isHidenCity) {
// 医院列表
TabContent() {
List() {
ForEach(this.hospitals, (item:Hospital) => {
ListItem() {
Text(item.name)
.fontSize(17)
.height(40)
.margin({left:20})
.onClick(()=>{
//医院点击
})
}
})
}
.width('100%')
.height('100%')
}.tabBar(this.hospitalSelectedName)
}
}
.onChange(index => this.onTabChange(index))
.barWidth('100%')
.barMode(BarMode.Scrollable)
.height('100%')
if (this.isHiddenSearchView) {
Column() {
List() {
ForEach(this.searchHospitals, (item: Hospital) => {
ListItem() {
Text(item.name)
.fontSize(17)
.height(40)
.margin({ left: 20 })
.onClick(() => {
//医院点击
})
}
})
}
.width('100%')
.height('100%')
}
.position({ y: 60 })
.width('100%')
.height('82%')
.backgroundColor(Color.White)
}
}
.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
function SearchInput(onSearchInput:(input:string)=>void) {
// inputText:String = ;
Row() {
// 返回按钮
Image($r('app.media.selected_hospital_ws'))
.width(20)
.height(20)
.margin({left:10})
TextInput({ placeholder: '搜索医院标准名别名' })
.width('80%')
.backgroundColor('#EEEEEE')
.onChange((value:string)=>{
onSearchInput(value);
})
// .onEditChange((isEditing: boolean) => {
// if (!isEditing) {
// onSearchInput(value);
// }
// })
// .onSubmit(() => {
// onSearchInput(value);
// })
}
.borderRadius(20)
.width('90%')
.height(40)
.margin({top:10})
.backgroundColor('#EEEEEE')
.justifyContent(FlexAlign.Start)
}
interface RequestProvinceCallData {
msg:string,
code:string,
data:ProvinceOrCiry[]
}
interface HospitalCallData {
msg:string,
code:string,
data:Hospital[]
}
// DataModel.ts
interface ProvinceOrCiry {
treePath: string
name: string,
parent:number,
id:number,
fullName:string
}
interface Hospital {
city_name: string
county_id: string
prov_id: string
prov_name: string
name:string
county_name:string
uuid:string
city_id:string
}
@@ -5,4 +5,4 @@
"value": "50fp"
}
]
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB