首页、患者分组、审核、列表等

This commit is contained in:
xiaoxiao
2025-07-10 09:27:17 +08:00
parent 5954f51701
commit 4641e9ecee
136 changed files with 7577 additions and 171 deletions
@@ -4,11 +4,13 @@ export class MyPageSectionClass {
imageSrc:ResourceStr = '';
title:string = '';
path:string = '';
status:boolean = false;
constructor(id:string,imageSrc:ResourceStr,title:string,path:string) {
constructor(id:string,imageSrc:ResourceStr,title:string,path:string,status:boolean) {
this.id = id;
this.imageSrc = imageSrc;
this.title = title;
this.path = path;
this.status = status;
}
}
@@ -1,11 +1,17 @@
import { HeaderView } from '../view/HeaderView'
import { HdNav, getTimeText, hdHttp, HdUser } from '@itcast/basic'
import { OneSection } from '../view/OneSection'
import { TwoSection } from '../view/TwoSection'
import { ThreeSection } from '../view/ThreeSection'
import { FourSection } from '../view/FourSection'
import { OtherList } from '../view/OtherList'
import { emitter } from '@kit.BasicServicesKit'
import { HdNav,hdHttp,HdResponse,BasicConstant,ExpertData,authStore,RequestDefaultModel } from '@itcast/basic'
import { BusinessError, emitter } from '@kit.BasicServicesKit';
import HashMap from '@ohos.util.HashMap'
interface heroFirst {
id: string;
nick_name: string;
}
@Component
export struct MyHomePage {
@@ -13,21 +19,64 @@ export struct MyHomePage {
@StorageProp('topHeight')
topHeight: number = 0
@State myInfoBackGround:string = '';
@State heroArray:Array<object> = [];
@State expertData:object | string = new Object;
scroller = new Scroller()
aboutToAppear(): void {
this.uploadBackImgAction();
emitter.on({ eventId: BasicConstant.notification_home_tab_change }, (eventData: emitter.EventData) => {
if (eventData.data?.changeIndex === 2) {
this.uploadBackImgAction();
}
});
}
uploadBackImgAction() {
const hashMap: HashMap<string, string> = new HashMap();
hdHttp.httpReq<string>(BasicConstant.myData,hashMap).then(async (res: HdResponse<string>) => {
console.info(`我的背景图: ${res}`);
let json:Record<string,object | string> = JSON.parse(res+'') as Record<string,object | string>;
if(json.code == '200') {
this.heroArray = json.data["honor_list"];
this.myInfoBackGround = json.data['myInfoBackGround'];
this.expertData = json.data;
// 获取ranking值(带安全类型转换)
const ranking: string = json.data["ranking"]?.toString() ?? "";
if (Number(ranking) > 0) {
// 创建排名对象
const rankDic: heroFirst = {
"id": "ranking",
"nick_name": `随访达人 I 排名${ranking}`
};
// 插入数组首位
this.heroArray.unshift(rankDic);
}
} else {
console.error('我的背景图:'+json.message)
}
}).catch((err: BusinessError) => {
console.info(`Response login fail: ${err}`);
})
}
build() {
Column() {
HdNav({ title: '我的', showLeftIcon:false , showRightIcon: false, hasBorder: true })
Scroll(this.scroller) {
Column() {
HeaderView()
// OneSection()
// TwoSection()
// ThreeSection()
FourSection()
OtherList()
}
Stack() {
Image(this.myInfoBackGround)
.backgroundImageSize(ImageSize.Cover)
.width('100%')
Column() {
HeaderView({heroArray:this.heroArray,expertData:this.expertData})
OneSection()
FourSection()
OtherList()
}
}.alignContent(Alignment.Top)
}
.width('100%')
.height('100%')
@@ -21,10 +21,10 @@ export struct FourSection {
// new MyPageSectionClass('threeItem',this.pushIconPath,this.pushStatus,''),
// new MyPageSectionClass('fourItem',$r('app.media.my_page_version'),'发现新版本','')
new MyPageSectionClass('oneItem',$r('app.media.my_page_choosePhone'),'更换手机号','pages/MinePage/ChangePhonePage'),
new MyPageSectionClass('twoItem',this.pushIconPath,this.pushStatus,''),
new MyPageSectionClass('threeItem',$r('app.media.my_page_guanyu_icon'),'关于肝胆相照','pages/WebView/WebPage'),
new MyPageSectionClass('fourItem',$r('app.media.my_page_zhibo_icon'),'肝胆相照直播群','pages/WebView/WebPage')
new MyPageSectionClass('oneItem',$r('app.media.my_page_choosePhone'),'更换手机号','pages/MinePage/ChangePhonePage',false),
new MyPageSectionClass('twoItem',this.pushIconPath,this.pushStatus,'',false),
new MyPageSectionClass('threeItem',$r('app.media.my_page_guanyu_icon'),'关于肝胆相照','pages/WebView/WebPage',false),
new MyPageSectionClass('fourItem',$r('app.media.my_page_zhibo_icon'),'肝胆相照直播群','pages/WebView/WebPage',false)
];
aboutToAppear() {
@@ -60,7 +60,7 @@ export struct FourSection {
// 更新数组中的标题
this.fourSectionList = this.fourSectionList.map((item, index) => {
if (index === 1) {
return new MyPageSectionClass(item.id, this.pushIconPath, this.pushStatus, item.path);
return new MyPageSectionClass(item.id, this.pushIconPath, this.pushStatus, item.path,false);
}
return item;
});
@@ -33,8 +33,8 @@ export struct HeaderView {
@State heroIndex: number = 0 // 当前页索引
@State photoPath:string = BasicConstant.urlImage+authStore.getUser().photo;
@State name:string = authStore.getUser().realName;
@State myPageData:object = new Object;
@State heroArray:Array<object> = [];
@Prop heroArray:Array<object> = [];
@Prop expertData:object | string= new Object;
@State clickHeroId:string = '';
@Consume@Watch('gotoTop')
toTop:boolean;
@@ -48,11 +48,9 @@ export struct HeaderView {
aboutToAppear(): void {
this.uploadUserDataAction();
this.uploadBackImgAction();
emitter.on({ eventId: BasicConstant.notification_home_tab_change }, (eventData: emitter.EventData) => {
if (eventData.data?.changeIndex === 2) {
this.uploadUserDataAction();
this.uploadBackImgAction();
}
});
}
@@ -81,103 +79,82 @@ export struct HeaderView {
})
}
uploadBackImgAction() {
const hashMap: HashMap<string, string> = new HashMap();
hdHttp.httpReq<string>(BasicConstant.myData,hashMap).then(async (res: HdResponse<string>) => {
console.info(`我的背景图: ${res}`);
let json:RequestDefaultModel = JSON.parse(res+'') as RequestDefaultModel;
if(json.code == '200') {
this.heroArray = json.data["honor_list"];
this.myPageData = json.data;
// 获取ranking值(带安全类型转换)
const ranking: string = this.myPageData["ranking"]?.toString() ?? "";
if (Number(ranking) > 0) {
// 创建排名对象
const rankDic: heroFirst = {
"id": "ranking",
"nick_name": `随访达人 I 排名${ranking}`
};
// 插入数组首位
this.heroArray.unshift(rankDic);
}
} else {
console.error('我的背景图:'+json.message)
}
}).catch((err: BusinessError) => {
console.info(`Response login fail: ${err}`);
})
}
handleAvatarClick() {
router.pushUrl({url:'pages/MinePage/EditUserDataPage'})
}
build() {
// Row() {
Column({space:5}) {
Row({space:10}) {
Image(this.photoPath)
.alt($r('app.media.userPhoto_default'))
.margin({left:15})
.width(60)
.height(60)
.borderRadius(5)
.objectFit(ImageFit.Cover)
.onClick(()=>this.handleAvatarClick())
Column({space:5}) {
Text(this.name)
.fontSize(18)
.fontColor('#FFFFFF')
.onClick(()=>this.handleAvatarClick())
List({space:5,initialIndex:this.heroIndex,scroller:this.scrollerForList}) {
ForEach(this.heroArray, (item: heroFirst) => {
ListItem() {
Row() {
Image(item.id === 'ranking'?$r('app.media.my_home_hero_ranking'):$r('app.media.my_page_header_hertIcon'))
.width(13)
.height(13)
.margin({left:7})
Text(item.nick_name)
.fontColor(Color.White)
.fontSize(11)
.margin({left:4,right:10})
}
.height(18)
.margin({right:5})
.borderRadius(9)
.borderWidth(1)
.borderColor(Color.White)
.onClick(()=>{
if (item.id !== 'ranking') {
this.clickHeroId = item.id;
this.dialogController.open();
}
})
}
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
.height(18)
}
.alignItems(HorizontalAlign.Start)
Column({space:15}) {
Row({space:10}) {
Image(this.photoPath)
.alt($r('app.media.userPhoto_default'))
.margin({left:15})
.width(60)
.height(60)
.width('70%')
.margin({top:22})
.borderRadius(5)
.objectFit(ImageFit.Cover)
.onClick(()=>this.handleAvatarClick())
Column({space:5}) {
Text(this.name)
.fontSize(18)
.fontColor('#FFFFFF')
.onClick(()=>this.handleAvatarClick())
List({space:5,initialIndex:this.heroIndex,scroller:this.scrollerForList}) {
ForEach(this.heroArray, (item: heroFirst) => {
ListItem() {
Row() {
Image(item.id === 'ranking'?$r('app.media.my_home_hero_ranking'):$r('app.media.my_page_header_hertIcon'))
.width(13)
.height(13)
.margin({left:7})
Text(item.nick_name)
.fontColor(Color.White)
.fontSize(11)
.margin({left:4,right:10})
}
.height(18)
.margin({right:5})
.borderRadius(9)
.borderWidth(1)
.borderColor(Color.White)
.onClick(()=>{
if (item.id !== 'ranking') {
this.clickHeroId = item.id;
this.dialogController.open();
}
})
}
})
}
.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
.height(18)
}.alignItems(HorizontalAlign.Start).width('calc(100% - 100vp)')
}.width('100%').margin({top:20})
Column(){
Row({space:70}){
ForEach([{'title':'随访患者数','content':this.expertData['expert_apply_num'] || '0'},
{'title':'公益咨询数','content':this.expertData['consult_total_num'] || '0'}],
// {'title':'患者送花数','content':this.expertData['ping_flowewr_num'] || '0'}],
(item:object)=>{
Column(){
Text(item['content']?.toString() || '0')
.fontSize(20)
.fontColor('#000000')
.height(28)
Text(item['title'])
.fontSize(12)
.fontColor('#333333')
.height(17)
}.height('100%').justifyContent(FlexAlign.Center)
})
}
.width('100%')
.height(97)
}
.width('100%')
.height(97)
.backgroundImage(this.myPageData["myInfoBackGround"]).backgroundImageSize(ImageSize.Cover)
}.width('95%').height(65).borderRadius(5).backgroundColor(Color.White)
}
// }
gotoTop()
{
.width('100%')
}
gotoTop() {
this.photoPath = BasicConstant.urlImage+authStore.getUser().photo;
}
}
@@ -5,15 +5,19 @@ export struct MyPageSectionItem {
@Prop sectionItem: MyPageSectionClass;
build() {
Column(){
Image(this.sectionItem.imageSrc)
.width(35).height(35)
.borderRadius(17.5)
.objectFit(ImageFit.Auto)
Text(this.sectionItem.title)
.fontSize(12)
.fontColor(Color.Black)
.margin({top:6})
}
Stack() {
Column() {
Image(this.sectionItem.imageSrc)
.width(24).height(24)
.objectFit(ImageFit.Auto)
Text(this.sectionItem.title)
.fontSize(14)
.fontColor('#333333')
.margin({ top: 10 })
}.width('100%')
if (this.sectionItem.status) {
Text().backgroundColor(Color.Red).width(10).height(10).borderRadius(5)
}
}.width('100%').height('100%').alignContent(Alignment.TopEnd)
}
}
@@ -1,19 +1,34 @@
import { it } from "@ohos/hypium";
import { MyPageSectionClass } from "../model/MyPageSectionClass";
import { MyPageSectionItem } from '../view/MyPageSectionItem'
import { router } from "@kit.ArkUI";
import { BasicConstant,hdHttp, HdResponse ,logger,authStore} from '@itcast/basic/Index'
import { BusinessError } from '@kit.BasicServicesKit';
import { it } from "@ohos/hypium";
interface extraData {
expertUuid: string
}
interface requestCallBack {
code:string;
msg:string;
message:string;
data:Array<object>
}
@Preview
@Component
export struct OneSection {
@State sectionTitle: string = "随访服务";
@State currentIndex: number = 0;
@Consume@Watch('gotoTop')
toTop:boolean;
@State oneSectionList: Array<MyPageSectionClass> = [
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'), '群发消息', '/pages/MyHomePage'),
new MyPageSectionClass('fourItem', $r('app.media.app_icon'), '随访二维码', '/pages/MyHomePage'),
new MyPageSectionClass('fiveItem', $r('app.media.app_icon'), '出诊计划', '/pages/MyHomePage')
new MyPageSectionClass('oneItem', $r('app.media.my_page_patientAudit'), '患者审核', '/pages/MyHomePage',false),
new MyPageSectionClass('twoItem', $r('app.media.my_page_patientList'), '患者分组', '/pages/MyHomePage',false),
new MyPageSectionClass('threeItem', $r('app.media.my_page_message'), '群发消息', '/pages/MyHomePage',false),
new MyPageSectionClass('fourItem', $r('app.media.my_page_QrCode'), '随访二维码', '/pages/MyHomePage',false),
new MyPageSectionClass('fiveItem', $r('app.media.my_page_visitPlan'), '出诊计划', '/pages/MyHomePage',false)
];
private getPagedItems(): Array<Array<MyPageSectionClass>> {
@@ -25,6 +40,35 @@ export struct OneSection {
return pages;
}
aboutToAppear(): void {
this.getApplyListData();
}
gotoTop() {
this.getApplyListData();
}
getApplyListData(){
hdHttp.post<string>(BasicConstant.applyList, {
expertUuid: authStore.getUser().uuid,
} as extraData).then(async (res: HdResponse<string>) => {
logger.info('Response applyList'+res);
let json:requestCallBack = JSON.parse(res+'') as requestCallBack;
if(json.code == '1') {
if (json.data.length > 0) {
this.oneSectionList = this.oneSectionList.map((item, index) => {
if (index === 0) {
return new MyPageSectionClass(item.id,item.imageSrc,item.title,item.path,true);
}
return item;
});
}
}
}).catch((err: BusinessError) => {
console.info(`Response fails: ${err}`);
})
}
build() {
Column() {
// 标题
@@ -42,6 +86,17 @@ export struct OneSection {
ForEach(pageItems, (item: MyPageSectionClass) => {
GridItem() {
MyPageSectionItem({ sectionItem: item })
.onClick(()=>{
if (item.title === '患者审核') {
router.pushUrl({
url:'pages/PatientsPage/PatientPages'
})
} else if (item.title === '患者分组') {
router.pushUrl({
url:'pages/PatientsPage/PatientsGroupPage'
})
}
})
}
}, (item: MyPageSectionClass) => item.id)
}
@@ -51,13 +106,13 @@ export struct OneSection {
.height('100%')
.width('100%')
})
}
}.width('100%')
.index(this.currentIndex)
.onChange((index: number) => {
this.currentIndex = index;
})
.height(78)
.indicator(false)
.indicator(false).loop(false)
Row() {
ForEach(new Array(Math.ceil(this.oneSectionList.length / 4)).fill(0), (item: number, idx: number) => {
@@ -9,12 +9,12 @@ export struct ThreeSection {
@State currentIndex: number = 0;
@State threeSectionList:Array<MyPageSectionClass> = [
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'),'我的福利','/pages/MyHomePage'),
new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'我的鲜花','/pages/MyHomePage'),
new MyPageSectionClass('fiveItem',$r('app.media.app_icon'),'课件明细','/pages/MyHomePage'),
new MyPageSectionClass('fiveItem',$r('app.media.app_icon'),'课程明细','/pages/MyHomePage')
new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'我的账户','/pages/MyHomePage',false),
new MyPageSectionClass('twoItem',$r('app.media.app_icon'),'我的积分','/pages/MyHomePage',false),
new MyPageSectionClass('threeItem',$r('app.media.app_icon'),'我的福利','/pages/MyHomePage',false),
new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'我的鲜花','/pages/MyHomePage',false),
new MyPageSectionClass('fiveItem',$r('app.media.app_icon'),'课件明细','/pages/MyHomePage',false),
new MyPageSectionClass('fiveItem',$r('app.media.app_icon'),'课程明细','/pages/MyHomePage',false)
];
private getPagedItems(): Array<Array<MyPageSectionClass>> {
@@ -9,10 +9,10 @@ export struct TwoSection {
@State currentIndex: number = 0;
@State twoSectionList:Array<MyPageSectionClass> = [
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'),'我的下载','/pages/MyHomePage'),
new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'我的收藏','/pages/MyHomePage')
new MyPageSectionClass('oneItem',$r('app.media.app_icon'),'我的视频','/pages/MyHomePage',false),
new MyPageSectionClass('twoItem',$r('app.media.app_icon'),'我的课程','/pages/MyHomePage',false),
new MyPageSectionClass('threeItem',$r('app.media.app_icon'),'我的下载','/pages/MyHomePage',false),
new MyPageSectionClass('fourItem',$r('app.media.app_icon'),'我的收藏','/pages/MyHomePage',false)
];
private getPagedItems(): Array<Array<MyPageSectionClass>> {
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB