云信发送消息相关
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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<string>(BasicConstant.closeConsult, {
|
||||
uuid:preferenceStore.getItemString('gdxz_consult_uuid'),
|
||||
|
||||
} as extraData).then(async (res: HdResponse<string>) => {
|
||||
|
||||
let json = JSON.parse(res+'') as Record<string, string>;
|
||||
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
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
@@ -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", "患教详情");
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user