云信发送消息相关

This commit is contained in:
XiuYun CHEN 2025-07-18 17:26:48 +08:00
parent f7408f7cbc
commit cbf50189cc
55 changed files with 4298 additions and 200 deletions

View File

@ -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)

View File

@ -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"
}
}

View File

@ -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

View File

@ -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

View File

@ -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", "患教详情");

View File

@ -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",

View File

@ -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)
}

View File

@ -69,6 +69,10 @@
{
"name": "patient_theme",
"value": "#3cc7c0"
},
{
"name": "tab_text_nor",
"value": "#848284"
}
]
}

View File

@ -88,3 +88,5 @@ 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'
export { PatientListModel,PatientsData } from './src/main/ets/models/PatientListModel'

View File

@ -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)

View File

@ -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 })

View File

@ -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=['全国','北京市','天津市','河北省','山西省'
,'内蒙古自治区','辽宁省','吉林省','黑龙江省','上海市','江苏省','浙江省'
,'安徽省','福建省','江西省','山东省','河南省','湖北省','湖南省','广东省',

View File

@ -12,5 +12,7 @@ export interface ChatParam extends ChatExtModel{
name:string,//患者姓名
conversationId:string,//最近会话id
chat_state:string//公益咨询状态
rawAttach:string;//发送公益咨询首条消息
hasMessage:string;//是否需要发送一条消息
messageType:string;//发送消息的类型
}

View File

@ -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;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -84,6 +84,75 @@ class VideoTools {
})
}
getVideoDetails(video_uuid:string)
{
this.hashMap.clear();
this.hashMap.set('video_uuid', video_uuid)
hdHttp.httpReq<string>(BasicConstant.videoDetail,this.hashMap).then(async (res: HdResponse<string>) => {
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()

View File

@ -13,6 +13,6 @@
"@nimsdk/base": "10.9.10",
"@nimkit/common": "file:../../common",
"@nimkit/localconversationkit_ui": "file:../../localconversationkit_ui",
"refreshlib": "file:../../RefreshLib"
}
}

View File

@ -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
}
}

View File

@ -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)
}
}
}

View File

@ -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)
}
}
}

View File

@ -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 })
}

View File

@ -0,0 +1,14 @@
import { PatientsData } from '@itcast/basic';
export class Groups {
/**
* 处理后的数据分组标题
*/
title: string = '';
/**
* RegionData数组
*/
regionDataList: Array<PatientsData> = [];
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<string, string> = new HashMap();
@State params:Record<string, string> = router.getParams() as Record<string, string>;
// @State params:Record<string, string> = router.getParams() as Record<string, string>;
@State params:Record<string, string>= HMRouterMgr.getCurrentParam() as Record<string, string>;
@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<string, string> = 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()
{
@ -191,12 +239,7 @@ export struct ConsultationDetailComp {
.width('100%')
.width('100%')
.onClick(() => {
// router.pushUrl({
// url: 'pages/Netease/ConsultationDetailPage',
// params: { uuid: this.item.uuid}
// });
})
}

View File

@ -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,
})

View File

@ -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<PatientsData> = [];
@State regionDataGroupsList: Array<Groups> = [];
private indexList: Array<string> = []
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<string>(BasicConstant.urlExpert + 'patientListByGBK', {
expertUuid: authStore.getUser().uuid
} as updateExtraData).then(async (res: HdResponse<string>) => {
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
}

View File

@ -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});

View File

@ -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<string, string>= HMRouterMgr.getCurrentParam() as Record<string, string>;
@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<string, string> = new HashMap();
hashMap.set('page',this.pageNumber.toString());
hashMap.set("topic", this.inputText);
hdHttp.httpReq<string>(BasicConstant.polularScienceArticleListInexpertNew,hashMap).then(async (res: HdResponse<string>) => {
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<string, string> = 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<string>(BasicConstant.patientVideoByName,hashMap).then(async (res: HdResponse<string>) => {
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)
}
}

View File

@ -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()
}

