diff --git a/commons/basic/src/main/ets/constants/BasicConstant.ets b/commons/basic/src/main/ets/constants/BasicConstant.ets index 945d902..84c426a 100644 --- a/commons/basic/src/main/ets/constants/BasicConstant.ets +++ b/commons/basic/src/main/ets/constants/BasicConstant.ets @@ -6,14 +6,13 @@ export class BasicConstant { static readonly getzcxy = "http://app.igandan.com/expert_zcxy.jsp";// 注册协议正式地址 //测试环境 - static readonly urlimage = "https://dev-app.igandan.com/app/"; - static readonly urlmyLan = "https://dev-app.igandan.com/app/expertAPI/"; - static readonly urlapp = "https://dev-app.igandan.com//app/expertApp/" + static readonly urlExpertAPI = "https://dev-app.igandan.com/app/expertAPI/"; + static readonly urlExpertApp = "https://dev-app.igandan.com//app/expertApp/" static readonly urlHtml = "http://dev-doc.igandan.com/app/" - static readonly imageHeader = "https://dev-doc.igandan.com/app/" + static readonly urlImage = "https://dev-doc.igandan.com/app/" static readonly urlExpert = "https://dev-app.igandan.com/app/expert/" - static readonly getStartpage=BasicConstant.urlapp + "startpage"; - static readonly meetingListV2=BasicConstant.urlmyLan + "meetingListV2"; + static readonly getStartpage=BasicConstant.urlExpertApp + "startpage"; + static readonly meetingListV2=BasicConstant.urlExpertAPI + "meetingListV2"; } \ No newline at end of file diff --git a/features/mypage/src/main/ets/view/ChangePasswordComp.ets b/features/mypage/src/main/ets/view/ChangePasswordComp.ets index 06c683a..5468efc 100644 --- a/features/mypage/src/main/ets/view/ChangePasswordComp.ets +++ b/features/mypage/src/main/ets/view/ChangePasswordComp.ets @@ -1,13 +1,47 @@ +import { hdHttp, HdResponse, BasicConstant, ExpertData, authStore } from '@itcast/basic' +import { BusinessError } from '@kit.BasicServicesKit'; import promptAction from '@ohos.promptAction'; -import { router } from '@kit.ArkUI' +import HashMap from '@ohos.util.HashMap'; +import { router } from '@kit.ArkUI'; + +interface updateExtraData { + expertUuid: string, + password: string, + oriPwd: string +} + +interface callBackData { + code: number, + message:string, + msg:string, + data: string +} -@Preview @Component export struct ChangePasswordComp { @State oldPassword: string = '' @State newPassword: string = '' @State confirmPassword: string = '' + uploadChangePasswordAction(){ + hdHttp.post(BasicConstant.urlExpert+'modifyPwd', { + expertUuid: authStore.getUser().uuid, + password: this.confirmPassword, + oriPwd: this.oldPassword + } as updateExtraData).then(async (res: HdResponse) => { + let json:callBackData = JSON.parse(res+'') as callBackData; + console.log('更新登录密码数据:',json); + if (json.code == 1) { + promptAction.showToast({message:'修改成功'}); + router.back(); + } else { + promptAction.showToast({message:json.message}); + } + }).catch((err: BusinessError) => { + console.info(`Response fail: ${err}`); + }) + } + build() { Column() { // 原密码输入框 @@ -72,8 +106,36 @@ export struct ChangePasswordComp { .borderWidth(1) .fontColor($r('app.color.main_color')) .onClick(() => { - // 处理密码修改提交逻辑 - this.handleSubmit() + const passwordRegex = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/ + if (this.oldPassword.length <= 0 || !this.oldPassword) { + promptAction.showToast({message:'请输入原密码'}) + return + } + if (!passwordRegex.test(this.oldPassword)) { + promptAction.showToast({message:'原密码格式错误'}) + return + } + if (this.newPassword.length <= 0 || !this.newPassword) { + promptAction.showToast({message:'请输入原密码'}) + return + } + if (!passwordRegex.test(this.newPassword)) { + promptAction.showToast({message:'新密码格式错误'}) + return + } + if (this.confirmPassword.length <= 0 || !this.confirmPassword) { + promptAction.showToast({message:'请确认新密码'}) + return + } + if (this.newPassword !== this.confirmPassword) { + promptAction.showToast({message:'新密码与确认密码不一致'}) + return + } + if (!passwordRegex.test(this.confirmPassword)) { + promptAction.showToast({message:'密码格式不正确,请重新输入!'}) + return + } + this.uploadChangePasswordAction() }) } .width('100%') @@ -81,21 +143,4 @@ export struct ChangePasswordComp { .backgroundColor(Color.White) } - // 提交处理函数 - private handleSubmit() { - // 这里添加密码验证和提交逻辑 - // 验证规则示例: - if (this.newPassword !== this.confirmPassword) { - promptAction.showToast({message:'两次输入的新密码不一致'}) - return - } - - const passwordRegex = /^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d]{6,16}$/ - if (!passwordRegex.test(this.newPassword)) { - promptAction.showToast({message:'密码必须为6-16位数字字母组合'}) - return - } - - // 调用修改密码接口... - } } diff --git a/features/mypage/src/main/ets/view/ChangePhoneComp.ets b/features/mypage/src/main/ets/view/ChangePhoneComp.ets index fd69bb6..7b08888 100644 --- a/features/mypage/src/main/ets/view/ChangePhoneComp.ets +++ b/features/mypage/src/main/ets/view/ChangePhoneComp.ets @@ -22,7 +22,7 @@ export struct ChangePhoneComp { hashMap.set('newMobile',this.phoneNumber) hashMap.set('oldMobile',authStore.getUser().photo) hashMap.set('sms',this.smsCode) - hdHttp.httpReq(BasicConstant.urlmyLan+'updateMobile',hashMap).then(async (res: HdResponse) => { + hdHttp.httpReq(BasicConstant.urlExpertAPI+'updateMobile',hashMap).then(async (res: HdResponse) => { let json:callBackData = JSON.parse(res+'') as callBackData; console.log('更新手机号数据:',json); if (json.code == 200) { @@ -40,7 +40,7 @@ export struct ChangePhoneComp { const hashMap: HashMap = new HashMap(); hashMap.set('type','6'); hashMap.set('mobile',this.phoneNumber) - hdHttp.httpReq(BasicConstant.urlmyLan+'smsSend',hashMap).then(async (res: HdResponse) => { + hdHttp.httpReq(BasicConstant.urlExpertAPI+'smsSend',hashMap).then(async (res: HdResponse) => { let json:callBackData = JSON.parse(res+'') as callBackData; console.log('获取验证码数据:',json); if (json.code == 200) { @@ -76,7 +76,7 @@ export struct ChangePhoneComp { .objectFit(ImageFit.Contain) .margin({left:10}) - TextInput({ placeholder: '请输入手机号码' }) + TextInput({ placeholder: '请输入新的手机号码' }) .fontSize(16) .backgroundColor(Color.White) .onChange((value: string) => { diff --git a/features/mypage/src/main/ets/view/EditUserDataComp.ets b/features/mypage/src/main/ets/view/EditUserDataComp.ets index 546a3b7..1d49889 100644 --- a/features/mypage/src/main/ets/view/EditUserDataComp.ets +++ b/features/mypage/src/main/ets/view/EditUserDataComp.ets @@ -43,7 +43,7 @@ interface UploadAvatarResponse { @Component export struct EditUserDataComp { - @State photoPath:string = BasicConstant.imageHeader+authStore.getUser().photo; + @State photoPath:string = BasicConstant.urlImage+authStore.getUser().photo; @State name:string = authStore.getUser().realName; @State sex:string = authStore.getUser().sex == 0 ? '男' : '女'; @State birthday:string = authStore.getUser().birthDate; @@ -55,7 +55,7 @@ export struct EditUserDataComp { @State officePhone:string = authStore.getUser().officePhone; @State positionName:string = authStore.getUser().positionName; @State certificate:string = authStore.getUser().certificate; - @State certificatePhoto:string = BasicConstant.imageHeader+authStore.getUser().certificateImg; + @State certificatePhoto:string = BasicConstant.urlImage+authStore.getUser().certificateImg; @State diseaseName:string = ''; @State intro:string = authStore.getUser().intro; @@ -315,13 +315,14 @@ export struct EditUserDataComp { Column() { Column(){ Text('基本资料') + .height(20) .fontSize(16) .margin({left:15}) .fontColor($r('app.color.main_color')) } .width('100%') - .height(17) - .backgroundColor(Color.Gray) + .height(20) + .backgroundColor('#D1D1D1') .alignItems(HorizontalAlign.Start) // 基本信息字段 EditUserDataItem({ label: '头像', required: true, content: this.photoPath, hasArrow: true }) @@ -354,13 +355,14 @@ export struct EditUserDataComp { Column() { Column(){ Text('专业资料') + .height(20) .fontSize(16) .margin({left:15}) .fontColor($r('app.color.main_color')) } .width('100%') - .height(17) - .backgroundColor(Color.Gray) + .height(20) + .backgroundColor('#D1D1D1') .alignItems(HorizontalAlign.Start) EditUserDataItem({ label: '医院', required: true, content: this.hospatilName }) diff --git a/features/mypage/src/main/ets/view/EditUserDataItem.ets b/features/mypage/src/main/ets/view/EditUserDataItem.ets index c9a988b..e80aa59 100644 --- a/features/mypage/src/main/ets/view/EditUserDataItem.ets +++ b/features/mypage/src/main/ets/view/EditUserDataItem.ets @@ -42,7 +42,7 @@ export struct EditUserDataItem { .margin({ right: this.hasArrow?0:10 }) } else { Text(this.content) - .fontSize(16) + .fontSize(14) .fontColor('#333333') .width('60%') .textOverflow({ overflow: TextOverflow.Ellipsis }) diff --git a/features/mypage/src/main/ets/view/FourSection.ets b/features/mypage/src/main/ets/view/FourSection.ets index b4ca7c7..f7f387d 100644 --- a/features/mypage/src/main/ets/view/FourSection.ets +++ b/features/mypage/src/main/ets/view/FourSection.ets @@ -1,9 +1,9 @@ -import { it } from "@ohos/hypium"; import { MyPageSectionClass } from "../model/MyPageSectionClass"; import { MyPageSectionItem } from '../view/MyPageSectionItem' import { common, Want } from '@kit.AbilityKit'; import notificationManager from '@ohos.notificationManager'; import { Theme } from "@ohos.arkui.theme"; +import { router } from '@kit.ArkUI' import { BusinessError } from "@kit.BasicServicesKit"; import emitter from '@ohos.events.emitter'; @@ -12,25 +12,23 @@ export struct FourSection { @State sectionTitle: string = "常规操作"; @State currentIndex: number = 0; @State pushStatus: string = '通知已开'; + @State pushIconPath: Resource = $r('app.media.my_page_message_on') @State refreshFlag: boolean = false; @State fourSectionList:Array = [ - new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'微信绑定','/pages/MyHomePage'), - new MyPageSectionClass('twoItem',$r('app.media.app_icon'),'更换手机号','/pages/MyHomePage'), - new MyPageSectionClass('threeItem',$r('app.media.app_icon'),this.pushStatus,'/pages/MyHomePage'), - new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'发现新版本','/pages/MyHomePage') + new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'微信绑定',''), + new MyPageSectionClass('twoItem',$r('app.media.my_page_choosePhone'),'更换手机号','pages/MinePage/ChangePhonePage'), + new MyPageSectionClass('threeItem',this.pushIconPath,this.pushStatus,''), + new MyPageSectionClass('fourItem',$r('app.media.my_page_version'),'发现新版本','') ]; aboutToAppear() { console.log('FourSection aboutToAppear!'); this.checkNotificationStatus(); - - // 监听通知状态变化事件 emitter.on('notification_status_changed', this.onNotificationChanged); } aboutToDisappear() { - // 取消事件监听 emitter.off('notification_status_changed', this.onNotificationChanged); } @@ -53,10 +51,11 @@ export struct FourSection { let isEnabled = await notificationManager.isNotificationEnabledSync(); console.log('当前通知状态:', isEnabled); this.pushStatus = isEnabled ? '通知已开' : '通知已关'; + this.pushIconPath = this.pushStatus == '通知已开'?$r('app.media.my_page_message_on'):$r('app.media.my_home_push_down'); // 更新数组中的标题 this.fourSectionList = this.fourSectionList.map((item, index) => { if (index === 2) { - return new MyPageSectionClass(item.id, item.imageSrc, this.pushStatus, item.path); + return new MyPageSectionClass(item.id, this.pushIconPath, this.pushStatus, item.path); } return item; }); @@ -103,6 +102,10 @@ export struct FourSection { .onClick(()=>{ if (item.title.includes('通知')) { this.handleNotificationClick(); + } else { + router.pushUrl({ + url:item.path + }) } }) }, (item: MyPageSectionClass) => item.id) diff --git a/features/mypage/src/main/ets/view/HeaderView.ets b/features/mypage/src/main/ets/view/HeaderView.ets index 0d62d93..8acc359 100644 --- a/features/mypage/src/main/ets/view/HeaderView.ets +++ b/features/mypage/src/main/ets/view/HeaderView.ets @@ -24,7 +24,7 @@ interface heroFirst { @Component export struct HeaderView { @State heroIndex: number = 0 // 当前页索引 - @State photoPath:string = BasicConstant.imageHeader+authStore.getUser().photo; + @State photoPath:string = BasicConstant.urlImage+authStore.getUser().photo; @State name:string = authStore.getUser().realName; @State myPageData:object = new Object; @State heroArray:Array = []; @@ -64,7 +64,7 @@ export struct HeaderView { uploadBackImgAction() { const hashMap: HashMap = new HashMap(); - const userDataUrl:string = BasicConstant.urlmyLan+'my'; + const userDataUrl:string = BasicConstant.urlExpertAPI+'my'; hdHttp.httpReq(userDataUrl,hashMap).then(async (res: HdResponse) => { console.info(`我的背景图: ${res}`); let json:RequestDefaultModel = JSON.parse(res+'') as RequestDefaultModel; @@ -131,7 +131,12 @@ export struct HeaderView { .onClick(() => { console.log('Show HeroPopWindow'); }) - .onClick(()=>this.dialogController.open()) + .onClick(()=>{ + this.dialogController.open(); + // if (!this.heroArray[index] as heroFirst == 'ranking') { + // this.dialogController.open(heroId:this.heroArray[index]['id'] as string); + // } + }) } }) } diff --git a/features/mypage/src/main/ets/view/HeroPopWindow.ets b/features/mypage/src/main/ets/view/HeroPopWindow.ets index 622f2c0..953dfd1 100644 --- a/features/mypage/src/main/ets/view/HeroPopWindow.ets +++ b/features/mypage/src/main/ets/view/HeroPopWindow.ets @@ -1,9 +1,38 @@ -import { it } from "@ohos/hypium"; +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 = new HashMap(); + + updateHeroDetailsAction(){ + this.hashMap.set('id',this.heroId); + hdHttp.httpReq(this.heroDetailsRequestUrl,this.hashMap).then(async (res: HdResponse) => { + 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() { //半透明黑色背景 diff --git a/features/mypage/src/main/ets/view/MyPageSectionItem.ets b/features/mypage/src/main/ets/view/MyPageSectionItem.ets index a711602..e6f623c 100644 --- a/features/mypage/src/main/ets/view/MyPageSectionItem.ets +++ b/features/mypage/src/main/ets/view/MyPageSectionItem.ets @@ -7,9 +7,9 @@ export struct MyPageSectionItem { build() { Column(){ Image(this.sectionItem.imageSrc) - .backgroundColor(Color.Gray) .width(35).height(35) .borderRadius(17.5) + .objectFit(ImageFit.Auto) Text(this.sectionItem.title) .fontSize(12) .fontColor(Color.Black) diff --git a/features/mypage/src/main/ets/view/OfficeSelectedSheet.ets b/features/mypage/src/main/ets/view/OfficeSelectedSheet.ets index 2baba98..ff9d777 100644 --- a/features/mypage/src/main/ets/view/OfficeSelectedSheet.ets +++ b/features/mypage/src/main/ets/view/OfficeSelectedSheet.ets @@ -14,7 +14,6 @@ export struct OfficeSelectedSheet { controller: CustomDialogController; @State officeNameArr:Array = []; private officeArr:Array = []; - @Prop selectedOffice:object = new Object; @State selectedModel:DefaultData = { officeName: '', officeUuid: '' }; @State selectedIndex:number = 0; @@ -44,9 +43,11 @@ export struct OfficeSelectedSheet { this.officeNameArr = json.data.map(item => item.officeName); console.log('科室名称数组:', this.officeNameArr); for (let index = 0; index < this.officeNameArr.length; index++) { - const element = this.officeNameArr[index]; - if (element == authStore.getUser().officeName) { + 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 { @@ -64,7 +65,7 @@ export struct OfficeSelectedSheet { Row({space:70}) { Button('取消') .layoutWeight(1) - .backgroundColor(Color.Transparent) + // .backgroundColor(Color.Transparent) .fontColor($r('app.color.main_color')) .backgroundColor(Color.White) .width(80) @@ -78,7 +79,6 @@ export struct OfficeSelectedSheet { Button('确定') .layoutWeight(1) - .backgroundColor(Color.Transparent) .fontColor($r('app.color.main_color')) .backgroundColor(Color.White) .width(80) diff --git a/features/mypage/src/main/ets/view/PositionSelectedSheet.ets b/features/mypage/src/main/ets/view/PositionSelectedSheet.ets index 29eb919..50c8ef7 100644 --- a/features/mypage/src/main/ets/view/PositionSelectedSheet.ets +++ b/features/mypage/src/main/ets/view/PositionSelectedSheet.ets @@ -43,9 +43,11 @@ export struct PositionSelectedSheet { this.officeArr = json.data as DefaultData[]; this.officeNameArr = json.data.map(item => item.name); for (let index = 0; index < this.officeNameArr.length; index++) { - const element = this.officeNameArr[index]; - if (element == authStore.getUser().positionName) { + 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); diff --git a/features/mypage/src/main/resources/base/media/icon_phone.png b/features/mypage/src/main/resources/base/media/icon_phone.png index 67be629..22f1e90 100644 Binary files a/features/mypage/src/main/resources/base/media/icon_phone.png and b/features/mypage/src/main/resources/base/media/icon_phone.png differ diff --git a/features/mypage/src/main/resources/base/media/icon_verification_code.png b/features/mypage/src/main/resources/base/media/icon_verification_code.png index 4397073..67be629 100644 Binary files a/features/mypage/src/main/resources/base/media/icon_verification_code.png and b/features/mypage/src/main/resources/base/media/icon_verification_code.png differ diff --git a/features/mypage/src/main/resources/base/media/my_home_push_down.png b/features/mypage/src/main/resources/base/media/my_home_push_down.png new file mode 100644 index 0000000..e3ba44c Binary files /dev/null and b/features/mypage/src/main/resources/base/media/my_home_push_down.png differ diff --git a/features/mypage/src/main/resources/base/media/my_page_choosePhone.png b/features/mypage/src/main/resources/base/media/my_page_choosePhone.png new file mode 100644 index 0000000..bb456f2 Binary files /dev/null and b/features/mypage/src/main/resources/base/media/my_page_choosePhone.png differ diff --git a/features/mypage/src/main/resources/base/media/my_page_message_on.png b/features/mypage/src/main/resources/base/media/my_page_message_on.png new file mode 100644 index 0000000..ee73356 Binary files /dev/null and b/features/mypage/src/main/resources/base/media/my_page_message_on.png differ diff --git a/features/mypage/src/main/resources/base/media/my_page_version.png b/features/mypage/src/main/resources/base/media/my_page_version.png new file mode 100644 index 0000000..0c774a9 Binary files /dev/null and b/features/mypage/src/main/resources/base/media/my_page_version.png differ diff --git a/features/register/src/main/ets/view/LoginComp.ets b/features/register/src/main/ets/view/LoginComp.ets index f78b0ca..f5637ca 100644 --- a/features/register/src/main/ets/view/LoginComp.ets +++ b/features/register/src/main/ets/view/LoginComp.ets @@ -29,7 +29,7 @@ export struct LoginComp { @State type:string ='账号密码登录' - loginUrl:string=BasicConstant.urlmyLan+'umSmsLogin' + loginUrl:string=BasicConstant.urlExpertAPI+'umSmsLogin' hashMap: HashMap = new HashMap(); @@ -67,12 +67,12 @@ export struct LoginComp { if(this.isPassLogin) { this.hashMap.set('password',this.code) - this.loginUrl=BasicConstant.urlmyLan+'login' + this.loginUrl=BasicConstant.urlExpertAPI+'login' } else { this.hashMap.set('sms',this.current_code) - this.loginUrl=BasicConstant.urlmyLan+'umSmsLogin' + this.loginUrl=BasicConstant.urlExpertAPI+'umSmsLogin' } this.hashMap.set('current_spec','hongmeng') hdHttp.httpReq(this.loginUrl,this.hashMap).then(async (res: HdResponse) => { @@ -126,7 +126,7 @@ export struct LoginComp { this.hashMap.clear(); this.hashMap.set('mobile',this.mobile) this.hashMap.set('type','7') - hdHttp.httpReq(BasicConstant.urlmyLan+'smsSend',this.hashMap).then(async (res: HdResponse) => { + hdHttp.httpReq(BasicConstant.urlExpertAPI+'smsSend',this.hashMap).then(async (res: HdResponse) => { }).catch((err: BusinessError) => { this.loading = false console.info(`Response login succeeded: ${err}`); diff --git a/products/expert/src/main/ets/pages/MinePage/CancelAccount.ets b/products/expert/src/main/ets/pages/MinePage/CancelAccount.ets index e3b58ab..39cda5f 100644 --- a/products/expert/src/main/ets/pages/MinePage/CancelAccount.ets +++ b/products/expert/src/main/ets/pages/MinePage/CancelAccount.ets @@ -1,5 +1,19 @@ import { HdNav } from '@itcast/basic'; -import { promptAction } from '@kit.ArkUI' +import { hdHttp, HdResponse,BasicConstant,ExpertData, authStore } from '@itcast/basic' +import { BusinessError } from '@kit.BasicServicesKit'; +import { router } from '@kit.ArkUI' +import promptAction from '@ohos.promptAction'; + +interface updateExtraData { + expertUuid: string, + content:string +} + +interface callBackData { + code: number, + message:string, + data: Array +} @Entry @Component @@ -13,6 +27,47 @@ struct CancelAccount { ' 收到您的注销申请后,我们将在10个工作日内帮您完成注销及数据清除工作' controller:TextAreaController = new TextAreaController(); + uploadCancleAccountAction() { + hdHttp.post(BasicConstant.urlExpert + 'patientList', { + expertUuid: authStore.getUser().uuid + } as updateExtraData).then(async (res: HdResponse) => { + let json: callBackData = JSON.parse(res + '') as callBackData; + console.log('注销账户数据:', json); + if (json.data.length > 0) { + promptAction.showDialog({ + title: '温馨提示', + message: '请您解除所有随访患者后再提交注销申请', + buttons: [{ text: '取消', color: '#000000' }, { text: '确定', color: '#000000' }] + }) + } else { + this.uploadFeedBackAction(); + } + }).catch((err: BusinessError) => { + console.info(`Response fail: ${err}`); + }) + } + + uploadFeedBackAction() { + hdHttp.post(BasicConstant.urlExpert + 'feedBack', { + expertUuid: authStore.getUser().uuid, + content: '注销此账户', + } as updateExtraData).then(async (res: HdResponse) => { + let json: callBackData = JSON.parse(res + '') as callBackData; + console.log('提交注销账户数据:', json); + if (json.code == 1) { + promptAction.showDialog({ + title: '温馨提示', + message: '提交成功!', + buttons: [{ text: '取消', color: '#000000' }, { text: '确定', color: '#000000' }] + }) + } else { + promptAction.showToast({ message: json.message }); + } + }).catch((err: BusinessError) => { + console.info(`Response fail: ${err}`); + }) + } + build() { Column() { HdNav({ title: '注销账户', showRightIcon: false, hasBorder: true }) @@ -73,7 +128,9 @@ struct CancelAccount { ] }) .then(data=>{ - console.info('showDialog success, click button: '+data.index) + if (data.index === 1) { + this.uploadCancleAccountAction(); + } }) .catch((error:Error)=>{ console.info('showDialog error:'+error) diff --git a/products/expert/src/main/ets/pages/MinePage/ChangePhonePage.ets b/products/expert/src/main/ets/pages/MinePage/ChangePhonePage.ets index e80db37..ec6d322 100644 --- a/products/expert/src/main/ets/pages/MinePage/ChangePhonePage.ets +++ b/products/expert/src/main/ets/pages/MinePage/ChangePhonePage.ets @@ -6,7 +6,7 @@ import { HdNav } from '@itcast/basic'; struct ChangePhonePage { build() { Column(){ - HdNav({ title: '更换手机号', showRightIcon: false, hasBorder: true }) + HdNav({ title: '修改手机号', showRightIcon: false, hasBorder: true }) ChangePhoneComp(); } } diff --git a/products/expert/src/main/ets/pages/MinePage/EditIntroductionPage.ets b/products/expert/src/main/ets/pages/MinePage/EditIntroductionPage.ets index 7821123..5a319bf 100644 --- a/products/expert/src/main/ets/pages/MinePage/EditIntroductionPage.ets +++ b/products/expert/src/main/ets/pages/MinePage/EditIntroductionPage.ets @@ -1,13 +1,54 @@ +import { hdHttp, HdResponse,BasicConstant,ExpertData, authStore } from '@itcast/basic' +import { BusinessError } from '@kit.BasicServicesKit'; +import { router } from '@kit.ArkUI' import promptAction from '@ohos.promptAction'; -import { authStore } from '@itcast/basic'; import { HdNav } from '@itcast/basic'; +interface updateExtraData { + uuid: string, + userName: string, + type: string, + intro: string, +} + +interface callBackData { + expert:ExpertData, + code:number, + message:string, + specialy:[], + data:ExpertData, + special:[] +} + @Entry @Component struct EditIntroductionPage { controller : TextAreaController = new TextAreaController() @State inputValue: string = authStore.getUser().intro; + commitIntroductionData(inputStr:string){ + const updateDataUrl:string = BasicConstant.urlExpert + 'modify'; + hdHttp.post(updateDataUrl, { + uuid: authStore.getUser().uuid, + userName: authStore.getUser().userName, + intro: inputStr, + type:'2' + } as updateExtraData).then(async (res: HdResponse) => { + let json:callBackData = JSON.parse(res+'') as callBackData; + if(json.code == 1 && json.data && typeof json.data === 'object') { + authStore.updateUser(json.data) + console.log('更新用户个人简介成功:', authStore.getUser().email); + promptAction.showToast({message:'修改成功', duration: 1000}) + router.back(); + } else { + console.error('更新用户个人简介失败:'+json.message) + promptAction.showToast({ message: json.message, duration: 1000 }) + } + }).catch((err: BusinessError) => { + console.info(`更新用户个人简介请求失败: ${err}`); + }) + } + build() { Column() { HdNav({ title: '修改个人简介', showRightIcon: false, hasBorder: true }) @@ -54,12 +95,15 @@ struct EditIntroductionPage { .position({x:'5%',y:'80%'}) .onClick(() => { // 处理登录逻辑 - if (this.inputValue.length > 0) { - promptAction.showToast({message:'请输入简介'}) - return + if (this.inputValue.length <= 0 || !this.inputValue) { + promptAction.showToast({message:'请填写您的个人简介'}); + return; } - - // 执行登录操作... + if (this.inputValue.length > 500) { + promptAction.showToast({message:'内容不能超过500字'}); + return; + } + this.commitIntroductionData(this.inputValue); }) } .width('100%') diff --git a/products/expert/src/main/ets/pages/MinePage/FeedbackPage.ets b/products/expert/src/main/ets/pages/MinePage/FeedbackPage.ets index 977cf4f..d826dcc 100644 --- a/products/expert/src/main/ets/pages/MinePage/FeedbackPage.ets +++ b/products/expert/src/main/ets/pages/MinePage/FeedbackPage.ets @@ -1,4 +1,20 @@ +import { hdHttp, HdResponse, BasicConstant, ExpertData, authStore } from '@itcast/basic' +import { BusinessError } from '@kit.BasicServicesKit'; +import promptAction from '@ohos.promptAction'; import { HdNav } from '@itcast/basic'; +import { router } from '@kit.ArkUI'; + +interface updateExtraData { + content: string, + expertUuid: string +} + +interface callBackData { + code: number, + message:string, + msg:string, + data: string +} @Entry @Component @@ -6,15 +22,35 @@ struct FeedbackPage { @State feedbackText: string = '' controller:TextAreaController = new TextAreaController(); + uploadChangePasswordAction() { + hdHttp.post(BasicConstant.urlExpert + 'feedBack', { + expertUuid: authStore.getUser().uuid, + content: this.feedbackText, + } as updateExtraData).then(async (res: HdResponse) => { + let json: callBackData = JSON.parse(res + '') as callBackData; + console.log('意见反馈数据:', json); + if (json.code == 1) { + promptAction.showToast({ message: '信息已提交,谢谢!' }); + router.back(); + } else { + promptAction.showToast({ message: json.message }); + } + }).catch((err: BusinessError) => { + console.info(`Response fail: ${err}`); + }) + } + build() { Column() { HdNav({ title: '意见反馈', showRightIcon: false, hasBorder: true }) // 输入框区域 TextArea({ - text:this.feedbackText, placeholder:'欢迎对我们的软件提供建议,帮助我们更快更好地改进"肝胆相照"APP(200字以内)', controller:this.controller }) + .onChange((value: string) => { + this.feedbackText = value + }) .placeholderFont({size:16}) .placeholderColor('#999999') .width('95%') @@ -43,14 +79,20 @@ struct FeedbackPage { width:1, color:'#8B2316' }) - .onClick(() => this.submitFeedback()) + .onClick(() => { + if (this.feedbackText.length <= 0 || !this.feedbackText) { + promptAction.showToast({message:'请输入您的建议'}) + return + } + if (this.feedbackText.length > 200) { + promptAction.showToast({message:'内容不能大于200字'}) + return + } + this.uploadChangePasswordAction(); + }) } .width('100%') .height('100%') .backgroundColor(Color.White) } - // 提交反馈处理 - private submitFeedback(): void { - // 提交逻辑实现 - } } \ No newline at end of file