From cbf50189cce684e6e260f1798a0801b6bf4a2294 Mon Sep 17 00:00:00 2001 From: XiuYun CHEN Date: Fri, 18 Jul 2025 17:26:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E4=BF=A1=E5=8F=91=E9=80=81=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chatkit/src/main/ets/ChatKitClient.ets | 22 +- chatkit_ui/oh-package.json5 | 3 +- chatkit_ui/src/main/ets/pages/ChatP2PPage.ets | 189 ++- .../src/main/ets/pages/ChatP2PPageCopy.ets | 1492 +++++++++++++++++ .../src/main/ets/pages/QuickMessagePage.ets | 37 +- .../main/ets/view/MessageComponentBuilder.ets | 20 +- .../resources/base/profile/route_map.json | 16 - .../ets/builder/NavigationBackBuilder.ets | 6 +- .../main/resources/base/element/color.json | 4 + commons/basic/Index.ets | 4 +- .../src/main/ets/Views/PerfactInputSheet.ets | 10 +- .../src/main/ets/components/HdSearchNav.ets | 8 +- .../src/main/ets/constants/BasicConstant.ets | 6 + .../src/main/ets/models/ChatExtModel.ets | 4 +- .../src/main/ets/models/PatientListModel.ets | 37 + .../resources/base/media/argee_commient.png | Bin 0 -> 1678 bytes .../main/resources/base/media/arrow_right.png | Bin 0 -> 1206 bytes .../src/main/resources/base/media/cb_hot.png | Bin .../src/main/resources/base/media/cb_new.png | Bin .../resources/base/media/edit_patitent.png | Bin 0 -> 1667 bytes .../main/resources/base/media/new_patient.png | Bin 0 -> 5968 bytes .../resources/base/media/patientgroup.png | Bin 0 -> 5112 bytes .../resources/base/media/read_commient.png | Bin 0 -> 1964 bytes .../main/resources/base/media/search_no.png | Bin 0 -> 1525 bytes .../base/media/triangle_green_theme.png | Bin .../resources/base/media/triangle_normal.png | Bin .../Home/src/main/ets/polyv/VideoUtil.ets | 69 + features/netease/oh-package.json5 | 2 +- .../main/ets/components/ItemCompPublic.ets | 71 +- .../src/main/ets/components/ItemCompTeach.ets | 122 ++ .../ets/components/ItemCompTeachVideo.ets | 114 ++ .../main/ets/components/ListCompPublic.ets | 4 +- .../netease/src/main/ets/model/Groups.ets | 14 + .../netease/src/main/ets/model/TeachModel.ets | 31 + .../src/main/ets/model/TeachVideoModel.ets | 31 + .../main/ets/model/patientVideoTypeModel.ets | 20 + .../main/ets/view/ConsultationDetailComp.ets | 69 +- .../netease/src/main/ets/view/MessageComp.ets | 4 +- .../src/main/ets/view/PatientListComp.ets | 440 +++++ .../src/main/ets/view/QuictDoctorComp.ets | 4 +- .../netease/src/main/ets/view/SearchComp.ets | 228 +++ .../netease/src/main/ets/view/TabBarComp.ets | 8 +- .../main/ets/view/TabBarConsultationComp.ets | 4 +- .../src/main/ets/view/TabBarTopComp.ets | 4 +- .../netease/src/main/ets/view/TuwenComp.ets | 212 +++ .../src/main/ets/view/VideoTeachComp.ets | 322 ++++ .../main/ets/pages/LocalConversationPage.ets | 54 +- .../ets/pages/LocalConversationPageCopy.ets | 363 ++++ .../resources/base/profile/route_map.json | 16 +- products/expert/src/main/ets/pages/Index.ets | 9 +- .../pages/Netease/ConsultationDetailPage.ets | 34 +- .../pages/Netease/PublicConsultationPage.ets | 46 +- .../src/main/ets/pages/Netease/imTabPage.ets | 49 +- .../VideoPage/PLVMediaPlayerOnlyVideoPage.ets | 292 ++++ .../resources/base/profile/main_pages.json | 4 +- 55 files changed, 4298 insertions(+), 200 deletions(-) create mode 100644 chatkit_ui/src/main/ets/pages/ChatP2PPageCopy.ets create mode 100644 commons/basic/src/main/ets/models/PatientListModel.ets create mode 100644 commons/basic/src/main/resources/base/media/argee_commient.png create mode 100644 commons/basic/src/main/resources/base/media/arrow_right.png rename {features/Home => commons/basic}/src/main/resources/base/media/cb_hot.png (100%) rename {features/Home => commons/basic}/src/main/resources/base/media/cb_new.png (100%) create mode 100644 commons/basic/src/main/resources/base/media/edit_patitent.png create mode 100644 commons/basic/src/main/resources/base/media/new_patient.png create mode 100644 commons/basic/src/main/resources/base/media/patientgroup.png create mode 100644 commons/basic/src/main/resources/base/media/read_commient.png create mode 100644 commons/basic/src/main/resources/base/media/search_no.png rename {features/Home => commons/basic}/src/main/resources/base/media/triangle_green_theme.png (100%) rename {features/Home => commons/basic}/src/main/resources/base/media/triangle_normal.png (100%) create mode 100644 features/netease/src/main/ets/components/ItemCompTeach.ets create mode 100644 features/netease/src/main/ets/components/ItemCompTeachVideo.ets create mode 100644 features/netease/src/main/ets/model/Groups.ets create mode 100644 features/netease/src/main/ets/model/TeachModel.ets create mode 100644 features/netease/src/main/ets/model/TeachVideoModel.ets create mode 100644 features/netease/src/main/ets/model/patientVideoTypeModel.ets create mode 100644 features/netease/src/main/ets/view/PatientListComp.ets create mode 100644 features/netease/src/main/ets/view/SearchComp.ets create mode 100644 features/netease/src/main/ets/view/TuwenComp.ets create mode 100644 features/netease/src/main/ets/view/VideoTeachComp.ets create mode 100644 localconversationkit_ui/src/main/ets/pages/LocalConversationPageCopy.ets create mode 100644 products/expert/src/main/ets/pages/VideoPage/PLVMediaPlayerOnlyVideoPage.ets diff --git a/chatkit/src/main/ets/ChatKitClient.ets b/chatkit/src/main/ets/ChatKitClient.ets index a32029c..4d630e9 100644 --- a/chatkit/src/main/ets/ChatKitClient.ets +++ b/chatkit/src/main/ets/ChatKitClient.ets @@ -15,6 +15,7 @@ import { V2NIMDataSyncType, V2NIMEnableServiceType, V2NIMError, + V2NIMKickedOfflineDetail, V2NIMLoginStatus, V2NIMMessageRevokeNotification } from '@nimsdk/base'; @@ -23,6 +24,8 @@ import { KitLogger } from './logger/AppLogger'; import { LoggerKitImpl } from './logger/LoggerKitImpl'; import { ChatRepo } from './repo/ChatRepo'; import { saveLocalRevokeMessageFormOther } from './utils/MessageUtils'; +import { router } from '@kit.ArkUI'; +import { HMRouterMgr } from '@hadss/hmrouter'; export const currentConversationChanged: string = 'CurrentConversationChanged' @@ -57,7 +60,13 @@ export class ChatKitClient { * 可用于判断网络是否断开 */ static connectBroken() { - return ChatKitClient.nim.loginService.getConnectStatus() !== V2NIMConnectStatus.V2NIM_CONNECT_STATUS_CONNECTED + if(ChatKitClient.nim!=null&&ChatKitClient.nim!=undefined&&ChatKitClient.nim.loginService!=null&&ChatKitClient.nim.loginService!=undefined) + { + return ChatKitClient.nim.loginService.getConnectStatus() !== V2NIMConnectStatus.V2NIM_CONNECT_STATUS_CONNECTED + } + else + return false + } /** @@ -146,7 +155,9 @@ export class ChatKitClient { ChatRepo.offRevokeMessage(ChatKitClient.onRevokeFun) ChatKitClient.nim.conversationService?.off('onSyncFinished', ChatKitClient.onSyncFinishedFun) ChatKitClient.nim.loginService.off('onDataSync', ChatKitClient.dataSyncFun) + ChatKitClient.nim.loginService.off('onKickedOffline', (detail: V2NIMKickedOfflineDetail) => { + }) } /** @@ -157,6 +168,15 @@ export class ChatKitClient { return } console.info("netease ChatKitClient initListener "); + ChatKitClient.nim.loginService.on("onKickedOffline", (detail: V2NIMKickedOfflineDetail) => { + // const detail = ChatKitClient.nim.loginService.getKickedOfflineDetail() + console.log('Response onKickedOffline'+detail.clientType+' 22 '+detail.customClientType) + HMRouterMgr.removeAll() + router.replaceUrl({ + url: 'pages/LoginPage/LoginPage', // 目标url + },router.RouterMode.Single) + router.clear() + }) // 数据同步监听 ChatKitClient.nim.conversationService?.on('onSyncFinished', ChatKitClient.onSyncFinishedFun) ChatKitClient.nim.loginService.on('onDataSync', ChatKitClient.dataSyncFun) diff --git a/chatkit_ui/oh-package.json5 b/chatkit_ui/oh-package.json5 index 5b38157..c969cf3 100644 --- a/chatkit_ui/oh-package.json5 +++ b/chatkit_ui/oh-package.json5 @@ -13,7 +13,8 @@ "class-transformer": "^0.5.1", "reflect-metadata": "^0.1.13", '@nimkit/markdown': "1.1.0", - "@itcast/basic":"file:../commons/basic" + "@itcast/basic":"file:../commons/basic", // 用于嵌套对象@Type反射 + "home": "file:../features/Home" } } \ No newline at end of file diff --git a/chatkit_ui/src/main/ets/pages/ChatP2PPage.ets b/chatkit_ui/src/main/ets/pages/ChatP2PPage.ets index 4e6fa5a..2400d74 100644 --- a/chatkit_ui/src/main/ets/pages/ChatP2PPage.ets +++ b/chatkit_ui/src/main/ets/pages/ChatP2PPage.ets @@ -29,7 +29,7 @@ import { import { NECameraSelectView } from '../view/NECameraSelectView'; import { common } from '@kit.AbilityKit'; import { cameraPicker } from '@kit.CameraKit'; -import { LengthMetrics, window } from '@kit.ArkUI'; +import { LengthMetrics, promptAction, window } from '@kit.ArkUI'; import { NERectData } from '../model/NERectData'; import { MessageOperationView } from '../view/MessageOperationView'; import { MessageOperationItem, MessageOperationType } from '../model/MessageOperationItem'; @@ -78,12 +78,16 @@ import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInput import { hdHttp, HdResponse,BasicConstant, authStore, preferenceStore, ChatParam} from '@itcast/basic' import { HashMap } from '@kit.ArkTS'; import { customAttachment } from '../view/MessageComponentBuilder' - +import { HMRouter, HMRouterMgr, HMRouterPathCallback, HMRouterPathInfo } from '@hadss/hmrouter'; +@HMRouter({ + pageUrl: 'ChatP2PPage' +}) @ComponentV2 export struct ChatP2PPage { pathStack: NavPathStack = new NavPathStack() sessionId=''//患者的云信id patientUuid=''//患者uuid + @Local rightButtonEnable:boolean=true @Local chat_state:string='' @Local gdxz_sessionType:string= preferenceStore.getItemString('gdxz_sessionType') @Local statusBarHeight:number=0 @@ -113,7 +117,7 @@ export struct ChatP2PPage { navBarHeight: number = 80; // 底部输入框以及固定按钮操作栏高度 @Local bottomHeight: number = 65; - bottomMargin: number = 100; + @Local bottomMargin: number = 100; // bottomMargin: number = 10; bottomWithReplyHeight: number = 135; controller: RichEditorController = new RichEditorController() @@ -177,7 +181,34 @@ export struct ChatP2PPage { }) teachDialog: CustomDialogController = new CustomDialogController({ builder: TeachDialog({ + imgCallBack:()=>{ + const pathInfo1: HMRouterPathInfo = { + pageUrl: 'TuwenCompPage', + }; + const callback: HMRouterPathCallback = { + onResult: (popInfo: PopInfo) => { + const result = popInfo.result as string; + this.sendHelloMessage(result,BasicConstant.Teach); + } + }; + HMRouterMgr.push(pathInfo1,callback) + + }, + videoCallBack:()=>{ + const pathInfo1: HMRouterPathInfo = { + pageUrl: 'VideoTeach', + + }; + const callback: HMRouterPathCallback = { + onResult: (popInfo: PopInfo) => { + const result = popInfo.result as string; + this.sendHelloMessage(result,BasicConstant.VideoTeach); + } + }; + HMRouterMgr.push(pathInfo1,callback) + + } }), cornerRadius: 4, width: '70%', @@ -420,12 +451,30 @@ export struct ChatP2PPage { }) } + sendHelloMessage(rawAttach:string,messageType:string)//发送初始消息 + { + this.chatViewModel.sendCustomMessage(messageType, rawAttach) + } + paramData() + { + let param = HMRouterMgr.getCurrentParam() as ChatParam; + this.conversationId = param.conversationId; + this.showName= param.name+''; + this.chat_state=param.chat_state + this.loadChatData(); + if('true'==param.hasMessage) + { + this.sendHelloMessage(param.rawAttach,param.messageType) + } + if(this.chat_state=='3') + { + this.bottomMargin=10 + } + + +} aboutToAppear() { - if(this.chat_state=='3') - { - this.bottomHeight==0 - } NEEmojiManager.instance.setup(); DeviceUtils.rootDirPath = getContext(this).filesDir @@ -461,6 +510,7 @@ export struct ChatP2PPage { } }) }) + this. paramData() this.initDialog() this. getOutList() @@ -576,19 +626,30 @@ export struct ChatP2PPage { }); } - @Builder + build() { - NavDestination() { + // NavDestination() { + Column() + { NavigationBackBuilder({ title:this.showName , rightButtonIcon: this.gdxz_sessionType==BasicConstant.general ? $r('app.media.more') :undefined, rightButtonTitle: this.gdxz_sessionType==BasicConstant.consult && this.chat_state!='3'? '关闭会话' : undefined, + rightButtonColor:this.rightButtonEnable?$r('app.color.top_title'):$r('app.color.common_gray_03'), top:this.statusBarHeight, rightButtonAction: () => { - this.goToSettingPage(this.pathStack) + if( this.gdxz_sessionType==BasicConstant.consult && this.chat_state!='3'&&this.rightButtonEnable) + { + this.closeConsult() + } + else { + this.goToSettingPage(this.pathStack) + } + }, leftButtonAction: () => { - this.pathStack.pop() + // this.pathStack.pop() + HMRouterMgr.pop() } }) @@ -783,7 +844,7 @@ export struct ChatP2PPage { top: { anchor: "chatPageListView", align: VerticalAlign.Bottom }, }) - if (this.hideInput === false && !this.showMultiSelect&&this.chat_state!='3') { + if (this.hideInput === false && !this.showMultiSelect&&this.chat_state!='3'&&this.chat_state!='333') { NEChatInputView({ controller: this.controller, placeHolder: (this.chatUserInfo.conversationName ?? '').length > 15 ? @@ -949,15 +1010,26 @@ export struct ChatP2PPage { } else if (data.type == NEChatMoreOperationType.Reply) { - this.pathStack.pushPathByName( - 'QuckMessagePage', - {}, - (popInfo: PopInfo) => { // 接收B返回的参数 - const result = popInfo.result as string; + const pathInfo1: HMRouterPathInfo = { + pageUrl: 'QuickMessagePage', + + }; + const callback: HMRouterPathCallback = { + onResult: (popInfo: PopInfo) => { + const result = popInfo.result as string; this.setInputContent(result); - // console.log(`B页面返回数据:${result}`); - } - ) + } + }; + HMRouterMgr.push(pathInfo1,callback) + // this.pathStack.pushPathByName( + // 'QuckMessagePage', + // {}, + // (popInfo: PopInfo) => { // 接收B返回的参数 + // const result = popInfo.result as string; + // this.setInputContent(result); + // // console.log(`B页面返回数据:${result}`); + // } + // ) } else if (data.type == NEChatMoreOperationType.Teach) { this.teachDialog.open() @@ -1091,20 +1163,59 @@ export struct ChatP2PPage { .zIndex(1) } - .hideTitleBar(true) - .onReady((context: NavDestinationContext) => { - this.pathStack = context.pathStack - let param = this.pathStack.getParamByName("ChatP2PPage") as ChatParam[]; - if (param.length > 0) { - this.conversationId = param[0].conversationId; - this.showName= param[0].name+''; - this.chat_state=param[0].chat_state - this.loadChatData(); - } else { - this.pathStack.removeByName("ChatP2PPage") + // } + + // .hideTitleBar(true) + // .onReady((context: NavDestinationContext) => { + // this.pathStack = context.pathStack + // let param = this.pathStack.getParamByName("ChatP2PPage") as ChatParam[]; + // if (param.length > 0) { + // this.conversationId = param[0].conversationId; + // this.showName= param[0].name+''; + // this.chat_state=param[0].chat_state + // this.loadChatData(); + // if('true'==param[0].hasMessage&&BasicConstant.consult==param[0].gdxz_sessionType) + // { + // this.sendHelloMessage(param[0].rawAttach) + // } + // if(this.chat_state=='3') + // { + // this.bottomMargin=10 + // } + // + // } else { + // this.pathStack.removeByName("ChatP2PPage") + // } + // }).onHidden(() => { + // AudioPlayerManager.instance.stopPlayAll() + // }) + } + + closeConsult() + { + + hdHttp.post(BasicConstant.closeConsult, { + uuid:preferenceStore.getItemString('gdxz_consult_uuid'), + + } as extraData).then(async (res: HdResponse) => { + + let json = JSON.parse(res+'') as Record; + let data=json.code as string + if(data=='1') + { + promptAction.showToast({ message: "您已关闭会话,谢谢您的回答!" }); + this.rightButtonEnable=false + this.chat_state='333' + // this.chat_state='3' + this.bottomMargin=10 } - }).onHidden(() => { - AudioPlayerManager.instance.stopPlayAll() + else { + promptAction.showToast({ message: json.message }) + } + + + }).catch((err: BusinessError) => { + }) } @@ -1430,11 +1541,15 @@ export struct ChatP2PPage { } // 跳转页面入口函数 -@Builder -export function ChatP2PPageBuilder() { - ChatP2PPage() -} +// @Builder +// export function ChatP2PPageBuilder() { +// ChatP2PPage() +// } export interface patientDetailExtraData{ patientUuid:string +} + +export interface extraData{ + uuid:string } \ No newline at end of file diff --git a/chatkit_ui/src/main/ets/pages/ChatP2PPageCopy.ets b/chatkit_ui/src/main/ets/pages/ChatP2PPageCopy.ets new file mode 100644 index 0000000..d57e01e --- /dev/null +++ b/chatkit_ui/src/main/ets/pages/ChatP2PPageCopy.ets @@ -0,0 +1,1492 @@ +/* + * Copyright (c) 2022 NetEase, Inc. All rights reserved. + * Use of this source code is governed by a MIT license that can be + * found in the LICENSE file. + * + */ + +import { ChatUserInfo } from '../model/ChatUserInfo'; +import { NIMMessageInfo } from '../model/NIMMessageInfo'; +import { MessageComponent } from '../view/MessageComponent'; +import { ChatP2PViewModel } from '../viewmodel/ChatP2PViewModel'; +import { NEChatEmojiView } from '../view/NEChatEmojiView'; +import { NEEmojiManager, NEEmojiParseResult, NIMEmoticonType } from '../manager/NEEmojiManager'; +import { NEChatMoreOperation } from '../view/ChatMoreOperationLayout'; +import { NEChatMoreOperationData, NEChatMoreOperationType } from '../model/NEChatMoreOperationData'; +import { NEAudioRecordView } from '../view/NEAudioRecordView'; +import { InputStyleType, NEChatInputView } from '../view/ChatInputView'; +import { + DoubleAlertDialog, + ImagesIndexModel, + MediaUtils, + NavigationBackBuilder, + NECommonUtils, + NetworkBrokenBuilder, + PermissionsUtils, + UserUtils, + VideoViewerDialog +} from '@nimkit/common'; +import { NECameraSelectView } from '../view/NECameraSelectView'; +import { common } from '@kit.AbilityKit'; +import { cameraPicker } from '@kit.CameraKit'; +import { LengthMetrics, promptAction, window } from '@kit.ArkUI'; +import { NERectData } from '../model/NERectData'; +import { MessageOperationView } from '../view/MessageOperationView'; +import { MessageOperationItem, MessageOperationType } from '../model/MessageOperationItem'; +import { BusinessError, pasteboard } from '@kit.BasicServicesKit'; +import { DeviceUtils } from '../common/DeviceUtils'; +import { ImageViewDialog } from '@nimkit/common/src/main/ets/ImageViewDialog/ImageViewDialog'; +import { + V2NIMMessage, + V2NIMMessageAudioAttachment, + V2NIMMessageLocationAttachment, + V2NIMMessageSendingState, + V2NIMMessageType +} from '@nimsdk/base'; +import { ChatConst } from '../constants/ChatConst'; +import { ChatKitClient } from '@nimkit/chatkit/src/main/ets/ChatKitClient'; +import { AudioPlayerManager } from '../manager/AudioPlayerManager'; +import { + conversationSelectLimitCount, + ConversationSelectParam, + CustomMessageUtils, + ErrorUtils, + MergedMessageAttachment, + mergedMessageCustomType, + mergedMessageLimitCount, + mergedMessageMaxDepth, + singleMessageLimitCount +} from '@nimkit/chatkit'; +import { ConversationSelectModel } from '@nimkit/chatkit/src/main/ets/model/ConversationSelectModel'; +import { ForwardMessageDialog } from '../view/ForwardMessageDialog'; +import { photoAccessHelper } from '@kit.MediaLibraryKit'; +import { + downLoadAndOpenFile, + getMessageImageUrl, + getMessageImageUrls, + getMessageVideoRatio, + getMessageVideoUrl, + parseMessageText +} from '../common/MessageHelper'; +import { sceneMap } from '@kit.MapKit'; +import { computeOperateViewHeight, computeOperateViewWidth, setupMoreOperationData } from '../common/ChatUtils'; +import { ChatMultiSelectView } from '../view/ChatMultiSelectView'; +import { TextMessageDetailDialog } from '../view/TextMessageDetailDialog'; +import { TeachDialog } from '../view/TeachDialog'; +import { NewWaDialog } from '../view/NewWaDialog'; +import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet' +import { hdHttp, HdResponse,BasicConstant, authStore, preferenceStore, ChatParam} from '@itcast/basic' +import { HashMap } from '@kit.ArkTS'; +import { customAttachment } from '../view/MessageComponentBuilder' +import { HMRouterMgr } from '@hadss/hmrouter'; + +@ComponentV2 +export struct ChatP2PPage { + pathStack: NavPathStack = new NavPathStack() + sessionId=''//患者的云信id + patientUuid=''//患者uuid + @Local rightButtonEnable:boolean=true + @Local chat_state:string='' + @Local gdxz_sessionType:string= preferenceStore.getItemString('gdxz_sessionType') + @Local statusBarHeight:number=0 + @Local havestopout:boolean=false;//是否有出诊公告 + @Local chatUserInfo: ChatUserInfo = new ChatUserInfo(); + chatViewModel: ChatP2PViewModel = new ChatP2PViewModel(); + conversationId: string = ''; + // 底部扩展区域高度,默认为0 + @Local expandHeight: number = 0; + @Local inputStyle: InputStyleType = InputStyleType.None; + @Local hideInput: boolean = false; + @Local scrollHeight: number = 0; + @Local showOperationView: boolean = false; + @Local showMultiSelect: boolean = false; + @Local multiSelectCount: number = 0; + // 长按操作弹窗的边距值 + operationViewMargin: number = 12; + defaultInputViewHeight: number = 0; + // 长按操作选中的消息 + @Local operationMsg: NIMMessageInfo | undefined = undefined + @Local replyMsg: NIMMessageInfo | undefined = undefined + @Local operationRect: NERectData = new NERectData() + screenHeight: number = 0; + screenWidth: number = 0; + keyboardHeight: number = 0 + //导航栏高度,用于计算弹窗位置 + navBarHeight: number = 80; + // 底部输入框以及固定按钮操作栏高度 + @Local bottomHeight: number = 65; + @Local bottomMargin: number = 100; + // bottomMargin: number = 10; + bottomWithReplyHeight: number = 135; + controller: RichEditorController = new RichEditorController() + operationMoreDataList: Array = Array() + listScroller: Scroller = new Scroller() + toScroll: boolean = false + inputContentLength: number = 0 + // 接受消息标记 + msgSize: number = 0 + // 列表滚动位置 + listScrollStartPosition: number = 0 + listScrollEndPosition: number = 0 + //首次加载数据滚动到底部 + firstLoadData: boolean = true; + selectVideoView: CustomDialogController = new CustomDialogController({ + builder: NECameraSelectView({ + onTakePhotoFromCamera: () => { + const context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; + MediaUtils.showCameraPicker(context, cameraPicker.PickerMediaType.PHOTO).then((result) => { + if (result.uri) { + if (result.type === photoAccessHelper.PhotoType.IMAGE) { + this.chatViewModel.sendImageMessage(result.uri) + } else if (result.type === photoAccessHelper.PhotoType.VIDEO) { + this.chatViewModel.sendVideoMessage(result.uri, result.duration, result.width, result.height) + } + } + }); + }, + onTakeVideoFromCamera: () => { + const context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; + MediaUtils.showCameraPicker(context, cameraPicker.PickerMediaType.VIDEO).then((result) => { + if (result.uri) { + if (result.type === photoAccessHelper.PhotoType.IMAGE) { + this.chatViewModel.sendImageMessage(result.uri) + } else if (result.type === photoAccessHelper.PhotoType.VIDEO) { + this.chatViewModel.sendVideoMessage(result.uri, result.duration, result.width, result.height) + } + } + }); + } + }), + cornerRadius: 0, + alignment: DialogAlignment.Bottom, + backgroundColor: Color.Transparent, + backgroundBlurStyle: BlurStyle.NONE, + height: 140, + }) + @Local imagesIndexModel?: ImagesIndexModel + @Local currentImageIndex: number = 0 + imageViewerDialog: CustomDialogController = new CustomDialogController({ + builder: ImageViewDialog({ + imagesIndexModel: this.imagesIndexModel + }), + cornerRadius: 0, + alignment: DialogAlignment.Center, + backgroundColor: Color.Black, + backgroundBlurStyle: BlurStyle.NONE, + height: '100%', + width: '100%', + customStyle: true + }) + teachDialog: CustomDialogController = new CustomDialogController({ + builder: TeachDialog({ + imgCallBack:()=>{ + HMRouterMgr.push({ pageUrl: 'TuwenCompPage' }) + } + }), + cornerRadius: 4, + width: '70%', + }) + @Local showName:string=String(this.chatUserInfo.conversationName) + waDialog: CustomDialogController = new CustomDialogController({ + builder: NewWaDialog({ + firstCallBack:()=>{ + this.chatViewModel.sendTextMessage("纽娃复合营养素固体饮料主要成分是:蜂花粉、乳清蛋白粉、灰树花粉、低聚木糖、蚕蛹氨基酸、麦芽粉、薏苡仁粉、烟酸、磷脂,以及其他调味品、辅助原料。科学配比制成,含有丰富的蛋白质、氨基酸、维生素、微量元素及其他营养元素,点击链接了解详情。", this.replyMsg) + const jsonData:customAttachment = { + gdxz_title:'纽娃复合营养素固体饮料', + gdxz_url:BasicConstant.getNewWa+"setInfo?patient_uuid="+this.patientUuid +"&expert_uuid="+ authStore.getUser().uuid, + gdxz_content: '肝胆相照®肝胆病在线公共服务平台', + gdxz_id: '', + gdxz_img: '', + gdxz_type: BasicConstant.Shopping, + gdxz_ext_data: '' + } + let rawAttach = JSON.stringify(jsonData) + this.chatViewModel.sendCustomMessage(BasicConstant.Shopping, rawAttach) + }, + secondCallBack:()=>{ + + } + }), + cornerRadius: 4, + width: '70%', + }) + @Local videoFileUrl?: string + @Local videoRatio?: number + videoViewerDialog: CustomDialogController = new CustomDialogController({ + builder: VideoViewerDialog({ + videoUrl: this.videoFileUrl, + videoRatio: this.videoRatio + }), + cornerRadius: 0, + alignment: DialogAlignment.Center, + backgroundColor: Color.Black, + backgroundBlurStyle: BlurStyle.NONE, + height: '100%', + width: '100%', + customStyle: true + }) + forwardMessages: V2NIMMessage[] = [] + forwardConversations: ConversationSelectModel[] = [] + currentConversationName?: string + forwardType?: ResourceStr = $r('app.string.chat_operation_forward') + forwardMessageDialog = new CustomDialogController({ + builder: ForwardMessageDialog({ + conversationList: this.forwardConversations, + currentConversationName: this.currentConversationName, + forwardType: this.forwardType, + sendForwardMsg: (text: string | undefined) => { + if (ErrorUtils.checkNetworkAndToast()) { + this.chatViewModel.forwardMessage(this.forwardMessages, this.forwardConversations, text) + this.showMultiSelect = false + } + } + }), + cornerRadius: 14, + backgroundColor: Color.White, + height: 250, + width: 276, + }) + invalidForwardDialogSureAction?: () => void + invalidForwardFailureDialog?: CustomDialogController = new CustomDialogController({ + builder: DoubleAlertDialog({ + title: $r('app.string.exception_description'), + message: $r("app.string.multiForward_exist_invalid_fail"), + sureAction: this.invalidForwardDialogSureAction + }), + cornerRadius: 14, + backgroundColor: Color.White, + height: 140, + width: 270, + }) + invalidForwardDepthDialog?: CustomDialogController = new CustomDialogController({ + builder: DoubleAlertDialog({ + title: $r('app.string.exception_description'), + message: $r('app.string.multiForward_exist_invalid_depth'), + sureAction: this.invalidForwardDialogSureAction + }), + cornerRadius: 14, + backgroundColor: Color.White, + height: 140, + width: 270, + }) + forwardMessageAction = (selectedList: ConversationSelectModel[]) => { + if (this.operationMsg?.message) { + this.forwardMessages = [this.operationMsg.message] + this.forwardConversations = selectedList + this.currentConversationName = this.chatUserInfo.getConversationName() + this.forwardMessageDialog.open() + } + } + private outpatient!:CustomDialogController; + @Local inputPlaceholder:string='您未添加出/停诊信息,是否添加?' + initDialog() { + this.outpatient = new CustomDialogController({ + builder:PerfactInputSheet({ + controller:this.outpatient, + inputTitle:'提示', + inputPlaceholder:this.inputPlaceholder, + style:'2', + okColor:$r('app.color.top_title'), + inputCallBack:(input: string,title:string)=>{ + if(this.havestopout) + { + const jsonData:customAttachment = { + gdxz_title: authStore.getUser().realName+'医生门诊详情', + gdxz_url: BasicConstant.urlOutpatientnew+authStore.getUser().uuid, + gdxz_content: '门诊详情', + gdxz_id: '', + gdxz_img: '', + gdxz_type: BasicConstant.VisitTeach, + gdxz_ext_data: '' + } + + let rawAttach = JSON.stringify(jsonData) + this.chatViewModel.sendCustomMessage(BasicConstant.VisitTeach, rawAttach) + } + + + } + }), + keyboardAvoidDistance: LengthMetrics.vp(0), // 设置弹窗底部与键盘顶部间距(单位:vp) + alignment: DialogAlignment.Center, + customStyle: true, + autoCancel: false, + backgroundColor: ('rgba(0,0,0,0.5)'), + height: '100%' + }) + } + @Monitor("chatUserInfo.isReceiveMsg") + onReceiveMsg() { + if (this.firstLoadData || this.chatUserInfo.isReceiveMsg) { + this.listScroller.scrollEdge(Edge.Bottom) + this.chatUserInfo.setReceiveMsg(false) + this.firstLoadData = false; + } + } + + @Monitor("chatUserInfo.scrollIndex") + onScrollIndex() { + if (this.chatUserInfo.scrollIndex > -1) { + let height = DeviceUtils.windowPXHeight / 2 + this.toScroll = true + this.listScroller.scrollToIndex(this.chatUserInfo.scrollIndex, false, undefined, { + 'extraOffset': new LengthMetrics(-height, 0) + }) + this.chatViewModel.setAnchorMessage(undefined) + this.chatUserInfo.setScrollIndex(-1) + } + } + + @Monitor("chatViewModel.needScrollToBottom") + onNeedScrollToBottom() { + if (this.chatViewModel.needScrollToBottom && + this.listScrollEndPosition >= this.chatUserInfo.msgList.totalCount() - 2) { + this.listScroller.scrollEdge(Edge.Bottom) + this.chatViewModel.needScrollToBottom = false; + } + } + + @Monitor("chatViewModel.anchorMsg") + onAnchorMsg() { + if (this.chatViewModel.anchorMsg) { + if (this.chatUserInfo.msgMap.has(this.chatViewModel.anchorMsg.getMessageClientId())) { + let position = this.chatUserInfo.searchPosition(this.chatViewModel.anchorMsg.getMessageClientId()) + this.toScroll = true + this.listScroller.scrollToIndex(position) + this.chatViewModel.setAnchorMessage(undefined) + } else { + this.chatViewModel.loadAnchorMsg(this.chatViewModel.anchorMsg) + } + } + + } + + @Monitor("chatViewModel.selectMsgCount") + onSelectMsg() { + this.multiSelectCount = this.chatViewModel.getSelectMessageSize() + } + + @Monitor("expandHeight") + onExpandInputView() { + if (this.expandHeight > 10) { + // 如果是定位消息状态,收到键盘展开重新切换最新消息 + if (this.chatViewModel.hasNew) { + this.chatViewModel.reloadMessageList() + } else { + this.listScroller.scrollEdge(Edge.Bottom) + } + } + } + + getOutList() + { + let hashMap1: HashMap = new HashMap(); + hashMap1.set("page", "1") + hdHttp.httpReq(BasicConstant.listOutPatient,hashMap1).then(async (res: HdResponse) => { + let json = JSON.parse(res+'') as Record; + let json1=json.data as Record + let datas:[]=json1.list as [] + if(datas!=null&&datas.length>0) + { + this.havestopout=true + } + + }).catch((err: BusinessError) => { + console.info(`Response fail: ${err}`); + }) + let hashMap: HashMap = new HashMap(); + + hdHttp.httpReq(BasicConstant.stopOutPatientList,hashMap).then(async (res: HdResponse) => { + let json = JSON.parse(res+'') as Record; + let datas:[]=json.data as [] + if(datas!=null&&datas.length>0) + { + this.havestopout=true + } + + }).catch((err: BusinessError) => { + console.info(`Response fail: ${err}`); + }) + } + + patientDetail() + { + this.sessionId = ChatKitClient.nim.conversationIdUtil.parseConversationTargetId(this.conversationId) + this.patientUuid=this.sessionId + hdHttp.post(BasicConstant.patientDetail, { + patientUuid: this.sessionId, + } as patientDetailExtraData).then(async (res: HdResponse) => { + let json = JSON.parse(res+'') as Record; + let datas=json.data as Record; + this.patientUuid=datas.uuid + this.showName=await UserUtils.getAvatarName(this.patientUuid,String(this.chatUserInfo.conversationName)) + }).catch((err: BusinessError) => { + + }) + } + sendHelloMessage(rawAttach:string)//发送初始消息 + { + this.chatViewModel.sendCustomMessage(BasicConstant.VisitTeach, rawAttach) + } + aboutToAppear() { + + NEEmojiManager.instance.setup(); + DeviceUtils.rootDirPath = getContext(this).filesDir + this.operationMoreDataList = setupMoreOperationData() + window.getLastWindow(getContext(this)).then(currentWindow => { + + let avoidArea1 = currentWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); + // 顶部状态栏高度 + let statusBarHeight = px2vp(avoidArea1.topRect.height); + this.statusBarHeight=statusBarHeight; + + let property = currentWindow.getWindowProperties(); + // 初始化窗口高度 + let avoidArea = currentWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_KEYBOARD); + this.screenHeight = px2vp(property.windowRect.height); + this.screenWidth = px2vp(property.windowRect.width); + DeviceUtils.windowPXWidth = property.windowRect.width; + DeviceUtils.windowPXHeight = property.windowRect.height; + this.scrollHeight = + px2vp(property.windowRect.height - avoidArea.bottomRect.height) - this.bottomHeight; + this.defaultInputViewHeight = this.scrollHeight; + // 监听软键盘的隐藏和显示 + currentWindow.on('avoidAreaChange', data => { + if (data.type == window.AvoidAreaType.TYPE_KEYBOARD) { + this.showOperationView = false + this.keyboardHeight = px2vp(data.area.bottomRect.height); + // 如果是定位消息状态,收到键盘展开重新切换最新消息 + if (this.keyboardHeight > 10 && this.chatViewModel.hasNew) { + this.chatViewModel.reloadMessageList() + } + this.computeScrollHeight() + return; + } + }) + }) + this.initDialog() + this. getOutList() + + } + + computeScrollHeight() { + if ((this.inputStyle === InputStyleType.Emoji || this.inputStyle === InputStyleType.Record || + this.inputStyle === InputStyleType.More) && this.keyboardHeight <= 0) { + this.scrollHeight = this.screenHeight - this.keyboardHeight - this.bottomHeight - this.expandHeight + } else { + this.scrollHeight = this.screenHeight - this.keyboardHeight - this.bottomHeight + if (this.keyboardHeight > 10) { + this.expandHeight = 0 + this.inputStyle = InputStyleType.None; + this.listScroller.scrollEdge(Edge.Bottom) + } + } + } + + getInputContentLength(): number { + let length = 0 + this.controller.getSpans().forEach((item) => { + if (typeof (item as RichEditorImageSpanResult)['imageStyle'] != 'undefined') { + let span = item as RichEditorImageSpanResult; + if (span.spanPosition.spanRange) { + let end = span.spanPosition.spanRange[1]; + if (end > length) { + length = end; + } + } + } else { + let span = item as RichEditorTextSpanResult + if (span.spanPosition.spanRange) { + let end = span.spanPosition.spanRange[1]; + if (end > length) { + length = end; + } + } + } + }) + return length + } + + getMessageText(): string { + let text = ''; + let results = this.controller?.getSpans(); + results?.forEach((item) => { + if (typeof (item as RichEditorImageSpanResult)['imageStyle'] != 'undefined') { + let resourcePath = (item as RichEditorImageSpanResult).valueResourceStr; + if (resourcePath != null && resourcePath.toString().length > 0) { + let path = resourcePath.toString(); + let splits = path.split("/") + let fileName = splits[splits.length - 1]; + let emoji = NEEmojiManager.instance.getEmojiByName(String(fileName)); + if (emoji?.tag != null) { + text += emoji.tag; + } + } + } else { + text += (item as RichEditorTextSpanResult).value; + } + }) + return text + } + + loadChatData() { + this.chatUserInfo.setConversationId(this.conversationId) + this.chatViewModel.init(this.conversationId, this.chatUserInfo); + this.chatViewModel.loadData(); + this.patientDetail() + } + + async showImageDetail(msg?: NIMMessageInfo, onlyMsg?: boolean) { + try { + const imageModel = + onlyMsg ? await getMessageImageUrl(msg, this.chatUserInfo) : await getMessageImageUrls(msg, this.chatUserInfo) + this.imagesIndexModel = imageModel + this.imageViewerDialog.open() + } catch (err) { + console.error(err) + } + } + + showVideoDetail(msg: NIMMessageInfo) { + AudioPlayerManager.instance.stopPlayAll() + this.videoFileUrl = getMessageVideoUrl(msg, this.chatUserInfo) + if (this.videoFileUrl == undefined) { + NECommonUtils.showToast($r('app.string.chat_msg_download_tips')) + return + } + this.videoRatio = getMessageVideoRatio(msg) + if (this.videoFileUrl) { + this.videoViewerDialog.open() + } + } + + showLocationDetail(msg: NIMMessageInfo) { + let attachment = msg.message.attachment as V2NIMMessageLocationAttachment + + let queryLocationOptions: sceneMap.LocationQueryOptions = { + location: { + latitude: attachment.latitude, + longitude: attachment.longitude + }, + name: attachment.address, + address: attachment.address, + }; + // 拉起地点详情页 + sceneMap.queryLocation(getContext(this) as common.UIAbilityContext, queryLocationOptions).then(() => { + console.info("netease QueryLocation", "Succeeded in querying location."); + }).catch((err: BusinessError) => { + console.error("netease QueryLocation", `Failed to query Location, code: ${err.code}, message: ${err.message}`); + }); + } + + @Builder + build() { + NavDestination() { + NavigationBackBuilder({ + title:this.showName , + rightButtonIcon: this.gdxz_sessionType==BasicConstant.general ? $r('app.media.more') :undefined, + rightButtonTitle: this.gdxz_sessionType==BasicConstant.consult && this.chat_state!='3'? '关闭会话' : undefined, + rightButtonColor:this.rightButtonEnable?$r('app.color.top_title'):$r('app.color.common_gray_03'), + top:this.statusBarHeight, + rightButtonAction: () => { + if( this.gdxz_sessionType==BasicConstant.consult && this.chat_state!='3'&&this.rightButtonEnable) + { + this.closeConsult() + } + else { + this.goToSettingPage(this.pathStack) + } + + }, + leftButtonAction: () => { + this.pathStack.pop() + } + + }) + RelativeContainer() { + List({ scroller: this.listScroller }) { + LazyForEach(this.chatUserInfo.msgList, (msg: NIMMessageInfo) => { + ListItem() { + MessageComponent({ + message: msg, + chatInfo: this.chatUserInfo, + showSelect: this.showMultiSelect, + onMessageClick: { + onAvatarClick: ((msg: NIMMessageInfo | undefined) => { + if (this.showMultiSelect) { + return + } + if (msg != null) { + if (msg?.message.senderId == ChatKitClient.getLoginUserId()) { + this.pathStack.pushPath({ + name: 'MineInfoPage' + }) + } else { + this.pathStack.pushPath({ name: 'PersonInfoPage', param: msg?.message.senderId }) + } + } + }), + onItemLongClick: ((event: GestureEvent, msg: NIMMessageInfo | undefined) => { + if (this.showMultiSelect) { + return + } + this.operationMsg = msg + let opMenuWidth = computeOperateViewWidth(msg) + let opMenuHeight = computeOperateViewHeight(msg) + let marginSize = this.operationViewMargin + if (event.target.area.position.x !== undefined) { + let xPoint = Number(event.target.area.globalPosition.x) + + (Number(event.target.area.width) - opMenuWidth) / 2 + if (xPoint < marginSize) { + xPoint = marginSize + } + if (xPoint + opMenuWidth + marginSize > this.screenWidth) { + xPoint = this.screenWidth - opMenuWidth - marginSize + } + this.operationRect.x = xPoint; + } + if (event.target.area.position.y !== undefined) { + let yPoint = + Number(event.target.area.globalPosition.y) - this.navBarHeight + + Number(event.target.area.height) + if (yPoint + opMenuHeight + marginSize + this.bottomHeight > this.scrollHeight) { + yPoint = + yPoint - opMenuHeight - marginSize * 2 - Number(event.target.area.height); + } + if (yPoint < 0) { + yPoint = this.scrollHeight / 2; + + } + this.operationRect.y = yPoint + } + this.showOperationView = true + }), + onItemClick: (_event: ClickEvent, msg: NIMMessageInfo | undefined) => { + if (this.showMultiSelect) { + if (msg) { + if (!msg?.isSelectedMsg && !msg.isRevokeMsg) { + this.chatViewModel.addSelectMessage(msg) + } else { + this.chatViewModel.removeSelectMessage(msg) + } + } + return + } + this.showMessageDetail(msg) + + }, + onRevokeEditClick: (_event: ClickEvent, msg: NIMMessageInfo | undefined) => { + if (this.showMultiSelect) { + return + } + if (msg?.checkRevokeEdit()) { + this.clearInput(true) + if (msg.isReplyMsg && msg.replyMsg) { + this.loadReplyInfo(msg.replyMsg) + } + parseMessageText(msg.revokeInfo?.revokeMsgText)?.forEach((item: NEEmojiParseResult) => { + if (item.text) { + this.controller.addTextSpan(item.text) + } else if (item.emoji) { + this.controller.addImageSpan($rawfile(`emoji/${item.emoji.file}`), + { + imageStyle: { size: [16, 16] } + }) + } + }) + } else if (msg?.revokeInfo !== undefined) { + NECommonUtils.showToast($r('app.string.chat_revoke_edit_error_tips')) + } + }, + onMultiSelect: (select: boolean, msg: NIMMessageInfo | undefined) => { + if (msg) { + if (select) { + this.chatViewModel.addSelectMessage(msg) + } else { + this.chatViewModel.removeSelectMessage(msg) + } + this.operationMsg = undefined + } + }, + onReplyClick: (_event: ClickEvent, msg: NIMMessageInfo | undefined) => { + if (msg) { + if (this.chatUserInfo.msgMap.has(msg.getMessageClientId())) { + let index = this.chatUserInfo.searchPosition(msg.getMessageClientId()) + this.listScroller.scrollToIndex(index) + } else { + this.showMessageDetail(msg, true) + } + } + }, + onSendFailClick: (_event: ClickEvent, msg: NIMMessageInfo | undefined) => { + if (this.showMultiSelect) { + return + } + if (msg) { + this.chatViewModel.resendMessage(msg) + } + }, + onAvatarLongPress: () => { + + }, + onReadReceiptClick: (_event: ClickEvent) => { + + } + }, + }) + } + }, (item: NIMMessageInfo) => item.message.messageClientId) + } + .id("chatPageListView") + .cachedCount(20) + .maintainVisibleContentPosition(true) + .padding({ bottom: 20 }) + .onScrollIndex((start: number, end: number) => { + // Listen to the first index of the current list. + if (!this.toScroll) { + if (start >= 0 && start < 3 + && this.listScrollStartPosition > start && this.chatViewModel.canLoadMore()) { + this.chatViewModel.getMoreMessageList() + } else if (this.listScrollEndPosition < end && this.chatViewModel.canLoadNext(end)) { + this.chatViewModel.getNewMessageList() + } + } + this.listScrollEndPosition = end; + this.listScrollStartPosition = start; + }) + .onScrollStop(() => { + console.debug('netease to scroll stop:', this.toScroll) + if (this.toScroll) { + this.toScroll = false + } + }) + .alignRules({ + left: { anchor: "__container__", align: HorizontalAlign.Start }, + right: { anchor: "__container__", align: HorizontalAlign.End }, + top: { anchor: "__container__", align: VerticalAlign.Top }, + }) + .height(this.scrollHeight - this.bottomMargin) + .onScrollStart(() => { + this.showOperationView = false + }) + .onTouch((event) => { + if (event.type == TouchType.Down) { + this.showOperationView = false + this.getUIContext().getFocusController().clearFocus(); + this.scrollHeight = this.defaultInputViewHeight; + this.expandHeight = 0; + this.inputStyle = InputStyleType.None + } + }) + + if (this.chatViewModel.networkBroken) { + NetworkBrokenBuilder() + } + + Column() + .height(this.bottomHeight) + .backgroundColor(Color.Transparent) + .backgroundColor($r('app.color.chat_input_background')) + .id("chat_input") + .alignRules({ + left: { anchor: "__container__", align: HorizontalAlign.Start }, + right: { anchor: "__container__", align: HorizontalAlign.End }, + top: { anchor: "chatPageListView", align: VerticalAlign.Bottom }, + }) + + if (this.hideInput === false && !this.showMultiSelect&&this.chat_state!='3'&&this.chat_state!='333') { + NEChatInputView({ + controller: this.controller, + placeHolder: (this.chatUserInfo.conversationName ?? '').length > 15 ? + this.chatUserInfo.conversationName?.substring(0, 15) + '...' : this.chatUserInfo.conversationName, + replyMsg: this.replyMsg, + chatInfo: this.chatUserInfo, + onDidClickCloseReply: () => { + this.clearInput(false) + }, + onDidClickImage: () => { + this.showOperationView = false + MediaUtils.showImageVideoPicker().then((result) => { + if (result.errorMsg == null && result.uri) { + if (result.type === photoAccessHelper.PhotoType.IMAGE) { + this.chatViewModel.sendImageMessage(result.uri); + } else if (result.type === photoAccessHelper.PhotoType.VIDEO) { + this.chatViewModel.sendVideoMessage(result.uri, result.duration, result.width, result.height); + } + } + }) + }, + onDidClickAudio: () => { + this.showOperationView = false + let context = getContext(this) as common.UIAbilityContext + this.getUIContext().getFocusController().clearFocus() + PermissionsUtils.reqPermissionsFromUser(['ohos.permission.MICROPHONE'], context).then((result) => { + if (result.grantStatus == true) { + if (this.inputStyle == InputStyleType.Record) { + this.expandHeight = 0 + this.inputStyle = InputStyleType.None; + this.scrollHeight = this.screenHeight - this.expandHeight - this.bottomHeight + } else { + this.inputStyle = InputStyleType.Record + this.expandHeight = ChatConst.messageInputAreaHeight + this.scrollHeight = this.screenHeight - this.expandHeight - this.bottomHeight + } + } else { + NECommonUtils.showToast($r('app.string.chat_permission_deny_tips')) + } + }) + + }, + onDidClickEmoji: () => { + this.showOperationView = false + if (this.inputStyle == InputStyleType.Emoji) { + this.expandHeight = 0 + this.inputStyle = InputStyleType.None; + this.scrollHeight = this.screenHeight - this.expandHeight - this.bottomHeight + } else { + this.inputStyle = InputStyleType.Emoji + this.expandHeight = ChatConst.messageInputAreaHeight + this.scrollHeight = this.screenHeight - this.expandHeight - this.bottomHeight + } + }, + onDidClickMore: () => { + this.showOperationView = false + if (this.inputStyle == InputStyleType.More) { + this.expandHeight = 0 + this.inputStyle = InputStyleType.None; + this.scrollHeight = this.screenHeight - this.expandHeight - this.bottomHeight + } else { + this.inputStyle = InputStyleType.More + this.expandHeight = ChatConst.messageInputAreaHeight + this.scrollHeight = this.screenHeight - this.expandHeight - this.bottomHeight + } + }, + onSendTextMessage: () => { + this.showOperationView = false + let text = this.getMessageText().trimEnd() + if (text.length <= 0) { + NECommonUtils.showToast($r('app.string.null_message_not_support')) + return + } + this.chatViewModel.sendTextMessage(text, this.replyMsg) + this.clearInput(true) + }, + inputStyle: this.inputStyle + }).alignRules({ + left: { anchor: "chat_input", align: HorizontalAlign.Start }, + right: { anchor: "chat_input", align: HorizontalAlign.End }, + bottom: { anchor: "chat_input", align: VerticalAlign.Bottom }, + top: { anchor: "chat_input", align: VerticalAlign.Top }, + }) + + .backgroundColor($r('app.color.chat_input_background')) + } else if (this.showMultiSelect) { + ChatMultiSelectView({ + isEnable: this.multiSelectCount > 0, + onMultiForward: () =>{ + if (ChatKitClient.connectBroken()) { + NECommonUtils.showToast($r('app.string.chat_network_error_tips')) + } else { + this.multiForwardMessage() + } + }, + onSingleForward: () => { + if (ChatKitClient.connectBroken()) { + NECommonUtils.showToast($r('app.string.chat_network_error_tips')) + } else { + this.singleForwardMessage() + } + }, + onMultiDelete: () => { + let selectMsg = this.chatViewModel.getSelectMessageList() + if (selectMsg.length > ChatConst.messageDeleteLimit) { + NECommonUtils.showToast($r('app.string.chat_multi_delete_limit_tips', ChatConst.messageDeleteLimit)) + } else { + this.showDialogToDelete(selectMsg) + } + }, + }).width('100%').height(this.bottomHeight) + .alignRules({ + left: { anchor: "chat_input", align: HorizontalAlign.Start }, + right: { anchor: "chat_input", align: HorizontalAlign.End }, + bottom: { anchor: "chat_input", align: VerticalAlign.Bottom }, + top: { anchor: "chat_input", align: VerticalAlign.Top }, + }).backgroundColor($r('app.color.chat_input_background')) + } + + Column() { + if (this.inputStyle === InputStyleType.Record) { + NEAudioRecordView({ + onRecordAudio: (filepath, duration) => { + this.chatViewModel.sendAudioMessage(filepath, duration) + }, + onRecordStart: () => { + this.hideInput = true + }, + onRecordEnd: () => { + this.hideInput = false + } + }) + .width('100%') + .height(150) + .alignRules({ + left: { anchor: "__container__", align: HorizontalAlign.Start }, + right: { anchor: "__container__", align: HorizontalAlign.End }, + top: { anchor: "__container__", align: VerticalAlign.Top }, + }) + } else if (this.inputStyle === InputStyleType.More) { + NEChatMoreOperation({ + dataList: this.operationMoreDataList, onDidClick: (data) => { + let context = getContext(this) as common.UIAbilityContext; + if (data.type == NEChatMoreOperationType.Video) { + PermissionsUtils.reqPermissionsFromUser(['ohos.permission.CAMERA'], context).then((result) => { + if (result.grantStatus == true) { + this.selectVideoView.open() + } else { + NECommonUtils.showToast($r('app.string.chat_permission_deny_tips')) + } + }) + } else if (data.type == NEChatMoreOperationType.Image) { + this.showOperationView = false + MediaUtils.showImageVideoPicker().then((result) => { + if (result.errorMsg == null && result.uri) { + if (result.type === photoAccessHelper.PhotoType.IMAGE) { + this.chatViewModel.sendImageMessage(result.uri); + } else if (result.type === photoAccessHelper.PhotoType.VIDEO) { + this.chatViewModel.sendVideoMessage(result.uri, result.duration, result.width, result.height); + } + } + }) + + } + else if (data.type == NEChatMoreOperationType.Reply) { + this.pathStack.pushPathByName( + 'QuckMessagePage', + {}, + (popInfo: PopInfo) => { // 接收B返回的参数 + const result = popInfo.result as string; + this.setInputContent(result); + // console.log(`B页面返回数据:${result}`); + } + ) + } + else if (data.type == NEChatMoreOperationType.Teach) { + this.teachDialog.open() + } + else if (data.type == NEChatMoreOperationType.Shopping) { + this.waDialog.open() + } + else if (data.type == NEChatMoreOperationType.Outpatient) { + if(this.havestopout) + { + this.inputPlaceholder='您是否发送您的出/停诊公告?' + this.outpatient.open() + } + else + { + this.inputPlaceholder='您未添加出/停诊信息,是否添加?' + this.outpatient.open() + } + + } + } + }).padding({ top: 10 }) + .width('100%') + .height(250) + .backgroundColor(Color.White) + .alignRules({ + left: { anchor: "__container__", align: HorizontalAlign.Start }, + right: { anchor: "__container__", align: HorizontalAlign.End }, + top: { anchor: "__container__", align: VerticalAlign.Top }, + }) + } else if (this.inputStyle === InputStyleType.Emoji) { + NEChatEmojiView({ + onDidClick: (emoji) => { + if (emoji.type === NIMEmoticonType.file) { + this.controller.addImageSpan($rawfile(`emoji/${emoji.file}`), { imageStyle: { size: [16, 16] } }) + } else if (emoji.type === NIMEmoticonType.delete) { + let currentLength = this.getInputContentLength() + if (currentLength > 0) { + this.controller.deleteSpans({ start: currentLength - 1, end: currentLength }) + } + } + }, + onEmojiSendMessage: () => { + let text = this.getMessageText().trimEnd() + if (text.length <= 0) { + NECommonUtils.showToast($r('app.string.null_message_not_support')) + return + } + this.chatViewModel.sendTextMessage(text, this.replyMsg) + this.clearInput(true) + } + }).padding({ top: 0 }) + .width('100%') + .height(170) + .alignRules({ + left: { anchor: "__container__", align: HorizontalAlign.Start }, + right: { anchor: "__container__", align: HorizontalAlign.End }, + top: { anchor: "__container__", align: VerticalAlign.Top } + }) + } + } + .height(this.expandHeight) + .width('100%') + .alignRules({ + left: { anchor: "__container__", align: HorizontalAlign.Start }, + right: { anchor: "__container__", align: HorizontalAlign.End }, + top: { anchor: "chat_input", align: VerticalAlign.Bottom }, + }) + .id("input_expand_back_container") + .backgroundColor($r('app.color.chat_input_background')) + + if (this.showOperationView) { + MessageOperationView({ + operateMsg: this.operationMsg, + didClickItem: (item: MessageOperationItem) => { + this.showOperationView = false + if (this.operationMsg == undefined) { + return; + } + if (item.operationType == MessageOperationType.Copy) { + const pasteboardData = + pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, this.operationMsg.message.text) + pasteboard.getSystemPasteboard().setDataSync(pasteboardData) + NECommonUtils.showToast($r('app.string.chat_message_copy_success_tips')) + } else if (item.operationType == MessageOperationType.Delete) { + // this.showDialogToDelete([this.operationMsg]) + this.chatViewModel.deleteMessageList([this.operationMsg]) + this.showMultiSelect = false + } else if (item.operationType == MessageOperationType.Undo) { + this.showDialogToRevoke(this.operationMsg) + } else if (item.operationType == MessageOperationType.Forward) { + // 转发 + this.forwardMessageAction = (selectedList: ConversationSelectModel[]) => { + if (this.operationMsg?.message) { + this.forwardMessages = [this.operationMsg.message] + this.forwardConversations = selectedList + this.currentConversationName = this.chatUserInfo.getConversationName() + this.forwardMessageDialog.open() + } + } + this.forwardType = $r('app.string.chat_operation_forward') + this.pathStack.pushPath({ + name: 'ConversationSelectPage', + param: new ConversationSelectParam([], conversationSelectLimitCount, this.forwardMessageAction) + }) + } else if (item.operationType == MessageOperationType.Collection) { + // 收藏 + this.chatViewModel.collectionMessage(this.operationMsg) + } else if (item.operationType == MessageOperationType.Pin) { + this.chatViewModel.pinMessage(this.operationMsg) + } else if (item.operationType == MessageOperationType.Unpin) { + this.chatViewModel.unpinMessage(this.operationMsg) + } else if (item.operationType == MessageOperationType.Select) { + this.chatViewModel.clearSelectMessage() + this.chatViewModel.addSelectMessage(this.operationMsg) + this.showMultiSelect = true + } else if (item.operationType == MessageOperationType.Reply) { + this.loadReplyInfo(this.operationMsg) + } + } + }) + .position({ x: this.operationRect.x, y: this.operationRect.y }) + .borderRadius(8) + .shadow(ShadowStyle.OUTER_DEFAULT_MD) + + } + } + .margin({ bottom: this.bottomMargin }) + + .expandSafeArea([SafeAreaType.KEYBOARD]) + .zIndex(1) + } + + .hideTitleBar(true) + .onReady((context: NavDestinationContext) => { + this.pathStack = context.pathStack + let param = this.pathStack.getParamByName("ChatP2PPage") as ChatParam[]; + if (param.length > 0) { + this.conversationId = param[0].conversationId; + this.showName= param[0].name+''; + this.chat_state=param[0].chat_state + this.loadChatData(); + if('true'==param[0].hasMessage&&BasicConstant.consult==param[0].gdxz_sessionType) + { + this.sendHelloMessage(param[0].rawAttach) + } + if(this.chat_state=='3') + { + this.bottomMargin=10 + } + + } else { + this.pathStack.removeByName("ChatP2PPage") + } + }).onHidden(() => { + AudioPlayerManager.instance.stopPlayAll() + }) + } + + closeConsult() + { + + hdHttp.post(BasicConstant.closeConsult, { + uuid:preferenceStore.getItemString('gdxz_consult_uuid'), + + } as extraData).then(async (res: HdResponse) => { + + let json = JSON.parse(res+'') as Record; + let data=json.code as string + if(data=='1') + { + promptAction.showToast({ message: "您已关闭会话,谢谢您的回答!" }); + this.rightButtonEnable=false + this.chat_state='333' + // this.chat_state='3' + this.bottomMargin=10 + } + else { + promptAction.showToast({ message: json.message }) + } + + + }).catch((err: BusinessError) => { + + }) + } + + loadReplyInfo(msg: NIMMessageInfo) { + this.bottomHeight = this.bottomWithReplyHeight + this.replyMsg = msg + this.getUIContext().getFocusController().requestFocus("chat_edit_input") + } + + clearInput(clearInput?: boolean) { + if (clearInput) { + this.controller.deleteSpans() + } + this.replyMsg = undefined + this.bottomHeight = 105 + this.computeScrollHeight() + } + + /** + * 【逐条转发】将多个消息逐条转发到多个会话中,并将留言发送到多个会话中 + */ + singleForwardMessage() { + // 校验网络 + if (ErrorUtils.checkNetworkAndToast()) { + this.forwardType = $r('app.string.chat_operation_single_forward') + // 校验转发条数 + if (this.chatViewModel.selectMsgMap.size > singleMessageLimitCount) { + let resourceManager = getContext(this).resourceManager + NECommonUtils.showToast($r("app.string.chat_forward_limit", resourceManager.getStringSync(this.forwardType.id), + singleMessageLimitCount)) + return + } + + // 不可合并转发的消息列表 + let invalidMessages: NIMMessageInfo[] = [] + for (const message of this.chatViewModel.selectMsgMap.values()) { + // 发送失败的消息不可转发 + // 语音消息不可转发 + // 话单消息不可转发 + if (message.message.sendingState === V2NIMMessageSendingState.V2NIM_MESSAGE_SENDING_STATE_FAILED || + message.message.messageType === V2NIMMessageType.V2NIM_MESSAGE_TYPE_AUDIO || + message.message.messageType === V2NIMMessageType.V2NIM_MESSAGE_TYPE_CALL) { + invalidMessages.push(message) + continue + } + } + + this.forwardMessageAction = async (selectedList: ConversationSelectModel[]) => { + let selectMessage = this.chatViewModel.getSelectMessageList().map(msg => msg.message) + selectMessage = selectMessage.sort((m1, m2) => { + if (m1.createTime < m2.createTime) { + return -1 + } + if (m1.createTime > m2.createTime) { + return 1 + } + return 0 + }) + this.forwardMessages = selectMessage + this.forwardConversations = selectedList + this.currentConversationName = this.chatUserInfo.getConversationName() + this.forwardMessageDialog.open() + } + + // 存在不可转发的消息:提示 + 取消勾选 + if (invalidMessages.length > 0) { + this.invalidForwardFailureDialog?.open() + this.invalidForwardDialogSureAction = () => { + for (const invalidMessage of invalidMessages) { + this.chatViewModel.removeSelectMessage(invalidMessage) + invalidMessage.isSelectedMsg = false + } + if (this.chatViewModel.getSelectMessageSize() > 0) { + this.pathStack.pushPath({ + name: 'ConversationSelectPage', + param: new ConversationSelectParam([], conversationSelectLimitCount, this.forwardMessageAction) + }) + } + } + } else { + if (this.chatViewModel.getSelectMessageSize() > 0) { + this.pathStack.pushPath({ + name: 'ConversationSelectPage', + param: new ConversationSelectParam([], conversationSelectLimitCount, this.forwardMessageAction) + }) + } + } + } + } + + /** + * 【合并转发】将多个消息合并为一条自定义消息,转发到多个会话中,并将留言发送到多个会话中 + */ + multiForwardMessage() { + // 校验网络 + if (ErrorUtils.checkNetworkAndToast()) { + this.forwardType = $r('app.string.chat_operation_multi_forward') + // 校验转发条数 + if (this.chatViewModel.selectMsgMap.size > mergedMessageLimitCount) { + let resourceManager = getContext(this).resourceManager + NECommonUtils.showToast($r("app.string.chat_forward_limit", resourceManager.getStringSync(this.forwardType.id), + mergedMessageLimitCount)) + return + } + + // 计算层数(深度) depth + let depth = 0 + // 不可合并转发的消息列表(1.发送失败的消息;2.转发层数超过 mergedMessageMaxDepth 的消息) + const invalidMessages: NIMMessageInfo[] = [] + let invalidFail: boolean = false + let invalidDepth: boolean = false + for (const message of this.chatViewModel.selectMsgMap.values()) { + // 发送失败的消息不可转发 + if (message.message.sendingState === V2NIMMessageSendingState.V2NIM_MESSAGE_SENDING_STATE_FAILED) { + invalidMessages.push(message) + invalidFail = true + continue + } + + // 解析消息中的 depth + if (message.message.attachment) { + let data = CustomMessageUtils.dataOfCustomMessage(message.message.attachment) + if (data) { + let dep = data["depth"] as number + if (dep >= mergedMessageMaxDepth) { + invalidMessages.push(message) + invalidDepth = true + } else if (dep >= depth) { + depth = dep + } + } + } + } + + // 当前合并转发消息深度 + 1 + depth += 1 + + this.forwardMessageAction = async (selectedList: ConversationSelectModel[]) => { + let forwardMessages = + await this.chatViewModel.mergeForwardMessage(this.chatViewModel.getSelectMessageList(), depth) + if (forwardMessages) { + this.forwardMessages = [forwardMessages] + } + this.forwardConversations = selectedList + this.currentConversationName = this.chatUserInfo.getConversationName() + this.forwardMessageDialog.open() + } + + // 存在不可转发的消息:提示 + 取消勾选 + if (invalidMessages.length > 0) { + if (invalidFail) { + this.invalidForwardFailureDialog?.open() + } else if (invalidDepth) { + this.invalidForwardDepthDialog?.open() + } + this.invalidForwardDialogSureAction = () => { + for (const invalidMessage of invalidMessages) { + this.chatViewModel.removeSelectMessage(invalidMessage) + invalidMessage.isSelectedMsg = false + } + if (this.chatViewModel.getSelectMessageSize() > 0) { + this.pathStack.pushPath({ + name: 'ConversationSelectPage', + param: new ConversationSelectParam([], conversationSelectLimitCount, this.forwardMessageAction) + }) + } + } + } else { + if (this.chatViewModel.getSelectMessageSize() > 0) { + this.pathStack.pushPath({ + name: 'ConversationSelectPage', + param: new ConversationSelectParam([], conversationSelectLimitCount, this.forwardMessageAction) + }) + } + } + } + } + + /** + * 查看消息详情,点击消息体查看或者点击被回复内容查看 + * @param msg 点击的消息 + * @param onlyShow 是否为只展示该消息,如果是则文本消息会直接弹窗展示,图片消息则只查看当前消息 + */ + showMessageDetail(msg: NIMMessageInfo | undefined, onlyShow?: boolean) { + if (msg) { + if (onlyShow && msg.getMessageType() == V2NIMMessageType.V2NIM_MESSAGE_TYPE_TEXT) { + let textMessageDetailDialog: CustomDialogController = new CustomDialogController({ + builder: TextMessageDetailDialog({ + message: msg + }), + cornerRadius: 0, + alignment: DialogAlignment.Center, + backgroundColor: Color.White, + height: '100%', + width: '100%', + customStyle: true + }) + textMessageDetailDialog.open() + } + if (msg?.message.messageType === V2NIMMessageType.V2NIM_MESSAGE_TYPE_IMAGE) { + this.showImageDetail(msg, onlyShow) + } else if (msg?.message.messageType === V2NIMMessageType.V2NIM_MESSAGE_TYPE_FILE) { + downLoadAndOpenFile(msg, getContext(this), this.chatUserInfo) + } else if (msg?.message.messageType === V2NIMMessageType.V2NIM_MESSAGE_TYPE_VIDEO) { + this.showVideoDetail(msg) + } else if (msg?.message.messageType === V2NIMMessageType.V2NIM_MESSAGE_TYPE_LOCATION) { + this.showLocationDetail(msg) + } else if (msg?.message.messageType === V2NIMMessageType.V2NIM_MESSAGE_TYPE_AUDIO) { + if (onlyShow) { + this.playAudioMessage(msg) + } + } else if (msg?.message.messageType === V2NIMMessageType.V2NIM_MESSAGE_TYPE_CUSTOM) { + const attachment = msg.message.attachment + if (attachment) { + const type = CustomMessageUtils.typeOfCustomMessage(attachment) + if (type === mergedMessageCustomType) { + let data = CustomMessageUtils.dataOfCustomMessage(attachment) + if (data as MergedMessageAttachment) { + this.pathStack.pushPath({ + name: 'MergeMessageDetailPage', + param: data as MergedMessageAttachment + }) + } + } + } + } + } + } + + playAudioMessage(msg: NIMMessageInfo) { + if (msg.message.attachment) { + let audioManager = AudioPlayerManager.instance + audioManager.stopPlayAll() + audioManager.avPlayerLive((msg.message.attachment as V2NIMMessageAudioAttachment).url ?? '') + } + } + + showDialogToDelete(messages: NIMMessageInfo[]) { + AlertDialog.show( + { + title: $r('app.string.chat_msg_delete_dialog_title'), + message: $r('app.string.chat_msg_delete_dialog_desc'), + autoCancel: true, + alignment: DialogAlignment.Bottom, + gridCount: 4, + offset: { dx: 0, dy: -20 }, + primaryButton: { + value: $r('app.string.chat_msg_dialog_cancel'), + action: () => { + } + }, + secondaryButton: { + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + value: $r('app.string.chat_msg_dialog_sure'), + action: () => { + this.chatViewModel.deleteMessageList(messages) + this.showMultiSelect = false + } + } + } + ) + } + + showDialogToRevoke(message: NIMMessageInfo) { + AlertDialog.show( + { + title: $r('app.string.chat_msg_revoke_dialog_title'), + message: $r('app.string.chat_msg_revoke_dialog_desc'), + autoCancel: true, + alignment: DialogAlignment.Bottom, + gridCount: 4, + offset: { dx: 0, dy: -20 }, + primaryButton: { + value: $r('app.string.chat_msg_dialog_cancel'), + action: () => { + console.info('Callback when the first button is clicked') + } + }, + secondaryButton: { + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + value: $r('app.string.chat_msg_dialog_sure'), + action: () => { + console.info('Callback when the second button is clicked') + this.chatViewModel.revokeMessage(message) + } + } + } + ) + } + + goToSettingPage(pathStack: NavPathStack) { + if (this.showMultiSelect) { + this.chatViewModel.clearSelectMessage() + this.showMultiSelect = false + } else { + pathStack.pushPath({ + name: 'UserSettingPage', + param: this.chatViewModel.conversationId + }) + } + this.controller.stopEditing() + } + + onPageHide(): void { + this.chatViewModel.clearUnreadCount() + } + + aboutToDisappear(): void { + this.chatViewModel.clearUnreadCount() + this.chatViewModel.onDestroy() + AudioPlayerManager.instance.stopPlayAll() + } + + setInputContent(content: string) { + // 设置输入框内容 + this.controller?.deleteSpans(); + this.controller?.addTextSpan(content); + } +} + +// 跳转页面入口函数 +@Builder +export function ChatP2PPageBuilder() { + ChatP2PPage() +} + +export interface patientDetailExtraData{ + patientUuid:string +} + +export interface extraData{ + uuid:string +} \ No newline at end of file diff --git a/chatkit_ui/src/main/ets/pages/QuickMessagePage.ets b/chatkit_ui/src/main/ets/pages/QuickMessagePage.ets index 1ce153b..df78bfe 100644 --- a/chatkit_ui/src/main/ets/pages/QuickMessagePage.ets +++ b/chatkit_ui/src/main/ets/pages/QuickMessagePage.ets @@ -8,6 +8,11 @@ import { hdHttp, HdResponse,BasicConstant, authStore} from '@itcast/basic' import { BusinessError } from '@kit.BasicServicesKit'; import { promptAction,LengthMetrics } from '@kit.ArkUI' import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet' +import { HMRouter, HMRouterMgr } from '@hadss/hmrouter'; + +@HMRouter({ + pageUrl: 'QuickMessagePage' +}) @ComponentV2 export struct QuickMessagePage { @Local delectuuid:string='' @@ -29,13 +34,14 @@ export struct QuickMessagePage { width: '70%', }) build() { - NavDestination() { + // NavDestination() { Column() { NavigationBackBuilder({ title:$r('app.string.reply'), top:this.statusBarHeight, leftButtonAction: () => { - this.pathStack.pop() + // this.pathStack.pop() + HMRouterMgr.pop() } }) Row(){ @@ -65,7 +71,8 @@ export struct QuickMessagePage { Text(item.replystr).fontSize(16).fontColor($r('app.color.common_gray_01')).padding(20).textAlign(TextAlign.Start).width('100%') } .onClick(()=>{ - this.pathStack.pop(item.replystr) + // this.pathStack.pop(item.replystr) + HMRouterMgr.pop({param:item.replystr}) }) .gesture( LongPressGesture({ @@ -92,13 +99,13 @@ export struct QuickMessagePage { } .width('100%') .height('100%') - } - .hideTitleBar(true) - .backgroundColor(Color.White) - .onReady((context: NavDestinationContext) => { - this.pathStack = context.pathStack - - }) + // } + // .hideTitleBar(true) + // .backgroundColor(Color.White) + // .onReady((context: NavDestinationContext) => { + // this.pathStack = context.pathStack + // + // }) } aboutToAppear(): void { window.getLastWindow(getContext(this)).then(currentWindow => { @@ -216,11 +223,11 @@ struct DelectDialog { } } -// 跳转页面入口函数 -@Builder -export function QuickMessagePageBuilder() { - QuickMessagePage() -} +// // 跳转页面入口函数 +// @Builder +// export function QuickMessagePageBuilder() { +// QuickMessagePage() +// } interface extraData{ user_uuid:string diff --git a/chatkit_ui/src/main/ets/view/MessageComponentBuilder.ets b/chatkit_ui/src/main/ets/view/MessageComponentBuilder.ets index e738961..e450103 100644 --- a/chatkit_ui/src/main/ets/view/MessageComponentBuilder.ets +++ b/chatkit_ui/src/main/ets/view/MessageComponentBuilder.ets @@ -36,6 +36,9 @@ import { ChatInfo } from '../model/ChatInfo' import { Markdown } from '@nimkit/markdown' import { BasicConstant,DataWebModel } from '@itcast/basic' import { router } from '@kit.ArkUI' +import { videoTools } from 'home' +import { HMRouterMgr } from '@hadss/hmrouter' + @ComponentV2 export struct messageContent { @BuilderParam @@ -803,6 +806,7 @@ export struct customBuilder { @Local content:string='' @Local customType:string='' @Local customUrl:string='' + @Local uuid:string='' aboutToAppear(): void { if (this.message) { // @@ -812,6 +816,7 @@ export struct customBuilder { this.title=custom.gdxz_title this.customType=custom.gdxz_type this.customUrl=custom.gdxz_url + this.uuid=custom.gdxz_id if(BasicConstant.CouTeach==custom.gdxz_type) { this.content='点击查看问题详情' @@ -891,6 +896,13 @@ export struct customBuilder { // intent.putExtra("isCloseAnswer", true); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK ); // UIUtils.getContext().startActivity(intent); + // router.pushUrl({ + // url: 'pages/Netease/ConsultationDetailPage', + // params: { uuid: this.uuid, isHistory: 'true'} + // }); + HMRouterMgr.push({ pageUrl: 'ConsultationDetailPage' , param: { + uuid: this.uuid, isHistory: 'true' + } }) } else if(this.title!=null&&this.title.includes("互联网医院")) { @@ -907,13 +919,10 @@ export struct customBuilder { if (this.customUrl.includes("video")){ // intent = new Intent(UIUtils.getContext(), VideoDetilActivity.class); // intent.putExtra("uuid", teachAttachment.getMessigeid()); - - }else { - // intent = new Intent(UIUtils.getContext(), NewsDetailActivity.class); - + videoTools.getVideoDetails(this.uuid) } - if (this.customUrl.includes("outpatient_details") + else if (this.customUrl.includes("outpatient_details") ||this.customUrl.includes("wxPatient/index.htm#/outPatient")){ // intent.putExtra("title", "门诊详情"); ToWeb(this.customUrl,'门诊详情') @@ -925,6 +934,7 @@ export struct customBuilder { } else { + ToWeb(this.customUrl,'患教详情') // intent.putExtra("newsTitle", teachAttachment.getTitle()+""); // intent.putExtra("kepuuuid", teachAttachment.getMessigeid()); // intent.putExtra("title", "患教详情"); diff --git a/chatkit_ui/src/main/resources/base/profile/route_map.json b/chatkit_ui/src/main/resources/base/profile/route_map.json index 7e4eb38..eb0e7f1 100644 --- a/chatkit_ui/src/main/resources/base/profile/route_map.json +++ b/chatkit_ui/src/main/resources/base/profile/route_map.json @@ -1,21 +1,5 @@ { "routerMap": [ - { - "name": "ChatP2PPage", - "pageSourceFile": "src/main/ets/pages/ChatP2PPage.ets", - "buildFunction": "ChatP2PPageBuilder", - "data": { - "description": "this is p2p chat page" - } - }, - { - "name": "QuckMessagePage", - "pageSourceFile": "src/main/ets/pages/QuickMessagePage.ets", - "buildFunction": "QuickMessagePageBuilder", - "data": { - "description": "this is QuickMessagePage page" - } - }, { "name": "ChatTeamPage", "pageSourceFile": "src/main/ets/pages/ChatTeamPage.ets", diff --git a/common/src/main/ets/builder/NavigationBackBuilder.ets b/common/src/main/ets/builder/NavigationBackBuilder.ets index 467aad7..fd03ccd 100644 --- a/common/src/main/ets/builder/NavigationBackBuilder.ets +++ b/common/src/main/ets/builder/NavigationBackBuilder.ets @@ -15,6 +15,7 @@ interface NavigationBackBuilderParams { showDivideLine?: boolean; rightButtonTitle?: ResourceStr; rightButtonColor?: ResourceColor; + rightButtonEnable?: boolean; rightButtonIcon?: Resource; rightButtonAction?: (() => void); backgroundColor?: ResourceColor; @@ -89,7 +90,7 @@ export function NavigationBackBuilder(params?: NavigationBackBuilderParams) { if (params?.rightButtonTitle) { Text(params?.rightButtonTitle) .fontSize(14) - .fontColor(params?.rightButtonColor??Color.White) + .fontColor(Color.White) .width(params?.buttonTextWidth ?? 80) .height(35) .textAlign(TextAlign.Center) @@ -98,9 +99,10 @@ export function NavigationBackBuilder(params?: NavigationBackBuilderParams) { // }) .borderRadius(4) // .height(18) - .backgroundColor($r('app.color.top_title')) + .backgroundColor(params?.rightButtonColor??$r('app.color.top_title')) .margin({ right: 5 }) .onClick(params?.rightButtonAction) + // .enabled(params?.rightButtonEnable??true) } diff --git a/common/src/main/resources/base/element/color.json b/common/src/main/resources/base/element/color.json index 8efd88b..48469c2 100644 --- a/common/src/main/resources/base/element/color.json +++ b/common/src/main/resources/base/element/color.json @@ -69,6 +69,10 @@ { "name": "patient_theme", "value": "#3cc7c0" + }, + { + "name": "tab_text_nor", + "value": "#848284" } ] } \ No newline at end of file diff --git a/commons/basic/Index.ets b/commons/basic/Index.ets index 1e99bb2..3ce6316 100644 --- a/commons/basic/Index.ets +++ b/commons/basic/Index.ets @@ -87,4 +87,6 @@ export { ChangePhotoGrids } from './src/main/ets/components/ChangePhotoGrids' export { InputPopWindow } from './src/main/ets/Views/InputPopWindow' -export { ChatExtModel,ChatParam } from './src/main/ets/models/ChatExtModel' \ No newline at end of file +export { ChatExtModel,ChatParam } from './src/main/ets/models/ChatExtModel' + +export { PatientListModel,PatientsData } from './src/main/ets/models/PatientListModel' \ No newline at end of file diff --git a/commons/basic/src/main/ets/Views/PerfactInputSheet.ets b/commons/basic/src/main/ets/Views/PerfactInputSheet.ets index 78a5c02..9177ce3 100644 --- a/commons/basic/src/main/ets/Views/PerfactInputSheet.ets +++ b/commons/basic/src/main/ets/Views/PerfactInputSheet.ets @@ -158,20 +158,20 @@ export struct PerfactInputSheet { Text(this.inputPlaceholder) .fontColor('#444444') .backgroundColor(Color.White) - .padding({left:10,right:10}) + .padding({left:10,right:10,bottom:20}) } .backgroundColor(Color.White) Text('').height(1).width('100%') .backgroundColor($r('app.color.home_gray')).margin({top:10}) - Row({ space: 20 }) { + Row() { Text(this.cancelText) .fontSize(15) .fontColor(this.cancelColor) .textAlign(TextAlign.Center) - .width('45%').height(30) + .height(30).layoutWeight(1) .onClick(() => { if(this.needcancelCallBack) { @@ -191,11 +191,11 @@ export struct PerfactInputSheet { this.inputCallBack(this.inputText, this.inputTitle); }) - .width('45%').height(30) + .height(30).layoutWeight(1) - }.margin({ top: 10, bottom: 10 }) + }.margin({ top: 10, bottom: 10 }).width('100%') } .width('80%').backgroundColor(Color.White) }.borderRadius(24) diff --git a/commons/basic/src/main/ets/components/HdSearchNav.ets b/commons/basic/src/main/ets/components/HdSearchNav.ets index f2b3808..ba503a3 100644 --- a/commons/basic/src/main/ets/components/HdSearchNav.ets +++ b/commons/basic/src/main/ets/components/HdSearchNav.ets @@ -29,15 +29,17 @@ export struct HdSearchNav { isFocus:boolean = false; @Prop placeholder:string = '' - + @Prop + isLeftAction: boolean = false @State textInputContent:string = '' - + // 添加左侧点击函数 + private leftItemAction:()=> void = () => {}; build() { Row() { Row() { Image(this.leftIcon) .size({ width: 24, height: 24 }) - .onClick(() => router.back()) + .onClick(() =>this.isLeftAction? this.leftItemAction(): router.back()) .fillColor($r('app.color.black')) }.size({ width: 40, height: 50 }) diff --git a/commons/basic/src/main/ets/constants/BasicConstant.ets b/commons/basic/src/main/ets/constants/BasicConstant.ets index 9836cdf..e936073 100644 --- a/commons/basic/src/main/ets/constants/BasicConstant.ets +++ b/commons/basic/src/main/ets/constants/BasicConstant.ets @@ -81,6 +81,12 @@ export class BasicConstant { static readonly getInterrogation = BasicConstant.urlExpertAPI +"getInterrogation";// 一问多答 详情页 static readonly InterrogationPatientInfo = BasicConstant.urlExpertAPI +"InterrogationPatientInfo";// 一问多答 患者详情页 static readonly updateInterrogationAnswer = BasicConstant.urlExpertAPI+"updateInterrogationAnswer";// 一问多答 编辑回答 + static readonly closeConsult= BasicConstant.urlExpert + "closeConsult";// 关闭公益咨询 + static readonly polularScienceArticleListByKeywordsNew= BasicConstant.urlExpertApp + "polularScienceArticleListByKeywordsNew";// 患教学堂搜索 + static readonly polularScienceArticleListInexpertNew= BasicConstant.urlExpertApp+ "polularScienceArticleListInexpertNew";// 患教学堂 + static readonly patientVideoType= BasicConstant.urlExpertApp +"patientVideoType";// 患者视频类型列表 + static readonly patientVideoByName= BasicConstant.urlExpertApp +"patientVideoByName";//患教视频科普分享 + static readonly patientListByGBK= BasicConstant.urlExpertApp +"patientListByGBK";// 我的患者列表 static readonly province=['全国','北京市','天津市','河北省','山西省' ,'内蒙古自治区','辽宁省','吉林省','黑龙江省','上海市','江苏省','浙江省' ,'安徽省','福建省','江西省','山东省','河南省','湖北省','湖南省','广东省', diff --git a/commons/basic/src/main/ets/models/ChatExtModel.ets b/commons/basic/src/main/ets/models/ChatExtModel.ets index e6cb51a..04c2890 100644 --- a/commons/basic/src/main/ets/models/ChatExtModel.ets +++ b/commons/basic/src/main/ets/models/ChatExtModel.ets @@ -12,5 +12,7 @@ export interface ChatParam extends ChatExtModel{ name:string,//患者姓名 conversationId:string,//最近会话id chat_state:string//公益咨询状态 - + rawAttach:string;//发送公益咨询首条消息 + hasMessage:string;//是否需要发送一条消息 + messageType:string;//发送消息的类型 } \ No newline at end of file diff --git a/commons/basic/src/main/ets/models/PatientListModel.ets b/commons/basic/src/main/ets/models/PatientListModel.ets new file mode 100644 index 0000000..a051d53 --- /dev/null +++ b/commons/basic/src/main/ets/models/PatientListModel.ets @@ -0,0 +1,37 @@ +import { List } from '@kit.ArkTS'; +export interface PatientListModel{ + + code:string; + data:PatientsData[]; + +} + + + +export interface PatientsData{ + mobile:string;// 手机号 + realName:string;// 患者姓名 + photo:string;// 患者头像路径 + uuid:string;// 唯一标示 + birthDate:string;// 患者出生日期 + sex:number;// 患者性别(0.男 1.女) + type:number;// 类型//1.随访关系 2.包月服务关系 (type==2即为VIP) + provId:string;// 省id + cityId:string;// 市id + countyId:string;// 区县id + nation:string;// 民族 + nickname:string;// 别名 + note:string;// 备注内容 + + // 新的患者增加的 + patientUuid:string;// 患者uuid + expertUuid:string;// 专家uuid + createDate:string;// 申请时间 + content:string;// 申请内容 + status:number;// 新的患者申请,状态(1.待审核2.审核通过3.拒绝 4.已过期) + join_date:string;//随访时间 + diagnosis:string;//患病类型 + sortLetters:string; // 显示数据拼音的首字母 + isSelect:boolean; +} + diff --git a/commons/basic/src/main/resources/base/media/argee_commient.png b/commons/basic/src/main/resources/base/media/argee_commient.png new file mode 100644 index 0000000000000000000000000000000000000000..2aa70d287c3864674c907329c2d0dc837c29b2da GIT binary patch literal 1678 zcmeAS@N?(olHy`uVBq!ia0vp^x**KK1|+Sd9?b$$k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m^Cs(B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxOgGuU%v{0TQqR!T z+}y-mN5ROz&{W^RSl`${*T~q)#K6kLNC66zfVLH-q*(>IxIyg#@@$ndN=gc>^!3Zj z%k|2Q_413-^$jg8E%gnI^o@*kfhu&1EAvVcD|GXUm0>2hq!uR^WfqiV=I1GZOiWD5 zFD$Tv3bSNU;+l1ennz|zM-B0$V)JVzP|XC=H|jx7ncO3BHWAB;NpiyW)Z+ZoqGVvir744~DzI`cN=+=uFAB-e&w+(vKt_H^esM;Afr7I$IMft0d=ry1 z^FV@{U|qhxR-SpqC5d^-sh%#jNT7Usl;eK0DBW~*bVJ#y+m>tWWD|lLI=}3Z{lRyK z=~2-3fL}G+QkSVSi+=eNeCqpw=!aJ~DP7xf+(K$QuSd{r@kftyh4yy*$X)xE`D4~> zm-VW3@!7K-|McoEy6PFM{ztl?{gxZk)~jRxPWwG$TlNNB)qhsE=O$~oo@aZ< zDEuT+_NMq2yRS#|pBi0u-sr!c(a*c);qAVLy7?XcOtXwSV&jy|US83*4Sv?dcsf93 zg;#F;QwPxvOgA)CZ(BXcI#6)x`uw&z6Yd{yP0&B`UCPz@jf{x;5&!zY$-f$womv^b z@b8B~iO!+)<&aqh?_B_h7 z(l2O-eCnDSviq_PSAP7C3BA{|+I_ZjFM2Li|L)XYckYkw*Sg#6r+dl0oX?)CcgBQ0 zUTgiE0>>{kkNiIfs>KS#=6l>+BYM|k&t2AwT5sm6?qPpX-tysj|ILnP+IoI& zl^a&sbiO-b=Ke-jw%mwWT4p-2@pXcqo{?CrUyc1o zU#7c!PY(JT8P+_6w>nGk% xn)UjR;Pt@vlctv);y#`~zv#t(pD*@|Yz+Q2t9d%_`=x_w2v1i(mvv4FO#l;#jGO=f literal 0 HcmV?d00001 diff --git a/commons/basic/src/main/resources/base/media/arrow_right.png b/commons/basic/src/main/resources/base/media/arrow_right.png new file mode 100644 index 0000000000000000000000000000000000000000..2251fc2148a2a92300912c12f67a417485f279f6 GIT binary patch literal 1206 zcmeAS@N?(olHy`uVBq!ia0vp^{6H+l!3HEV&ax!|DajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_cg49tp|ArU1JzCKpT`MG+DAT@dwxdlMo3=B5*6$OdO*{LN8 zNvY|XdA3ULckfqH$V{%1*XSQL?vFu&J;D8jzb> zlBiITo0C^;Rbi_HHrEQs1_|pcDS(xfWZNo192Makpx~Tel&WB=XR4cQU}&OXZmDNz zYG`6%sH0$HU}&swV61OwtZQgwWngJ#XsQ4ONh+i#(Mch>H3D2mX`VkM*2oZxQ#zd*s+SwSN_GcP5- zyjT;g+}GF2Gq1QLF)umQ)5TT^XnMv>2~2MaLa#GUy`YqkTL84#CABECEH%ZgC_h&L>|?7;+-|YN zX&zK>3U0SJ;?%1Tbc{YIUXkJ%CIn18ASOK30y*$>pPC0u>_xy-ZFpU$j)8$u+tbA{ zq~g|`DF=C*90Xh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/base/media/new_patient.png new file mode 100644 index 0000000000000000000000000000000000000000..ade0c70ad9b33a01fc609f85bdeb7690084afbef GIT binary patch literal 5968 zcmaJ_cQl;q*B!kRTto;%L^q?CF?xwk^xjK|DVSmOPLSv&2qMv=_ZBq>fSoujYEpc51Tz+-bYG)0+eYe5_k zFp%AE3_u*iFQ=1+|e%PLEvG{5+iu z{B#T*{2n_3M3>ZBq}My4-^&@5&;W}fQ3W^goGi2QV=0A;9n2>O*BtO zXNbPC>R+*LRx<35P$(n>4EFKy0r`l45S}hzAt@;-u%IwlSXkf&A>ic;N7-Qn;9mFs zR#0~Ga`1FTqFfPh;BQ4cdjuLK!+zuRKPkYF|H#6<{wmW=!N3?hBv=R}_&cS)f!f;t zKNJT02knK@clxj2|5Mn@&==_h)_3wkpgkRK4$k@B?@&mHlBbg$3gKypK)C;1MZHG| z6vFEf0tr-70&<(U!W|JlUOa!owY4GYa4(b{+`&m*S%&>a0OacG2oV<*7gbOalTc7m zR1gwU5mQhSRZ$WamlP3FQdSn1l=_>ijBr51oZzUxxsLzkO8zVNcPGG*H<6W{JYBt= z992CLFyNmVLtOvei`c*F{l#_scQ4}q$_3w;0slVN|8>rPZ{0M{@995Xd$ahb@15W` z&F*>A)lw%uUjYExK6PaUL(Ke+6$#4lxaHb;5Hk0^Bk>tNTa?ku*pP^*Me|9e#}6NG zPs|kS+I%-yF4dKRE&92?`R+fJ>*mjYUO%R23!&F#YR}pfrviAE1E@jvqpCHjEX= z`AGSzaz+i&I0XzbJJ`PmRN*&b46DQ6#Dar$BG)3ZJ{k|HiJsHooBm0qk6A6l^W9V-oe7ClnUKABaJBtnWMTlaO>4Eadp@i5fAqh8QqLL%iTY+ zm+zj2YUb;F?}yE{k9=> z2%mBQz3RO<4wnahJV*JeaihE`qFVWL&U@`@(b^ml^cBSW6a=|zG1}Bn-F?Nc*Z9K5 zq&k`doOf8zev5 zUT$C`yK=3#FiF_C$-Ivgona}u0(68#QF*>x0Mr#ku5kCuVHCWgOGJs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y zvh!xJ+U@tNZD`PF>!9h_6P}@H_Mt=j!|vbT+6U+MRX3Tj$fRwlwR-DBmeXHPl4FdOs&N#o331?3Sh+ zgf7BHN<_+?mQ=bAQN*E(WLBesPce1!=U$}gn*)&kN~(0Eq9!$&AT#VyBarn4)g+aV zrc&Q0Pd?0^0{)@U8UJa^4S!XnJHISz>dWkuaocfk70oZUEN_ul`B;hW+PCxCK?shkZ;DXC(F$L_m^Ev$4)q#p_xviEWI^L`;=3fBF!wW2xZJ_;(vws+YckZUepPXlr_3Nk@ubCjOL8Kw6eY@ZL1hX+u{xTw;=vC0MeGlF8Nj8VKhU6bd)xua2lLCF{ij%?xC zkAtWx!1px7`8e+KB*p4h)r~+%8cPctlKmxo=|SHK`>2KH!{3cO9|FEh0HZ|nFZ}$f z;Io!FxIl7HJl}nw-hX=(SQvO}p*P%)$^RbyEPV+UO`8tGcAJ49>5p}eybV*SJOdeD cYXk5A)HhG{hb}+4`RiYtjfDfI2IZUZKPYc5q5uE@ literal 0 HcmV?d00001 diff --git a/commons/basic/src/main/resources/base/media/read_commient.png b/commons/basic/src/main/resources/base/media/read_commient.png new file mode 100644 index 0000000000000000000000000000000000000000..ae3cb9517bc94339a3ecfcf365edc7a51d811bee GIT binary patch literal 1964 zcmaJ?c~BEq91e2CQV(=IAoW-xN>td~2??YU5{>}D5Rf7&Ws|J3Lb5U0NCKr&q9Wjd zS`n1P3oYP*)~g_N3KEAh^sbpXTf+Y#a z?}Cbz$^a3ng8??k@mA6}T!701>1-~S#q|OhG&-9~V^WzkZw8akqVZV_;Qd3!z3Eh| z`Eqg4dtdlTKu*LkEuTtFNl5`ym>{ZKL#6Y0JSvSrWiY&Pgty+L!62izMn7*hs0OepLJHJ?3CMV)?@~}}KgeqI@5_W2jB13mR60nrr8EkZO8+0KR)0Y2F**EC zy#Fbzk2YyxsvOp%2AvXb-0FEYS6aSE2SXUDi$>Ap(JIOkQ4G~5qFO*C8mSsUkwQvD zV>2!sVM(QYiAIk>8YL_d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ewe*1US)_@-EvPhkx<-(u9gTe~DWM4fH?2oo literal 0 HcmV?d00001 diff --git a/features/Home/src/main/resources/base/media/triangle_green_theme.png b/commons/basic/src/main/resources/base/media/triangle_green_theme.png similarity index 100% rename from features/Home/src/main/resources/base/media/triangle_green_theme.png rename to commons/basic/src/main/resources/base/media/triangle_green_theme.png diff --git a/features/Home/src/main/resources/base/media/triangle_normal.png b/commons/basic/src/main/resources/base/media/triangle_normal.png similarity index 100% rename from features/Home/src/main/resources/base/media/triangle_normal.png rename to commons/basic/src/main/resources/base/media/triangle_normal.png diff --git a/features/Home/src/main/ets/polyv/VideoUtil.ets b/features/Home/src/main/ets/polyv/VideoUtil.ets index 67ce6dc..838e5ec 100644 --- a/features/Home/src/main/ets/polyv/VideoUtil.ets +++ b/features/Home/src/main/ets/polyv/VideoUtil.ets @@ -84,6 +84,75 @@ class VideoTools { }) } + getVideoDetails(video_uuid:string) + { + + this.hashMap.clear(); + this.hashMap.set('video_uuid', video_uuid) + hdHttp.httpReq(BasicConstant.videoDetail,this.hashMap).then(async (res: HdResponse) => { + + logger.info('Response videoDetail'+res); + let json:VideoDetailModel = JSON.parse(res+'') as VideoDetailModel; + if(json.video.polyv_uuid==null||json.video.polyv_uuid==undefined) + { + if(json.video.content!=null) + { + let content=json.video.content + let split = content.split("\"vid\" : "); + if (split.length<2){ + split = content.split("'vid' : "); + if (split.length>1){ + let split1 = split[1].split("'"); + this.goPLVMediaPlayerOnlyVideoPage(split1[1],video_uuid) + + }else { + promptAction.showToast({ message: '视频信息错误' }) + this.goPLVMediaPlayerOnlyVideoPage('',video_uuid) + } + }else if(split.length>1){ + let split1 = split[1].split("\""); + this.goPLVMediaPlayerOnlyVideoPage(split1[1],video_uuid) + } + } + else + { + promptAction.showToast({ message: '视频信息错误' }) + this.goPLVMediaPlayerOnlyVideoPage('',video_uuid) + } + + } + else + { + this.goPLVMediaPlayerOnlyVideoPage(json.video.polyv_uuid,video_uuid) + } + + + }).catch((err: BusinessError) => { + this.goPLVMediaPlayerOnlyVideoPage('',video_uuid) + }) + + } + + async goPLVMediaPlayerOnlyVideoPage(vid:string,video_uuid:string) + { + const mediaResourcesResult = await runCatching(PLVMockMediaResourceData.getInstance().setupMediaResourcesFromLocal(vid,mockViewerParam)) + if (mediaResourcesResult.success === false) { + promptAction.showToast({ + message: `'视频数据初始化失败': ${mediaResourcesResult.error}`, + duration: seconds(3).toMillis() + }) + return + } + const mediaResource = mediaResourcesResult.data[0] + router.pushUrl({ + url:'pages/VideoPage/PLVMediaPlayerOnlyVideoPage', + params: { + video_uuid:video_uuid, + param:new PLVMediaPlayerSingleVideoPageParam(mediaResource) + } + }) + } + } export const videoTools = new VideoTools() \ No newline at end of file diff --git a/features/netease/oh-package.json5 b/features/netease/oh-package.json5 index da6bbef..3292f19 100644 --- a/features/netease/oh-package.json5 +++ b/features/netease/oh-package.json5 @@ -13,6 +13,6 @@ "@nimsdk/base": "10.9.10", "@nimkit/common": "file:../../common", "@nimkit/localconversationkit_ui": "file:../../localconversationkit_ui", - + "refreshlib": "file:../../RefreshLib" } } \ No newline at end of file diff --git a/features/netease/src/main/ets/components/ItemCompPublic.ets b/features/netease/src/main/ets/components/ItemCompPublic.ets index c8a6709..7443fd4 100644 --- a/features/netease/src/main/ets/components/ItemCompPublic.ets +++ b/features/netease/src/main/ets/components/ItemCompPublic.ets @@ -2,7 +2,8 @@ import { ConsulList } from '../model/ConsulModel' import { router } from '@kit.ArkUI' import { BasicConstant, ChatParam, preferenceStore } from '@itcast/basic'; -import { ChatKitClient } from '@nimkit/chatkit'; +import { ChatKitClient, LocalConversationRepo } from '@nimkit/chatkit'; +import { HMRouterMgr } from '@hadss/hmrouter'; @Preview @@ -11,10 +12,11 @@ export struct ItemCompPublic { @Prop item:ConsulList; @State isHistory:boolean = false;//是否是我已回答 @State status:string='' + @State unreadCount:number=0 aboutToAppear(): void { - + this.getUnread() } - pathStack: NavPathStack = new NavPathStack() + // pathStack: NavPathStack = new NavPathStack() build() { Column() { @@ -26,13 +28,16 @@ export struct ItemCompPublic { Text(this.item.createDate ? this.item.createDate.length > 16 ? this.item.createDate.substring(1, 16) : this.item.createDate : '') .fontSize(15).fontColor($r('app.color.top_title')).padding({ left: 5 }) - Text('') - .width(11) - .height(11) + Text(this.unreadCount>100?'...':this.unreadCount+'') + .width(18) + .height(18) + .fontSize(11) + .textAlign(TextAlign.Center) + .fontColor(Color.White) .backgroundColor('#ffff3e3e') .borderRadius(20) .margin({ top: -20 }) - .visibility(this.isHistory ? Visibility.Visible : Visibility.None) + .visibility(this.unreadCount>0&&this.item.state!=3 ? Visibility.Visible : Visibility.None) } @@ -56,10 +61,13 @@ export struct ItemCompPublic { .borderRadius(17) .textAlign(TextAlign.Center) .onClick(() => { - router.pushUrl({ - url: 'pages/Netease/ConsultationDetailPage', - params: { uuid: this.item.uuid, isHistory: this.isHistory + '' } - }); + HMRouterMgr.push({ pageUrl: 'ConsultationDetailPage' , param: { + uuid: this.item.uuid, isHistory: this.isHistory+'' + } }) + // router.pushUrl({ + // url: 'pages/Netease/ConsultationDetailPage', + // params: { uuid: this.item.uuid, isHistory: this.isHistory + '' ,patientUuid:this.item.patientUuid} + // }); }) Text(this.item.diseaseName.includes("甲、乙、丙、丁") ? '肝炎' : this.item.diseaseName) .fontSize(11) @@ -83,22 +91,31 @@ export struct ItemCompPublic { { preferenceStore.setItemString('gdxz_consult_uuid', this.item.uuid) preferenceStore.setItemString('gdxz_sessionType', BasicConstant.consult) - this.pathStack.pushPath({ - name: "ChatP2PPage", - param: { - conversationId: ChatKitClient.nim.conversationIdUtil.p2pConversationId(this.item.patientUuid.toString() - .toLowerCase()), - name: this.item.realName, - chat_state:this.item.state+'' - } as ChatParam - }) + HMRouterMgr.push({ pageUrl: 'ChatP2PPage' , param: { + conversationId: ChatKitClient.nim.conversationIdUtil.p2pConversationId(this.item.patientUuid.toString() + .toLowerCase()), + name: this.item.realName, + chat_state:this.item.state+'' + } as ChatParam}) + // this.pathStack.pushPath({ + // name: "ChatP2PPage", + // param: { + // conversationId: ChatKitClient.nim.conversationIdUtil.p2pConversationId(this.item.patientUuid.toString() + // .toLowerCase()), + // name: this.item.realName, + // chat_state:this.item.state+'' + // } as ChatParam + // }) } else { - router.pushUrl({ - url: 'pages/Netease/ConsultationDetailPage', - params: { uuid: this.item.uuid,isHistory:this.isHistory+''} - }); + HMRouterMgr.push({ pageUrl: 'ConsultationDetailPage' , param: { + uuid: this.item.uuid, isHistory: this.isHistory+'' + } }) + // router.pushUrl({ + // url: 'pages/Netease/ConsultationDetailPage', + // params: { uuid: this.item.uuid,isHistory:this.isHistory+''} + // }); } @@ -108,5 +125,11 @@ export struct ItemCompPublic { } + getUnread() + { + + this.unreadCount = LocalConversationRepo.getTotalUnreadCount() ?? 0 + } + } diff --git a/features/netease/src/main/ets/components/ItemCompTeach.ets b/features/netease/src/main/ets/components/ItemCompTeach.ets new file mode 100644 index 0000000..8e5dd7a --- /dev/null +++ b/features/netease/src/main/ets/components/ItemCompTeach.ets @@ -0,0 +1,122 @@ +import { HMRouterMgr } from '@hadss/hmrouter'; +import { BasicConstant, TimestampUtil } from '@itcast/basic'; +import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet'; +import { LengthMetrics, router } from '@kit.ArkUI' +import { ChatKitClient } from '@nimkit/chatkit'; +import { customAttachment } from '@nimkit/chatkit_ui/src/main/ets/view/MessageComponentBuilder'; +import { StringIsEmpty } from '@nimkit/common'; +import { PatientTBean } from '../model/TeachModel'; + + +@Preview +@Component +export struct ItemCompTeach { + @Prop item:PatientTBean; + + aboutToAppear(): void { + this.initDialog() + } + private dialog!:CustomDialogController; + @State inputPlaceholder:string='' + initDialog() { + this.dialog = new CustomDialogController({ + builder:PerfactInputSheet({ + controller:this.dialog, + inputTitle:'是否确定发送此患教科普', + inputPlaceholder:this.inputPlaceholder, + style:'2', + okText:'发送', + okColor:$r('app.color.top_title'), + inputCallBack:(input: string,title:string)=>{ + let img=StringIsEmpty(this.item.imgPath)?"http://doc.igandan.com/app/html/img/2016/20160714132557.png":BasicConstant.urlHtml+this.item.imgPath + const jsonData:customAttachment = { + gdxz_title: this.item.topic, + gdxz_url:BasicConstant.urlHtml+this.item.path, + gdxz_content:this.item.summary, + gdxz_id: this.item.uuid, + gdxz_img:img , + gdxz_type: BasicConstant.Teach, + gdxz_ext_data: '' + } + + + HMRouterMgr.pop({param:JSON.stringify(jsonData)}) + + + } + }), + keyboardAvoidDistance: LengthMetrics.vp(0), // 设置弹窗底部与键盘顶部间距(单位:vp) + alignment: DialogAlignment.Center, + customStyle: true, + autoCancel: false, + backgroundColor: ('rgba(0,0,0,0.5)'), + height: '100%' + }) + } + build() { + + Column() + { Row() + { + Image(BasicConstant.urlHtml+this.item.imgPath).width(114).height(76).alt($r('app.media.home_scroll_default1')) + Column() + { + Text(this.item.topic).fontColor($r('app.color.common_gray_01')).fontSize(16) .textOverflow({ overflow: TextOverflow.Ellipsis }).height(40) + .ellipsisMode(EllipsisMode.END).maxLines(2) .textAlign(TextAlign.Start).align(Alignment.TopStart) + .width('100%') + Row() + { + Row() { + Text('今日') + .borderRadius(30) + .fontColor(Color.White) + .backgroundColor('#f24d57') + .fontSize(11) + .padding({ left: 5, right: 5,top:2,bottom:2 }) + .visibility(TimestampUtil.isToday(this.item.modifyDate) ? Visibility.Visible : Visibility.None) + Text(this.item.modifyDate.length > 10 ? this.item.modifyDate.substring(5, 10) : this.item.modifyDate) + .fontColor($r('app.color.common_gray_03')) + .fontSize(12) + + .visibility(!TimestampUtil.isToday(this.item.modifyDate) ? Visibility.Visible : Visibility.None) + }.width(80).align(Alignment.Start) + + Row() { + Image($r('app.media.read_commient')).width(10).height(10) + Text(this.item.readnum > 100000 ? this.item.readnum * 1.000 / 10000.00 + '万' : this.item.readnum + '') + .fontColor($r('app.color.common_gray_03')).padding({left:3}) + .fontSize(12) + }.width(80).align(Alignment.Start) + + Row() { + Image($r('app.media.argee_commient')).width(10).height(10) + Text(this.item.agreenum > 100000 ? this.item.agreenum * 1.000 / 10000.00 + '万' : this.item.agreenum + '') + .fontColor($r('app.color.common_gray_03')).padding({left:3}) + .fontSize(12) + }.width(80).align(Alignment.Start) + } + .margin({top:10}) + .width('100%') + }.padding({left:10}) + .layoutWeight(1) + + }.alignSelf(ItemAlign.Start) + + .width('100%') + .padding(10) + .onClick(() => { + this.inputPlaceholder=this.item.topic + this.dialog.open() + }) + Text().backgroundColor($r('app.color.efefef')).width('100%').height(1) + + } + + } + + + + + +} + diff --git a/features/netease/src/main/ets/components/ItemCompTeachVideo.ets b/features/netease/src/main/ets/components/ItemCompTeachVideo.ets new file mode 100644 index 0000000..3e1fdf9 --- /dev/null +++ b/features/netease/src/main/ets/components/ItemCompTeachVideo.ets @@ -0,0 +1,114 @@ +import { HMRouterMgr } from '@hadss/hmrouter'; +import { BasicConstant, TimestampUtil } from '@itcast/basic'; +import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet'; +import { LengthMetrics, router } from '@kit.ArkUI' +import { ChatKitClient } from '@nimkit/chatkit'; +import { customAttachment } from '@nimkit/chatkit_ui/src/main/ets/view/MessageComponentBuilder'; +import { StringIsEmpty } from '@nimkit/common'; +import { PatientVBean } from '../model/TeachVideoModel'; + + +@Preview +@Component +export struct ItemCompTeachVideo { + @Prop item:PatientVBean; + + aboutToAppear(): void { + this.initDialog() + } + private dialog!:CustomDialogController; + @State inputPlaceholder:string='' + initDialog() { + this.dialog = new CustomDialogController({ + builder:PerfactInputSheet({ + controller:this.dialog, + inputTitle:'是否确定发送此患教科普', + inputPlaceholder:this.inputPlaceholder, + style:'2', + okText:'发送', + okColor:$r('app.color.top_title'), + inputCallBack:(input: string,title:string)=>{ + let img=StringIsEmpty(this.item.imgpath)?"http://doc.igandan.com/app/html/img/2016/20160714132557.png":BasicConstant.urlHtml+this.item.imgpath + const jsonData:customAttachment = { + + gdxz_title: this.item.name, + gdxz_url:BasicConstant.urlHtml+this.item.path, + gdxz_content:'肝胆相照®肝胆病在线公共服务平台', + gdxz_id: this.item.uuid, + gdxz_img:img, + gdxz_type: BasicConstant.VideoTeach, + gdxz_ext_data: '' + } + + + HMRouterMgr.pop({param:JSON.stringify(jsonData)}) + + + } + }), + keyboardAvoidDistance: LengthMetrics.vp(0), // 设置弹窗底部与键盘顶部间距(单位:vp) + alignment: DialogAlignment.Center, + customStyle: true, + autoCancel: false, + backgroundColor: ('rgba(0,0,0,0.5)'), + height: '100%' + }) + } + build() { + + Column() + { Row() + { + Image(BasicConstant.urlHtml+this.item.imgpath).width(114).height(76).alt($r('app.media.home_scroll_default1')).borderRadius(4) + Column() + { + Text(this.item.name).fontColor($r('app.color.common_gray_01')).fontSize(16) .textOverflow({ overflow: TextOverflow.Ellipsis }).height(40) + .ellipsisMode(EllipsisMode.END).maxLines(2) .textAlign(TextAlign.Start).align(Alignment.TopStart) + .width('100%') + Text(this.item.public_name) + .fontColor($r('app.color.common_gray_03')) + .fontSize(14) + .width('100%').textAlign(TextAlign.Start) + Row() + { + Row() { + + Text(this.item.create_date.split(" ")[0]) + .fontColor($r('app.color.common_gray_03')) + .fontSize(12) + }.width(100).align(Alignment.Start) + + Row() { + Image($r('app.media.read_commient')).width(10).height(10) + Text(this.item.readnum > 100000 ? this.item.readnum * 1.000 / 10000.00 + '万' : this.item.readnum + '') + .fontColor($r('app.color.common_gray_03')).padding({left:3}) + .fontSize(12) + }.width(80).align(Alignment.Start) + + + } + .margin({top:10}) + .width('100%') + }.padding({left:10}) + .layoutWeight(1) + + }.alignSelf(ItemAlign.Start) + + .width('100%') + .padding(10) + .onClick(() => { + this.inputPlaceholder=this.item.name + this.dialog.open() + }) + Text().backgroundColor($r('app.color.efefef')).width('100%').height(1) + + } + + } + + + + + +} + diff --git a/features/netease/src/main/ets/components/ListCompPublic.ets b/features/netease/src/main/ets/components/ListCompPublic.ets index f711c16..2084560 100644 --- a/features/netease/src/main/ets/components/ListCompPublic.ets +++ b/features/netease/src/main/ets/components/ListCompPublic.ets @@ -9,7 +9,7 @@ import HashMap from '@ohos.util.HashMap'; @Component export struct ListCompPublic { - pathStack: NavPathStack = new NavPathStack() + // pathStack: NavPathStack = new NavPathStack() @State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量 @Prop @Watch('onUpdate') @@ -207,7 +207,7 @@ export struct ListCompPublic { { ForEach(this.list, (item: ConsulList) => { ListItem() { - ItemCompPublic({ item,isHistory:this.isHistory,pathStack: this.pathStack }) + ItemCompPublic({ item,isHistory:this.isHistory }) } diff --git a/features/netease/src/main/ets/model/Groups.ets b/features/netease/src/main/ets/model/Groups.ets new file mode 100644 index 0000000..f954a5b --- /dev/null +++ b/features/netease/src/main/ets/model/Groups.ets @@ -0,0 +1,14 @@ +import { PatientsData } from '@itcast/basic'; + +export class Groups { + + /** + * 处理后的数据分组标题 + */ + title: string = ''; + + /** + * RegionData数组 + */ + regionDataList: Array = []; +} \ No newline at end of file diff --git a/features/netease/src/main/ets/model/TeachModel.ets b/features/netease/src/main/ets/model/TeachModel.ets new file mode 100644 index 0000000..810a9aa --- /dev/null +++ b/features/netease/src/main/ets/model/TeachModel.ets @@ -0,0 +1,31 @@ +export interface TeachModel { + code:string; + data:PatientTBean[]; + message:string; + totalPage:number +} + + + +export interface PatientTBean{ + + expertName:string; + imgPath:string; + topic:string; + publisherUuid:string; + recommendedUuid:string; + isOriginal:string; + isThrough:string; + filePath:number; + uuid:string; + agreenum:number; + readnum:number; + submitDate:string; + modifyDate:string; + summary:string; + type:string; + path:string; + tags:string; + content:string; +} + diff --git a/features/netease/src/main/ets/model/TeachVideoModel.ets b/features/netease/src/main/ets/model/TeachVideoModel.ets new file mode 100644 index 0000000..b745241 --- /dev/null +++ b/features/netease/src/main/ets/model/TeachVideoModel.ets @@ -0,0 +1,31 @@ +export interface TeachVideoModel { + code:string; + data:TeachVideo; + message:string; + +} + + +export interface TeachVideo { + totalPage:number, + list:PatientVBean[]; + +} + +export interface PatientVBean{ + + type_uuid:string; + imgpath:string; + public_name:string; + sort:string; + uuid:string; + readnum:number; + create_date:string; + name:string; + status:string; + path:string; + tags:string; + note:string; + video_type_name:string; +} + diff --git a/features/netease/src/main/ets/model/patientVideoTypeModel.ets b/features/netease/src/main/ets/model/patientVideoTypeModel.ets new file mode 100644 index 0000000..c38a617 --- /dev/null +++ b/features/netease/src/main/ets/model/patientVideoTypeModel.ets @@ -0,0 +1,20 @@ +export interface patientVideoTypeModel { + code:string; + data:VideoTypeBean[]; + message:string; + +} + + + +export interface VideoTypeBean{ + + + uuid:string; + sort:number; + status:number; + note:string; + name:string; + +} + diff --git a/features/netease/src/main/ets/view/ConsultationDetailComp.ets b/features/netease/src/main/ets/view/ConsultationDetailComp.ets index f6dd780..b810ccb 100644 --- a/features/netease/src/main/ets/view/ConsultationDetailComp.ets +++ b/features/netease/src/main/ets/view/ConsultationDetailComp.ets @@ -1,25 +1,36 @@ -import { authStore, BaseBean, BasicConstant, hdHttp, HdLoadingDialog, HdNav, HdResponse, +import { authStore, BaseBean, BasicConstant, + ChatParam, + hdHttp, HdLoadingDialog, HdNav, HdResponse, PhotoGrids, + preferenceStore, ViewImageInfo} from '@itcast/basic' import { HashMap } from '@kit.ArkTS'; import { ConsultDetail, ConsultPhoto } from '../model/ConsulModel'; import { BusinessError } from '@kit.BasicServicesKit'; import { promptAction, router } from '@kit.ArkUI'; import { PerfactInputSheet } from '@itcast/basic/src/main/ets/Views/PerfactInputSheet'; +import { ChatKitClient } from '@nimkit/chatkit'; +import { customAttachment } from '@nimkit/chatkit_ui/src/main/ets/view/MessageComponentBuilder'; +import { HMRouter, HMRouterMgr } from '@hadss/hmrouter'; - +@HMRouter({ + pageUrl: 'ConsultationDetailPage' +}) @Component export struct ConsultationDetailComp { @State patientName: string='' ; hashMap: HashMap = new HashMap(); - @State params:Record = router.getParams() as Record; + // @State params:Record = router.getParams() as Record; + @State params:Record= HMRouterMgr.getCurrentParam() as Record; @State state: number=1 ; @State createDate: string='' ; @State content: string='' ; @State diseaseName: string='' ; @State imgList:ConsultPhoto[]=[] - + @State chat_state:string='' + // pathStack: NavPathStack = new NavPathStack() + @State patientUuid:string='' dialog: CustomDialogController = new CustomDialogController({ builder: HdLoadingDialog({ message: '加载中...' }), customStyle: true, @@ -51,6 +62,7 @@ export struct ConsultationDetailComp { } aboutToAppear() { + this.initDialog() this.initData() } @@ -71,7 +83,7 @@ export struct ConsultationDetailComp { this.content=json.data.detail.content this.diseaseName=json.data.detail.diseaseName this.imgList = [...json.data.imgList] - + this.patientUuid=json.data.detail.patientUuid }).catch((err: BusinessError) => { this.dialog.close() @@ -113,6 +125,39 @@ export struct ConsultationDetailComp { { promptAction.showToast({ message: '抢答成功' }) this.addBonusPoints() + preferenceStore.setItemString('gdxz_consult_uuid',this.params.uuid) + preferenceStore.setItemString('gdxz_sessionType', BasicConstant.consult) + const jsonData:customAttachment = { + gdxz_title: this.content, + gdxz_url: '', + gdxz_content: '', + gdxz_id: this.params.uuid, + gdxz_img: '', + gdxz_type: BasicConstant.CouTeach, + gdxz_ext_data: '' + } + HMRouterMgr.push({ pageUrl: 'ChatP2PPage' , param: { + conversationId: ChatKitClient.nim.conversationIdUtil.p2pConversationId(this.patientUuid + .toLowerCase()), + name: this.patientName, + chat_state:'', + hasMessage:'true', + messageType:BasicConstant.CouTeach, + rawAttach:JSON.stringify(jsonData) + } as ChatParam}) + // this.pathStack.pushPath({ + // name: "ChatP2PPage", + // param: { + // conversationId: ChatKitClient.nim.conversationIdUtil.p2pConversationId(this.params.patientUuid + // .toLowerCase()), + // name: this.patientName, + // chat_state:'', + // hasMessage:'true', + // gdxz_sessionType:BasicConstant.consult, + // rawAttach:JSON.stringify(jsonData) + // } as ChatParam + // }) + } else { @@ -125,6 +170,7 @@ export struct ConsultationDetailComp { }) } + addBonusPoints() { const hashMap: HashMap = new HashMap(); @@ -142,7 +188,9 @@ export struct ConsultationDetailComp { build() { Column() { - HdNav({ title: '咨询详情', showRightIcon: false, showLeftIcon: true}) + HdNav({ title: '咨询详情', showRightIcon: false, showLeftIcon: true,isLeftAction:true,leftItemAction: () => { + HMRouterMgr.pop() + }}) Text(this.state==0?$r('app.string.cancellation'):this.patientName).fontSize(19).fontColor($r('app.color.top_title')).width('100%') .padding(10) Row() { @@ -180,7 +228,7 @@ export struct ConsultationDetailComp { .fontColor($r('app.color.main_color')) .onClick(() => { this.countConsult() - + }) .visibility(this.params.isHistory=='false'?Visibility.Visible:Visibility.None) @@ -191,12 +239,7 @@ export struct ConsultationDetailComp { .width('100%') .width('100%') - .onClick(() => { - // router.pushUrl({ - // url: 'pages/Netease/ConsultationDetailPage', - // params: { uuid: this.item.uuid} - // }); - }) + } diff --git a/features/netease/src/main/ets/view/MessageComp.ets b/features/netease/src/main/ets/view/MessageComp.ets index 43e6d59..fdf5a39 100644 --- a/features/netease/src/main/ets/view/MessageComp.ets +++ b/features/netease/src/main/ets/view/MessageComp.ets @@ -9,7 +9,7 @@ import { V2NIMFriendAddApplication } from '@nimsdk/base'; @ComponentV2 export struct MessageComp { - @Param pathStack: NavPathStack = new NavPathStack() + // @Param pathStack: NavPathStack = new NavPathStack() @Param onUreadMessageChange?: (unreadCount?: number) => void = undefined loadUnreadApplication = async () => { @@ -70,7 +70,7 @@ export struct MessageComp { // }) }}) LocalConversationPage({ - pathStack: this.pathStack, + onUreadMessageChange: this.onUreadMessageChange, }) diff --git a/features/netease/src/main/ets/view/PatientListComp.ets b/features/netease/src/main/ets/view/PatientListComp.ets new file mode 100644 index 0000000..04bae12 --- /dev/null +++ b/features/netease/src/main/ets/view/PatientListComp.ets @@ -0,0 +1,440 @@ +import { authStore, BasicConstant, hdHttp, HdLoadingDialog,HdNav, HdResponse, patientDbManager, + PatientListModel, + PatientsData} from '@itcast/basic' +import { Groups } from '../model/Groups'; +import { display } from '@kit.ArkUI'; +import { StringIsEmpty } from '@nimkit/common'; +import I18n from '@ohos.i18n'; +import Intl from '@ohos.intl'; +let collator = new Intl.Collator(I18n.System.getSystemLocale(), { + usage: 'sort', + collation: 'pinyin', + caseFirst: 'lower' +}) +@Component +export struct PatientListComp { + + private scroller: Scroller = new Scroller() + @State regionInfo: Array = []; + @State regionDataGroupsList: Array = []; + private indexList: Array = [] + private normalIndexValue: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', + 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '#'] + + private indexUtil = I18n.getInstance(I18n.System.getSystemLocale()); + + @State alphabetSelected: number = 0 + dialog: CustomDialogController = new CustomDialogController({ + builder: HdLoadingDialog({ message: '加载中...' }), + customStyle: true, + alignment: DialogAlignment.Center + }) + + aboutToAppear() { + this. PatientsData() + + this.loadPatients() + } + + PatientsData() + { + this.dialog.open() + hdHttp.post(BasicConstant.urlExpert + 'patientListByGBK', { + expertUuid: authStore.getUser().uuid + } as updateExtraData).then(async (res: HdResponse) => { + try { + let json: PatientListModel = JSON.parse(res + '') as PatientListModel; + console.log('服务器返回的患者数据:', json); + if(json.data!=null) + { + this.collationData(json.data); + } + + + } catch (parseError) { + console.error('解析服务器响应失败:', parseError); + } + }) + } + + async loadPatients() { + try { + await patientDbManager.patientsToFMDB(); + } catch (error) { + console.error('加载患者数据失败:', error); + } + } + @Builder + itemHead(text: string) { + ListItem() { + Row() { + Text(text) + .fontSize($r('sys.float.ohos_id_text_size_sub_title3')) + .fontWeight(FontWeight.Medium) + .fontFamily($r('sys.string.ohos_id_text_font_family_medium')) + .fontColor($r('sys.color.ohos_id_color_text_secondary')) + } + .alignItems(VerticalAlign.Center) + .justifyContent(FlexAlign.Start) + .backgroundColor($r('sys.color.ohos_id_color_panel_bg')) + // .enabled(this.selectState) + .height(40) + .width('100%') + .padding({ left: 15,}) + + } + } + + build() { + + Column() { + HdNav({ title: '患者消息', showRightIcon: true, showLeftIcon: true,showRightText:false,rightIcon:$r('app.media.selected_hospital_ws')}) + Stack({ alignContent: Alignment.TopEnd }) { + Column() { + List({ scroller: this.scroller, space: 0, initialIndex: 0 }) { + ListItem() { + Column() + { + Row() { + Image($r('app.media.new_patient')) + .width(50) + .height(50) + .margin({ left:10 }) + Row() + { + Text('新的患者') + .fontSize(16) + .fontColor($r('app.color.common_gray_01')) + .textAlign(TextAlign.Start) + .padding({left:10,right:10}) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .ellipsisMode(EllipsisMode.END) + Text('(待审核'+'人)') + .fontSize(16) + .fontColor(Color.Red) + .layoutWeight(1) + .textAlign(TextAlign.Start) + .padding({left:5}) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .ellipsisMode(EllipsisMode.END) + + }.layoutWeight(1) + .align(Alignment.Start) + + Column() + { + Image($r('app.media.arrow_right')) + .width(7) + .height(13) + .margin({ left:10 }) + .alignSelf(ItemAlign.End) + + }.align(Alignment.End).padding({right:30}) + } + .alignItems(VerticalAlign.Center) + .padding({ top:10,bottom:10}) + .width('100%') + Text().height(0.5).backgroundColor($r('sys.color.ohos_id_color_list_separator')).width('100%') + } + + + } + .width('100%') + .align(Alignment.Start) + .onClick(() => { + + }) + ListItem() { + Row() { + Image($r('app.media.patientgroup')) + .width(50) + .height(50) + .margin({ left:10 }) + Row() + { + Text('患者分组') + .fontSize(16) + .fontColor($r('app.color.common_gray_01')) + .textAlign(TextAlign.Start) + .padding({left:10,right:10}) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .ellipsisMode(EllipsisMode.END) + Text('(随访'+'人)') + .fontSize(16) + .fontColor(Color.Red) + .layoutWeight(1) + .textAlign(TextAlign.Start) + .padding({left:5}) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .ellipsisMode(EllipsisMode.END) + + }.layoutWeight(1) + .align(Alignment.Start) + + Column() + { + Image($r('app.media.arrow_right')) + .width(7) + .height(13) + .margin({ left:10 }) + .alignSelf(ItemAlign.End) + + }.align(Alignment.End).padding({right:30}) + } + .alignItems(VerticalAlign.Center) + .padding({ top:10,bottom:10}) + .width('100%') + } + .width('100%') + .align(Alignment.Start) + .onClick(() => { + + }) + ForEach(this.regionDataGroupsList, (regionDataGroups: Groups, index) => { + + ListItemGroup({ header: this.itemHead(regionDataGroups.title) }) { + ListItem() { + List() { + ForEach(regionDataGroups.regionDataList, (regionData: PatientsData, index?: number) => { + ListItem() { + Row() { + Image(BasicConstant.urlHtml+regionData.photo) + .alt($r('app.media.userPhoto_default')) + .width(50) + .height(50) + .margin({ left:10 }) + .borderRadius(8) + Column() + { + Text(regionData.realName) + .fontSize(16) + .fontColor($r('app.color.common_gray_01')) + .width('100%') + .textAlign(TextAlign.Start) + .padding({left:10,right:10}) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .ellipsisMode(EllipsisMode.END) + Text(regionData.diagnosis?regionData.diagnosis.includes("甲、乙、丙、丁") ? '肝炎' :regionData.diagnosis:'') + .fontSize(12) + .borderColor($r('app.color.top_title')) + .fontColor($r('app.color.top_title')) + .padding({left:8,right:8,top:3,bottom:3}) + .borderRadius(17) + .borderWidth(1) + .textAlign(TextAlign.Center) + .margin({top:5,left:10}) + .visibility(regionData.diagnosis?Visibility.Visible:Visibility.None) + .alignSelf(ItemAlign.Start) + + }.layoutWeight(1) + .align(Alignment.Start) + + Column() + { + Image($r('app.media.edit_patitent')) + .width(24) + .height(24) + .margin({ left:10 }) + .alignSelf(ItemAlign.End) + + Text(regionData.join_date ?"随访于"+ regionData.join_date.split(" ")[0] :'') + .fontSize(12) + .fontColor($r('app.color.666666')) + .margin({top:5}) + .textAlign(TextAlign.Center) + .visibility(regionData.join_date?Visibility.Visible:Visibility.None) + + }.align(Alignment.End).padding({right:30}) + } + .alignItems(VerticalAlign.Center) + .padding({ top:10,bottom:10}) + .width('100%') + } + + .width('100%') + .align(Alignment.Start) + .onClick(() => { + // // 暂不选择需要退出 + // if (regionData.name === this.noSelect) { + // this.selectedRegion = ''; + // // 页面返回 + // return; + // } + // this.selectedRegion = regionData.name; + // this.selectState = false; + // if (this.pageLevel < 4) { + // this.pageLevel++; + // } + // let regionData1 = this.getData('data2'); + // if (this.pageLevel > 1) { + // regionData1 = this.getData('data3'); + // } + // if (regionData1.regionInfos.length === 0) { + // return; + // } + // if (this.pageLevel < 4) { + // this.collationData(regionData1, false); + // } + }) + }) + } + .divider({ + strokeWidth: 0.5, + color: $r('sys.color.ohos_id_color_list_separator'), + startMargin: 0, + endMargin: 0 + }) + .width('100%') + } + .width('100%') + + } + .width('100%') + .align(Alignment.Center) + }) + + } + .sticky(StickyStyle.None) + .onScrollIndex((start: number, end: number) => { + let target = this.indexList[start] + let indexList = this.normalIndexValue; + let index = this.searchIndex(indexList, target) + this.alphabetSelected = index === -1 ? this.onSlideList(indexList, target) - 1 : index; + }) + .layoutWeight(1) + .width('100%') + .scrollBar(BarState.Off) + // Text().height(56).width('100%') + } + .width('100%') + .height('100%') + + Column() { + AlphabetIndexer({ + arrayValue: this.normalIndexValue, + selected: 0 + }) + .usingPopup(true) + .selected(this.alphabetSelected) + .onSelect((index: number) => { + if (index === 0) { + this.scroller.scrollToIndex(0); + return; + } + let pos = 0 + let useValue = this.normalIndexValue + let currentWord = useValue[index] // 在右侧索引上的位置 + if (currentWord === '·') { // 在右侧索引上的位置 刚号是点,则需要找右侧索引上一个字母 + + let beforeWord = useValue[index - 1]; // 这个是右侧索引点的上一个字母 + let afterWord = useValue[index + 1]; + + pos = this.onClickPointIndex(this.indexList, beforeWord, afterWord) + } else { + pos = this.searchIndex(this.indexList, currentWord) + } + if (pos === -1) { + return; + } + this.scroller.scrollToIndex(pos); + }) + .id('id_hwid_region_choose_alphabetIndexer') + .onAreaChange((oldValue: Area, newValue: Area) => { + // 获取屏幕对象 + let displayObj: display.Display = display.getDefaultDisplaySync(); + // 获取屏幕高度 + let displayHeight: number = displayObj.height / displayObj.densityPixels; + }) + .itemSize('20') + .font({ size: '20vp' }) + .selectedFont({ + size: '20vp', style: FontStyle.Normal, + weight: FontWeight.Bolder + }) + + } + .height('100%') + .backgroundColor(Color.Transparent) + } + .layoutWeight(1) + + + }.width('100%') + .height('100%') + + // .backgroundColor($r('app.color.white')) + + } + + private collationData(regionRequestData: PatientsData[]) { + + + this.regionInfo = regionRequestData.map((regionData: PatientsData) => { + if(StringIsEmpty(regionData.nickname)) + { + + regionData.nickname = regionData.realName ; + + } + + return regionData; + }).sort((a, b) => collator.compare(a.nickname, b.nickname)); + this.indexList = []; + this.regionDataGroupsList = []; + this.regionInfo.forEach((value: PatientsData) => { + let index = this.indexUtil.getIndex(value.nickname); + + if (this.indexList.indexOf(index) === -1) { + let regionDataGroups: Groups = new Groups(); + if(this.normalIndexValue.includes(index)) + { + regionDataGroups.title = index; + } + else + { + regionDataGroups.title = '#'; + } + + this.indexList.push(index); + regionDataGroups.regionDataList.push(value); + this.regionDataGroupsList.push(regionDataGroups); + } else { + this.regionDataGroupsList[this.indexList.indexOf(index)].regionDataList.push(value); + + } + }) + this.regionDataGroupsList.sort((a, b) => { + return this.normalIndexValue.indexOf(a.title) - this.normalIndexValue.indexOf(b.title); + }); + this.dialog.close() + } + + + private searchIndex(indexList: string[], target: string): number { + return indexList.indexOf(target); + } + private onSlideList(indexList: string[], target: string): number { + for (let i = 1; i < indexList.length; i++) { + if (indexList[i] > target && indexList[i] !== '·') { + return i; + } + } + return 0; + } + private onClickPointIndex(indexList: string[], beforeWord: string, afterWord: string): number { + for (let i = 1; i < indexList.length; i++) { + if (indexList[i] > beforeWord && indexList[i] < afterWord) { + return i; + } + } + return 0; + } +} +interface updateExtraData { + expertUuid: string +} diff --git a/features/netease/src/main/ets/view/QuictDoctorComp.ets b/features/netease/src/main/ets/view/QuictDoctorComp.ets index d95fc96..d4252b6 100644 --- a/features/netease/src/main/ets/view/QuictDoctorComp.ets +++ b/features/netease/src/main/ets/view/QuictDoctorComp.ets @@ -7,14 +7,14 @@ export struct QuictDoctorComp { @Watch('onChangeIndex') activeIndex: number = 0 @State type: number=0 - pathStack: NavPathStack = new NavPathStack() + // pathStack: NavPathStack = new NavPathStack() onChangeIndex() { } build() { Column() { - TabBarTopComp({activeIndex:this.activeIndex,type:this.type,pathStack: this.pathStack}); + TabBarTopComp({activeIndex:this.activeIndex,type:this.type}); diff --git a/features/netease/src/main/ets/view/SearchComp.ets b/features/netease/src/main/ets/view/SearchComp.ets new file mode 100644 index 0000000..80784be --- /dev/null +++ b/features/netease/src/main/ets/view/SearchComp.ets @@ -0,0 +1,228 @@ +import { BasicConstant, EmptyViewComp, hdHttp, HdLoadingDialog, HdNav, HdResponse, HdSearchNav } from '@itcast/basic' +import { HMRouter, HMRouterMgr } from '@hadss/hmrouter' +import { PullToRefreshLayout, RefreshController } from 'refreshlib' +import { HashMap } from '@kit.ArkTS'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { PatientTBean, TeachModel } from '../model/TeachModel'; +import { promptAction } from '@kit.ArkUI'; +import { ItemCompTeach } from '../components/ItemCompTeach'; +import { PatientVBean, TeachVideoModel } from '../model/TeachVideoModel'; +import { ItemCompTeachVideo } from '../components/ItemCompTeachVideo'; + +@HMRouter({ pageUrl: 'SearchComp' }) +@Component +export struct SearchComp { + dialog: CustomDialogController = new CustomDialogController({ + builder: HdLoadingDialog({ message: '加载中...' }), + customStyle: true, + alignment: DialogAlignment.Center + }) + @State params:Record= HMRouterMgr.getCurrentParam() as Record; + @State pageNumber:number = 1; + @State totalPageNumer:number = 1; + @State data:PatientTBean[]=[]; + @State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量 + @State datav:PatientVBean[]=[]; + @State empty:string='暂无数据' + aboutToAppear() { + + this.getApplyList(); + + + } + getApplyList() { + this.dialog.open() + if(this.params.type=='tuwen') + { + this.empty='暂无患教学堂' + const hashMap: HashMap = new HashMap(); + hashMap.set('page',this.pageNumber.toString()); + hashMap.set("topic", this.inputText); + hdHttp.httpReq(BasicConstant.polularScienceArticleListInexpertNew,hashMap).then(async (res: HdResponse) => { + this.dialog.close(); + let json:TeachModel = JSON.parse(res+'') as TeachModel; + if(json.code == '1') { + if(this.pageNumber==1) + { + this.data=[] + if(json.data!=null) + { + this.data = json.data; + } + + } + else if(this.pageNumber>1) + { + this.data.push(...json.data) + } + + this.totalPageNumer =json.totalPage; + if (this.data.length > 0) { + this.isEmptyViewVisible = false; + } else { + this.isEmptyViewVisible = true; + } + } else { + + promptAction.showToast({ message: json.message, duration: 1000 }) + } + }).catch((err: BusinessError) => { + this.dialog.close(); + this.controller.refreshError(); + console.info(`Response fails: ${err}`); + }) + } + else if(this.params.type=='video') + { + this.empty='暂无科普视频' + const hashMap: HashMap = new HashMap(); + hashMap.set('page',this.pageNumber.toString()); + hashMap.set("sort", this.params.sort); + hashMap.set("name", this.inputText); + if(this.params.typeUuid!='') + { + hashMap.set("typeUuid", this.params.typeUuid); + } + + hdHttp.httpReq(BasicConstant.patientVideoByName,hashMap).then(async (res: HdResponse) => { + this.dialog.close(); + let json:TeachVideoModel = JSON.parse(res+'') as TeachVideoModel; + if(json.code == '1') { + if(this.pageNumber==1) + { + this.datav=[] + if(json.data!=null) + { + this.datav = json.data.list; + } + + } + else if(this.pageNumber>1) + { + this.datav.push(...json.data.list) + } + + this.totalPageNumer =json.data.totalPage; + + } else { + + promptAction.showToast({ message: json.message, duration: 1000 }) + } + if (this.datav.length > 0) { + this.isEmptyViewVisible = false; + } else { + this.isEmptyViewVisible = true; + } + }).catch((err: BusinessError) => { + this.dialog.close(); + this.controller.refreshError(); + console.info(`Response fails: ${err}`); + }) + } + + } + public controller:RefreshController = new RefreshController(); + scroller = new Scroller(); + + @State inputText:string='' + + + onRefresh() + { + this.pageNumber = 1; + this.getApplyList(); + } + build() { + Column(){ + + HdSearchNav({showRightText:true,rightText:'搜索',rightTextColor:Color.White,isFocus:true,placeholder:'输入搜索内容',rightItemAction:(value: string)=>{ + this.inputText = value; + this.onRefresh(); + },isLeftAction:true, + leftItemAction:()=>{ + HMRouterMgr.pop() + }}) + + Text().height(5).width('100%').backgroundColor($r('app.color.home_gray')) + if (this.isEmptyViewVisible){ + EmptyViewComp({promptText:this.empty,isVisibility:this.isEmptyViewVisible}).layoutWeight(1) + + } + else + { + PullToRefreshLayout({ + scroller:this.scroller, + viewKey:"ListPage", + controller:this.controller, + contentView:()=>{ + this.contentView() + }, + + onRefresh:()=>{ + this.pageNumber = 1; + this.getApplyList(); + setTimeout(() => { + this.controller.refreshSuccess() + }, 1000) + }, + onCanPullRefresh:()=>{ + if (!this.scroller.currentOffset()) { + /*处理无数据,为空的情况*/ + return true + } + //如果列表到顶,返回true,表示可以下拉,返回false,表示无法下拉 + return this.scroller.currentOffset().yOffset <= 0 + }, + onLoad:()=>{ + this.pageNumber++; + this.getApplyList(); + setTimeout(() => { + this.controller.loadSuccess() + }, 1000) + + }, + onCanPullLoad: () => { + if (this.pageNumber >= this.totalPageNumer) { + return false; + } else { + return true; + } + } + }).width('100%').layoutWeight(1).clip(true) + } + + } + .width('100%') + .height('100%') + } + + @Builder + contentView(){ + List({ scroller: this.scroller }) { + if(this.params.type=='tuwen') + { + ForEach(this.data, (item: PatientTBean, index) => { + ListItem() { + ItemCompTeach({item:item}) + } + }) + } + else if(this.params.type=='video') + { + ForEach(this.datav, (item: PatientVBean, index) => { + ListItem() { + ItemCompTeachVideo({item:item}) + } + }) + } + + } + .width('100%') + .height('100%') + .edgeEffect(EdgeEffect.None) + + } + + +} + diff --git a/features/netease/src/main/ets/view/TabBarComp.ets b/features/netease/src/main/ets/view/TabBarComp.ets index 1374724..6041dfc 100644 --- a/features/netease/src/main/ets/view/TabBarComp.ets +++ b/features/netease/src/main/ets/view/TabBarComp.ets @@ -2,10 +2,11 @@ import { TabBarCompModel } from '../model/TabBarCompModel' import { TabBarItems } from '../components/TabBarItems' import { BasicConstant } from '@itcast/basic' import { MessageComp } from '../view/MessageComp' +import { PatientListComp } from './PatientListComp' @Component export struct TabBarComp { - pathStack: NavPathStack = new NavPathStack() + // pathStack: NavPathStack = new NavPathStack() @StorageProp('bottomHeight') bottomHeight: number = 0 @Link @@ -33,8 +34,9 @@ export struct TabBarComp { }) { ForEach(TabBarItems, (item: TabBarCompModel, index: number) => { TabContent() { - if (index === 0) MessageComp({ pathStack: this.pathStack }) - // else if (index === 1) VideoGandan() + // if (index === 0) MessageComp({ pathStack: this.pathStack }) + if (index === 0) MessageComp() + else if (index === 1) PatientListComp() // else if (index === 2) MyHomePage() } diff --git a/features/netease/src/main/ets/view/TabBarConsultationComp.ets b/features/netease/src/main/ets/view/TabBarConsultationComp.ets index 6e202c1..2834eb6 100644 --- a/features/netease/src/main/ets/view/TabBarConsultationComp.ets +++ b/features/netease/src/main/ets/view/TabBarConsultationComp.ets @@ -6,7 +6,7 @@ import { ManyForOneComp } from '../view/ManyForOneComp' @Component export struct TabBarConsultationComp { - pathStack: NavPathStack = new NavPathStack() + // pathStack: NavPathStack = new NavPathStack() @StorageProp('bottomHeight') bottomHeight: number = 0 @Link activeIndex: number @@ -42,7 +42,7 @@ export struct TabBarConsultationComp { TabContent() { if (index === 0) { - QuictDoctorComp({pathStack: this.pathStack}) + QuictDoctorComp() } else if(index === 1) { diff --git a/features/netease/src/main/ets/view/TabBarTopComp.ets b/features/netease/src/main/ets/view/TabBarTopComp.ets index 453b3e6..747ead6 100644 --- a/features/netease/src/main/ets/view/TabBarTopComp.ets +++ b/features/netease/src/main/ets/view/TabBarTopComp.ets @@ -5,7 +5,7 @@ import { ListCompMany } from '../components/ListCompMany' @Component export struct TabBarTopComp { - pathStack: NavPathStack = new NavPathStack() + // pathStack: NavPathStack = new NavPathStack() @StorageProp('bottomHeight') bottomHeight: number = 0 @Link activeIndex: number @@ -46,7 +46,7 @@ export struct TabBarTopComp { TabContent() { if (this.type==0) { - ListCompPublic({isHistory:this.isHistory,pathStack: this.pathStack}) + ListCompPublic({isHistory:this.isHistory}) } else if(this.type==1) diff --git a/features/netease/src/main/ets/view/TuwenComp.ets b/features/netease/src/main/ets/view/TuwenComp.ets new file mode 100644 index 0000000..5d7da58 --- /dev/null +++ b/features/netease/src/main/ets/view/TuwenComp.ets @@ -0,0 +1,212 @@ +import { BasicConstant, EmptyViewComp, hdHttp, HdLoadingDialog, HdNav, HdResponse, HdSearchNav } from '@itcast/basic' +import { HMRouter, HMRouterMgr, HMRouterPathCallback, HMRouterPathInfo } from '@hadss/hmrouter' +import { PullToRefreshLayout, RefreshController } from 'refreshlib' +import { HashMap } from '@kit.ArkTS'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { PatientTBean, TeachModel } from '../model/TeachModel'; +import { promptAction } from '@kit.ArkUI'; +import { ItemCompTeach } from '../components/ItemCompTeach'; +import { StringIsEmpty } from '@nimkit/common'; + +@HMRouter({ pageUrl: 'TuwenCompPage' }) +@Component +export struct TuwenComp { + dialog: CustomDialogController = new CustomDialogController({ + builder: HdLoadingDialog({ message: '加载中...' }), + customStyle: true, + alignment: DialogAlignment.Center + }) + @State pageNumber:number = 1; + @State totalPageNumer:number = 1; + @State data:PatientTBean[]=[]; + @State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量 + aboutToAppear() { + this.getApplyList(); + } + getApplyList() { + const hashMap: HashMap = new HashMap(); + hashMap.set('page',this.pageNumber.toString()); + hashMap.set("type", this.sort); + hashMap.set("keywords", this.inputText); + this.dialog.open() + hdHttp.httpReq(BasicConstant.polularScienceArticleListByKeywordsNew,hashMap).then(async (res: HdResponse) => { + this.dialog.close(); + let json:TeachModel = JSON.parse(res+'') as TeachModel; + if(json.code == '1') { + if(this.pageNumber==1) + { + this.data=[] + if(json.data!=null) + { + this.data = json.data; + } + + } + else if(this.pageNumber>1) + { + this.data.push(...json.data) + } + + this.totalPageNumer =json.totalPage; + if (this.data.length > 0) { + this.isEmptyViewVisible = false; + } else { + this.isEmptyViewVisible = true; + } + } else { + + promptAction.showToast({ message: json.message, duration: 1000 }) + } + }).catch((err: BusinessError) => { + this.dialog.close(); + this.controller.refreshError(); + console.info(`Response fails: ${err}`); + }) + } + public controller:RefreshController = new RefreshController(); + scroller = new Scroller(); + @State Sorts:string='最新' + @State Imgs:ResourceStr=$r('app.media.cb_new') + @State inputText:string='' + @State + @Watch('onRefresh') + sort:string='1' + + onRefresh() + { + this.pageNumber = 1; + this.getApplyList(); + } + build() { + Column(){ + HdNav({ title: '患教学堂', showRightIcon: false, showLeftIcon: true , isLeftAction:true,leftItemAction:()=>{ + HMRouterMgr.pop() + }}) + + Row() { + Row() { + Image($r('app.media.search_no')).width(15).height(15).margin({ right:5 }) + Text('搜索').fontSize(14).fontColor($r('app.color.common_gray_03')).textAlign(TextAlign.Start) + + + } + .layoutWeight(1) + .justifyContent(FlexAlign.Center) + .onClick(()=>{ + const pathInfo1: HMRouterPathInfo = { + pageUrl: 'SearchComp', + param:{type:'tuwen'} + + }; + const callback: HMRouterPathCallback = { + onResult: (popInfo: PopInfo) => { + const result = popInfo.result as string; + if(!StringIsEmpty(result)) + { + HMRouterMgr.pop({param:result}) + } + + // this.sendHelloMessage(result,BasicConstant.Teach); + } + }; + HMRouterMgr.push(pathInfo1,callback) + // HMRouterMgr.push({ pageUrl: 'SearchComp' }) + }) + + Text('|').fontColor($r('app.color.tab_text_nor')) + .fontSize(13) + + Row() { + Text(this.Sorts).fontSize(14).fontColor($r('app.color.common_gray_03')).textAlign(TextAlign.Start) + .margin({ left:5 }) + Image(this.Imgs).width(15).height(15) + } + .layoutWeight(1) + .justifyContent(FlexAlign.Center) + .onClick(()=>{ + if(this.Sorts=='最新') + { + this.sort='2' + this.Sorts='最热' + this.Imgs=$r('app.media.cb_hot') + } + else + { + this.sort='1' + this.Sorts='最新' + this.Imgs=$r('app.media.cb_new') + } + }) + + }.width('100%').height(45) + Text().height(5).width('100%').backgroundColor($r('app.color.home_gray')) + if (this.isEmptyViewVisible){ + EmptyViewComp({promptText:'暂无数据',isVisibility:this.isEmptyViewVisible}).layoutWeight(1) + + } + else + { + PullToRefreshLayout({ + scroller:this.scroller, + viewKey:"ListPage", + controller:this.controller, + contentView:()=>{ + this.contentView() + }, + + onRefresh:()=>{ + this.pageNumber = 1; + this.getApplyList(); + setTimeout(() => { + this.controller.refreshSuccess() + }, 1000) + }, + onCanPullRefresh:()=>{ + if (!this.scroller.currentOffset()) { + /*处理无数据,为空的情况*/ + return true + } + //如果列表到顶,返回true,表示可以下拉,返回false,表示无法下拉 + return this.scroller.currentOffset().yOffset <= 0 + }, + onLoad:()=>{ + this.pageNumber++; + this.getApplyList(); + setTimeout(() => { + this.controller.loadSuccess() + }, 1000) + + }, + onCanPullLoad: () => { + if (this.pageNumber >= this.totalPageNumer) { + return false; + } else { + return true; + } + } + }).width('100%').layoutWeight(1).clip(true) + } + + } + .width('100%') + .height('100%') + } + + @Builder + contentView(){ + List({ scroller: this.scroller }) { + ForEach(this.data, (item: PatientTBean, index) => { + ListItem() { + ItemCompTeach({item:item}) + } + }) + } + .width('100%') + .height('100%') + .edgeEffect(EdgeEffect.None) + + } + + +} + diff --git a/features/netease/src/main/ets/view/VideoTeachComp.ets b/features/netease/src/main/ets/view/VideoTeachComp.ets new file mode 100644 index 0000000..174e783 --- /dev/null +++ b/features/netease/src/main/ets/view/VideoTeachComp.ets @@ -0,0 +1,322 @@ +import { BasicConstant, + ChangeUtil, + EmptyViewComp, hdHttp, HdLoadingDialog, HdNav, HdResponse, HdSearchNav } from '@itcast/basic' +import { HMRouter, HMRouterMgr, HMRouterPathCallback, HMRouterPathInfo } from '@hadss/hmrouter' +import { PullToRefreshLayout, RefreshController } from 'refreshlib' +import { HashMap } from '@kit.ArkTS'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { promptAction } from '@kit.ArkUI'; +import { StringIsEmpty } from '@nimkit/common'; +import { patientVideoTypeModel, VideoTypeBean } from '../model/patientVideoTypeModel'; +import { PatientVBean, TeachVideoModel } from '../model/TeachVideoModel'; +import { ItemCompTeachVideo } from '../components/ItemCompTeachVideo'; + +@HMRouter({ pageUrl: 'VideoTeach' }) +@Component +export struct VideoTeachComp { + dialog: CustomDialogController = new CustomDialogController({ + builder: HdLoadingDialog({ message: '加载中...' }), + customStyle: true, + alignment: DialogAlignment.Center + }) + @State pageNumber:number = 1; + @State totalPageNumer:number = 1; + @State data:PatientVBean[]=[]; + @State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量 + @State beanType:VideoTypeBean[]=[]; + aboutToAppear() { + this.patientVideoType() + this.getApplyList(); + + } + getApplyList() { + const hashMap: HashMap = new HashMap(); + hashMap.set('page',this.pageNumber.toString()); + hashMap.set("sort", this.sort); + hashMap.set("name", ''); + if(this.typeUuid!='') + { + hashMap.set("typeUuid", this.typeUuid); + } + + this.dialog.open() + hdHttp.httpReq(BasicConstant.patientVideoByName,hashMap).then(async (res: HdResponse) => { + this.dialog.close(); + let json:TeachVideoModel = JSON.parse(res+'') as TeachVideoModel; + if(json.code == '1') { + if(this.pageNumber==1) + { + this.data=[] + if(json.data!=null) + { + this.data = json.data.list; + } + + } + else if(this.pageNumber>1) + { + this.data.push(...json.data.list) + } + + this.totalPageNumer =json.data.totalPage; + + } else { + + promptAction.showToast({ message: json.message, duration: 1000 }) + } + if (this.data.length > 0) { + this.isEmptyViewVisible = false; + } else { + this.isEmptyViewVisible = true; + } + }).catch((err: BusinessError) => { + this.dialog.close(); + this.controller.refreshError(); + console.info(`Response fails: ${err}`); + }) + } + patientVideoType() { + const hashMap: HashMap = new HashMap(); + this.dialog.open() + hdHttp.httpReq(BasicConstant.patientVideoType,hashMap).then(async (res: HdResponse) => { + this.dialog.close(); + let json:patientVideoTypeModel = JSON.parse(res+'') as patientVideoTypeModel; + + + this.beanType=[] + if(json.data!=null) + { + this.beanType = json.data; + for (let j = 0;j=4){ + substring = title.substring(0, 4);//取出来前4位 + }else if(title.length>=3){ + substring = title.substring(0, 3);//取出来前3位 + }else if (title.length>=2){ + substring = title.substring(0, 2);//取出来前2位 + } + if (substring.includes("-")){//含有- + let split: string[] = substring.split("-"); + if (split.length>1){ + s = split[split.length - 1] + title.substring(4, title.length); + }else { + s = title.substring(4, title.length); + } + this.beanType[j].name=s; + } + } + if('乙肝'==this.beanType[j].name) + { + this.typeUuid=this.beanType[j].uuid + } + + } + + + } + + + + + }).catch((err: BusinessError) => { + this.dialog.close(); + this.controller.refreshError(); + console.info(`Response fails: ${err}`); + }) + } + public controller:RefreshController = new RefreshController(); + scroller = new Scroller(); + @State Sorts:string='最新' + @State Imgs:ResourceStr=$r('app.media.cb_new') + @State notselectImg: ResourceStr = $r('app.media.triangle_normal'); + @State selectImg: ResourceStr = $r('app.media.triangle_green_theme'); + + @State typePosition:number=-1 + @State + @Watch('onRefresh') + sort:string='2' + @State + @Watch('onRefresh') + typeUuid:string='' + @State typelistStatus:boolean=false; + + onRefresh() + { + this.pageNumber = 1; + this.getApplyList(); + } + build() { + Column(){ + HdNav({ title: '视频科普', showLeftIcon: true , isLeftAction:true,leftItemAction:()=>{ + HMRouterMgr.pop() + }, showRightIcon: true,rightIcon:$r('app.media.selected_hospital_ws'),rightItemAction:()=> { + + const pathInfo1: HMRouterPathInfo = { + pageUrl: 'SearchComp', + param:{type:'video',sort:this.sort,typeUuid:this.typeUuid} + + }; + const callback: HMRouterPathCallback = { + onResult: (popInfo: PopInfo) => { + const result = popInfo.result as string; + if(!StringIsEmpty(result)) + { + HMRouterMgr.pop({param:result}) + } + + } + }; + HMRouterMgr.push(pathInfo1,callback) + }}) + + Row() { + Row() { + + Text(this.typePosition==-1?'乙肝':this.beanType[this.typePosition].name).fontSize(14) + .fontColor(this.typePosition==-1?$r('app.color.common_gray_03'):$r('app.color.top_title')).textAlign(TextAlign.Start) + .maxLines(1) + + .textOverflow({ overflow: TextOverflow.Ellipsis }) + Image(this.typePosition==-1?this.notselectImg:this.selectImg).width(15).height(15).margin({ right:5 }) + + } + .padding({left:30,right:30}) + .layoutWeight(1) + .justifyContent(FlexAlign.Center) + .onClick(()=>{ + this.typelistStatus=!this.typelistStatus + + }) + + Text('|').fontColor($r('app.color.tab_text_nor')) + .fontSize(13) + + Row() { + Text(this.Sorts).fontSize(14).fontColor($r('app.color.common_gray_03')).textAlign(TextAlign.Start) + .margin({ left:5 }) + Image(this.Imgs).width(15).height(15) + } + .layoutWeight(1) + .justifyContent(FlexAlign.Center) + .onClick(()=>{ + if(this.Sorts=='最新') + { + this.sort='1' + this.Sorts='最热' + this.Imgs=$r('app.media.cb_hot') + } + else + { + this.sort='2' + this.Sorts='最新' + this.Imgs=$r('app.media.cb_new') + } + }) + + }.width('100%').height(45) + Text().height(5).width('100%').backgroundColor($r('app.color.home_gray')) + Stack({ }) { + if (this.isEmptyViewVisible){ + EmptyViewComp({promptText:'暂无视频科普',isVisibility:this.isEmptyViewVisible}).width('100%') + } + else + { + PullToRefreshLayout({ + scroller:this.scroller, + viewKey:"ListPage", + controller:this.controller, + contentView:()=>{ + this.contentView() + }, + + onRefresh:()=>{ + this.pageNumber = 1; + this.getApplyList(); + setTimeout(() => { + this.controller.refreshSuccess() + }, 1000) + }, + onCanPullRefresh:()=>{ + if (!this.scroller.currentOffset()) { + /*处理无数据,为空的情况*/ + return true + } + //如果列表到顶,返回true,表示可以下拉,返回false,表示无法下拉 + return this.scroller.currentOffset().yOffset <= 0 + }, + onLoad:()=>{ + this.pageNumber++; + this.getApplyList(); + setTimeout(() => { + this.controller.loadSuccess() + }, 1000) + + }, + onCanPullLoad: () => { + if (this.pageNumber >= this.totalPageNumer) { + return false; + } else { + return true; + } + } + }).width('100%') .height('100%').clip(true) + } + + + List() { + ForEach(this.beanType, (item: VideoTypeBean,index:number) => { + ListItem() { + Column() { + + Text(item.name).fontColor(this.typePosition==index?$r('app.color.top_title'):$r('app.color.tab_text_nor')) + .fontSize(14).height(40) + .padding({left:10}) + .width('100%') + .alignSelf(ItemAlign.Start) + + } + .width('100%') + .justifyContent(FlexAlign.Start) + .onClick(()=>{ + this.typePosition=index + this.typeUuid=item.uuid + this.typelistStatus=false + }) + } + }, (item: VideoTypeBean) => JSON.stringify(item)) + } .width('100%') + .height('100%') + .visibility(this.typelistStatus?Visibility.Visible:Visibility.None) + .backgroundColor(Color.White) + } + .layoutWeight(1) + + } + .width('100%') + .height('100%') + } + + @Builder + contentView(){ + List({ scroller: this.scroller }) { + ForEach(this.data, (item: PatientVBean, index) => { + ListItem() { + ItemCompTeachVideo({item:item}) + } + }) + } + .width('100%') + .height('100%') + .edgeEffect(EdgeEffect.None) + + } + + +} + diff --git a/localconversationkit_ui/src/main/ets/pages/LocalConversationPage.ets b/localconversationkit_ui/src/main/ets/pages/LocalConversationPage.ets index 672a52a..34e1ad6 100644 --- a/localconversationkit_ui/src/main/ets/pages/LocalConversationPage.ets +++ b/localconversationkit_ui/src/main/ets/pages/LocalConversationPage.ets @@ -5,6 +5,7 @@ * */ +import { HMRouter, HMRouterMgr } from '@hadss/hmrouter'; import { BasicConstant, ChatParam, preferenceStore } from '@itcast/basic'; import { ChatKitClient, ChatRepo, NEUserWithFriend, PersonSelectParam, TeamRepo } from '@nimkit/chatkit'; import { CommonEmptyResult, CommonLongLoadingProgress, NetworkBrokenBuilder } from '@nimkit/common'; @@ -12,10 +13,12 @@ import { V2NIMConversationType, V2NIMLocalConversation } from '@nimsdk/base'; import { AitServer } from '../service/ait/AitService'; import { ConversationViewItem } from '../view/ConversationViewItem'; import { LocalConversationViewModel } from '../viewmodel/LocalConversationViewModel'; - +@HMRouter({ + pageUrl: 'LocalConversationPage' +}) @ComponentV2 export struct LocalConversationPage { - @Param pathStack: NavPathStack = new NavPathStack() + // @Param pathStack: NavPathStack = new NavPathStack() @Param onUreadMessageChange?: (unreadCount?: number) => void = undefined private viewModel: LocalConversationViewModel = new LocalConversationViewModel() @@ -28,7 +31,7 @@ export struct LocalConversationPage { } build() { - NavDestination() { + // NavDestination() { if (this.viewModel.conversationList) { if (this.viewModel.conversationList.length <= 0 && this.viewModel.isFinishedSyncLoad) { CommonEmptyResult({ @@ -73,18 +76,18 @@ export struct LocalConversationPage { CommonLongLoadingProgress({ contentText: $r('app.string.conversation_loading') }) } - } - .hideTitleBar(true) + // } + // .hideTitleBar(true) // .title(this.titleBuilder) - .backgroundColor(Color.White) + // .backgroundColor(Color.White) } - @Builder - titleBuilder() { - ConversationNavigationTitleBar({ - pathStack: this.pathStack - }) - } + // @Builder + // titleBuilder() { + // ConversationNavigationTitleBar({ + // pathStack: this.pathStack + // }) + // } /** * 跳转到聊天页面 @@ -93,15 +96,16 @@ export struct LocalConversationPage { if (conversationInfo?.type == V2NIMConversationType.V2NIM_CONVERSATION_TYPE_P2P) { preferenceStore.setItemString('gdxz_consult_uuid','') preferenceStore.setItemString('gdxz_sessionType',BasicConstant.general) - this.pathStack.pushPath({ name: "ChatP2PPage", - param: { - // gdxz_sessionType:BasicConstant.general, - conversationId:conversationInfo.conversationId - } as ChatParam - - }) + HMRouterMgr.push({ pageUrl: 'ChatP2PPage' , param: { + conversationId:conversationInfo.conversationId + } as ChatParam}) + // this.pathStack.pushPath({ name: "ChatP2PPage", + // param: { + // conversationId:conversationInfo.conversationId + // } as ChatParam + // }) } else if (conversationInfo?.type == V2NIMConversationType.V2NIM_CONVERSATION_TYPE_TEAM) { - this.pathStack.pushPath({ name: "ChatTeamPage", param: conversationInfo.conversationId }) + // this.pathStack.pushPath({ name: "ChatTeamPage", param: conversationInfo.conversationId }) } } } @@ -356,8 +360,8 @@ struct ConversationNavigationTitleBar { } } -// 跳转页面入口函数 -@Builder -export function LocalConversationPageBuilder() { - LocalConversationPage() -} \ No newline at end of file +// // 跳转页面入口函数 +// @Builder +// export function LocalConversationPageBuilder() { +// LocalConversationPage() +// } \ No newline at end of file diff --git a/localconversationkit_ui/src/main/ets/pages/LocalConversationPageCopy.ets b/localconversationkit_ui/src/main/ets/pages/LocalConversationPageCopy.ets new file mode 100644 index 0000000..672a52a --- /dev/null +++ b/localconversationkit_ui/src/main/ets/pages/LocalConversationPageCopy.ets @@ -0,0 +1,363 @@ +/* + * Copyright (c) 2022 NetEase, Inc. All rights reserved. + * Use of this source code is governed by a MIT license that can be + * found in the LICENSE file. + * + */ + +import { BasicConstant, ChatParam, preferenceStore } from '@itcast/basic'; +import { ChatKitClient, ChatRepo, NEUserWithFriend, PersonSelectParam, TeamRepo } from '@nimkit/chatkit'; +import { CommonEmptyResult, CommonLongLoadingProgress, NetworkBrokenBuilder } from '@nimkit/common'; +import { V2NIMConversationType, V2NIMLocalConversation } from '@nimsdk/base'; +import { AitServer } from '../service/ait/AitService'; +import { ConversationViewItem } from '../view/ConversationViewItem'; +import { LocalConversationViewModel } from '../viewmodel/LocalConversationViewModel'; + +@ComponentV2 +export struct LocalConversationPage { + @Param pathStack: NavPathStack = new NavPathStack() + @Param onUreadMessageChange?: (unreadCount?: number) => void = undefined + private viewModel: LocalConversationViewModel = new LocalConversationViewModel() + + aboutToAppear(): void { + + this.viewModel.onUreadMessageChange = this.onUreadMessageChange + //初始化@ 服务 + AitServer.instance.init() + this.viewModel.initConversation() + } + + build() { + NavDestination() { + if (this.viewModel.conversationList) { + if (this.viewModel.conversationList.length <= 0 && this.viewModel.isFinishedSyncLoad) { + CommonEmptyResult({ + tips: $r('app.string.conversation_empty') + }).margin({ + top: 80 + }) + } else { + if (this.viewModel.networkBroken) { + NetworkBrokenBuilder() + } + + List() { + ForEach(this.viewModel.conversationList, (item: V2NIMLocalConversation) => { + ListItem() { + ConversationViewItem({ + conversationInfo: item, + haveBeanAit: this.viewModel.aitConversationList.has(item.conversationId), + onItemClick: () => { + //goto ChatPage + this.goToChatPage(item) + } + }) + } + }) + } + .listDirection(Axis.Vertical) + .onReachEnd(() => { + if (this.viewModel.conversationList && + this.viewModel.conversationList.length > 0 && + !this.viewModel.isFinished) { + this.viewModel.loadConversation() + } + }) + .scrollBar(BarState.Off) + .width('100%') + .height('100%') + .backgroundColor('#ffFFFFFF') + } + + } else { + CommonLongLoadingProgress({ contentText: $r('app.string.conversation_loading') }) + } + + } + .hideTitleBar(true) + // .title(this.titleBuilder) + .backgroundColor(Color.White) + } + + @Builder + titleBuilder() { + ConversationNavigationTitleBar({ + pathStack: this.pathStack + }) + } + + /** + * 跳转到聊天页面 + */ + goToChatPage(conversationInfo: V2NIMLocalConversation) { + if (conversationInfo?.type == V2NIMConversationType.V2NIM_CONVERSATION_TYPE_P2P) { + preferenceStore.setItemString('gdxz_consult_uuid','') + preferenceStore.setItemString('gdxz_sessionType',BasicConstant.general) + this.pathStack.pushPath({ name: "ChatP2PPage", + param: { + // gdxz_sessionType:BasicConstant.general, + conversationId:conversationInfo.conversationId + } as ChatParam + + }) + } else if (conversationInfo?.type == V2NIMConversationType.V2NIM_CONVERSATION_TYPE_TEAM) { + this.pathStack.pushPath({ name: "ChatTeamPage", param: conversationInfo.conversationId }) + } + } +} + +@ComponentV2 +struct ConversationNavigationTitleBar { + @Local conversationPopupShowed: boolean = false + @Param pathStack: NavPathStack = new NavPathStack() + + build() { + Column({ space: 10 }) { + Row() { + //标题栏左侧图标 + Image($r('app.media.brand')) + .margin({ left: 20 }) + .width(32) + .height(32) + .objectFit(ImageFit.Contain) + //标题栏左侧文字 + Text($r('app.string.conversation_title')) + .fontSize(20) + .fontWeight(FontWeight.Bold) + .height(32) + .width('100%') + .margin({ left: 12, right: 12 }) + .layoutWeight(2) + .textAlign(TextAlign.Start) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + + + Row() + .height(1) + .layoutWeight(1) + + //标题栏右侧搜索图标 + Image($r('app.media.nav_search')) + .width(32) + .height(32) + .padding({ + left: 3, + right: 3, + top: 3, + bottom: 3 + }) + .margin({ right: 10 }) + .onClick(() => { + //点击去搜索 + this.goSearchPage(this.pathStack) + }) + + //标题栏右侧更多按钮图标 + Image($r('app.media.nav_add')) + .width(32) + .height(32) + .padding({ + left: 3, + right: 3, + top: 3, + bottom: 3 + }) + .margin({ right: 20 }) + .onClick(() => { + this.conversationPopupShowed = !this.conversationPopupShowed + }) + .bindPopup(this.conversationPopupShowed, + //右侧更多操作弹框 + { + targetSpace: 'popupLocation', + builder: this.popupBuilder, + placement: Placement.Bottom, + mask: true, + popupColor: Color.White, + enableArrow: false, + showInSubWindow: false, + autoCancel: true, + onStateChange: (e) => { + if (!e.isVisible) { + this.conversationPopupShowed = false + } + } + }) + + } + .height(55) + .alignSelf(ItemAlign.Start) + + Row() + .width('100%') + .height(1) + .backgroundColor("#E9EFF5") + } + .height('100%') + .width('100%') + } + + @Builder + popupBuilder() { + Column({ space: 16 }) { + //添加好友 + Row() { + Image($r('app.media.friend_add')) + .width(14) + .height(14) + Text($r('app.string.add_friend')) + .fontSize(14) + .fontColor('#ff333333') + .margin({ left: 6 }) + }.onClick(() => { + if (this.conversationPopupShowed) { + this.conversationPopupShowed = false + this.goAddFriend(this.pathStack) + } + }) + + //创建讨论组 + Row() { + Image($r('app.media.team_discuss')) + .width(14) + .height(14) + Text($r('app.string.create_discuss_team')) + .fontSize(14) + .fontColor('#ff333333') + .margin({ left: 6 }) + }.onClick(() => { + if (this.conversationPopupShowed) { + this.conversationPopupShowed = false + this.goToPersonSelectPage(this.pathStack, true) + } + }) + + //创建高级群 + Row() { + Image($r("app.media.team_advance")) + .width(14) + .height(14) + Text($r('app.string.create_advance_team')) + .fontSize(14) + .fontColor('#ff333333') + .margin({ left: 6 }) + }.onClick(() => { + if (this.conversationPopupShowed) { + this.conversationPopupShowed = false + this.goToPersonSelectPage(this.pathStack, false) + } + }) + } + .width(122) + .padding({ + top: 16, + left: 16, + bottom: 16 + }) + .alignItems(HorizontalAlign.Start) + .borderRadius(8) + .backgroundColor('#ffFFFFFF') + } + + /** + * 搜索页面 + */ + goSearchPage(pathStack: NavPathStack) { + pathStack.pushPath({ name: "SearchPage" }) + } + + /** + * 添加好友 + */ + goAddFriend(pathStack: NavPathStack) { + pathStack.pushPath({ name: "AddFriendPage" }) + } + + // 创建讨论组的人选选择器返回 + groupSelectorCallback = async (selectedList: NEUserWithFriend[]) => { + try { + this.pathStack.pop() + let invitees = selectedList.map(user => user.user?.accountId ?? '') + this.createGroupTeam(invitees) + } catch (err) { + console.log(err) + } + } + // 创建高级群的人选选择器返回 + teamSelectorCallback = async (selectedList: NEUserWithFriend[]) => { + try { + this.pathStack.pop() + let invitees = selectedList.map(user => user.user?.accountId ?? '') + this.createAdvanceTeam(invitees) + } catch (err) { + console.log(err) + } + } + + /** + * 跳转到人员选择器 + * @param pathStack + * @param isGroup + */ + goToPersonSelectPage(pathStack: NavPathStack, isGroup: boolean) { + if (isGroup) { + pathStack.pushPath({ + name: "PersonSelectPage", + param: new PersonSelectParam(this.groupSelectorCallback) + }) + } else { + pathStack.pushPath({ + name: "PersonSelectPage", + param: new PersonSelectParam(this.teamSelectorCallback) + }) + } + + } + + /** + * 创建讨论组 + */ + createGroupTeam(invitees: string[]) { + TeamRepo.createGroupTeam(invitees).then((result) => { + if (result) { + // 跳转到聊天页面 + this.pathStack.pushPath({ + name: "ChatTeamPage", + param: ChatKitClient.nim.conversationIdUtil.teamConversationId(result.team.teamId) + }) + } + }) + } + + /** + * 创建高级群 + */ + createAdvanceTeam(invitees: string[]) { + TeamRepo.createAdvanceTeam(invitees).then((result) => { + if (result) { + //1,本地保存一条消息 + let message = ChatKitClient.nim.messageCreator.createTipsMessage( + getContext(this).resourceManager.getStringSync($r('app.string.createAdvancedTeamSuccess')) + ) + ChatRepo.saveLocalMessage(message, + ChatKitClient.nim.conversationIdUtil.teamConversationId(result.team.teamId), + ChatKitClient.getLoginUserId(), + (new Date()).valueOf() - 500 + ) + // 2 跳转到聊天页面 + this.pathStack.pushPath({ + name: "ChatTeamPage", + param: ChatKitClient.nim.conversationIdUtil.teamConversationId(result.team.teamId) + }) + } + }) + + } +} + +// 跳转页面入口函数 +@Builder +export function LocalConversationPageBuilder() { + LocalConversationPage() +} \ No newline at end of file diff --git a/localconversationkit_ui/src/main/resources/base/profile/route_map.json b/localconversationkit_ui/src/main/resources/base/profile/route_map.json index 611cd9b..208caba 100644 --- a/localconversationkit_ui/src/main/resources/base/profile/route_map.json +++ b/localconversationkit_ui/src/main/resources/base/profile/route_map.json @@ -1,12 +1,12 @@ { "routerMap": [ - { - "name": "LocalConversationPage", - "pageSourceFile": "src/main/ets/pages/LocalConversationPage.ets", - "buildFunction": "LocalConversationPageBuilder", - "data": { - "description": "this is Conversation list page" - } - } +// { +// "name": "LocalConversationPage", +// "pageSourceFile": "src/main/ets/pages/LocalConversationPage.ets", +// "buildFunction": "LocalConversationPageBuilder", +// "data": { +// "description": "this is Conversation list page" +// } +// } ] } \ No newline at end of file diff --git a/products/expert/src/main/ets/pages/Index.ets b/products/expert/src/main/ets/pages/Index.ets index d2110e6..2cfb218 100644 --- a/products/expert/src/main/ets/pages/Index.ets +++ b/products/expert/src/main/ets/pages/Index.ets @@ -1,11 +1,16 @@ import { GuidePage } from 'register' +import { AttributeUpdater } from '@kit.ArkUI'; +import { HMDefaultGlobalAnimator, HMNavigation } from '@hadss/hmrouter'; @Entry @Component struct Index { + build() { Column() { - GuidePage() + GuidePage() } } -} \ No newline at end of file + +} + diff --git a/products/expert/src/main/ets/pages/Netease/ConsultationDetailPage.ets b/products/expert/src/main/ets/pages/Netease/ConsultationDetailPage.ets index 18ed410..462763d 100644 --- a/products/expert/src/main/ets/pages/Netease/ConsultationDetailPage.ets +++ b/products/expert/src/main/ets/pages/Netease/ConsultationDetailPage.ets @@ -1,17 +1,41 @@ -import { router } from '@kit.ArkUI' +import { HMDefaultGlobalAnimator, HMNavigation } from '@hadss/hmrouter'; +import { AttributeUpdater, router } from '@kit.ArkUI' import { ConsultationDetailComp } from 'netease' +class NavModifier extends AttributeUpdater { + initializeModifier(instance: NavigationAttribute): void { + instance.mode(NavigationMode.Stack); + instance.navBarWidth('100%'); + instance.hideTitleBar(true); + instance.hideToolBar(true); + } +} @Entry @Component struct ConsultationDetailPage { - + modifier: NavModifier = new NavModifier() + // pathStack: NavPathStack = new NavPathStack() // @State params:Record = router.getParams() as Record; build() { - RelativeContainer() { - ConsultationDetailComp() + // Navigation(this.pathStack) { + Column(){ + HMNavigation({ + navigationId: 'ConsultationDetailNavigations', homePageUrl: 'ConsultationDetailPages', + options: { + standardAnimator: HMDefaultGlobalAnimator.STANDARD_ANIMATOR, + dialogAnimator: HMDefaultGlobalAnimator.DIALOG_ANIMATOR, + modifier: this.modifier + } + }) + { + ConsultationDetailComp() + } + } .height('100%') .width('100%') + // } + // .mode(NavigationMode.Auto) + // .hideTitleBar(true) } - } \ No newline at end of file diff --git a/products/expert/src/main/ets/pages/Netease/PublicConsultationPage.ets b/products/expert/src/main/ets/pages/Netease/PublicConsultationPage.ets index 05a7da3..d18192c 100644 --- a/products/expert/src/main/ets/pages/Netease/PublicConsultationPage.ets +++ b/products/expert/src/main/ets/pages/Netease/PublicConsultationPage.ets @@ -1,9 +1,20 @@ import { TabBarConsultationComp } from 'netease'; +import { AttributeUpdater } from '@kit.ArkUI'; +import { HMDefaultGlobalAnimator, HMNavigation } from '@hadss/hmrouter'; + +class NavModifier extends AttributeUpdater { + initializeModifier(instance: NavigationAttribute): void { + instance.mode(NavigationMode.Stack); + instance.navBarWidth('100%'); + instance.hideTitleBar(true); + instance.hideToolBar(true); + } +} @Entry @Component struct PublicConsultationPage { - pathStack: NavPathStack = new NavPathStack() - + // pathStack: NavPathStack = new NavPathStack() + modifier: NavModifier = new NavModifier() @State @Watch('onChangeIndex') activeIndex: number = 0 @@ -22,17 +33,32 @@ struct PublicConsultationPage { this.onChangeIndex() } build() { - Navigation(this.pathStack) { - Flex() { - TabBarConsultationComp({ activeIndex: this.activeIndex, pathStack: this.pathStack}) + // Navigation(this.pathStack) { + Column() + { + HMNavigation({ + navigationId: 'PublicConsultationPageNavigations', homePageUrl: 'PublicConsultationPage', + options: { + standardAnimator: HMDefaultGlobalAnimator.STANDARD_ANIMATOR, + dialogAnimator: HMDefaultGlobalAnimator.DIALOG_ANIMATOR, + modifier: this.modifier + } + }) + { + Flex() { + TabBarConsultationComp({ activeIndex: this.activeIndex}) + } + .backgroundColor($r('app.color.white')) } - .backgroundColor($r('app.color.white')) + } + + // .backgroundColor(Color.Red) // .height('100%') // .width('100%') - - } - .mode(NavigationMode.Auto) - .hideTitleBar(true) + // + // } + // .mode(NavigationMode.Auto) + // .hideTitleBar(true) } } \ No newline at end of file diff --git a/products/expert/src/main/ets/pages/Netease/imTabPage.ets b/products/expert/src/main/ets/pages/Netease/imTabPage.ets index 56f3385..b0a2218 100644 --- a/products/expert/src/main/ets/pages/Netease/imTabPage.ets +++ b/products/expert/src/main/ets/pages/Netease/imTabPage.ets @@ -1,9 +1,19 @@ +import { HMDefaultGlobalAnimator, HMNavigation } from '@hadss/hmrouter'; import { TabBarComp } from 'netease'; +import { AttributeUpdater } from '@kit.ArkUI'; +class NavModifier extends AttributeUpdater { + initializeModifier(instance: NavigationAttribute): void { + instance.mode(NavigationMode.Stack); + instance.navBarWidth('100%'); + instance.hideTitleBar(true); + instance.hideToolBar(true); + } +} @Entry @Component struct ImTabPage { - pathStack: NavPathStack = new NavPathStack() - + // pathStack: NavPathStack = new NavPathStack() + modifier: NavModifier = new NavModifier() @State @Watch('onChangeIndex') activeIndex: number = 0 @@ -22,16 +32,33 @@ struct ImTabPage { this.onChangeIndex() } build() { - Navigation(this.pathStack) { - Flex() { - TabBarComp({ activeIndex: this.activeIndex, pathStack: this.pathStack}) + // Navigation(this.pathStack) { + Column() + { + HMNavigation({ + navigationId: 'MainNavigations', homePageUrl: 'ImTabPage', + options: { + standardAnimator: HMDefaultGlobalAnimator.STANDARD_ANIMATOR, + dialogAnimator: HMDefaultGlobalAnimator.DIALOG_ANIMATOR, + modifier: this.modifier + } + }) + { + Flex() { + TabBarComp({ activeIndex: this.activeIndex}) + } + .backgroundColor($r('app.color.white')) } - .backgroundColor($r('app.color.white')) - // .backgroundColor(Color.Red) - // .height('100%') - // .width('100%') } - .mode(NavigationMode.Auto) - .hideTitleBar(true) + .width('100%') + .height('100%') + + + + // } + // .mode(NavigationMode.Auto) + // .hideTitleBar(true) } + + } \ No newline at end of file diff --git a/products/expert/src/main/ets/pages/VideoPage/PLVMediaPlayerOnlyVideoPage.ets b/products/expert/src/main/ets/pages/VideoPage/PLVMediaPlayerOnlyVideoPage.ets new file mode 100644 index 0000000..d7386ed --- /dev/null +++ b/products/expert/src/main/ets/pages/VideoPage/PLVMediaPlayerOnlyVideoPage.ets @@ -0,0 +1,292 @@ +import { PLVMediaPlayerSingleVideoLayout } from 'scene_single_video'; +import { DependScope, Disposable, requireNotNull, runCatching } from '@polyvharmony/media-player-sdk'; +import { + createId, + PLVMediaPlayerScenes, + PLVMediaPlayerSingleVideoPageParam, + PLVMPPageControlViewModel, + PLVOrientationManager, + PLVOrientationManagerObserver +} from 'media-player-common'; +import common from '@ohos.app.ability.common'; +import window from '@ohos.window'; +import { createDependScope } from '@polyvharmony/media-player-sdk' +import { + commonPageModule,getDisplayWindowWidth +} from 'media-player-common' +import { HdNav,BasicConstant ,authStore} from '@itcast/basic' +import HashMap from '@ohos.util.HashMap'; +import { hdHttp, HdResponse ,logger} from '@itcast/basic/Index' +import { emitter,BusinessError } from '@kit.BasicServicesKit'; +import { VideoDetailModel,VideoCommentModel,commentModel,VideoDetailsComment } from 'home' +import { router,promptAction } from '@kit.ArkUI'; +import inputMethod from '@ohos.inputMethod'; + +@Entry +@Component +export struct PLVMediaPlayerOnlyVideoPage { + @Provide pageDependScope: DependScope = createDependScope(commonPageModule) + // @Consume pageDependScope: DependScope + private params: VideoPageParam = router.getParams() as VideoPageParam + + private param: PLVMediaPlayerSingleVideoPageParam = this.params.param + private context = getContext(this) as common.UIAbilityContext + private pageControlViewModel: PLVMPPageControlViewModel = this.pageDependScope.get(PLVMPPageControlViewModel) + private onBackPressDisposable: Disposable | undefined = undefined + private readonly plv_media_player_single_video_background: string = createId() + + @State isPortrait: boolean = true;//是否竖屏 + @State commentList:Array = [];//评论列表 + @State commentContent:string = '';//评论内容 + scroller: Scroller = new Scroller(); + @State note:string='' + aboutToAppear(): void { + requireNotNull(this.param, () => "param is null") + this.onBackPressDisposable = this.pageControlViewModel.onBackPressHandler.register(10, () => this.onBackPress()) + runCatching(async () => { + const windowInstance = await window.getLastWindow(this.context) + windowInstance.setWindowKeepScreenOn(true) + }) + this.getVideoDetail(this.params.video_uuid) + this.getCommentdata(this.params.video_uuid) + + PLVOrientationManager.getInstance().isPortrait.observe((isPortrait) => { + if (typeof isPortrait === 'boolean') { + this.isPortrait = isPortrait + } + }) + + emitter.on({ eventId: BasicConstant.notification_back_refreshData }, () => { + this.getCommentdata(this.params.video_uuid) + }) + } + + @State currentIndex: number = 0; + + @Builder tabBuilder(title: string, targetIndex: number) { + Column() { + Text(title) + .fontColor(this.currentIndex === targetIndex ? '#8D2316' : '#848284') + .fontSize(14) + .lineHeight(45) + .height(45) + + } + .width('100%') + .height(50) + .justifyContent(FlexAlign.Center) + } + build() { + Column(){ + if (this.isPortrait) { + HdNav({ title: '视频详情', showRightIcon: false, showLeftIcon: true }) + } + + Stack() { + // 背景图 + // Image($r('app.media.plv_media_player_video_item_background_portrait')) + // .id(this.plv_media_player_single_video_background) + // .objectFit(ImageFit.Cover) + // .expandSafeArea(undefined, [SafeAreaEdge.BOTTOM]) + + PLVMediaPlayerSingleVideoLayout({ + mediaResource: this.param.mediaResource, + enterFromDownloadCenter: this.param.enterFromDownloadCenter + }) + + // 屏幕方向监听器 + PLVOrientationManagerObserver() + } + .width('100%') + .height(this.getPlayerAreaHeight()) + + // Tabs() { + // TabContent() { + // Scroll(this.scroller) { + // Text(this.note).fontSize(14).fontColor(Color.Black) + // } + // } + // .align(Alignment.TopStart) + // .padding(15) + // .customTabbar('视频简介') + // + // TabContent() { + // Column() { + // List(){ + // ForEach(this.commentList,(model:commentModel)=>{ + // ListItem(){ + // VideoDetailsComment({model:model,videoCommentUuid:this.params.video_uuid}); + // } + // }) + // }.height('calc(100% - 100vp)').width('100%').backgroundColor('#f4f4f4').scrollBar(BarState.Off) + // Row({space:10}) { + // Row() { + // TextInput({ placeholder: '我也说一句',text:this.commentContent }) + // .fontSize(17) + // .backgroundColor(Color.White) + // .width('95%') + // .onChange((value: string) => { + // this.commentContent = value; // 实时更新临时内容[3](@ref) + // console.info('视频详情评论输入框内容:', this.commentContent); + // }) + // }.borderRadius(5).borderWidth(1).borderColor('#333333').backgroundColor(Color.White).height(50).width('calc(100% - 100vp)') + // .margin({ left: 10,top: 10 }) + // + // Button('发送') + // .borderRadius(5) + // .type(ButtonType.ROUNDED_RECTANGLE) + // .backgroundColor($r('app.color.main_color')) + // .fontColor(Color.White) + // .fontSize(17) + // .width(70).height(50) + // .margin({top:10}) + // .onClick(()=>{ + // this.addComment(); + // }) + // }.backgroundColor(Color.White).width('100%').height(100).justifyContent(FlexAlign.Start).alignItems(VerticalAlign.Top) + // + // } + // .justifyContent(FlexAlign.End) + // } + // .backgroundColor('#f4f4f4') + // .customTabbar('评论') + // } + // .divider( { + // strokeWidth: 1, + // color: $r('app.color.common_gray_border'), + // }) + // .layoutWeight(1) + // .onChange((index: number) => { + // this.currentIndex = index; + // }) + } + + } + + getPlayerAreaHeight(): string | number { + if (this.isPortrait) { + return getDisplayWindowWidth().vp / 16 * 9 + } else { + return '100%' + } + } + + onBackPress(): boolean { + if (!PLVOrientationManager.getInstance().isPortrait.value) { + PLVOrientationManager.getInstance().requestOrientation('port'); + return true; + } + return false; + } + + aboutToDisappear(): void { + this.onBackPressDisposable?.dispose() + runCatching(async () => { + const windowInstance = await window.getLastWindow(this.context) + windowInstance.setWindowKeepScreenOn(false) + }) + + emitter.off(BasicConstant.notification_back_refreshData) + } + + getVideoDetail(video_uuid:string) { + const hashMap: HashMap = new HashMap(); + hashMap.clear(); + hashMap.set('video_uuid', video_uuid) + + hdHttp.httpReq(BasicConstant.videoDetail,hashMap).then(async (res: HdResponse) => { + logger.info('Response videoDetails'+video_uuid); + logger.info('Response videoDetail'+res); + let json:VideoDetailModel = JSON.parse(res+'') as VideoDetailModel; + this.note=json.video.note + this.readSeriesVideo(video_uuid) + }).catch((err: BusinessError) => { + }) + } + + readSeriesVideo(video_uuid:string) { + // const hashMap: HashMap = new HashMap(); + // hashMap.clear(); + // hashMap.set('uuid', uuid) + + hdHttp.post(BasicConstant.read, { + user_uuid: authStore.getUser().uuid, + news_article_uuid:video_uuid, + type: '4', + } as readExtraData).then(async (res: HdResponse) => { + + + }).catch((err: BusinessError) => { + }) + } + + + getCommentdata(video_uuid:string) { + const hashMap: HashMap = new HashMap(); + hashMap.clear(); + hashMap.set('uuid', video_uuid) + hdHttp.httpReq(BasicConstant.videoCommentListV2,hashMap).then(async (res: HdResponse) => { + logger.info('Response videoDetails commentList:'+video_uuid); + logger.info('Response videoDetail commentList:'+res); + let json:VideoCommentModel = JSON.parse(res+'') as VideoCommentModel; + if(json.data != null && json.data!) { + this.commentList = json.data; + } + }).catch((err: BusinessError) => { + }) + } + + addComment() { + inputMethod.getController().hideTextInput();//关闭键盘 + if (this.commentContent.length == 0) { + promptAction.showToast({ message: '请输入评论内容', duration: 1000 }) + return; + } + + const hashMap: HashMap = new HashMap(); + hashMap.set('article_uuid', this.params.video_uuid) + hashMap.set('comment', this.commentContent) + hashMap.set('type', '8') + hdHttp.httpReq(BasicConstant.addCommentV2,hashMap).then(async (res: HdResponse) => { + logger.info('Response replyComment:'+res); + let json:CommentV2Model = JSON.parse(res+'') as CommentV2Model; + if(json.code == 200) { + promptAction.showToast({ message: '发表评论成功', duration: 1000 }) + this.getCommentdata(this.params.video_uuid); + this.commentContent = ''; + } else { + promptAction.showToast({ message: json.message, duration: 1000 }) + } + }).catch((err: BusinessError) => { + }) + } +} + +@Extend(TabContent) +function customTabbar(name:string) { + .tabBar(SubTabBarStyle.of(name) + .labelStyle({ unselectedColor: '#848284', selectedColor:'#8D2316' , font: { size: 17 }}) + .indicator({ + color: '#8D2316', //下划线颜色 + height: 1, //下划线高度 + marginTop:16 //下划线与文字间距 + })) + .height('100%') +} + +interface VideoPageParam { + video_uuid:string + param:PLVMediaPlayerSingleVideoPageParam +} + +export interface CommentV2Model{ + code:number; + data:Object[]; + message:string; + msg:string +} +interface readExtraData{ +user_uuid:string, +news_article_uuid:string, +type:string, +} \ No newline at end of file diff --git a/products/expert/src/main/resources/base/profile/main_pages.json b/products/expert/src/main/resources/base/profile/main_pages.json index 0d69699..b8eb675 100644 --- a/products/expert/src/main/resources/base/profile/main_pages.json +++ b/products/expert/src/main/resources/base/profile/main_pages.json @@ -42,6 +42,8 @@ "pages/Netease/PatientSimplyPage", "pages/Netease/MyOpinionPage", "pages/PatientsPage/GroupManagementPage", - "pages/WebView/WebPageSnapshot" + "pages/WebView/WebPageSnapshot", + "pages/VideoPage/PLVMediaPlayerOnlyVideoPage" + ] } \ No newline at end of file