更新注册等相关逻辑

This commit is contained in:
XiuYun CHEN 2025-05-29 17:22:54 +08:00
parent 5375c26462
commit aa6b694ba4
20 changed files with 584 additions and 202 deletions

View File

@ -20,7 +20,7 @@ export { BasicConstant } from './src/main/ets/constants/BasicConstant'
export { preferenceStore } from './src/main/ets/utils/PreferenceStore'
export { LoginInfo,Data } from './src/main/ets/models/LoginInfoModel'
export { LoginInfo,Data,SpecialDisease } from './src/main/ets/models/LoginInfoModel'
export { DataWebModel,DataWebModels } from './src/main/ets/models/DataWebModel'

View File

@ -34,5 +34,12 @@ export class BasicConstant {
static readonly expertVideoTypeList = BasicConstant.urlExpertAPI + "expertVideoTypeList";
static readonly videoByKeyWordsNew = BasicConstant.urlExpertApp + "videoByKeyWordsNew";
static readonly tagList = BasicConstant.urlExpertApp + "tagList";
static readonly meetingListBySearch = BasicConstant.urlExpertAPI + "meetingListBySearch";
static readonly province=['全国','北京市','天津市','河北省','山西省'
,'内蒙古自治区','辽宁省','吉林省','黑龙江省','上海市','江苏省','浙江省'
,'安徽省','福建省','江西省','山东省','河南省','湖北省','湖南省','广东省',
'广西壮族自治区','海南省','重庆市','四川省','贵州省','云南省','西藏自治区',
'陕西省','甘肃省','宁夏回族自治区','新疆维吾尔自治区','台湾省','香港特别行政区','澳门特别行政区']
}

View File

