From 436033154ad7ec63c09ee85888e8a63a0c2aaa8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E4=B8=9C=E6=B5=B7?= Date: Tue, 17 Jun 2025 11:34:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/pages/ConversationDetail.ets | 43 +++++---- .../src/main/ets/pages/ConversationList.ets | 24 ++--- features/home/src/main/ets/pages/Index.ets | 95 ++++++++++--------- 3 files changed, 83 insertions(+), 79 deletions(-) diff --git a/features/home/src/main/ets/pages/ConversationDetail.ets b/features/home/src/main/ets/pages/ConversationDetail.ets index 34f8a30..85a672a 100755 --- a/features/home/src/main/ets/pages/ConversationDetail.ets +++ b/features/home/src/main/ets/pages/ConversationDetail.ets @@ -20,9 +20,10 @@ import { ConversationDetailTopSearch } from '../views/Conversation/ConversationD import { HomeConstants } from '../constants/HomeConstants'; import { deviceInfo } from '@kit.BasicServicesKit'; +// [Start conversation_detail] @Component export struct ConversationDetail { - @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @StorageProp('currentBreakpoint') currentBreakpoint: string = 'sm'; @Prop currentConversationUserName: string; @Prop currentFeatureIndex: number; @Consume('pageInfo') pageInfo: NavPathStack; @@ -32,58 +33,58 @@ export struct ConversationDetail { Flex({ direction: FlexDirection.Column }) { ConversationDetailTopSearch({ currentConversationUserName: $currentConversationUserName, }) .height(Adaptive.ContactItemHeight(this.currentBreakpoint)) - if (this.currentConversationUserName.length === HomeConstants.CONVERSATION_DEFAULT_SIZE) { + if (this.currentConversationUserName.length === 3) { ConversationDetailItem({ receivedName: $currentConversationUserName, - isReceived: HomeConstants.IS_RECEIVED, - content: HomeConstants.CONVERSATION_LIST_APPLET[0], - isAppletMsg: HomeConstants.IS_APPLET_CONVERSATION, + isReceived: true, + content: '芬芬邀请你喝奶茶啦', + isAppletMsg: true, currentFeatureIndex: $currentFeatureIndex }) ConversationDetailItem({ receivedName: $currentConversationUserName, - isReceived: HomeConstants.IS_RECEIVED, - content: HomeConstants.CONVERSATION_LIST_APPLET[1], + isReceived: true, + content: '请你喝奶茶,快点单吧!!速度速度,就差你了', currentFeatureIndex: $currentFeatureIndex }) ConversationDetailItem({ receivedName: $currentConversationUserName, - isReceived: !HomeConstants.IS_RECEIVED, - content: HomeConstants.CONVERSATION_LIST_APPLET[2], + isReceived: false, + content: '哈哈,今天有什么喜事说来听听', currentFeatureIndex: $currentFeatureIndex }) } else { ConversationDetailItem({ receivedName: $currentConversationUserName, - isReceived: HomeConstants.IS_RECEIVED, - content: HomeConstants.CONVERSATION_LIST_DOCUMENT[0], - isDocumentMsg: HomeConstants.IS_DOCUMENT_CONVERSATION, + isReceived: true, + content: '市场部2023年新产品宣传规划', + isDocumentMsg: true, currentFeatureIndex: $currentFeatureIndex }) ConversationDetailItem({ receivedName: $currentConversationUserName, - isReceived: HomeConstants.IS_RECEIVED, - content: HomeConstants.CONVERSATION_LIST_DOCUMENT[1], + isReceived: true, + content: '这是明天会议的资料,请发给Jack,让他确认', currentFeatureIndex: $currentFeatureIndex }) ConversationDetailItem({ receivedName: $currentConversationUserName, - isReceived: !HomeConstants.IS_RECEIVED, - content: HomeConstants.CONVERSATION_LIST_DOCUMENT[2], + isReceived: false, + content: '好的,我明天过去', currentFeatureIndex: $currentFeatureIndex }) } Blank() ConversationDetailBottom() } - .height(BaseConstants.FULL_HEIGHT) - .width(BaseConstants.FULL_WIDTH) + .height('100%') + .width('100%') .backgroundColor($r('app.color.background_color_grey')) .padding({ - bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 ? - $r('app.float.tab_content_pb') : $r('app.float.zero') + bottom: deviceInfo.deviceType !== '2in1' ? '28vp' : '0vp' }) } .hideTitleBar(true) } -} \ No newline at end of file +} +// [End conversation_detail] \ No newline at end of file diff --git a/features/home/src/main/ets/pages/ConversationList.ets b/features/home/src/main/ets/pages/ConversationList.ets index cd766b0..89d4b1b 100755 --- a/features/home/src/main/ets/pages/ConversationList.ets +++ b/features/home/src/main/ets/pages/ConversationList.ets @@ -20,9 +20,10 @@ import { HomeTopSearch } from '../views/common/HomeTopSearch'; import { HomeConstants } from '../constants/HomeConstants'; import { deviceInfo } from '@kit.BasicServicesKit'; +// [Start conversation_list_diff_device] @Component export struct ConversationList { - @StorageProp('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @StorageProp('currentBreakpoint') currentBreakpoint: string = 'sm'; @Link currentConversationUserName: Resource; @Link currentContactUserName: string; @State private currentIndex: number = 0; @@ -32,6 +33,7 @@ export struct ConversationList { Flex({ direction: FlexDirection.Column }) { HomeTopSearch({ title: HomeConstants.CONVERSATION_TITLE }) .height('13%') + // [Start conversation_list] List() { ForEach(ConversationListData, (item: ConversationDataInterface, index: number) => { ListItem() { @@ -45,23 +47,21 @@ export struct ConversationList { this.currentContactUserName = ''; this.currentIndex = index; }) - .backgroundColor(this.currentIndex === index ? $r('app.color.conversation_clicked_bg_color') : Color.White) + .backgroundColor(this.currentIndex === index ? '#33D8D8D8' : Color.White) } .height(Adaptive.ContactItemHeight(this.currentBreakpoint)) - }, (item: ConversationDataInterface, index: number) => index + JSON.stringify(item)) } + // [End conversation_list] .padding({ - bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 && - this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.tab_content_pb') : $r('app.float.zero') + bottom: deviceInfo.deviceType !== '2in1' && this.currentBreakpoint === 'lg' ? '28vp' : '0vp' }) .backgroundColor(Color.White) - .width(BaseConstants.FULL_WIDTH) - .height(BaseConstants.FULL_HEIGHT) + .width('100%') + .height('100%') } - - .height(BaseConstants.FULL_HEIGHT) - .width(BaseConstants.FULL_WIDTH) + .height('100%') + .width('100%') } -} \ No newline at end of file +} +// [End conversation_list_diff_device] \ No newline at end of file diff --git a/features/home/src/main/ets/pages/Index.ets b/features/home/src/main/ets/pages/Index.ets index a4f88e7..5d70cb2 100755 --- a/features/home/src/main/ets/pages/Index.ets +++ b/features/home/src/main/ets/pages/Index.ets @@ -27,8 +27,10 @@ import { deviceInfo } from '@kit.BasicServicesKit'; @Entry @Component export struct Index { - @StorageProp('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @StorageProp('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = 'sm'; + // [Start navigation_diff_device] @Provide('pageInfo') pageInfo: NavPathStack = new NavPathStack(); + // [StartExclude navigation_diff_device] @State currentConversationUserName: string = ''; @State currentContactUserName: string = ''; @State currentContactUserIcon: Resource = HomeConstants.DEFAULT_AVATAR; @@ -38,11 +40,12 @@ export struct Index { @State isSplitDocumentScreen: boolean = BaseConstants.SPLIT_DOCUMENT_SCREEN; watchCurrentBreakpoint() { - if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM && + if (this.currentBreakpoint === 'sm' && this.pageInfo.getParamByName('ConversationDetailNone').length === 1 && this.pageInfo.size() === 1) { this.pageInfo.pop(); } } + // [EndExclude navigation_diff_device] @Builder PageMap(name: string) { @@ -68,13 +71,14 @@ export struct Index { Flex() { HomeTab({ currentPageIndex: $currentPageIndex }) .width(Adaptive.HomeTabWidth(this.currentBreakpoint)) - .backgroundColor($r('app.color.background_color_grey_two')) + .backgroundColor('#F1F3F5') .padding({ - top: $r('app.float.home_tab_padding_top'), - bottom: $r('app.float.home_tab_padding_bottom'), - left: $r('app.float.home_tab_padding_left') + top: '180vp', + bottom: '180vp', + left: '22vp' }) - .visibility(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + .visibility(this.currentBreakpoint === 'lg' ? Visibility.Visible : Visibility.None) + // [Start nav_path_stack] Navigation(this.pageInfo) { if (this.currentPageIndex === 0) { Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) { @@ -82,20 +86,17 @@ export struct Index { currentConversationUserName: $currentConversationUserName, currentContactUserName: $currentContactUserName }) - .flexGrow(BaseConstants.FLEX_GROW_ONE) - .width(BaseConstants.FULL_WIDTH) + .flexGrow(1) + .width('100%') HomeTab({ currentPageIndex: $currentPageIndex }) .width(Adaptive.HomeTabWidth(this.currentBreakpoint)) .height(Adaptive.HomeTabHeight(this.currentBreakpoint)) - .visibility(this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + .visibility(this.currentBreakpoint !== 'lg' ? Visibility.Visible : Visibility.None) } .padding({ - bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 - && this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.tab_content_pb') : $r('app.float.zero') + bottom: deviceInfo.deviceType !== '2in1' && this.currentBreakpoint !== 'lg' ? '28vp' : '0vp' }) - .height(BaseConstants.FULL_HEIGHT) - + .height('100%') } else if (this.currentPageIndex === 1) { Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center }) { ContactsList({ @@ -103,46 +104,44 @@ export struct Index { currentConversationUserName: $currentConversationUserName, currentContactUserIcon: $currentContactUserIcon }) - .flexGrow(BaseConstants.FLEX_GROW_ONE) - .width(BaseConstants.FULL_WIDTH) + .flexGrow(1) + .width('100%') HomeTab({ currentPageIndex: $currentPageIndex }) .width(Adaptive.HomeTabWidth(this.currentBreakpoint)) .height(Adaptive.HomeTabHeight(this.currentBreakpoint)) - .visibility(this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + .visibility(this.currentBreakpoint !== 'lg' ? Visibility.Visible : Visibility.None) } - .height(BaseConstants.FULL_HEIGHT) + .height('100%') .padding({ - bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 - && this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? - $r('app.float.tab_content_pb') : $r('app.float.zero') + bottom: deviceInfo.deviceType !== '2in1' && this.currentBreakpoint !== 'lg' ? '28vp' : '0vp' }) } } + // [End nav_path_stack] .hideTitleBar(true) .hideToolBar(true) - .navBarWidth(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? HomeConstants.NAVIGATION_NAV_BAR_WIDTH_LG : - HomeConstants.NAVIGATION_NAV_BAR_WIDTH_MD) + .navBarWidth(this.currentBreakpoint === 'lg' ? '44.5%' : '50%') .navDestination(this.PageMap) - .mode(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_SM ? NavigationMode.Stack : NavigationMode.Split) - .width(BaseConstants.FULL_WIDTH) + .mode(this.currentBreakpoint === 'sm' ? NavigationMode.Stack : NavigationMode.Split) + .width('100%') } - .visibility(this.currentPageIndex === CurrentPage.HOME || this.currentPageIndex === CurrentPage.CONVERSATION ? - Visibility.Visible : Visibility.None) + .visibility(this.currentPageIndex === 0 || this.currentPageIndex === 1 ? Visibility.Visible : Visibility.None) + // [StartExclude navigation_diff_device] /** * SocialCircle page */ Flex({ direction: FlexDirection.Column }) { SocialCircle() - .flexGrow(BaseConstants.FLEX_GROW_ONE) + .flexGrow(1) HomeTab({ currentPageIndex: $currentPageIndex }) .width(Adaptive.HomeTabWidth(this.currentBreakpoint)) .height(Adaptive.HomeTabHeight(this.currentBreakpoint)) } - .width(BaseConstants.FULL_WIDTH) - .height(BaseConstants.FULL_HEIGHT) + .width('100%') + .height('100%') .visibility(this.currentPageIndex === CurrentPage.SOCIAL_CIRCLE && this.currentBreakpoint !== - BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + 'lg' ? Visibility.Visible : Visibility.None) .padding({ bottom: $r('app.float.tab_content_pb') }) @@ -160,28 +159,28 @@ export struct Index { SocialCircle() .width(BaseConstants.NINETY_WIDTH_PERCENT) } - .width(BaseConstants.FULL_WIDTH) + .width('100%') .visibility(this.currentPageIndex === CurrentPage.SOCIAL_CIRCLE && this.currentBreakpoint === - BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + 'lg' ? Visibility.Visible : Visibility.None) /** * Me page */ Flex({ direction: FlexDirection.Column }) { Column() - .flexGrow(BaseConstants.FLEX_GROW_ONE) + .flexGrow(1) HomeTab({ currentPageIndex: $currentPageIndex }) .width(Adaptive.HomeTabWidth(this.currentBreakpoint)) .height(Adaptive.HomeTabHeight(this.currentBreakpoint)) } - .width(BaseConstants.FULL_WIDTH) - .height(BaseConstants.FULL_HEIGHT) + .width('100%') + .height('100%') .visibility(this.currentPageIndex === CurrentPage.ME && this.currentBreakpoint !== - BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + 'lg' ? Visibility.Visible : Visibility.None) .padding({ - top: deviceInfo.deviceType === BaseConstants.DEVICE_2IN1 ? $r('app.float.zero') : $r('app.float.device_padding_top'), - bottom: deviceInfo.deviceType !== BaseConstants.DEVICE_2IN1 - && this.currentBreakpoint !== BreakpointConstants.BREAKPOINT_LG ? + top: deviceInfo.deviceType === '2in1' ? $r('app.float.zero') : $r('app.float.device_padding_top'), + bottom: deviceInfo.deviceType !== '2in1' + && this.currentBreakpoint !== 'lg' ? $r('app.float.tab_content_pb') : $r('app.float.zero') }) @@ -197,14 +196,18 @@ export struct Index { }) Column() .width(BaseConstants.NINETY_WIDTH_PERCENT) - .height(BaseConstants.FULL_HEIGHT) + .height('100%') } - .width(BaseConstants.FULL_WIDTH) + .width('100%') .visibility(this.currentPageIndex === CurrentPage.ME && this.currentBreakpoint === - BreakpointConstants.BREAKPOINT_LG ? Visibility.Visible : Visibility.None) + 'lg' ? Visibility.Visible : Visibility.None) + // [EndExclude navigation_diff_device] } - .height(BaseConstants.FULL_HEIGHT) - .width(BaseConstants.FULL_WIDTH) + // [StartExclude navigation_diff_device] + .height('100%') + .width('100%') .backgroundColor($r('app.color.background_color_grey_two')) + // [EndExclude navigation_diff_device] } + // [End navigation_diff_device] } \ No newline at end of file -- Gitee