群发消息与页面刷新

This commit is contained in:
XiuYun CHEN
2025-08-01 17:18:36 +08:00
parent 3f58565a76
commit 92b91dd65e
23 changed files with 512 additions and 185 deletions
@@ -6,14 +6,15 @@ import { HashMap,JSON } from "@kit.ArkTS";
import { BusinessError } from "@kit.BasicServicesKit";
import { promptAction, router } from "@kit.ArkUI";
import { PullToRefreshLayout, RefreshController } from "refreshlib";
import { HMLifecycleState, HMPopInfo, HMRouterMgr } from "@hadss/hmrouter";
import { HMLifecycleState, HMPopInfo, HMRouter, HMRouterMgr } from "@hadss/hmrouter";
@HMRouter({ pageUrl: 'MassSendingComp' })
@Component
export struct GroupMessageSendingComp {
@State pageNumber: number = 1
@State totalPage: number = 1
scroller = new Scroller()
@State messageList: ApiItem[] = []
private params: ESObject = HMRouterMgr.getCurrentParam()
public controller: RefreshController = new RefreshController()
private lifecycleOwner = HMRouterMgr.getCurrentLifecycleOwner()
private handleCallback = () => {
@@ -124,9 +125,9 @@ export struct GroupMessageSendingComp {
title: '群发消息',
showRightText: false,
showRightIcon: false,
isLeftAction: true,
leftItemAction: () => {
router.back()
isLeftAction:this.params?true:false,
leftItemAction:()=>{
HMRouterMgr.pop()
}
})
@@ -97,6 +97,7 @@ export struct PatientApplyPage {
let json:applyListCallBacl = JSON.parse(res+'') as applyListCallBacl;
if(json.code == 1) {
if (status == '2') {
this.submintMessage(model.patientUuid+'')
this.getApplyList();
// 添加单个患者
const singlePatient: PatientData = {
@@ -119,10 +120,13 @@ export struct PatientApplyPage {
console.info('添加失败');
}
promptAction.showToast({ message: '消息已处理', duration: 1000 })
router.pushUrl({
url:'pages/PatientsPage/PatientMsgSetPage',
params:{ 'model':model }
})
// router.pushUrl({
// url:'pages/PatientsPage/PatientMsgSetPage',
// params:{ 'model':model }
// })
HMRouterMgr.push({ pageUrl: 'PatientSetMsgPage' , param: {
'model': model
} })
} else if (status == '3') {
this.pageNumber = 1;
this.getApplyList();
@@ -225,4 +229,27 @@ export struct PatientApplyPage {
}
}.width('100%').height('100%').backgroundColor('#f4f4f4')
}
submintMessage(patient_user_uuid:string) {
const hashMap: HashMap<string, string> = new HashMap();
hashMap.set('msg_type','1')
hashMap.set('msg_content','你好,我已经是你的随访医生了')
hashMap.set('patient_user_uuid',patient_user_uuid)
// this.dialog.open()
hdHttp.httpReq<string>(BasicConstant.addGroupSendMsg4YunXin,hashMap).then(async (res: HdResponse<string>) => {
// this.dialog.close();
// logger.info('Response addGroupSendMsg4YunXin'+res);
// let json:Record<string,string> = JSON.parse(res+'') as Record<string,string>;
// if(json.code == '200') {
// promptAction.showToast({ message: '消息已发出', duration: 1000 })
//
// } else {
// console.error('群发消息失败:'+json.message)
// promptAction.showToast({ message: json.message, duration: 1000 })
// }
}).catch((err: BusinessError) => {
this.dialog.close();
console.info(`Response fails: ${err}`);
})
}
}