张善主

Merge remote-tracking branch 'origin/main'

@@ -98,4 +98,8 @@ export class DeviceUtil { @@ -98,4 +98,8 @@ export class DeviceUtil {
98 static isTablet(): boolean { 98 static isTablet(): boolean {
99 return deviceInfo.deviceType == 'tablet'; 99 return deviceInfo.deviceType == 'tablet';
100 } 100 }
  101 +
  102 + static is2in1(): boolean {
  103 + return deviceInfo.deviceType == '2in1';
  104 + }
101 } 105 }
@@ -43,6 +43,9 @@ export class WindowModel { @@ -43,6 +43,9 @@ export class WindowModel {
43 return this.windowClass as window.Window 43 return this.windowClass as window.Window
44 } 44 }
45 45
  46 + /**
  47 + * @deprecated 应用整体全屏,不需要再设置全屏与否了。
  48 + */
46 setMainWindowFullScreen(fullScreen: boolean) { 49 setMainWindowFullScreen(fullScreen: boolean) {
47 if (deviceInfo.deviceType != "phone") { 50 if (deviceInfo.deviceType != "phone") {
48 return 51 return
@@ -140,6 +143,9 @@ export class WindowModel { @@ -140,6 +143,9 @@ export class WindowModel {
140 return this.windowClass?.getWindowProperties() 143 return this.windowClass?.getWindowProperties()
141 } 144 }
142 145
  146 + /**
  147 + * @deprecated 应用整体全屏,不需要再设置全屏与否了。
  148 + */
143 setWindowLayoutFullScreen(isFullScreen: boolean) { 149 setWindowLayoutFullScreen(isFullScreen: boolean) {
144 this.isFullScreen = isFullScreen 150 this.isFullScreen = isFullScreen
145 this.windowClass?.setWindowLayoutFullScreen(isFullScreen) 151 this.windowClass?.setWindowLayoutFullScreen(isFullScreen)
@@ -35,7 +35,7 @@ export struct topicInfoView { @@ -35,7 +35,7 @@ export struct topicInfoView {
35 if (this.frontLinkObject.linkUrl.length > 0 || this.frontLinkObject?.newsId.length > 0) { 35 if (this.frontLinkObject.linkUrl.length > 0 || this.frontLinkObject?.newsId.length > 0) {
36 Row() { 36 Row() {
37 Text("查看详情") 37 Text("查看详情")
38 - .fontSize(14) 38 + .fontSize(12)
39 .fontColor($r('app.color.white')) 39 .fontColor($r('app.color.white'))
40 .maxLines(1) 40 .maxLines(1)
41 .borderRadius(2) 41 .borderRadius(2)
@@ -59,7 +59,7 @@ export struct topicInfoView { @@ -59,7 +59,7 @@ export struct topicInfoView {
59 ProcessUtils.processPage(contentDTO) 59 ProcessUtils.processPage(contentDTO)
60 60
61 }) 61 })
62 - .width(80) 62 + .width(70)
63 .alignRules({ 63 .alignRules({
64 left: { anchor: "__container__", align: HorizontalAlign.Start }, 64 left: { anchor: "__container__", align: HorizontalAlign.Start },
65 bottom: { anchor: "__container__", align: VerticalAlign.Bottom } 65 bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
@@ -85,7 +85,7 @@ export struct topicInfoView { @@ -85,7 +85,7 @@ export struct topicInfoView {
85 left: { anchor: "__container__", align: HorizontalAlign.Start }, 85 left: { anchor: "__container__", align: HorizontalAlign.Start },
86 bottom: this.frontLinkObject.linkUrl.length > 0 || this.frontLinkObject?.newsId.length > 0 ?{ anchor: "row_detail", align: VerticalAlign.Top }:{ anchor: "__container__", align: VerticalAlign.Bottom } 86 bottom: this.frontLinkObject.linkUrl.length > 0 || this.frontLinkObject?.newsId.length > 0 ?{ anchor: "row_detail", align: VerticalAlign.Top }:{ anchor: "__container__", align: VerticalAlign.Bottom }
87 }) 87 })
88 - .margin({top: 10 , left: 16, right: 16, bottom: this.frontLinkObject.linkUrl.length > 0 || this.frontLinkObject?.newsId.length > 0 ?0:16}) 88 + .margin({top: 10 , left: 16, right: 16, bottom: this.frontLinkObject.linkUrl.length > 0 || this.frontLinkObject?.newsId.length > 0 ?10:16})
89 .id('txt_summary') 89 .id('txt_summary')
90 90
91 Text(this.frontLinkObject?.title ?? "") 91 Text(this.frontLinkObject?.title ?? "")
@@ -88,7 +88,7 @@ export struct Card6Component { @@ -88,7 +88,7 @@ export struct Card6Component {
88 .fontSize(18) 88 .fontSize(18)
89 .lineHeight(27) 89 .lineHeight(27)
90 .fontWeight(FontWeight.Normal) 90 .fontWeight(FontWeight.Normal)
91 - .maxLines(this.contentDTO.appStyle === '6' ? 4 : 2) 91 + .maxLines(this.contentDTO.appStyle === '6' ? 4 : 3)
92 .alignSelf(ItemAlign.Start) 92 .alignSelf(ItemAlign.Start)
93 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 93 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
94 .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && 94 .textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
@@ -107,7 +107,7 @@ export struct Card6Component { @@ -107,7 +107,7 @@ export struct Card6Component {
107 } 107 }
108 108
109 .alignItems(HorizontalAlign.Start) 109 .alignItems(HorizontalAlign.Start)
110 - .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156) 110 + .height(this.contentDTO.appStyle === CompStyle.Card_13 ? '' : 156)
111 111
112 112
113 .justifyContent(FlexAlign.SpaceBetween) 113 .justifyContent(FlexAlign.SpaceBetween)
@@ -138,7 +138,8 @@ export struct Card6Component { @@ -138,7 +138,8 @@ export struct Card6Component {
138 }) 138 })
139 139
140 .width(CommonConstants.FULL_WIDTH) 140 .width(CommonConstants.FULL_WIDTH)
141 - .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 106 : 184) .justifyContent(FlexAlign.SpaceBetween) 141 + .height(this.contentDTO.appStyle === CompStyle.Card_13 ? '' : 184)
  142 + .justifyContent(FlexAlign.SpaceBetween)
142 .alignItems(VerticalAlign.Top) 143 .alignItems(VerticalAlign.Top)
143 } 144 }
144 } 145 }
@@ -44,10 +44,14 @@ export struct ZhSingleRow04 { @@ -44,10 +44,14 @@ export struct ZhSingleRow04 {
44 .onClick(() => { 44 .onClick(() => {
45 if (this.compDTO?.objectType === '11') { 45 if (this.compDTO?.objectType === '11') {
46 ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle) 46 ProcessUtils.jumpChannelTab(this.compDTO.objectId, this.compDTO.pageId as string, this.compDTO.objectTitle)
47 - } else if (this.compDTO?.objectType === '5') {  
48 - ProcessUtils._gotoSpecialTopic(this.compDTO.linkUrl)  
49 - } else if (this.compDTO?.objectType === '6') {  
50 - ProcessUtils._gotoDefaultWeb(this.compDTO.linkUrl) 47 + } else {
  48 + const contentDTO: ContentDTO = {
  49 + objectId: this.compDTO.objectId,
  50 + objectType: this.compDTO.objectType,
  51 + linkUrl: this.compDTO.linkUrl,
  52 + pageId: this.compDTO.pageId
  53 + } as ContentDTO
  54 + ProcessUtils.processPage(contentDTO)
51 } 55 }
52 }) 56 })
53 } 57 }
@@ -84,6 +88,7 @@ export struct ZhSingleRow04 { @@ -84,6 +88,7 @@ export struct ZhSingleRow04 {
84 .scrollBar(BarState.Off) 88 .scrollBar(BarState.Off)
85 .width(CommonConstants.FULL_PARENT) 89 .width(CommonConstants.FULL_PARENT)
86 .height(166) 90 .height(166)
  91 + .edgeEffect(EdgeEffect.None)
87 } 92 }
88 .width(CommonConstants.FULL_WIDTH) 93 .width(CommonConstants.FULL_WIDTH)
89 .backgroundColor($r("app.color.white")) 94 .backgroundColor($r("app.color.white"))
@@ -19,6 +19,7 @@ const TAG = 'MinePageComponent'; @@ -19,6 +19,7 @@ const TAG = 'MinePageComponent';
19 */ 19 */
20 @Component 20 @Component
21 export struct MinePageComponent { 21 export struct MinePageComponent {
  22 + private topRectHeight: string = AppStorage.get<number>('topSafeHeight') + 'px';
22 //是否是创作者 23 //是否是创作者
23 @State isCreator:boolean = false 24 @State isCreator:boolean = false
24 @State isLogin:boolean = false //默认 false 测试放开 25 @State isLogin:boolean = false //默认 false 测试放开
@@ -167,6 +168,8 @@ export struct MinePageComponent { @@ -167,6 +168,8 @@ export struct MinePageComponent {
167 .backgroundColor($r('app.color.color_F9F9F9')) 168 .backgroundColor($r('app.color.color_F9F9F9'))
168 .scrollable(ScrollDirection.Vertical) 169 .scrollable(ScrollDirection.Vertical)
169 .scrollBar(BarState.Off) 170 .scrollBar(BarState.Off)
  171 + // 预留状态栏、导航栏高度
  172 + .margin({ top: this.topRectHeight})
170 } 173 }
171 174
172 175
@@ -22,6 +22,7 @@ const storage = LocalStorage.getShared(); @@ -22,6 +22,7 @@ const storage = LocalStorage.getShared();
22 @Entry(storage) 22 @Entry(storage)
23 @Component 23 @Component
24 export struct TopNavigationComponentNew { 24 export struct TopNavigationComponentNew {
  25 + private topRectHeight: string = AppStorage.get<number>('topSafeHeight') + 'px';
25 /** 26 /**
26 * @deprecated 27 * @deprecated
27 */ 28 */
@@ -138,6 +139,8 @@ export struct TopNavigationComponentNew { @@ -138,6 +139,8 @@ export struct TopNavigationComponentNew {
138 .width('100%') 139 .width('100%')
139 .height('100%') 140 .height('100%')
140 } 141 }
  142 + // 预留状态栏
  143 + .margin({ top: this.topRectHeight })
141 } 144 }
142 145
143 @Builder 146 @Builder
@@ -133,6 +133,7 @@ struct MineHomePage { @@ -133,6 +133,7 @@ struct MineHomePage {
133 .backgroundImageSize(ImageSize.Cover) 133 .backgroundImageSize(ImageSize.Cover)
134 .padding({left:"17lpx",right:"8lpx"}) 134 .padding({left:"17lpx",right:"8lpx"})
135 .height('35lpx') 135 .height('35lpx')
  136 + .borderRadius({topRight:2,bottomRight:2})
136 } 137 }
137 138
138 Blank() 139 Blank()
@@ -78,7 +78,7 @@ export struct DetailPlayVLivePage { @@ -78,7 +78,7 @@ export struct DetailPlayVLivePage {
78 LiveEmptyComponent({ 78 LiveEmptyComponent({
79 emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend 79 emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
80 }) 80 })
81 - .height('30%').margin({top:this.topSafeHeight }) 81 + .height('40%').margin({top:this.topSafeHeight })
82 } else { 82 } else {
83 83
84 if (this.liveDetailPageLogic.showPad) { 84 if (this.liveDetailPageLogic.showPad) {
@@ -92,7 +92,7 @@ export struct DetailPlayVLivePage { @@ -92,7 +92,7 @@ export struct DetailPlayVLivePage {
92 LiveEmptyComponent({ 92 LiveEmptyComponent({
93 emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend 93 emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
94 }) 94 })
95 - .height('30%').margin({top:this.topSafeHeight }) 95 + .height('40%').margin({top:this.topSafeHeight })
96 } 96 }
97 97
98 98
@@ -14,6 +14,7 @@ import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdK @@ -14,6 +14,7 @@ import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdK
14 import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index' 14 import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index'
15 15
16 const TAG = "PlayerCommentComponent" 16 const TAG = "PlayerCommentComponent"
  17 +
17 /** 18 /**
18 * 沉浸式直播--- 聊天区域 19 * 沉浸式直播--- 聊天区域
19 */ 20 */
@@ -52,7 +53,7 @@ export struct PlayerCommentComponent { @@ -52,7 +53,7 @@ export struct PlayerCommentComponent {
52 this.liveViewModel.getLiveCommentList( 53 this.liveViewModel.getLiveCommentList(
53 1, 54 1,
54 this.contentDetailData?.liveInfo?.mlive?.mliveId, 55 this.contentDetailData?.liveInfo?.mlive?.mliveId,
55 - this.contentDetailData?.newsId+'', 56 + this.contentDetailData?.newsId + '',
56 20,) 57 20,)
57 .then( 58 .then(
58 (data) => { 59 (data) => {
@@ -82,21 +83,22 @@ export struct PlayerCommentComponent { @@ -82,21 +83,22 @@ export struct PlayerCommentComponent {
82 83
83 build() { 84 build() {
84 Column() { 85 Column() {
85 - List({ scroller: this.scroller }) {  
86 - // 主持人  
87 - if (this.contentDetailData.oldNewsId) {  
88 - ChartItemCompereComponent()  
89 - }  
90 - ForEach(this.liveChatList, (item: LiveRoomItemBean) => {  
91 - ListItem() {  
92 - ChatItemComponent({ item: item }) 86 + Stack({ alignContent: Alignment.BottomStart }) {
  87 + List({ scroller: this.scroller }) {
  88 + // 主持人
  89 + if (this.contentDetailData.oldNewsId) {
  90 + ChartItemCompereComponent()
93 } 91 }
94 - })  
95 - }  
96 - .height(280)  
97 - .width('80%')  
98 - .scrollBar(BarState.Off)  
99 - .margin({ bottom: 20 }) 92 + ForEach(this.liveChatList, (item: LiveRoomItemBean) => {
  93 + ListItem() {
  94 + ChatItemComponent({ item: item })
  95 + }
  96 + })
  97 + }
  98 + .width('80%')
  99 + .scrollBar(BarState.Off)
  100 +
  101 + }.height(280)
100 102
101 // 收藏、分享、点赞是否需要根据字段显隐 103 // 收藏、分享、点赞是否需要根据字段显隐
102 LiveOperRowListView({ 104 LiveOperRowListView({
@@ -13,6 +13,7 @@ export struct PlayerUIComponent { @@ -13,6 +13,7 @@ export struct PlayerUIComponent {
13 13
14 build() { 14 build() {
15 Stack() { 15 Stack() {
  16 + // 标题
16 PlayerTitleComponent() 17 PlayerTitleComponent()
17 18
18 PlayerCommentComponent() 19 PlayerCommentComponent()
1 import AbilityConstant from '@ohos.app.ability.AbilityConstant'; 1 import AbilityConstant from '@ohos.app.ability.AbilityConstant';
2 import app from '@system.app'; 2 import app from '@system.app';
3 -import hilog from '@ohos.hilog';  
4 import UIAbility from '@ohos.app.ability.UIAbility'; 3 import UIAbility from '@ohos.app.ability.UIAbility';
5 import Want from '@ohos.app.ability.Want'; 4 import Want from '@ohos.app.ability.Want';
6 import window from '@ohos.window'; 5 import window from '@ohos.window';
7 import { BusinessError } from '@ohos.base'; 6 import { BusinessError } from '@ohos.base';
8 -import { DeviceUtil, EmitterEventId, EmitterUtils, WindowModel } from 'wdKit'; 7 +import { DeviceUtil, EmitterEventId, EmitterUtils, Logger, WindowModel } from 'wdKit';
9 import { ConfigurationConstant } from '@kit.AbilityKit'; 8 import { ConfigurationConstant } from '@kit.AbilityKit';
10 import { StartupManager } from '../startupmanager/StartupManager'; 9 import { StartupManager } from '../startupmanager/StartupManager';
11 -import { UIContext } from '@ohos.arkui.UIContext';  
12 10
13 let floatWindowClass: window.Window | null = null; 11 let floatWindowClass: window.Window | null = null;
  12 +const TAG = 'EntryAbility'
14 13
15 export default class EntryAbility extends UIAbility { 14 export default class EntryAbility extends UIAbility {
16 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { 15 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
17 StartupManager.sharedInstance().appOnCreate(want, launchParam, this.context) 16 StartupManager.sharedInstance().appOnCreate(want, launchParam, this.context)
18 - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); 17 + Logger.info(TAG, 'Ability onCreate');
19 18
20 // 还没深色模式需求,暂直接不跟随系统。 19 // 还没深色模式需求,暂直接不跟随系统。
21 this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT); 20 this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT);
@@ -32,13 +31,13 @@ export default class EntryAbility extends UIAbility { @@ -32,13 +31,13 @@ export default class EntryAbility extends UIAbility {
32 } 31 }
33 32
34 onDestroy(): void { 33 onDestroy(): void {
35 - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); 34 + Logger.info(TAG, 'Ability onDestroy');
36 StartupManager.sharedInstance().appOnDestory() 35 StartupManager.sharedInstance().appOnDestory()
37 } 36 }
38 37
39 onWindowStageCreate(windowStage: window.WindowStage): void { 38 onWindowStageCreate(windowStage: window.WindowStage): void {
40 // Main window is created, set main page for this ability 39 // Main window is created, set main page for this ability
41 - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); 40 + Logger.info(TAG, 'Ability onWindowStageCreate');
42 WindowModel.shared.setWindowStage(windowStage); 41 WindowModel.shared.setWindowStage(windowStage);
43 // 2. 获取布局避让遮挡的区域 42 // 2. 获取布局避让遮挡的区域
44 const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 43 const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
@@ -57,72 +56,50 @@ export default class EntryAbility extends UIAbility { @@ -57,72 +56,50 @@ export default class EntryAbility extends UIAbility {
57 // 音频悬浮窗初始移动位置604为ui高度 56 // 音频悬浮窗初始移动位置604为ui高度
58 let initMoveY = vp2px(604) 57 let initMoveY = vp2px(604)
59 58
60 -  
61 - // 在普通phone/折叠屏/tablet设备上以沉浸式(全屏)启动  
62 - if (DeviceUtil.isPhone() || DeviceUtil.isTablet()) {  
63 - // 设置窗口的布局是否为沉浸式布局  
64 - // 沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。  
65 - // 非沉浸式布局是指布局避让状态栏与导航栏,组件不会与其重叠。  
66 - // windowClass.setWindowLayoutFullScreen(true)  
67 - // 设置窗口全屏模式时窗口内导航栏、状态栏的属性  
68 - // windowClass.setWindowSystemBarProperties({  
69 - // statusBarContentColor: "#FFFFFF"  
70 - // })  
71 -  
72 - // 设置启动时窗口的显示方向属性,  
73 - // 普通phone以PORTRAIT/竖屏显示模式启动  
74 - // 折叠屏和tablet是以AUTO_ROTATION_RESTRICTED/受开关控制的自动旋转模式启动  
75 - WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)  
76 - .then(() => {  
77 - hilog.info(0x0000, 'testTag', 'setPreferredOrientation Succeeded');  
78 - })  
79 - .catch((err: Error) => {  
80 - hilog.error(0x0000, 'testTag',  
81 - `setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`);  
82 - })  
83 - } 59 + this.onWindowSetup(windowClass)
84 60
85 //../../../../../../features/wdLogin/src/main/ets/pages/launchPage/LaunchPage 61 //../../../../../../features/wdLogin/src/main/ets/pages/launchPage/LaunchPage
86 windowStage.loadContent('pages/launchPage/LaunchPage', (err, data) => { 62 windowStage.loadContent('pages/launchPage/LaunchPage', (err, data) => {
87 if (err.code) { 63 if (err.code) {
88 - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); 64 + Logger.error(TAG, 'Failed to load the content. Cause: ' + JSON.stringify(err) ?? '');
89 return; 65 return;
90 } 66 }
91 - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); 67 + Logger.info(TAG, 'Succeeded in loading the content. Data: ' + JSON.stringify(data) ?? '');
92 }); 68 });
93 // 1.创建悬浮窗 69 // 1.创建悬浮窗
94 windowStage.createSubWindow('subWindow', (err: BusinessError, data) => { 70 windowStage.createSubWindow('subWindow', (err: BusinessError, data) => {
95 let errCode: number = err.code; 71 let errCode: number = err.code;
96 if (errCode) { 72 if (errCode) {
97 - console.error('floatWindowClass Failed to create the subwindow. Cause: ' + JSON.stringify(err)); 73 + Logger.error('floatWindowClass Failed to create the subwindow. Cause: ' + JSON.stringify(err));
98 return; 74 return;
99 } 75 }
100 - console.info('floatWindowClass Succeeded in creating the subwindow. Data: ' + JSON.stringify(data)); 76 + Logger.info('floatWindowClass Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
101 floatWindowClass = data; 77 floatWindowClass = data;
102 AppStorage.setOrCreate('floatWindowClass', floatWindowClass); 78 AppStorage.setOrCreate('floatWindowClass', floatWindowClass);
103 // 2.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。 79 // 2.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。
104 floatWindowClass.moveWindowTo(0, initMoveY, (err: BusinessError) => { 80 floatWindowClass.moveWindowTo(0, initMoveY, (err: BusinessError) => {
105 let errCode: number = err.code; 81 let errCode: number = err.code;
106 if (errCode) { 82 if (errCode) {
107 - console.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err)); 83 + Logger.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));
108 return; 84 return;
109 } 85 }
110 - console.info('floatWindowClass Succeeded in moving the window.'); 86 + Logger.info('floatWindowClass Succeeded in moving the window.');
111 }); 87 });
112 // 3.为悬浮窗加载对应的目标页面。 88 // 3.为悬浮窗加载对应的目标页面。
113 floatWindowClass.setUIContent("pages/view/AudioComponent", (err: BusinessError) => { 89 floatWindowClass.setUIContent("pages/view/AudioComponent", (err: BusinessError) => {
114 let errCode: number = err.code; 90 let errCode: number = err.code;
115 if (errCode) { 91 if (errCode) {
116 - console.error('floatWindowClass Failed to load the content. Cause:' + JSON.stringify(err)); 92 + Logger.error('floatWindowClass Failed to load the content. Cause:' + JSON.stringify(err));
117 return; 93 return;
118 } 94 }
119 - console.info('floatWindowClass Succeeded in loading the content.'); 95 + Logger.info('floatWindowClass Succeeded in loading the content.');
120 let color: string = 'rgba(0,0,0,0)'; 96 let color: string = 'rgba(0,0,0,0)';
121 try { 97 try {
122 (floatWindowClass as window.Window).setWindowBackgroundColor(color); 98 (floatWindowClass as window.Window).setWindowBackgroundColor(color);
123 } catch (exception) { 99 } catch (exception) {
124 - console.error('Failed to set the background color. Cause: ' + JSON.stringify(exception));  
125 - }; 100 + Logger.error('Failed to set the background color. Cause: ' + JSON.stringify(exception));
  101 + }
  102 + ;
126 }); 103 });
127 104
128 floatWindowClass.on('windowEvent', (data) => { 105 floatWindowClass.on('windowEvent', (data) => {
@@ -132,33 +109,68 @@ export default class EntryAbility extends UIAbility { @@ -132,33 +109,68 @@ export default class EntryAbility extends UIAbility {
132 }); 109 });
133 } 110 }
134 111
  112 + public async onWindowSetup(mainWindow: window.Window) {
  113 + // 在普通phone/折叠屏/tablet设备上以沉浸式(全屏)启动
  114 + if (DeviceUtil.isPhone() || DeviceUtil.isTablet()) {
  115 + // 设置窗口的布局是否为沉浸式布局
  116 + // 沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。
  117 + // 非沉浸式布局是指布局避让状态栏与导航栏,,组件不会与其重叠
  118 + mainWindow.setWindowLayoutFullScreen(true)
  119 + //设置窗口全屏模式时窗口内导航栏、状态栏的属性
  120 + mainWindow.setWindowSystemBarProperties({
  121 + //statusBarColor:'#000000'
  122 + statusBarContentColor: '#FFFFFF'
  123 + })
  124 + mainWindow.setSpecificSystemBarEnabled('status', true)
  125 +
  126 + // 设置启动时窗口的显示方向属性,
  127 + // 普通phone以PORTRAIT/竖屏显示模式启动
  128 + // 折叠屏和tablet是以AUTO_ROTATION_RESTRICTED/受开关控制的自动旋转模式启动
  129 + WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)
  130 + .then(() => {
  131 + Logger.info(TAG, 'setPreferredOrientation Succeeded');
  132 + })
  133 + .catch((err: Error) => {
  134 + Logger.info(TAG,
  135 + `setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`);
  136 + })
  137 + } else if (DeviceUtil.is2in1()) {
  138 + // 2in1(PC)设备不支持旋转(无横竖屏模式),会以默认窗口(非全屏)显示模式启动Logger.info(TAG,`start at 2in1 window device )
  139 + Logger.info(TAG, 'start at 2in1 window device')
  140 + } else {
  141 + // 轻量级智能穿戴/lite wearable device
  142 + Logger.info(TAG, 'start at other type device')
  143 + }
  144 +
  145 + }
  146 +
135 destroyFloatWindow() { 147 destroyFloatWindow() {
136 (floatWindowClass as window.Window).destroyWindow((err: BusinessError) => { 148 (floatWindowClass as window.Window).destroyWindow((err: BusinessError) => {
137 let errCode: number = err.code; 149 let errCode: number = err.code;
138 if (errCode) { 150 if (errCode) {
139 - console.error('floatWindowClass Failed to destroy the window. Cause: ' + JSON.stringify(err)); 151 + Logger.error('floatWindowClass Failed to destroy the window. Cause: ' + JSON.stringify(err));
140 return; 152 return;
141 } 153 }
142 - console.info('floatWindowClass Succeeded in destroying the window.'); 154 + Logger.info('floatWindowClass Succeeded in destroying the window.');
143 }); 155 });
144 } 156 }
145 157
146 onWindowStageDestroy(): void { 158 onWindowStageDestroy(): void {
147 // Main window is destroyed, release UI related resources 159 // Main window is destroyed, release UI related resources
148 this.destroyFloatWindow() 160 this.destroyFloatWindow()
149 - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); 161 + Logger.info(TAG, 'Ability onWindowStageDestroy');
150 } 162 }
151 163
152 onForeground(): void { 164 onForeground(): void {
153 // Ability has brought to foreground 165 // Ability has brought to foreground
154 - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); 166 + Logger.info(TAG, 'Ability onForeground');
155 167
156 EmitterUtils.sendEmptyEvent(EmitterEventId.APP_ENTER_FOREGROUD) 168 EmitterUtils.sendEmptyEvent(EmitterEventId.APP_ENTER_FOREGROUD)
157 } 169 }
158 170
159 onBackground(): void { 171 onBackground(): void {
160 // Ability has back to background 172 // Ability has back to background
161 - hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); 173 + Logger.info(TAG, 'Ability onBackground');
162 174
163 EmitterUtils.sendEmptyEvent(EmitterEventId.APP_ENTER_BACKGROUD) 175 EmitterUtils.sendEmptyEvent(EmitterEventId.APP_ENTER_BACKGROUD)
164 } 176 }
@@ -176,7 +176,7 @@ struct LaunchAdvertisingPage { @@ -176,7 +176,7 @@ struct LaunchAdvertisingPage {
176 if (this.defaultModel.openType == '2') { 176 if (this.defaultModel.openType == '2') {
177 //端外打开 177 //端外打开
178 ProcessUtils.jumpExternalWebPage(this.defaultModel.linkUrl) 178 ProcessUtils.jumpExternalWebPage(this.defaultModel.linkUrl)
179 - }else { 179 + }else if(this.defaultModel.openType == '1'){
180 //端内打开 180 //端内打开
181 ProcessUtils.gotoDefaultWebPage(this.defaultModel.linkUrl) 181 ProcessUtils.gotoDefaultWebPage(this.defaultModel.linkUrl)
182 } 182 }
@@ -222,6 +222,7 @@ struct LaunchAdvertisingPage { @@ -222,6 +222,7 @@ struct LaunchAdvertisingPage {
222 this.defaultModel.bootVideoUrl = dataModel.launchAdInfo[0].matInfo.matVideoUrl 222 this.defaultModel.bootVideoUrl = dataModel.launchAdInfo[0].matInfo.matVideoUrl
223 this.defaultModel.showType = dataModel.launchAdInfo[0].matInfo.matType 223 this.defaultModel.showType = dataModel.launchAdInfo[0].matInfo.matType
224 this.defaultModel.isAd = '1' 224 this.defaultModel.isAd = '1'
  225 + this.defaultModel.openType = dataModel.launchAdInfo[0].matInfo.openType
225 } 226 }
226 } 227 }
227 228
@@ -23,6 +23,7 @@ let storage = LocalStorage.getShared(); @@ -23,6 +23,7 @@ let storage = LocalStorage.getShared();
23 @Component 23 @Component
24 export struct BottomNavigationComponent { 24 export struct BottomNavigationComponent {
25 @Provide bottomRectHeight: number = 0 25 @Provide bottomRectHeight: number = 0
  26 + private bottomRectHeight1: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
26 @Provide topRectHeight: number = 0 27 @Provide topRectHeight: number = 0
27 @Provide isLayoutFullScreen: boolean = false 28 @Provide isLayoutFullScreen: boolean = false
28 @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL 29 @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL
@@ -73,50 +74,51 @@ export struct BottomNavigationComponent { @@ -73,50 +74,51 @@ export struct BottomNavigationComponent {
73 } 74 }
74 75
75 build() { 76 build() {
76 - Tabs({ barPosition: BarPosition.End, index: this.currentNavIndex, controller: this.navController }) {  
77 - ForEach(this.bottomNavList, (navItem: BottomNavDTO, index: number) => {  
78 - TabContent() {  
79 - if (CompUtils.isMine(navItem)) {  
80 - // 我的页面组件数据列表  
81 - MinePageComponent({ isMinePage: this.currentNavIndex === this.bottomNavList.length - 1 })  
82 - } else if (navItem.name === '视频') {  
83 - // 视频频道,包含视频和直播  
84 - VideoChannelPage({  
85 - topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),  
86 - _currentNavIndex: $currentNavIndex,  
87 - autoRefresh: this.autoRefresh  
88 - })  
89 - } else {  
90 - TopNavigationComponentNew({  
91 - groupId: navItem.id,  
92 - topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),  
93 - _currentNavIndex: $currentNavIndex,  
94 - bottomNavIndex: index,  
95 - currentBottomNavName: navItem.name,  
96 - assignChannel: this.assignChannel,  
97 - autoRefresh: this.autoRefresh  
98 - }) 77 + Column() {
  78 + Tabs({ barPosition: BarPosition.End, index: this.currentNavIndex, controller: this.navController }) {
  79 + ForEach(this.bottomNavList, (navItem: BottomNavDTO, index: number) => {
  80 + TabContent() {
  81 + if (CompUtils.isMine(navItem)) {
  82 + // 我的页面组件数据列表
  83 + MinePageComponent({ isMinePage: this.currentNavIndex === this.bottomNavList.length - 1 })
  84 + } else if (navItem.name === '视频') {
  85 + // 视频频道,包含视频和直播
  86 + VideoChannelPage({
  87 + topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
  88 + _currentNavIndex: $currentNavIndex,
  89 + autoRefresh: this.autoRefresh
  90 + })
  91 + } else {
  92 + TopNavigationComponentNew({
  93 + groupId: navItem.id,
  94 + topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
  95 + _currentNavIndex: $currentNavIndex,
  96 + bottomNavIndex: index,
  97 + currentBottomNavName: navItem.name,
  98 + assignChannel: this.assignChannel,
  99 + autoRefresh: this.autoRefresh
  100 + })
  101 + }
99 } 102 }
100 - }  
101 - .tabBar(this.tabBarBuilder(navItem, index)) 103 + .tabBar(this.tabBarBuilder(navItem, index))
102 104
103 - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])  
104 - }); 105 + // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
  106 + });
105 107
106 - }  
107 - .zIndex(10)  
108 - .scrollable(false)  
109 - .animationDuration(0)  
110 - .barHeight(this.displayDirection === DisplayDirection.VERTICAL ? $r('app.float.bottom_navigation_barHeight') :  
111 - 0.001)  
112 - .barMode(BarMode.Fixed)  
113 - .barBackgroundColor(this.barBackgroundColor)  
114 - // 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域  
115 - .backgroundColor(this.barBackgroundColor)  
116 - .expandSafeArea([SafeAreaType.SYSTEM])  
117 -  
118 - // .padding({ bottom: this.bottomRectHeight + 'px', top: this.topRectHeight + 'px' }) // 此处margin具体数值在实际中应与导航条区域高度保持一致 108 + }
  109 + .zIndex(10)
  110 + .scrollable(false)
  111 + .animationDuration(0)
  112 + .barHeight(this.displayDirection === DisplayDirection.VERTICAL ? $r('app.float.bottom_navigation_barHeight') :
  113 + 0.001)
  114 + .barMode(BarMode.Fixed)
  115 + .barBackgroundColor(this.barBackgroundColor)
  116 + // 备注:鸿蒙目前只有修改三线导航背景方法,对于全面屏导航条手机需要设置背景色并使其扩散到导航区域
  117 + .backgroundColor(this.barBackgroundColor)
  118 + .layoutWeight(1)
119 119
  120 + Blank().width('100%').height(this.bottomRectHeight1).backgroundColor(this.barBackgroundColor)
  121 + }.height('100%').width('100%')
120 } 122 }
121 123
122 @Builder 124 @Builder
1 import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit'; 1 import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit';
2 import { window } from '@kit.ArkUI'; 2 import { window } from '@kit.ArkUI';
3 import { BusinessError } from '@kit.BasicServicesKit'; 3 import { BusinessError } from '@kit.BasicServicesKit';
  4 +import { NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
4 import { ProcessUtils } from 'wdRouter'; 5 import { ProcessUtils } from 'wdRouter';
  6 +import DailyPaperTopicModel from 'wdComponent/src/main/ets/model/DailyPaperTopicModel'
  7 +
5 /** 8 /**
6 * 意图调用 9 * 意图调用
7 */ 10 */
@@ -19,7 +22,7 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { @@ -19,7 +22,7 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor {
19 */ 22 */
20 onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage): 23 onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage):
21 Promise<insightIntent.ExecuteResult> { 24 Promise<insightIntent.ExecuteResult> {
22 - console.log('yzl onExecuteInUIAbilityForegroundMode',name,JSON.stringify(param)) 25 + console.log('yzl onExecuteInUIAbilityForegroundMode', name, JSON.stringify(param))
23 // 根据意图名称分发处理逻辑 26 // 根据意图名称分发处理逻辑
24 switch (name) { 27 switch (name) {
25 case InsightIntentExecutorImpl.ViewBlog: 28 case InsightIntentExecutorImpl.ViewBlog:
@@ -36,19 +39,19 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { @@ -36,19 +39,19 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor {
36 } 39 }
37 } as insightIntent.ExecuteResult) 40 } as insightIntent.ExecuteResult)
38 } 41 }
  42 +
39 /** 43 /**
40 * 实现习惯推荐功能 44 * 实现习惯推荐功能
41 * @param param 意图参数 45 * @param param 意图参数
42 * @param pageLoader 窗口 46 * @param pageLoader 窗口
43 */ 47 */
44 - private jumpToViewBlog(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> {  
45 - console.log('yzl jumpToView',JSON.stringify(param)) 48 + private jumpToViewBlog(param: Record<string, Object>,
  49 + pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> {
  50 + console.log('yzl jumpToView', JSON.stringify(param))
46 return new Promise((resolve, reject) => { 51 return new Promise((resolve, reject) => {
47 - // TODO 实现意图调用,loadContent的入参为歌曲落地页路径,例如:pages/SongPage  
48 // TODO 热启动是否切到主页 52 // TODO 热启动是否切到主页
49 pageLoader.loadContent('pages/MainPage') 53 pageLoader.loadContent('pages/MainPage')
50 .then(() => { 54 .then(() => {
51 -  
52 resolve({ 55 resolve({
53 code: 0, 56 code: 0,
54 result: { 57 result: {
@@ -72,12 +75,26 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { @@ -72,12 +75,26 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor {
72 * @param param 意图参数 75 * @param param 意图参数
73 * @param pageLoader 窗口 76 * @param pageLoader 窗口
74 */ 77 */
75 - private jumpToViewColumnUpdate(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> {  
76 - console.log('yzl jumpToViewColum',JSON.stringify(param)) 78 + private jumpToViewColumnUpdate(param: Record<string, Object>,
  79 + pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> {
77 return new Promise((resolve, reject) => { 80 return new Promise((resolve, reject) => {
78 pageLoader.loadContent('pages/MainPage') 81 pageLoader.loadContent('pages/MainPage')
79 .then(() => { 82 .then(() => {
80 - ProcessUtils.gotoMorningEveningPaper() 83 + if (NetworkUtil.isNetConnected()) {
  84 + DailyPaperTopicModel.getDailyPaperTopic().then(dailyPaperTopicBean => {
  85 + if (dailyPaperTopicBean && dailyPaperTopicBean.id > 0) {
  86 + SPHelper.default.saveSync('dailyPaperTopicPageId', dailyPaperTopicBean.id);
  87 + ProcessUtils.gotoMorningEveningPaper() //跳转至早晚报页面
  88 + } else {
  89 + ToastUtils.showToast('暂无早晚报信息', 1000)
  90 + }
  91 + }).catch((err: string) => {
  92 + console.log('yzlerr',JSON.stringify(err))
  93 + ToastUtils.showToast('暂无早晚报信息', 1000)
  94 + })
  95 + } else {
  96 + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000)
  97 + }
81 resolve({ 98 resolve({
82 code: 0, 99 code: 0,
83 result: { 100 result: {