From e794ed885a75be8ab5c789c2ea8db902ce338b0b Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期三, 08 十月 2025 00:01:17 +0800
Subject: [PATCH] 完善功能

---
 entry/src/main/ets/pages/message/MessagePage.ets |  114 +++++++++++++++++++--------------------------------------
 1 files changed, 38 insertions(+), 76 deletions(-)

diff --git a/entry/src/main/ets/pages/message/MessagePage.ets b/entry/src/main/ets/pages/message/MessagePage.ets
index af21043..e25fdab 100644
--- a/entry/src/main/ets/pages/message/MessagePage.ets
+++ b/entry/src/main/ets/pages/message/MessagePage.ets
@@ -1,63 +1,49 @@
-import { CommonConstantWX } from "../../common/CommonConstantWX"
-import { WxUserInfoBase } from "../../data/WxUserInfoBase"
 
-/*
- * Search({placeholder: '璇疯緭鍏ユ偍瑕佹悳绱㈢殑鍐呭',value: 'DeepSeek'})
-        .width('90%')
-        .backgroundColor(Color.White)
-        .searchButton('鎼滅储')
-        .onChange((value: string) => {
-          console.info(`杈撳叆鐨勫唴瀹逛负锛�${value}`)
-        })
-        //鎻愪氦鏂规硶
-        .onSubmit((value:string) => {
-          console.info(`鎻愪氦鐨勫唴瀹逛负锛�${value}`)
-        })
- * */
+class Message {
+  avatar: string | Resource = ''
+  name: string = ''
+  company: string = ''
+  desc: string = ''
+}
+
 @Entry
 @Component
 export struct MessagePage {
-  @State userList:Array<WxUserInfoBase> = CommonConstantWX.mUser
-  @State searchUser:Array<WxUserInfoBase> = []
+  @State messageList: Message[] = [
+    { avatar: '', name: '鏉庡コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...' },
+    { avatar: '', name: '鏋楀厛鐢�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...' },
+    { avatar: '', name: '鍚村コ澹�', company: '鎽╃背绉诲姩绉戞妧|绉诲姩绔紑鍙戝伐绋嬪笀', desc: '杩欎釜宀椾綅鎴戝崄鍒嗘劅鍏磋叮锛岃鐪嬩竴涓嬫垜鐨勭畝鍘嗭紝鎴�...' }
+  ]
+
   build() {
     Column({space: 10}) {
-      Search({placeholder: '鎼滅储'})
-        .backgroundColor(Color.White)
-        .width('90%')
-        .borderRadius(5)
-        .onChange((value: string) =>{
-          //姣忔杈撳叆閮借娓呯┖searchUser鏁扮粍
-          this.searchUser = []
-          let searchCount = 0
-          //杩涜閬嶅巻锛屽湪鏁扮粍婧愬ご鏌ユ壘鍜寁alue鐩稿叧鐨勬暟鎹�
-          for (let index = 0; index < this.userList.length; index++) {
-            const element = this.userList[index];
-            //鍒ゆ柇姣忎竴鏉℃暟鎹槸鍚︽湁鍜孷alue鐩稿叧鐨勫唴瀹�
-            if (element.name?.indexOf(value) != -1) {
-              //鎵惧埌鐩稿叧鐨勬暟鎹紝娣诲姞鍒皊earch鏁扮粍褰撲腑锛屽苟涓旀暟鎹姞涓�
-              searchCount ++
-              this.searchUser.push(element)
-            }
-          }
-          //鍒ゆ柇SearchCount鏄惁涓�0
-          if (searchCount === 0) {
-            //琛ㄧず鏌ユ棤姝や汉
-            this.searchUser.push({
-              id: 999,
-              name: '鏃犳鐢ㄦ埛',
-              img:$r('app.media.avatar_icon')
-            })
-          }
+      Text('鑱旂郴浜�')
+        .width('100%')
+        .textAlign(TextAlign.Start)
+        .fontWeight(800)
+        .fontSize(18)
+        .margin({ left: 16 })
+      Row() {
+        Image($r('app.media.search_icon'))
+          .width(14)
+          .height(14)
+        TextInput({ placeholder: '鎼滅储鎯宠鏌ユ壘鐨勫矖浣�' })
+          .placeholderFont({ size: 14})
+          .placeholderColor('#999999')
+          .backgroundColor('#f3f7fe')
+      }
+      .borderRadius(30)
+      .padding({ left: 20, right: 20 })
+      .backgroundColor('#f3f7fe')
+      .width('100%')
+      .margin({ top: 10 })
+
+      List({ space: 10, initialIndex: 0 }){
+        ForEach(this.messageList, (item: Message) => {
 
         })
-      List({space: 20}){
-        ForEach(this.searchUser.length === 0 ? this.userList: this.searchUser,(item: WxUserInfoBase) => {
-          ListItem(){
-            userInfoItem({item: item})
-          }
-        })
       }
-      .height('90%')
+      .height('100%')
       .padding({top:10})
       .margin({bottom: 30})
       .backgroundColor(Color.White)
@@ -65,30 +51,6 @@
     }
     .height('100%')
     .width('100%')
-    .backgroundColor('#ccc')
-  }
-}
-
-@Component
-struct userInfoItem {
-  @Prop item: WxUserInfoBase
-  build() {
-    Row({space: 15}){
-      Image(this.item.img)
-        .width(40)
-        .height(40)
-        .objectFit(ImageFit.Cover)
-      Text(this.item.name)
-        .fontSize(20)
-    }
-    .onClick(() => {
-      this.getUIContext().getRouter().pushUrl({
-        url: 'pages/message/MessageDetailsPage',
-        params:{
-          userInfo: this.item
-        }
-      })
-    })
-    .padding(10)
+    .padding({ left: 10, right: 10 })
   }
 }
\ No newline at end of file

--
Gitblit v1.8.0