Showing
7 changed files
with
46 additions
and
56 deletions
| @@ -108,9 +108,9 @@ export class ProcessUtils { | @@ -108,9 +108,9 @@ export class ProcessUtils { | ||
| 108 | break; | 108 | break; |
| 109 | case ContentConstants.TYPE_TELETEXT: | 109 | case ContentConstants.TYPE_TELETEXT: |
| 110 | // 图文详情,跳转h5 | 110 | // 图文详情,跳转h5 |
| 111 | - if(content?.linkUrl){ //有 linkUrl 走专题页展示逻辑 | ||
| 112 | - ProcessUtils.gotoSpecialTopic(content) | ||
| 113 | - }else{ | 111 | + if (content?.linkUrl) { //有 linkUrl 走专题页展示逻辑 |
| 112 | + ProcessUtils.gotoSpecialTopic(content,true) | ||
| 113 | + } else { | ||
| 114 | ProcessUtils.gotoWeb(content); | 114 | ProcessUtils.gotoWeb(content); |
| 115 | } | 115 | } |
| 116 | break; | 116 | break; |
| @@ -191,13 +191,14 @@ export class ProcessUtils { | @@ -191,13 +191,14 @@ export class ProcessUtils { | ||
| 191 | WDRouterRule.jumpWithAction(taskAction) | 191 | WDRouterRule.jumpWithAction(taskAction) |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | - public static gotoSpecialTopic(content: ContentDTO) { | 194 | + public static gotoSpecialTopic(content: ContentDTO, backVisibility?: boolean) { |
| 195 | let taskAction: Action = { | 195 | let taskAction: Action = { |
| 196 | type: 'JUMP_INNER_NEW_PAGE', | 196 | type: 'JUMP_INNER_NEW_PAGE', |
| 197 | params: { | 197 | params: { |
| 198 | contentID: content?.objectId, | 198 | contentID: content?.objectId, |
| 199 | url: content.linkUrl, | 199 | url: content.linkUrl, |
| 200 | pageID: 'SPACIAL_TOPIC_PAGE', | 200 | pageID: 'SPACIAL_TOPIC_PAGE', |
| 201 | + backVisibility: backVisibility, | ||
| 201 | extra: { | 202 | extra: { |
| 202 | relType: content?.relType, | 203 | relType: content?.relType, |
| 203 | relId: content?.relId, | 204 | relId: content?.relId, |
| @@ -12,26 +12,13 @@ const TAG = 'WdWebComponent'; | @@ -12,26 +12,13 @@ const TAG = 'WdWebComponent'; | ||
| 12 | @Component | 12 | @Component |
| 13 | export struct WdWebComponent { | 13 | export struct WdWebComponent { |
| 14 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 14 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 15 | - onWebPrepared: () => void = () => {} | ||
| 16 | - @Prop backVisibility: boolean = false | 15 | + onWebPrepared: () => void = () => { |
| 16 | + } | ||
| 17 | @Prop webUrl: string = '' | 17 | @Prop webUrl: string = '' |
| 18 | @Link isPageEnd: boolean | 18 | @Link isPageEnd: boolean |
| 19 | 19 | ||
| 20 | build() { | 20 | build() { |
| 21 | Column() { | 21 | Column() { |
| 22 | - Row() { | ||
| 23 | - Image($r("app.media.ic_back")) | ||
| 24 | - .width(44) | ||
| 25 | - .padding(13) | ||
| 26 | - .aspectRatio(1) | ||
| 27 | - .onClick(() => { | ||
| 28 | - router.back(); | ||
| 29 | - }) | ||
| 30 | - }.backgroundColor(Color.Black) | ||
| 31 | - .width('100%') | ||
| 32 | - .height(44) | ||
| 33 | - .visibility(this.backVisibility ? Visibility.Visible : Visibility.None) | ||
| 34 | - | ||
| 35 | Web({ src: this.webUrl, controller: this.webviewControl }) | 22 | Web({ src: this.webUrl, controller: this.webviewControl }) |
| 36 | .domStorageAccess(true) | 23 | .domStorageAccess(true) |
| 37 | .databaseAccess(true) | 24 | .databaseAccess(true) |
| @@ -76,6 +63,7 @@ export struct WdWebComponent { | @@ -76,6 +63,7 @@ export struct WdWebComponent { | ||
| 76 | this.webviewControl.registerHandler(handleName, { handle: handle }); | 63 | this.webviewControl.registerHandler(handleName, { handle: handle }); |
| 77 | } | 64 | } |
| 78 | } | 65 | } |
| 66 | + | ||
| 79 | /** | 67 | /** |
| 80 | * 默认【CallNative】逻辑处理 | 68 | * 默认【CallNative】逻辑处理 |
| 81 | */ | 69 | */ |
| @@ -161,9 +161,11 @@ export struct ImageAndTextPageComponent { | @@ -161,9 +161,11 @@ export struct ImageAndTextPageComponent { | ||
| 161 | operationButtonList: this.operationButtonList, | 161 | operationButtonList: this.operationButtonList, |
| 162 | styleType: 1, | 162 | styleType: 1, |
| 163 | }) | 163 | }) |
| 164 | + .position({y: '100%'}) | ||
| 164 | } | 165 | } |
| 165 | .width(CommonConstants.FULL_WIDTH) | 166 | .width(CommonConstants.FULL_WIDTH) |
| 166 | .height(CommonConstants.FULL_HEIGHT) | 167 | .height(CommonConstants.FULL_HEIGHT) |
| 168 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 167 | .padding({ top: 38 }) | 169 | .padding({ top: 38 }) |
| 168 | 170 | ||
| 169 | // 发布时间 | 171 | // 发布时间 |
| @@ -196,7 +198,6 @@ export struct ImageAndTextPageComponent { | @@ -196,7 +198,6 @@ export struct ImageAndTextPageComponent { | ||
| 196 | .width(CommonConstants.FULL_WIDTH) | 198 | .width(CommonConstants.FULL_WIDTH) |
| 197 | .height(CommonConstants.FULL_HEIGHT) | 199 | .height(CommonConstants.FULL_HEIGHT) |
| 198 | .backgroundColor(Color.White) | 200 | .backgroundColor(Color.White) |
| 199 | - | ||
| 200 | } | 201 | } |
| 201 | 202 | ||
| 202 | private async getDetail() { | 203 | private async getDetail() { |
| @@ -9,7 +9,7 @@ import { OperRowListView } from './view/OperRowListView'; | @@ -9,7 +9,7 @@ import { OperRowListView } from './view/OperRowListView'; | ||
| 9 | import DetailViewModel from '../viewmodel/DetailViewModel'; | 9 | import DetailViewModel from '../viewmodel/DetailViewModel'; |
| 10 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; | 10 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; |
| 11 | import { EmptyComponent } from '../components/view/EmptyComponent'; | 11 | import { EmptyComponent } from '../components/view/EmptyComponent'; |
| 12 | -import { NetworkUtil } from 'wdKit'; | 12 | +import { NetworkUtil, WindowModel } from 'wdKit'; |
| 13 | 13 | ||
| 14 | const TAG: string = 'SpacialTopicPageComponent' | 14 | const TAG: string = 'SpacialTopicPageComponent' |
| 15 | 15 | ||
| @@ -89,17 +89,25 @@ export struct SpacialTopicPageComponent { | @@ -89,17 +89,25 @@ export struct SpacialTopicPageComponent { | ||
| 89 | Column() { | 89 | Column() { |
| 90 | Stack({ alignContent: Alignment.Bottom }) { | 90 | Stack({ alignContent: Alignment.Bottom }) { |
| 91 | Column() { | 91 | Column() { |
| 92 | + Text(this.contentDetailData?.newsTitle) | ||
| 93 | + .backgroundColor(Color.White) | ||
| 94 | + .width('100%') | ||
| 95 | + .height(40) | ||
| 96 | + .fontSize(18) | ||
| 97 | + .textAlign(TextAlign.Center) | ||
| 98 | + .fontWeight(500) | ||
| 99 | + .visibility(this.action?.params?.backVisibility && this.isPageEnd ? Visibility.Visible : Visibility.None) | ||
| 100 | + | ||
| 92 | WdWebComponent({ | 101 | WdWebComponent({ |
| 93 | webviewControl: this.webviewControl, | 102 | webviewControl: this.webviewControl, |
| 94 | webUrl: this.webUrl, | 103 | webUrl: this.webUrl, |
| 95 | - backVisibility: false, | ||
| 96 | onWebPrepared: this.onWebPrepared.bind(this), | 104 | onWebPrepared: this.onWebPrepared.bind(this), |
| 97 | - isPageEnd: $isPageEnd | 105 | + isPageEnd: $isPageEnd, |
| 98 | }) | 106 | }) |
| 99 | } | 107 | } |
| 100 | .width(CommonConstants.FULL_WIDTH) | 108 | .width(CommonConstants.FULL_WIDTH) |
| 101 | .height(CommonConstants.FULL_HEIGHT) | 109 | .height(CommonConstants.FULL_HEIGHT) |
| 102 | - .padding({ bottom: 75 }) | 110 | + .padding({ bottom: this.action?.params?.backVisibility ? 115 : 75 }) |
| 103 | 111 | ||
| 104 | if (!this.isNetConnected) { | 112 | if (!this.isNetConnected) { |
| 105 | EmptyComponent({ | 113 | EmptyComponent({ |
| @@ -111,7 +119,7 @@ export struct SpacialTopicPageComponent { | @@ -111,7 +119,7 @@ export struct SpacialTopicPageComponent { | ||
| 111 | }).padding({ bottom: 200 }) | 119 | }).padding({ bottom: 200 }) |
| 112 | } else { | 120 | } else { |
| 113 | if (!this.isPageEnd) { | 121 | if (!this.isPageEnd) { |
| 114 | - detailedSkeleton() | 122 | + detailedSkeleton().padding({ bottom: this.bottomSafeHeight }) |
| 115 | } | 123 | } |
| 116 | } | 124 | } |
| 117 | //底部交互区 | 125 | //底部交互区 |
| @@ -120,17 +128,33 @@ export struct SpacialTopicPageComponent { | @@ -120,17 +128,33 @@ export struct SpacialTopicPageComponent { | ||
| 120 | publishCommentModel: this.publishCommentModel, | 128 | publishCommentModel: this.publishCommentModel, |
| 121 | operationButtonList: this.operationButtonList, | 129 | operationButtonList: this.operationButtonList, |
| 122 | }) | 130 | }) |
| 123 | - .padding({ | ||
| 124 | - bottom: `${this.bottomSafeHeight}px` | ||
| 125 | - }) | ||
| 126 | } | 131 | } |
| 127 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 132 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 128 | } | 133 | } |
| 129 | 134 | ||
| 135 | + onPageShow() { | ||
| 136 | + if (!this.action?.params?.backVisibility) { | ||
| 137 | + WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + | ||
| 130 | aboutToAppear() { | 141 | aboutToAppear() { |
| 131 | - if (this.action) { | ||
| 132 | - this.webUrl = this.action.params?.url || '' | 142 | + if (!this.action?.params?.backVisibility) { |
| 143 | + WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 133 | } | 144 | } |
| 145 | + this.webUrl = this.action?.params?.url || '' | ||
| 134 | this.getDetail() | 146 | this.getDetail() |
| 135 | } | 147 | } |
| 148 | + | ||
| 149 | + onPageHide() { | ||
| 150 | + if (!this.action?.params?.backVisibility) { | ||
| 151 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 152 | + } | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + aboutToDisappear() { | ||
| 156 | + if (!this.action?.params?.backVisibility) { | ||
| 157 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 158 | + } | ||
| 159 | + } | ||
| 136 | } | 160 | } |
| 1 | import { Action } from 'wdBean'; | 1 | import { Action } from 'wdBean'; |
| 2 | import { SpacialTopicPageComponent } from 'wdComponent' | 2 | import { SpacialTopicPageComponent } from 'wdComponent' |
| 3 | import { CommonConstants } from 'wdConstant' | 3 | import { CommonConstants } from 'wdConstant' |
| 4 | -import { Logger, WindowModel } from 'wdKit' | 4 | +import { Logger } from 'wdKit' |
| 5 | import router from '@ohos.router'; | 5 | import router from '@ohos.router'; |
| 6 | 6 | ||
| 7 | const TAG = 'SpacialTopicPage'; | 7 | const TAG = 'SpacialTopicPage'; |
| @@ -30,28 +30,8 @@ struct SpacialTopicPage { | @@ -30,28 +30,8 @@ struct SpacialTopicPage { | ||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | aboutToAppear() { | 32 | aboutToAppear() { |
| 33 | - WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 34 | Logger.info(TAG, 'aboutToAppear'); | 33 | Logger.info(TAG, 'aboutToAppear'); |
| 35 | let action: Action = router.getParams() as Action | 34 | let action: Action = router.getParams() as Action |
| 36 | this.action = action | 35 | this.action = action |
| 37 | } | 36 | } |
| 38 | - | ||
| 39 | - aboutToDisappear() { | ||
| 40 | - Logger.info(TAG, 'aboutToDisappear'); | ||
| 41 | - WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - onPageShow() { | ||
| 45 | - WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 46 | - Logger.info(TAG, 'onPageShow'); | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - onPageHide() { | ||
| 50 | - Logger.info(TAG, 'onPageHide'); | ||
| 51 | - WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - onBackPress() { | ||
| 55 | - Logger.info(TAG, 'onBackPress'); | ||
| 56 | - } | ||
| 57 | } | 37 | } |
| @@ -17,20 +17,15 @@ struct DefaultWebPage { | @@ -17,20 +17,15 @@ struct DefaultWebPage { | ||
| 17 | 17 | ||
| 18 | build() { | 18 | build() { |
| 19 | Column() { | 19 | Column() { |
| 20 | - Stack({ alignContent: Alignment.Bottom }) { | ||
| 21 | - Column() { | ||
| 22 | WdWebComponent({ | 20 | WdWebComponent({ |
| 23 | webviewControl: this.webviewControl, | 21 | webviewControl: this.webviewControl, |
| 24 | webUrl: this.webUrl, | 22 | webUrl: this.webUrl, |
| 25 | - backVisibility: false, | ||
| 26 | isPageEnd: $isPageEnd | 23 | isPageEnd: $isPageEnd |
| 27 | }) | 24 | }) |
| 28 | } | 25 | } |
| 29 | .width(CommonConstants.FULL_WIDTH) | 26 | .width(CommonConstants.FULL_WIDTH) |
| 30 | .height(CommonConstants.FULL_HEIGHT) | 27 | .height(CommonConstants.FULL_HEIGHT) |
| 31 | } | 28 | } |
| 32 | - }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | ||
| 33 | - } | ||
| 34 | 29 | ||
| 35 | aboutToAppear() { | 30 | aboutToAppear() { |
| 36 | let action: Action = router.getParams() as Action | 31 | let action: Action = router.getParams() as Action |
-
Please register or login to post a comment