From 23fa268f56dcd99c8dcd46f50f3ffcaa4cdcbc49 Mon Sep 17 00:00:00 2001 From: wwf <1971391498@qq.com> Date: 星期五, 10 十月 2025 17:25:53 +0800 Subject: [PATCH] 功能完善 --- entry/src/main/ets/pages/message/MessageDetailsPage.ets | 55 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 41 insertions(+), 14 deletions(-) diff --git a/entry/src/main/ets/pages/message/MessageDetailsPage.ets b/entry/src/main/ets/pages/message/MessageDetailsPage.ets index a2ea405..8594cff 100644 --- a/entry/src/main/ets/pages/message/MessageDetailsPage.ets +++ b/entry/src/main/ets/pages/message/MessageDetailsPage.ets @@ -12,13 +12,28 @@ @State messageList: Message[] = [ { avatar: '', content: '璇峰彂涓�涓嬩綘鐨勭畝鍘嗙粰鎴戙��', isMe: false }, { avatar: '', content: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴戣寰楁垜鍙互鑳滀换杩欎釜宀椾綅', isMe: true }, - ] - aboutToAppear(): void { + @State avatar: string | Resource = '' + @State name: string = '' + @State company: string = '' + @State pageHeight: number = 0 + @State chatHeight: number = 0 + @State inputText: string = '' + aboutToAppear(): void { + interface Params { + avatar: string | Resource + name: string + company: string + } + const params: Params = router.getParams() as Params + this.name = params.name + this.company = params.company + this.avatar = params.avatar } + build() { - Column() { + Flex({ direction: FlexDirection.Column }) { Row() { Image($r('app.media.left_icon')) .width(20) @@ -27,21 +42,21 @@ router.back() }) Column() { - Text('鏉庡コ澹�') + Text(this.name) .fontSize(16) .fontWeight(700) - Text('鎽╃背绉诲姩绉戞妧') + Text(this.company) .fontSize(12) .fontColor('#666666') .margin({ top: 4 }) } - Row() } .width('100%') .padding(10) .justifyContent(FlexAlign.SpaceBetween) .backgroundColor('#fff') + .expandSafeArea() Column() { List({ space: 20, initialIndex: 0 }){ @@ -66,7 +81,7 @@ .alignItems(VerticalAlign.Bottom) } else { Row({ space: 10 }) { - Image($r('app.media.avatar')) + Image(this.avatar) .width(32) .height(32) Text(item.content) @@ -91,31 +106,43 @@ .edgeEffect(EdgeEffect.Spring) .width('100%') } + .layoutWeight(1) .padding(16) .width('100%') - .height(600) + .expandSafeArea() Row({ space: 8 }) { Image($r('app.media.audio_icon')) .width(24) .height(24) - TextInput() - .width(240) + TextInput({ text: $$this.inputText }) + .layoutWeight(1) .placeholderColor('#999999') .backgroundColor('#f3f7fe') Image($r('app.media.expression_icon')) .width(24) .height(24) - Image($r('app.media.add_icon')) - .width(24) - .height(24) + if (this.inputText) { + Button('鍙戦��') + .type(ButtonType.Normal) + .borderRadius(6) + .onClick(() => { + this.messageList.push({ + avatar: '', content: this.inputText, isMe: true + }) + this.inputText = '' + }) + } else { + Image($r('app.media.add_icon')) + .width(24) + .height(24) + } } .backgroundColor('#FFF') .width('100%') .height(60) .padding(10) .alignItems(VerticalAlign.Center) - } .width('100%') .height('100%') -- Gitblit v1.8.0