扩展消息部分代码提交

This commit is contained in:
XiuYun CHEN
2025-07-14 17:37:45 +08:00
parent cf7aa93d6e
commit 1121cc3f20
15 changed files with 200 additions and 73 deletions
@@ -1,6 +1,8 @@
import { ConsulList } from '../model/ConsulModel'
import { router } from '@kit.ArkUI'
import { BasicConstant, ChatParam, preferenceStore } from '@itcast/basic';
import { ChatKitClient } from '@nimkit/chatkit';
@Preview
@@ -12,55 +14,99 @@ export struct ItemCompPublic {
aboutToAppear(): void {
}
pathStack: NavPathStack = new NavPathStack()
build() {
Column() {
Row()
{
Text(this.item.state==0?$r('app.string.cancellation'):this.item.realName).fontSize(19).fontColor($r('app.color.top_title')).layoutWeight(1)
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).backgroundColor('#ffff3e3e').borderRadius(20).margin({top:-20})
.visibility(this.isHistory?Visibility.Visible:Visibility.None)
}
Column() {
Row() {
Text(this.item.state == 0 ? $r('app.string.cancellation') : this.item.realName)
.fontSize(19)
.fontColor($r('app.color.top_title'))
.layoutWeight(1)
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)
.backgroundColor('#ffff3e3e')
.borderRadius(20)
.margin({ top: -20 })
.visibility(this.isHistory ? Visibility.Visible : Visibility.None)
}
Text(this.item.content)
.fontSize(14).fontColor($r('app.color.common_gray_03')).padding(9).margin({top:10})
.backgroundColor($r('app.color.f6f6f6')).borderRadius(8)
.fontSize(14)
.fontColor($r('app.color.common_gray_03'))
.padding(9)
.margin({ top: 10 })
.backgroundColor($r('app.color.f6f6f6'))
.borderRadius(8)
.width('100%')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
Row()
{
Text('问题详情').fontSize(11).backgroundColor($r('app.color.top_title')).fontColor(Color.White)
.width(63).height(25).borderRadius(17).textAlign(TextAlign.Center)
Row() {
Text('问题详情')
.fontSize(11)
.backgroundColor($r('app.color.top_title'))
.fontColor(Color.White)
.width(63)
.height(25)
.borderRadius(17)
.textAlign(TextAlign.Center)
.onClick(() => {
router.pushUrl({
url: 'pages/Netease/ConsultationDetailPage',
params: { uuid: this.item.uuid,isHistory:this.isHistory+''}
params: { uuid: this.item.uuid, isHistory: this.isHistory + '' }
});
})
Text(this.item.diseaseName.includes("甲、乙、丙、丁")?'肝炎':this.item.diseaseName).fontSize(11).borderColor($r('app.color.top_title')).fontColor($r('app.color.top_title'))
.width(63).height(25).borderRadius(17).borderWidth(1).textAlign(TextAlign.Center).margin({left:10})
Text(this.item.diseaseName.includes("甲、乙、丙、丁") ? '肝炎' : this.item.diseaseName)
.fontSize(11)
.borderColor($r('app.color.top_title'))
.fontColor($r('app.color.top_title'))
.width(63)
.height(25)
.borderRadius(17)
.borderWidth(1)
.textAlign(TextAlign.Center)
.margin({ left: 10 })
}.alignSelf(ItemAlign.Start)
.margin({top:10})
.margin({ top: 10 })
}
.width('100%')
.padding(10)
.onClick(() => {
router.pushUrl({
url: 'pages/Netease/ConsultationDetailPage',
params: { uuid: this.item.uuid,isHistory:this.isHistory+''}
});
if(this.isHistory)
{
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
})
}
else
{
router.pushUrl({
url: 'pages/Netease/ConsultationDetailPage',
params: { uuid: this.item.uuid,isHistory:this.isHistory+''}
});
}
})
}
}
@@ -9,7 +9,7 @@ import HashMap from '@ohos.util.HashMap';
@Component
export struct ListCompPublic {
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 })
ItemCompPublic({ item,isHistory:this.isHistory,pathStack: this.pathStack })
}
@@ -112,6 +112,7 @@ export struct ConsultationDetailComp {
if(json.code=='1')
{
promptAction.showToast({ message: '抢答成功' })
this.addBonusPoints()
}
else
{
@@ -123,6 +124,21 @@ export struct ConsultationDetailComp {
})
}
addBonusPoints() {
const hashMap: HashMap<string, string> = new HashMap();
hashMap.clear();
hashMap.set('score_type','2');
hdHttp.httpReq<string>(BasicConstant.addBonusPoints,hashMap).then(async (res: HdResponse<string>) => {
let json:Record<string,string> = JSON.parse(res+'') as Record<string,string>;
promptAction.showToast({ message: json.message })
}).catch((err: BusinessError) => {
this.dialog.close();
})
}
build() {
Column() {
@@ -7,14 +7,14 @@ export struct QuictDoctorComp {
@Watch('onChangeIndex')
activeIndex: number = 0
@State type: number=0
pathStack: NavPathStack = new NavPathStack()
onChangeIndex() {
}
build() {
Column() {
TabBarTopComp({activeIndex:this.activeIndex,type:this.type});
TabBarTopComp({activeIndex:this.activeIndex,type:this.type,pathStack: this.pathStack});
@@ -6,7 +6,7 @@ import { ManyForOneComp } from '../view/ManyForOneComp'
@Component
export struct TabBarConsultationComp {
pathStack: NavPathStack = new NavPathStack()
@StorageProp('bottomHeight')
bottomHeight: number = 0
@Link activeIndex: number
@@ -42,7 +42,7 @@ export struct TabBarConsultationComp {
TabContent() {
if (index === 0)
{
QuictDoctorComp()
QuictDoctorComp({pathStack: this.pathStack})
}
else if(index === 1)
{
@@ -5,7 +5,7 @@ import { ListCompMany } from '../components/ListCompMany'
@Component
export struct TabBarTopComp {
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})
ListCompPublic({isHistory:this.isHistory,pathStack: this.pathStack})
}
else if(this.type==1)