View File

@ -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)
{

View File

@ -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)

View File

@ -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<string, string> = new HashMap();
hashMap.set('page',this.pageNumber.toString());
hashMap.set("type", this.sort);
hashMap.set("keywords", this.inputText);
this.dialog.open()
hdHttp.httpReq<string>(BasicConstant.polularScienceArticleListByKeywordsNew,hashMap).then(async (res: HdResponse<string>) => {
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)
}
}

View File

@ -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<string, string> = 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<string>(BasicConstant.patientVideoByName,hashMap).then(async (res: HdResponse<string>) => {
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<string, string> = new HashMap();
this.dialog.open()
hdHttp.httpReq<string>(BasicConstant.patientVideoType,hashMap).then(async (res: HdResponse<string>) => {
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<this.beanType.length;j++){
let title:string = this.beanType[j].name
let s:string;
let digit:boolean = ChangeUtil.isFirstDigit(title.charAt(0));//判断首位是否是数字
let asciiAlpha :boolean= ChangeUtil.isLetter(title.charAt(0));//字母
if(digit||asciiAlpha){
let substring:string = '';
if (title.length>=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)
}
}

View File

@ -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()
}
// // 跳转页面入口函数
// @Builder
// export function LocalConversationPageBuilder() {
// LocalConversationPage()
// }

View File

@ -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()
}

View File

@ -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"
// }
// }
]
}

View File

@ -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()
}
}
}

View File

@ -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<NavigationAttribute> {
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<string, string> = router.getParams() as Record<string, string>;
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)
}
}

View File

@ -1,9 +1,20 @@
import { TabBarConsultationComp } from 'netease';
import { AttributeUpdater } from '@kit.ArkUI';
import { HMDefaultGlobalAnimator, HMNavigation } from '@hadss/hmrouter';
class NavModifier extends AttributeUpdater<NavigationAttribute> {
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)
}
}

View File

@ -1,9 +1,19 @@
import { HMDefaultGlobalAnimator, HMNavigation } from '@hadss/hmrouter';
import { TabBarComp } from 'netease';
import { AttributeUpdater } from '@kit.ArkUI';
class NavModifier extends AttributeUpdater<NavigationAttribute> {
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)
}
}

View File

@ -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<commentModel> = [];//评论列表
@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<string, string> = new HashMap();
hashMap.clear();
hashMap.set('video_uuid', video_uuid)
hdHttp.httpReq<string>(BasicConstant.videoDetail,hashMap).then(async (res: HdResponse<string>) => {
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<string, string> = new HashMap();
// hashMap.clear();
// hashMap.set('uuid', uuid)
hdHttp.post<string>(BasicConstant.read, {
user_uuid: authStore.getUser().uuid,
news_article_uuid:video_uuid,
type: '4',
} as readExtraData).then(async (res: HdResponse<string>) => {
}).catch((err: BusinessError) => {
})
}
getCommentdata(video_uuid:string) {
const hashMap: HashMap<string, string> = new HashMap();
hashMap.clear();
hashMap.set('uuid', video_uuid)
hdHttp.httpReq<string>(BasicConstant.videoCommentListV2,hashMap).then(async (res: HdResponse<string>) => {
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<string, string> = new HashMap();
hashMap.set('article_uuid', this.params.video_uuid)
hashMap.set('comment', this.commentContent)
hashMap.set('type', '8')
hdHttp.httpReq<string>(BasicConstant.addCommentV2,hashMap).then(async (res: HdResponse<string>) => {
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,
}

View File

@ -42,6 +42,8 @@
"pages/Netease/PatientSimplyPage",
"pages/Netease/MyOpinionPage",
"pages/PatientsPage/GroupManagementPage",
"pages/WebView/WebPageSnapshot"
"pages/WebView/WebPageSnapshot",
"pages/VideoPage/PLVMediaPlayerOnlyVideoPage"
]
}