角标,小红点,群发消息
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
"@polyvharmony/media-player-sdk": "2.5.0",
|
||||
"@polyvharmony/media-player-sdk-addon-cache-down": "2.5.0",
|
||||
"scene_single_video": "file:../../scene_single_video",
|
||||
"media-player-common": "file:../../polyv"
|
||||
"media-player-common": "file:../../polyv",
|
||||
"@nimkit/chatkit": "file:../../chatkit"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { iconsModel } from '../model/HomeModel'
|
||||
import { patientDbManager, PatientEntity } from '@itcast/basic';
|
||||
import { promptAction, router } from '@kit.ArkUI';
|
||||
import { HomeModel, iconsModel } from '../model/HomeModel'
|
||||
import { BasicConstant, hdHttp, HdResponse, patientDbManager, PatientEntity } from '@itcast/basic';
|
||||
import { promptAction, router, UIObserver, uiObserver } from '@kit.ArkUI';
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import { pushService } from '@kit.PushKit';
|
||||
|
||||
@@ -9,18 +9,34 @@ import { pushService } from '@kit.PushKit';
|
||||
// name:string;
|
||||
// isRed:boolean;
|
||||
// }
|
||||
import { ChatKitClient, LocalConversationRepo } from '@nimkit/chatkit';
|
||||
import { HashMap } from '@kit.ArkTS';
|
||||
|
||||
@Component
|
||||
export struct HomeIconComp {
|
||||
@Prop iconList: iconsModel[];
|
||||
@State patientIcon: string = '';
|
||||
@State patientName: string = '我的患者';
|
||||
@State patientRed: boolean = false;
|
||||
@State videoIcon: string = '';
|
||||
@State videoName: string = '肝胆视频';
|
||||
@State zixunIcon: string = '';
|
||||
@State consultation: string = '公益咨询';
|
||||
@State consultationRed: boolean = false;
|
||||
@State iconListtmp:iconsModel[]=[];
|
||||
listener: (info: uiObserver.RouterPageInfo) => void = (info: uiObserver.RouterPageInfo) => {
|
||||
let routerInfo: uiObserver.RouterPageInfo | undefined = this.queryRouterPageInfo();
|
||||
if (info.pageId == routerInfo?.pageId) {
|
||||
if (info.state == uiObserver.RouterPageState.ON_PAGE_SHOW) {
|
||||
this.getRedCount()
|
||||
} else if (info.state == uiObserver.RouterPageState.ON_PAGE_HIDE) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
aboutToAppear(): void {
|
||||
let uiObserver: UIObserver = this.getUIContext().getUIObserver();
|
||||
uiObserver.on('routerPageUpdate', this.listener);
|
||||
for (const icons of this.iconList) {
|
||||
if (icons.name === '我的患者') {
|
||||
this.patientIcon = icons.img;
|
||||
@@ -30,19 +46,91 @@ export struct HomeIconComp {
|
||||
this.zixunIcon = icons.img
|
||||
}
|
||||
}
|
||||
this.initList()
|
||||
// for (let index = 0; index < this.iconList!.length; index++) {
|
||||
// const iconModel = this.iconList![index] as iconsModel ;
|
||||
// if (index == 0) {
|
||||
// iconModel.isRed = true;
|
||||
// }
|
||||
// }
|
||||
this.getRedCount()
|
||||
}
|
||||
|
||||
for (let index = 0; index < this.iconList!.length; index++) {
|
||||
const iconModel = this.iconList![index] as iconsModel ;
|
||||
if (index == 0) {
|
||||
iconModel.isRed = true;
|
||||
aboutToDisappear(): void {
|
||||
let uiObserver: UIObserver = this.getUIContext().getUIObserver();
|
||||
uiObserver.off('routerPageUpdate', this.listener);
|
||||
}
|
||||
|
||||
async getRedCount()
|
||||
{
|
||||
let unreadCount = LocalConversationRepo.getTotalUnreadCount() ?? 0
|
||||
let consultcount=0
|
||||
const result = await LocalConversationRepo.getConversationList(0,100)
|
||||
if(result!=null&&result.conversationList!=null)
|
||||
{
|
||||
for (const conversation of result.conversationList) {
|
||||
const uuid = ChatKitClient.nim.conversationIdUtil.parseConversationTargetId(conversation.conversationId);
|
||||
// 假设 selectUserStyleWithModel 返回 "1" 表示 type=1
|
||||
const style = await patientDbManager.getPatientTypeByUuid(uuid);
|
||||
if (style != 1) {
|
||||
if(conversation.unreadCount>0)
|
||||
{
|
||||
consultcount++
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
unreadCount=unreadCount-consultcount
|
||||
if(unreadCount>0)
|
||||
{
|
||||
this.patientRed=true
|
||||
}
|
||||
else
|
||||
{
|
||||
this.patientRed=false
|
||||
}
|
||||
if(consultcount>0)
|
||||
{
|
||||
this.consultationRed=true
|
||||
}
|
||||
|
||||
this.initList()
|
||||
const hashMap: HashMap<string, string> = new HashMap();
|
||||
hdHttp.httpReq<string>(BasicConstant.indexV2,hashMap).then(async (res: HdResponse<string>) => {
|
||||
let json:HomeModel = JSON.parse(res+'') as HomeModel;
|
||||
if(json.data!=null&&json.data.consult_list!=null&&json.data.consult_list.list!=null)
|
||||
{
|
||||
consultcount=consultcount>0?consultcount:json.data.consult_list.list.length
|
||||
if(consultcount>0)
|
||||
{
|
||||
this.consultationRed=true
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.consultationRed=false
|
||||
}
|
||||
this.initList()
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
initList()
|
||||
{
|
||||
this.iconListtmp=[...[{ 'img': this.patientIcon, 'name': this.patientName,'isRed':this.patientRed } as iconsModel,
|
||||
{ 'img': this.videoIcon, 'name': this.videoName} as iconsModel,
|
||||
{'img':this.zixunIcon,'name':this.consultation,'isRed':this.consultationRed} as iconsModel]]
|
||||
}
|
||||
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Grid() {
|
||||
ForEach([{ 'img': this.patientIcon, 'name': this.patientName },{ 'img': this.videoIcon, 'name': this.videoName},{'img':this.zixunIcon,'name':this.consultation}], (item: iconsModel) => {//this.iconList
|
||||
ForEach(this.iconListtmp, (item: iconsModel) => {//this.iconList
|
||||
GridItem(){
|
||||
Stack() {
|
||||
Column() {
|
||||
@@ -76,4 +164,5 @@ export struct HomeIconComp {
|
||||
}.width('100%').backgroundColor(Color.White)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -170,4 +170,5 @@ export struct HomePage {
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { TabBarCompModel } from '../model/TabBarCompModel'
|
||||
import { TabBarItems } from '../components/TabBarItems'
|
||||
import { authStore, BasicConstant, hdHttp, HdLoadingDialog, HdResponse } from '@itcast/basic'
|
||||
import { authStore, BasicConstant, hdHttp, HdLoadingDialog, HdResponse,
|
||||
NotificationManagementUtil } from '@itcast/basic'
|
||||
import { MessageComp } from '../view/MessageComp'
|
||||
import { PatientListComp, updateExtraData } from './PatientListComp'
|
||||
import { applyListCallBacl, FollowPlanListComp } from 'patient'
|
||||
import { HMLifecycleState, HMRouterMgr } from '@hadss/hmrouter'
|
||||
import { BusinessError } from '@kit.BasicServicesKit'
|
||||
import { LocalConversationRepo } from '@nimkit/chatkit'
|
||||
|
||||
@Component
|
||||
export struct TabBarComp {
|
||||
@@ -17,6 +19,8 @@ export struct TabBarComp {
|
||||
private lifecycleOwner = HMRouterMgr.getCurrentLifecycleOwner()
|
||||
private handleCallback = () => {
|
||||
this.getApplyList()
|
||||
let unreadCount=LocalConversationRepo.getTotalUnreadCount() ?? -1
|
||||
NotificationManagementUtil.setBadgeNumber(unreadCount)
|
||||
}
|
||||
aboutToAppear() {
|
||||
this.getApplyList()
|
||||
|
||||
@@ -67,7 +67,8 @@ export struct SendGroupMessageComp {
|
||||
if (this.isPossessList) {
|
||||
this.submintMessage("5")
|
||||
} else {
|
||||
HMRouterMgr.push({})
|
||||
|
||||
HMRouterMgr.push({pageUrl:'OutpatientComp',param:"send"})
|
||||
}
|
||||
this.outpatient.close();
|
||||
}
|
||||
@@ -168,16 +169,25 @@ export struct SendGroupMessageComp {
|
||||
logger.info('Response stopOutPatientList'+res);
|
||||
let json:Record<string,string> = JSON.parse(res+'') as Record<string,string>;
|
||||
if(json.code == '200') {
|
||||
if (Array.isArray(json.data)) {
|
||||
const data:Array<Record<string,string>> = json.data
|
||||
if (data.length>0) {
|
||||
this.isPossessList = true
|
||||
} else {
|
||||
this.getListOutPatient()
|
||||
}
|
||||
} else {
|
||||
let json = JSON.parse(res+'') as Record<string, object>;
|
||||
let datas:[]=json.data as []
|
||||
if(datas!=null&&datas.length>0)
|
||||
{
|
||||
this.isPossessList=true
|
||||
}
|
||||
else {
|
||||
this.getListOutPatient()
|
||||
}
|
||||
// if (Array.isArray(json.data)) {
|
||||
// const data:Array<Record<string,string>> = json.data
|
||||
// if (data.length>0) {
|
||||
// this.isPossessList = true
|
||||
// } else {
|
||||
// this.getListOutPatient()
|
||||
// }
|
||||
// } else {
|
||||
// this.getListOutPatient()
|
||||
// }
|
||||
} else {
|
||||
console.error('停/出诊公告列表失败:'+json.message)
|
||||
promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
@@ -197,12 +207,19 @@ export struct SendGroupMessageComp {
|
||||
logger.info('Response listOutPatient'+res);
|
||||
let json:Record<string,string> = JSON.parse(res+'') as Record<string,string>;
|
||||
if(json.code == '200') {
|
||||
if (Array.isArray(json.data)) {
|
||||
const data:Array<Record<string,string>> = json.data
|
||||
if (data.length>0) {
|
||||
this.isPossessList = true
|
||||
}
|
||||
let json = JSON.parse(res+'') as Record<string, object>;
|
||||
let json1=json.data as Record<string, object>
|
||||
let datas:[]=json1.list as []
|
||||
if(datas!=null&&datas.length>0)
|
||||
{
|
||||
this.isPossessList=true
|
||||
}
|
||||
// if (Array.isArray(json.data)) {
|
||||
// const data:Array<Record<string,string>> = json.data
|
||||
// if (data.length>0) {
|
||||
// this.isPossessList = true
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
console.error('门诊列表失败:'+json.message)
|
||||
promptAction.showToast({ message: json.message, duration: 1000 })
|
||||
|
||||
Reference in New Issue
Block a user