diff --git a/LICENSE b/LICENSE index 338e5b0bc22082e0ffcc7121c2ed3897a3ddccb0..18795a48d6b12fcdc1aa7bac9a9cb99f83815267 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ - Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 9d83524c3f4d8cc67c20215dddcb476eeb51ee47..8c19b6eb0942e991868371b047c1e721b3d17f02 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 应用接续(浏览进度) +# 实现浏览进度接续 ### 介绍 @@ -11,101 +11,74 @@ | ![image](screenshots/index.png) | ![image](screenshots/longlist.png) | ![image](screenshots/video.png) | ![image](screenshots/web.png) | ### 使用说明: -前置安装: - -1. 第一步:点击Build->Build Hap(s)/APP(s)->Build Hap(s),构建三个模块的hap包。 -2. 第二步:点击 entry/longlist/video/web -> Edit Configurations 打开编辑页。 -3. 第三步:选择 Deploy Multi Hap 勾选 Deploy Multi Hap Packages 后勾选 longlist、video 和 web,点击 Apply 后运行项目。 本示例提供3个按钮触发使用不同场景的进度接续: -1. 长列表进度:点击该按钮完成进入长列表浏览页面,并可以完成进度接续。 -2. 媒体浏览进度接续:可以观看视频切换视频,并可以完成进度接续。 -3. Web页面浏览进度接续:可以查看web页面,并可以完成进度接续。 +1. 长列表进度:点击该按钮完成进入长列表浏览页面,点击对端接续图标,对端恢复页面到长列表页面并且浏览位置在源端离开的条目附近。 +2. 媒体浏览进度接续:可以观看视频切换视频,点击对端接续图标,对端恢复视频播放页面,并且从源端当前播放的位置开始播放。 +3. Web页面浏览进度接续:可以查看web页面,点击对端接续图标,对端恢复页面到web页面并且浏览位置在源端离开的条目附近。 ### 工程目录 ``` -├──entry/src/main/ets/ -│ ├──entryability -│ │ └──EntryAbility.ets // 程序入口类 -│ ├──entrybackupability -│ │ └──EntryBackupAbility.ets // 备份恢复类 -│ └──pages -│ └──Index.ets // 首页 -├──entry/src/main/resources // 应用资源目录 -├──features/longList/src/main/ets/ -│ ├──constants -│ │ ├──BreakpointConstants.ets // 断点相关常量 -│ │ ├──CommonConstants.ets // 一般常量 -│ │ └──HomeConstants.ets // 主页的常量 -│ ├──longlistability -│ │ └──LongListAbility.ets -│ ├──model -│ │ ├──FooterTabData.ets // 底部导航栏 -│ │ ├──FunctionEntryData.ets // 功能区 -│ │ ├──FunctionEntryListData.ets // 功能区数据列表 -│ │ ├──WaterFlowData.ets // 瀑布流数据 -│ │ ├──WaterFlowDescriptionData.ets // 瀑布流item底部描述信息 -│ │ ├──WaterFlowHeadData.ets // 瀑布流item媒体信息 -│ │ └──WaterFlowListData.ets // 瀑布流数据列表 -│ ├──pages -│ │ └──Index.ets // 滑动页面入口 -│ ├──utils -│ │ ├──BreakpointSystem.ets // 一多断点监听 -│ │ ├──BreakpointType.ets // 一多断点类型 -│ │ ├──Logger.ets // 日志 -│ │ └──NetworkUtil.ets // 网络请求 -│ └──view -│ ├──FunctionView.ets // 功能区页面 -│ ├──HomeContent.ets // 主页 -│ ├──IndexNavDestination.ets // 导航栏入口 -│ ├──NavigationBarView.ets // 导航栏页面 -│ ├──SearchBarView.ets // 搜索栏页面 -│ ├──WaterFlowDescriptionView.ets // 瀑布流item底部描述页面 -│ ├──WaterFlowImageView.ets // 瀑布流item图片描述页面 -│ ├──WaterFlowLivingView.ets // 瀑布流item直播描述页面 -│ ├──WaterFlowVideoView.ets // 瀑布流item视频描述页面 -│ └──WaterFlowView.ets // 瀑布流页面 -├──features/longList/src/main/resources // 资源类 -├──features/video/src/main/ets/ // 代码区 -│ ├──components -│ │ ├──ExitVideo.ets // 退出应用组件 -│ │ ├──SpeedDialog.ets // 播放倍速弹窗 -│ │ └──VideoOperate.ets // 视频操作组件 -│ ├──pages -│ │ └──Index.ets // 首页视频界面 -│ ├──utils -│ │ ├──GlobalContext.ets // 上下文工具类 -│ │ ├──Logger.ets // 日志帮助类 -│ │ ├──ResourceUtil.ets // 资源工具类 -│ │ └──TimeUtils.ets // 视频时间帮助类 -│ ├──videoability -│ │ └──VideoAbility.ets -│ └──videomanager -│ └──AvPlayManager.ets // 视频管理接口,统一封装了对外提供的功能接口 -├──features/video/src/main/resources // 应用资源目录 -├──features/web/src/main/ets // 代码区 -│ ├──common -│ │ ├──constants -│ │ │ └──CommonConstants.ets // 常量 -│ │ └──utils -│ │ └──Logger.ets // 日志打印 -│ ├──model -│ │ └──ProductModel.ets // 产品模型 -│ ├──pages -│ │ ├──IndexPage.ets // 首页页面 -│ │ └──OrderConfirmPage.ets // 订单确认页面 -│ └──webability -│ └──WebAbility.ets -└──features/web/src/main/resources // 资源文件夹 +├───ets +│ ├───constants +│ │ ├───BreakpointConstants.ets // 断点相关常量 +│ │ ├───CommonConstants.ets // 一般常量 +│ │ └───HomeConstants.ets // 主页的常量 +│ ├───entryability +│ │ └───EntryAbility.ets // 程序入口类 +│ ├───entrybackupability +│ │ └───EntryBackupAbility.ets // 备份恢复类 +│ ├───pages +│ │ └───Index.ets // 首页 +│ ├───utils +│ │ ├───BreakpointSystem.ets // 一多断点监听 +│ │ ├───BreakpointType.ets // 一多断点类型 +│ │ ├───GlobalContext.ets // 上下文工具类 +│ │ ├───NetworkUtil.ets // 网络请求 +│ │ ├───ResourceUtil.ets // 资源工具类 +│ │ └───TimeUtils.ets // 视频时间帮助类 +│ ├───view +│ │ ├───longlist +│ │ │ ├───FunctionView.ets // 功能区页面 +│ │ │ ├───HomeContent.ets // 主页 +│ │ │ ├───LongListPageComponent.ets // 列表页面 +│ │ │ ├───NavigationBarView.ets // 导航栏页面 +│ │ │ ├───SearchBarView.ets // 搜索栏页面 +│ │ │ ├───WaterFlowDescriptionView.ets // 瀑布流item底部描述页面 +│ │ │ ├───WaterFlowImageView.ets // 瀑布流item图片描述页面 +│ │ │ ├───WaterFlowLivingView.ets // 瀑布流item直播描述页面 +│ │ │ ├───WaterFlowVideoView.ets // 瀑布流item视频描述页面 +│ │ │ └───WaterFlowView.ets // 瀑布流页面 +│ │ ├───video +│ │ │ ├───ExitVideo.ets // 退出应用组件 +│ │ │ ├───SpeedDialog.ets // 播放倍速弹窗 +│ │ │ ├───VideoOperate.ets // 视频操作组件 +│ │ │ └───VideoPageComponent.ets // 视频页面 +│ │ └───web +│ │ └───WebPageComponent.ets // 网页显示页面 +│ └───viewmodel +│ ├───longlist +│ │ ├───FooterTabData.ets // 底部导航栏 +│ │ ├───FunctionEntryData.ets // 功能区 +│ │ ├───FunctionEntryListData.ets // 功能区数据列表 +│ │ ├───WaterFlowData.ets // 瀑布流数据 +│ │ ├───WaterFlowDescriptionData.ets // 瀑布流item底部描述信息 +│ │ ├───WaterFlowHeadData.ets // 瀑布流item媒体信息 +│ │ └───WaterFlowListData.ets // 瀑布流数据列表 +│ ├───video +│ │ └───AvPlayManager.ets // 视频管理接口,统一封装了对外提供的功能接口 +│ └───web +│ └───ProductModel.ets // 产品模型 +└───entry/src/main/resources // 应用资源目录 ``` ### 具体实现 1. 长列表是List嵌套WaterFlow组件,需要接续currentOffset。 -2. 媒体进度接续使用Avplayer实现,接续其集数和播放进度。 +2. 媒体进度接续使用AVplayer实现,接续其集数和播放进度。 3. Web进度使用js语句获取进度。 ### 相关权限 @@ -116,16 +89,16 @@ ### 约束与限制 -1.本示例仅支持标准系统上运行,支持设备:华为手机。 +1.本示例仅支持标准系统上运行,支持设备:华为手机、华为平板、华为电脑。 -2.HarmonyOS系统:HarmonyOS 5.0.0 Release及以上。 +2.HarmonyOS系统:HarmonyOS 5.0.5 Release及以上。 -3.DevEco Studio版本:DevEco Studio 5.0.0 Release及以上。 +3.DevEco Studio版本:DevEco Studio 5.0.5 Release及以上。 -4.HarmonyOS SDK版本:HarmonyOS 5.0.0 Release SDK及以上。 +4.HarmonyOS SDK版本:HarmonyOS 5.0.5 Release SDK及以上。 5.双端设备需要登录同一华为账号。 -6.双端设备需要打开Wi-Fi和蓝牙开关。条件允许时,建议双端设备接入同一个局域网,可提升数据传输的速度。 +6.双端设备建议打开Wi-Fi和蓝牙开关。条件允许时,建议双端设备接入同一个局域网,可提升数据传输的速度。 7.应用接续只能在同应用(UIAbility)之间触发,双端设备都需要有该应用。 \ No newline at end of file diff --git a/build-profile.json5 b/build-profile.json5 index c22fe515a0cca759389cb2f85ea84048b4e8880a..ac6267b0851a7098a8b72e2f519b4112c177d655 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -1,12 +1,11 @@ { "app": { - "signingConfigs": [ - ], + "signingConfigs": [], "products": [ { "name": "default", "signingConfig": "default", - "compatibleSdkVersion": "5.0.4(16)", + "compatibleSdkVersion": "5.0.5(17)", "runtimeOS": "HarmonyOS", "buildOption": { "strictMode": { @@ -37,42 +36,6 @@ ] } ] - }, - { - "name": "web", - "srcPath": "./features/web", - "targets": [ - { - "name": "default", - "applyToProducts": [ - "default" - ] - } - ] - }, - { - "name": "video", - "srcPath": "./features/video", - "targets": [ - { - "name": "default", - "applyToProducts": [ - "default" - ] - } - ] - }, - { - "name": "longList", - "srcPath": "./features/longList", - "targets": [ - { - "name": "default", - "applyToProducts": [ - "default" - ] - } - ] } ] } \ No newline at end of file diff --git a/features/longList/src/main/ets/constants/BreakpointConstants.ets b/entry/src/main/ets/constants/BreakpointConstants.ets similarity index 91% rename from features/longList/src/main/ets/constants/BreakpointConstants.ets rename to entry/src/main/ets/constants/BreakpointConstants.ets index a4b3c02e0ab81433b6af2e3b9ae63d46c1da3451..e94fa5ad7e1458cbce84086142a7ca54873c26ff 100644 --- a/features/longList/src/main/ets/constants/BreakpointConstants.ets +++ b/entry/src/main/ets/constants/BreakpointConstants.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -32,6 +32,11 @@ export class BreakpointConstants { */ public static readonly BREAKPOINT_LG: string = 'lg'; + /** + * Breakpoints representing the type of oversized equipment. + */ + public static readonly BREAKPOINT_XL: string = 'xl'; + /** * Breakpoint range sm */ @@ -115,7 +120,7 @@ export class BreakpointConstants { /** * Function margin right lg */ - public static readonly FUNCTION_MARGIN_RIGHT_LG: number = 134; + public static readonly FUNCTION_MARGIN_RIGHT_LG: number = 24; /** * Function margin left sm @@ -130,5 +135,5 @@ export class BreakpointConstants { /** * Function margin left lg */ - public static readonly FUNCTION_MARGIN_LEFT_LG: number = 134; + public static readonly FUNCTION_MARGIN_LEFT_LG: number = 24; } \ No newline at end of file diff --git a/features/longList/src/main/ets/constants/CommonConstants.ets b/entry/src/main/ets/constants/CommonConstants.ets similarity index 93% rename from features/longList/src/main/ets/constants/CommonConstants.ets rename to entry/src/main/ets/constants/CommonConstants.ets index c865911808d8389dbf234445e0d8a0974632a743..c3aaeb5bbe280ec6c94ad7bc3d092e627eb5b7b9 100644 --- a/features/longList/src/main/ets/constants/CommonConstants.ets +++ b/entry/src/main/ets/constants/CommonConstants.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -77,15 +77,25 @@ export class CommonConstants { public static readonly FUNCTION_FIRST_INDEX: number = 0; /** - * Function page one + * Function page one. */ public static readonly FUNCTION_SECOND_INDEX: number = 1; /** - * Function page one + * Function page one. */ public static readonly FUNCTION_FIRST_COUNT: number = 10; + /** + * Grid data count under md breakpoint. + */ + public static readonly FUNCTION_FIRST_COUNT_MD: number = 12; + + /** + * Grid data count under lg breakpoint. + */ + public static readonly FUNCTION_FIRST_COUNT_LG: number = 16; + /** * Function page one */ @@ -256,4 +266,9 @@ export class CommonConstants { * chinese language */ public static readonly CHINESE_LANGUAGE: string = 'zh'; + + /** + * Duration. + */ + static readonly TOAST_DURATION: number = 2000; } \ No newline at end of file diff --git a/features/longList/src/main/ets/constants/HomeConstants.ets b/entry/src/main/ets/constants/HomeConstants.ets similarity index 87% rename from features/longList/src/main/ets/constants/HomeConstants.ets rename to entry/src/main/ets/constants/HomeConstants.ets index 5d25809c0a888bc29533e79393c21dd4d4c006ff..47792f9f112fc74fc63e0eeba841ccaeb401cdc8 100644 --- a/features/longList/src/main/ets/constants/HomeConstants.ets +++ b/entry/src/main/ets/constants/HomeConstants.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -68,6 +68,16 @@ export class HomeConstants { */ public static readonly FUNCTION_COLUMN: string = '1fr 1fr 1fr 1fr 1fr'; + /** + * Columns template under md breakpoint. + */ + public static readonly FUNCTION_COLUMN_MD: string = '1fr 1fr 1fr 1fr 1fr 1fr'; + + /** + * Columns template under lg breakpoint. + */ + public static readonly FUNCTION_COLUMN_LG: string = '1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr'; + /** * index page. */ diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 3afb1a4200f749101d06d43e832cc4c662bc49c3..12d903e58318099773f530385bc1867592274ec4 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,45 +12,204 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; -import { window } from '@kit.ArkUI'; +import { UIContext, window } from '@kit.ArkUI'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { GlobalContext } from '../utils/GlobalContext'; +import { BreakpointConstants } from '../constants/BreakpointConstants'; + +const DOMAIN = 0x0000; export default class EntryAbility extends UIAbility { + private mainWindowClass?: window.Window; + private uiContext?: UIContext; + + // [Start on_create] onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { + GlobalContext.getContext().setObject('abilityWant', want); + GlobalContext.getContext().setObject('context', this.context) + if (want.parameters) { + if (want.parameters.currentTime) { + GlobalContext.getContext().setObject('currentTime', want.parameters.currentTime); + } + } + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); + if (launchParam.launchReason === AbilityConstant.LaunchReason.CONTINUATION) { + if (want.parameters) { + this.continueRestore(want); + } + } + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate'); + } + // [End on_create] + + onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { + GlobalContext.getContext().setObject('abilityWant', want); + GlobalContext.getContext().setObject('context', this.context) + if (want.parameters) { + if (want.parameters.currentTime) { + GlobalContext.getContext().setObject('currentTime', want.parameters.currentTime); + } + } this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + if (launchParam.launchReason === AbilityConstant.LaunchReason.CONTINUATION) { + if (want.parameters) { + this.continueRestore(want); + } + } + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onNewWant'); } + // [Start continue_restore] + continueRestore(want: Want) { + if (!want.parameters) { + hilog.error(0x0000, 'EntryAbility', 'missing sessionId'); + return; + } + let currentPage = want.parameters.currentPage as string; + AppStorage.setOrCreate('currentPage', currentPage); + want.parameters.continueIndex && AppStorage.setOrCreate('continueWaterOffset', want.parameters.continueIndex); + want.parameters.currentOffset && AppStorage.setOrCreate('continueOffset', want.parameters.currentOffset); + want.parameters.continueHeight && AppStorage.setOrCreate('continueHeight', want.parameters.continueHeight); + AppStorage.setOrCreate('continueEntry', true); + AppStorage.setOrCreate('setCurrentOffset', true); + want.parameters.continueTime && AppStorage.setOrCreate('currentTime', want.parameters.continueTime); + want.parameters.continueItem && AppStorage.setOrCreate('videoIndex', want.parameters.continueItem); + want.parameters.continueItem && AppStorage.setOrCreate('videoSelect', want.parameters.continueItem); + want.parameters.flag && AppStorage.setOrCreate('flag', want.parameters.flag); + AppStorage.setOrCreate('continue', true); + AppStorage.setOrCreate('continueRestore', true); + want.parameters.pageUrl && AppStorage.setOrCreate('pageUrl', want.parameters.pageUrl); + want.parameters.scrollDistance && AppStorage.setOrCreate('scrollDistance', want.parameters.scrollDistance); + want.parameters.breakpoint && AppStorage.setOrCreate('continueBreakpoint', want.parameters.breakpoint); + + this.context.restoreWindowStage(new LocalStorage()); + } + // [End continue_restore] + + // [Start on_continue] + async onContinue(wantParam: Record): Promise { + // 1.1 Retrieve the data to be connected and transmit it via wantParam. + let continueIndex = AppStorage.get('continueIndex') as number; + wantParam.continueIndex = continueIndex; + let currentOffset = AppStorage.get('currentOffset') as number; + wantParam.currentOffset = currentOffset; + let continueHeight = AppStorage.get('listItemHeight') as number; + wantParam.continueHeight = continueHeight; + let currentTime = AppStorage.get('currentTime') as number; + wantParam.continueTime = currentTime; + let videoIndex = AppStorage.get('videoIndex') as number; + wantParam.continueItem = videoIndex; + let flag = AppStorage.get('flag') as boolean; + wantParam.flag = flag; + let url = AppStorage.get('pageUrl') as string; + wantParam.pageUrl = url; + let distance = AppStorage.get('scrollDistance') as number; + wantParam.scrollDistance = distance; + let breakpoint = AppStorage.get(BreakpointConstants.BREAKPOINT_NAME) as string; + wantParam.breakpoint = breakpoint; + let pageInfos = AppStorage.get('pageInfos') as NavPathStack; + let pageArr = pageInfos.getAllPathName(); + let currentPage = ''; + if (pageArr.length > 0) { + currentPage = pageArr[pageArr.length - 1]; + } + AppStorage.setOrCreate('continue', false); + wantParam.currentPage = currentPage; + + return AbilityConstant.OnContinueResult.AGREE; + } + // [End on_continue] + onDestroy(): void { - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy'); } onWindowStageCreate(windowStage: window.WindowStage): void { - // Main window is created, set main page for this ability - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + // Main window is created, set main page for this ability. + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); windowStage.loadContent('pages/Index', (err) => { if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); return; } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.'); + windowStage.getMainWindow().then((data: window.Window) => { + this.mainWindowClass = data; + this.updateWidthBp(); + this.uiContext = data.getUIContext(); + data.on('windowSizeChange', this.onWindowSizeChange); + }).catch((err: BusinessError) => { + hilog.error(0x0000, 'WebAbility', `Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`); + }); + hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.'); }); } + onWindowStageRestore(windowStage: window.WindowStage): void { + // Main window is created, set main page for this ability. + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageRestore'); + + windowStage.loadContent('pages/Index', (err) => { + if (err.code) { + hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err)); + return; + } + windowStage.getMainWindow().then((data: window.Window) => { + this.mainWindowClass = data; + this.updateWidthBp(); + this.uiContext = data.getUIContext(); + data.on('windowSizeChange', this.onWindowSizeChange); + }).catch((err: BusinessError) => { + hilog.error(0x0000, 'WebAbility', `Failed to obtain the main window. Cause code: ${err.code}, message: ${err.message}`); + }); + hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.'); + }); + } + + private onWindowSizeChange: (windowSize: window.Size) => void = (windowSize: window.Size) => { + this.updateWidthBp(); + }; + + updateWidthBp(): void { + if (!this.uiContext) { + return + } + let mainWindow: window.WindowProperties = this.mainWindowClass!.getWindowProperties(); + let windowWidth: number = mainWindow.windowRect.width; + let windowWidthVp = this.uiContext.px2vp(windowWidth); + let widthBp: string = ''; + if (windowWidthVp < 320) { + widthBp = 'xs'; + } else if (windowWidthVp >= 320 && windowWidthVp < 600) { + widthBp = 'sm'; + } else if (windowWidthVp >= 600 && windowWidthVp < 840) { + widthBp = 'md'; + } else if (windowWidthVp >= 840 && windowWidthVp < 1440) { + widthBp = 'lg'; + } else { + widthBp = 'xl'; + } + AppStorage.setOrCreate(BreakpointConstants.BREAKPOINT_NAME, widthBp); + AppStorage.setOrCreate('windowWidth', windowWidth); + let windowHeight: number = mainWindow.windowRect.height; + AppStorage.setOrCreate('windowHeight', windowHeight); + } + onWindowStageDestroy(): void { - // Main window is destroyed, release UI related resources - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + // Main window is destroyed, release UI related resources. + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); } onForeground(): void { - // Ability has brought to foreground - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + // Ability has brought to foreground. + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); } onBackground(): void { - // Ability has back to background - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + // Ability has back to background. + hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground'); } } \ No newline at end of file diff --git a/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets index be794f48ccffc46278e76ce3493088a647b0d470..0a97e21bd7a15599af76a806695860ff1eb0ebfe 100644 --- a/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +++ b/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,15 +12,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { hilog } from '@kit.PerformanceAnalysisKit'; import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit'; +const DOMAIN = 0x0000; + export default class EntryBackupAbility extends BackupExtensionAbility { async onBackup() { - hilog.info(0x0000, 'testTag', 'onBackup ok'); + hilog.info(DOMAIN, 'testTag', 'onBackup ok'); + await Promise.resolve(); } async onRestore(bundleVersion: BundleVersion) { - hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); + hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion)); + await Promise.resolve(); } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index f2b9a711f6fddde64e392fb335cdf11a1db9b1ec..5b84e69d75d162c7580312ff05afd4d959d31f12 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,76 +12,128 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { common, Want } from '@kit.AbilityKit'; + +import { window } from '@kit.ArkUI'; +import { EnvironmentCallback } from '@kit.AbilityKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; +import { i18n } from '@kit.LocalizationKit'; +import { BreakpointConstants } from '../constants/BreakpointConstants'; +import { CommonConstants } from '../constants/CommonConstants'; @Entry @Component struct Index { - private context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; + @StorageLink('pageInfos') pageInfos: NavPathStack = new NavPathStack(); + @StorageLink(BreakpointConstants.BREAKPOINT_NAME) currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @StorageLink(CommonConstants.LANGUAGE) language: string = CommonConstants.CHINESE_LANGUAGE; + @StorageLink('continueEntry') continueEntry: boolean = false; + @StorageLink('topHeight') topHeight: number = 0; + @StorageLink('bottomHeight') bottomHeight: number = 0; + @StorageLink('currentPage') currentPage: string = ''; - build() { - Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween }) { - Text($r('app.string.title')) - .fontSize(30) - .textAlign(TextAlign.Start) - .width('100%') - .fontWeight(FontWeight.Bold) - .padding({ - top: 56, - left: 16, - right: 16 - }) + aboutToAppear(): void { + window.getLastWindow(this.getUIContext().getHostContext()).then(win => { + win.setWindowLayoutFullScreen(true); + let area = win.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); + let height = area.topRect.height; + let vpHeight = this.getUIContext().px2vp(height); + AppStorage.setOrCreate('topHeight', vpHeight); + let bottomArea = win.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); + let bottomHeight = bottomArea.bottomRect.height; + let vpBottomHeight = this.getUIContext().px2vp(bottomHeight); + AppStorage.setOrCreate('bottomHeight', vpBottomHeight); + }); + let envCallback: EnvironmentCallback = { + onConfigurationUpdated(config) { + AppStorage.set(CommonConstants.LANGUAGE, config.language); + }, + onMemoryLevel(level) {} + }; + try { + let applicationContext = this.getUIContext().getHostContext()?.getApplicationContext(); + applicationContext && applicationContext.on('environment', envCallback); + } catch (paramError) { + hilog.error(0x000, 'progress', `error: ${JSON.stringify(paramError)}`); + } + } - Column() { - Button($r('app.string.button1')) - .width('100%') - .margin({ top: 12 }) - .onClick(async () => { - let want: Want = { - deviceId: '', - bundleName: 'com.example.continueprogress', - abilityName: 'LongListAbility', - } - this.context.startAbility(want); - }) + onPageShow(): void { + try { + let systemLanguage: string = i18n.System.getSystemLanguage(); + let local = new Intl.Locale(systemLanguage); + this.language = local.language; + } catch (err) { + hilog.error(0x000, 'progress', `call System.getSystemLanguage() failed`); + } + if (this.currentPage !== '') { + let pageArr = this.pageInfos.getAllPathName(); + if (pageArr.length === 0) { + this.pageInfos.pushPathByName(this.currentPage, null, true); + } else if (pageArr[pageArr.length - 1] !== this.currentPage) { + this.pageInfos.replacePathByName(this.currentPage, null, true); + } + this.currentPage = ''; + } + } - Button($r('app.string.button2')) + build() { + Navigation(this.pageInfos) { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween }) { + Text($r('app.string.title')) + .fontSize(30) + .textAlign(TextAlign.Start) .width('100%') - .margin({ top: 12 }) - .onClick(async () => { - let want: Want = { - deviceId: '', - bundleName: 'com.example.continueprogress', - abilityName: 'VideoAbility', - } - this.context.startAbility(want); + .fontWeight(FontWeight.Bold) + .padding({ + top: 56 }) - Button($r('app.string.button3')) - .width('100%') - .margin({ - top: 12, - bottom: 16 - }) - .onClick(async () => { - let want: Want = { - deviceId: '', - bundleName: 'com.example.continueprogress', - abilityName: 'WebAbility', - } - this.context.startAbility(want); - }) + Column({ space: 12 }) { + Button($r('app.string.button1')) + .width('100%') + .constraintSize({ + maxWidth: 448 + }) + .onClick(async () => { + this.pageInfos.pushPathByName('LongListPage', null, true); + }) + + Button($r('app.string.button2')) + .width('100%') + .constraintSize({ + maxWidth: 448 + }) + .onClick(async () => { + this.pageInfos.pushPathByName('VideoPage', null, true); + }) + Button($r('app.string.button3')) + .width('100%') + .constraintSize({ + maxWidth: 448 + }) + .onClick(async () => { + this.pageInfos.pushPathByName('WebPageComponent', null, true); + }) + + } + .width('100%') + .alignSelf(ItemAlign.End) + .padding({ + bottom: 16 + }) } .width('100%') + .height('100%') .padding({ - left: 16, - right: 16 + left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? 32 : 24, + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? 32 : 24, + top: this.topHeight, + bottom: this.bottomHeight }) - .alignSelf(ItemAlign.End) } - .width('100%') - .height('100%') - + .hideTitleBar(true) + .mode(NavigationMode.Stack) + .backgroundColor($r('sys.color.container_modal_unfocus_background')) } } \ No newline at end of file diff --git a/features/longList/src/main/ets/utils/BreakpointSystem.ets b/entry/src/main/ets/utils/BreakpointSystem.ets similarity index 39% rename from features/longList/src/main/ets/utils/BreakpointSystem.ets rename to entry/src/main/ets/utils/BreakpointSystem.ets index 310e44405a30c374f8479564b76190c031043e75..76d100690c09db9d99821965575373bf5571e841 100644 --- a/features/longList/src/main/ets/utils/BreakpointSystem.ets +++ b/entry/src/main/ets/utils/BreakpointSystem.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,13 +13,13 @@ * limitations under the License. */ -import mediaQuery from '@ohos.mediaquery'; import { BreakpointConstants } from '../constants/BreakpointConstants'; declare interface BreakPointTypeOption { sm?: T, md?: T, lg?: T, + xl?: T } export class BreakpointType { @@ -41,61 +41,17 @@ export class BreakpointType { case BreakpointConstants.BREAKPOINT_LG: point = this.options.lg as T; break; + case BreakpointConstants.BREAKPOINT_XL: + if (this.options.xl) { + point = this.options.xl as T; + } else { + point = this.options.lg as T; + } + break; default: point = this.options.sm as T; break; } return point; } -} - -export class BreakpointSystem { - private readonly listenerKey = 'change'; - private currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; - private smListener: mediaQuery.MediaQueryListener; - private mdListener: mediaQuery.MediaQueryListener; - private lgListener: mediaQuery.MediaQueryListener; - - constructor(context: UIContext) { - this.smListener = context.getMediaQuery().matchMediaSync(BreakpointConstants.RANGE_SM); - this.mdListener = context.getMediaQuery().matchMediaSync(BreakpointConstants.RANGE_MD); - this.lgListener = context.getMediaQuery().matchMediaSync(BreakpointConstants.RANGE_LG); - } - - private updateCurrentBreakpoint(breakpoint: string): void { - if (this.currentBreakpoint !== breakpoint) { - this.currentBreakpoint = breakpoint; - AppStorage.setOrCreate(BreakpointConstants.BREAKPOINT_NAME, this.currentBreakpoint); - } - } - - private isBreakpointSM = (mediaQueryResult: mediaQuery.MediaQueryResult): void => { - if (mediaQueryResult.matches) { - this.updateCurrentBreakpoint(BreakpointConstants.BREAKPOINT_SM); - } - }; - - private isBreakpointMD = (mediaQueryResult: mediaQuery.MediaQueryResult): void => { - if (mediaQueryResult.matches) { - this.updateCurrentBreakpoint(BreakpointConstants.BREAKPOINT_MD); - } - }; - - private isBreakpointLG = (mediaQueryResult: mediaQuery.MediaQueryResult): void => { - if (mediaQueryResult.matches) { - this.updateCurrentBreakpoint(BreakpointConstants.BREAKPOINT_LG); - } - }; - - public register(): void { - this.smListener.on(this.listenerKey, this.isBreakpointSM); - this.mdListener.on(this.listenerKey, this.isBreakpointMD); - this.lgListener.on(this.listenerKey, this.isBreakpointLG); - } - - public unregister(): void { - this.smListener.off(this.listenerKey, this.isBreakpointSM); - this.mdListener.off(this.listenerKey, this.isBreakpointMD); - this.lgListener.off(this.listenerKey, this.isBreakpointLG); - } } \ No newline at end of file diff --git a/features/longList/src/main/ets/utils/BreakpointType.ets b/entry/src/main/ets/utils/BreakpointType.ets similarity index 95% rename from features/longList/src/main/ets/utils/BreakpointType.ets rename to entry/src/main/ets/utils/BreakpointType.ets index e5082132676e8825a6db51225a643f70ea890356..87d06f53121beabcbe9247e203d6a2dd72e343b4 100644 --- a/features/longList/src/main/ets/utils/BreakpointType.ets +++ b/entry/src/main/ets/utils/BreakpointType.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/features/video/src/main/ets/utils/GlobalContext.ets b/entry/src/main/ets/utils/GlobalContext.ets similarity index 95% rename from features/video/src/main/ets/utils/GlobalContext.ets rename to entry/src/main/ets/utils/GlobalContext.ets index 63ac2c38e5a8017dc554bafcbf4c4a962f002251..25c89cfa8f5a6549dd87111952305a7120e4855c 100644 --- a/features/video/src/main/ets/utils/GlobalContext.ets +++ b/entry/src/main/ets/utils/GlobalContext.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/features/longList/src/main/ets/utils/NetworkUtil.ets b/entry/src/main/ets/utils/NetworkUtil.ets similarity index 83% rename from features/longList/src/main/ets/utils/NetworkUtil.ets rename to entry/src/main/ets/utils/NetworkUtil.ets index 789c9f65f54cb74c2ed724e320710aa159b46d5d..d0c6e648374a9009269c34d83aec4c27497627cb 100644 --- a/features/longList/src/main/ets/utils/NetworkUtil.ets +++ b/entry/src/main/ets/utils/NetworkUtil.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,12 +15,12 @@ import { http } from '@kit.NetworkKit'; import { systemDateTime } from '@kit.BasicServicesKit'; -import { FunctionEntryData } from '../model/FunctionEntryData'; -import { WaterFlowData } from '../model/WaterFlowData'; -import Logger from './Logger'; -import { WaterFlowHeadData } from '../model/WaterFlowHeadData'; -import { WaterFlowDescriptionData } from '../model/WaterFlowDescriptionData'; +import { FunctionEntryData } from '../viewmodel/longlist/FunctionEntryData'; +import { WaterFlowData } from '../viewmodel/longlist/WaterFlowData'; +import { WaterFlowHeadData } from '../viewmodel/longlist/WaterFlowHeadData'; +import { WaterFlowDescriptionData } from '../viewmodel/longlist/WaterFlowDescriptionData'; import { CommonConstants } from '../constants/CommonConstants'; +import { hilog } from '@kit.PerformanceAnalysisKit'; const URL: string = 'https://devecostudio-drcn.op.hicloud.com/solution/v1/getSceneMockData' + '?scene={scene}&fileName={fileName}&pageNum={pageNum}&pageSize={pageSize}'; @@ -47,7 +47,7 @@ export class NetworkUtil { usingCache: true, }); const endTime = systemDateTime.getTime() - beginTime; - Logger.info('getResponse success, url:' + url + ', cost: ' + endTime); + hilog.info(0x000, 'progress', 'getResponse success, url:' + url + ', cost: ' + endTime); if (data && data.responseCode === http.ResponseCode.OK && typeof data.result === 'string') { let arr: Record = JSON.parse(data.result); return arr; @@ -55,7 +55,7 @@ export class NetworkUtil { return null; } } catch (err) { - Logger.error('getResponse err:', JSON.stringify(err)); + hilog.error(0x000, 'progress', 'getResponse err:', JSON.stringify(err)); return null; } } @@ -78,7 +78,7 @@ export class NetworkUtil { return result; } } catch (err) { - Logger.error('getFunctionEntryData err:', JSON.stringify(err)); + hilog.error(0x000, 'progress', 'getFunctionEntryData err:', JSON.stringify(err)); } return result; } @@ -106,7 +106,7 @@ export class NetworkUtil { return result; } } catch (err) { - Logger.error('getWaterFlowData err: ', JSON.stringify(err)); + hilog.error(0x000, 'progress', 'getWaterFlowData err: ', JSON.stringify(err)); } return result; } diff --git a/features/video/src/main/ets/utils/ResourceUtil.ets b/entry/src/main/ets/utils/ResourceUtil.ets similarity index 95% rename from features/video/src/main/ets/utils/ResourceUtil.ets rename to entry/src/main/ets/utils/ResourceUtil.ets index b84f7b34f769cde67e813c91035335500e00fa0d..5b797ecd497264bda39612cf9107d74674a5392b 100644 --- a/features/video/src/main/ets/utils/ResourceUtil.ets +++ b/entry/src/main/ets/utils/ResourceUtil.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/features/video/src/main/ets/utils/TimeUtils.ets b/entry/src/main/ets/utils/TimeUtils.ets similarity index 95% rename from features/video/src/main/ets/utils/TimeUtils.ets rename to entry/src/main/ets/utils/TimeUtils.ets index ce11beaca551af32daa5cf9970fbf4c8abce3cf8..6fa62b945725b47159e7d2e3c194314757b557ab 100644 --- a/features/video/src/main/ets/utils/TimeUtils.ets +++ b/entry/src/main/ets/utils/TimeUtils.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/features/longList/src/main/ets/view/FunctionView.ets b/entry/src/main/ets/view/longlist/FunctionView.ets similarity index 55% rename from features/longList/src/main/ets/view/FunctionView.ets rename to entry/src/main/ets/view/longlist/FunctionView.ets index 055510baa182a85c975bec8ba09cde7dba22e5a7..055a27bdd1d965532f4bbb6240c6330cc94b3721 100644 --- a/features/longList/src/main/ets/view/FunctionView.ets +++ b/entry/src/main/ets/view/longlist/FunctionView.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,16 +13,17 @@ * limitations under the License. */ -import { BreakpointConstants } from '../constants/BreakpointConstants'; -import { BreakpointType } from '../utils/BreakpointSystem'; -import { FunctionEntryListData } from '../model/FunctionEntryListData'; -import { FunctionEntryData } from '../model/FunctionEntryData'; -import { HomeConstants } from '../constants/HomeConstants'; -import { CommonConstants } from '../constants/CommonConstants'; +import { BreakpointConstants } from '../../constants/BreakpointConstants'; +import { BreakpointType } from '../../utils/BreakpointSystem'; +import { FunctionEntryListData } from '../../viewmodel/longlist/FunctionEntryListData'; +import { FunctionEntryData } from '../../viewmodel/longlist/FunctionEntryData'; +import { HomeConstants } from '../../constants/HomeConstants'; +import { CommonConstants } from '../../constants/CommonConstants'; @Component export struct FunctionView { - @StorageLink(BreakpointConstants.BREAKPOINT_NAME) currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; + @StorageLink(BreakpointConstants.BREAKPOINT_NAME) @Watch('getData') currentBreakpoint: string = + BreakpointConstants.BREAKPOINT_LG; @StorageLink(CommonConstants.LANGUAGE) language:string = CommonConstants.CHINESE_LANGUAGE; @Watch('aboutToAppear') @Link freshFlag: boolean; @State functionEntryListData: FunctionEntryListData = new FunctionEntryListData(); @@ -33,12 +34,25 @@ export struct FunctionView { @State currentIndex: number = CommonConstants.FUNCTION_FIRST_INDEX; @State gridHeight: number = HomeConstants.FUNCTION_TWO_LINES_HEIGHT; - async aboutToAppear(): Promise { + aboutToAppear(): void { + this.getData() + } + + async getData(): Promise { let arr: FunctionEntryData[] = await this.functionEntryListData.getData(); this.functionEntryData = arr; - this.functionEntryFirstData = arr.slice(CommonConstants.NUMBER_DEFAULT_VALUE, CommonConstants.FUNCTION_FIRST_COUNT); - this.functionEntrySecondData = arr.slice(CommonConstants.FUNCTION_FIRST_COUNT, - CommonConstants.FUNCTION_FIRST_COUNT + CommonConstants.FUNCTION_SECOND_COUNT); + this.functionEntryFirstData = arr.slice(CommonConstants.NUMBER_DEFAULT_VALUE, new BreakpointType({ + sm: CommonConstants.FUNCTION_FIRST_COUNT, + md: CommonConstants.FUNCTION_FIRST_COUNT_MD, + lg: CommonConstants.FUNCTION_FIRST_COUNT_LG, + xl: CommonConstants.FUNCTION_FIRST_COUNT_LG + }).getValue(this.currentBreakpoint)); + this.functionEntrySecondData = arr.slice(new BreakpointType({ + sm: CommonConstants.FUNCTION_FIRST_COUNT, + md: CommonConstants.FUNCTION_FIRST_COUNT_MD, + lg: CommonConstants.FUNCTION_FIRST_COUNT_LG, + xl: CommonConstants.FUNCTION_FIRST_COUNT_LG + }).getValue(this.currentBreakpoint)); } build() { @@ -47,27 +61,63 @@ export struct FunctionView { if (this.functionEntryData.length === CommonConstants.NUMBER_DEFAULT_VALUE) { this.DefaultGrid(); } else { - this.FunctionGrid(this.functionEntryFirstData); + ForEach(this.functionEntryFirstData, (item: FunctionEntryData) => { + GridItem() { + Column() { + Image(item.icon) + .height($r('app.float.function_gridItem_image_height')) + .width($r('app.float.function_gridItem_image_width')) + .borderRadius($r('app.float.function_gridItem_border_radius')) + Text(this.language.includes(CommonConstants.CHINESE_LANGUAGE) ? item.name : item.nameEn) + .fontSize($r('app.float.category_text_font')) + .lineHeight($r('app.float.function_gridItem_text_line_height')) + .margin({ top: $r('app.float.function_gridItem_text_margin_top') }); + }; + } + .width($r('app.float.function_gridItem_width')) + .height($r('app.float.function_gridItem_height')); + }, (item: FunctionEntryData): string => item.index.toString()) } } .rowsGap($r('app.float.function_row_gap')) .padding({ bottom: $r('app.float.function_padding_bottom') }) - .height(this.gridHeight) - .rowsTemplate(HomeConstants.FUNCTION_ROWS_PAGE_ONE) - .columnsTemplate(HomeConstants.FUNCTION_COLUMN); + .columnsTemplate(new BreakpointType({ + sm: HomeConstants.FUNCTION_COLUMN, + md: HomeConstants.FUNCTION_COLUMN_MD, + lg: HomeConstants.FUNCTION_COLUMN_LG, + xl: HomeConstants.FUNCTION_COLUMN_LG + }).getValue(this.currentBreakpoint)); Grid() { if (this.functionEntryData.length === CommonConstants.NUMBER_DEFAULT_VALUE) { this.DefaultGrid(); } else { - this.FunctionGrid(this.functionEntrySecondData); + ForEach(this.functionEntrySecondData, (item: FunctionEntryData) => { + GridItem() { + Column() { + Image(item.icon) + .height($r('app.float.function_gridItem_image_height')) + .width($r('app.float.function_gridItem_image_width')) + .borderRadius($r('app.float.function_gridItem_border_radius')); + Text(this.language.includes(CommonConstants.CHINESE_LANGUAGE) ? item.name : item.nameEn) + .fontSize($r('app.float.category_text_font')) + .lineHeight($r('app.float.function_gridItem_text_line_height')) + .margin({ top: $r('app.float.function_gridItem_text_margin_top') }); + }; + } + .width($r('app.float.function_gridItem_width')) + .height($r('app.float.function_gridItem_height')); + }, (item: FunctionEntryData): string => item.index.toString()) } } .rowsGap($r('app.float.function_row_gap')) .padding({ bottom: $r('app.float.function_padding_bottom') }) - .height(this.gridHeight) - .rowsTemplate(HomeConstants.FUNCTION_ROWS_PAGE_TWO) - .columnsTemplate(HomeConstants.FUNCTION_COLUMN); + .columnsTemplate(new BreakpointType({ + sm: HomeConstants.FUNCTION_COLUMN, + md: HomeConstants.FUNCTION_COLUMN_MD, + lg: HomeConstants.FUNCTION_COLUMN_LG, + xl: HomeConstants.FUNCTION_COLUMN_LG + }).getValue(this.currentBreakpoint)) } .onChange((index: number) => { this.currentIndex = index; @@ -87,14 +137,16 @@ export struct FunctionView { left: new BreakpointType({ sm: BreakpointConstants.FUNCTION_MARGIN_LEFT_SM, md: BreakpointConstants.FUNCTION_MARGIN_LEFT_MD, - lg: BreakpointConstants.FUNCTION_MARGIN_LEFT_LG + lg: BreakpointConstants.FUNCTION_MARGIN_LEFT_LG, + xl: BreakpointConstants.FUNCTION_MARGIN_LEFT_LG }).getValue(this.currentBreakpoint), right: new BreakpointType({ sm: BreakpointConstants.FUNCTION_MARGIN_RIGHT_SM, md: BreakpointConstants.FUNCTION_MARGIN_RIGHT_MD, - lg: BreakpointConstants.FUNCTION_MARGIN_RIGHT_LG + lg: BreakpointConstants.FUNCTION_MARGIN_RIGHT_LG, + xl: BreakpointConstants.FUNCTION_MARGIN_RIGHT_LG }).getValue(this.currentBreakpoint) - }); + }) } @Builder @@ -132,7 +184,7 @@ export struct FunctionView { .height($r('app.float.function_gridItem_image_height')) .width($r('app.float.function_gridItem_image_width')) .borderRadius($r('app.float.function_gridItem_border_radius')); - Text(this.language === CommonConstants.CHINESE_LANGUAGE ? item.name : item.nameEn) + Text(this.language.includes(CommonConstants.CHINESE_LANGUAGE) ? item.name : item.nameEn) .fontSize($r('app.float.category_text_font')) .lineHeight($r('app.float.function_gridItem_text_line_height')) .margin({ top: $r('app.float.function_gridItem_text_margin_top') }); diff --git a/features/longList/src/main/ets/view/HomeContent.ets b/entry/src/main/ets/view/longlist/HomeContent.ets similarity index 69% rename from features/longList/src/main/ets/view/HomeContent.ets rename to entry/src/main/ets/view/longlist/HomeContent.ets index 688b3efc788a9bbc70c1d60098c2b25ae1e16832..7d42a9bee61cd306b9af1e4bc7382895962ddfcd 100644 --- a/features/longList/src/main/ets/view/HomeContent.ets +++ b/entry/src/main/ets/view/longlist/HomeContent.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,24 +15,27 @@ import { connection } from '@kit.NetworkKit'; import { BusinessError } from '@kit.BasicServicesKit'; -import { promptAction } from '@kit.ArkUI'; import { WaterFlowView } from './WaterFlowView'; -import { WaterFlowListData } from '../model/WaterFlowListData'; -import { CommonConstants, NetConnectionState } from '../constants/CommonConstants'; -import { BreakpointConstants } from '../constants/BreakpointConstants'; +import { WaterFlowListData } from '../../viewmodel/longlist/WaterFlowListData'; +import { CommonConstants, NetConnectionState } from '../../constants/CommonConstants'; +import { BreakpointConstants } from '../../constants/BreakpointConstants'; import { SearchBarView } from './SearchBarView'; import { FunctionView } from './FunctionView'; -import { HomeConstants } from '../constants/HomeConstants'; -import { BreakpointType } from '../utils/BreakpointSystem'; -import { common, Want } from '@kit.AbilityKit'; -import Logger from '../utils/Logger'; +import { HomeConstants } from '../../constants/HomeConstants'; +import { BreakpointType } from '../../utils/BreakpointSystem'; +import { hilog } from '@kit.PerformanceAnalysisKit'; @Component export struct HomeContent { + @StorageLink('pageInfos') pageInfo: NavPathStack = new NavPathStack(); @StorageLink(BreakpointConstants.BREAKPOINT_NAME) currentBreakpoint: string = BreakpointConstants.BREAKPOINT_LG; @StorageProp('topHeight') topHeight: number = CommonConstants.NUMBER_DEFAULT_VALUE; @StorageLink('currentOffset') currentOffset: number = 0; - @StorageLink('setCurrentOffset') @Watch('watchCurrentOffset')setCurrentOffset: boolean = false; + @StorageLink('continueOffset') continueOffset: number = 0; + @StorageLink('continueHeight') continueHeight: number = 0; + @StorageLink('listItemHeight') listItemHeight: number = 0; + @StorageLink('continueBreakpoint') continueBreakpoint: string = ''; + @StorageLink('setCurrentOffset') setCurrentOffset: boolean = false; @Link windowsHeight: number; @State isShowFoot: boolean = false; @State isRefreshing: boolean = false; @@ -41,20 +44,12 @@ export struct HomeContent { @State netConnectState: NetConnectionState = NetConnectionState.UNKNOWN_STATE; public scroller: Scroller = new Scroller(); public waterFlowScroller: Scroller = new Scroller(); - private context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; - - watchCurrentOffset(){ - if(this.setCurrentOffset){ - this.scroller.scrollTo({xOffset:0, yOffset:this.currentOffset}); - this.setCurrentOffset = false; - } - } listenNetworkEvent(firstLoading: boolean) { let netCon: connection.NetConnection = connection.createNetConnection(); let loading: boolean = false; netCon.register((error: BusinessError) => { - Logger.info(JSON.stringify(error)); + hilog.info(0x000, 'progress', JSON.stringify(error)); }); netCon.on('netUnavailable', () => { if (!loading) { @@ -74,7 +69,7 @@ export struct HomeContent { } catch (error) { let message = (error as BusinessError).message; let code = (error as BusinessError).code; - Logger.error('showToast args error code is ', code.toString(), 'message is ', message.toString()); + hilog.error(0x000, 'progress', 'showToast args error code is ', code.toString(), 'message is ', message.toString()); } } } @@ -98,7 +93,7 @@ export struct HomeContent { setTimeout(() => { this.isRefreshing = false; netCon.unregister((error: BusinessError) => { - Logger.error('unregister err:' + JSON.stringify(error)); + hilog.error(0x000, 'progress', 'unregister err:' + JSON.stringify(error)); }); }, 1000); } @@ -106,48 +101,88 @@ export struct HomeContent { aboutToAppear(): void { this.listenNetworkEvent(true); } + // [Start on_did_build] onDidBuild(): void { + hilog.info(0x000, 'progress', `onDidBuild ${this.setCurrentOffset} ${this.continueOffset}`); if(this.setCurrentOffset){ - this.scroller.scrollTo({xOffset:0, yOffset:this.currentOffset}); + this.scroller.scrollTo({xOffset: 0, yOffset: this.continueOffset}); this.setCurrentOffset = false; } } // [End on_did_build] + build() { Column() { - Row(){ - Image($r('app.media.back')) - .width(40) - .height(40) - .margin({ - right:8 + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG || + this.currentBreakpoint === BreakpointConstants.BREAKPOINT_XL) { + Row() { + Row(){ + Image($r('app.media.back')) + .width(40) + .height(40) + .margin({ + right:8 + }) + .onClick(()=>{ + this.pageInfo.pop(); + }) + Text($r('app.string.button1')) + .fontSize(20) + .fontWeight(700) + .lineHeight(27) + } + .height(56) + .alignItems(VerticalAlign.Center) + .justifyContent(FlexAlign.Start) + + .padding({ + left:19, + right:19 }) - .onClick(()=>{ - let want: Want = { - deviceId: '', - bundleName: 'com.example.continueprogress', - abilityName: 'EntryAbility', - } - this.context.startAbility(want) + SearchBarView() + .width(400) + .height(56) + } + .width('100%') + .height(56) + .justifyContent(FlexAlign.SpaceBetween) + .margin({ + top: this.topHeight, + bottom: 16 + }) + } else { + Row(){ + Image($r('app.media.back')) + .width(40) + .height(40) + .margin({ + right:8 + }) + .onClick(()=>{ + this.pageInfo.pop(); + }) + Text($r('app.string.button1')) + .fontSize(20) + .fontWeight(700) + .lineHeight(27) + } + .height(56) + .width('100%') + .alignItems(VerticalAlign.Center) + .justifyContent(FlexAlign.Start) + .margin({ + top: this.topHeight + }) + .padding({ + left:19, + right:19 + }) + SearchBarView() + .margin({ + bottom: 16 }) - Text($r('app.string.button1')) - .fontSize(20) - .fontWeight(700) - .lineHeight(27) } - .height(56) - .width('100%') - .alignItems(VerticalAlign.Center) - .justifyContent(FlexAlign.Start) - .margin({ - top: this.topHeight - }) - .padding({ - left:19, - right:19 - }) - SearchBarView(); Column() { // [Start scroll_water_flow_view] Scroll(this.scroller) { @@ -161,28 +196,21 @@ export struct HomeContent { scroller: this.scroller, windowsHeight: this.windowsHeight, isShowFoot: this.isShowFoot - }); + }) } .justifyContent(FlexAlign.Start); } else if (this.netConnectState === NetConnectionState.LOADING_STATE) { Column() { - this.loadingData(); + this.loadingData() } .justifyContent(FlexAlign.Start); } else if (this.netConnectState === NetConnectionState.FAIL_STATE) { Column() { - this.netUnavailable(); + this.netUnavailable() } - .justifyContent(FlexAlign.Start); + .justifyContent(FlexAlign.Start) } } - .onAppear(()=>{ - if(this.setCurrentOffset){ - this.scroller.scrollTo({xOffset:0, yOffset:this.currentOffset}); - this.setCurrentOffset = false; - } - this.currentOffset = this.scroller.currentOffset().yOffset; - }) // [EndExclude scroll_water_flow_view] .onDidScroll((xOffset: number, yOffset: number, scrollState: ScrollState)=>{ if(!this.setCurrentOffset){ @@ -190,16 +218,13 @@ export struct HomeContent { } }) // [End scroll_water_flow_view] - .onDisAppear(()=>{ - this.currentOffset = this.scroller.currentOffset().yOffset; - }) .width(CommonConstants.FULL_PERCENT) - .scrollBar(BarState.Off); + .scrollBar(BarState.Off) } } .backgroundColor($r('app.color.start_window_background')) .height(CommonConstants.FULL_PERCENT) - .width(CommonConstants.FULL_PERCENT); + .width(CommonConstants.FULL_PERCENT) } @Builder @@ -223,8 +248,8 @@ export struct HomeContent { .height($r('app.float.function_gridItem_gray_height')) .width($r('app.float.function_gridItem_gray_width')) .backgroundColor($r('app.color.function_default_color')) - .margin({ top: $r('app.float.function_gridItem_gray_marge_top') }); - }; + .margin({ top: $r('app.float.function_gridItem_gray_marge_top') }) + } } .width($r('app.float.function_gridItem_width')) .height($r('app.float.function_gridItem_height')); @@ -238,7 +263,7 @@ export struct HomeContent { }) .height($r('app.float.function_two_lines_default_height')) .rowsTemplate(HomeConstants.FUNCTION_ROWS_PAGE_ONE) - .columnsTemplate(HomeConstants.FUNCTION_COLUMN); + .columnsTemplate(HomeConstants.FUNCTION_COLUMN) Grid() { ForEach(HomeConstants.FUNCTION_DEFAULT_ICONS.slice(CommonConstants.NUMBER_DEFAULT_VALUE, @@ -259,23 +284,24 @@ export struct HomeContent { .padding({ bottom: $r('app.float.function_padding_bottom'), left: $r('app.float.function_padding_left'), - right: $r('app.float.function_padding_right'), + right: $r('app.float.function_padding_right') }) .height($r('app.float.water_flow_default_height')) .rowsTemplate(BreakpointConstants.GRID_NUM_TWO) .columnsTemplate(new BreakpointType({ sm: BreakpointConstants.GRID_NUM_TWO, md: BreakpointConstants.GRID_NUM_THREE, - lg: BreakpointConstants.GRID_NUM_THREE - }).getValue(this.currentBreakpoint)); - }; + lg: BreakpointConstants.GRID_NUM_THREE, + xl: BreakpointConstants.GRID_NUM_THREE + }).getValue(this.currentBreakpoint)) + } LoadingProgress() .color(Color.Black) .opacity($r('app.float.net_unavailable_opacity')) .width($r('app.float.net_unavailable_loading_width')) - .height($r('app.float.net_unavailable_loading_height')); - }; + .height($r('app.float.net_unavailable_loading_height')) + } } @Builder @@ -290,9 +316,9 @@ export struct HomeContent { }); Text($r('app.string.net_connection_description')) .fontSize($r('app.float.net_unavailable_text_fontsize')) - .opacity($r('app.float.net_unavailable_opacity')); + .opacity($r('app.float.net_unavailable_opacity')) } .width(CommonConstants.FULL_PERCENT) - .height(CommonConstants.FULL_PERCENT); + .height(CommonConstants.FULL_PERCENT) } } \ No newline at end of file diff --git a/features/longList/src/main/ets/view/IndexNavDestination.ets b/entry/src/main/ets/view/longlist/LongListPageComponent.ets similarity index 57% rename from features/longList/src/main/ets/view/IndexNavDestination.ets rename to entry/src/main/ets/view/longlist/LongListPageComponent.ets index fb6b3d8c0cbda2fca2aa7fe723e5c9c6c4a5df7c..6fb81a6c1a0cf005a0a93b33ea8767c6c29317ad 100644 --- a/features/longList/src/main/ets/view/IndexNavDestination.ets +++ b/entry/src/main/ets/view/longlist/LongListPageComponent.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,15 +13,26 @@ * limitations under the License. */ -import { BreakpointConstants } from '../constants/BreakpointConstants'; -import { BreakpointType } from '../utils/BreakpointSystem'; -import { NavigationBarView } from '../view/NavigationBarView'; -import { HomeContent } from '../view/HomeContent'; +import { BreakpointConstants } from '../../constants/BreakpointConstants'; +import { BreakpointType } from '../../utils/BreakpointSystem'; +import { NavigationBarView } from './NavigationBarView'; +import { HomeContent } from './HomeContent'; +import { display } from '@kit.ArkUI'; +import { hilog } from '@kit.PerformanceAnalysisKit'; @Component -export struct IndexNavDestination { +export struct LongListPageComponent { + @StorageLink('pageInfos') pageInfos: NavPathStack = new NavPathStack(); @StorageLink(BreakpointConstants.BREAKPOINT_NAME) currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; - @Link windowsHeight: number ; + @State windowsHeight: number = 0; + @StorageLink('bottomHeight') bottomHeight: number = 0; + @StorageLink('currentPage') currentPage: string = ''; + @StorageLink('continueEntry') continueEntry: boolean = false; + @StorageLink('continueOffset') continueOffset: number = 0; + @StorageLink('continueHeight') continueHeight: number = 0; + @StorageLink('listItemHeight') listItemHeight: number = 0; + @StorageLink('continueBreakpoint') continueBreakpoint: string = ''; + @StorageLink('setCurrentOffset') setCurrentOffset: boolean = false; private swiperController: SwiperController = new SwiperController(); private scroller: Scroller = new Scroller(); private waterFlowScroller: Scroller = new Scroller(); @@ -34,6 +45,7 @@ export struct IndexNavDestination { sm: FlexDirection.Column, md: FlexDirection.Column, lg: FlexDirection.Row, + xl: FlexDirection.Row } ).getValue(this.currentBreakpoint), wrap: FlexWrap.NoWrap, @@ -46,16 +58,16 @@ export struct IndexNavDestination { scroller: this.scroller, waterFlowScroller: this.waterFlowScroller, windowsHeight: this.windowsHeight - }); + }) } .width($r('app.string.full_screen')) - .height($r('app.string.full_screen')); + .height($r('app.string.full_screen')) NavigationBarView({ swiperController: this.swiperController, scroller: this.scroller, waterFlowScroller: this.waterFlowScroller - }); + }) } .direction( new BreakpointType( @@ -63,12 +75,22 @@ export struct IndexNavDestination { sm: Direction.Auto, md: Direction.Auto, lg: Direction.Rtl, + xl: Direction.Rtl } ).getValue(this.currentBreakpoint) ) .width($r('app.string.full_screen')) .height($r('app.string.full_screen')) - .backgroundColor($r('app.color.start_window_background')); - }; + .backgroundColor($r('app.color.start_window_background')) + } + .hideTitleBar(true) + .onAppear(() => { + this.windowsHeight = this.getUIContext().px2vp(display.getDefaultDisplaySync().height); + }) } +} + +@Builder +export function LongListPageComponentBuilder() { + LongListPageComponent() } \ No newline at end of file diff --git a/entry/src/main/ets/view/longlist/NavigationBarView.ets b/entry/src/main/ets/view/longlist/NavigationBarView.ets new file mode 100644 index 0000000000000000000000000000000000000000..7d8d1575d9759f1a442fe33bd64557d0d1d3fd3e --- /dev/null +++ b/entry/src/main/ets/view/longlist/NavigationBarView.ets @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BreakpointConstants } from '../../constants/BreakpointConstants'; +import { BreakpointType } from '../../utils/BreakpointSystem'; +import { FooterTab, FooterTabData, FooterTabDataEn } from '../../viewmodel/longlist/FooterTabData'; +import { CommonConstants } from '../../constants/CommonConstants'; + +@Component +export struct NavigationBarView { + @StorageLink(BreakpointConstants.BREAKPOINT_NAME) currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; + @StorageLink(CommonConstants.LANGUAGE) @Watch('changeTab') language: string = CommonConstants.CHINESE_LANGUAGE; + @StorageLink('bottomHeight') bottomHeight: number = 0; + @State selectIndex: number = CommonConstants.NUMBER_DEFAULT_VALUE; + @State iconArr: FooterTab[] = []; + public swiperController: SwiperController | undefined = undefined; + public scroller: Scroller = new Scroller(); + public waterFlowScroller: Scroller = new Scroller(); + + aboutToAppear(): void { + this.changeTab(); + } + + changeTab() { + if (this.language.includes(CommonConstants.CHINESE_LANGUAGE)) { + this.iconArr = new FooterTabData().tabList; + } else { + this.iconArr = new FooterTabDataEn().tabList; + } + } + + build() { + Flex({ + direction: this.currentBreakpoint === 'lg' || this.currentBreakpoint === 'xl' ? FlexDirection.Column : + FlexDirection.Row, + justifyContent: this.currentBreakpoint === 'xl' ? FlexAlign.Start : FlexAlign.SpaceBetween + }) { + ForEach(this.iconArr, (item: FooterTab, index: number) => { + Column() { + this.setNavigationItem(item, index); + } + }, (index: number) => JSON.stringify(index)); + } + .width(new BreakpointType( + { + sm: '100%', + md: '100%', + lg: '84vp', + xl: '240vp' + } + ).getValue(this.currentBreakpoint)) + .height(new BreakpointType( + { + sm: '84vp', + md: '84vp', + lg: '100%', + xl: '100%' + } + ).getValue(this.currentBreakpoint)) + .backgroundColor($r('app.color.start_window_background')) + .backgroundBlurStyle(BlurStyle.Thin, { + colorMode: ThemeColorMode.LIGHT, + adaptiveColor: AdaptiveColor.DEFAULT, + policy: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG || + this.currentBreakpoint === BreakpointConstants.BREAKPOINT_XL ? BlurStyleActivePolicy.ALWAYS_INACTIVE : + BlurStyleActivePolicy.ALWAYS_ACTIVE + }) + .padding({ + top: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_XL ? 56 : 0, + left: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_XL ? 16 : 0, + right: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_XL ? 16 : 0, + bottom: this.currentBreakpoint === BreakpointConstants.BREAKPOINT_XL || + this.currentBreakpoint === BreakpointConstants.BREAKPOINT_LG ? 0 : this.bottomHeight + }) + } + + @Builder + setNavigationItem(item: FooterTab, index: number) { + if (this.currentBreakpoint === BreakpointConstants.BREAKPOINT_XL) { + Row({ space: 8 }) { + Image(item.icon) + .objectFit(ImageFit.Fill) + .width($r('app.float.navigation_icon_size')) + .height($r('app.float.navigation_icon_size')) + .margin({ bottom: $r('app.float.margin_4') }) + + Text(item.name) + .fontSize(this.currentBreakpoint === BreakpointConstants.BREAKPOINT_XL ? 16 : 10) + .fontWeight(FontWeight.Medium) + } + .height(40) + .margin({ + left: 8 + }) + } else { + Column({ space: CommonConstants.SPACE_FOUR }) { + Image(item.icon) + .objectFit(ImageFit.Fill) + .width($r('app.float.navigation_icon_size')) + .height($r('app.float.navigation_icon_size')) + .margin({ bottom: $r('app.float.margin_4') }) + + Text(item.name) + .fontSize($r('app.float.font_size_10')) + .fontWeight(FontWeight.Medium) + } + .alignItems(HorizontalAlign.Center) + .justifyContent(FlexAlign.Center) + .onClick(() => { + if (item.name === this.iconArr[0].name) { + this.scroller.scrollTo({ xOffset: 0, yOffset: 0 }); + this.waterFlowScroller.scrollToIndex(0); + } + }) + .width(new BreakpointType( + { + sm: $r('app.string.full_screen_20'), + md: $r('app.string.full_screen_20'), + lg: $r('app.string.full_screen'), + xl: $r('app.string.full_screen') + } + ).getValue(this.currentBreakpoint)) + .height(new BreakpointType( + { + sm: $r('app.string.full_screen'), + md: $r('app.string.full_screen'), + lg: $r('app.string.full_screen_20'), + xl: $r('app.string.full_screen_20') + } + ).getValue(this.currentBreakpoint)) + .opacity(index === 0 ? 1 : $r('app.float.opacity_percent_40')) + .padding({ + top: new BreakpointType( + { + sm: $r('app.float.margin_4'), + md: $r('app.float.margin_4'), + lg: $r('app.float.zero'), + xl: $r('app.float.zero') + } + ).getValue(this.currentBreakpoint) + }) + } + } +} \ No newline at end of file diff --git a/features/longList/src/main/ets/view/SearchBarView.ets b/entry/src/main/ets/view/longlist/SearchBarView.ets similarity index 77% rename from features/longList/src/main/ets/view/SearchBarView.ets rename to entry/src/main/ets/view/longlist/SearchBarView.ets index 9d92a62a1351c951a68aa10f51518e48cfb563db..4d09c922ce779c940178b245abb15441c0cb453a 100644 --- a/features/longList/src/main/ets/view/SearchBarView.ets +++ b/entry/src/main/ets/view/longlist/SearchBarView.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,9 +13,9 @@ * limitations under the License. */ -import { CommonConstants } from '../constants/CommonConstants'; -import { BreakpointConstants } from '../constants/BreakpointConstants'; -import { BreakpointType } from '../utils/BreakpointSystem'; +import { CommonConstants } from '../../constants/CommonConstants'; +import { BreakpointConstants } from '../../constants/BreakpointConstants'; +import { BreakpointType } from '../../utils/BreakpointSystem'; @Component export struct SearchBarView { @@ -33,12 +33,14 @@ export struct SearchBarView { left: $r('app.float.search_input_left'), right: $r('app.float.search_input_right') }) - .width(CommonConstants.FULL_PERCENT); + .width(CommonConstants.FULL_PERCENT) + .enableKeyboardOnFocus(false) + .focusable(false) Image($r('app.media.ic_public_search')) .width($r('app.float.search_img_size')) .height($r('app.float.search_img_size')) - .margin({ left: $r('app.float.search_img_left') }); + .margin({ left: $r('app.float.search_img_left') }) } .alignSelf(ItemAlign.Center) .layoutWeight(1); @@ -49,14 +51,15 @@ export struct SearchBarView { left: new BreakpointType({ sm: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_SM, md: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_MD, - lg: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_LG + lg: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_LG, + xl: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_LG }).getValue(this.currentBreakpoint), right: new BreakpointType({ sm: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_RIGHT_SM, md: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_RIGHT_MD, - lg: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_RIGHT_LG - }).getValue(this.currentBreakpoint), - bottom:16 - }); + lg: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_RIGHT_LG, + xl: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_RIGHT_LG + }).getValue(this.currentBreakpoint) + }) } } \ No newline at end of file diff --git a/features/longList/src/main/ets/view/WaterFlowDescriptionView.ets b/entry/src/main/ets/view/longlist/WaterFlowDescriptionView.ets similarity index 84% rename from features/longList/src/main/ets/view/WaterFlowDescriptionView.ets rename to entry/src/main/ets/view/longlist/WaterFlowDescriptionView.ets index cd0b96a02aa84fe40366abee21c71d1ce06ec087..09b3efd90e89271eba828dd22c0562680eb79c2e 100644 --- a/features/longList/src/main/ets/view/WaterFlowDescriptionView.ets +++ b/entry/src/main/ets/view/longlist/WaterFlowDescriptionView.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,11 +14,13 @@ */ import { intl } from '@kit.LocalizationKit'; -import { CommonConstants } from '../constants/CommonConstants'; +import { CommonConstants } from '../../constants/CommonConstants'; @Component export struct WaterFlowDescriptionView { + @StorageLink(CommonConstants.LANGUAGE) language: string = CommonConstants.CHINESE_LANGUAGE; @Link title: string; + @Link titleEn: string; @Link userImage: string; @Link userName: string; @Link type: string; @@ -28,7 +30,7 @@ export struct WaterFlowDescriptionView { build() { Column() { - Text(this.title) + Text(this.language.includes(CommonConstants.CHINESE_LANGUAGE) ? this.title : this.titleEn) .fontSize($r('app.float.font_size_14')) .fontWeight(CommonConstants.TEXT_FONT_WEIGHT_500) .width($r('app.string.full_screen')) @@ -54,16 +56,19 @@ export struct WaterFlowDescriptionView { .fontWeight(CommonConstants.TEXT_FONT_WEIGHT_400) .fontColor(Color.Black) .opacity($r('app.float.opacity_percent_60')) - .margin({ left: 4 }); + .margin({ left: 4 }) + .width('40%') + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .maxLines(1) } .justifyContent(FlexAlign.Center); - Blank(); + Blank() Row() { Stack() { - Image('living' === this.type ? $r('app.media.people') : $r('app.media.ic_public_heart')) + Image('living' === this.type ? $r('app.media.people') : $r('app.media.ic_heart')) .fillColor(Color.Black) .objectFit(ImageFit.Fill) .width($r('app.float.photo_size_width')) @@ -71,7 +76,7 @@ export struct WaterFlowDescriptionView { .onClick(() => { this.collectionsCount++; }); - }; + } Text(this.collectionsCount < 1000 ? this.collectionsCount + '' : this.numberFormat.format(this.collectionsCount / 1000) + 'k') @@ -80,7 +85,7 @@ export struct WaterFlowDescriptionView { .fontColor(Color.Black) .opacity($r('app.float.opacity_percent_60')) .margin({ left: $r('app.float.margin_4') }); - }; + } } .justifyContent(FlexAlign.SpaceBetween) .width($r('app.string.full_screen')) @@ -92,6 +97,6 @@ export struct WaterFlowDescriptionView { top: $r('app.float.margin_12'), bottom: $r('app.float.margin_10') }) - .width($r('app.string.full_screen')); + .width($r('app.string.full_screen')) } } \ No newline at end of file diff --git a/features/longList/src/main/ets/view/WaterFlowImageView.ets b/entry/src/main/ets/view/longlist/WaterFlowImageView.ets similarity index 85% rename from features/longList/src/main/ets/view/WaterFlowImageView.ets rename to entry/src/main/ets/view/longlist/WaterFlowImageView.ets index 286f67b5bc328af6e99b123da46df9f2aa6b4c34..661e0b143bcbba61660e9c697caaa877d522524c 100644 --- a/features/longList/src/main/ets/view/WaterFlowImageView.ets +++ b/entry/src/main/ets/view/longlist/WaterFlowImageView.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,8 +13,8 @@ * limitations under the License. */ -import { BreakpointConstants } from '../constants/BreakpointConstants'; -import { CommonConstants } from '../constants/CommonConstants'; +import { BreakpointConstants } from '../../constants/BreakpointConstants'; +import { CommonConstants } from '../../constants/CommonConstants'; import { WaterFlowDescriptionView } from './WaterFlowDescriptionView'; @Component @@ -24,6 +24,7 @@ export struct WaterFlowImageView { @Link waterFlowItemWidth: number; @State source: string = CommonConstants.STRING_DEFAULT_VALUE; @State title: string = CommonConstants.STRING_DEFAULT_VALUE; + @State titleEn: string = CommonConstants.STRING_DEFAULT_VALUE; @State userImage: string = CommonConstants.STRING_DEFAULT_VALUE; @State userName: string = CommonConstants.STRING_DEFAULT_VALUE; @State collectionsCount: number = CommonConstants.NUMBER_DEFAULT_VALUE; @@ -35,6 +36,7 @@ export struct WaterFlowImageView { aboutToReuse(params: Record): void { this.source = params.source; this.title = params.title; + this.titleEn = params.titleEn; this.userImage = params.userImage; this.userName = params.userName; this.type = params.type; @@ -49,17 +51,17 @@ export struct WaterFlowImageView { Image(this.source) .alt($r('app.media.default_image')) .width($r('app.string.full_screen')) - .height(this.imageHeight / this.imageWidth * this.waterFlowItemWidth); + .aspectRatio(this.imageHeight / this.imageWidth) WaterFlowDescriptionView({ title: this.title, + titleEn: this.titleEn, userImage: this.userImage, userName: this.userName, type: this.type, collectionsCount: this.collectionsCount, vipSign: this.vipSign - }); + }) } .width($r('app.string.full_screen')) - .height($r('app.string.full_screen')); } } \ No newline at end of file diff --git a/features/longList/src/main/ets/view/WaterFlowLivingView.ets b/entry/src/main/ets/view/longlist/WaterFlowLivingView.ets similarity index 88% rename from features/longList/src/main/ets/view/WaterFlowLivingView.ets rename to entry/src/main/ets/view/longlist/WaterFlowLivingView.ets index c7bbb9112cf984d98b0948bb29808f4b884b0256..29dbdcfec848a9139daff31f8015325643070fda 100644 --- a/features/longList/src/main/ets/view/WaterFlowLivingView.ets +++ b/entry/src/main/ets/view/longlist/WaterFlowLivingView.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,7 +14,7 @@ */ import { componentUtils } from '@kit.ArkUI'; -import { CommonConstants } from '../constants/CommonConstants'; +import { CommonConstants } from '../../constants/CommonConstants'; import { WaterFlowDescriptionView } from './WaterFlowDescriptionView'; @Component @@ -25,6 +25,7 @@ export struct WaterFlowLivingView { @State currentBreakpoint: string = CommonConstants.STRING_DEFAULT_VALUE; @State windowsHeight: number = CommonConstants.NUMBER_DEFAULT_VALUE; @State title: string = CommonConstants.STRING_DEFAULT_VALUE; + @State titleEn: string = CommonConstants.STRING_DEFAULT_VALUE; @State userImage: string = CommonConstants.STRING_DEFAULT_VALUE; @State userName: string = CommonConstants.STRING_DEFAULT_VALUE; @State collectionsCount: number = CommonConstants.NUMBER_DEFAULT_VALUE; @@ -49,6 +50,9 @@ export struct WaterFlowLivingView { if (typeof params.title === 'string') { this.title = params.title; } + if (typeof params.titleEn === 'string') { + this.titleEn = params.titleEn; + } if (typeof params.userImage === 'string') { this.userImage = params.userImage; } @@ -81,7 +85,7 @@ export struct WaterFlowLivingView { .muted(true) .loop(true) .width($r('app.string.full_screen')) - .height(this.livingHeight / this.livingWidth * this.waterFlowItemWidth) + .aspectRatio(this.livingHeight / this.livingWidth) .onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => { if (isVisible && currentRatio >= 1.0) { this.videoController.start(); @@ -90,8 +94,8 @@ export struct WaterFlowLivingView { } }) .onAppear(() => { - let videoPos = - this.getUIContext().getComponentUtils().getRectangleById(CommonConstants.WATER_FLOW_LIVING_STRUCT_ID + this.itemIndex); + let videoPos = this.getUIContext().getComponentUtils() + .getRectangleById(CommonConstants.WATER_FLOW_LIVING_STRUCT_ID + this.itemIndex); if (this.getUIContext().px2vp(videoPos.windowOffset.y) + this.getUIContext().px2vp(videoPos.size.height) < this.windowsHeight) { setTimeout(() => { @@ -106,10 +110,11 @@ export struct WaterFlowLivingView { } .margin($r('app.float.live_view_image_margin')) .zIndex(1); - }; + } WaterFlowDescriptionView({ title: this.title, + titleEn: this.titleEn, userImage: this.userImage, userName: this.userName, type: this.type, @@ -118,6 +123,5 @@ export struct WaterFlowLivingView { }) } .width($r('app.string.full_screen')) - .height($r('app.string.full_screen')); } } diff --git a/features/longList/src/main/ets/view/WaterFlowVideoView.ets b/entry/src/main/ets/view/longlist/WaterFlowVideoView.ets similarity index 90% rename from features/longList/src/main/ets/view/WaterFlowVideoView.ets rename to entry/src/main/ets/view/longlist/WaterFlowVideoView.ets index 680d0d3adb16750b2d18d63b7688cdbe0f09efc2..e212b79982940fbd7ba22f26d4697e55658e1b0c 100644 --- a/features/longList/src/main/ets/view/WaterFlowVideoView.ets +++ b/entry/src/main/ets/view/longlist/WaterFlowVideoView.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,7 +13,7 @@ * limitations under the License. */ -import { CommonConstants } from '../constants/CommonConstants'; +import { CommonConstants } from '../../constants/CommonConstants'; import { WaterFlowDescriptionView } from './WaterFlowDescriptionView'; @Component @@ -24,6 +24,7 @@ export struct WaterFlowVideoView { @State playStatus: boolean = false; @State currentBreakpoint: string = CommonConstants.STRING_DEFAULT_VALUE; @State title: string = CommonConstants.STRING_DEFAULT_VALUE; + @State titleEn: string = CommonConstants.STRING_DEFAULT_VALUE; @State userImage: string = CommonConstants.STRING_DEFAULT_VALUE; @State userName: string = CommonConstants.STRING_DEFAULT_VALUE; @State collectionsCount: number = CommonConstants.NUMBER_DEFAULT_VALUE; @@ -36,6 +37,7 @@ export struct WaterFlowVideoView { aboutToReuse(params: Record): void { this.thumbnails = params.thumbnails; this.title = params.title; + this.titleEn = params.titleEn; this.videoWidth = parseInt(params.videoWidth, CommonConstants.NUMBER_DEFAULT_VALUE); this.videoHeight = parseInt(params.videoHeight, CommonConstants.NUMBER_DEFAULT_VALUE); this.userImage = params.userImage; @@ -51,7 +53,7 @@ export struct WaterFlowVideoView { Image(this.thumbnails) .alt($r('app.media.default_image')) .width($r('app.string.full_screen')) - .height(this.videoHeight / this.videoWidth * this.waterFlowItemWidth); + .aspectRatio(this.videoHeight / this.videoWidth) Row() { if (!this.playStatus) { Image($r('app.media.arrow_right_play')) @@ -65,6 +67,7 @@ export struct WaterFlowVideoView { WaterFlowDescriptionView({ title: this.title, + titleEn: this.titleEn, userImage: this.userImage, userName: this.userName, type: this.type, @@ -73,6 +76,5 @@ export struct WaterFlowVideoView { }) } .width($r('app.string.full_screen')) - .height($r('app.string.full_screen')); } } \ No newline at end of file diff --git a/features/longList/src/main/ets/view/WaterFlowView.ets b/entry/src/main/ets/view/longlist/WaterFlowView.ets similarity index 75% rename from features/longList/src/main/ets/view/WaterFlowView.ets rename to entry/src/main/ets/view/longlist/WaterFlowView.ets index fa89bcc91d96ed1498adaa4e446e8714b7503e51..9b95208e2e59abba994971272fa36ba249b935e5 100644 --- a/features/longList/src/main/ets/view/WaterFlowView.ets +++ b/entry/src/main/ets/view/longlist/WaterFlowView.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,25 +16,31 @@ import { display, MeasureText, promptAction } from '@kit.ArkUI'; import { connection } from '@kit.NetworkKit'; import { BusinessError } from '@kit.BasicServicesKit'; -import { BreakpointType } from '../utils/BreakpointSystem'; -import { WaterFlowListData } from '../model/WaterFlowListData'; -import { WaterFlowData } from '../model/WaterFlowData'; +import { BreakpointType } from '../../utils/BreakpointSystem'; +import { WaterFlowListData } from '../../viewmodel/longlist/WaterFlowListData'; +import { WaterFlowData } from '../../viewmodel/longlist/WaterFlowData'; import { WaterFlowImageView } from './WaterFlowImageView'; import { WaterFlowVideoView } from './WaterFlowVideoView'; import { WaterFlowLivingView } from './WaterFlowLivingView'; -import { CommonConstants } from '../constants/CommonConstants'; -import { BreakpointConstants } from '../constants/BreakpointConstants'; -import Logger from '../utils/Logger'; +import { CommonConstants } from '../../constants/CommonConstants'; +import { BreakpointConstants } from '../../constants/BreakpointConstants'; +import { hilog } from '@kit.PerformanceAnalysisKit'; @Component export struct WaterFlowView { @StorageLink(BreakpointConstants.BREAKPOINT_NAME) currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; @StorageLink(CommonConstants.LANGUAGE) language: string = CommonConstants.CHINESE_LANGUAGE; @StorageLink('continueIndex') continueIndex: number = 0; - @StorageLink('continueEntry') @Watch('watchContinueEntry') continueEntry: boolean = false; - @State @Watch('watchLoadFinish') loadFinish:boolean = false; + @StorageLink('continueWaterOffset') continueWaterOffset: number = 0; + @StorageLink('listItemHeight') listItemHeight: number = 0; + @StorageLink('continueEntry') continueEntry: boolean = false; + @StorageLink('windowWidth') windowWidth: number = 0; + @StorageLink('continueBreakpoint') continueBreakpoint: string = ''; + @StorageLink('continueHeight') continueHeight: number = 0; + @State loadFinish:boolean = false; @State listDataCount: number = CommonConstants.NUMBER_DEFAULT_VALUE; @State waterFlowItemWidth: number = CommonConstants.NUMBER_DEFAULT_VALUE; + @State waterFlowHeight: number = 0; @Link isShowFoot: boolean; @Link waterFlowListData: WaterFlowListData; @Link windowsHeight: number; @@ -43,23 +49,10 @@ export struct WaterFlowView { private pageNo: number = CommonConstants.WATER_FLOW_PAGE_START_INDEX; private pageSize: number = CommonConstants.WATER_FLOW_PAGE_SIZE; - watchLoadFinish(){ - if (this.continueEntry && this.loadFinish){ - this.waterFlowScroller.scrollTo({xOffset:0, yOffset:this.continueIndex}); - this.continueEntry = false; - } - } - - watchContinueEntry(){ - if (this.continueEntry && this.loadFinish){ - this.waterFlowScroller.scrollTo({xOffset:0, yOffset:this.continueIndex}); - this.continueEntry = false; - } - } listenNetworkEvent() { let netCon: connection.NetConnection = connection.createNetConnection(); netCon.register((error: BusinessError) => { - Logger.info('register info:' + JSON.stringify(error)); + hilog.info(0x000, 'progress', 'register info:' + JSON.stringify(error)); }); netCon.on('netUnavailable', () => { if (this.isShowFoot === true) { @@ -74,7 +67,7 @@ export struct WaterFlowView { } catch (error) { let message = (error as BusinessError).message; let code = (error as BusinessError).code; - Logger.error('showToast args error code is ', code.toString(), 'message is ', message.toString()); + hilog.error(0x000, 'progress', 'showToast args error code is ', code.toString(), 'message is ', message.toString()); } }); netCon.on('netAvailable', () => { @@ -84,7 +77,7 @@ export struct WaterFlowView { }); setTimeout(() => { netCon.unregister((error: BusinessError) => { - Logger.info('unregister info:' + JSON.stringify(error)); + hilog.info(0x000, 'progress', 'unregister info:' + JSON.stringify(error)); }); }, 500); } @@ -126,19 +119,15 @@ export struct WaterFlowView { Column({ space: CommonConstants.SPACE_EIGHT }) { Column() { // [Start water_flow] - WaterFlow( - // [StartExclude water_flow] - { footer: this.footStyle, scroller: this.waterFlowScroller } - // [EndExclude water_flow] - ) { + WaterFlow({ footer: this.footStyle, scroller: this.waterFlowScroller }) { // [StartExclude water_flow] LazyForEach(this.waterFlowListData.getData(), (item: WaterFlowData, index: number) => { FlowItem() { if (item.waterFlowHead.type === CommonConstants.WATER_FLOW_IMAGE_TYPE) { WaterFlowImageView({ source: item.waterFlowHead.source, - title: this.language === CommonConstants.CHINESE_LANGUAGE ? item.waterFlowDescription.title : - item.waterFlowDescription.titleEn, + title: item.waterFlowDescription.title, + titleEn: item.waterFlowDescription.titleEn, userImage: item.waterFlowDescription.userImage, userName: item.waterFlowDescription.userName, collectionsCount: item.waterFlowDescription.collectionsCount, @@ -153,8 +142,8 @@ export struct WaterFlowView { source: item.waterFlowHead.source, thumbnails: item.waterFlowHead.thumbnails, currentBreakpoint: this.currentBreakpoint, - title: this.language === CommonConstants.CHINESE_LANGUAGE ? item.waterFlowDescription.title : - item.waterFlowDescription.titleEn, + title: item.waterFlowDescription.title, + titleEn: item.waterFlowDescription.titleEn, userImage: item.waterFlowDescription.userImage, userName: item.waterFlowDescription.userName, collectionsCount: item.waterFlowDescription.collectionsCount, @@ -170,8 +159,8 @@ export struct WaterFlowView { thumbnails: item.waterFlowHead.thumbnails, currentBreakpoint: this.currentBreakpoint, windowsHeight: this.windowsHeight, - title: this.language === CommonConstants.CHINESE_LANGUAGE ? item.waterFlowDescription.title : - item.waterFlowDescription.titleEn, + title: item.waterFlowDescription.title, + titleEn: item.waterFlowDescription.titleEn, userImage: item.waterFlowDescription.userImage, userName: item.waterFlowDescription.userName, collectionsCount: item.waterFlowDescription.collectionsCount, @@ -184,8 +173,6 @@ export struct WaterFlowView { .reuseId(CommonConstants.WATER_FLOW_LIVING_REUSE_ID); } } - .height(item.waterFlowHead.height / item.waterFlowHead.width * this.waterFlowItemWidth + - this.getTitleHeight(item.waterFlowDescription.title)) .backgroundColor(Color.White) .width($r('app.string.full_screen')) .clip(true) @@ -199,10 +186,14 @@ export struct WaterFlowView { } this.listDataCount = this.waterFlowListData.dataSource.totalCount(); this.loadFinish = true; - }); + let imageWidth = this.waterFlowListData.dataSource.getData(0).waterFlowHead.width; + let imageHeight = this.waterFlowListData.dataSource.getData(0).waterFlowHead.height; + this.listItemHeight = imageHeight / imageWidth * this.getUIContext().px2vp(this.windowWidth) / + new BreakpointType({ sm: 2, md: 3, lg: 4, xl: 4 }).getValue(this.currentBreakpoint); + }) }, (item: WaterFlowData) => { return item.waterFlowDescription.index.toString(); - }); + }) // [EndExclude water_flow] } .restoreId(1) @@ -230,7 +221,8 @@ export struct WaterFlowView { .columnsTemplate(new BreakpointType({ sm: BreakpointConstants.GRID_NUM_TWO, md: BreakpointConstants.GRID_NUM_THREE, - lg: BreakpointConstants.GRID_NUM_FOUR + lg: BreakpointConstants.GRID_NUM_FOUR, + xl: BreakpointConstants.GRID_NUM_FOUR }).getValue(this.currentBreakpoint)) .columnsGap($r('app.float.water_flow_column_gap')) .rowsGap($r('app.float.water_flow_row_gap')) @@ -238,11 +230,28 @@ export struct WaterFlowView { .itemConstraintSize({ minWidth: $r('app.string.zero_screen'), maxWidth: $r('app.string.full_screen'), - minHeight: $r('app.string.zero_screen'), - }); + minHeight: $r('app.string.zero_screen') + }) + .onAreaChange((oldArea: Area, newArea: Area) => { + let height = oldArea.height; + hilog.info(0x000, 'progress', `onAreaChange ${this.continueEntry} ${this.continueWaterOffset} + ${this.listItemHeight}`); + if (this.continueEntry && height != 0){ + if (this.continueBreakpoint !== '' && this.continueBreakpoint !== this.currentBreakpoint) { + let countBreakPoint = new BreakpointType({ sm: 2, md: 3, lg: 4, xl: 4 }); + let index = this.continueWaterOffset / this.continueHeight * + countBreakPoint.getValue(this.continueBreakpoint); + let offset = index / countBreakPoint.getValue(this.currentBreakpoint) * this.listItemHeight; + this.waterFlowScroller.scrollTo({xOffset: 0, yOffset: offset}); + } else { + this.waterFlowScroller.scrollTo({xOffset: 0, yOffset: this.continueWaterOffset}); + } + this.continueEntry = false; + } + }) } .width($r('app.string.full_screen')) - .height($r('app.string.full_screen')); + .height($r('app.string.full_screen')) } .height($r('app.string.full_screen')) .margin({ @@ -251,19 +260,21 @@ export struct WaterFlowView { left: new BreakpointType({ sm: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_SM, md: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_MD, - lg: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_LG + lg: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_LG, + xl: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_LEFT_LG }).getValue(this.currentBreakpoint), right: new BreakpointType({ sm: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_RIGHT_SM, md: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_RIGHT_MD, - lg: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_RIGHT_LG + lg: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_RIGHT_LG, + xl: BreakpointConstants.SEARCHBAR_AND_WATER_FLOW_MARGIN_RIGHT_LG }).getValue(this.currentBreakpoint) }) .animation({ duration: CommonConstants.ANIMATION_DURATION_TIME, curve: Curve.EaseOut, playMode: PlayMode.Normal - }); + }) } @Builder @@ -275,31 +286,31 @@ export struct WaterFlowView { .fontSize($r('app.float.font_size_14')) .height($r('app.float.text_height')) .margin({ bottom: $r('app.float.margin_10') }) - .opacity($r('app.float.opacity_percent_40')); + .opacity($r('app.float.opacity_percent_40')) } else if (this.isShowFoot) { Row() { LoadingProgress() .color(Color.Black) .opacity($r('app.float.net_unavailable_opacity')) .width($r('app.float.net_request_loading_width')) - .height($r('app.float.net_request_loading_height')); + .height($r('app.float.net_request_loading_height')) Text($r('app.string.footer_text_loading')) .fontWeight(CommonConstants.TEXT_FONT_WEIGHT_400) .fontSize($r('app.float.font_size_14')) .height($r('app.float.text_height')) - .opacity($r('app.float.opacity_percent_40')); + .opacity($r('app.float.opacity_percent_40')) } .height($r('app.float.net_request_loading_width')) .width(CommonConstants.FULL_PERCENT) .alignItems(VerticalAlign.Center) - .justifyContent(FlexAlign.Center); + .justifyContent(FlexAlign.Center) } } .width(CommonConstants.FULL_PERCENT) .height(CommonConstants.TWENTY_PERCENT) .margin({ bottom: $r('app.float.margin_30') }) .alignItems(VerticalAlign.Bottom) - .justifyContent(FlexAlign.Center); + .justifyContent(FlexAlign.Center) } } \ No newline at end of file diff --git a/features/video/src/main/ets/components/ExitVideo.ets b/entry/src/main/ets/view/video/ExitVideo.ets similarity index 89% rename from features/video/src/main/ets/components/ExitVideo.ets rename to entry/src/main/ets/view/video/ExitVideo.ets index c77d19f747da88dc2c4439d8fa4547e050e4cbfb..4eb5841f36ace0e2acf5ef98b12bb9b22a91fc1b 100644 --- a/features/video/src/main/ets/components/ExitVideo.ets +++ b/entry/src/main/ets/view/video/ExitVideo.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,16 +16,16 @@ import { common, Want } from '@kit.AbilityKit'; import { connection } from '@kit.NetworkKit'; import { promptAction } from '@kit.ArkUI'; -import avPlayManage from '../videomanager/AvPlayManager'; -import { GlobalContext } from '../utils/GlobalContext'; +import avPlayManage from '../../viewmodel/video/AvPlayManager'; +import { GlobalContext } from '../../utils/GlobalContext'; @Component export struct ExitVideo { + @StorageLink('pageInfos') pageInfo: NavPathStack = new NavPathStack(); @StorageLink('videoName') videoName: Resource = $r('app.string.video_res_1'); @StorageLink('show') show: boolean = false; @StorageLink('videoSelect') videoSelect: number = 0; @Link avPlayManage: avPlayManage; - private context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; private videoList: Resource[] = [$r('app.string.video_res_1'), $r('app.string.video_res_2')]; async isInternet(): Promise { @@ -129,20 +129,15 @@ export struct ExitVideo { }) { // Exit Row(){ - Image($r('app.media.back')) + Image($r("app.media.ic_back")) .id('Exit') .width(40) .height(40) .onClick(() => { - let want: Want = { - deviceId: '', - bundleName: 'com.example.continueprogress', - abilityName: 'EntryAbility', - } - this.context.startAbility(want); + this.pageInfo.pop(); }) - Text($r('app.string.title')) + Text($r('app.string.video_title')) .fontColor(Color.White) .fontWeight(FontWeight.Medium) .fontSize($r('app.float.size_24')) diff --git a/features/video/src/main/ets/components/SpeedDialog.ets b/entry/src/main/ets/view/video/SpeedDialog.ets similarity index 92% rename from features/video/src/main/ets/components/SpeedDialog.ets rename to entry/src/main/ets/view/video/SpeedDialog.ets index e860def64978012c38798bc93ac27fcffbfd6098..adb5176f071bc44c2f7ebe2ff360ed0cc00bd56c 100644 --- a/features/video/src/main/ets/components/SpeedDialog.ets +++ b/entry/src/main/ets/view/video/SpeedDialog.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,7 +13,7 @@ * limitations under the License. */ -import avPlayManage from '../videomanager/AvPlayManager'; +import avPlayManage from '../../viewmodel/video/AvPlayManager'; // Index of the playback rate list. const ZERO = 0; @@ -26,7 +26,8 @@ export struct SpeedDialog { @State speedList: Resource[] = [$r('app.string.video_speed_1_0X'), $r('app.string.video_speed_1_25X'), $r('app.string.video_speed_1_75X'), $r('app.string.video_speed_2_0X')]; - @Link speedSelect: number; // Index of the current selection + @StorageLink('speedSelect') speedSelect: number = 0; // Index of the current selection + @Link speed: number; @StorageLink('avPlayManage') avPlayManage: avPlayManage = new avPlayManage(); private controller: CustomDialogController; @@ -50,7 +51,7 @@ export struct SpeedDialog { .fontWeight(FontWeight.Medium) .textAlign(TextAlign.Center) Blank() - Image(this.speedSelect === index ? $r('app.media.ic_radio_selected') : $r('app.media.ic_radio')) + Image(this.speed === index ? $r('app.media.ic_radio_selected') : $r('app.media.ic_radio')) .width($r('app.float.size_24')) .height($r('app.float.size_24')) .objectFit(ImageFit.Contain) @@ -117,6 +118,5 @@ export struct SpeedDialog { .alignItems(HorizontalAlign.Center) .width('90%') .borderRadius($r('app.float.size_24')) - .backgroundColor(Color.White) } } \ No newline at end of file diff --git a/features/video/src/main/ets/components/VideoOperate.ets b/entry/src/main/ets/view/video/VideoOperate.ets similarity index 64% rename from features/video/src/main/ets/components/VideoOperate.ets rename to entry/src/main/ets/view/video/VideoOperate.ets index cc838f34bc843ea760b90b51c6b1879c82768d3c..9a2934db906cc61293536e76dc7c5cf0d23ab92f 100644 --- a/features/video/src/main/ets/components/VideoOperate.ets +++ b/entry/src/main/ets/view/video/VideoOperate.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,29 +13,38 @@ * limitations under the License. */ -import { timeConvert } from '../utils/TimeUtils'; -import avPlayManage from '../videomanager/AvPlayManager'; -import { SpeedDialog } from '../components/SpeedDialog'; +import { timeConvert } from '../../utils/TimeUtils'; +import avPlayManage from '../../viewmodel/video/AvPlayManager'; +import { SpeedDialog } from './SpeedDialog'; @Component export struct VideoOperate { + @State speedList: Resource[] = + [$r('app.string.video_speed_1_0X'), $r('app.string.video_speed_1_25X'), $r('app.string.video_speed_1_75X'), + $r('app.string.video_speed_2_0X')]; @StorageLink('currentTime') currentTime: number = 0; @StorageLink('flag') flag: boolean = true; @StorageLink('speedIndex') speedIndex: number = 0; // Index of the playback rate list. @StorageLink('sliderWidth') sliderWidth: string = ''; - @StorageLink('speedName') speedName: Resource = $r('app.string.video_speed_1_0X'); + @StorageLink('speedSelect') @Watch('changeSpeed') speedSelect: number = 0; // Speed Magnification Selection + @State speed: number = this.speedSelect; // Speed Magnification Selection + @StorageLink('speedName') speedName: Resource = this.speedList[this.speedSelect]; @Link durationTime: number; @Link isSwiping: boolean; @Link avPlayManage: avPlayManage; @Link XComponentFlag: boolean; @State videoList: Resource[] = [$r('app.string.video_res_1'), $r('app.string.video_res_2')]; - @State speedSelect: number = 0; // Speed Magnification Selection private dialogController: CustomDialogController = new CustomDialogController({ - builder: SpeedDialog({ speedSelect: $speedSelect }), + builder: SpeedDialog({ speed: $speed }), alignment: DialogAlignment.Bottom, offset: { dx: $r('app.float.size_zero'), dy: $r('app.float.size_down_20') } }); + changeSpeed() { + this.speedName = this.speedList[this.speedSelect]; + this.speed = this.speedSelect; + } + build() { Row() { Row() { @@ -75,21 +84,12 @@ export struct VideoOperate { .showTips(false) .onChange((value: number, mode: SliderChangeMode) => { if (mode === SliderChangeMode.Begin) { - this.isSwiping = true; - this.avPlayManage.videoPause(); - this.flag = false; + this.avPlayManage.sliderAction(true); } this.avPlayManage.videoSeek(value); - let timeInterval = AppStorage.get('timeInterval') as number; - clearInterval(timeInterval); - timeInterval = setInterval(() => { // Update the current time. - this.currentTime = this.avPlayManage.getCurrentTime(); - }, 100); - AppStorage.setOrCreate('timeInterval', timeInterval); + if (mode === SliderChangeMode.End) { - this.isSwiping = false; - this.flag = true; - this.avPlayManage.videoPlay(); + this.avPlayManage.sliderAction(false); } }) } @@ -100,22 +100,6 @@ export struct VideoOperate { Text(timeConvert(this.durationTime)) .fontColor(Color.White) .fontWeight(FontWeight.Regular) - - Button(this.speedName, { type: ButtonType.Normal }) - .border({ width: $r('app.float.size_1'), color: Color.White }) - .width($r('app.float.size_75')) - .height($r('app.float.size_40')) - .fontSize($r('app.float.size_15')) - .borderRadius($r('app.float.size_24')) - .fontColor(Color.White) - .backgroundColor(Color.Black) - .opacity($r('app.float.size_1')) - .margin({ left: $r('app.float.size_10') }) - .id('Speed') - .onClick(() => { - this.speedSelect = this.speedIndex; - this.dialogController.open(); - }) } } .justifyContent(FlexAlign.Center) diff --git a/features/video/src/main/ets/pages/Index.ets b/entry/src/main/ets/view/video/VideoPageComponent.ets similarity index 58% rename from features/video/src/main/ets/pages/Index.ets rename to entry/src/main/ets/view/video/VideoPageComponent.ets index dd4683868b032d9c27190a323e6474ab8361211e..faeed1ee185e39da915b70fc8cf6ace49068fcd7 100644 --- a/features/video/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/view/video/VideoPageComponent.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,14 +15,14 @@ import { media } from '@kit.MediaKit'; import { connection } from '@kit.NetworkKit'; -import { common } from '@kit.AbilityKit'; import { display, promptAction } from '@kit.ArkUI'; import { emitter } from '@kit.BasicServicesKit'; -import avPlayManage from '../videomanager/AvPlayManager'; -import { VideoOperate } from '../components/VideoOperate'; -import { ExitVideo } from '../components/ExitVideo'; -import { timeConvert } from '../utils/TimeUtils'; -import { GlobalContext } from '../utils/GlobalContext'; +import avPlayManage from '../../viewmodel/video/AvPlayManager'; +import { VideoOperate } from './VideoOperate'; +import { ExitVideo } from './ExitVideo'; +import { timeConvert } from '../../utils/TimeUtils'; +import { GlobalContext } from '../../utils/GlobalContext'; +import { hilog } from '@kit.PerformanceAnalysisKit'; const PROPORTION = 0.99; // Screen Percentage const SURFACEW = 0.9; // Surface width ratio @@ -53,7 +53,8 @@ let innerEventWH: innerInfo = { @Entry @Component -struct Index { +struct VideoPageComponent { + @StorageLink('pageInfos') pageInfos: NavPathStack = new NavPathStack(); @StorageLink('flag') flag: boolean = true; // Pause Playback @StorageLink('currentTime') currentTime: number = 0; @StorageLink('show') show: boolean = false; // Indicates whether the videoPanel component is displayed. @@ -62,21 +63,23 @@ struct Index { @StorageLink('videoName') videoName: Resource = $r('app.string.video_res_1'); @StorageLink('videoIndex') videoIndex: number = 0; @StorageLink('continue') @Watch('continueChange')continue: boolean = false; - @StorageLink('timeInterval') timeInterval: number = 0; + @StorageLink('bottomHeight') bottomHeight: number = 0; + @StorageLink('topHeight') topHeight: number = 0; + @StorageLink('windowWidth') windowWidth: number = 0; + @StorageLink('windowHeight') windowHeight: number = 0; + @StorageLink('continueEntry') continueEntry: boolean = false; + @StorageLink('currentPage') currentPage: string = ''; @State avPlayManage: avPlayManage = new avPlayManage(); @State isSwiping: boolean = false; @State isClickScreen: boolean = false; @State XComponentFlag: boolean = false; - @State speedSelect: number = 0; + @StorageLink('speedSelect') speedSelect: number = 0; @State videoListSelect: number = 0; @State durationTime: number = 0; @State surfaceW: number = 0; @State surfaceH: number = 0; @State percent: number = 0; - @State windowWidth: number = 300; - @State windowHeight: number = 300; @State isCalcWHFinished: boolean = false; - private videoList: Resource[] = [$r('app.string.video_res_1'), $r('app.string.video_res_2')]; private videoNameList: string[] = ['test1.mp4', 'test2.mp4'] private surfaceId: string = ''; private timeout: number = 0; // Timer ID @@ -116,36 +119,6 @@ struct Index { emitter.off(innerEventFalse.eventId); } - onPageHide() { - this.avPlayManage.videoPause(); - this.flag = false; - } - - onPageShow() { - emitter.on(innerEventTrue, (res) => { - if (res.data) { - this.flag = res.data.flag; - this.XComponentFlag = res.data.flag; - } - }); - emitter.on(innerEventFalse, (res) => { - if (res.data) { - this.flag = res.data.flag; - } - }); - emitter.on(innerEventWH, (res) => { - if (res.data) { - this.windowWidth = res.data.width; - this.windowHeight = res.data.height; - this.setVideoWH(); - } - }); - - if (this.flag == false) { - this.clearTimer(); - } - } - setVideoWH(): void { if (this.percent >= 1) { // Horizontal video this.surfaceW = Math.round(this.windowWidth * PROPORTION); @@ -182,20 +155,17 @@ struct Index { .visibility(this.XComponentFlag ? Visibility.Visible : Visibility.Hidden) .onLoad(() => { this.surfaceId = this.xComponentController.getXComponentSurfaceId(); - this.avPlayManage.initPlayer(this.surfaceId, this.videoNameList[this.videoIndex],this.continue,this.currentTime, + this.avPlayManage.initPlayer(this.surfaceId, this.videoNameList[this.videoIndex], this.continue, + this.currentTime, (avPlayer: media.AVPlayer) => { this.percent = avPlayer.width / avPlayer.height; this.setVideoWH(); this.isCalcWHFinished = true; this.durationTime = this.avPlayManage.getDurationTime(); this.clearTimer(); - clearInterval(this.timeInterval); if(!this.flag){ this.avPlayManage.videoPause() } - this.timeInterval = setInterval(() => { // Update the current time. - this.currentTime = this.avPlayManage.getCurrentTime(); - }, SET_INTERVAL); }) }) @@ -204,85 +174,129 @@ struct Index { } build() { - Stack() { - Column() { - this.CoverXComponent() - } - .align(Alignment.TopStart) - .margin({ top: $r('app.float.size_80') }) - .id('Video') - .justifyContent(FlexAlign.Center) - - Text() - .height(`${this.surfaceH}px`) - .width(`${this.surfaceW}px`) - .margin({ top: $r('app.float.size_80') }) - .backgroundColor(Color.Black) - .opacity($r('app.float.size_zero_five')) - .visibility(this.isSwiping ? Visibility.Visible : Visibility.Hidden) + NavDestination() { + Stack() { + Column() { + this.CoverXComponent() + } + .id('Video') + .justifyContent(FlexAlign.Center) - Row() { - Text(timeConvert(this.currentTime)) - .fontSize($r('app.float.size_24')) - .opacity($r('app.float.size_1')) - .fontColor($r('app.color.slider_selected')) - Text('/' + timeConvert(this.durationTime)) - .fontSize($r('app.float.size_24')) - .opacity($r('app.float.size_1')) - .fontColor(Color.White) - } - .margin({ top: $r('app.float.size_80') }) - .visibility(this.isSwiping ? Visibility.Visible : Visibility.Hidden) + Text() + .height(`${this.surfaceH}px`) + .width(`${this.surfaceW}px`) + .margin({ top: $r('app.float.size_80') }) + .backgroundColor(Color.Black) + .opacity($r('app.float.size_zero_five')) + .visibility(this.isSwiping ? Visibility.Visible : Visibility.Hidden) - Column() { Row() { - ExitVideo({ - avPlayManage: $avPlayManage, - }) + Text(timeConvert(this.currentTime)) + .fontSize($r('app.float.size_24')) + .opacity($r('app.float.size_1')) + .fontColor($r('app.color.slider_selected')) + Text('/' + timeConvert(this.durationTime)) + .fontSize($r('app.float.size_24')) + .opacity($r('app.float.size_1')) + .fontColor(Color.White) } - .width('100%') - .justifyContent(FlexAlign.Start) - - Blank() + .margin({ top: $r('app.float.size_80') }) + .visibility(this.isSwiping ? Visibility.Visible : Visibility.Hidden) Column() { - // Progress bar - VideoOperate({ - avPlayManage: $avPlayManage, - durationTime: $durationTime, - isSwiping: $isSwiping, - XComponentFlag: $XComponentFlag - }) - .width('100%') + Row() { + ExitVideo({ + avPlayManage: $avPlayManage, + }) + } + .width('100%') + .justifyContent(FlexAlign.Start) + + Blank() + + Column() { + // Progress bar + VideoOperate({ + avPlayManage: $avPlayManage, + durationTime: $durationTime, + isSwiping: $isSwiping, + XComponentFlag: $XComponentFlag + }) + .width('100%') + } + .justifyContent(FlexAlign.Center) } - .justifyContent(FlexAlign.Center) + .onTouch((event: TouchEvent) => { + if (event.type === TouchType.Down) { + this.isClickScreen = true; + this.clearTimer(); + } else if (event.type === TouchType.Up) { + this.setTimer(); + } else if (event.type === TouchType.Move) { + this.isClickScreen = true; + this.clearTimer(); + } + }) + .visibility(this.isClickScreen ? Visibility.Visible : Visibility.Hidden) + .width('100%') + .height('100%') } - .onTouch((event: TouchEvent) => { - if (event.type === TouchType.Down) { - this.isClickScreen = true; - this.clearTimer(); - } else if (event.type === TouchType.Up) { + .onClick(() => { + this.isClickScreen = !this.isClickScreen; + if (this.isClickScreen) { this.setTimer(); - } else if (event.type === TouchType.Move) { - this.isClickScreen = true; + } else { this.clearTimer(); } }) - .visibility(this.isClickScreen ? Visibility.Visible : Visibility.Hidden) - .width('100%') + .backgroundColor(Color.Black) .height('100%') + .width('100%') + .padding({ + top: this.topHeight, + bottom: this.bottomHeight === 0 ? 16 : this.bottomHeight + }) } - .onClick(() => { - this.isClickScreen = !this.isClickScreen; - if (this.isClickScreen) { - this.setTimer(); - } else { + .hideTitleBar(true) + .onAppear(() => { + let index = AppStorage.get('videoIndex') as number; + if (!index) { + AppStorage.setOrCreate('videoIndex', 0); + } + }) + .onShown(() => { + emitter.on(innerEventTrue, (res) => { + if (res.data) { + this.flag = res.data.flag; + this.XComponentFlag = res.data.flag; + } + }); + emitter.on(innerEventFalse, (res) => { + if (res.data) { + this.flag = res.data.flag; + } + }); + emitter.on(innerEventWH, (res) => { + if (res.data) { + this.windowWidth = res.data.width; + this.windowHeight = res.data.height; + this.setVideoWH(); + } + }); + + if (!this.flag) { this.clearTimer(); } + hilog.info(0x000, 'progress', 'onShown currentPage ' + this.currentPage); + }) + .onHidden(() => { + this.avPlayManage.videoPause(); + this.flag = false; }) - .backgroundColor(Color.Black) - .height('100%') - .width('100%') - .padding({ top: '36vp', bottom: '28vp' }) } +} + +@Builder +export function VideoPageComponentBuilder() { + VideoPageComponent() } \ No newline at end of file diff --git a/entry/src/main/ets/view/web/WebPageComponent.ets b/entry/src/main/ets/view/web/WebPageComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..6aeb1ff67a1d83a50c4f1af0547a0f076539bdb4 --- /dev/null +++ b/entry/src/main/ets/view/web/WebPageComponent.ets @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { BusinessError } from '@kit.BasicServicesKit'; +import { router, promptAction } from '@kit.ArkUI'; +import { webview } from '@kit.ArkWeb'; +import { window } from '@kit.ArkUI'; +import { common, Want } from '@kit.AbilityKit'; +import { CommonConstants } from '../../constants/CommonConstants'; +import { ArkTSFunModel } from '../../viewmodel/web/ProductModel'; +import { i18n } from '@kit.LocalizationKit'; +import { BreakpointConstants } from '../../constants/BreakpointConstants'; +import { BreakpointType } from '../../utils/BreakpointSystem'; +import { hilog } from '@kit.PerformanceAnalysisKit'; + +const TAG: string = '[IndexPage]'; + +@Entry +@Component +struct WebPageComponent { + @StorageLink('pageInfos') pageInfos: NavPathStack = new NavPathStack(); + @StorageLink(BreakpointConstants.BREAKPOINT_NAME) @Watch('changeWebListCount') currentBreakpoint: string = + BreakpointConstants.BREAKPOINT_SM; + @StorageLink('continueRestore') continueRestore: boolean = false; + @StorageLink('pageUrl') @Watch('watchPageUrl') pageUrl: string = 'resource://rawfile/product_list.html'; + @StorageLink('scrollDistance') scrollDistance: number = 0; + @StorageLink('bottomHeight') bottomHeight: number = 0; + @StorageLink('topHeight') topHeight: number = 0; + @StorageLink('continueEntry') continueEntry: boolean = false; + @StorageLink('currentPage') currentPage: string = ''; + @State webCanBack: boolean = false; + @State onPageEnd: boolean = false; + @State webCanForward: boolean = false; + @State controller: webview.WebviewController = new webview.WebviewController(); + @State statusBarHeight: number = 0; + @State sliderBarHeight: number = 56; + + arkTSObj: ArkTSFunModel = { + jumpOrderConfirm: (detailStr: string) => this.jumpOrderConfirm(detailStr) + }; + + watchPageUrl() { + if (this.continueRestore) { + this.controller.loadUrl(this.pageUrl); + this.continueRestore = false; + } + } + + jumpOrderConfirm(detailStr: string): void { + router.pushUrl({ + url: 'pages/OrderConfirmPage', + params: { statusBarHeight: this.statusBarHeight, sliderBarHeight: this.sliderBarHeight, detailStr } + }); + } + + changeWebListCount() { + let column = new BreakpointType({ + sm: 'javascript:document.getElementById("productList").style["column-count"] = 1', + md: 'javascript:document.getElementById("productList").style["column-count"] = 2', + lg: 'javascript:document.getElementById("productList").style["column-count"] = 3' + }).getValue(this.currentBreakpoint); + this.controller.runJavaScript(column); + let columnGap = new BreakpointType({ + sm: 'javascript:document.getElementById("productList").style["column-gap"] = 0px', + md: 'javascript:document.getElementById("productList").style["column-gap"] = 20px', + lg: 'javascript:document.getElementById("productList").style["column-gap"] = 40px' + }).getValue(this.currentBreakpoint); + this.controller.runJavaScript(columnGap); + } + + build() { + NavDestination() { + Column() { + Row() { + Image($r('app.media.back')) + .width(40) + .height(40) + .margin({ + right: 8 + }) + .onClick(() => { + if (this.pageUrl.includes('product_list')) { + this.pageInfos.pop(); + } else if (this.pageUrl.includes('product_detail')) { + this.controller.loadUrl(i18n.System.getSystemLanguage() === 'zh-Hans' ? + 'resource://rawfile/product_list.html' : + 'resource://rawfile/product_list_en.html'); + } + }) + Text($r('app.string.tittle')) + .fontSize(20) + .fontWeight(700) + .lineHeight(27) + } + .backgroundColor(this.pageUrl && this.pageUrl.includes('product_list') ? '#FFF1F3F5' : '#00000000') + .height(56) + .width('100%') + .alignItems(VerticalAlign.Center) + .justifyContent(FlexAlign.Start) + .padding({ + left: 19, + right: 19 + }) + .margin({ + top: this.topHeight + }) + // [Start web_on_page_end] + Web({ src: this.pageUrl, controller: this.controller }) + // [StartExclude web_on_page_end] + .layoutWeight(1) + .javaScriptProxy({ + object: this.arkTSObj, + name: 'arkTSFunObj', + methodList: ['jumpOrderConfirm'], + controller: this.controller + }) + .onConfirm(() => { + this.getUIContext().getPromptAction().showToast({ + message: $r('app.string.toast_msg'), + duration: CommonConstants.TOAST_DURATION + }); + return false; + }) + .layoutWeight(1) + // [EndExclude web_on_page_end] + .onPageEnd(async () => { + // [StartExclude web_on_page_end] + this.changeWebListCount(); + this.webCanBack = this.controller.accessBackward(); + this.webCanForward = this.controller.accessForward(); + this.onPageEnd = true; + // [EndExclude web_on_page_end] + if (this.pageUrl.includes('product_list') && this.continueRestore) { + this.controller.runJavaScript('javascript:document.getElementById("productList").scrollTop = ' + + this.scrollDistance); + } + this.pageUrl = this.controller.getUrl(); + let result = + await this.controller.runJavaScript('javascript:document.getElementById("productList").scrollTop'); + this.scrollDistance = Number(result); + }) + // [StartExclude web_on_page_end] + .zoomAccess(false) + // [EndExclude web_on_page_end] + .onTouch(async (event: TouchEvent) => { + if (event.type === TouchType.Up) { + if (this.pageUrl.includes('product_list')) { + let result = + await this.controller.runJavaScript('javascript:document.getElementById("productList").scrollTop'); + this.scrollDistance = Number(result); + } + } + }) + // [End web_on_page_end] + } + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) + .width(CommonConstants.FULL_PERCENT) + .height(CommonConstants.FULL_PERCENT) + .backgroundColor($r('app.color.common_bg')) + .padding({ + bottom: this.pageUrl && this.pageUrl.includes('product_list') ? 0 : 28 + }) + } + .hideTitleBar(true) + .onAppear(() => { + let url = AppStorage.get('pageUrl') as string; + if (!url) { + this.pageUrl = 'resource://rawfile/product_list.html'; + } + webview.WebviewController.setWebDebuggingAccess(true); + window.getLastWindow(this.getUIContext().getHostContext(), (err: BusinessError, windowClass: window.Window) => { + if (err.code) { + hilog.error(0x000, 'progress', TAG, 'Failed to obtain the main window. Cause: ' + JSON.stringify(err)); + return; + } + hilog.info(0x000, 'progress', TAG, 'Succeeded in obtaining the main window. Data: ' + JSON.stringify(windowClass)); + + // Realize the immersive effect. + try { + let type = window.AvoidAreaType.TYPE_SYSTEM; + // Get status bar height. + let area: window.AvoidArea = windowClass.getWindowAvoidArea(type); + let statusBarHeight = this.getUIContext().px2vp(area.topRect.height); + let sliderBarHeight = this.getUIContext().px2vp(area.bottomRect.height); + this.statusBarHeight = statusBarHeight; + this.sliderBarHeight = sliderBarHeight; + if (statusBarHeight > 0) { + windowClass.setWindowLayoutFullScreen(true); + } + } catch (exception) { + hilog.error(0x000, 'progress', TAG, 'Failed to set the system bar properties. Cause: ' + JSON.stringify(exception)); + } + }); + }) + .onBackPressed(() => { + if (this.pageUrl.includes('product_list')) { + this.pageInfos.pop(); + } else if (this.pageUrl.includes('product_detail')) { + this.controller.loadUrl(i18n.System.getSystemLanguage() === 'zh-Hans' ? + 'resource://rawfile/product_list.html' : + 'resource://rawfile/product_list_en.html'); + } + return true; + }) + .onShown(() => { + hilog.info(0x000, 'progress', 'onShown currentPage ' + this.currentPage); + }) + } +} + +@Builder +export function WebPageComponentBuilder() { + WebPageComponent() +} \ No newline at end of file diff --git a/features/longList/src/main/ets/model/FooterTabData.ets b/entry/src/main/ets/viewmodel/longlist/FooterTabData.ets similarity index 93% rename from features/longList/src/main/ets/model/FooterTabData.ets rename to entry/src/main/ets/viewmodel/longlist/FooterTabData.ets index ed16d627cf0606ec12fe8b1511838bdf428ada81..1965f295aab5f6ac092d39a3b52d1fcef9f8f0ee 100644 --- a/features/longList/src/main/ets/model/FooterTabData.ets +++ b/entry/src/main/ets/viewmodel/longlist/FooterTabData.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,7 +13,7 @@ * limitations under the License. */ -import { HomeConstants } from '../constants/HomeConstants'; +import { HomeConstants } from '../../constants/HomeConstants'; export class FooterTabData { public tabList: FooterTab[] = []; diff --git a/features/longList/src/main/ets/model/FunctionEntryData.ets b/entry/src/main/ets/viewmodel/longlist/FunctionEntryData.ets similarity index 95% rename from features/longList/src/main/ets/model/FunctionEntryData.ets rename to entry/src/main/ets/viewmodel/longlist/FunctionEntryData.ets index ed58a4a6ece74966fe6ffcc8bcd38af0106c7195..9ce7520824262641152ac6b0e49d9bc858b0c1e4 100644 --- a/features/longList/src/main/ets/model/FunctionEntryData.ets +++ b/entry/src/main/ets/viewmodel/longlist/FunctionEntryData.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/features/longList/src/main/ets/model/FunctionEntryListData.ets b/entry/src/main/ets/viewmodel/longlist/FunctionEntryListData.ets similarity index 86% rename from features/longList/src/main/ets/model/FunctionEntryListData.ets rename to entry/src/main/ets/viewmodel/longlist/FunctionEntryListData.ets index 093eaed9edb7c8ad8c680f5d289534082a0d96f5..d095e085e708f17363083660955a00874065c04c 100644 --- a/features/longList/src/main/ets/model/FunctionEntryListData.ets +++ b/entry/src/main/ets/viewmodel/longlist/FunctionEntryListData.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,9 +13,9 @@ * limitations under the License. */ -import { NetworkUtil } from '../utils/NetworkUtil'; +import { NetworkUtil } from '../../utils/NetworkUtil'; import { FunctionEntryData } from './FunctionEntryData'; -import { CommonConstants } from '../constants/CommonConstants'; +import { CommonConstants } from '../../constants/CommonConstants'; export class FunctionEntryListData { public netWorkUtil: NetworkUtil = new NetworkUtil(); diff --git a/features/longList/src/main/ets/model/WaterFlowData.ets b/entry/src/main/ets/viewmodel/longlist/WaterFlowData.ets similarity index 95% rename from features/longList/src/main/ets/model/WaterFlowData.ets rename to entry/src/main/ets/viewmodel/longlist/WaterFlowData.ets index 60669971eaa6ae39a7d11e3c4cceff8f1537be8e..0b33fdf2439bff9d9db7bffc14af564a8c5553a8 100644 --- a/features/longList/src/main/ets/model/WaterFlowData.ets +++ b/entry/src/main/ets/viewmodel/longlist/WaterFlowData.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/features/longList/src/main/ets/model/WaterFlowDescriptionData.ets b/entry/src/main/ets/viewmodel/longlist/WaterFlowDescriptionData.ets similarity index 96% rename from features/longList/src/main/ets/model/WaterFlowDescriptionData.ets rename to entry/src/main/ets/viewmodel/longlist/WaterFlowDescriptionData.ets index 71b83d3f3e38401c51313b7337121aef63a8725d..42551f346c072cbcc3e0d390a3f2194fa161c53a 100644 --- a/features/longList/src/main/ets/model/WaterFlowDescriptionData.ets +++ b/entry/src/main/ets/viewmodel/longlist/WaterFlowDescriptionData.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License,Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/features/longList/src/main/ets/model/WaterFlowHeadData.ets b/entry/src/main/ets/viewmodel/longlist/WaterFlowHeadData.ets similarity index 95% rename from features/longList/src/main/ets/model/WaterFlowHeadData.ets rename to entry/src/main/ets/viewmodel/longlist/WaterFlowHeadData.ets index 12b967a5ac38b46a7affa96afd6181298fc53d97..4b037bca493d7ef7170d981159161f11be5bff61 100644 --- a/features/longList/src/main/ets/model/WaterFlowHeadData.ets +++ b/entry/src/main/ets/viewmodel/longlist/WaterFlowHeadData.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License,Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/features/longList/src/main/ets/model/WaterFlowListData.ets b/entry/src/main/ets/viewmodel/longlist/WaterFlowListData.ets similarity index 93% rename from features/longList/src/main/ets/model/WaterFlowListData.ets rename to entry/src/main/ets/viewmodel/longlist/WaterFlowListData.ets index 7dc475e297a2bafc619f7a6d2d82cf0a2a771ab7..e00b9c3c6fe1896fce5d2a3eb1a3c53c184931e5 100644 --- a/features/longList/src/main/ets/model/WaterFlowListData.ets +++ b/entry/src/main/ets/viewmodel/longlist/WaterFlowListData.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,9 +13,9 @@ * limitations under the License. */ -import { NetworkUtil } from '../utils/NetworkUtil'; +import { NetworkUtil } from '../../utils/NetworkUtil'; import { WaterFlowData } from './WaterFlowData'; -import { CommonConstants } from '../constants/CommonConstants'; +import { CommonConstants } from '../../constants/CommonConstants'; export class WaterFlowListData { public dataSource: BasicDataSource = new BasicDataSource(); diff --git a/features/video/src/main/ets/videomanager/AvPlayManager.ets b/entry/src/main/ets/viewmodel/video/AvPlayManager.ets similarity index 85% rename from features/video/src/main/ets/videomanager/AvPlayManager.ets rename to entry/src/main/ets/viewmodel/video/AvPlayManager.ets index aa1731199969acb9af3032c9185f955caafe16c1..b032dd0e39066ca1706e90bee8034d22054facd1 100644 --- a/features/video/src/main/ets/videomanager/AvPlayManager.ets +++ b/entry/src/main/ets/viewmodel/video/AvPlayManager.ets @@ -17,8 +17,8 @@ import { media } from '@kit.MediaKit'; import { resourceManager } from '@kit.LocalizationKit'; import { BusinessError, emitter } from '@kit.BasicServicesKit'; import { common } from '@kit.AbilityKit'; -import Logger from '../utils/Logger'; -import { GlobalContext } from '../utils/GlobalContext'; +import { GlobalContext } from '../../utils/GlobalContext'; +import { hilog } from '@kit.PerformanceAnalysisKit'; const CASE_ZERO = 0; const CASE_ONE = 1; @@ -40,7 +40,8 @@ export default class AvPlayManage { private fileDescriptor: resourceManager.RawFileDescriptor | null = null; private videoSrc: string = ''; private fileSrc: string = ''; - private continue:boolean = false; + private continue: boolean = false; + private isSliderAction: boolean = false; async initPlayer(surfaceId: string, file: string, isContinue: boolean, continueTime: number, callback: (avPlayer: media.AVPlayer) => void): Promise { @@ -67,7 +68,7 @@ export default class AvPlayManage { this.avPlayer.fdSrc = this.fileDescriptor; } }catch(e){ - Logger.error(this.tag, + hilog.error(0x000, 'progress', `setAVPlayerCallback Invoke avPlayer failed, code is ${e.code}, message is ${e.message}`); } } @@ -78,13 +79,13 @@ export default class AvPlayManage { return; } this.avPlayer.on('seekDone', (seekDoneTime) => { - Logger.info(this.tag, `setAVPlayerCallback AVPlayer seek succeeded, seek time is ${seekDoneTime}`); + hilog.info(0x000, 'progress', `setAVPlayerCallback AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }); this.avPlayer.on('error', (err) => { if (this.avPlayer === null) { return; } - Logger.error(this.tag, + hilog.error(0x000, 'progress', `setAVPlayerCallback Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); this.avPlayer.reset(); }); @@ -179,7 +180,11 @@ export default class AvPlayManage { // Listening function for reporting time // [Start time_update] this.avPlayer.on('timeUpdate', (time: number) => { + if (this.isSliderAction) { + return; + } this.currentTime = time; + AppStorage.set('currentTime', this.currentTime) }); // [End time_update] } @@ -197,7 +202,7 @@ export default class AvPlayManage { try { this.avPlayer.play(); } catch (e) { - Logger.error(this.tag, `videoPlay = ${JSON.stringify(e)}`); + hilog.error(0x000, 'progress', `videoPlay = ${JSON.stringify(e)}`); } } } @@ -207,7 +212,7 @@ export default class AvPlayManage { try { this.avPlayer.pause(); } catch (e) { - Logger.info(this.tag, `videoPause== ${JSON.stringify(e)}`); + hilog.info(0x000, 'progress', `videoPause== ${JSON.stringify(e)}`); } } } @@ -216,9 +221,9 @@ export default class AvPlayManage { if (this.avPlayer) { try { this.avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_1_00_X); - Logger.info(this.tag, 'videoSpeed_1_00'); + hilog.info(0x000, 'progress', 'videoSpeed_1_00'); } catch (e) { - Logger.info(this.tag, `videoSpeed_1_00== ${JSON.stringify(e)}`); + hilog.info(0x000, 'progress', `videoSpeed_1_00== ${JSON.stringify(e)}`); } } } @@ -227,9 +232,9 @@ export default class AvPlayManage { if (this.avPlayer) { try { this.avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_1_25_X); - Logger.info(this.tag, 'videoSpeed_1_25'); + hilog.info(0x000, 'progress', 'videoSpeed_1_25'); } catch (e) { - Logger.info(this.tag, `videoSpeed_1_25== ${JSON.stringify(e)}`); + hilog.info(0x000, 'progress', `videoSpeed_1_25== ${JSON.stringify(e)}`); } } } @@ -238,9 +243,9 @@ export default class AvPlayManage { if (this.avPlayer) { try { this.avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_1_75_X); - Logger.info(this.tag, 'videoSpeed_1_75'); + hilog.info(0x000, 'progress', 'videoSpeed_1_75'); } catch (e) { - Logger.info(this.tag, 'videoSpeed_1_75==' + JSON.stringify(e)); + hilog.info(0x000, 'progress', 'videoSpeed_1_75==' + JSON.stringify(e)); } } } @@ -249,9 +254,9 @@ export default class AvPlayManage { if (this.avPlayer) { try { this.avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_2_00_X); - Logger.info(this.tag, `videoSpeed_2_0`); + hilog.info(0x000, 'progress', `videoSpeed_2_0`); } catch (e) { - Logger.info(this.tag, `videoSpeed_2_0== ${JSON.stringify(e)}`); + hilog.info(0x000, 'progress', `videoSpeed_2_0== ${JSON.stringify(e)}`); } } } @@ -260,9 +265,9 @@ export default class AvPlayManage { if ( this.state === 'playing' || this.state === 'paused' || this.state ==='prepared' || this.state ==='completed') { try { this.avPlayer!.seek(seekTime, media.SeekMode.SEEK_CLOSEST); - Logger.info(this.tag, `videoSeek== ${seekTime}`); + hilog.info(0x000, 'progress', `videoSeek== ${seekTime}`); } catch (e) { - Logger.info(this.tag, `videoSeek== ${JSON.stringify(e)}`); + hilog.info(0x000, 'progress', `videoSeek== ${JSON.stringify(e)}`); } } } @@ -280,7 +285,7 @@ export default class AvPlayManage { } this.avPlayer.release((err) => { if (err === null) { - Logger.info(this.tag, 'videoRelease release success'); + hilog.info(0x000, 'progress', 'videoRelease release success'); } }); } @@ -290,10 +295,10 @@ export default class AvPlayManage { this.videoSrc = videoSrc; let timeInterval = AppStorage.get('timeInterval') as number; clearInterval(timeInterval); - Logger.info(this.tag, `videoChoose this.videoSrc = ${this.videoSrc}`); + hilog.info(0x000, 'progress', `videoChoose this.videoSrc = ${this.videoSrc}`); this.videoReset(); } catch (e) { - Logger.info(this.tag, `videoChoose== ${JSON.stringify(e)}`); + hilog.info(0x000, 'progress', `videoChoose== ${JSON.stringify(e)}`); } } @@ -321,4 +326,8 @@ export default class AvPlayManage { this.videoReset(); } } + + sliderAction(isSliderAction: boolean) { + this.isSliderAction = isSliderAction; + } } \ No newline at end of file diff --git a/features/web/src/main/ets/model/ProductModel.ets b/entry/src/main/ets/viewmodel/web/ProductModel.ets similarity index 94% rename from features/web/src/main/ets/model/ProductModel.ets rename to entry/src/main/ets/viewmodel/web/ProductModel.ets index a12969f92f43e708871e981154ee236032f06666..3eda2962ee24cf43b607099010ccab9452eadbc9 100644 --- a/features/web/src/main/ets/model/ProductModel.ets +++ b/entry/src/main/ets/viewmodel/web/ProductModel.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index 313aa6132b97bb2b003cc1cac0b3a5f34c7372f3..1a5592cd3a74bf853ad15d929f65dafcd98046e2 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -1,17 +1,24 @@ +// [Start module_json5] { "module": { + // [StartExclude module_json5] "name": "entry", "type": "entry", "description": "$string:module_desc", "mainElement": "EntryAbility", "deviceTypes": [ - "phone" + "phone", + "tablet", + "2in1" ], "deliveryWithInstall": true, "installationFree": false, "pages": "$profile:main_pages", + "routerMap": "$profile:route_map", + // [EndExclude module_json5] "abilities": [ { + // [StartExclude module_json5] "name": "EntryAbility", "srcEntry": "./ets/entryability/EntryAbility.ets", "description": "$string:EntryAbility_desc", @@ -26,12 +33,15 @@ "entity.system.home" ], "actions": [ - "action.system.home", + "action.system.home" ] } - ] - }, + ], + // [EndExclude module_json5] + "continuable": true + } ], + // [StartExclude module_json5] "extensionAbilities": [ { "name": "EntryBackupAbility", @@ -45,6 +55,30 @@ } ], } - ] + ], + "requestPermissions": [ + { + "name": "ohos.permission.INTERNET", + "reason": "$string:reason_internet", + "usedScene": { + "abilities": [ + "VideoAbility" + ], + "when": "always" + } + }, + { + "name": "ohos.permission.GET_NETWORK_INFO", + "reason": "$string:reason_get_network_info", + "usedScene": { + "abilities": [ + "VideoAbility" + ], + "when": "always" + } + } + ], + // [EndExclude module_json5] } -} \ No newline at end of file +} +// [End module_json5] \ No newline at end of file diff --git a/entry/src/main/resources/base/element/color.json b/entry/src/main/resources/base/element/color.json index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..75ccc23356ec9ec91d6fb26d0702d80bd8675721 100644 --- a/entry/src/main/resources/base/element/color.json +++ b/entry/src/main/resources/base/element/color.json @@ -3,6 +3,58 @@ { "name": "start_window_background", "value": "#FFFFFF" + }, + { + "name": "common_background_2", + "value": "#F7F7F7" + }, + { + "name": "common_background_3", + "value": "#E5E7E9" + }, + { + "name": "function_default_color", + "value": "#CCCCCC" + }, + { + "name": "slider_selected", + "value": "#007DFF" + }, + { + "name": "speed_dialog", + "value": "#33bab4b4" + }, + { + "name": "video_play", + "value": "#333333" + }, + { + "name": "video_play_selected", + "value": "#5c5c5c" + }, + { + "name": "common_bg", + "value": "#F1F3F5" + }, + { + "name": "price_red", + "value": "#E92F4F" + }, + { + "name": "item_title_font", + "value": "#E6000000" + }, + { + "name": "desc_font", + "value": "#99000000" + }, + { + "name": "button_start", + "value": "#F64D43" + }, + { + "name": "button_end", + "value": "#EB344D" } ] } \ No newline at end of file diff --git a/features/longList/src/main/resources/base/element/float.json b/entry/src/main/resources/base/element/float.json similarity index 73% rename from features/longList/src/main/resources/base/element/float.json rename to entry/src/main/resources/base/element/float.json index cf223dd4e456f1825e2069725e8b304dda57e2f5..d9fe33965cbd29f3b2800402bfdb53d54b933a30 100644 --- a/features/longList/src/main/resources/base/element/float.json +++ b/entry/src/main/resources/base/element/float.json @@ -447,6 +447,194 @@ { "name": "water_flow_column_gap", "value": "8" + }, + { + "name": "size_zero_five", + "value": "0.5" + }, + { + "name": "size_zero_six", + "value": "0.6" + }, + { + "name": "size_zero", + "value": "0" + }, + { + "name": "size_1", + "value": "1" + }, + { + "name": "size_5", + "value": "5" + }, + { + "name": "size_10", + "value": "10" + }, + { + "name": "size_12", + "value": "12" + }, + { + "name": "size_15", + "value": "15" + }, + { + "name": "size_16", + "value": "16" + }, + { + "name": "size_18", + "value": "18" + }, + { + "name": "size_20", + "value": "20" + }, + { + "name": "size_down_20", + "value": "-20" + }, + { + "name": "size_24", + "value": "24" + }, + { + "name": "size_25", + "value": "25" + }, + { + "name": "size_30", + "value": "30" + }, + { + "name": "size_32", + "value": "32" + }, + { + "name": "size_35", + "value": "35" + }, + { + "name": "size_40", + "value": "40" + }, + { + "name": "size_45", + "value": "45" + }, + { + "name": "size_48", + "value": "48" + }, + { + "name": "size_50", + "value": "50" + }, + { + "name": "size_64", + "value": "64" + }, + { + "name": "size_75", + "value": "75" + }, + { + "name": "size_80", + "value": "-80" + }, + { + "name": "size_254", + "value": "254" + }, + { + "name": "font_size_sm", + "value": "12fp" + }, + { + "name": "line_height_sm", + "value": "16vp" + }, + { + "name": "font_size_mm", + "value": "14fp" + }, + { + "name": "line_height_mm", + "value": "19vp" + }, + { + "name": "font_size_md", + "value": "18fp" + }, + { + "name": "font_size_lg", + "value": "20fp" + }, + { + "name": "font_size_llg", + "value": "24fp" + }, + { + "name": "more_img_width", + "value": "6vp" + }, + { + "name": "more_img_height", + "value": "12vp" + }, + { + "name": "location_img_size", + "value": "18vp" + }, + { + "name": "ext_item_height", + "value": "20vp" + }, + { + "name": "img_size", + "value": "24vp" + }, + { + "name": "btn_size", + "value": "30vp" + }, + { + "name": "navi_height", + "value": "56vp" + }, + { + "name": "location_info_height", + "value": "64vp" + }, + { + "name": "product_size", + "value": "80vp" + }, + { + "name": "ss_padding_margin", + "value": "4vp" + }, + { + "name": "sm_padding_margin", + "value": "8vp" + }, + { + "name": "md_padding_margin", + "value": "12vp" + }, + { + "name": "lg_padding_margin", + "value": "16vp" + }, + { + "name": "border_radius", + "value": "16vp" + }, + { + "name": "confirm_button_margin_bottom", + "value": "10vp" } ] -} \ No newline at end of file +} diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index cc60ce1199ee3f6d4e9c6d868b2e5e107178295a..9419c7affa43d9630e4967ca83dd5f12b2389b9a 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -27,6 +27,150 @@ { "name": "button3", "value": "Web Continue" + }, + { + "name": "internet_reason", + "value": "Used to access the Internet for the scenario of retrieving network list data" + }, + { + "name": "network_info_reason", + "value": "Used to retrieve network information for the scenario of retrieving network list data" + }, + { + "name": "full_screen", + "value": "100%" + }, + { + "name": "zero_screen", + "value": "0%" + }, + { + "name": "full_screen_20", + "value": "20%" + }, + { + "name": "net_connection_description", + "value": "Unable to connect to the network, please check your network settings" + }, + { + "name": "footer_text_max_count", + "value": "Reached the bottom" + }, + { + "name": "footer_text_loading", + "value": "Loading, please wait a moment" + }, + { + "name": "search", + "value": "search..." + }, + { + "name": "video_res_1", + "value": "test1.mp4" + }, + { + "name": "video_res_2", + "value": "test2.mp4" + }, + { + "name": "video_res_3", + "value": "network.mp4" + }, + { + "name": "video_speed_1_0X", + "value": "1.0X" + }, + { + "name": "video_speed_1_25X", + "value": "1.25X" + }, + { + "name": "video_speed_1_75X", + "value": "1.75X" + }, + { + "name": "video_speed_2_0X", + "value": "2.0X" + }, + { + "name": "video_warn", + "value": "Please check if the network is connected or available!" + }, + { + "name": "dialog_cancel", + "value": "Cancel" + }, + { + "name": "dialog_play_speed", + "value": "Playback speed" + }, + { + "name": "playing", + "value": "Playing" + }, + { + "name": "reason_internet", + "value": "Used for accessing the Internet during video playback" + }, + { + "name": "reason_get_network_info", + "value": "Used for retrieving network information during video playback" + }, + { + "name": "click_change", + "value": "Click Change" + }, + { + "name": "video_title", + "value": "Video Continue" + }, + { + "name": "toast_msg", + "value": "This function is not developed yet. Please look forward to it." + }, + { + "name": "confirm_order", + "value": "Confirm the order" + }, + { + "name": "dollar", + "value": "¥%d" + }, + { + "name": "invoice", + "value": "Invoice" + }, + { + "name": "personal_invoice", + "value": "Electronic Free Text Invoice - Personal" + }, + { + "name": "delivery", + "value": "Delivery" + }, + { + "name": "standard_delivery", + "value": "Standard Delivery" + }, + { + "name": "self_operated", + "value": "Mall self-operated" + }, + { + "name": "user_name", + "value": "Zhang XX" + }, + { + "name": "user_phone", + "value": "185 xxxx xxxx" + }, + { + "name": "user_address", + "value": "Room XX, Unit XX, XX Building, XXX Community, Haidian District, Beijing" + }, + { + "name": "tittle", + "value": "Web Continue" } ] } \ No newline at end of file diff --git a/features/longList/src/main/resources/base/media/V.svg b/entry/src/main/resources/base/media/V.svg similarity index 100% rename from features/longList/src/main/resources/base/media/V.svg rename to entry/src/main/resources/base/media/V.svg diff --git a/features/longList/src/main/resources/base/media/arrow_right.svg b/entry/src/main/resources/base/media/arrow_right.svg similarity index 100% rename from features/longList/src/main/resources/base/media/arrow_right.svg rename to entry/src/main/resources/base/media/arrow_right.svg diff --git a/features/longList/src/main/resources/base/media/arrow_right_living_play.svg b/entry/src/main/resources/base/media/arrow_right_living_play.svg similarity index 100% rename from features/longList/src/main/resources/base/media/arrow_right_living_play.svg rename to entry/src/main/resources/base/media/arrow_right_living_play.svg diff --git a/features/longList/src/main/resources/base/media/arrow_right_play.svg b/entry/src/main/resources/base/media/arrow_right_play.svg similarity index 100% rename from features/longList/src/main/resources/base/media/arrow_right_play.svg rename to entry/src/main/resources/base/media/arrow_right_play.svg diff --git a/features/longList/src/main/resources/base/media/back.png b/entry/src/main/resources/base/media/back.png similarity index 100% rename from features/longList/src/main/resources/base/media/back.png rename to entry/src/main/resources/base/media/back.png diff --git a/entry/src/main/resources/base/media/background.png b/entry/src/main/resources/base/media/background.png index f939c9fa8cc8914832e602198745f592a0dfa34d..923f2b3f27e915d6871871deea0420eb45ce102f 100644 Binary files a/entry/src/main/resources/base/media/background.png and b/entry/src/main/resources/base/media/background.png differ diff --git a/features/longList/src/main/resources/base/media/default_image.png b/entry/src/main/resources/base/media/default_image.png similarity index 100% rename from features/longList/src/main/resources/base/media/default_image.png rename to entry/src/main/resources/base/media/default_image.png diff --git a/entry/src/main/resources/base/media/foreground.png b/entry/src/main/resources/base/media/foreground.png index 4483ddad1f079e1089d685bd204ee1cfe1d01902..97014d3e10e5ff511409c378cd4255713aecd85f 100644 Binary files a/entry/src/main/resources/base/media/foreground.png and b/entry/src/main/resources/base/media/foreground.png differ diff --git a/features/web/src/main/resources/base/media/ic_avatar.svg b/entry/src/main/resources/base/media/ic_avatar.svg similarity index 100% rename from features/web/src/main/resources/base/media/ic_avatar.svg rename to entry/src/main/resources/base/media/ic_avatar.svg diff --git a/features/video/src/main/resources/base/media/back.png b/entry/src/main/resources/base/media/ic_back.png similarity index 100% rename from features/video/src/main/resources/base/media/back.png rename to entry/src/main/resources/base/media/ic_back.png diff --git a/features/web/src/main/resources/base/media/ic_back_off.svg b/entry/src/main/resources/base/media/ic_back_off.svg similarity index 100% rename from features/web/src/main/resources/base/media/ic_back_off.svg rename to entry/src/main/resources/base/media/ic_back_off.svg diff --git a/features/web/src/main/resources/base/media/ic_back_on.svg b/entry/src/main/resources/base/media/ic_back_on.svg similarity index 100% rename from features/web/src/main/resources/base/media/ic_back_on.svg rename to entry/src/main/resources/base/media/ic_back_on.svg diff --git a/entry/src/main/resources/base/media/ic_heart.svg b/entry/src/main/resources/base/media/ic_heart.svg new file mode 100644 index 0000000000000000000000000000000000000000..b445a940d9a7459cef70472920b53aa1bc54d2e6 --- /dev/null +++ b/entry/src/main/resources/base/media/ic_heart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/features/web/src/main/resources/base/media/ic_home.svg b/entry/src/main/resources/base/media/ic_home.svg similarity index 100% rename from features/web/src/main/resources/base/media/ic_home.svg rename to entry/src/main/resources/base/media/ic_home.svg diff --git a/features/web/src/main/resources/base/media/ic_location.svg b/entry/src/main/resources/base/media/ic_location.svg similarity index 100% rename from features/web/src/main/resources/base/media/ic_location.svg rename to entry/src/main/resources/base/media/ic_location.svg diff --git a/features/web/src/main/resources/base/media/ic_more.svg b/entry/src/main/resources/base/media/ic_more.svg similarity index 100% rename from features/web/src/main/resources/base/media/ic_more.svg rename to entry/src/main/resources/base/media/ic_more.svg diff --git a/features/web/src/main/resources/base/media/ic_next_off.svg b/entry/src/main/resources/base/media/ic_next_off.svg similarity index 100% rename from features/web/src/main/resources/base/media/ic_next_off.svg rename to entry/src/main/resources/base/media/ic_next_off.svg diff --git a/features/web/src/main/resources/base/media/ic_next_on.svg b/entry/src/main/resources/base/media/ic_next_on.svg similarity index 100% rename from features/web/src/main/resources/base/media/ic_next_on.svg rename to entry/src/main/resources/base/media/ic_next_on.svg diff --git a/features/longList/src/main/resources/base/media/ic_public_class.png b/entry/src/main/resources/base/media/ic_public_class.png similarity index 100% rename from features/longList/src/main/resources/base/media/ic_public_class.png rename to entry/src/main/resources/base/media/ic_public_class.png diff --git a/features/longList/src/main/resources/base/media/ic_public_discover.png b/entry/src/main/resources/base/media/ic_public_discover.png similarity index 100% rename from features/longList/src/main/resources/base/media/ic_public_discover.png rename to entry/src/main/resources/base/media/ic_public_discover.png diff --git a/features/longList/src/main/resources/base/media/ic_public_heart.png b/entry/src/main/resources/base/media/ic_public_heart.png similarity index 100% rename from features/longList/src/main/resources/base/media/ic_public_heart.png rename to entry/src/main/resources/base/media/ic_public_heart.png diff --git a/features/longList/src/main/resources/base/media/ic_public_home_filled.png b/entry/src/main/resources/base/media/ic_public_home_filled.png similarity index 100% rename from features/longList/src/main/resources/base/media/ic_public_home_filled.png rename to entry/src/main/resources/base/media/ic_public_home_filled.png diff --git a/features/longList/src/main/resources/base/media/ic_public_input_search.svg b/entry/src/main/resources/base/media/ic_public_input_search.svg similarity index 100% rename from features/longList/src/main/resources/base/media/ic_public_input_search.svg rename to entry/src/main/resources/base/media/ic_public_input_search.svg diff --git a/features/longList/src/main/resources/base/media/ic_public_mine.png b/entry/src/main/resources/base/media/ic_public_mine.png similarity index 100% rename from features/longList/src/main/resources/base/media/ic_public_mine.png rename to entry/src/main/resources/base/media/ic_public_mine.png diff --git a/features/longList/src/main/resources/base/media/ic_public_search.svg b/entry/src/main/resources/base/media/ic_public_search.svg similarity index 100% rename from features/longList/src/main/resources/base/media/ic_public_search.svg rename to entry/src/main/resources/base/media/ic_public_search.svg diff --git a/features/longList/src/main/resources/base/media/ic_public_shopping.png b/entry/src/main/resources/base/media/ic_public_shopping.png similarity index 100% rename from features/longList/src/main/resources/base/media/ic_public_shopping.png rename to entry/src/main/resources/base/media/ic_public_shopping.png diff --git a/features/video/src/main/resources/base/media/ic_radio.png b/entry/src/main/resources/base/media/ic_radio.png similarity index 100% rename from features/video/src/main/resources/base/media/ic_radio.png rename to entry/src/main/resources/base/media/ic_radio.png diff --git a/features/video/src/main/resources/base/media/ic_radio_selected.svg b/entry/src/main/resources/base/media/ic_radio_selected.svg similarity index 100% rename from features/video/src/main/resources/base/media/ic_radio_selected.svg rename to entry/src/main/resources/base/media/ic_radio_selected.svg diff --git a/features/video/src/main/resources/base/media/ic_screen_switch.svg b/entry/src/main/resources/base/media/ic_screen_switch.svg similarity index 100% rename from features/video/src/main/resources/base/media/ic_screen_switch.svg rename to entry/src/main/resources/base/media/ic_screen_switch.svg diff --git a/features/video/src/main/resources/base/media/ic_video_back.svg b/entry/src/main/resources/base/media/ic_video_back.svg similarity index 100% rename from features/video/src/main/resources/base/media/ic_video_back.svg rename to entry/src/main/resources/base/media/ic_video_back.svg diff --git a/features/video/src/main/resources/base/media/ic_video_list.svg b/entry/src/main/resources/base/media/ic_video_list.svg similarity index 100% rename from features/video/src/main/resources/base/media/ic_video_list.svg rename to entry/src/main/resources/base/media/ic_video_list.svg diff --git a/features/video/src/main/resources/base/media/ic_video_list_down.svg b/entry/src/main/resources/base/media/ic_video_list_down.svg similarity index 100% rename from features/video/src/main/resources/base/media/ic_video_list_down.svg rename to entry/src/main/resources/base/media/ic_video_list_down.svg diff --git a/features/video/src/main/resources/base/media/ic_video_list_up.svg b/entry/src/main/resources/base/media/ic_video_list_up.svg similarity index 100% rename from features/video/src/main/resources/base/media/ic_video_list_up.svg rename to entry/src/main/resources/base/media/ic_video_list_up.svg diff --git a/features/video/src/main/resources/base/media/ic_video_pause.svg b/entry/src/main/resources/base/media/ic_video_pause.svg similarity index 100% rename from features/video/src/main/resources/base/media/ic_video_pause.svg rename to entry/src/main/resources/base/media/ic_video_pause.svg diff --git a/features/video/src/main/resources/base/media/ic_video_play.svg b/entry/src/main/resources/base/media/ic_video_play.svg similarity index 100% rename from features/video/src/main/resources/base/media/ic_video_play.svg rename to entry/src/main/resources/base/media/ic_video_play.svg diff --git a/features/video/src/main/resources/base/media/ic_video_view_list.svg b/entry/src/main/resources/base/media/ic_video_view_list.svg similarity index 100% rename from features/video/src/main/resources/base/media/ic_video_view_list.svg rename to entry/src/main/resources/base/media/ic_video_view_list.svg diff --git a/features/video/src/main/resources/base/media/icon.png b/entry/src/main/resources/base/media/icon.png similarity index 100% rename from features/video/src/main/resources/base/media/icon.png rename to entry/src/main/resources/base/media/icon.png diff --git a/features/video/src/main/resources/base/media/list.png b/entry/src/main/resources/base/media/list.png similarity index 100% rename from features/video/src/main/resources/base/media/list.png rename to entry/src/main/resources/base/media/list.png diff --git a/features/longList/src/main/resources/base/media/moon.png b/entry/src/main/resources/base/media/moon.png similarity index 100% rename from features/longList/src/main/resources/base/media/moon.png rename to entry/src/main/resources/base/media/moon.png diff --git a/features/longList/src/main/resources/base/media/people.svg b/entry/src/main/resources/base/media/people.svg similarity index 100% rename from features/longList/src/main/resources/base/media/people.svg rename to entry/src/main/resources/base/media/people.svg diff --git a/features/longList/src/main/resources/base/media/tab_home.svg b/entry/src/main/resources/base/media/tab_home.svg similarity index 100% rename from features/longList/src/main/resources/base/media/tab_home.svg rename to entry/src/main/resources/base/media/tab_home.svg diff --git a/features/longList/src/main/resources/base/media/tab_home_selected.svg b/entry/src/main/resources/base/media/tab_home_selected.svg similarity index 100% rename from features/longList/src/main/resources/base/media/tab_home_selected.svg rename to entry/src/main/resources/base/media/tab_home_selected.svg diff --git a/features/longList/src/main/resources/base/media/tab_item_normal.svg b/entry/src/main/resources/base/media/tab_item_normal.svg similarity index 100% rename from features/longList/src/main/resources/base/media/tab_item_normal.svg rename to entry/src/main/resources/base/media/tab_item_normal.svg diff --git a/entry/src/main/resources/base/profile/route_map.json b/entry/src/main/resources/base/profile/route_map.json new file mode 100644 index 0000000000000000000000000000000000000000..c405ce1562d579b0038e20b72814ad4e80c84078 --- /dev/null +++ b/entry/src/main/resources/base/profile/route_map.json @@ -0,0 +1,28 @@ +{ + "routerMap": [ + { + "name": "LongListPage", + "pageSourceFile": "src/main/ets/view/longlist/LongListPageComponent.ets", + "buildFunction": "LongListPageComponentBuilder", + "data": { + "description": "this is LongListPageComponent" + } + }, + { + "name": "VideoPage", + "pageSourceFile": "src/main/ets/view/video/VideoPageComponent.ets", + "buildFunction": "VideoPageComponentBuilder", + "data": { + "description": "this is VideoPageComponent" + } + }, + { + "name": "WebPageComponent", + "pageSourceFile": "src/main/ets/view/web/WebPageComponent.ets", + "buildFunction": "WebPageComponentBuilder", + "data": { + "description": "this is WebPageComponent" + } + } + ] +} \ No newline at end of file diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index cc60ce1199ee3f6d4e9c6d868b2e5e107178295a..f6285109dd39337a71ec2ac48d7e3cab5f309fbe 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -27,6 +27,150 @@ { "name": "button3", "value": "Web Continue" + }, + { + "name": "full_screen", + "value": "100%" + }, + { + "name": "full_screen_20", + "value": "20%" + }, + { + "name": "internet_reason", + "value": "Used to access the Internet for the scenario of retrieving network list data" + }, + { + "name": "network_info_reason", + "value": "Used to retrieve network information for the scenario of retrieving network list data" + }, + { + "name": "zero_screen", + "value": "0%" + }, + { + "name": "search", + "value": "search..." + }, + { + "name": "footer_text_loading", + "value": "Loading, please wait a moment" + }, + { + "name": "net_connection_description", + "value": "Unable to connect to the network, please check your network settings" + }, + { + "name": "footer_text_max_count", + "value": "Reached the bottom" + }, + { + "name": "video_res_1", + "value": "test1.mp4" + }, + { + "name": "video_res_2", + "value": "test2.mp4" + }, + { + "name": "video_res_3", + "value": "network.mp4" + }, + { + "name": "video_speed_1_0X", + "value": "1.0X" + }, + { + "name": "video_speed_1_25X", + "value": "1.25X" + }, + { + "name": "video_speed_1_75X", + "value": "1.75X" + }, + { + "name": "video_speed_2_0X", + "value": "2.0X" + }, + { + "name": "video_warn", + "value": "Please check if the network is connected or available!" + }, + { + "name": "dialog_cancel", + "value": "Cancel" + }, + { + "name": "dialog_play_speed", + "value": "Playback speed" + }, + { + "name": "playing", + "value": "Playing" + }, + { + "name": "reason_internet", + "value": "Used for accessing the Internet during video playback" + }, + { + "name": "reason_get_network_info", + "value": "Used for retrieving network information during video playback" + }, + { + "name": "click_change", + "value": "Click Change" + }, + { + "name": "video_title", + "value": "Video Continue" + }, + { + "name": "toast_msg", + "value": "This function is not developed yet. Please look forward to it." + }, + { + "name": "confirm_order", + "value": "Confirm the order" + }, + { + "name": "dollar", + "value": "¥%d" + }, + { + "name": "invoice", + "value": "Invoice" + }, + { + "name": "personal_invoice", + "value": "Electronic Free Text Invoice - Personal" + }, + { + "name": "delivery", + "value": "Delivery" + }, + { + "name": "standard_delivery", + "value": "Standard Delivery" + }, + { + "name": "self_operated", + "value": "Mall self-operated" + }, + { + "name": "user_name", + "value": "Zhang XX" + }, + { + "name": "user_phone", + "value": "185 xxxx xxxx" + }, + { + "name": "user_address", + "value": "Room XX, Unit XX, XX Building, XXX Community, Haidian District, Beijing" + }, + { + "name": "tittle", + "value": "Web Continue" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/imgs/ic_1.png b/entry/src/main/resources/rawfile/imgs/ic_1.png new file mode 100644 index 0000000000000000000000000000000000000000..e6e9c9fa24cb3fddd2cce49e398f661582da927c Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_1.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_10.png b/entry/src/main/resources/rawfile/imgs/ic_10.png new file mode 100644 index 0000000000000000000000000000000000000000..1f3a94a81d406cd7b6e1c582ec51ac0d3f20082b Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_10.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_11.png b/entry/src/main/resources/rawfile/imgs/ic_11.png new file mode 100644 index 0000000000000000000000000000000000000000..d13d60f2af8c8d73b1019c3a6a0acf166e5395da Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_11.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_12.png b/entry/src/main/resources/rawfile/imgs/ic_12.png new file mode 100644 index 0000000000000000000000000000000000000000..2550b1f5e65910f731a72a7ff98ba351fb119545 Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_12.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_13.png b/entry/src/main/resources/rawfile/imgs/ic_13.png new file mode 100644 index 0000000000000000000000000000000000000000..2062cb0a1bbbe69126ac1851052064aa2fa3bd3a Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_13.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_14.png b/entry/src/main/resources/rawfile/imgs/ic_14.png new file mode 100644 index 0000000000000000000000000000000000000000..a1852a4d2101956d2b8969b026ab62aedff32b80 Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_14.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_15.png b/entry/src/main/resources/rawfile/imgs/ic_15.png new file mode 100644 index 0000000000000000000000000000000000000000..b1143646120a8a61e1b331ce54b142770176b8a4 Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_15.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_2.png b/entry/src/main/resources/rawfile/imgs/ic_2.png new file mode 100644 index 0000000000000000000000000000000000000000..e21569dc30d8a3c6dcacfabc205485b4066e3fa9 Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_2.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_3.png b/entry/src/main/resources/rawfile/imgs/ic_3.png new file mode 100644 index 0000000000000000000000000000000000000000..9d8359d4106a05e8e62f13a930d854565a84aa07 Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_3.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_4.png b/entry/src/main/resources/rawfile/imgs/ic_4.png new file mode 100644 index 0000000000000000000000000000000000000000..7c993a12dff3bafdedac31d5545ddec03c932a41 Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_4.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_5.png b/entry/src/main/resources/rawfile/imgs/ic_5.png new file mode 100644 index 0000000000000000000000000000000000000000..d54f13c6185100d470a4b8345c759ba0eb24389c Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_5.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_6.png b/entry/src/main/resources/rawfile/imgs/ic_6.png new file mode 100644 index 0000000000000000000000000000000000000000..451fe509517312a070cbfba043da95d6d6bef113 Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_6.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_7.png b/entry/src/main/resources/rawfile/imgs/ic_7.png new file mode 100644 index 0000000000000000000000000000000000000000..db04f3ad9fc1a63d5ce47ba87777930a5743df0d Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_7.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_8.png b/entry/src/main/resources/rawfile/imgs/ic_8.png new file mode 100644 index 0000000000000000000000000000000000000000..7a530109f99bbd4cdda45b936c63b5baaddbf4e1 Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_8.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_9.png b/entry/src/main/resources/rawfile/imgs/ic_9.png new file mode 100644 index 0000000000000000000000000000000000000000..33410003b897f5f1bbe1ade0eb5bf6b16d221883 Binary files /dev/null and b/entry/src/main/resources/rawfile/imgs/ic_9.png differ diff --git a/entry/src/main/resources/rawfile/imgs/ic_heart.svg b/entry/src/main/resources/rawfile/imgs/ic_heart.svg new file mode 100644 index 0000000000000000000000000000000000000000..c1ea3a82d4c4911c6de12315b2d63d71b827701a --- /dev/null +++ b/entry/src/main/resources/rawfile/imgs/ic_heart.svg @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/imgs/ic_heart_dark.svg b/entry/src/main/resources/rawfile/imgs/ic_heart_dark.svg new file mode 100644 index 0000000000000000000000000000000000000000..175b392b9706aae339636819f7a26ab6ec16afa7 --- /dev/null +++ b/entry/src/main/resources/rawfile/imgs/ic_heart_dark.svg @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/imgs/ic_service.svg b/entry/src/main/resources/rawfile/imgs/ic_service.svg new file mode 100644 index 0000000000000000000000000000000000000000..420b3d3fac1435f7a124abe9612d775252dad542 --- /dev/null +++ b/entry/src/main/resources/rawfile/imgs/ic_service.svg @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/imgs/ic_service_dark.svg b/entry/src/main/resources/rawfile/imgs/ic_service_dark.svg new file mode 100644 index 0000000000000000000000000000000000000000..7d8c6939177e01863185c5e61c808a88d95c2d4e --- /dev/null +++ b/entry/src/main/resources/rawfile/imgs/ic_service_dark.svg @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/imgs/ic_shopping.svg b/entry/src/main/resources/rawfile/imgs/ic_shopping.svg new file mode 100644 index 0000000000000000000000000000000000000000..c395561ea488cea34cd0d2afde31fbdfcf72731f --- /dev/null +++ b/entry/src/main/resources/rawfile/imgs/ic_shopping.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/imgs/ic_shopping_dark.svg b/entry/src/main/resources/rawfile/imgs/ic_shopping_dark.svg new file mode 100644 index 0000000000000000000000000000000000000000..cfdaa5fe06768ad6b366d9d5b8a9687bad11485d --- /dev/null +++ b/entry/src/main/resources/rawfile/imgs/ic_shopping_dark.svg @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/js/product_detail.js b/entry/src/main/resources/rawfile/js/product_detail.js new file mode 100644 index 0000000000000000000000000000000000000000..7f53ab9a30494a2044ac0e90c519467c4a9b5af5 --- /dev/null +++ b/entry/src/main/resources/rawfile/js/product_detail.js @@ -0,0 +1,151 @@ +let productList = [{ + 'id': 1, + 'img': 'imgs/ic_1.png', + 'price': 4488 + }, + { + 'id': 2, + 'img': 'imgs/ic_2.png', + 'price': 4488 + }, + { + 'id': 3, + 'img': 'imgs/ic_3.png', + 'price': 4488 + }, + { + 'id': 4, + 'img': 'imgs/ic_4.png', + 'price': 4488 + }, + { + 'id': 5, + 'img': 'imgs/ic_5.png', + 'price': 4488 + }, + { + 'id': 6, + 'img': 'imgs/ic_6.png', + 'price': 4488 + }, + { + 'id': 7, + 'img': 'imgs/ic_7.png', + 'price': 4488 + }, + { + 'id': 8, + 'img': 'imgs/ic_8.png', + 'price': 4488 + }, + { + 'id': 9, + 'img': 'imgs/ic_9.png', + 'price': 4488 + }, + { + 'id': 10, + 'img': 'imgs/ic_10.png', + 'price': 4488 + }, + { + 'id': 11, + 'img': 'imgs/ic_11.png', + 'price': 4488 + }, + { + 'id': 12, + 'img': 'imgs/ic_12.png', + 'price': 4488 + }, + { + 'id': 13, + 'img': 'imgs/ic_13.png', + 'price': 4488 + }, + { + 'id': 14, + 'img': 'imgs/ic_14.png', + 'price': 4488 + }, + { + 'id': 15, + 'img': 'imgs/ic_15.png', + 'price': 4488 + } +]; + +let urlSearchParams = new URLSearchParams(window.location.search); +let productIndex = urlSearchParams.get('index'); +let topHeight = urlSearchParams.get('topHeight'); +let bottomHeight = urlSearchParams.get('bottomHeight'); +let productDetail = productList[productIndex]; +let swiperStr = '
'; +for (let i = 0; i < 4; i++) { + swiperStr += '
'; +} + +document.getElementById('swiper').innerHTML = swiperStr; +document.getElementById('price').innerHTML = '¥ ' + productDetail.price; + +if (window.screen.width >= 840) { + document.getElementById('product-desc').style.paddingTop = Number.parseInt(topHeight) + 'px'; +} else { + document.getElementById('slider').style.paddingTop = topHeight + 'px'; +} + + +const itemCount = 5; +let currentIndex = 0; +const slider = document.querySelector('#swiper'); + +let sliderItems = slider.getElementsByClassName('imgDiv'); + +let firstItem = sliderItems[0].cloneNode(true); +let lastItem = sliderItems[sliderItems.length - 1].cloneNode(true); +slider.appendChild(firstItem); +slider.prepend(lastItem); + +if (window.screen.width > 600 && window.screen.width < 840) { + slider.style.transform = `translateX(-25%)`; +} +function autoScroll() { + let sliderItemWidth = sliderItems[0].offsetWidth; + currentIndex++; + debugger; + + if (slider.clientWidth > 600 && slider.clientWidth < 840) { + slider.style.transform = `translateX(-${currentIndex * 50 + 25}%)`; + } else { + slider.style.transform = `translateX(-${currentIndex * sliderItemWidth}px)`; + } + + if (currentIndex === itemCount) { + setTimeout(() => { + slider.style.transition = 'none'; + slider.style.transform = 'translateX(0)'; + currentIndex = 0; + void slider.offsetWidth; + slider.style.transition = 'transform 0.5s ease-in-out'; + }, 500); + } +} + +setInterval(autoScroll, 2000); + +window.addEventListener('resize', () => { + document.getElementById('product-desc').style.paddingTop = Number.parseInt(topHeight) + 'px'; +}); + +function orderConfirm() { + arkTSFunObj.jumpOrderConfirm(JSON.stringify(productDetail)); +} + +function setLanguage(lastLang) { + if (lastLang.includes('zh')) { + document.getElementById('btn-to-buy').innerHTML = '购买'; + } else { + document.getElementById('btn-add-cart').innerHTML = 'Add to Cart'; + document.getElementById('btn-to-buy').innerHTML = 'Buy'; + } +} \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/js/product_list.js b/entry/src/main/resources/rawfile/js/product_list.js new file mode 100644 index 0000000000000000000000000000000000000000..bfae6889cc515b7c0c51db83abef689b32d62048 --- /dev/null +++ b/entry/src/main/resources/rawfile/js/product_list.js @@ -0,0 +1,117 @@ +let productList = [{ + 'id': 1, + 'img': 'imgs/ic_1.png', + 'price': 4488 + }, + { + 'id': 2, + 'img': 'imgs/ic_2.png', + 'price': 4488 + }, + { + 'id': 3, + 'img': 'imgs/ic_3.png', + 'price': 4488 + }, + { + 'id': 4, + 'img': 'imgs/ic_4.png', + 'price': 4488 + }, + { + 'id': 5, + 'img': 'imgs/ic_5.png', + 'price': 4488 + }, + { + 'id': 6, + 'img': 'imgs/ic_6.png', + 'price': 4488 + }, + { + 'id': 7, + 'img': 'imgs/ic_7.png', + 'price': 4488 + }, + { + 'id': 8, + 'img': 'imgs/ic_8.png', + 'price': 4488 + }, + { + 'id': 9, + 'img': 'imgs/ic_9.png', + 'price': 4488 + }, + { + 'id': 10, + 'img': 'imgs/ic_10.png', + 'price': 4488 + }, + { + 'id': 11, + 'img': 'imgs/ic_11.png', + 'price': 4488 + }, + { + 'id': 12, + 'img': 'imgs/ic_12.png', + 'price': 4488 + }, + { + 'id': 13, + 'img': 'imgs/ic_13.png', + 'price': 4488 + }, + { + 'id': 14, + 'img': 'imgs/ic_14.png', + 'price': 4488 + }, + { + 'id': 15, + 'img': 'imgs/ic_15.png', + 'price': 4488 + } +]; +let topHeight = 0; +let bottomHeight = 0; + +function setTopHeight(topHeightFromArkTs, bottomHeightFromArkTs) { + topHeight = topHeightFromArkTs; + bottomHeight = bottomHeightFromArkTs; + document.getElementById('nav').style.marginTop = topHeight + 'px'; + document.getElementById('productList').style.paddingBottom = bottomHeightFromArkTs + 56 + 'px'; +} + +function addProductList() { + let list = ''; + for (let i = 0; i < productList.length; i++) { + list += `
  • `; + list += ``; + list += '
    '; + list += `

    `; + list += `

    `; + list += `¥ ${productList[i].price}`; + list += '
    '; + list += '
  • '; + + let tmp = document.getElementById('productList'); + tmp.innerHTML = list; + } +} + +function setLanguage(lastLang) { + if (lastLang.includes('zh')) { + document.getElementById('nav').innerHTML = '精选好物'; + } else { + document.getElementById('nav').innerHTML = 'Prime Goods'; + } +} + +addProductList(); + +function jumpDetail(index) { + window.location.href = 'product_detail.html?index=' + index + '&topHeight=' + topHeight + '&bottomHeight=' + + bottomHeight; +} \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/product_detail.html b/entry/src/main/resources/rawfile/product_detail.html new file mode 100644 index 0000000000000000000000000000000000000000..63bc6bd578f0cc54c5feea7e690aaad93b2b77af --- /dev/null +++ b/entry/src/main/resources/rawfile/product_detail.html @@ -0,0 +1,78 @@ + + + + + + + + The Canavas Danmu Wall + + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    + 05 + : + 12 + : + 12 +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/product_list.html b/entry/src/main/resources/rawfile/product_list.html new file mode 100644 index 0000000000000000000000000000000000000000..e45436e1bd5104909723dbceac19a0a0d0d2571d --- /dev/null +++ b/entry/src/main/resources/rawfile/product_list.html @@ -0,0 +1,17 @@ + + + + + + + + The Canavas Danmu Wall + + +
    +
      +
    +
    + + + \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/style/common.css b/entry/src/main/resources/rawfile/style/common.css new file mode 100644 index 0000000000000000000000000000000000000000..a837e31508f1863f9073562eed644358fd42ccba --- /dev/null +++ b/entry/src/main/resources/rawfile/style/common.css @@ -0,0 +1,39 @@ +:root { + --background_primary: #ffffffff; + --background-secondary: #f1f3f5ff; + --background_tertiary: #e5e5eaff; + --background_fourth: #d1d1d6ff; + --comp_background_primary: #ffffffff; + --comp_background_secondary: #00000019; + --comp_background_tertiary: #0000000c; + --font_primary: #000000e5; + --font_secondary: #00000099; + --font_tertiary: #00000066; + --font_color_red: #CF0A2C; + --btn_backgournd_red: #CF0A2C; + --font_on_primary: #ffffff; +} + +@media (prefers-color-scheme: dark) { + :root { + --background_primary: #000000ff; + --background-secondary: #000000ff; + --background_tertiary: #202224ff; + --background_fourth: #2e3033ff; + --comp_background_primary: #202224ff; + --comp_background_secondary: #ffffff19; + --comp_background_tertiary: #ffffff0c; + --font_primary: #ffffffe5; + --font_secondary: #ffffff66; + --font_color_red: #8B001C; + --btn_backgournd_red: #8B001C; + --font_on_primary: #E0E0E0; + } +} + +@media (prefers-color-scheme: dark) { + img { + filter: brightness(0.8) contrast(1.2) invert(0.1); + + } +} \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/style/product_detail.css b/entry/src/main/resources/rawfile/style/product_detail.css new file mode 100644 index 0000000000000000000000000000000000000000..10eba094fb272de985a9cb16899a1b6b5ebd8a7c --- /dev/null +++ b/entry/src/main/resources/rawfile/style/product_detail.css @@ -0,0 +1,379 @@ +body { + margin: 0; +} + +@media (320px <=width < 600px) { + .imgDiv { + flex: 0 0 100vw; + width: 100vw; + height: 275; + } + + #slider { + width: 100vw; + } + + #swiper>div>img { + height: 270px; + width: 270px; + } + + #swiper { + height: 275px; + } + + .info { + margin: 16px; + } + + .custom-margin-left { + margin-left: 16px; + } + + .custom-margin-right { + margin-right: 16px; + } + + #btn-add-cart { + width: 112px; + } + + #btn-to-buy { + width: 128px; + } + + #menu { + width: 100vw; + } + + #detail-info { + flex-direction: column; + } + + .custom-padding { + padding: 0 16px; + } + + #dot { + right: 20px; + bottom: 16px; + } +} + +@media (600px <=width < 840px) { + .imgDiv { + min-width: 50%; + height: 275px; + } + + #swiper>div>img { + height: 270px; + width: 270px; + } + + #swiper { + height: 275px; + } + + .info { + margin: 24px; + } + + #btn-add-cart, + #btn-to-buy { + width: 214px; + } + + .custom-margin-left { + margin-left: 24px; + } + + .custom-margin-right { + margin-right: 24px; + } + + #menu { + width: 100vw; + } + + #detail-info { + flex-direction: column; + width: 100vw; + } + + #slider { + width: 100vw; + } + + .custom-padding { + padding: 0 24px; + } + + #dot { + right: 20px; + bottom: 16px; + } +} + +@media (840px <=width) { + .imgDiv { + /* flex: 0 0 '100%'; + width: '100%'; + position: relative; */ + width: 50vw; + height: 100vh; + line-height: 100vh; + position: relative; + display: flex; + justify-content: center; + align-items: center; + } + + #swiper>div>img { + width: 50vw; + height: 50vw; + display: block; + vertical-align: middle; + } + + #btn-add-cart, + #btn-to-buy { + width: 180px; + } + + .custom-margin-left { + margin-left: 32px; + } + + .custom-margin-right { + margin-right: 32px; + } + + #menu { + width: 50vw; + } + + #detail-info { + flex-direction: row; + } + + #slider { + width: 50vw; + } + + .info { + width: '100%'; + margin-top: 16px; + } + + #product-desc { + width: 50vw; + padding-left: 32px; + padding-right: 32px; + box-sizing: border-box; + margin-top: 36px; + } + + .custom-padding { + padding: 0 32px; + } + + #dot { + right: 30px; + bottom: 5vh; + } +} + +#detail { + width: 100vw; + height: 100vh; + background-color: var(--background-secondary); + display: flex; + flex-direction: column; + justify-content: space-between; +} + +#detail-info { + flex: 1; + overflow: scroll; + display: flex; +} + +#slider { + position: relative; + background-color: var(--comp_background_primary); + overflow: hidden; +} + +#swiper { + position: relative; + background-color: var(--comp_background_primary); + display: flex; + transition: transform 0.5s ease-in-out; +} + +.imgDiv { + display: flex; + justify-content: center; + align-items: center; + height: '100%'; + transition: transform 0.5s ease-in-out; +} + +#swiper>div>img { + object-fit: cover; +} + +#dot { + position: absolute; + /* right: 20px; + bottom: 12px; */ + width: 36px; + height: 18px; + border-radius: 9px; + background-color: rgba(0, 0, 0, 0.05); + color: rgba(0, 0, 0, 0.9); + text-align: center; + font-size: 12px; + line-height: 18px; + font-weight: 400; +} + +.info { + display: flex; + flex-direction: column; + background-color: var(--comp_background_primary); + border-radius: 16px; + padding: 12px; + color: var(--font_primary); +} + +#price-div { + display: flex; + flex-direction: row; + background-color: var(--btn_backgournd_red); + justify-content: space-between; + align-items: center; + height: 54px; + border-radius: 8px; + padding: 8px; +} + +#price { + font-size: 20px; + color: var(--font_on_primary); + line-height: 28px; + font-weight: 500; +} + +#price>span { + font-size: 14px; +} + +.custom-radius { + background-color: rgba(0, 0, 0, 0.05); + border-radius: 12px; + height: 14px; +} + +.custom-radius-red-light { + background-color: #FAE8E0; + border-radius: 4px; + height: 17px; + border-color: rgba(207, 10, 44, 0.4); + display: inline-block; + margin-top: 8px; +} + +.price-time { + background-color: rgba(0, 0, 0, 0.1); + height: 16px; + width: 16px; + border-radius: 3px; + display: inline-block; + text-align: center; + line-height: 16px; +} + +#product-name { + font-size: 16px; + line-height: 21px; + font-weight: 400; + margin-top: 12px; +} + +#guide { + font-size: 14px; + line-height: 20px; + font-weight: 400; + margin-top: 26px; +} + +#product-info { + font-size: 14px; + opacity: 0.6; + text-align: left; + line-height: 20px; + font-weight: 400; + margin-top: 8px; +} + +br { + display: inline; + line-height: 8px; +} + +#menu { + box-sizing: border-box; + height: 56px; + align-items: center; + display: flex; + flex-direction: row; + justify-content: space-between; + position: fixed; + bottom: 0; + right: 0; + background-color: var(--background-secondary); + border-top: 1px solid var(--comp_background_tertiary); +} + +#menu>div>img { + height: 24px; + width: 24px; +} + +button { + font-size: 16px; + border: none; + height: 40px; + border-radius: 40px; +} + +button:first-of-type { + color: var(--font_color_red); + background-color: var(--comp_background_secondary); + margin-right: 6px; + /* background: linear-gradient(270deg, #FF914C 52%, #FEA748 96%); */ +} + +button:last-of-type { + background-color: var(--btn_backgournd_red); + color: var(--font_on_primary); + /* background: linear-gradient(90deg, #F64D43 11%, #EB344D 89%); */ +} + + +@media (prefers-color-scheme: dark) { + .custom-radius { + background-color: #ffffff0c; + } + + .custom-radius-red-light { + background-color: var(--comp_background_secondary); + border-color: rgba(207, 10, 44, 0.4); + } + + .price-time { + background-color: #FFFFFF19; + } +} \ No newline at end of file diff --git a/entry/src/main/resources/rawfile/style/product_list.css b/entry/src/main/resources/rawfile/style/product_list.css new file mode 100644 index 0000000000000000000000000000000000000000..444a25294f6b534d752237ff5fd415a50771ac5f --- /dev/null +++ b/entry/src/main/resources/rawfile/style/product_list.css @@ -0,0 +1,114 @@ +body { + margin: 0; +} + +@media (320px <=width < 600px) { + ul { + grid-template-columns: 1fr; + row-gap: 12px; + padding-left: 16px; + padding-right: 16px; + } + + #nav { + padding: 0 16px; + } +} + +@media (600px <=width < 840px) { + ul { + grid-template-columns: 1fr 1fr; + row-gap: 12px; + column-gap: 12px; + padding-left: 24px; + padding-right: 24px; + } + + #nav { + padding: 0 24px; + } +} + +@media (840px <=width) { + ul { + grid-template-columns: 1fr 1fr 1fr; + row-gap: 12px; + column-gap: 12px; + padding-left: 32px; + padding-right: 32px; + } + + #nav { + padding: 0 32px; + } +} + +#container { + width: 100vw; + height: 100vh; + display: flex; + flex-direction: column; + background-color: var(--background-secondary); +} + +#nav { + height: 56px; + font-size: 24px; + color: var(--font_primary); + text-align: left; + line-height: 56px; + font-weight: 700; +} + +ul { + flex: 1; + overflow: scroll; + list-style-type: none; + margin: 0; + padding-top: 12px; + padding-bottom: 12px; + display: grid; +} + +li { + display: flex; + background-color: var(--comp_background_primary); + border-radius: 16px; + padding-right: 16px; +} + +li>img { + width: 120px; + aspect-ratio: 1; +} + +li>div { + flex: 1; + padding-top: 12px; + padding-bottom: 12px; + display: flex; + flex-direction: column; +} + +li>div>p { + background-color: var(--comp_background_secondary); + height: 20px; + border-radius: 10px; + margin: 0; +} + +#p2 { + width: 100px; + margin-top: 4px; +} + +li>div>span { + font-size: 21px; + color: #E92F4F; + font-weight: 500; + margin-top: auto; +} + +li>div>span>span { + font-size: 14px; +} \ No newline at end of file diff --git a/features/video/src/main/resources/rawfile/test1.mp4 b/entry/src/main/resources/rawfile/test1.mp4 similarity index 100% rename from features/video/src/main/resources/rawfile/test1.mp4 rename to entry/src/main/resources/rawfile/test1.mp4 diff --git a/features/video/src/main/resources/rawfile/test2.mp4 b/entry/src/main/resources/rawfile/test2.mp4 similarity index 100% rename from features/video/src/main/resources/rawfile/test2.mp4 rename to entry/src/main/resources/rawfile/test2.mp4 diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json index 34cb9b17f7ba3c65500d5f36d081811fc218b17c..3f43fa563d89447bef90087e715ddf244f689bed 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -27,6 +27,150 @@ { "name": "button3", "value": "web页面浏览进度接续" + }, + { + "name": "full_screen", + "value": "100%" + }, + { + "name": "full_screen_20", + "value": "20%" + }, + { + "name": "internet_reason", + "value": "用于获取网络列表数据场景使用Internet网络" + }, + { + "name": "network_info_reason", + "value": "用于获取网络列表数据场景获取网络信息" + }, + { + "name": "zero_screen", + "value": "0%" + }, + { + "name": "net_connection_description", + "value": "无法连接网络,请检查网络设置" + }, + { + "name": "footer_text_max_count", + "value": "—已到达底部—" + }, + { + "name": "footer_text_loading", + "value": "—加载中,请稍后—" + }, + { + "name": "search", + "value": "搜索..." + }, + { + "name": "video_warn", + "value": "请检查网络是否连接或可用!" + }, + { + "name": "video_speed_1_0X", + "value": "1.0X" + }, + { + "name": "video_speed_1_25X", + "value": "1.25X" + }, + { + "name": "video_speed_1_75X", + "value": "1.75X" + }, + { + "name": "video_res_1", + "value": "test1.mp4" + }, + { + "name": "video_res_2", + "value": "test2.mp4" + }, + { + "name": "video_res_3", + "value": "network.mp4" + }, + { + "name": "video_speed_2_0X", + "value": "2.0X" + }, + { + "name": "dialog_cancel", + "value": "取消" + }, + { + "name": "dialog_play_speed", + "value": "播放倍速" + }, + { + "name": "playing", + "value": "当前播放" + }, + { + "name": "reason_internet", + "value": "用于视频播放场景使用Internet网络" + }, + { + "name": "reason_get_network_info", + "value": "用于视频播放场景获取网络信息" + }, + { + "name": "click_change", + "value": "点击切换" + }, + { + "name": "video_title", + "value": "媒体播放进度接续" + }, + { + "name": "toast_msg", + "value": "该功能暂未开发,敬请期待" + }, + { + "name": "confirm_order", + "value": "确认订单" + }, + { + "name": "dollar", + "value": "¥%d" + }, + { + "name": "invoice", + "value": "发票" + }, + { + "name": "personal_invoice", + "value": "电子普通发票-个人" + }, + { + "name": "delivery", + "value": "配送" + }, + { + "name": "standard_delivery", + "value": "标准配送" + }, + { + "name": "self_operated", + "value": "商城自营" + }, + { + "name": "user_name", + "value": "张XX" + }, + { + "name": "user_phone", + "value": "185 xxxx xxxx" + }, + { + "name": "user_address", + "value": "北京市 海淀区 XXX小区XX楼XX单元XX室" + }, + { + "name": "tittle", + "value": "web页面浏览进度接续" } ] } \ No newline at end of file diff --git a/features/longList/build-profile.json5 b/features/longList/build-profile.json5 deleted file mode 100644 index 4d611879c7913fb0610c686e2399258ab3a6dad1..0000000000000000000000000000000000000000 --- a/features/longList/build-profile.json5 +++ /dev/null @@ -1,28 +0,0 @@ -{ - "apiType": "stageMode", - "buildOption": { - }, - "buildOptionSet": [ - { - "name": "release", - "arkOptions": { - "obfuscation": { - "ruleOptions": { - "enable": false, - "files": [ - "./obfuscation-rules.txt" - ] - } - } - } - }, - ], - "targets": [ - { - "name": "default" - }, - { - "name": "ohosTest", - } - ] -} \ No newline at end of file diff --git a/features/longList/hvigorfile.ts b/features/longList/hvigorfile.ts deleted file mode 100644 index c6edcd90486dd5a853cf7d34c8647f08414ca7a3..0000000000000000000000000000000000000000 --- a/features/longList/hvigorfile.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { hapTasks } from '@ohos/hvigor-ohos-plugin'; - -export default { - system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ - plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ -} diff --git a/features/longList/obfuscation-rules.txt b/features/longList/obfuscation-rules.txt deleted file mode 100644 index 272efb6ca3f240859091bbbfc7c5802d52793b0b..0000000000000000000000000000000000000000 --- a/features/longList/obfuscation-rules.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Define project specific obfuscation rules here. -# You can include the obfuscation configuration files in the current module's build-profile.json5. -# -# For more details, see -# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 - -# Obfuscation options: -# -disable-obfuscation: disable all obfuscations -# -enable-property-obfuscation: obfuscate the property names -# -enable-toplevel-obfuscation: obfuscate the names in the global scope -# -compact: remove unnecessary blank spaces and all line feeds -# -remove-log: remove all console.* statements -# -print-namecache: print the name cache that contains the mapping from the old names to new names -# -apply-namecache: reuse the given cache file - -# Keep options: -# -keep-property-name: specifies property names that you want to keep -# -keep-global-name: specifies names that you want to keep in the global scope - --enable-property-obfuscation --enable-toplevel-obfuscation --enable-filename-obfuscation --enable-export-obfuscation \ No newline at end of file diff --git a/features/longList/oh-package.json5 b/features/longList/oh-package.json5 deleted file mode 100644 index 0ee9ff49782fd80b3cdafcd58b1c4f491331a964..0000000000000000000000000000000000000000 --- a/features/longList/oh-package.json5 +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "longlist", - "version": "1.0.0", - "description": "Please describe the basic information.", - "main": "", - "author": "", - "license": "", - "dependencies": {} -} - diff --git a/features/longList/src/main/ets/longlistability/LongListAbility.ets b/features/longList/src/main/ets/longlistability/LongListAbility.ets deleted file mode 100644 index e41fd29df760077701f6e0a5e05fb5fed50fb1f1..0000000000000000000000000000000000000000 --- a/features/longList/src/main/ets/longlistability/LongListAbility.ets +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; -import { hilog } from '@kit.PerformanceAnalysisKit'; -import { window } from '@kit.ArkUI'; -import { distributedDataObject } from '@kit.ArkData'; - -class ContinueData { - continueIndex: number | undefined; - currentOffset: number | undefined; - - constructor(continueIndex: number | undefined, currentOffset: number | undefined) { - this.continueIndex = continueIndex; - this.currentOffset = currentOffset; - } -} - -export default class LongListAbility extends UIAbility { - // [Start continue_restore] - continueRestore(want: Want) { - if (!want.parameters || !want.parameters.distributedSessionId) { - console.error('missing sessionId'); - return; - } - - // 2.1 Invoke the create () interface to create and obtain a distributed data object instance - let continueData: ContinueData = new ContinueData(undefined,undefined); - let dataObject = distributedDataObject.create(this.context, continueData); - - // 2.2 Register the recovery state listening. When a callback notification with the status of'restored' is received, the distributed data object at the receiving end has restored the data saved by the originating end. (When asset data is available, the corresponding files are also migrated.) - dataObject.on('status', (sessionId: string, networkId: string, status: string) => { - if (status === 'restored') { - // The status notification of "restored" is received, indicating that the data stored on the initiator has been restored - AppStorage.setOrCreate('continueIndex', dataObject['continueIndex']); - AppStorage.setOrCreate('currentOffset', dataObject['currentOffset']); - AppStorage.setOrCreate('continueEntry', true); - AppStorage.setOrCreate('setcurrentOffset', true); - } - }); - - // 2.3 Obtain the sessionId placed by the initiator from want.parameters and call the setSessionId interface to set the synchronized sessionId - let sessionId = want.parameters.distributedSessionId as string; - dataObject.setSessionId(sessionId); - this.context.restoreWindowStage(new LocalStorage()); - } - // [End continue_restore] - - // [Start on_continue] - async onContinue(wantParam: Record): Promise { - // 1.1 Invoke the create () interface to create and obtain a distributed data object instance - // continueData is an object that can be used to store the data that needs to be connected - let continueIndex = AppStorage.get('continueIndex') as number; - let currentOffset = AppStorage.get('currentOffset') as number; - let continueData: ContinueData = new ContinueData(continueIndex, currentOffset); - let dataObject = distributedDataObject.create(this.context, continueData); - - // 1.2 Call the genSessionId () interface to create a sessionId, call the setSessionId () interface to set the synchronized sessionId, and put the sessionId into the wantParam - let sessionId = distributedDataObject.genSessionId(); - console.log(`gen sessionId: ${sessionId}`); - dataObject.setSessionId(sessionId); - wantParam.distributedSessionId = sessionId; - - // 1.3 Obtain the networkId of the receiver device from wantParam. Use the networkId to invoke the save interface to save the data to the receiver - let deviceId = wantParam.targetDevice as string; - console.log(`get deviceId: ${deviceId}`); - dataObject.save(deviceId); - return AbilityConstant.OnContinueResult.AGREE; - } - // [End on_continue] - - // [Start on_create] - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - hilog.info(0x0000, 'EntryAbility', '%{public}s', 'Ability onCreate'); - if (launchParam.launchReason === AbilityConstant.LaunchReason.CONTINUATION) { - if (want.parameters && want.parameters.distributedSessionId) { - this.continueRestore(want); - } - } - } - - onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { - if (launchParam.launchReason === AbilityConstant.LaunchReason.CONTINUATION) { - if (want.parameters && want.parameters.distributedSessionId) { - this.continueRestore(want); - } - } - } - // [End on_create] - - onDestroy(): void { - hilog.info(0x0000, 'EntryAbility', '%{public}s', 'Ability onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage){ - // Main window is created, set main page for this ability - hilog.info(0x0000, 'EntryAbility', '%{public}s', 'Ability onWindowStageCreate'); - - windowStage.loadContent('pages/Index', (err) => { - if (err.code) { - hilog.error(0x0000, 'EntryAbility', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'EntryAbility', 'Succeeded in loading the content.'); - }); - } - - onWindowStageDestroy(): void { - // Main window is destroyed, release UI related resources - hilog.info(0x0000, 'EntryAbility', '%{public}s', 'Ability onWindowStageDestroy'); - } - - onForeground(): void { - // Ability has brought to foreground - hilog.info(0x0000, 'EntryAbility', '%{public}s', 'Ability onForeground'); - } - - onBackground(): void { - // Ability has back to background - hilog.info(0x0000, 'EntryAbility', '%{public}s', 'Ability onBackground'); - } -} diff --git a/features/longList/src/main/ets/pages/Index.ets b/features/longList/src/main/ets/pages/Index.ets deleted file mode 100644 index 723336ff3b0f9bdd9cd15d074d83aac56ae53093..0000000000000000000000000000000000000000 --- a/features/longList/src/main/ets/pages/Index.ets +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { display, window } from '@kit.ArkUI'; -import { i18n } from '@kit.LocalizationKit'; -import { BreakpointConstants } from '../constants/BreakpointConstants'; -import { BreakpointSystem } from '../utils/BreakpointSystem'; -import { IndexNavDestination } from '../view/IndexNavDestination'; -import { HomeConstants } from '../constants/HomeConstants'; -import { CommonConstants } from '../constants/CommonConstants'; -import Logger from '../utils/Logger'; - -@Entry -@Component -struct Index { - @StorageLink(BreakpointConstants.BREAKPOINT_NAME) currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; - @StorageLink(CommonConstants.LANGUAGE) language: string = CommonConstants.CHINESE_LANGUAGE; - @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack(); - @State windowsHeight: number = CommonConstants.NUMBER_DEFAULT_VALUE; - private breakpointSystem: BreakpointSystem = new BreakpointSystem(this.getUIContext()); - private indexPage: string = CommonConstants.CHINESE_LANGUAGE; - - onBackPress() { - return true; - } - - @Builder - PageMap(name: string) { - if (name === this.indexPage) { - IndexNavDestination({ windowsHeight: this.windowsHeight }); - } else { - NavDestination() - .hideTitleBar(true); - } - } - - aboutToAppear(): void { - try { - let systemLanguage: string = i18n.System.getSystemLanguage(); - let local = new Intl.Locale(systemLanguage); - this.language = local.language; - } catch (err) { - Logger.error(`call System.getSystemLanguage() failed`); - } - if (this.language === CommonConstants.CHINESE_LANGUAGE) { - this.indexPage = HomeConstants.INDEX_PAGE; - } else { - this.indexPage = HomeConstants.INDEX_PAGE_EN; - } - this.pageInfos.pushPath({ name: this.indexPage }, false); - this.windowsHeight = this.getUIContext().px2vp(display.getDefaultDisplaySync().height); - this.breakpointSystem.register(); - window.getLastWindow(this.getUIContext().getHostContext()).then(win => { - win.setWindowLayoutFullScreen(true); - let area = win.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); - let height = area.topRect.height; - let vpHeight = this.getUIContext().px2vp(height); - AppStorage.setOrCreate('topHeight', vpHeight); - }); - } - - aboutToDisappear(): void { - this.breakpointSystem.unregister(); - } - - build() { - Navigation(this.pageInfos) { - } - .hideNavBar(true) - .mode(NavigationMode.Split) - .hideToolBar(true) - .hideTitleBar(true) - .navDestination(this.PageMap); - } -} \ No newline at end of file diff --git a/features/longList/src/main/ets/utils/Logger.ets b/features/longList/src/main/ets/utils/Logger.ets deleted file mode 100644 index 56419b8f96945271afd594241cda6c99c1a7af0a..0000000000000000000000000000000000000000 --- a/features/longList/src/main/ets/utils/Logger.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { hilog } from '@kit.PerformanceAnalysisKit'; - -class Logger { - private domain: number; - private prefix: string; - private format: string = '%{public}s, %{public}s'; - - constructor(prefix: string) { - this.prefix = prefix; - this.domain = 0xFF00; - } - - /** - * Outputs debug-level logs. - * @param args Indicates the log parameters. - */ - debug(...args: string[]) { - hilog.debug(this.domain, this.prefix, this.format, args); - } - - /** - * Outputs info-level logs. - * @param args Indicates the log parameters. - */ - info(...args: string[]) { - hilog.info(this.domain, this.prefix, this.format, args); - } - - /** - * Outputs warning-level logs. - * @param args Indicates the log parameters. - */ - warn(...args: string[]) { - hilog.warn(this.domain, this.prefix, this.format, args); - } - - /** - * Outputs error-level logs. - * @param args Indicates the log parameters. - */ - error(...args: string[]) { - hilog.error(this.domain, this.prefix, this.format, args); - } -} - -export default new Logger('[PageSlip]'); - diff --git a/features/longList/src/main/ets/view/NavigationBarView.ets b/features/longList/src/main/ets/view/NavigationBarView.ets deleted file mode 100644 index 8d3300c6f79328b23d7c017492b4966a002e5342..0000000000000000000000000000000000000000 --- a/features/longList/src/main/ets/view/NavigationBarView.ets +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { BreakpointConstants } from '../constants/BreakpointConstants'; -import { BreakpointType } from '../utils/BreakpointSystem'; -import { FooterTab, FooterTabData, FooterTabDataEn } from '../model/FooterTabData'; -import { CommonConstants } from '../constants/CommonConstants'; - -@Component -export struct NavigationBarView { - @StorageLink(BreakpointConstants.BREAKPOINT_NAME) currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; - @StorageLink(CommonConstants.LANGUAGE) language: string = CommonConstants.CHINESE_LANGUAGE; - @State selectIndex: number = CommonConstants.NUMBER_DEFAULT_VALUE; - public swiperController: SwiperController | undefined = undefined; - public scroller: Scroller = new Scroller(); - public waterFlowScroller: Scroller = new Scroller(); - private iconArr: FooterTab[] = []; - - aboutToAppear(): void { - if (this.language === CommonConstants.CHINESE_LANGUAGE) { - this.iconArr = new FooterTabData().tabList; - } else { - this.iconArr = new FooterTabDataEn().tabList; - } - } - - build() { - Row() { - ForEach(this.iconArr, (item: FooterTab, index: number) => { - Column() { - this.setNavigationItem(item, index); - }; - }, (index: number) => JSON.stringify(index)); - } - .width($r('app.string.full_screen')) - .height($r('app.float.navigation_height')) - .justifyContent(FlexAlign.SpaceBetween) - .backgroundColor($r('app.color.start_window_background')); - } - - @Builder - setNavigationItem(item: FooterTab, index: number) { - Column({ space: CommonConstants.SPACE_FOUR }) { - Image(item.icon) - .objectFit(ImageFit.Fill) - .width($r('app.float.navigation_icon_size')) - .height($r('app.float.navigation_icon_size')) - .margin({ bottom: $r('app.float.margin_4') }); - - Text(item.name) - .fontSize($r('app.float.font_size_10')) - .fontWeight(FontWeight.Medium); - } - .onClick(() => { - if (item.name === this.iconArr[0].name) { - this.scroller.scrollTo({ xOffset: 0, yOffset: 0 }); - this.waterFlowScroller.scrollToIndex(0); - } - }) - .width(new BreakpointType( - { - sm: $r('app.string.full_screen_20'), - md: $r('app.string.full_screen_20'), - lg: $r('app.string.full_screen'), - } - ).getValue(this.currentBreakpoint)) - .height(new BreakpointType( - { - sm: $r('app.string.full_screen'), - md: $r('app.string.full_screen'), - lg: $r('app.float.navigation_height_lg'), - } - ).getValue(this.currentBreakpoint)) - .opacity(index === 0 ? 1 : $r('app.float.opacity_percent_40')) - .padding({ - top: new BreakpointType( - { - sm: $r('app.float.margin_4'), - md: $r('app.float.margin_4'), - lg: $r('app.float.zero'), - } - ).getValue(this.currentBreakpoint) - }); - } -} \ No newline at end of file diff --git a/features/longList/src/main/module.json5 b/features/longList/src/main/module.json5 deleted file mode 100644 index 016a182e4caac3804bcb35eef5c6d70e23520733..0000000000000000000000000000000000000000 --- a/features/longList/src/main/module.json5 +++ /dev/null @@ -1,33 +0,0 @@ -// [Start module_json5] -{ - "module": { - // [StartExclude module_json5] - "name": "longList", - "type": "feature", - "description": "$string:module_desc", - "mainElement": "LongListAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:main_pages", - // [EndExclude module_json5] - "abilities": [ - { - // [StartExclude module_json5] - "name": "LongListAbility", - "srcEntry": "./ets/longlistability/LongListAbility.ets", - "description": "$string:LongListAbility_desc", - "icon": "$media:layered_image", - "label": "$string:LongListAbility_label", - "startWindowIcon": "$media:startIcon", - "startWindowBackground": "$color:start_window_background", - "exported": true, - // [EndExclude module_json5] - "continuable": true - } - ] - } -} -// [End module_json5] \ No newline at end of file diff --git a/features/longList/src/main/resources/base/element/color.json b/features/longList/src/main/resources/base/element/color.json deleted file mode 100644 index 0ebc8753a0578e85c153bff40003880781db9011..0000000000000000000000000000000000000000 --- a/features/longList/src/main/resources/base/element/color.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#F1F3F5" - }, - { - "name": "common_background_2", - "value": "#F7F7F7" - }, - { - "name": "common_background_3", - "value": "#E5E7E9" - }, - { - "name": "function_default_color", - "value": "#CCCCCC" - } - ] -} \ No newline at end of file diff --git a/features/longList/src/main/resources/base/element/string.json b/features/longList/src/main/resources/base/element/string.json deleted file mode 100644 index a10edebb21c500c33c2ddb34565888bae9876f1d..0000000000000000000000000000000000000000 --- a/features/longList/src/main/resources/base/element/string.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "LongListAbility_desc", - "value": "description" - }, - { - "name": "LongListAbility_label", - "value": "pageSlip" - }, - { - "name": "internet_reason", - "value": "Used to access the Internet for the scenario of retrieving network list data" - }, - { - "name": "network_info_reason", - "value": "Used to retrieve network information for the scenario of retrieving network list data" - }, - { - "name": "full_screen", - "value": "100%" - }, - { - "name": "zero_screen", - "value": "0%" - }, - { - "name": "full_screen_20", - "value": "20%" - }, - { - "name": "net_connection_description", - "value": "Unable to connect to the network, please check your network settings" - }, - { - "name": "footer_text_max_count", - "value": "Reached the bottom" - }, - { - "name": "footer_text_loading", - "value": "Loading, please wait a moment" - }, - { - "name": "search", - "value": "search..." - }, - { - "name": "button1", - "value": "Long List Continue" - } - ] -} \ No newline at end of file diff --git a/features/longList/src/main/resources/base/media/background.png b/features/longList/src/main/resources/base/media/background.png deleted file mode 100644 index f939c9fa8cc8914832e602198745f592a0dfa34d..0000000000000000000000000000000000000000 Binary files a/features/longList/src/main/resources/base/media/background.png and /dev/null differ diff --git a/features/longList/src/main/resources/base/media/foreground.png b/features/longList/src/main/resources/base/media/foreground.png deleted file mode 100644 index 4483ddad1f079e1089d685bd204ee1cfe1d01902..0000000000000000000000000000000000000000 Binary files a/features/longList/src/main/resources/base/media/foreground.png and /dev/null differ diff --git a/features/longList/src/main/resources/base/media/layered_image.json b/features/longList/src/main/resources/base/media/layered_image.json deleted file mode 100644 index fb49920440fb4d246c82f9ada275e26123a2136a..0000000000000000000000000000000000000000 --- a/features/longList/src/main/resources/base/media/layered_image.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "layered-image": - { - "background" : "$media:background", - "foreground" : "$media:foreground" - } -} \ No newline at end of file diff --git a/features/longList/src/main/resources/base/media/startIcon.png b/features/longList/src/main/resources/base/media/startIcon.png deleted file mode 100644 index 205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b..0000000000000000000000000000000000000000 Binary files a/features/longList/src/main/resources/base/media/startIcon.png and /dev/null differ diff --git a/features/longList/src/main/resources/base/profile/backup_config.json b/features/longList/src/main/resources/base/profile/backup_config.json deleted file mode 100644 index 78f40ae7c494d71e2482278f359ec790ca73471a..0000000000000000000000000000000000000000 --- a/features/longList/src/main/resources/base/profile/backup_config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "allowToBackupRestore": true -} \ No newline at end of file diff --git a/features/longList/src/main/resources/base/profile/main_pages.json b/features/longList/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 1898d94f58d6128ab712be2c68acc7c98e9ab9ce..0000000000000000000000000000000000000000 --- a/features/longList/src/main/resources/base/profile/main_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "pages/Index" - ] -} diff --git a/features/longList/src/main/resources/en_US/element/string.json b/features/longList/src/main/resources/en_US/element/string.json deleted file mode 100644 index 6645940ccf9ec89c2c7e3dcd05154f95595fb4a3..0000000000000000000000000000000000000000 --- a/features/longList/src/main/resources/en_US/element/string.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "LongListAbility_desc", - "value": "description" - }, - { - "name": "LongListAbility_label", - "value": "pageSlip" - }, - { - "name": "full_screen", - "value": "100%" - }, - { - "name": "full_screen_20", - "value": "20%" - }, - { - "name": "internet_reason", - "value": "Used to access the Internet for the scenario of retrieving network list data" - }, - { - "name": "network_info_reason", - "value": "Used to retrieve network information for the scenario of retrieving network list data" - }, - { - "name": "zero_screen", - "value": "0%" - }, - { - "name": "search", - "value": "search..." - }, - { - "name": "footer_text_loading", - "value": "Loading, please wait a moment" - }, - { - "name": "net_connection_description", - "value": "Unable to connect to the network, please check your network settings" - }, - { - "name": "footer_text_max_count", - "value": "Reached the bottom" - }, - { - "name": "button1", - "value": "Long List Continue" - } - ] -} \ No newline at end of file diff --git a/features/longList/src/main/resources/zh_CN/element/string.json b/features/longList/src/main/resources/zh_CN/element/string.json deleted file mode 100644 index c524636876a00bd1b452646134861f616f469c7f..0000000000000000000000000000000000000000 --- a/features/longList/src/main/resources/zh_CN/element/string.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "string": [ - { - "name": "module_desc", - "value": "模块描述" - }, - { - "name": "LongListAbility_desc", - "value": "描述" - }, - { - "name": "LongListAbility_label", - "value": "流畅页面" - }, - { - "name": "full_screen", - "value": "100%" - }, - { - "name": "full_screen_20", - "value": "20%" - }, - { - "name": "internet_reason", - "value": "用于获取网络列表数据场景使用Internet网络" - }, - { - "name": "network_info_reason", - "value": "用于获取网络列表数据场景获取网络信息" - }, - { - "name": "zero_screen", - "value": "0%" - }, - { - "name": "net_connection_description", - "value": "无法连接网络,请检查网络设置" - }, - { - "name": "footer_text_max_count", - "value": "—已到达底部—" - }, - { - "name": "footer_text_loading", - "value": "—加载中,请稍后—" - }, - { - "name": "search", - "value": "搜索..." - }, - { - "name": "button1", - "value": "长列表进度接续" - } - ] -} \ No newline at end of file diff --git a/features/video/build-profile.json5 b/features/video/build-profile.json5 deleted file mode 100644 index 4d611879c7913fb0610c686e2399258ab3a6dad1..0000000000000000000000000000000000000000 --- a/features/video/build-profile.json5 +++ /dev/null @@ -1,28 +0,0 @@ -{ - "apiType": "stageMode", - "buildOption": { - }, - "buildOptionSet": [ - { - "name": "release", - "arkOptions": { - "obfuscation": { - "ruleOptions": { - "enable": false, - "files": [ - "./obfuscation-rules.txt" - ] - } - } - } - }, - ], - "targets": [ - { - "name": "default" - }, - { - "name": "ohosTest", - } - ] -} \ No newline at end of file diff --git a/features/video/hvigorfile.ts b/features/video/hvigorfile.ts deleted file mode 100644 index c6edcd90486dd5a853cf7d34c8647f08414ca7a3..0000000000000000000000000000000000000000 --- a/features/video/hvigorfile.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { hapTasks } from '@ohos/hvigor-ohos-plugin'; - -export default { - system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ - plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ -} diff --git a/features/video/obfuscation-rules.txt b/features/video/obfuscation-rules.txt deleted file mode 100644 index 272efb6ca3f240859091bbbfc7c5802d52793b0b..0000000000000000000000000000000000000000 --- a/features/video/obfuscation-rules.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Define project specific obfuscation rules here. -# You can include the obfuscation configuration files in the current module's build-profile.json5. -# -# For more details, see -# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 - -# Obfuscation options: -# -disable-obfuscation: disable all obfuscations -# -enable-property-obfuscation: obfuscate the property names -# -enable-toplevel-obfuscation: obfuscate the names in the global scope -# -compact: remove unnecessary blank spaces and all line feeds -# -remove-log: remove all console.* statements -# -print-namecache: print the name cache that contains the mapping from the old names to new names -# -apply-namecache: reuse the given cache file - -# Keep options: -# -keep-property-name: specifies property names that you want to keep -# -keep-global-name: specifies names that you want to keep in the global scope - --enable-property-obfuscation --enable-toplevel-obfuscation --enable-filename-obfuscation --enable-export-obfuscation \ No newline at end of file diff --git a/features/video/oh-package.json5 b/features/video/oh-package.json5 deleted file mode 100644 index 57a6dfde51626aa36acbbdce03488af8c1f0cd36..0000000000000000000000000000000000000000 --- a/features/video/oh-package.json5 +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "video", - "version": "1.0.0", - "description": "Please describe the basic information.", - "main": "", - "author": "", - "license": "", - "dependencies": {} -} - diff --git a/features/video/src/main/ets/utils/Logger.ets b/features/video/src/main/ets/utils/Logger.ets deleted file mode 100644 index b2d262127f7e5bfa39b7b9fa8f5513eb7e0f55af..0000000000000000000000000000000000000000 --- a/features/video/src/main/ets/utils/Logger.ets +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { hilog } from '@kit.PerformanceAnalysisKit'; - -class Logger { - private domain: number; - private prefix: string; - private format: string = '%{public}s, %{public}s'; - - constructor(prefix: string) { - this.prefix = prefix; - this.domain = 0xFF00; - } - - debug(...args: string[]): void { - hilog.debug(this.domain, this.prefix, this.format, args); - } - - info(...args: string[]): void { - hilog.info(this.domain, this.prefix, this.format, args); - } - - warn(...args: string[]): void { - hilog.warn(this.domain, this.prefix, this.format, args); - } - - error(...args: string[]): void { - hilog.error(this.domain, this.prefix, this.format, args); - } -} - -export default new Logger('[Samples_VideoPlay]'); \ No newline at end of file diff --git a/features/video/src/main/ets/videoability/VideoAbility.ets b/features/video/src/main/ets/videoability/VideoAbility.ets deleted file mode 100644 index 9609c0071a5ce78b25f5ede90d978be82ed5d568..0000000000000000000000000000000000000000 --- a/features/video/src/main/ets/videoability/VideoAbility.ets +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; -import { hilog } from '@kit.PerformanceAnalysisKit'; -import { window } from '@kit.ArkUI'; -import { distributedDataObject } from '@kit.ArkData'; -import { emitter } from '@kit.BasicServicesKit'; -import { GlobalContext } from '../utils/GlobalContext'; - -class ContinueData { - continueTime: number | undefined; - continueItem: number | undefined; - flag: boolean | undefined; - - constructor(continueTime: number | undefined, continueItem: number | undefined, flag: boolean | undefined) { - this.continueTime = continueTime; - this.continueItem = continueItem; - this.flag = flag; - } -} - -export default class VideoAbility extends UIAbility { - continueRestore(want: Want) { - if (!want.parameters || !want.parameters.distributedSessionId) { - return; - } - let continueData: ContinueData = new ContinueData(undefined, undefined, undefined); - let dataObject = distributedDataObject.create(this.context, continueData); - dataObject.on('status', (sessionId: string, networkId: string, status: string) => { - if (status === 'restored') { - AppStorage.setOrCreate('currentTime', dataObject['continueTime']); - AppStorage.setOrCreate('videoIndex', dataObject['continueItem']); - AppStorage.setOrCreate('flag', dataObject['flag']); - AppStorage.setOrCreate('continue', true); - } - }); - let sessionId = want.parameters.distributedSessionId as string; - dataObject.setSessionId(sessionId); - this.context.restoreWindowStage(new LocalStorage()); - } - - async onContinue(wantParam: Record): Promise { - let currentTime = AppStorage.get('currentTime') as number; - let videoIndex = AppStorage.get('videoIndex') as number; - let flag = AppStorage.get('flag') as boolean; - let continueData: ContinueData = new ContinueData(currentTime, videoIndex, flag); - let dataObject = distributedDataObject.create(this.context, continueData); - let sessionId = distributedDataObject.genSessionId(); - dataObject.setSessionId(sessionId); - wantParam.distributedSessionId = sessionId; - - let deviceId = wantParam.targetDevice as string; - dataObject.save(deviceId); - return AbilityConstant.OnContinueResult.AGREE; - } - - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - GlobalContext.getContext().setObject('abilityWant', want); - GlobalContext.getContext().setObject('context', this.context) - if (want.parameters) { - if (want.parameters.currentTime) { - GlobalContext.getContext().setObject('currentTime', want.parameters.currentTime); - } - } - if (launchParam.launchReason === AbilityConstant.LaunchReason.CONTINUATION) { - if (want.parameters && want.parameters.distributedSessionId) { - this.continueRestore(want); - } - } - } - - onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { - GlobalContext.getContext().setObject('abilityWant', want); - GlobalContext.getContext().setObject('context', this.context); - if (want.parameters) { - if (want.parameters.currentTime) { - GlobalContext.getContext().setObject('currentTime', want.parameters.currentTime); - } - } - if (launchParam.launchReason === AbilityConstant.LaunchReason.CONTINUATION) { - if (want.parameters && want.parameters.distributedSessionId) { - this.continueRestore(want); - } - } - } - - onDestroy(): void { - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage): void { - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); - windowStage.getMainWindow().then((win: window.Window) => { - win.setWindowKeepScreenOn(true); - win.setWindowSystemBarProperties({ - statusBarColor: '#000000', - statusBarContentColor: '#FFFFFF' - }); - win.setWindowLayoutFullScreen(true); - win.on('windowSizeChange', (newSize: window.Size) => { - let eventWHData: emitter.EventData = { - data: { - 'width': newSize.width, - 'height': newSize.height - } - }; - let innerEventWH: emitter.InnerEvent = { - eventId: 3, - priority: emitter.EventPriority.HIGH - }; - emitter.emit(innerEventWH, eventWHData); - }); - }); - windowStage.loadContent('pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy(): void { - // Main window is destroyed, release UI related resources - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); - } - - onForeground(): void { - // Ability has brought to foreground - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); - } - - onBackground(): void { - // Ability has back to background - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); - } -} diff --git a/features/video/src/main/module.json5 b/features/video/src/main/module.json5 deleted file mode 100644 index 67fe0b4218ea80a21e6da5f46ddc5afa723f11c9..0000000000000000000000000000000000000000 --- a/features/video/src/main/module.json5 +++ /dev/null @@ -1,50 +0,0 @@ -{ - "module": { - "name": "video", - "type": "feature", - "description": "$string:module_desc", - "mainElement": "VideoAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "VideoAbility", - "srcEntry": "./ets/videoability/VideoAbility.ets", - "description": "$string:VideoAbility_desc", - "icon": "$media:layered_image", - "label": "$string:VideoAbility_label", - "startWindowIcon": "$media:startIcon", - "startWindowBackground": "$color:start_window_background", - "exported": true, - "continuable": true, - "launchType": "singleton" - } - ], - "requestPermissions": [ - { - "name": "ohos.permission.INTERNET", - "reason": "$string:reason_internet", - "usedScene": { - "abilities": [ - "VideoAbility" - ], - "when": "always" - } - }, - { - "name": "ohos.permission.GET_NETWORK_INFO", - "reason": "$string:reason_get_network_info", - "usedScene": { - "abilities": [ - "VideoAbility" - ], - "when": "always" - } - } - ] - } -} \ No newline at end of file diff --git a/features/video/src/main/resources/base/element/color.json b/features/video/src/main/resources/base/element/color.json deleted file mode 100644 index 419aa49d53413d68acdd73edc8d2b80d01ef60e9..0000000000000000000000000000000000000000 --- a/features/video/src/main/resources/base/element/color.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - }, - { - "name": "slider_selected", - "value": "#007DFF" - }, - { - "name": "speed_dialog", - "value": "#33bab4b4" - }, - { - "name": "video_play", - "value": "#333333" - }, - { - "name": "video_play_selected", - "value": "#5c5c5c" - } - ] -} \ No newline at end of file diff --git a/features/video/src/main/resources/base/element/float.json b/features/video/src/main/resources/base/element/float.json deleted file mode 100644 index 1ea100d17b3e64467b32d74ac46263d8846b277b..0000000000000000000000000000000000000000 --- a/features/video/src/main/resources/base/element/float.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "float": [ - { - "name": "size_zero_five", - "value": "0.5" - }, - { - "name": "size_zero_six", - "value": "0.6" - }, - { - "name": "size_zero", - "value": "0" - }, - { - "name": "size_1", - "value": "1" - }, - { - "name": "size_5", - "value": "5" - }, - { - "name": "size_10", - "value": "10" - }, - { - "name": "size_12", - "value": "12" - }, - { - "name": "size_15", - "value": "15" - }, - { - "name": "size_16", - "value": "16" - }, - { - "name": "size_18", - "value": "18" - }, - { - "name": "size_20", - "value": "20" - }, - { - "name": "size_down_20", - "value": "-20" - }, - { - "name": "size_24", - "value": "24" - }, - { - "name": "size_25", - "value": "25" - }, - { - "name": "size_30", - "value": "30" - }, - { - "name": "size_32", - "value": "32" - }, - { - "name": "size_35", - "value": "35" - }, - { - "name": "size_40", - "value": "40" - }, - { - "name": "size_45", - "value": "45" - }, - { - "name": "size_48", - "value": "48" - }, - { - "name": "size_50", - "value": "50" - }, - { - "name": "size_64", - "value": "64" - }, - { - "name": "size_75", - "value": "75" - }, - { - "name": "size_80", - "value": "-80" - }, - { - "name": "size_254", - "value": "254" - } - ] -} \ No newline at end of file diff --git a/features/video/src/main/resources/base/element/string.json b/features/video/src/main/resources/base/element/string.json deleted file mode 100644 index c9b08acb818916507d9327a512823d5c996ce96d..0000000000000000000000000000000000000000 --- a/features/video/src/main/resources/base/element/string.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "VideoAbility_desc", - "value": "description" - }, - { - "name": "VideoAbility_label", - "value": "label" - }, - { - "name": "video_res_1", - "value": "test1.mp4" - }, - { - "name": "video_res_2", - "value": "test2.mp4" - }, - { - "name": "video_res_3", - "value": "network.mp4" - }, - { - "name": "video_speed_1_0X", - "value": "1.0X" - }, - { - "name": "video_speed_1_25X", - "value": "1.25X" - }, - { - "name": "video_speed_1_75X", - "value": "1.75X" - }, - { - "name": "video_speed_2_0X", - "value": "2.0X" - }, - { - "name": "video_warn", - "value": "Please check if the network is connected or available!" - }, - { - "name": "dialog_cancel", - "value": "Cancel" - }, - { - "name": "dialog_play_speed", - "value": "Playback speed" - }, - { - "name": "playing", - "value": "Playing" - }, - { - "name": "reason_internet", - "value": "Used for accessing the Internet during video playback" - }, - { - "name": "reason_get_network_info", - "value": "Used for retrieving network information during video playback" - }, - { - "name": "click_change", - "value": "Click Change" - }, - { - "name": "title", - "value": "Video Continue" - } - ] -} \ No newline at end of file diff --git a/features/video/src/main/resources/base/media/background.png b/features/video/src/main/resources/base/media/background.png deleted file mode 100644 index f939c9fa8cc8914832e602198745f592a0dfa34d..0000000000000000000000000000000000000000 Binary files a/features/video/src/main/resources/base/media/background.png and /dev/null differ diff --git a/features/video/src/main/resources/base/media/foreground.png b/features/video/src/main/resources/base/media/foreground.png deleted file mode 100644 index 4483ddad1f079e1089d685bd204ee1cfe1d01902..0000000000000000000000000000000000000000 Binary files a/features/video/src/main/resources/base/media/foreground.png and /dev/null differ diff --git a/features/video/src/main/resources/base/media/layered_image.json b/features/video/src/main/resources/base/media/layered_image.json deleted file mode 100644 index fb49920440fb4d246c82f9ada275e26123a2136a..0000000000000000000000000000000000000000 --- a/features/video/src/main/resources/base/media/layered_image.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "layered-image": - { - "background" : "$media:background", - "foreground" : "$media:foreground" - } -} \ No newline at end of file diff --git a/features/video/src/main/resources/base/media/startIcon.png b/features/video/src/main/resources/base/media/startIcon.png deleted file mode 100644 index 205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b..0000000000000000000000000000000000000000 Binary files a/features/video/src/main/resources/base/media/startIcon.png and /dev/null differ diff --git a/features/video/src/main/resources/base/profile/main_pages.json b/features/video/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 1898d94f58d6128ab712be2c68acc7c98e9ab9ce..0000000000000000000000000000000000000000 --- a/features/video/src/main/resources/base/profile/main_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "pages/Index" - ] -} diff --git a/features/video/src/main/resources/en_US/element/string.json b/features/video/src/main/resources/en_US/element/string.json deleted file mode 100644 index 24e29315e3f3bf1e3e87a4ba4b81d7803275ea22..0000000000000000000000000000000000000000 --- a/features/video/src/main/resources/en_US/element/string.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "VideoAbility_desc", - "value": "description" - }, - { - "name": "VideoAbility_label", - "value": "label" - }, - { - "name": "video_res_1", - "value": "test1.mp4" - }, - { - "name": "video_res_2", - "value": "test2.mp4" - }, - { - "name": "video_res_3", - "value": "network.mp4" - }, - { - "name": "video_speed_1_0X", - "value": "1.0X" - }, - { - "name": "video_speed_1_25X", - "value": "1.25X" - }, - { - "name": "video_speed_1_75X", - "value": "1.75X" - }, - { - "name": "video_speed_2_0X", - "value": "2.0X" - }, - { - "name": "video_warn", - "value": "Please check if the network is connected or available!" - }, - { - "name": "dialog_cancel", - "value": "Cancel" - }, - { - "name": "dialog_play_speed", - "value": "Playback speed" - }, - { - "name": "playing", - "value": "playing" - }, - { - "name": "reason_internet", - "value": "Used for accessing the Internet during video playback" - }, - { - "name": "reason_get_network_info", - "value": "Used for retrieving network information during video playback" - }, - { - "name": "click_change", - "value": "Click Change" - }, - { - "name": "title", - "value": "Video Continue" - } - - ] -} \ No newline at end of file diff --git a/features/video/src/main/resources/zh_CN/element/string.json b/features/video/src/main/resources/zh_CN/element/string.json deleted file mode 100644 index b38b7b047f7a236a5aa3eb09ec359b4a593e60fa..0000000000000000000000000000000000000000 --- a/features/video/src/main/resources/zh_CN/element/string.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "string": [ - { - "name": "module_desc", - "value": "模块描述" - }, - { - "name": "VideoAbility_desc", - "value": "description" - }, - { - "name": "VideoAbility_label", - "value": "适配播放" - }, - { - "name": "video_warn", - "value": "请检查网络是否连接或可用!" - }, - { - "name": "video_speed_1_0X", - "value": "1.0X" - }, - { - "name": "video_speed_1_25X", - "value": "1.25X" - }, - { - "name": "video_speed_1_75X", - "value": "1.75X" - }, - { - "name": "video_res_1", - "value": "test1.mp4" - }, - { - "name": "video_res_2", - "value": "test2.mp4" - }, - { - "name": "video_res_3", - "value": "network.mp4" - }, - { - "name": "video_speed_2_0X", - "value": "2.0X" - }, - { - "name": "dialog_cancel", - "value": "取消" - }, - { - "name": "dialog_play_speed", - "value": "播放倍速" - }, - { - "name": "playing", - "value": "当前播放" - }, - { - "name": "reason_internet", - "value": "用于视频播放场景使用Internet网络" - }, - { - "name": "reason_get_network_info", - "value": "用于视频播放场景获取网络信息" - }, - { - "name": "click_change", - "value": "点击切换" - }, - { - "name": "title", - "value": "媒体播放进度接续" - } - ] -} \ No newline at end of file diff --git a/features/web/build-profile.json5 b/features/web/build-profile.json5 deleted file mode 100644 index 4d611879c7913fb0610c686e2399258ab3a6dad1..0000000000000000000000000000000000000000 --- a/features/web/build-profile.json5 +++ /dev/null @@ -1,28 +0,0 @@ -{ - "apiType": "stageMode", - "buildOption": { - }, - "buildOptionSet": [ - { - "name": "release", - "arkOptions": { - "obfuscation": { - "ruleOptions": { - "enable": false, - "files": [ - "./obfuscation-rules.txt" - ] - } - } - } - }, - ], - "targets": [ - { - "name": "default" - }, - { - "name": "ohosTest", - } - ] -} \ No newline at end of file diff --git a/features/web/hvigorfile.ts b/features/web/hvigorfile.ts deleted file mode 100644 index c6edcd90486dd5a853cf7d34c8647f08414ca7a3..0000000000000000000000000000000000000000 --- a/features/web/hvigorfile.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { hapTasks } from '@ohos/hvigor-ohos-plugin'; - -export default { - system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ - plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ -} diff --git a/features/web/obfuscation-rules.txt b/features/web/obfuscation-rules.txt deleted file mode 100644 index 272efb6ca3f240859091bbbfc7c5802d52793b0b..0000000000000000000000000000000000000000 --- a/features/web/obfuscation-rules.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Define project specific obfuscation rules here. -# You can include the obfuscation configuration files in the current module's build-profile.json5. -# -# For more details, see -# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 - -# Obfuscation options: -# -disable-obfuscation: disable all obfuscations -# -enable-property-obfuscation: obfuscate the property names -# -enable-toplevel-obfuscation: obfuscate the names in the global scope -# -compact: remove unnecessary blank spaces and all line feeds -# -remove-log: remove all console.* statements -# -print-namecache: print the name cache that contains the mapping from the old names to new names -# -apply-namecache: reuse the given cache file - -# Keep options: -# -keep-property-name: specifies property names that you want to keep -# -keep-global-name: specifies names that you want to keep in the global scope - --enable-property-obfuscation --enable-toplevel-obfuscation --enable-filename-obfuscation --enable-export-obfuscation \ No newline at end of file diff --git a/features/web/oh-package.json5 b/features/web/oh-package.json5 deleted file mode 100644 index ce84c78232e1f42c270125897440feef24fa5b3f..0000000000000000000000000000000000000000 --- a/features/web/oh-package.json5 +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "web", - "version": "1.0.0", - "description": "Please describe the basic information.", - "main": "", - "author": "", - "license": "", - "dependencies": {} -} - diff --git a/features/web/src/main/ets/common/constants/CommonConstants.ets b/features/web/src/main/ets/common/constants/CommonConstants.ets deleted file mode 100644 index 3d90d079ef8cc4df8f47e947f61627b54d20b310..0000000000000000000000000000000000000000 --- a/features/web/src/main/ets/common/constants/CommonConstants.ets +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Common constants for common component. - */ -export class CommonConstants { - /** - * Font family. - */ - static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi'; - - /** - * 100 percent. - */ - static readonly FULL_PERCENT: string = '100%'; - - /** - * 50 percent. - */ - static readonly PERCENT_50: string = '50%'; - - /** - * Duration. - */ - static readonly TOAST_DURATION: number = 2000; - - /** - * Space. - */ - static readonly NORMAL_SPACE: number = 12; -} \ No newline at end of file diff --git a/features/web/src/main/ets/common/utils/Logger.ets b/features/web/src/main/ets/common/utils/Logger.ets deleted file mode 100644 index 9013ef6daa5049cb6d73fb8fa2bfdd56387f026f..0000000000000000000000000000000000000000 --- a/features/web/src/main/ets/common/utils/Logger.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { hilog } from '@kit.PerformanceAnalysisKit'; - -class Logger { - private domain: number; - private prefix: string; - private format: string = '%{public}s, %{public}s'; - - /** - * constructor. - * - * @param Prefix Identifies the log tag. - * @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF. - */ - constructor(prefix: string = 'MyApp', domain: number = 0xFF00) { - this.prefix = prefix; - this.domain = domain; - } - - debug(...args: string[]): void { - hilog.debug(this.domain, this.prefix, this.format, args); - } - - info(...args: string[]): void { - hilog.info(this.domain, this.prefix, this.format, args); - } - - warn(...args: string[]): void { - hilog.warn(this.domain, this.prefix, this.format, args); - } - - error(...args: string[]): void { - hilog.error(this.domain, this.prefix, this.format, args); - } -} - -export default new Logger('PageRedirection', 0xFF00); \ No newline at end of file diff --git a/features/web/src/main/ets/pages/IndexPage.ets b/features/web/src/main/ets/pages/IndexPage.ets deleted file mode 100644 index bbf5be0b7c59125fdf1d10d17bd106e9e3f03eaa..0000000000000000000000000000000000000000 --- a/features/web/src/main/ets/pages/IndexPage.ets +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { BusinessError } from '@kit.BasicServicesKit'; -import { webview } from '@kit.ArkWeb'; -import { window } from '@kit.ArkUI'; -import { common, Want } from '@kit.AbilityKit'; -import Logger from '../common/utils/Logger'; -import { CommonConstants } from '../common/constants/CommonConstants'; -import { ArkTSFunModel } from '../model/ProductModel'; -import { i18n } from '@kit.LocalizationKit'; - -const TAG: string = '[IndexPage]'; - -@Entry -@Component -struct IndexPage { - @StorageLink('continueRestore') continueRestore: boolean = false; - @StorageLink('pageUrl') @Watch('watchPageUrl') pageUrl: string = - i18n.System.getSystemLanguage() === 'zh-Hans' ? 'resource://rawfile/product_list.html' : - 'resource://rawfile/product_list_en.html'; - @StorageLink('scrollDistance') scrollDistance: number = 0; - @State webCanBack: boolean = false; - @State onPageEnd: boolean = false; - @State webCanForward: boolean = false; - @State controller: webview.WebviewController = new webview.WebviewController(); - @State statusBarHeight: number = 0; - @State sliderBarHeight: number = 56; - private context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; - arkTSObj: ArkTSFunModel = { - jumpOrderConfirm: (detailStr: string) => this.jumpOrderConfirm(detailStr) - }; - - watchPageUrl() { - if (this.continueRestore) { - this.controller.loadUrl(this.pageUrl); - this.continueRestore = false; - } - } - - aboutToAppear() { - webview.WebviewController.setWebDebuggingAccess(true); - window.getLastWindow(this.getUIContext().getHostContext(), (err: BusinessError, windowClass: window.Window) => { - if (err.code) { - Logger.error(TAG, 'Failed to obtain the main window. Cause: ' + JSON.stringify(err)); - return; - } - Logger.info(TAG, 'Succeeded in obtaining the main window. Data: ' + JSON.stringify(windowClass)); - - // Realize the immersive effect. - try { - let type = window.AvoidAreaType.TYPE_SYSTEM; - // Get status bar height. - let area: window.AvoidArea = windowClass.getWindowAvoidArea(type); - let statusBarHeight = this.getUIContext().px2vp(area.topRect.height); - let sliderBarHeight = this.getUIContext().px2vp(area.bottomRect.height); - this.statusBarHeight = statusBarHeight; - this.sliderBarHeight = sliderBarHeight; - if (statusBarHeight > 0) { - windowClass.setWindowLayoutFullScreen(true); - } - } catch (exception) { - Logger.error(TAG, 'Failed to set the system bar properties. Cause: ' + JSON.stringify(exception)); - } - }); - } - - onBackPress() { - return true; - } - - jumpOrderConfirm(detailStr: string): void { - this.getUIContext().getRouter().pushUrl({ - url: 'pages/OrderConfirmPage', - params: { statusBarHeight: this.statusBarHeight, sliderBarHeight: this.sliderBarHeight, detailStr } - }); - } - - build() { - Stack({ - alignContent: Alignment.TopStart - }) { - // [Start web_on_page_end] - Web({ src: this.pageUrl, controller: this.controller }) - // [StartExclude web_on_page_end] - .layoutWeight(1) - .javaScriptProxy({ - object: this.arkTSObj, - name: 'arkTSFunObj', - methodList: ['jumpOrderConfirm'], - controller: this.controller - }) - .onConfirm(() => { - this.getUIContext().getPromptAction().showToast({ - message: $r('app.string.toast_msg'), - duration: CommonConstants.TOAST_DURATION - }); - return false; - }) - .width('100%') - .height(this.pageUrl.includes('product_list') ? '90%' : '100%') - // [EndExclude web_on_page_end] - .onPageEnd(async () => { - // [StartExclude web_on_page_end] - this.webCanBack = this.controller.accessBackward(); - this.webCanForward = this.controller.accessForward(); - this.onPageEnd = true; - // [EndExclude web_on_page_end] - if (this.pageUrl.includes('product_list') && this.continueRestore) { - this.controller.runJavaScript('javascript:document.getElementById("productList").scrollTop = ' + - this.scrollDistance); - } - this.pageUrl = this.controller.getUrl(); - let result = - await this.controller.runJavaScript('javascript:document.getElementById("productList").scrollTop'); - this.scrollDistance = Number(result); - }) - // [StartExclude web_on_page_end] - .zoomAccess(false) - // [EndExclude web_on_page_end] - .onTouch(async (event: TouchEvent) => { - if (event.type === TouchType.Up) { - if (this.pageUrl.includes('product_list')) { - let result = - await this.controller.runJavaScript('javascript:document.getElementById("productList").scrollTop'); - this.scrollDistance = Number(result); - } - } - }) - // [End web_on_page_end] - .margin({ - top: this.pageUrl.includes('product_detail') ? 0 : 92, - }) - Row() { - Image($r('app.media.back')) - .width(40) - .height(40) - .margin({ - right: 8 - }) - .onClick(() => { - if (this.pageUrl.includes('product_list')) { - let want: Want = { - deviceId: '', - bundleName: 'com.example.continueprogress', - abilityName: 'EntryAbility', - } - this.context.startAbility(want); - } else if (this.pageUrl.includes('product_detail')) { - this.controller.loadUrl(i18n.System.getSystemLanguage() === 'zh-Hans' ? - 'resource://rawfile/product_list.html' : - 'resource://rawfile/product_list_en.html'); - } - }) - Text($r('app.string.tittle')) - .fontSize(20) - .fontWeight(700) - .lineHeight(27) - } - .backgroundColor(this.pageUrl.includes('product_list') ? '#FFF1F3F5' : '#00000000') - .height(56) - .width('100%') - .alignItems(VerticalAlign.Center) - .justifyContent(FlexAlign.Start) - .padding({ - left: 19, - right: 19 - }) - .margin({ - top: 36, - }) - } - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP]) - .width(CommonConstants.FULL_PERCENT) - .height(CommonConstants.FULL_PERCENT) - .backgroundColor($r('app.color.common_bg')) - .padding({ - bottom: 28 - }) - } -} \ No newline at end of file diff --git a/features/web/src/main/ets/pages/OrderConfirmPage.ets b/features/web/src/main/ets/pages/OrderConfirmPage.ets deleted file mode 100644 index 5347576f861c32a442be2be1681a2d687d07f1a5..0000000000000000000000000000000000000000 --- a/features/web/src/main/ets/pages/OrderConfirmPage.ets +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { CommonConstants } from '../common/constants/CommonConstants'; -import ProductModel from '../model/ProductModel'; - -@Extend(Text) -function titleStyle() { - .fontSize($r('app.float.font_size_mm')) - .lineHeight($r('app.float.line_height_mm')) - .fontWeight(FontWeight.Normal) - .fontFamily('HarmonyHeiTi') -} - -@Entry -@Component -struct OrderConfirmPage { - statusBarHeight: number = (this.getUIContext().getRouter().getParams() as Record)['statusBarHeight']; - sliderBarHeight: number = (this.getUIContext().getRouter().getParams() as Record)['sliderBarHeight']; - productDetail: ProductModel = - JSON.parse((this.getUIContext().getRouter().getParams() as Record)['detailStr']) as ProductModel; - - build() { - Column() { - Row() { - Image($r('app.media.ic_back_on')) - .width($r('app.float.img_size')) - .margin({ left: $r('app.float.md_padding_margin'), right: $r('app.float.lg_padding_margin') }) - .onClick(() => { - this.getUIContext().getRouter().back(); - }) - Text($r('app.string.confirm_order')) - .fontSize($r('app.float.font_size_lg')) - .fontWeight(FontWeight.Medium) - } - .width(CommonConstants.FULL_PERCENT) - .height($r('app.float.navi_height')) - - Column() { - Row() { - Image($r('app.media.ic_location')) - .width($r('app.float.location_img_size')) - .aspectRatio(1) - Column() { - Row() { - Text($r('app.string.user_name')) - .titleStyle() - Text($r('app.string.user_phone')) - .titleStyle() - .margin({ left: $r('app.float.md_padding_margin') }) - } - - Text($r('app.string.user_address')) - .titleStyle() - .fontSize($r('app.float.font_size_sm')) - .fontColor($r('app.color.desc_font')) - .margin({ top: $r('app.float.ss_padding_margin') }) - } - .alignItems(HorizontalAlign.Start) - .margin({ left: $r('app.float.md_padding_margin') }) - .layoutWeight(1) - } - .padding($r('app.float.md_padding_margin')) - .margin({ top: $r('app.float.sm_padding_margin') }) - .backgroundColor(Color.White) - .width(CommonConstants.FULL_PERCENT) - .borderRadius($r('app.float.border_radius')) - - Column({ space: CommonConstants.NORMAL_SPACE }) { - Row() { - Image($r('app.media.ic_avatar')) - .width($r('app.float.img_size')) - .aspectRatio(1) - Text($r('app.string.self_operated')) - .titleStyle() - .margin({ left: $r('app.float.sm_padding_margin') }) - } - .height($r('app.float.ext_item_height')) - .margin({ top: $r('app.float.md_padding_margin') }) - - Divider() - .vertical(false) - .width(CommonConstants.FULL_PERCENT) - .color($r('app.color.common_bg')) - - Row({ space: CommonConstants.NORMAL_SPACE }) { - Image($rawfile(this.productDetail.img)) - .width($r('app.float.product_size')) - .aspectRatio(1) - .borderRadius($r('app.float.border_radius')) - Column() { - Text(this.productDetail.name) - .titleStyle() - .textOverflow({ overflow: TextOverflow.Ellipsis }) - .maxLines(2) - Text(this.productDetail.sku) - .titleStyle() - .fontSize($r('app.float.font_size_sm')) - .lineHeight($r('app.float.line_height_sm')) - .fontColor($r('app.color.desc_font')) - .textOverflow({ overflow: TextOverflow.Ellipsis }) - .maxLines(2) - } - .justifyContent(FlexAlign.SpaceBetween) - .alignItems(HorizontalAlign.Start) - .layoutWeight(1) - .height($r('app.float.product_size')) - - Column() { - Text($r('app.string.dollar', this.productDetail.price)) - .titleStyle() - .fontWeight(FontWeight.Medium) - Text('x1') - .fontSize($r('app.float.font_size_sm')) - .fontColor($r('app.color.desc_font')) - .fontWeight(FontWeight.Medium) - .fontFamily('HarmonyHeiTi-Medium') - .margin({ top: $r('app.float.ss_padding_margin') }) - } - .margin({ left: $r('app.float.lg_padding_margin') }) - .alignItems(HorizontalAlign.End) - } - .alignItems(VerticalAlign.Top) - - Row() { - Text($r('app.string.delivery')) - .titleStyle() - Text($r('app.string.standard_delivery')) - .titleStyle() - } - .height($r('app.float.ext_item_height')) - .margin({ top: $r('app.float.md_padding_margin') }) - .width(CommonConstants.FULL_PERCENT) - .justifyContent(FlexAlign.SpaceBetween) - - Divider() - .vertical(false) - .width(CommonConstants.FULL_PERCENT) - .color($r('app.color.common_bg')) - Row() { - Text($r('app.string.invoice')) - .titleStyle() - Row() { - Text($r('app.string.personal_invoice')) - .titleStyle() - Image($r('app.media.ic_more')) - .width($r('app.float.more_img_width')) - .height($r('app.float.more_img_height')) - .margin({ left: $r('app.float.md_padding_margin') }) - } - } - .height($r('app.float.ext_item_height')) - .margin({ bottom: $r('app.float.md_padding_margin') }) - .width(CommonConstants.FULL_PERCENT) - .justifyContent(FlexAlign.SpaceBetween) - } - .alignItems(HorizontalAlign.Start) - .margin({ top: $r('app.float.md_padding_margin') }) - .padding({ left: $r('app.float.md_padding_margin'), right: $r('app.float.md_padding_margin') }) - .backgroundColor(Color.White) - .width(CommonConstants.FULL_PERCENT) - .borderRadius($r('app.float.border_radius')) - } - .layoutWeight(1) - - Row() { - Row() { - Text($r('app.string.dollar', '')) - .fontColor($r('app.color.price_red')) - .fontSize($r('app.float.font_size_md')) - .fontWeight(FontWeight.Medium) - Text(this.productDetail.price.toString()) - .fontColor($r('app.color.price_red')) - .fontSize($r('app.float.font_size_llg')) - .fontWeight(FontWeight.Medium) - } - - Button($r('app.string.confirm_order')) - .width(CommonConstants.PERCENT_50) - .linearGradient({ - angle: 90, - colors: [[$r('app.color.button_start'), 0.11], [$r('app.color.button_end'), 0.89]] - }) - .onClick(() => { - this.getUIContext().getPromptAction().showToast({ - message: $r('app.string.toast_msg'), - duration: CommonConstants.TOAST_DURATION - }); - }) - } - .margin({ bottom: $r('app.float.confirm_button_margin_bottom') }) - .justifyContent(FlexAlign.SpaceBetween) - .width(CommonConstants.FULL_PERCENT) - .height($r('app.float.navi_height')) - } - .width(CommonConstants.FULL_PERCENT) - .height(CommonConstants.FULL_PERCENT) - .backgroundColor($r('app.color.common_bg')) - .padding({ - top: this.statusBarHeight, - left: $r('app.float.md_padding_margin'), - right: $r('app.float.md_padding_margin'), - bottom: this.sliderBarHeight - }) - } -} \ No newline at end of file diff --git a/features/web/src/main/ets/webability/WebAbility.ets b/features/web/src/main/ets/webability/WebAbility.ets deleted file mode 100644 index 593fec780f66867b04b8500ffa55c7ae3d48f2fd..0000000000000000000000000000000000000000 --- a/features/web/src/main/ets/webability/WebAbility.ets +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License,Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; -import { window } from '@kit.ArkUI'; -import { distributedDataObject } from '@kit.ArkData'; -import Logger from '../common/utils/Logger'; - -const TAG = '[EntryAbility]'; - -class ContinueData { - pageUrl: string | undefined; - scrollDistance: number | undefined; - - constructor(pageUrl: string | undefined, scrollDistance: number | undefined) { - this.pageUrl = pageUrl; - this.scrollDistance = scrollDistance; - } -} - -export default class WebAbility extends UIAbility { - continueRestore(want: Want) { - if (!want.parameters || !want.parameters.distributedSessionId) { - return; - } - - let continueData: ContinueData = new ContinueData(undefined, undefined); - let dataObject = distributedDataObject.create(this.context, continueData); - dataObject.on('status', (sessionId: string, networkId: string, status: string) => { - if (status === 'restored') { - AppStorage.setOrCreate('continueRestore', true); - AppStorage.setOrCreate('pageUrl', dataObject['pageUrl']); - AppStorage.setOrCreate('scrollDistance', dataObject['scrollDistance']); - } - }); - let sessionId = want.parameters.distributedSessionId as string; - dataObject.setSessionId(sessionId); - this.context.restoreWindowStage(new LocalStorage()); - } - - onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { - Logger.info(TAG, 'Ability onCreate'); - if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) { - if (want.parameters && want.parameters.distributedSessionId) { - this.continueRestore(want); - } - } - } - - onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { - if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) { - if (want.parameters && want.parameters.distributedSessionId) { - this.continueRestore(want); - } - } - } - - onDestroy(): void { - Logger.info(TAG, 'Ability onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage): void { - // Main window is created, set main page for this ability. - Logger.info(TAG, 'Ability onWindowStageCreate'); - windowStage.loadContent('pages/IndexPage', (err, data) => { - if (err.code) { - Logger.error(TAG, 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - Logger.info(TAG, 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy(): void { - // Main window is destroyed, release UI related resources. - Logger.info(TAG, 'Ability onWindowStageDestroy'); - } - - onForeground(): void { - // Ability has brought to foreground. - Logger.info(TAG, 'Ability onForeground'); - } - - onBackground(): void { - // Ability has back to background. - Logger.info(TAG, 'Ability onBackground'); - } - - async onContinue(wantParam: Record): Promise { - let url = AppStorage.get('pageUrl') as string; - let distance = AppStorage.get('scrollDistance') as number; - AppStorage.setOrCreate('continue', false); - let continueData: ContinueData = new ContinueData(url, distance); - let dataObject = distributedDataObject.create(this.context, continueData); - let sessionId = distributedDataObject.genSessionId(); - dataObject.setSessionId(sessionId); - wantParam.distributedSessionId = sessionId; - let deviceId = wantParam.targetDevice as string; - dataObject.save(deviceId); - return AbilityConstant.OnContinueResult.AGREE; - } -} diff --git a/features/web/src/main/module.json5 b/features/web/src/main/module.json5 deleted file mode 100644 index 163e667a19ecaab93ca0006d81f0736cded8d7ca..0000000000000000000000000000000000000000 --- a/features/web/src/main/module.json5 +++ /dev/null @@ -1,27 +0,0 @@ -{ - "module": { - "name": "web", - "type": "feature", - "description": "$string:module_desc", - "mainElement": "WebAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "WebAbility", - "srcEntry": "./ets/webability/WebAbility.ets", - "description": "$string:WebAbility_desc", - "icon": "$media:layered_image", - "label": "$string:WebAbility_label", - "startWindowIcon": "$media:startIcon", - "startWindowBackground": "$color:start_window_background", - "exported": true, - "continuable": true - } - ] - } -} \ No newline at end of file diff --git a/features/web/src/main/resources/base/element/color.json b/features/web/src/main/resources/base/element/color.json deleted file mode 100644 index 60db317867ac3807694220886e6a1f3b74a7b521..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/base/element/color.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - }, - { - "name": "common_bg", - "value": "#F1F3F5" - }, - { - "name": "price_red", - "value": "#E92F4F" - }, - { - "name": "item_title_font", - "value": "#E6000000" - }, - { - "name": "desc_font", - "value": "#99000000" - }, - { - "name": "button_start", - "value": "#F64D43" - }, - { - "name": "button_end", - "value": "#EB344D" - } - ] -} \ No newline at end of file diff --git a/features/web/src/main/resources/base/element/float.json b/features/web/src/main/resources/base/element/float.json deleted file mode 100644 index 32d8fb17bfe41802d43ffd830e6ab55ff0d284aa..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/base/element/float.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "float": [ - { - "name": "font_size_sm", - "value": "12fp" - }, - { - "name": "line_height_sm", - "value": "16vp" - }, - { - "name": "font_size_mm", - "value": "14fp" - }, - { - "name": "line_height_mm", - "value": "19vp" - }, - { - "name": "font_size_md", - "value": "18fp" - }, - { - "name": "font_size_lg", - "value": "20fp" - }, - { - "name": "font_size_llg", - "value": "24fp" - }, - { - "name": "more_img_width", - "value": "6vp" - }, - { - "name": "more_img_height", - "value": "12vp" - }, - { - "name": "location_img_size", - "value": "18vp" - }, - { - "name": "ext_item_height", - "value": "20vp" - }, - { - "name": "img_size", - "value": "24vp" - }, - { - "name": "btn_size", - "value": "30vp" - }, - { - "name": "navi_height", - "value": "56vp" - }, - { - "name": "location_info_height", - "value": "64vp" - }, - { - "name": "product_size", - "value": "80vp" - }, - { - "name": "ss_padding_margin", - "value": "4vp" - }, - { - "name": "sm_padding_margin", - "value": "8vp" - }, - { - "name": "md_padding_margin", - "value": "12vp" - }, - { - "name": "lg_padding_margin", - "value": "16vp" - }, - { - "name": "border_radius", - "value": "16vp" - }, - { - "name": "confirm_button_margin_bottom", - "value": "10vp" - } - ] -} \ No newline at end of file diff --git a/features/web/src/main/resources/base/element/string.json b/features/web/src/main/resources/base/element/string.json deleted file mode 100644 index 6e26287597a7708016ef9388bb3411253199709f..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/base/element/string.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "WebAbility_desc", - "value": "description" - }, - { - "name": "WebAbility_label", - "value": "Page Redirection" - }, - { - "name": "toast_msg", - "value": "This function is not developed yet. Please look forward to it." - }, - { - "name": "confirm_order", - "value": "Confirm the order" - }, - { - "name": "dollar", - "value": "¥%d" - }, - { - "name": "invoice", - "value": "Invoice" - }, - { - "name": "personal_invoice", - "value": "Electronic Free Text Invoice - Personal" - }, - { - "name": "delivery", - "value": "Delivery" - }, - { - "name": "standard_delivery", - "value": "Standard Delivery" - }, - { - "name": "self_operated", - "value": "Mall self-operated" - }, - { - "name": "user_name", - "value": "Zhang XX" - }, - { - "name": "user_phone", - "value": "185 xxxx xxxx" - }, - { - "name": "user_address", - "value": "Room XX, Unit XX, XX Building, XXX Community, Haidian District, Beijing" - }, - { - "name": "tittle", - "value": "Web Continue" - } - ] -} \ No newline at end of file diff --git a/features/web/src/main/resources/base/media/back.png b/features/web/src/main/resources/base/media/back.png deleted file mode 100644 index 21f734f35ead6027de252373c3b8c5880b1b6269..0000000000000000000000000000000000000000 Binary files a/features/web/src/main/resources/base/media/back.png and /dev/null differ diff --git a/features/web/src/main/resources/base/media/background.png b/features/web/src/main/resources/base/media/background.png deleted file mode 100644 index f939c9fa8cc8914832e602198745f592a0dfa34d..0000000000000000000000000000000000000000 Binary files a/features/web/src/main/resources/base/media/background.png and /dev/null differ diff --git a/features/web/src/main/resources/base/media/foreground.png b/features/web/src/main/resources/base/media/foreground.png deleted file mode 100644 index 4483ddad1f079e1089d685bd204ee1cfe1d01902..0000000000000000000000000000000000000000 Binary files a/features/web/src/main/resources/base/media/foreground.png and /dev/null differ diff --git a/features/web/src/main/resources/base/media/layered_image.json b/features/web/src/main/resources/base/media/layered_image.json deleted file mode 100644 index fb49920440fb4d246c82f9ada275e26123a2136a..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/base/media/layered_image.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "layered-image": - { - "background" : "$media:background", - "foreground" : "$media:foreground" - } -} \ No newline at end of file diff --git a/features/web/src/main/resources/base/media/startIcon.png b/features/web/src/main/resources/base/media/startIcon.png deleted file mode 100644 index 205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b..0000000000000000000000000000000000000000 Binary files a/features/web/src/main/resources/base/media/startIcon.png and /dev/null differ diff --git a/features/web/src/main/resources/base/profile/main_pages.json b/features/web/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 41f761d4a1c9943174ef77e665d57dca5f148164..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/base/profile/main_pages.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "src": [ - "pages/IndexPage", - "pages/OrderConfirmPage" - ] -} diff --git a/features/web/src/main/resources/en_US/element/string.json b/features/web/src/main/resources/en_US/element/string.json deleted file mode 100644 index 6e26287597a7708016ef9388bb3411253199709f..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/en_US/element/string.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "WebAbility_desc", - "value": "description" - }, - { - "name": "WebAbility_label", - "value": "Page Redirection" - }, - { - "name": "toast_msg", - "value": "This function is not developed yet. Please look forward to it." - }, - { - "name": "confirm_order", - "value": "Confirm the order" - }, - { - "name": "dollar", - "value": "¥%d" - }, - { - "name": "invoice", - "value": "Invoice" - }, - { - "name": "personal_invoice", - "value": "Electronic Free Text Invoice - Personal" - }, - { - "name": "delivery", - "value": "Delivery" - }, - { - "name": "standard_delivery", - "value": "Standard Delivery" - }, - { - "name": "self_operated", - "value": "Mall self-operated" - }, - { - "name": "user_name", - "value": "Zhang XX" - }, - { - "name": "user_phone", - "value": "185 xxxx xxxx" - }, - { - "name": "user_address", - "value": "Room XX, Unit XX, XX Building, XXX Community, Haidian District, Beijing" - }, - { - "name": "tittle", - "value": "Web Continue" - } - ] -} \ No newline at end of file diff --git a/features/web/src/main/resources/rawfile/imgs/ic_1.png b/features/web/src/main/resources/rawfile/imgs/ic_1.png deleted file mode 100644 index 466fbb0f0531b372d844f99f47e21196039c8e7f..0000000000000000000000000000000000000000 Binary files a/features/web/src/main/resources/rawfile/imgs/ic_1.png and /dev/null differ diff --git a/features/web/src/main/resources/rawfile/imgs/ic_2.png b/features/web/src/main/resources/rawfile/imgs/ic_2.png deleted file mode 100644 index 334a2d5bbc94ab5a0e34843ae2e1ac4d6a5c8652..0000000000000000000000000000000000000000 Binary files a/features/web/src/main/resources/rawfile/imgs/ic_2.png and /dev/null differ diff --git a/features/web/src/main/resources/rawfile/imgs/ic_3.png b/features/web/src/main/resources/rawfile/imgs/ic_3.png deleted file mode 100644 index 71cb48b4334d3c9c7feed44d04d756faf75a7368..0000000000000000000000000000000000000000 Binary files a/features/web/src/main/resources/rawfile/imgs/ic_3.png and /dev/null differ diff --git a/features/web/src/main/resources/rawfile/imgs/ic_4.png b/features/web/src/main/resources/rawfile/imgs/ic_4.png deleted file mode 100644 index 96193e49d583410bbdd2f7cb9a185089dc19bec0..0000000000000000000000000000000000000000 Binary files a/features/web/src/main/resources/rawfile/imgs/ic_4.png and /dev/null differ diff --git a/features/web/src/main/resources/rawfile/imgs/ic_5.png b/features/web/src/main/resources/rawfile/imgs/ic_5.png deleted file mode 100644 index 9dd34ce4c53280e0f0092ea5a77a180ca11255df..0000000000000000000000000000000000000000 Binary files a/features/web/src/main/resources/rawfile/imgs/ic_5.png and /dev/null differ diff --git a/features/web/src/main/resources/rawfile/imgs/ic_6.png b/features/web/src/main/resources/rawfile/imgs/ic_6.png deleted file mode 100644 index 6a5278d71861fc1f74daa7622ef501731173c9fd..0000000000000000000000000000000000000000 Binary files a/features/web/src/main/resources/rawfile/imgs/ic_6.png and /dev/null differ diff --git a/features/web/src/main/resources/rawfile/imgs/ic_service.svg b/features/web/src/main/resources/rawfile/imgs/ic_service.svg deleted file mode 100644 index 89c6228feb23dbb501e64f1e0471f859658e9095..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/imgs/ic_service.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - ic_service - - - - - - - - - - \ No newline at end of file diff --git a/features/web/src/main/resources/rawfile/imgs/ic_shopping.svg b/features/web/src/main/resources/rawfile/imgs/ic_shopping.svg deleted file mode 100644 index 354899b22174db024fca0bf70e2ce357af60abaf..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/imgs/ic_shopping.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - ic_Shopping - - - - \ No newline at end of file diff --git a/features/web/src/main/resources/rawfile/js/product_detail.js b/features/web/src/main/resources/rawfile/js/product_detail.js deleted file mode 100644 index 02ffbc36d8dc53b921b386ccda7a12c99e1fa74a..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/js/product_detail.js +++ /dev/null @@ -1,100 +0,0 @@ -let productList = [ - { - 'id': 1, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_1.png', - 'price': 4488 - }, - { - 'id': 2, - 'name': 'XX设备 新品优惠!新品优惠!新品优惠!', - 'img': 'imgs/ic_2.png', - 'price': 4488 - }, - { - 'id': 3, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_3.png', - 'price': 4488 - }, - { - 'id': 4, - 'name': 'XX设备 新品优惠!新品优惠!新品优惠!', - 'img': 'imgs/ic_4.png', - 'price': 4488 - }, - { - 'id': 5, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_5.png', - 'price': 4488 - }, - { - 'id': 6, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_6.png', - 'price': 4488 - }, - { - 'id': 7, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_1.png', - 'price': 4488 - }, - { - 'id': 8, - 'name': 'XX设备 新品优惠!新品优惠!新品优惠!', - 'img': 'imgs/ic_2.png', - 'price': 4488 - }, - { - 'id': 9, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_3.png', - 'price': 4488 - }, - { - 'id': 10, - 'name': 'XX设备 新品优惠!新品优惠!新品优惠!', - 'img': 'imgs/ic_4.png', - 'price': 4488 - }, - { - 'id': 11, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_5.png', - 'price': 4488 - } -]; - -let urlSearchParams = new URLSearchParams(window.location.search); -let productIndex = urlSearchParams.get('index'); -let productDetail = productList[productIndex]; -productDetail.sku = '冰晶蓝,8GB+128GB,4G网网通,官电视剧还是快点好4G网网通'; -let swiperStr = ''; -for (let i = 0; i < 3; i++) { - swiperStr += '' -} -document.getElementById('swiper').innerHTML = swiperStr; -document.getElementById('price').innerHTML = '¥ ' + productDetail.price; -document.getElementById('product-name').innerHTML = productDetail.name; - -let currentIndex = 0; -let images = document.querySelectorAll('#swiper img'); - -function showNext() { - var currentImg = document.querySelector('.showing'); - if (currentImg) { - currentImg.classList.remove('showing'); - - currentIndex += 1; - if (currentIndex >= images.length) { - currentIndex = 0; - } - images[currentIndex].classList.add('showing'); - } else { - images[0].classList.add('showing'); - } -} - -setInterval(showNext, 2000); diff --git a/features/web/src/main/resources/rawfile/js/product_detail_en.js b/features/web/src/main/resources/rawfile/js/product_detail_en.js deleted file mode 100644 index 2812810e61b8d46a628028a4f2255a5545b1c258..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/js/product_detail_en.js +++ /dev/null @@ -1,100 +0,0 @@ -let productList = [ - { - 'id': 1, - 'name': 'XX XXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_1.png', - 'price': 4488 - }, - { - 'id': 2, - 'name': 'XX XXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_2.png', - 'price': 4488 - }, - { - 'id': 3, - 'name': 'XX XXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_3.png', - 'price': 4488 - }, - { - 'id': 4, - 'name': 'XX XXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_4.png', - 'price': 4488 - }, - { - 'id': 5, - 'name': 'XX XXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_5.png', - 'price': 4488 - }, - { - 'id': 6, - 'name': 'XX XXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_6.png', - 'price': 4488 - }, - { - 'id': 7, - 'name': 'XX XXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_1.png', - 'price': 4488 - }, - { - 'id': 8, - 'name': 'XX XXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_2.png', - 'price': 4488 - }, - { - 'id': 9, - 'name': 'XX XXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_3.png', - 'price': 4488 - }, - { - 'id': 10, - 'name': 'XX XXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_4.png', - 'price': 4488 - }, - { - 'id': 11, - 'name': 'XX XXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_5.png', - 'price': 4488 - } -]; - -let urlSearchParams = new URLSearchParams(window.location.search); -let productIndex = urlSearchParams.get('index'); -let productDetail = productList[productIndex]; -productDetail.sku = 'XXX,XGB+XXXGB,XXXXXX,XXXXXXXXXXXXXXXX'; -let swiperStr = ''; -for (let i = 0; i < 3; i++) { - swiperStr += '' -} -document.getElementById('swiper').innerHTML = swiperStr; -document.getElementById('price').innerHTML = '¥ ' + productDetail.price; -document.getElementById('product-name').innerHTML = productDetail.name; - -let currentIndex = 0; -let images = document.querySelectorAll('#swiper img'); - -function showNext() { - var currentImg = document.querySelector('.showing'); - if (currentImg) { - currentImg.classList.remove('showing'); - - currentIndex += 1; - if (currentIndex >= images.length) { - currentIndex = 0; - } - images[currentIndex].classList.add('showing'); - } else { - images[0].classList.add('showing'); - } -} - -setInterval(showNext, 2000); diff --git a/features/web/src/main/resources/rawfile/js/product_list.js b/features/web/src/main/resources/rawfile/js/product_list.js deleted file mode 100644 index e2a96f4cb9b3a81dbbd586f29c6e6ea1e57f478a..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/js/product_list.js +++ /dev/null @@ -1,90 +0,0 @@ -let productList = [ - { - 'id': 1, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_1.png', - 'price': 4488 - }, - { - 'id': 2, - 'name': 'XX设备 新品优惠!新品优惠!新品优惠!', - 'img': 'imgs/ic_2.png', - 'price': 4488 - }, - { - 'id': 3, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_3.png', - 'price': 4488 - }, - { - 'id': 4, - 'name': 'XX设备 新品优惠!新品优惠!新品优惠!', - 'img': 'imgs/ic_4.png', - 'price': 4488 - }, - { - 'id': 5, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_5.png', - 'price': 4488 - }, - { - 'id': 6, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_6.png', - 'price': 4488 - }, - { - 'id': 7, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_1.png', - 'price': 4488 - }, - { - 'id': 8, - 'name': 'XX设备 新品优惠!新品优惠!新品优惠!', - 'img': 'imgs/ic_2.png', - 'price': 4488 - }, - { - 'id': 9, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_3.png', - 'price': 4488 - }, - { - 'id': 10, - 'name': 'XX设备 新品优惠!新品优惠!新品优惠!', - 'img': 'imgs/ic_4.png', - 'price': 4488 - }, - { - 'id': 11, - 'name': 'HW nove9 新品手机【官方标配】8+128G全网通', - 'img': 'imgs/ic_5.png', - 'price': 4488 - } -]; - -function addDocument() { - let list = ''; - for (let i = 0; i < productList.length; i++) { - list += `
  • `; - list += ``; - list += '
    '; - list += `

    ${productList[i].name}

    `; - list += `¥ ${productList[i].price}`; - list += '
    '; - list += '
  • '; - - let tmp = document.getElementById('productList'); - tmp.innerHTML = list; // 添加到div里 - } -} - -addDocument(); - -function jumpDetail(index) { - window.location.href = 'product_detail.html?index=' + index; -} diff --git a/features/web/src/main/resources/rawfile/js/product_list_en.js b/features/web/src/main/resources/rawfile/js/product_list_en.js deleted file mode 100644 index 000ff92483659ac23936ce6f0c976158272e111b..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/js/product_list_en.js +++ /dev/null @@ -1,90 +0,0 @@ -let productList = [ - { - 'id': 1, - 'name': 'XXXXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_1.png', - 'price': 4488 - }, - { - 'id': 2, - 'name': 'XXXXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_2.png', - 'price': 4488 - }, - { - 'id': 3, - 'name': 'XXXXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_3.png', - 'price': 4488 - }, - { - 'id': 4, - 'name': 'XXXXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_4.png', - 'price': 4488 - }, - { - 'id': 5, - 'name': 'XXXXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_5.png', - 'price': 4488 - }, - { - 'id': 6, - 'name': 'XXXXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_6.png', - 'price': 4488 - }, - { - 'id': 7, - 'name': 'XXXXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_1.png', - 'price': 4488 - }, - { - 'id': 8, - 'name': 'XXXXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_2.png', - 'price': 4488 - }, - { - 'id': 9, - 'name': 'XXXXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_3.png', - 'price': 4488 - }, - { - 'id': 10, - 'name': 'XXXXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_4.png', - 'price': 4488 - }, - { - 'id': 11, - 'name': 'XXXXXXX XXXXXXXXXXXXXXXXXXXXXX', - 'img': 'imgs/ic_5.png', - 'price': 4488 - } -]; - -function addDocument() { - let list = ''; - for (let i = 0; i < productList.length; i++) { - list += `
  • `; - list += ``; - list += '
    '; - list += `

    ${productList[i].name}

    `; - list += `¥ ${productList[i].price}`; - list += '
    '; - list += '
  • '; - - let tmp = document.getElementById('productList'); - tmp.innerHTML = list; // 添加到div里 - } -} - -addDocument(); - -function jumpDetail(index) { - window.location.href = 'product_detail_en.html?index=' + index; -} diff --git a/features/web/src/main/resources/rawfile/product_detail.html b/features/web/src/main/resources/rawfile/product_detail.html deleted file mode 100644 index a9cc358639b2d26eb110c3e057ef7aea3126a784..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/product_detail.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - The Canavas Danmu Wall - - -
    -
    - -
    -
    -
    -
    -
    -
    HW nove9 新品手机【官方标配】8+128G全网通
    -
    商品详情:
    -
    商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情

    - 商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情商品详情

    -
    -
    -
    - -
    - - - diff --git a/features/web/src/main/resources/rawfile/product_detail_en.html b/features/web/src/main/resources/rawfile/product_detail_en.html deleted file mode 100644 index 03629012939d0b3079d932dbabaeb7a441ea5ddc..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/product_detail_en.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - The Canavas Danmu Wall - - -
    -
    - -
    -
    -
    -
    -
    -
    'XX XXXXX XXXXXXXXXXXXXXXXXXXXXX'
    -
    XXXX:
    -
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    - XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    -
    -
    -
    - -
    - - - diff --git a/features/web/src/main/resources/rawfile/product_list.html b/features/web/src/main/resources/rawfile/product_list.html deleted file mode 100644 index 3c17a93267b6e9ac5189bae04c7cad93daca42d8..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/product_list.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - The Canavas Danmu Wall - - -
    -
      -
    -
    - - - diff --git a/features/web/src/main/resources/rawfile/product_list_en.html b/features/web/src/main/resources/rawfile/product_list_en.html deleted file mode 100644 index 3dd4b4713807566223f581e16efbbc61c0a002f5..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/product_list_en.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - The Canavas Danmu Wall - - -
    -
      -
    -
    - - - diff --git a/features/web/src/main/resources/rawfile/style/product_detail.css b/features/web/src/main/resources/rawfile/style/product_detail.css deleted file mode 100644 index a653c3d902757c2f0cd0a280a0df44b83f9ce381..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/style/product_detail.css +++ /dev/null @@ -1,158 +0,0 @@ -body { - margin: 0; -} - -#detail { - width: 100%; - height: 100vh; - background-color: #F1F3F5; - display: flex; - flex-direction: column; - justify-content: space-between; -} - -#detail-info { - flex: 1; - overflow: scroll; -} - -#slider { - width: 100vw; - height:100vw; - background-color: #000000; - overflow: hidden; -} -#swiper { - width: 100vw; - height:100vw; - background-color: #000000; -} - -#swiper > img { - height: 100%; - aspect-ratio: 1.42; - margin: 0px 0 24px 0; - object-fit: cover; - display: none; -} - -.showing { - display: block !important; -} -#dot { - position: absolute; - right: 18px; - top: 68vw; - z-index: 2; - width: 36px; - height: 18px; - border-radius: 9px; - background-color: rgba(0,0,0,0.40); - color: white; - text-align: center; - font-size: 12px; - line-height: 18px; - font-weight: 400; -} - -#info { - margin: 12px; - background-color: #FFFFFF; - border-radius: 16px; - padding: 12px; - color: #182431; -} - -#price { - font-size: 20px; - color: #E92F4F; - line-height: 28px; - font-weight: 500; - margin-top: 4px; -} - -#price > span { - font-size: 14px; -} - -#product-name { - font-size: 16px; - line-height: 21px; - font-weight: 400; - margin-top: 12px; -} - -#guide { - font-size: 14px; - line-height: 20px; - font-weight: 400; - margin-top: 26px; -} - -#product-info { - font-size: 14px; - opacity: 0.6; - text-align: left; - line-height: 20px; - font-weight: 400; - margin-top: 8px; -} - -br { - display: inline; - line-height: 8px; -} - -#menu { - height: 56px; - padding: 0 12px; - align-items: center; - display: flex; - flex-direction: row; -} - -#menu > div { - display: flex; -} - -#menu > div:first-of-type { - flex: 1; - justify-content: space-around; -} - -.btn { - display: flex; - flex-direction: column; -} - -.btn > img { - width: 24px; - height: 24px; -} - -.btn > text { - margin-top: 4px; - font-size: 10px; - text-align: center; - color: #182431; -} - -button { - color: #FFFFFF; - border: none; - height: 40px; - width: 96px -} - -button:first-of-type { - margin-left: 8px; - border-bottom-left-radius: 20px; - border-top-left-radius: 20px; - background: linear-gradient(270deg, #FF914C 52%, #FEA748 96%); -} - -button:last-of-type { - border-bottom-right-radius: 20px; - border-top-right-radius: 20px; - background: linear-gradient(90deg, #F64D43 11%, #EB344D 89%); -} \ No newline at end of file diff --git a/features/web/src/main/resources/rawfile/style/product_detail_en.css b/features/web/src/main/resources/rawfile/style/product_detail_en.css deleted file mode 100644 index a653c3d902757c2f0cd0a280a0df44b83f9ce381..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/style/product_detail_en.css +++ /dev/null @@ -1,158 +0,0 @@ -body { - margin: 0; -} - -#detail { - width: 100%; - height: 100vh; - background-color: #F1F3F5; - display: flex; - flex-direction: column; - justify-content: space-between; -} - -#detail-info { - flex: 1; - overflow: scroll; -} - -#slider { - width: 100vw; - height:100vw; - background-color: #000000; - overflow: hidden; -} -#swiper { - width: 100vw; - height:100vw; - background-color: #000000; -} - -#swiper > img { - height: 100%; - aspect-ratio: 1.42; - margin: 0px 0 24px 0; - object-fit: cover; - display: none; -} - -.showing { - display: block !important; -} -#dot { - position: absolute; - right: 18px; - top: 68vw; - z-index: 2; - width: 36px; - height: 18px; - border-radius: 9px; - background-color: rgba(0,0,0,0.40); - color: white; - text-align: center; - font-size: 12px; - line-height: 18px; - font-weight: 400; -} - -#info { - margin: 12px; - background-color: #FFFFFF; - border-radius: 16px; - padding: 12px; - color: #182431; -} - -#price { - font-size: 20px; - color: #E92F4F; - line-height: 28px; - font-weight: 500; - margin-top: 4px; -} - -#price > span { - font-size: 14px; -} - -#product-name { - font-size: 16px; - line-height: 21px; - font-weight: 400; - margin-top: 12px; -} - -#guide { - font-size: 14px; - line-height: 20px; - font-weight: 400; - margin-top: 26px; -} - -#product-info { - font-size: 14px; - opacity: 0.6; - text-align: left; - line-height: 20px; - font-weight: 400; - margin-top: 8px; -} - -br { - display: inline; - line-height: 8px; -} - -#menu { - height: 56px; - padding: 0 12px; - align-items: center; - display: flex; - flex-direction: row; -} - -#menu > div { - display: flex; -} - -#menu > div:first-of-type { - flex: 1; - justify-content: space-around; -} - -.btn { - display: flex; - flex-direction: column; -} - -.btn > img { - width: 24px; - height: 24px; -} - -.btn > text { - margin-top: 4px; - font-size: 10px; - text-align: center; - color: #182431; -} - -button { - color: #FFFFFF; - border: none; - height: 40px; - width: 96px -} - -button:first-of-type { - margin-left: 8px; - border-bottom-left-radius: 20px; - border-top-left-radius: 20px; - background: linear-gradient(270deg, #FF914C 52%, #FEA748 96%); -} - -button:last-of-type { - border-bottom-right-radius: 20px; - border-top-right-radius: 20px; - background: linear-gradient(90deg, #F64D43 11%, #EB344D 89%); -} \ No newline at end of file diff --git a/features/web/src/main/resources/rawfile/style/product_list.css b/features/web/src/main/resources/rawfile/style/product_list.css deleted file mode 100644 index 400a4965bd579b0ea515e7f572e7f4666634e68e..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/style/product_list.css +++ /dev/null @@ -1,56 +0,0 @@ -body { - margin: 0; -} - -#container { - width: 100vw; - height: 100vh; - display: flex; - flex-direction: column; -} -#nav { - height: 56px; - font-size: 24px; - color: #182431; - text-align: left; - line-height: 56px; - font-weight: 700; - padding: 0 24px; -} - -ul { - overflow: scroll; - list-style-type: none; - padding: 0; - margin: 0; -} -li { - display: flex; - padding: 8px 24px; -} -li > img { - width: 106px; - aspect-ratio: 1; - border-radius: 18px; -} -li > div { - margin-left: 12px; - flex: 1; -} -li > div > p { - font-size: 14px; - line-height: 19px; - color: #182431; - font-weight: 400; - text-align: justify; -} - -li > div > span { - font-size: 21px; - color: #E92F4F; - line-height: 28px; - font-weight: 500; -} -li > div > span > span { - font-size: 14px; -} \ No newline at end of file diff --git a/features/web/src/main/resources/rawfile/style/product_list_en.css b/features/web/src/main/resources/rawfile/style/product_list_en.css deleted file mode 100644 index 400a4965bd579b0ea515e7f572e7f4666634e68e..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/rawfile/style/product_list_en.css +++ /dev/null @@ -1,56 +0,0 @@ -body { - margin: 0; -} - -#container { - width: 100vw; - height: 100vh; - display: flex; - flex-direction: column; -} -#nav { - height: 56px; - font-size: 24px; - color: #182431; - text-align: left; - line-height: 56px; - font-weight: 700; - padding: 0 24px; -} - -ul { - overflow: scroll; - list-style-type: none; - padding: 0; - margin: 0; -} -li { - display: flex; - padding: 8px 24px; -} -li > img { - width: 106px; - aspect-ratio: 1; - border-radius: 18px; -} -li > div { - margin-left: 12px; - flex: 1; -} -li > div > p { - font-size: 14px; - line-height: 19px; - color: #182431; - font-weight: 400; - text-align: justify; -} - -li > div > span { - font-size: 21px; - color: #E92F4F; - line-height: 28px; - font-weight: 500; -} -li > div > span > span { - font-size: 14px; -} \ No newline at end of file diff --git a/features/web/src/main/resources/zh_CN/element/string.json b/features/web/src/main/resources/zh_CN/element/string.json deleted file mode 100644 index ef3cc17e2e6c1ac7f592756bc28a5d939a030532..0000000000000000000000000000000000000000 --- a/features/web/src/main/resources/zh_CN/element/string.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "string": [ - { - "name": "module_desc", - "value": "模块描述" - }, - { - "name": "WebAbility_desc", - "value": "description" - }, - { - "name": "WebAbility_label", - "value": "H5页面跳转" - }, - { - "name": "toast_msg", - "value": "该功能暂未开发,敬请期待" - }, - { - "name": "confirm_order", - "value": "确认订单" - }, - { - "name": "dollar", - "value": "¥%d" - }, - { - "name": "invoice", - "value": "发票" - }, - { - "name": "personal_invoice", - "value": "电子普通发票-个人" - }, - { - "name": "delivery", - "value": "配送" - }, - { - "name": "standard_delivery", - "value": "标准配送" - }, - { - "name": "self_operated", - "value": "商城自营" - }, - { - "name": "user_name", - "value": "张XX" - }, - { - "name": "user_phone", - "value": "185 xxxx xxxx" - }, - { - "name": "user_address", - "value": "北京市 海淀区 XXX小区XX楼XX单元XX室" - }, - { - "name": "tittle", - "value": "web页面浏览进度接续" - } - ] -} \ No newline at end of file