@ -1,6 +1,6 @@
import { List } from '@kit.ArkTS';
export interface LoginInfo{
special: List<SpecialDisease> ;
special: SpecialDisease[] ;
YX_accid:string ;
code:string;
data:Data;
@ -9,7 +9,7 @@ export interface LoginInfo{
message:string;
}
interface SpecialDisease{
export interface SpecialDisease{
diseaseName:string;
diseaseUuid:string;
}
@ -52,4 +52,5 @@ export interface Data{
state:number;
realName:string;
specialy:Array<object>;
}

View File

@ -28,8 +28,8 @@ export interface ExpertData{
certificateImg:string;
birthDate:string;
isStar:number;
countyId:number;
cityId:number;
countyId:string;
cityId:string;
email:string;
photo:string;
qrcode:string;
@ -43,7 +43,7 @@ export interface ExpertData{
nation:number;
wechat_qrcode:string;
sex:number;
provId:number;
provId:string;
uuid:string;
intro:string;
certificate:string;

View File

@ -1,5 +1,6 @@
import { preferences } from '@kit.ArkData'
import { ExpertData } from '../models/RequestDefaultModel'
import { logger } from '../utils/logger'
export const AUTH_STORE_KEY = 'perfactAuth'
@ -14,30 +15,27 @@ class PerfactAuth {
}
async setUser(phone:string,user: ExpertData) {
AppStorage.setOrCreate(phone, user)
await this.getStore().put(phone, JSON.stringify(user))
await this.getStore().flush()
}
async updateUser(phone:string,user: ExpertData) {
AppStorage.setOrCreate(phone, user)
await this.getStore().put(phone, JSON.stringify(user))
await this.getStore().flush()
}
async delUser(phone:string) {
AppStorage.setOrCreate(phone, {})
await this.getStore().put(phone, '{}')
await this.getStore().flush()
}
initUser(phone:string) {
const json = this.getStore().getSync(AUTH_STORE_KEY, '{}') as string
AppStorage.setOrCreate(AUTH_STORE_KEY, JSON.parse(json))
}
getUser(phone:string) {
return AppStorage.get<ExpertData>(phone) || {} as ExpertData
// logger.info('个人资料initUser'+this.getStore().getSync(phone,'{}'));
return JSON.parse(this.getStore().getSync(phone,'{}')+'') as ExpertData
}
}

View File

@ -23,7 +23,7 @@ class PreferenceStore {
this.getStore().flush()
}
getItemString(keyword: string) {
return this.getStore().getSync(keyword,'')
return this.getStore().getSync(keyword,'') as string
}
getItemBooleanT(keyword: string):boolean {
return this.getStore().getSync(keyword,true) as boolean

View File

@ -3,7 +3,7 @@ import { router } from '@kit.ArkUI'
import { Data } from '../models/LoginInfoModel'
import { ExpertData } from '../models/RequestDefaultModel'
import { BusinessError } from '@kit.BasicServicesKit'
import { logger } from '../utils/logger'
export interface HdUser {
id: string
username: string
@ -63,6 +63,7 @@ class AuthStore {
}
getUser() {
logger.info('个人资料initUser'+ (AppStorage.get<Data>('user') || {} as Data)+'');
return AppStorage.get<Data>('user') || {} as Data
}

View File

@ -3,12 +3,13 @@ import { MeetingItemModel,MeetingModel,MeetingModels,ItemModel } from '../model/
import { HdList, HdListController,BasicConstant,hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
import { promptAction, router } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit';
import { HdLoadingDialog } from '@itcast/basic'
import { EmptyViewComp,HdLoadingDialog } from '@itcast/basic'
import HashMap from '@ohos.util.HashMap';
@Component
export struct ListComp {
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
@State
list: ItemModel[] = []
controller = new HdListController()
@ -16,12 +17,17 @@ export struct ListComp {
page: number = 1
@State
keyword: string = ''
hashMap: HashMap<string, string> = new HashMap();
@Prop
@Watch('onUpdate')
sort: number = 30
timer: number = -1
hashMap: HashMap<string, string> = new HashMap();
location: string=''
@Prop
@Watch('onUpdate')
month:string=''
@State
url:string=BasicConstant.meetingListV2
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
@ -29,11 +35,8 @@ export struct ListComp {
})
onUpdate() {
if (this.timer) clearTimeout(this.timer)
this.timer = setTimeout(() => {
this.controller.reload()
this.url=BasicConstant.meetingListBySearch
this.onRefresh()
}, 500)
}
onRefresh() {
@ -47,7 +50,13 @@ export struct ListComp {
this.dialog.open()
this.hashMap.clear();
this.hashMap.set('page', this.page+"")
hdHttp.httpReq<string>(BasicConstant.meetingListV2,this.hashMap).then(async (res: HdResponse<string>) => {
if(BasicConstant.meetingListBySearch==this.url)
{
this.hashMap.set('location', this.location+"")
this.hashMap.set('status', "")
this.hashMap.set('month', this.month+"")
}
hdHttp.httpReq<string>(this.url,this.hashMap).then(async (res: HdResponse<string>) => {
logger.info('Response meetingListV2'+res);
let json:MeetingModels = JSON.parse(res+'') as MeetingModels;
this.dialog.close();
@ -78,9 +87,18 @@ export struct ListComp {
} else {
this.page++
}
if (this.list.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
}).catch((err: BusinessError) => {
this.dialog.close();
if (this.list.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
})
}
getPosition() {
@ -100,6 +118,12 @@ export struct ListComp {
}
build() {
if (this.isEmptyViewVisible){
EmptyViewComp({promptText:'暂无会议',isVisibility:this.isEmptyViewVisible})
.width('100%')
.height('100%')
} else
{
HdList({
lw: 1,
controller: this.controller,
@ -117,6 +141,8 @@ export struct ListComp {
}
})
}
}
}
}

View File

@ -19,8 +19,7 @@ export struct ListCompGandan {
controller = new HdListController()
@State
page: number = 1
@State
keyword: string = ''
hashMap: HashMap<string, string> = new HashMap();
dialog: CustomDialogController = new CustomDialogController({

View File

@ -3,12 +3,13 @@ import { MeetingItemModel,MeetingModel,MeetingModels,ItemModel } from '../model/
import { HdList, HdListController,BasicConstant,hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
import { promptAction, router } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit';
import { HdLoadingDialog } from '@itcast/basic'
import { EmptyViewComp,HdLoadingDialog } from '@itcast/basic'
import HashMap from '@ohos.util.HashMap';
@Component
export struct ListCompPast {
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
@Prop
@Watch('onUpdate')
year:string=''
@ -103,10 +104,18 @@ export struct ListCompPast {
} else {
this.page++
}
if (this.list.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
}).catch((err: BusinessError) => {
this.dialog.close()
if (this.list.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
})
}
getPosition() {
@ -126,6 +135,12 @@ export struct ListCompPast {
}
build() {
if (this.isEmptyViewVisible){
EmptyViewComp({promptText:'暂无数据',isVisibility:this.isEmptyViewVisible})
.width('100%')
.height('100%')
} else
{
HdList({
lw: 1,
controller: this.controller,
@ -143,6 +158,8 @@ export struct ListCompPast {
}
})
}
}
}
}

View File

@ -184,6 +184,7 @@ export struct SecondaryLink {
.margin({left:10,right:15})
.onClick(()=>{
this.tagPositiontmp = [...this.tagPosition];
this.keywords=''
if(this.tagPosition.length>0)
{
this.videoImgSe=$r('app.media.cb_screen_yes')
@ -195,7 +196,7 @@ export struct SecondaryLink {
}
else
{
this.keywords=''
this.videoSelect=$r('app.color.848284')
this.videoImgSe=$r('app.media.cb_screen_no')
}

View File

@ -33,10 +33,6 @@ export struct PastVideo {
{
HdNav({ title: '过往会议', showRightIcon: false, showLeftIcon: true})
Row() {
Blank()
.onClick(()=>{
this.tlistStatus=!this.tlistStatus
})
Row() {
if(this.timePosition!=-1)
{
@ -49,19 +45,14 @@ export struct PastVideo {
}
}
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
this.tlistStatus=!this.tlistStatus
})
Blank()
.onClick(()=>{
this.tlistStatus=!this.tlistStatus
})
Text('|').customStyle()
Blank()
.onClick(()=>{
this.getSelectMonth()
})
Text('|').customStyle()
Row() {
if(this.typePosition!=-1)
{
@ -73,13 +64,12 @@ export struct PastVideo {
Image(this.notselectImg).width(13).margin({left:5})
}
}
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
this.getSelectMonth()
})
Blank()
.onClick(()=>{
this.getSelectMonth()
})
}.width('100%').height(45)
Text().Line()
Stack({ }) {
@ -117,6 +107,9 @@ export struct PastVideo {
this.timePosition=index
this.tlistStatus=false
this.timeText=item
this.monthText='会议月份';
this.type=''
this.typePosition=-1;
})
}
}, (item: string) => JSON.stringify(item))

View File

@ -33,10 +33,7 @@ export struct PlayBack {
{
HdNav({ title: '肝胆回放', showRightIcon: false, showLeftIcon: true})
Row() {
Blank()
.onClick(()=>{
this.tlistStatus=!this.tlistStatus
})
Row() {
if(this.timePosition!=-1)
{
@ -48,19 +45,15 @@ export struct PlayBack {
Image(this.notselectImg).width(13).margin({left:5})
}
}
.onClick(()=>{
this.tlistStatus=!this.tlistStatus
})
Blank()
}.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
this.typelistStatus=false
this.tlistStatus=!this.tlistStatus
})
Text('|').customStyle()
Blank()
.onClick(()=>{
this.typelistStatus=!this.typelistStatus
})
Row() {
if(this.typePosition!=-1)
{
@ -72,13 +65,13 @@ export struct PlayBack {
Image(this.notselectImg).width(13).margin({left:5})
}
}
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
this.tlistStatus=false
this.typelistStatus=!this.typelistStatus
})
Blank()
.onClick(()=>{
this.typelistStatus=!this.typelistStatus
})
}.width('100%').height(45)
Text().Line()
Stack({ }) {

View File

@ -1,4 +1,4 @@
import { HdNav } from '@itcast/basic'
import { HdNav,BasicConstant } from '@itcast/basic'
import { ListComp } from '../components/ListComp'
import { router } from '@kit.ArkUI'
@ -10,9 +10,13 @@ export struct VideoPage {
@State selectImg: ResourceStr = $r('app.media.triangle_green_theme');
@State monthWords:Array<string> =[]
@State timePosition:number=-1;
@State proivcePosition:number=-1;
@State tlistStatus:boolean=false;
@State timeText:string='会议时间';
@State plistStatus:boolean=false;
@State PriText:string='会议地点';
@State location: string=''
@State month:string=''
onPageShow(): void {
console.log('VideoPage onPageShow!');
@ -33,10 +37,7 @@ export struct VideoPage {
{
HdNav({ title: '肝胆会议', showRightIcon: false, showLeftIcon: false,showRightText:false,rightText:'扫一扫' })
Row() {
Blank()
.onClick(()=>{
this.tlistStatus=!this.tlistStatus
})
Row() {
if(this.timePosition!=-1)
{
@ -48,48 +49,54 @@ export struct VideoPage {
Image(this.notselectImg).width(13).margin({left:5})
}
}
.onClick(()=>{
this.tlistStatus=!this.tlistStatus
})
Blank()
}.layoutWeight(1)
.onClick(()=>{
this.plistStatus=false
this.tlistStatus=!this.tlistStatus
})
.justifyContent(FlexAlign.Center)
Text('|').customStyle()
Blank()
Row() {
Text('会议地点').customStyle()
if(this.proivcePosition!=-1)
{
Text(this.PriText).customStyle().fontColor($r('app.color.top_title'))
Image(this.selectImg).width(13).margin({left:5})
}
else {
Text(this.PriText).customStyle()
Image(this.notselectImg).width(13).margin({left:5})
}
Blank()
Text('|').customStyle()
Blank()
.onClick(() => {
router.pushUrl({url:'pages/VideoPage/PlayBackPage'})
}
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
this.tlistStatus=false
this.plistStatus=!this.plistStatus
})
Text('|').customStyle()
Row() {
Text('会议回放').customStyle()
}
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.onClick(() => {
router.pushUrl({url:'pages/VideoPage/PlayBackPage'})
})
Blank()
.onClick(() => {
router.pushUrl({url:'pages/VideoPage/PlayBackPage'})
})
}.width('100%').height(45)
Text().Line()
Stack({ }) {
ListComp().backgroundColor($r('app.color.e4e4e4'))
ListComp({location:this.location,month:this.month}).backgroundColor($r('app.color.e4e4e4'))
if(this.tlistStatus)
{
List() {
ForEach(this.monthWords, (item: string,index:number) => {
ListItem() {
Column() {
if(this.timePosition==index)
{
Row()
@ -116,15 +123,67 @@ export struct VideoPage {
this.timePosition=index
this.tlistStatus=false
this.timeText=item
if(this.timePosition==0)
{
this.month=''
}
else
{
this.month=index-1+''
}
})
}
}, (item: string) => JSON.stringify(item))
} .width('100%')
.height('100%').backgroundColor(Color.White)
}
if(this.plistStatus)
{
Column()
{
Grid() {
ForEach(BasicConstant.province, (item: string, index: number) => {
GridItem() {
Text(item.length>3?item.substring(0,3)+"...":item)
.height(40)
.width('100%')
.maxLines(1)
.padding({left:5,right:5})
.fontWeight(FontWeight.Regular)
.fontSize(13)
.fontColor($r('app.color.848284'))
.textAlign(TextAlign.Center)
.border({ width: 1, color:'#999999' })
.borderRadius(5)
.onClick(() => {
this.PriText=item.length>3?item.substring(0,3)+"...":item
this.proivcePosition=index
this.plistStatus=false
if(this.proivcePosition==0)
{
this.location=''
}
else
{
this.location=item.substring(0,2)
}
})
}
})
}
.padding(10)
.columnsTemplate('1fr 1fr 1fr 1fr')
.columnsGap(10)
.rowsGap(10)
.backgroundColor(Color.White)
.height('calc(100% - 175vp)')
.width('100%')
.layoutWeight(1)
}
.height('100%')
}
}
}
.width('100%')
@ -144,10 +203,8 @@ export struct VideoPage {
}
}
getNowMonth()
{
this.monthWords.push("所有");
let month:number= new Date().getMonth()+1;
for(let i =month;i<13;i++){
@ -155,12 +212,8 @@ export struct VideoPage {
}
for(let i =1;i<month;i++){
this.monthWords.push(i+"月");
}
}
}
@Extend(Text)
function customStyle() {

View File

@ -153,7 +153,7 @@ export struct EditUserDataComp {
// 使用post发起请求使用Promise进行异步回调其中content以及destination为可选参数可根据实际情况选择
session.post(updateDataUrl, postContent)
.then((response) => {
// console.info(`Response succeeded: ${JSON.stringify(response.headers)}`);
console.info(`Response succeeded66: ${JSON.stringify(response.headers)}`);
console.info(`Response succeeded: ${JSON.stringify(response.statusCode)}`);
console.info(`Response succeeded22: ${JSON.stringify(response)}`);
// console.info(`Response succeeded: ${JSON.stringify(postContent)}`);

View File

@ -2,8 +2,8 @@ import { authStore, hdHttp, HdResponse,HdNav,BasicConstant, logger,LoginInfo,Cha
import { promptAction, router } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit';
import HashMap from '@ohos.util.HashMap';
import { DataWebModel,preferenceStore } from '@itcast/basic'
import {perfactAuth } from '@itcast/basic'
import { DataWebModel,preferenceStore ,SpecialDisease} from '@itcast/basic'
@Preview
@Component
export struct LoginComp {
@ -76,7 +76,8 @@ 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'||json.code=='200') {
this.arrToStringSpecialy(json.special)
this.getSaveUserInfor(1,json)
} else {
promptAction.showToast({ message: json.message, duration: 1000 })
@ -89,12 +90,15 @@ export struct LoginComp {
getSaveUserInfor(type:number,objs:LoginInfo) {
let state:number=objs.data.state
let checkInfo:string=objs.data.checkInfo
if(state!=6) {
perfactAuth.initUser(this.mobile)
authStore.setUser(objs.data)
router.pushUrl({
url: 'pages/LoginPage/LoginSetInfoPage', // 目标url
params: {
loginInputPhone:this.mobile
loginInputPhone:this.mobile,
state:state,
checkInfo:checkInfo
}
})
} else {
@ -108,7 +112,27 @@ export struct LoginComp {
})
}
}
arrToStringSpecialy(data:SpecialDisease[]) {
let diseaseName=''
let diseaseUuid=''
if(data!=null&&data.length>0)
{
data.forEach((element,index) => {
if(index!=data.length-1)
{
diseaseName+=element.diseaseName+','
diseaseUuid+=element.diseaseUuid+','
}
else
{
diseaseName+=element.diseaseName
diseaseUuid+=element.diseaseUuid
}
});
}
preferenceStore.setItemString('diseaseName',diseaseName)
preferenceStore.setItemString('diseaseUuid',diseaseUuid)
}
getMessage() {
if (!this.mobile) {
return promptAction.showToast({ message: '手机号码不为空' })

View File

@ -1,4 +1,5 @@
import { BasicConstant,ExpertData, authStore,perfactAuth } from '@itcast/basic'
import { BasicConstant,ExpertData,perfactAuth,ChangeUtil,authStore,preferenceStore,LoginInfo,
logger } from '@itcast/basic'
import { LengthMetrics, 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'
@ -8,6 +9,8 @@ import { OfficeSelectedSheet } from '@itcast/basic/src/main/ets/Views/OfficeSele
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'
import { BusinessError } from '@kit.BasicServicesKit';
import { rcp } from '@kit.RemoteCommunicationKit';
interface extraData {
uuid: string
@ -16,13 +19,21 @@ interface extraData {
interface updateExtraData {
uuid: string,
userName: string,
birthDate: string,
realName:string,
type: string,
sex:string,
photo: string,
provId:string,
cityId:string,
countyId:string,
hospitalUuid:string,
hospitalName:string,
certificateImg: string,
positionUuid: string,
certificate:string
officeUuid: string,
officeName: string,
officePhone:string,
diseaseUuids: string
}
@ -38,28 +49,34 @@ interface callBackData {
@Component
export struct PerfectUserDataComp {
scroller: Scroller = new Scroller();
@Prop state:number=0
@Prop loginPhone:string = '';
@Prop checkInfo:string=''
@State photoPath:string = BasicConstant.urlImage+authStore.getUser().photo;
@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 sexnum:number = perfactAuth.getUser('13419527489').sex;
@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 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 photoPath:string = perfactAuth.getUser(this.loginPhone).photo;
@State name:string = perfactAuth.getUser(this.loginPhone).realName?perfactAuth.getUser(this.loginPhone).realName:'请输入姓名';
@State sex:string = perfactAuth.getUser(this.loginPhone).sex?perfactAuth.getUser(this.loginPhone).sex == 0 ? '男' : '女':'请选择性别';
@State sexnum:number = perfactAuth.getUser(this.loginPhone).sex;
@State hospatilName:string = perfactAuth.getUser(this.loginPhone).hospitalName?perfactAuth.getUser(this.loginPhone).hospitalName:'请选择所在医院'
@State officeName:string = perfactAuth.getUser(this.loginPhone).officeName?perfactAuth.getUser(this.loginPhone).officeName:'请选择科室';
@State officeUuid:string = perfactAuth.getUser(this.loginPhone).officeUuid;
@State officePhone:string = perfactAuth.getUser(this.loginPhone).officePhone?perfactAuth.getUser(this.loginPhone).officePhone:'请输入所在科室的电话';
@State positionName:string = perfactAuth.getUser(this.loginPhone).positionName?perfactAuth.getUser(this.loginPhone).positionName:'请选择职称';
@State positionUuid:string = perfactAuth.getUser(this.loginPhone).positionUuid;
@State certificate:string = perfactAuth.getUser(this.loginPhone).certificate?perfactAuth.getUser(this.loginPhone).certificate:'请输入执业医师证号码';
@State certificatePhoto:string = perfactAuth.getUser(this.loginPhone).certificateImg;
@State diseaseName:string = perfactAuth.getUser(this.loginPhone).diseaseName?perfactAuth.getUser(this.loginPhone).diseaseName:'请选择专长';
@State diseaseUuid:string = perfactAuth.getUser(this.loginPhone).diseaseUuid?perfactAuth.getUser(this.loginPhone).diseaseUuid:'';
@State inputTitle:string = '';
@State inputPlaceholder:string = '';
@State info:string=''
@State cityId:string = perfactAuth.getUser(this.loginPhone).cityId?perfactAuth.getUser(this.loginPhone).cityId:'';
@State provId:string = perfactAuth.getUser(this.loginPhone).provId?perfactAuth.getUser(this.loginPhone).provId:'';
@State countyId:string = perfactAuth.getUser(this.loginPhone).countyId?perfactAuth.getUser(this.loginPhone).countyId:'';
@State hospitalUuid:string = perfactAuth.getUser(this.loginPhone).hospitalUuid?perfactAuth.getUser(this.loginPhone).hospitalUuid:'';
@State base64Stringphoto:string=''
@State base64Stringcertificate:string=''
private photoSheetDialog!: CustomDialogController;
private officePickerDialog!: CustomDialogController;
@ -77,10 +94,8 @@ export struct PerfectUserDataComp {
this.initPositionPickerDialog();
this.initCerficatePhotoDialog();
this.initDiseaseSheetDIalog();
this.hospatilName =JSON.stringify(perfactAuth.getUser(this.loginPhone))
console.info('个人资料=loginPhone',this.loginPhone+' 3rf '+this.hospatilName);
this.handleState()
// logger.info("Response this.photoPath "+this.photoPath)
emitter.on({ eventId: 250516 }, () => {
this.handleSave()
@ -90,6 +105,10 @@ export struct PerfectUserDataComp {
console.info(`eventData: ${JSON.stringify(eventData)}`);
const params =eventData.data as Record<string, string>; // 获取传递过来的参数对象
this.hospatilName=params.name
this.countyId=params.county_id
this.cityId=params.city_id
this.provId=params.prov_id
this.hospitalUuid=params.uuid
});
}
@ -99,20 +118,83 @@ export struct PerfectUserDataComp {
emitter.off(250517)
}
private handleState()
{
if(this.state==0||this.state==1||this.state==11||this.state==10
||this.state==9||this.state==3||this.state==4||this.state==5
||this.state==7) {
if(this.state==3||this.state==4||this.state==5)
{
this.info='您的资料未通过审核,请修改完善后重新提交。'
if(this.checkInfo!=''||this.checkInfo!=null)
{
this.info=this.checkInfo
promptAction.showDialog({ title: '温馨提示', message: this.checkInfo,
buttons: [{ text: '确定', color: $r('app.color.main_color') }],
})
.then(data => {
if (data.index == 1) {
}
})
}
}
}
else
{
this.info='肝胆相照将尽快对您的资料进行审核,请耐心等待。'
}
if(this.state!=0&&this.state!=1)
{
this.photoPath = BasicConstant.urlImage+authStore.getUser().photo
this.name = authStore.getUser().realName?authStore.getUser().realName:'请输入姓名'
this.sex = authStore.getUser().sex?'请选择性别':authStore.getUser().sex == 0 ? '男' : '女';
this.sexnum = authStore.getUser().sex;
this.hospatilName = authStore.getUser().hospitalName?authStore.getUser().hospitalName:'请选择所在医院'
this.officeName = authStore.getUser().officeName?authStore.getUser().officeName:'请选择科室';
this.officeUuid = authStore.getUser().officeUuid;
this.officePhone = authStore.getUser().officePhone?authStore.getUser().officePhone:'请输入所在科室的电话';
this.positionName = authStore.getUser().positionName?authStore.getUser().positionName:'请选择职称';
this.positionUuid = authStore.getUser().positionUuid;
this.certificate = authStore.getUser().certificate?authStore.getUser().certificate:'请输入执业医师证号码';
this.certificatePhoto = BasicConstant.urlImage+authStore.getUser().certificateImg;
this.diseaseName = preferenceStore.getItemString('diseaseName')?preferenceStore.getItemString('diseaseName'):'请选择专长';
this.diseaseUuid = preferenceStore.getItemString('diseaseUuid')?preferenceStore.getItemString('diseaseUuid'):'';
this.cityId = authStore.getUser().cityId?authStore.getUser().cityId+'':''
this.provId = authStore.getUser().provId?authStore.getUser().provId+'':'';
this.countyId = authStore.getUser().countyId?authStore.getUser().countyId+'':'';
this.hospitalUuid = authStore.getUser().hospitalUuid?authStore.getUser().hospitalUuid:'';
}
}
canEdit()
{
if(this.state==0||this.state==1||this.state==11||this.state==10
||this.state==9||this.state==3||this.state==4||this.state==5
||this.state==7) {
return true;
}
else
{
return false
}
}
private handleSave() {
promptAction.showToast({ message: '您输入的个人资料已经保存,请完善所有信息后提交审核', duration: 1000 })
const userData:ExpertData = {
positionName: this.positionName=='请选择职称'?'':this.positionName,
positionName: this.positionName,
userName: this.loginPhone,
createDate: '',
password: '',
officeName: this.officeName=='请选择科室'?'':this.officeName,
officeName: this.officeName,
certificateImg: this.certificatePhoto,
birthDate: '',
isStar: 0,
countyId: 0,
cityId: 0,
countyId: this.countyId,
cityId:this.cityId,
email: '',
photo: this.photoPath,
qrcode: '',
@ -120,12 +202,12 @@ export struct PerfectUserDataComp {
hospitalName: this.hospatilName,
officeUuid: this.officeUuid,
checkInfo: '',
hospitalUuid: '',
officePhone: this.officePhone=='请输入所在科室的电话'?'':this.officePhone,
hospitalUuid: this.hospitalUuid,
officePhone: this.officePhone,
positionUuid: this.positionUuid,
sex: this.sexnum,
provId: 0,
certificate: this.certificate=='请输入执业医师证号码'?'':this.certificate,
provId: this.provId,
certificate: this.certificate,
realName: this.name,
isEnable: 0,
isVisit: 0,
@ -140,11 +222,131 @@ export struct PerfectUserDataComp {
intro: '',
state: 0,
specialy: [],
diseaseName:this.diseaseName=='请选择专长'?'':this.diseaseName,
diseaseUuid:this.diswaseUuid
diseaseName:this.diseaseName,
diseaseUuid:this.diseaseUuid
};
perfactAuth.setUser('13419527489',userData);
console.info('个人资料=name',perfactAuth.getUser('13419527489').realName,'\n科室:',perfactAuth.getUser('13419527489').positionName);
perfactAuth.setUser(this.loginPhone,userData);
// console.info('个人资料=name',perfactAuth.getUser(this.loginPhone).realName,'\n科室:',perfactAuth.getUser(this.loginPhone).positionName);
}
handleModify()
{
if(this.base64Stringphoto.length<1&&(this.photoPath==undefined||this.photoPath.length<0))
{
promptAction.showToast({ message: "请选择头像" , duration: 1000 })
return
}
if(this.name.length<1||this.name=='请输入姓名')
{
promptAction.showToast({ message: "姓名不为空" , duration: 1000 })
return
}
if(this.sex.length<1||this.sex=='请选择性别')
{
promptAction.showToast({ message: "请选择性别" , duration: 1000 })
return
}
if(this.hospatilName.length<1||this.hospatilName=='请选择所在医院')
{
promptAction.showToast({ message: "医院不为空" , duration: 1000 })
return
}
if(this.hospitalUuid.length<1)
{
promptAction.showToast({ message: "医院不为空" , duration: 1000 })
return
}
if(this.officeName.length<1||this.officeName=='请选择科室')
{
promptAction.showToast({ message: "科室不为空" , duration: 1000 })
return
}
if(this.officeUuid.length<1)
{
promptAction.showToast({ message: "科室不为空" , duration: 1000 })
return
}
if(this.officePhone.length<1||this.officePhone=='请输入所在科室的电话')
{
promptAction.showToast({ message: "科室电话不为空" , duration: 1000 })
return
}
if(this.positionName.length<1||this.positionName=='请选择职称')
{
promptAction.showToast({ message: "职称不为空" , duration: 1000 })
return
}
if(this.positionUuid.length<1)
{
promptAction.showToast({ message: "职称不为空" , duration: 1000 })
return
}
if(this.certificate.length<1||this.certificate=='请输入执业医师证号码')
{
promptAction.showToast({ message: "执业医师资格证号码不为空" , duration: 1000 })
return
}
if(this.base64Stringcertificate.length<1&&(this.certificatePhoto==undefined||this.certificatePhoto.length<0))
{
promptAction.showToast({ message: "请选择执业医师资格证照片" , duration: 1000 })
return
}
if(this.diseaseName.length<1||this.diseaseName=='请选择专长')
{
promptAction.showToast({ message: "请选择专长" , duration: 1000 })
return
}
if(this.diseaseUuid.length<1)
{
promptAction.showToast({ message: "请选择专长" , duration: 1000 })
return
}
const updateDataUrl:string = BasicConstant.urlExpert + 'modify';
// 定义content请根据实际情况选择
const postContent = new rcp.MultipartForm({
'uuid': authStore.getUser().uuid,
'userName': this.loginPhone,
'realName':this.name,
'type': '1',
'sex':this.sexnum+'',
'photo': this.base64Stringphoto,
'provId':this.provId,
'cityId':this.cityId,
'countyId':this.countyId,
'hospitalUuid':this.hospitalUuid,
'hospitalName':this.hospatilName,
'certificateImg': this.base64Stringcertificate,
'positionUuid': this.positionUuid,
'certificate':this.certificate,
'officeUuid': this.officeUuid,
'officeName': this.officeName,
'officePhone':this.officePhone,
'diseaseUuids': this.diseaseUuid
})
const session = rcp.createSession();
session.post(updateDataUrl, postContent)
.then((response) => {
let json:LoginInfo = JSON.parse(response+'') as LoginInfo;
if(json.code=='1') {
this.state=-1
this.info='肝胆相照将尽快对您的资料进行审核,请耐心等待。'
}
else
{
promptAction.showToast({ message: "提交失败,请重试" +json.message, duration: 1000 })
}
// console.info(`Response succeeded2: ${JSON.stringify(response.headers)}`);
// console.info(`Response succeeded: ${JSON.stringify(response.statusCode)}`);
// console.info(`Response succeeded22: ${JSON.stringify(response)}`);
// console.info(`Response postContent: ${JSON.stringify(postContent)}`);
})
.catch((err: BusinessError) => {
console.error(`Response err: Code is ${JSON.stringify(err.code)}, message is ${JSON.stringify(err)}`);
})
}
initSexDialog(){
@ -195,6 +397,7 @@ export struct PerfectUserDataComp {
controller: this.photoSheetDialog,
onPhotoSelected: async (uri: string) => {
this.photoPath = uri;
this.base64Stringphoto = await ChangeUtil.convertUriToBase64(uri);
}
}),
alignment: DialogAlignment.Bottom,
@ -243,8 +446,10 @@ export struct PerfectUserDataComp {
this.certificatePhotoSheetDialog = new CustomDialogController({
builder: PhotoActionSheet({
controller: this.certificatePhotoSheetDialog,
onPhotoSelected: (url: string) => {
onPhotoSelected: async (url: string) => {
this.certificatePhoto = url;
this.base64Stringcertificate = await ChangeUtil.convertUriToBase64(url);
console.log('Selected image URI:', url);
}
}),
@ -262,7 +467,7 @@ export struct PerfectUserDataComp {
controller:this.diseaseSheetDialog,
specialitySelected: (diseaseUuids:string,diseaseName:string)=>{
this.diseaseName = diseaseName;
this.diswaseUuid = diseaseUuids;
this.diseaseUuid = diseaseUuids;
}
}),
alignment: DialogAlignment.Bottom,
@ -281,11 +486,23 @@ export struct PerfectUserDataComp {
// 基本信息字段
EditUserDataItem({ label: '头像', required: false, content: this.photoPath, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.onClick(()=>this.photoSheetDialog.open())
.onClick(()=>
{
if(!this.canEdit())
{
return
}
this.photoSheetDialog.open()
}
)
EditUserDataItem({ label: '姓名', required: false, content: this.name, hasArrow:true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>{
if(!this.canEdit())
{
return
}
this.inputTitle = '请输入姓名';
this.inputPlaceholder = this.name;
this.perfactInputSheet.open()
@ -293,11 +510,21 @@ export struct PerfectUserDataComp {
EditUserDataItem({ label: '性别', required: false, content: this.sex, hasArrow:true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>this.sexSheetDilog.open())
.onClick(()=> {
if(!this.canEdit())
{
return
}
this.sexSheetDilog.open()
})
EditUserDataItem({ label: '医院', required: false, content: this.hospatilName, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=> {
if(!this.canEdit())
{
return
}
router.pushUrl({
url: 'pages/LoginPage/SelectedHospitalPage'
})
@ -305,11 +532,22 @@ export struct PerfectUserDataComp {
EditUserDataItem({ label: '科室', required: false, content: this.officeName, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>this.officePickerDialog.open())
.onClick(()=> {
if(!this.canEdit())
{
return
}
this.officePickerDialog.open()
}
)
EditUserDataItem({ label: '科室电话', required: false, content: this.officePhone, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>{
if(!this.canEdit())
{
return
}
this.inputTitle = '请输入所在科室电话';
this.inputPlaceholder = this.officePhone;
this.perfactInputSheet.open()
@ -317,11 +555,22 @@ export struct PerfectUserDataComp {
EditUserDataItem({ label: '职称', required: false, content: this.positionName, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>this.positionPickerDialog.open())
.onClick(()=> {
if(!this.canEdit())
{
return
}
this.positionPickerDialog.open()
}
)
EditUserDataItem({ label: '执业医师证编号', required: false, content: this.certificate ,hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>{
if(!this.canEdit())
{
return
}
this.inputTitle = '请输入执业医师资格证号码';
this.inputPlaceholder = this.certificate;
this.perfactInputSheet.open()}
@ -329,13 +578,30 @@ export struct PerfectUserDataComp {
EditUserDataItem({ label: '执业医师证图片或胸牌', required: false, content: this.certificatePhoto, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>this.certificatePhotoSheetDialog.open())
.onClick(()=> {
if(!this.canEdit())
{
return
}
this.certificatePhotoSheetDialog.open()
})
EditUserDataItem({ label: '专长(可选一到十项)', required: false, content: this.diseaseName , hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>this.diseaseSheetDialog.open())
.onClick(()=>
{
if(!this.canEdit())
{
return
}
this.diseaseSheetDialog.open()
})
Column() {
Text(this.info) .fontSize(18).fontColor('#ffff5454').padding(10).margin({top:20})
.visibility(this.info==''?Visibility.None:Visibility.Visible)
// 登录按钮
Button({type:ButtonType.Normal}){
Text('提交')
@ -346,17 +612,21 @@ export struct PerfectUserDataComp {
.backgroundColor($r('app.color.main_color'))
.fontColor('#FFFFFF')
.fontSize(18)
.position({x:'2.5%'})
// .position({x:'2.5%'})
.visibility(this.state==0||this.state==1||this.state==11||this.state==10
||this.state==9||this.state==3||this.state==4||this.state==5
||this.state==7?Visibility.Visible:Visibility.None)
.onClick(() => {
// 提交逻辑
router.pushUrl({
url: 'pages/LoginPage/SelectedHospitalPage'
})
this.handleModify()
})
}
.width('100%')
.height(48)
.margin({top:50})
.padding({top:50,bottom:20})
}
.width('100%')
.height('100%')
@ -366,11 +636,8 @@ export struct PerfectUserDataComp {
}
.height('auto')
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.Off)
// .scrollBar(BarState.Off)
.backgroundColor('#ffffff')
}
}
// function handleSave() {
//
// }

View File

@ -150,7 +150,7 @@ export struct SelectedHospitalComp {
{
let item={
city_name: this.districtsSelectedName,
county_id: this.cityId,
county_id: this.districtsId,
prov_id: this.provincerId,
prov_name: this.provincerSelectedName,
name:'其他医院',

View File

@ -25,6 +25,7 @@ struct BootPage {
themeManager.enableFullScreen()
authStore.initUser()
getContext().getApplicationContext().getRunningProcessInformation()
if(this.isFirstRun)
{

View File

@ -5,13 +5,14 @@ import { router } from '@kit.ArkUI';
@Entry
@Component
struct LoginSetInfoPage {
@State loginInputPhone:Record<string, string> =router.getParams() as Record<string, string>;
@State loginInputPhone:Record<string, object> =router.getParams() as Record<string, object>;
build() {
Column() {
// LoginSetInfo()
HdNav({ title: '完善个人资料', showRightIcon: false, showLeftIcon: true,showRightText:true,rightText:'保存' })
PerfectUserDataComp({loginPhone:this.loginInputPhone.loginInputPhone});
PerfectUserDataComp({loginPhone:String(this.loginInputPhone.loginInputPhone),
state:Number(this.loginInputPhone.state),checkInfo:String(this.loginInputPhone.checkInfo)});
}
}
}