diff --git a/entry/build-profile.json5 b/entry/build-profile.json5 index da325a1dd5dfba4ca8ecb810c869d95f63958d77..ab4a4e9823fff53de8ffe9e08fb52c97d6a6380b 100644 --- a/entry/build-profile.json5 +++ b/entry/build-profile.json5 @@ -8,7 +8,7 @@ "arkOptions": { "obfuscation": { "ruleOptions": { - "enable": false, + "enable": true, "files": [ "./obfuscation-rules.txt" ] diff --git a/entry/src/main/ets/common/constants/CommonConstants.ets b/entry/src/main/ets/common/constants/CommonConstants.ets index 0d3e63a5d189f943dcc1ddf3c310cd928c82c677..5139e84daab6e0e6dbeebdc79a6e216d1f966069 100644 --- a/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/entry/src/main/ets/common/constants/CommonConstants.ets @@ -27,11 +27,6 @@ export class CommonConstants { */ public static readonly SIXTY_OPACITY: number = 0.6; - /** - * Component opacity value: 0.8. - */ - public static readonly EIGHTY_OPACITY: number = 0.8; - /** * Font weight value: five. */ @@ -42,11 +37,6 @@ export class CommonConstants { */ public static readonly WATER_FLOW_LAYOUT_WEIGHT: number = 1; - /** - * Water flow layout columns template. - */ - public static readonly WATER_FLOW_COLUMNS_TEMPLATE: string = '1fr 1fr'; - /** * Width the percentage of the 100. */ @@ -72,11 +62,6 @@ export class CommonConstants { */ public static readonly DATASOURCE_MIN_COUNT: number = 5; - /** - * toolbar font weight - */ - public static readonly TOOLBAR_FONT_WEIGHT: number = 500; - /** * time out 500 */ @@ -87,11 +72,6 @@ export class CommonConstants { */ public static readonly TIME_OUT_TWO_THOUSANDS: number = 2000; - /** - * Invalid Index. - */ - public static readonly INVALID_INDEX: number = -1; - /** * show or hide top icon event */ @@ -103,7 +83,7 @@ export class CommonConstants { public static readonly EVENT_QUICK_TOP_FUNC: string = 'event_quick_top_func'; /** - * refresh waterflow first page data event + * refresh waterFlow first page data event */ public static readonly EVENT_REFRESH_WATERFLOW_DATA: string = 'event_refresh_waterflow_data'; @@ -117,149 +97,15 @@ export class CommonConstants { */ public static readonly EVENT_REMOVE_ITEM: string = 'event_remove_item'; - /** - * Index content width. - */ - public static readonly INDEX_CONTENT_WIDTH: string = '91.1%'; - - /** - * Index divider height. - */ - public static readonly DIVIDER_HEIGHT: number = 0.5; - - /** - * Index divider width. - */ - public static readonly DIVIDER_WIDTH: string = '93%'; - - /** - * Font width 80%. - */ - public static readonly EIGHTY_FONT_WIDTH: string = '80%'; - - /** - * Drawer divider width. - */ - public static readonly DIVIDER_DRAWER_WIDTH: string = '90%'; - - /** - * Card title height. - */ - public static readonly CARD_TITLE_HEIGHT: number = 20; - - /** - * Card text height. - */ - public static readonly CARD_TEXT_HEIGHT: number = 48; - - /** - * Index title height. - */ - public static readonly INDEX_TITLE_HEIGHT: number = 112; - /** * Flow height. */ public static readonly FLOW_HEIGHT: Length = 244; - /** - * Translate bottom. - */ - public static readonly TRANSLATE_BOTTOM: number = 40; - - /** - * Border radius index list. - */ - public static readonly BORDER_RADIUS_INDEX_LIST: number = 18; - - /** - * List content height. - */ - public static readonly LIST_CONTENT_HEIGHT: string = '110%'; - - /** - * Translate top. - */ - public static readonly TRANSLATE_TOP: number = -40; - - /** - * Arr. - */ - public static readonly ARR: number[] = [1, 2, 3, 4, 5, 6]; - - /** - * Goods arr. - */ - public static readonly GOODS_ARR: String[] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']; - - /** - * colors. - */ - public static readonly COLORS: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; - - /** - * Routes. - */ - public static readonly ROUTES: Route[] = [ - { - title: $r('app.string.scenario1'), - child: [ - { - text: $r('app.string.scenario_sections'), - to: 'SectionsHomePage' - } - ] - }, - { - title: $r('app.string.scenario2'), - child: [ - { - text: $r('app.string.scenario_sticky'), - to: 'StickyHomePage' - } - ] - }, - { - title: $r('app.string.scenario3'), - child: [ - { - text: $r('app.string.scenario_embed'), - to: 'NavPage' - } - ] - } - ]; - /** * Breakpoint sm. */ public static readonly BREAK_POINT_SM: string = 'sm'; - - /** - * Breakpoint md. - */ - public static readonly BREAK_POINT_MD: string = 'md'; - - /** - * Breakpoint lg. - */ - public static readonly BREAK_POINT_LG: string = 'lg'; -} - -/** - * Route type define. - */ -export interface Route { - title: string | Resource, - child: Array -} - -/** - * ChildRoute type define. - */ -export interface ChildRoute { - text: string | Resource, - to: string } /** @@ -277,36 +123,6 @@ export class NavPageStyle { public static readonly POSITION_INITIAL: number = 0; } -/** - * The style of ToolBarComponent. - */ -export class ToolBarStyle { - /** - * The bottom margin. - */ - public static readonly MARGIN_BOTTOM: number = 3; - - /** - * The size of image. - */ - public static readonly IMAGE_SIZE: number = 24; - - /** - * The weight of layout. - */ - public static readonly LAYOUT_WEIGHT: string = '30%'; - - /** - * The height of divider. - */ - public static readonly DIVIDER_HEIGHT: number = 0.5; - - /** - * The opacity of divider. - */ - public static readonly DIVIDER_OPACITY: number = 0.05; -} - export class BreakpointType { sm: T md: T diff --git a/entry/src/main/ets/model/HomeViewModel.ets b/entry/src/main/ets/model/HomeViewModel.ets index 4ac417492eeff31a181a76b347c173647ade094e..f956cf52cbee762b71facda8c0c7fb5102d9212f 100644 --- a/entry/src/main/ets/model/HomeViewModel.ets +++ b/entry/src/main/ets/model/HomeViewModel.ets @@ -15,19 +15,6 @@ import { FlowItemCardType, IProductItem } from './ProductItem'; -/** - * Home page classify title data. - */ -const classifyTitle: Resource[] = [ - $r('app.string.title_bar_homepage'), - $r('app.string.title_bar_phone'), - $r('app.string.title_bar_computer'), - $r('app.string.title_bar_foods'), - $r('app.string.title_bar_men_wear'), - $r('app.string.title_bar_fresh'), - $r('app.string.title_bar_furniture_kitchenware') -]; - /** * Home page swiper image data. */ @@ -388,4 +375,4 @@ const loadingMoreFlowData: IProductItem[] = [ } ]; -export { classifyTitle, swiperImage, waterFlowData, loadingMoreFlowData }; \ No newline at end of file +export { swiperImage, waterFlowData, loadingMoreFlowData }; \ No newline at end of file diff --git a/entry/src/main/ets/pages/NavPage.ets b/entry/src/main/ets/pages/NavPage.ets index 1f80b7d1632bedf98b620fd0d750c95199f30a9c..97d14a2546b80080326610f6937af7f2573960ae 100644 --- a/entry/src/main/ets/pages/NavPage.ets +++ b/entry/src/main/ets/pages/NavPage.ets @@ -32,8 +32,6 @@ function setNavStyle() { struct NavPage { @Provide('NavPathStack') pageInfos: NavPathStack = new NavPathStack(); @State toolBarConfigs: ToolBarData[] = []; // bottom navigation data. - @StorageProp('bottomRectHeight') bottomRectHeight: number = 0; - @StorageProp('topRectHeight') topRectHeight: number = 0; aboutToAppear() { this.toolBarConfigs = DataModel.TOOL_BAR; @@ -54,16 +52,4 @@ struct NavPage { .setNavStyle() .navDestination(this.PagesMap) } - - @Builder - HolderPage(text: Resource) { - Column() { - Text(text) - .fontSize($r('app.float.detail_font_size')) - .height(CommonConstants.FULL_HEIGHT) - .width(CommonConstants.FULL_WIDTH) - .textAlign(TextAlign.Center) - } - .justifyContent(FlexAlign.Center) - } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/SectionsHomePage.ets b/entry/src/main/ets/pages/SectionsHomePage.ets index 71f51364c9d3446ae13e4fe96de8cf11b66b73ff..5b4007e18d0f12fc19c0f6608a10bc9f87802f81 100644 --- a/entry/src/main/ets/pages/SectionsHomePage.ets +++ b/entry/src/main/ets/pages/SectionsHomePage.ets @@ -50,7 +50,6 @@ struct SectionsHomePage { name: $r('app.string.sticky_tab_user') } ] - @StorageProp('bottomRectHeight') bottomRectHeight: number = 0; @StorageProp('topRectHeight') topRectHeight: number = 0; @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; tabsController: TabsController = new TabsController(); @@ -95,7 +94,7 @@ struct SectionsHomePage { TabContent() { SectionsPage() }.tabBar(this.tabBuilder(item.index, item.name)) - }) + }, (item: tabArray) => JSON.stringify(item)) } .backgroundColor($r('sys.color.gray_01')) .barHeight(0) @@ -140,7 +139,7 @@ struct SectionsHomePage { Row() { ForEach(this.tabsArray, (item: tabArray) => { this.tabBuilder(item.index, item.name) - }) + }, (item: tabArray) => JSON.stringify(item)) } } .scrollable(ScrollDirection.Horizontal) diff --git a/entry/src/main/ets/view/FlowItemComponent.ets b/entry/src/main/ets/view/FlowItemComponent.ets index 52c1119fc259fdc22045e62c8deea2212699b9e1..457d2cb13ad446f4475fd5e2f798a6c6f7d923d2 100644 --- a/entry/src/main/ets/view/FlowItemComponent.ets +++ b/entry/src/main/ets/view/FlowItemComponent.ets @@ -159,39 +159,6 @@ export default struct FlowItemComponent { } } - @Builder - longPressMenuBuilder() { - Column() { - Button($r('app.string.no_interested_button_text')) - .width(CommonConstants.EIGHTY_FONT_WIDTH) - .height($r('app.float.flow_press_btn_height')) - .backgroundColor(Color.White) - .fontColor(Color.Black) - .onClick(() => { - getContext(this).eventHub.emit(CommonConstants.EVENT_REMOVE_ITEM, this.item.id); - this.hideMenu() - }) - Button($r('app.string.low_quality_button_text')) - .width(CommonConstants.EIGHTY_FONT_WIDTH) - .height($r('app.float.flow_press_btn_height')) - .backgroundColor(Color.White) - .fontColor(Color.Black) - Button($r('app.string.seen_button_text')) - .width(CommonConstants.EIGHTY_FONT_WIDTH) - .height($r('app.float.flow_press_btn_height')) - .backgroundColor(Color.White) - .fontColor(Color.Black) - } - .justifyContent(FlexAlign.SpaceEvenly) - .borderRadius($r('app.float.product_layout_radius')) - .backgroundColor($r('app.color.flow_press_foreground_color')) - .width(CommonConstants.FULL_WIDTH) - .height(this.flowHeight) - .onClick(() => { - this.hideMenu(); - }) - } - @Builder SwiperCardBuilder(item: ProductItem) { Swiper() { diff --git a/entry/src/main/ets/view/GoodsNavComponent.ets b/entry/src/main/ets/view/GoodsNavComponent.ets index 1859fcdd24d6303ed5f75d62ad403baa9d85a443..928a3072b23ff1578a1eb34a1cc10be2ef7e4f6e 100644 --- a/entry/src/main/ets/view/GoodsNavComponent.ets +++ b/entry/src/main/ets/view/GoodsNavComponent.ets @@ -21,12 +21,10 @@ import { CommonConstants } from '../common/constants/CommonConstants'; import { GoodsTabComponent } from './GoodsTabComponent'; const SCROLL_OFFSET_FULL: number = 120; -const BACKGROUND_HEIGHT: Length = 222; @Component export struct GoodsNavComponent { @State isRefreshing: boolean = false; - @State arr: String[] = CommonConstants.GOODS_ARR; @State bgOpacity: number = CommonConstants.FULL_OPACITY; @State deviceType: string = ''; private scroller: Scroller = new Scroller(); @@ -42,7 +40,6 @@ export struct GoodsNavComponent { build() { Stack({ alignContent: Alignment.Top }) { - // Column() { Refresh({ refreshing: $$this.isRefreshing }) { Scroll(this.scroller) { Column() { @@ -59,7 +56,7 @@ export struct GoodsNavComponent { .height(CommonConstants.FULL_HEIGHT) .scrollBar(BarState.Off) .scrollable(ScrollDirection.Vertical) - .onWillScroll((handler) => { + .onWillScroll(() => { let opacity = (SCROLL_OFFSET_FULL - this.scroller.currentOffset().yOffset) * 1.0 / SCROLL_OFFSET_FULL; if (opacity <= 0) { this.bgOpacity = 0; diff --git a/entry/src/main/ets/view/GoodsTabComponent.ets b/entry/src/main/ets/view/GoodsTabComponent.ets index b9cc12cb4463be7904eb440d3b53383f7ca5aff0..71eae263c7568234166876c9a03f8edadf76a6ed 100644 --- a/entry/src/main/ets/view/GoodsTabComponent.ets +++ b/entry/src/main/ets/view/GoodsTabComponent.ets @@ -27,7 +27,6 @@ import WaterFlowComponent from './WaterFlowComponent'; @Component export struct GoodsTabComponent { @State tabsIndex: number = 0; - @State isMask: boolean = true; @StorageProp('currentBreakpoint') curBp: string = CommonConstants.BREAK_POINT_SM; tabsController: TabsController = new TabsController(); tabDataSource: TabDataSource = new TabDataSource(); @@ -95,7 +94,7 @@ export struct GoodsTabComponent { List({ scroller: this.tabScroller }) { ForEach(TAB_DATA, (tabItem: TabDataModel, index: number) => { this.tabBuilder(index, tabItem.navData) - }) + }, (index: number) => JSON.stringify(index)) } .width(CommonConstants.FULL_WIDTH) .height(CommonConstants.FULL_HEIGHT) @@ -119,11 +118,11 @@ export struct GoodsTabComponent { .width(CommonConstants.FULL_WIDTH) Tabs({ controller: this.tabsController }) { - ForEach(TAB_DATA, (tabItem: TabDataModel, index) => { + ForEach(TAB_DATA, (tabItem: TabDataModel, index: number) => { TabContent() { WaterFlowComponent({ datasource: this.filterData(index) }) } - }) + },(index: number) => JSON.stringify(index)) } .barMode(BarMode.Scrollable) .barWidth(CommonConstants.FULL_WIDTH) diff --git a/entry/src/main/ets/view/SectionsWaterFlowComponent.ets b/entry/src/main/ets/view/SectionsWaterFlowComponent.ets index b44cdaed94979af0db2b8ade304bfad9b845d726..e53b7fb9b3a4855b97d98937fbbbf9c56658b65e 100644 --- a/entry/src/main/ets/view/SectionsWaterFlowComponent.ets +++ b/entry/src/main/ets/view/SectionsWaterFlowComponent.ets @@ -25,9 +25,6 @@ struct ReusableFlowItem { this.item = params.item; } - aboutToAppear() { - } - build() { Row() { Stack() { @@ -143,11 +140,11 @@ export struct SectionsPage { build() { Column({ space: 0 }) { WaterFlow({ scroller: this.scroller }) { - ForEach(new BreakpointType([0, 1], [0, 1, 2], [0, 1, 2, 3, 4]).GetValue(this.curBp), () => { + ForEach(new BreakpointType([0, 1], [0, 1, 2], [0, 1, 2, 3, 4]).GetValue(this.curBp), (index: number) => { FlowItem() .width('100%') .height(150) - }) + },(index: number) => JSON.stringify(index)) LazyForEach(this.dataSource, (item: number) => { FlowItem() { diff --git a/entry/src/main/ets/view/WaterFlowComponent.ets b/entry/src/main/ets/view/WaterFlowComponent.ets index 9a36f81814fc65d54eb9e0cb4b311503d30d2f2c..729b9270c9981068968b8d3e5852405746d462e9 100644 --- a/entry/src/main/ets/view/WaterFlowComponent.ets +++ b/entry/src/main/ets/view/WaterFlowComponent.ets @@ -46,13 +46,13 @@ export default struct WaterFlowComponent { build() { WaterFlow({ footer: (): void => this.itemProgressFoot(), scroller: this.scroller }) { - LazyForEach(this.datasource, (item: ProductItem, index) => { + LazyForEach(this.datasource, (item: ProductItem, index: number) => { FlowItem() { FlowItemComponent({ item: item }) }.onClick(() => { this.pageInfos.pushPathByName('Detail', item.id); }) - }, (item: ProductItem) => JSON.stringify(item)) + }, (item: string) => item) } .height(CommonConstants.FULL_HEIGHT) .friction(CommonConstants.WATER_FLOW_FRICTION)