Showing
149 changed files
with
315 additions
and
115 deletions
| @@ -5,13 +5,13 @@ | @@ -5,13 +5,13 @@ | ||
| 5 | "name": "default", | 5 | "name": "default", |
| 6 | "type": "HarmonyOS", | 6 | "type": "HarmonyOS", |
| 7 | "material": { | 7 | "material": { |
| 8 | - "certpath": "C:\\Users\\PC\\.ohos\\config\\auto_debug_sight_harmony_com.wondertek.sight_70086000309521319.cer", | ||
| 9 | - "storePassword": "0000001B264B065AE68D1C7F3C0863A33C083D91E12CC54AA36D44179AA8DBA37EA3C50E7F3692F5EB6F3E", | 8 | + "certpath": "C:\\Users\\PC\\.ohos\\config\\auto_debug_sight_harmony_com.wondertek.sight_70086000327424393.cer", |
| 9 | + "storePassword": "0000001A76406594DCD45689E6888037F1FA52EA0D15317DD495835E1F8D18BEF743FCEB51D881F01BA2", | ||
| 10 | "keyAlias": "debugKey", | 10 | "keyAlias": "debugKey", |
| 11 | - "keyPassword": "0000001BFB62A8007F44B0EAAF9CF878A92620ED75A21E53B3740EA60DEBF6543F6E16AA7200542280D746", | ||
| 12 | - "profile": "C:\\Users\\PC\\.ohos\\config\\auto_debug_sight_harmony_com.wondertek.sight_70086000309521319.p7b", | 11 | + "keyPassword": "0000001ACD3163BEAB09744DEA803A35F7B90073531926D60C13C3BA4F277C41CDB92A46819ED663CD31", |
| 12 | + "profile": "C:\\Users\\PC\\.ohos\\config\\auto_debug_sight_harmony_com.wondertek.sight_70086000327424393.p7b", | ||
| 13 | "signAlg": "SHA256withECDSA", | 13 | "signAlg": "SHA256withECDSA", |
| 14 | - "storeFile": "C:\\Users\\PC\\.ohos\\config\\auto_debug_sight_harmony_com.wondertek.sight_70086000309521319.p12" | 14 | + "storeFile": "C:\\Users\\PC\\.ohos\\config\\auto_debug_sight_harmony_com.wondertek.sight_70086000327424393.p12" |
| 15 | } | 15 | } |
| 16 | } | 16 | } |
| 17 | ], | 17 | ], |
| 1 | +import { Action } from 'wdBean'; | ||
| 1 | import { ImageAndTextPageComponent } from 'wdComponent' | 2 | import { ImageAndTextPageComponent } from 'wdComponent' |
| 2 | import { Logger } from 'wdKit' | 3 | import { Logger } from 'wdKit' |
| 4 | +import router from '@ohos.router'; | ||
| 3 | 5 | ||
| 4 | const TAG = 'ImageAndTextDetailPage'; | 6 | const TAG = 'ImageAndTextDetailPage'; |
| 5 | 7 | ||
| 6 | @Entry | 8 | @Entry |
| 7 | @Component | 9 | @Component |
| 8 | struct ImageAndTextDetailPage { | 10 | struct ImageAndTextDetailPage { |
| 11 | + action: Action = {} as Action | ||
| 9 | 12 | ||
| 10 | build() { | 13 | build() { |
| 11 | Column() { | 14 | Column() { |
| 12 | - ImageAndTextPageComponent() | 15 | + ImageAndTextPageComponent({action: this.action}) |
| 13 | } | 16 | } |
| 14 | } | 17 | } |
| 15 | 18 | ||
| @@ -25,6 +28,8 @@ struct ImageAndTextDetailPage { | @@ -25,6 +28,8 @@ struct ImageAndTextDetailPage { | ||
| 25 | 28 | ||
| 26 | aboutToAppear() { | 29 | aboutToAppear() { |
| 27 | Logger.info(TAG, 'aboutToAppear'); | 30 | Logger.info(TAG, 'aboutToAppear'); |
| 31 | + let action: Action = router.getParams() as Action | ||
| 32 | + this.action = action | ||
| 28 | } | 33 | } |
| 29 | 34 | ||
| 30 | aboutToDisappear() { | 35 | aboutToDisappear() { |
| @@ -51,4 +51,12 @@ export { ReLInfoDTO } from './src/main/ets/bean/detail/ReLInfoDTO'; | @@ -51,4 +51,12 @@ export { ReLInfoDTO } from './src/main/ets/bean/detail/ReLInfoDTO'; | ||
| 51 | 51 | ||
| 52 | export { ShareInfoDTO } from './src/main/ets/bean/detail/ShareInfoDTO'; | 52 | export { ShareInfoDTO } from './src/main/ets/bean/detail/ShareInfoDTO'; |
| 53 | 53 | ||
| 54 | -export { VideoInfoDTO } from './src/main/ets/bean/detail/VideoInfoDTO'; | ||
| 54 | +export { VideoInfoDTO } from './src/main/ets/bean/detail/VideoInfoDTO'; | ||
| 55 | + | ||
| 56 | +export { H5ReceiveDetailBean } from './src/main/ets/bean/h5/H5ReceiveDetailBean'; | ||
| 57 | + | ||
| 58 | +export { H5ReceiveDataJsonBean } from './src/main/ets/bean/h5/H5ReceiveDataJsonBean'; | ||
| 59 | + | ||
| 60 | +export { H5ReceiveDataExtraBean } from './src/main/ets/bean/h5/H5ReceiveDataExtraBean'; | ||
| 61 | + | ||
| 62 | +export { ResponseBean } from './src/main/ets/bean/h5/ResponseBean'; |
| @@ -4,4 +4,12 @@ import { ItemDTO } from '../../ItemDTO'; | @@ -4,4 +4,12 @@ import { ItemDTO } from '../../ItemDTO'; | ||
| 4 | // 附加字段集合,不同组件,额外附加参数不同 | 4 | // 附加字段集合,不同组件,额外附加参数不同 |
| 5 | export interface ExtraDTO extends ItemDTO { | 5 | export interface ExtraDTO extends ItemDTO { |
| 6 | labels?: LabelDTO[]; | 6 | labels?: LabelDTO[]; |
| 7 | + contentId: string; | ||
| 8 | + contentType: string; | ||
| 9 | + topicId: string; | ||
| 10 | + channelId: string; | ||
| 11 | + compId: string; | ||
| 12 | + sourcePage: string; | ||
| 13 | + relId: string; | ||
| 14 | + relType: string; | ||
| 7 | } | 15 | } |
| 1 | +import { ContentDetailDTO } from '../detail/ContentDetailDTO'; | ||
| 2 | + | ||
| 3 | +export interface ResponseBean{ | ||
| 4 | + success:boolean; | ||
| 5 | + | ||
| 6 | + // 服务请求响应值/微服务响应状态码” | ||
| 7 | + code: number; | ||
| 8 | + | ||
| 9 | + // 服务请求响应说明 | ||
| 10 | + message: string; | ||
| 11 | + | ||
| 12 | + // 响应结果 | ||
| 13 | + data:ContentDetailDTO; | ||
| 14 | + | ||
| 15 | + // 请求响应时间戳(unix格式) | ||
| 16 | + timestamp?: number; | ||
| 17 | +} |
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | "wdConstant": "file:../wdConstant", | 10 | "wdConstant": "file:../wdConstant", |
| 11 | "wdKit": "file:../wdKit", | 11 | "wdKit": "file:../wdKit", |
| 12 | + "wdWebComponent": "file:../wdWebComponent", | ||
| 12 | "wdBean": "file:../wdBean", | 13 | "wdBean": "file:../wdBean", |
| 13 | "wdRouter": "file:../wdRouter", | 14 | "wdRouter": "file:../wdRouter", |
| 14 | "wdNetwork": "file:../wdNetwork" | 15 | "wdNetwork": "file:../wdNetwork" |
| 1 | -import { NewspaperListItemBean, NewspaperPositionItemBean } from 'wdBean'; | 1 | +import { Action, NewspaperListItemBean, NewspaperPositionItemBean, Params } from 'wdBean'; |
| 2 | +import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'; | ||
| 2 | import { StringUtils } from 'wdKit'; | 3 | import { StringUtils } from 'wdKit'; |
| 4 | +import { WDRouterRule } from 'wdRouter'; | ||
| 3 | 5 | ||
| 4 | @Component | 6 | @Component |
| 5 | export struct ENewspaperItemComponent { | 7 | export struct ENewspaperItemComponent { |
| @@ -27,14 +29,6 @@ export struct ENewspaperItemComponent { | @@ -27,14 +29,6 @@ export struct ENewspaperItemComponent { | ||
| 27 | } | 29 | } |
| 28 | .width('100%') | 30 | .width('100%') |
| 29 | .aspectRatio(0.68688) | 31 | .aspectRatio(0.68688) |
| 30 | - .onClick((event: ClickEvent) =>{ | ||
| 31 | - if (this.itemBeanClicked && this.itemBeanClicked.newsId){ | ||
| 32 | - // todo 跳转事件 | ||
| 33 | - | ||
| 34 | - | ||
| 35 | - this.itemBeanClicked = {} as NewspaperPositionItemBean | ||
| 36 | - } | ||
| 37 | - }) | ||
| 38 | .onTouch((event: TouchEvent) => { | 32 | .onTouch((event: TouchEvent) => { |
| 39 | if (event.type === TouchType.Down) { | 33 | if (event.type === TouchType.Down) { |
| 40 | let x = event.touches[0].x; | 34 | let x = event.touches[0].x; |
| @@ -58,6 +52,24 @@ export struct ENewspaperItemComponent { | @@ -58,6 +52,24 @@ export struct ENewspaperItemComponent { | ||
| 58 | } | 52 | } |
| 59 | if (event.type === TouchType.Up) { | 53 | if (event.type === TouchType.Up) { |
| 60 | this.context.clearRect(0, 0, this.context.width, this.context.height) | 54 | this.context.clearRect(0, 0, this.context.width, this.context.height) |
| 55 | + if (this.itemBeanClicked && this.itemBeanClicked.newsId){ | ||
| 56 | + // todo 跳转事件 | ||
| 57 | + let taskAction: Action = { | ||
| 58 | + type: 'JUMP_INNER_NEW_PAGE', | ||
| 59 | + params: { | ||
| 60 | + contentID:'30001373964', | ||
| 61 | + pageID: 'IMAGE_TEXT_DETAIL', | ||
| 62 | + extra:{ | ||
| 63 | + relType: '1', | ||
| 64 | + relId: '500000008738', | ||
| 65 | + sourcePage: '5' | ||
| 66 | + } as ExtraDTO | ||
| 67 | + } as Params, | ||
| 68 | + }; | ||
| 69 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 70 | + | ||
| 71 | + this.itemBeanClicked = {} as NewspaperPositionItemBean | ||
| 72 | + } | ||
| 61 | } | 73 | } |
| 62 | if (event.type === TouchType.Move) { | 74 | if (event.type === TouchType.Move) { |
| 63 | let mx = event.touches[0].x; | 75 | let mx = event.touches[0].x; |
| 1 | -import { ContentDetailDTO } from 'wdBean'; | 1 | +import { Action, ContentDetailDTO } from 'wdBean'; |
| 2 | import DetailViewModel from '../viewmodel/DetailViewModel'; | 2 | import DetailViewModel from '../viewmodel/DetailViewModel'; |
| 3 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; | 3 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; |
| 4 | +import router from '@ohos.router'; | ||
| 4 | 5 | ||
| 5 | @Component | 6 | @Component |
| 6 | export struct ImageAndTextPageComponent { | 7 | export struct ImageAndTextPageComponent { |
| 7 | - | ||
| 8 | scroller: Scroller = new Scroller(); | 8 | scroller: Scroller = new Scroller(); |
| 9 | - @State relId: string= '' | ||
| 10 | - @State contentId: string= '' | ||
| 11 | - @State relType: string= '' | 9 | + action: Action = {} as Action |
| 12 | @State detailData: ContentDetailDTO = {} as ContentDetailDTO | 10 | @State detailData: ContentDetailDTO = {} as ContentDetailDTO |
| 13 | 11 | ||
| 14 | - build(){ | 12 | + build() { |
| 15 | RelativeContainer() { | 13 | RelativeContainer() { |
| 16 | - RelativeContainer(){ | 14 | + RelativeContainer() { |
| 15 | + Text('2024年1月25日 9:45') | ||
| 16 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 17 | + .fontSize($r('app.float.font_size_13')) | ||
| 18 | + .id('date') | ||
| 19 | + .alignRules({ right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 20 | + center:{anchor: "__container__", align:VerticalAlign.Center}}) | ||
| 21 | + | ||
| 17 | Image($r('app.media.icon_ren_min_ri_bao')) | 22 | Image($r('app.media.icon_ren_min_ri_bao')) |
| 18 | .width(70) | 23 | .width(70) |
| 19 | .height(28) | 24 | .height(28) |
| 20 | - .alignRules({top:{anchor: "__container__", align: VerticalAlign.Top}, | ||
| 21 | - left:{anchor: "__container__", align: HorizontalAlign.Start}}) | ||
| 22 | - | ||
| 23 | - Text(this.detailData.publishTime) | ||
| 24 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 25 | - .fontSize($r('app.float.font_size_13')) | ||
| 26 | - .alignRules({top:{anchor: "__container__", align: VerticalAlign.Top}, | ||
| 27 | - right:{anchor: "__container__", align: HorizontalAlign.End}}) | 25 | + .alignRules({ left: { anchor: "__container__", align: HorizontalAlign.Start }, |
| 26 | + center:{anchor: "__container__", align:VerticalAlign.Center}}) | ||
| 28 | } | 27 | } |
| 28 | + .height(32) | ||
| 29 | .width('100%') | 29 | .width('100%') |
| 30 | .id('image_text_detail_top') | 30 | .id('image_text_detail_top') |
| 31 | - .alignRules({top:{anchor: "__container__", align: VerticalAlign.Top}}) | 31 | + .alignRules({ top: { anchor: "__container__", align: VerticalAlign.Top } }) |
| 32 | 32 | ||
| 33 | Image($r('app.media.line')) | 33 | Image($r('app.media.line')) |
| 34 | .width('100%') | 34 | .width('100%') |
| 35 | .height(6) | 35 | .height(6) |
| 36 | .objectFit(ImageFit.Contain) | 36 | .objectFit(ImageFit.Contain) |
| 37 | .id('image_text_detail_top_line') | 37 | .id('image_text_detail_top_line') |
| 38 | - .alignRules({top:{anchor: "image_text_detail_top", align: VerticalAlign.Bottom}}) | ||
| 39 | - .margin({top: 10}) | ||
| 40 | - | ||
| 41 | - Scroll(this.scroller) { | ||
| 42 | - Column() { | ||
| 43 | - ImageAndTextWebComponent({detailData: this.detailData}) | ||
| 44 | - } | ||
| 45 | - .width('100%') | ||
| 46 | - } | ||
| 47 | - .scrollable(ScrollDirection.Vertical) | ||
| 48 | - .scrollBar(BarState.Off) | ||
| 49 | - .alignRules({top:{anchor: "image_text_detail_top_line", align: VerticalAlign.Bottom}}) | ||
| 50 | - .id('image_text_detail_content') | 38 | + .alignRules({ top: { anchor: "image_text_detail_top", align: VerticalAlign.Bottom } }) |
| 39 | + .margin({ top: 10 }) | ||
| 51 | 40 | ||
| 52 | - RelativeContainer(){ | 41 | + RelativeContainer() { |
| 53 | Image($r('app.media.icon_arrow_left')) | 42 | Image($r('app.media.icon_arrow_left')) |
| 54 | .width(24) | 43 | .width(24) |
| 55 | .height(24) | 44 | .height(24) |
| 56 | - .alignRules({left:{anchor: "__container__", align: HorizontalAlign.Start}, | ||
| 57 | - center:{anchor: "__container__", align: VerticalAlign.Center}}) | ||
| 58 | - | ||
| 59 | - Row(){ | ||
| 60 | - Image($r('app.media.icon_comment')) | ||
| 61 | - .width(24) | ||
| 62 | - .height(24) | ||
| 63 | - .margin({left: 24}) | ||
| 64 | - | ||
| 65 | - Image($r('app.media.icon_star')) | ||
| 66 | - .width(24) | ||
| 67 | - .height(24) | ||
| 68 | - .margin({left: 24}) | ||
| 69 | - | ||
| 70 | - Image($r('app.media.icon_listen')) | ||
| 71 | - .width(24) | ||
| 72 | - .height(24) | ||
| 73 | - .margin({left: 24}) | ||
| 74 | - | ||
| 75 | - Image($r('app.media.icon_forward')) | ||
| 76 | - .width(24) | ||
| 77 | - .height(24) | ||
| 78 | - .margin({left: 24}) | ||
| 79 | - } | ||
| 80 | - .alignItems(VerticalAlign.Center) | ||
| 81 | - .alignRules({right:{anchor: "__container__", align: HorizontalAlign.End}, | ||
| 82 | - center:{anchor: "__container__", align: VerticalAlign.Center}}) | 45 | + .id('back') |
| 46 | + .alignRules({ left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 47 | + center: { anchor: "__container__", align: VerticalAlign.Center } }) | ||
| 48 | + .onClick((event: ClickEvent) => { | ||
| 49 | + router.back() | ||
| 50 | + }) | ||
| 51 | + | ||
| 52 | + Image($r('app.media.icon_forward')) | ||
| 53 | + .width(24) | ||
| 54 | + .height(24) | ||
| 55 | + .id('forward') | ||
| 56 | + .alignRules({ right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 57 | + center: { anchor: "back", align: VerticalAlign.Center } }) | ||
| 58 | + | ||
| 59 | + Image($r('app.media.icon_listen')) | ||
| 60 | + .width(24) | ||
| 61 | + .height(24) | ||
| 62 | + .margin({ right: 24 }) | ||
| 63 | + .id('listen') | ||
| 64 | + .alignRules({ right: { anchor: "forward", align: HorizontalAlign.Start }, | ||
| 65 | + center: { anchor: "back", align: VerticalAlign.Center } }) | ||
| 66 | + | ||
| 67 | + Image($r('app.media.icon_star')) | ||
| 68 | + .width(24) | ||
| 69 | + .height(24) | ||
| 70 | + .margin({ right: 24 }) | ||
| 71 | + .id('star') | ||
| 72 | + .alignRules({ right: { anchor: "listen", align: HorizontalAlign.Start }, | ||
| 73 | + center: { anchor: "back", align: VerticalAlign.Center } }) | ||
| 74 | + | ||
| 75 | + Image($r('app.media.icon_comment')) | ||
| 76 | + .width(24) | ||
| 77 | + .height(24) | ||
| 78 | + .margin({ right: 24 }) | ||
| 79 | + .id('comment') | ||
| 80 | + .alignRules({ right: { anchor: "star", align: HorizontalAlign.Start }, | ||
| 81 | + center: { anchor: "back", align: VerticalAlign.Center } }) | ||
| 83 | 82 | ||
| 84 | } | 83 | } |
| 85 | .width('100%') | 84 | .width('100%') |
| 86 | .height(56) | 85 | .height(56) |
| 87 | - .alignRules({bottom:{anchor: "__container__", align: VerticalAlign.Bottom}}) | 86 | + .id('image_text_detail_bottom') |
| 87 | + .alignRules({ bottom: { anchor: "__container__", align: VerticalAlign.Bottom } }) | ||
| 88 | 88 | ||
| 89 | + Scroll(this.scroller) { | ||
| 90 | + Column() { | ||
| 91 | + ImageAndTextWebComponent({ detailData: this.detailData, action: this.action }) | ||
| 92 | + } | ||
| 93 | + .width('100%') | ||
| 94 | + } | ||
| 95 | + .scrollable(ScrollDirection.Vertical) | ||
| 96 | + .scrollBar(BarState.Off) | ||
| 97 | + .alignRules({ top: { anchor: "image_text_detail_top_line", align: VerticalAlign.Bottom }, | ||
| 98 | + bottom:{anchor: "image_text_detail_bottom", align: VerticalAlign.Top}}) | ||
| 99 | + .id('image_text_detail_content') | ||
| 89 | 100 | ||
| 90 | } | 101 | } |
| 91 | .width('100%') | 102 | .width('100%') |
| 92 | .height('100%') | 103 | .height('100%') |
| 93 | - .padding({left: 16, right: 16}) | 104 | + .padding({ left: 16, right: 16 }) |
| 94 | .backgroundColor(Color.White) | 105 | .backgroundColor(Color.White) |
| 95 | } | 106 | } |
| 96 | 107 | ||
| 97 | async aboutToAppear() { | 108 | async aboutToAppear() { |
| 98 | - let detailBean = await DetailViewModel.getDetailPageData(this.relId, this.contentId, this.relType) | ||
| 99 | - this.detailData = detailBean; | 109 | + let contentId: string = '' |
| 110 | + let relId: string = '' | ||
| 111 | + let relType: string = '' | ||
| 112 | + if (this.action && this.action.params) { | ||
| 113 | + if (this.action.params.contentID) { | ||
| 114 | + contentId = this.action.params.contentID; | ||
| 115 | + } | ||
| 116 | + if (this.action && this.action.params && this.action.params.extra) { | ||
| 117 | + if (this.action.params.extra.relId) { | ||
| 118 | + relId = this.action.params.extra.relId; | ||
| 119 | + } | ||
| 120 | + if (this.action.params.extra.relType) { | ||
| 121 | + relType = this.action.params.extra.relType | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + } | ||
| 125 | + let detailBean = await DetailViewModel.getDetailPageData(relId, contentId, relType) | ||
| 126 | + this.detailData = detailBean; | ||
| 127 | + } | ||
| 128 | + | ||
| 100 | } | 129 | } |
| 101 | 130 | ||
| 102 | aboutToDisappear() { | 131 | aboutToDisappear() { |
| 103 | 132 | ||
| 104 | } | 133 | } |
| 105 | - | ||
| 106 | } | 134 | } |
| 1 | -import { ContentDetailDTO } from 'wdBean' | 1 | +import { |
| 2 | + Action, | ||
| 3 | + ContentDetailDTO, | ||
| 4 | + H5ReceiveDataExtraBean, | ||
| 5 | + H5ReceiveDataJsonBean, | ||
| 6 | + H5ReceiveDetailBean, | ||
| 7 | + ResponseBean | ||
| 8 | +} from 'wdBean'; | ||
| 9 | +import { Logger } from 'wdKit'; | ||
| 10 | +import { WdWebComponent } from 'wdWebComponent'; | ||
| 11 | +import { BridgeWebViewControl } from '../../../../../wdWebComponent/oh_modules/wdJsBridge/Index'; | ||
| 2 | 12 | ||
| 3 | @Component | 13 | @Component |
| 4 | -export struct ImageAndTextWebComponent{ | ||
| 5 | - @Prop detailData: ContentDetailDTO = {} as ContentDetailDTO | 14 | +export struct ImageAndTextWebComponent { |
| 15 | + webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | ||
| 16 | + action: Action = {} as Action | ||
| 17 | + @State reload: number = 0; | ||
| 18 | + @Prop @Watch('onDetailDataUpdated') detailData: ContentDetailDTO = {} as ContentDetailDTO | ||
| 6 | 19 | ||
| 7 | - build(){ | 20 | + onDetailDataUpdated() { |
| 21 | + if (this.action) { | ||
| 22 | + let contentId: string = '' | ||
| 23 | + let contentType: string = '' | ||
| 24 | + let topicId: string = '' | ||
| 25 | + let channelId: string = '' | ||
| 26 | + let compId: string = '' | ||
| 27 | + let sourcePage: string = '5' | ||
| 28 | + if (this.action.params) { | ||
| 29 | + if (this.action.params.contentID) { | ||
| 30 | + contentId = this.action.params?.contentID | ||
| 31 | + } | ||
| 32 | + if (this.action.params.extra) { | ||
| 33 | + if (this.action.params.extra.contentType) { | ||
| 34 | + contentType = this.action.params.extra.contentType | ||
| 35 | + } | ||
| 36 | + if (this.action.params.extra.topicId) { | ||
| 37 | + topicId = this.action.params.extra.topicId | ||
| 38 | + } | ||
| 39 | + if (this.action.params.extra.channelId) { | ||
| 40 | + channelId = this.action.params.extra.channelId | ||
| 41 | + } | ||
| 42 | + if (this.action.params.extra.compId) { | ||
| 43 | + compId = this.action.params.extra.compId | ||
| 44 | + } | ||
| 45 | + if (this.action.params.extra.sourcePage) { | ||
| 46 | + sourcePage = this.action.params.extra.sourcePage | ||
| 47 | + } | ||
| 48 | + } | ||
| 8 | 49 | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + let h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | ||
| 53 | + let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { creatorId: '', isLogin: '0' } as H5ReceiveDataExtraBean | ||
| 54 | + let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { | ||
| 55 | + contentId: contentId, | ||
| 56 | + contentType: contentType | ||
| 57 | + } as H5ReceiveDataJsonBean | ||
| 58 | + h5ReceiveDataJsonBean.topicId = topicId | ||
| 59 | + h5ReceiveDataJsonBean.channelId = channelId | ||
| 60 | + h5ReceiveDataJsonBean.compId = compId | ||
| 61 | + h5ReceiveDataJsonBean.sourcePage = sourcePage | ||
| 62 | + h5ReceiveDataJsonBean.netError = '0' | ||
| 63 | + let response: ResponseBean = {} as ResponseBean | ||
| 64 | + response.data = this.detailData | ||
| 65 | + h5ReceiveDataJsonBean.responseMap = response | ||
| 66 | + h5ReceiveAppData.dataJson = h5ReceiveDataJsonBean | ||
| 67 | + h5ReceiveAppData.dataExt = h5ReceiveDataExtraBean | ||
| 68 | + this.webviewControl.callHandle("jsCall_receiveAppData", JSON.stringify(h5ReceiveAppData), (data: string) => { | ||
| 69 | + Logger.info("from js data = " + data); | ||
| 70 | + }) | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + build() { | ||
| 76 | + Column() { | ||
| 77 | + WdWebComponent({ | ||
| 78 | + type: 0, | ||
| 79 | + webviewControl: this.webviewControl, | ||
| 80 | + webResource: $rawfile('apph5/index.html'), | ||
| 81 | + backVisibility: false, | ||
| 82 | + reload: this.reload | ||
| 83 | + }) | ||
| 84 | + } | ||
| 9 | } | 85 | } |
| 10 | } | 86 | } |
| 1 | -import { CompDTO, TopNavDTO } from 'wdBean'; | 1 | +import { Action, CompDTO, Params, TopNavDTO } from 'wdBean'; |
| 2 | import { LazyDataSource, Logger } from 'wdKit'; | 2 | import { LazyDataSource, Logger } from 'wdKit'; |
| 3 | +import { WDRouterRule } from 'wdRouter'; | ||
| 3 | import { PageComponent } from './PageComponent'; | 4 | import { PageComponent } from './PageComponent'; |
| 4 | 5 | ||
| 5 | const TAG = 'TopNavigationComponent'; | 6 | const TAG = 'TopNavigationComponent'; |
| @@ -17,26 +18,40 @@ export struct TopNavigationComponent { | @@ -17,26 +18,40 @@ export struct TopNavigationComponent { | ||
| 17 | readonly MAX_LINE: number = 1; | 18 | readonly MAX_LINE: number = 1; |
| 18 | 19 | ||
| 19 | build() { | 20 | build() { |
| 20 | - Tabs() { | ||
| 21 | - ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => { | ||
| 22 | - TabContent() { | ||
| 23 | - PageComponent({ | ||
| 24 | - currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 25 | - navIndex: index, | ||
| 26 | - pageId: navItem.pageId + '', | ||
| 27 | - channelId: navItem.channelId + '' | ||
| 28 | - }) | ||
| 29 | - } | ||
| 30 | - .tabBar(this.tabBarBuilder(navItem, index)) | ||
| 31 | - }, (navItem: TopNavDTO) => JSON.stringify(navItem)); | 21 | + Column() { |
| 22 | + Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 23 | + .width(72) | ||
| 24 | + .height(29) | ||
| 25 | + .onClick((event: ClickEvent) => { | ||
| 26 | + let taskAction: Action = { | ||
| 27 | + type: 'JUMP_INNER_NEW_PAGE', | ||
| 28 | + params: { | ||
| 29 | + pageID: 'E_NEWSPAPER' | ||
| 30 | + } as Params, | ||
| 31 | + }; | ||
| 32 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 33 | + }) | ||
| 34 | + Tabs() { | ||
| 35 | + ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => { | ||
| 36 | + TabContent() { | ||
| 37 | + PageComponent({ | ||
| 38 | + currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | ||
| 39 | + navIndex: index, | ||
| 40 | + pageId: navItem.pageId + '', | ||
| 41 | + channelId: navItem.channelId + '' | ||
| 42 | + }) | ||
| 43 | + } | ||
| 44 | + .tabBar(this.tabBarBuilder(navItem, index)) | ||
| 45 | + }, (navItem: TopNavDTO) => JSON.stringify(navItem)); | ||
| 46 | + } | ||
| 47 | + .barHeight($r('app.float.top_tab_bar_height')) | ||
| 48 | + .barMode(BarMode.Scrollable) | ||
| 49 | + .vertical(false) | ||
| 50 | + .onChange((index: number) => { | ||
| 51 | + Logger.info(TAG, `onChange index : ${index}`); | ||
| 52 | + this.currentTopNavSelectedIndex = index; | ||
| 53 | + }) | ||
| 32 | } | 54 | } |
| 33 | - .barHeight($r('app.float.top_tab_bar_height')) | ||
| 34 | - .barMode(BarMode.Scrollable) | ||
| 35 | - .vertical(false) | ||
| 36 | - .onChange((index: number) => { | ||
| 37 | - Logger.info(TAG, `onChange index : ${index}`); | ||
| 38 | - this.currentTopNavSelectedIndex = index; | ||
| 39 | - }) | ||
| 40 | } | 55 | } |
| 41 | 56 | ||
| 42 | @Builder | 57 | @Builder |
| @@ -241,7 +241,7 @@ body #app::-webkit-scrollbar-track { | @@ -241,7 +241,7 @@ body #app::-webkit-scrollbar-track { | ||
| 241 | display: inline-block; | 241 | display: inline-block; |
| 242 | width: 20px; | 242 | width: 20px; |
| 243 | height: 20px; | 243 | height: 20px; |
| 244 | - background-image: url("../image/loading.svg"); | 244 | + background-image: url("../../../../../../../wdComponent/src/main/resources/rawfile/apph5/image/loading.svg"); |
| 245 | background-position: 50%; | 245 | background-position: 50%; |
| 246 | background-size: 100%; | 246 | background-size: 100%; |
| 247 | background-repeat: no-repeat; | 247 | background-repeat: no-repeat; |
| @@ -81,7 +81,7 @@ | @@ -81,7 +81,7 @@ | ||
| 81 | position: absolute; | 81 | position: absolute; |
| 82 | left: 0.32rem; | 82 | left: 0.32rem; |
| 83 | top: -0.13333rem; | 83 | top: -0.13333rem; |
| 84 | - background-image: url("../image/yh-icon.svg"); | 84 | + background-image: url("../../../../../../../wdComponent/src/main/resources/rawfile/apph5/image/yh-icon.svg"); |
| 85 | background-size: 100% 100%; | 85 | background-size: 100% 100%; |
| 86 | } | 86 | } |
| 87 | .gx-mobile .head-link-block { | 87 | .gx-mobile .head-link-block { |
| @@ -1124,7 +1124,7 @@ | @@ -1124,7 +1124,7 @@ | ||
| 1124 | .vote .title .t-icon .icon-img { | 1124 | .vote .title .t-icon .icon-img { |
| 1125 | width: 0.48rem; | 1125 | width: 0.48rem; |
| 1126 | height: 0.48rem; | 1126 | height: 0.48rem; |
| 1127 | - background-image: url("../image/vote/icon_live.png"); | 1127 | + background-image: url("../../../../../../../wdComponent/src/main/resources/rawfile/apph5/image/vote/icon_live.png"); |
| 1128 | background-size: 100% 100%; | 1128 | background-size: 100% 100%; |
| 1129 | } | 1129 | } |
| 1130 | .vote .title .t-icon span { | 1130 | .vote .title .t-icon span { |
| @@ -1567,7 +1567,7 @@ | @@ -1567,7 +1567,7 @@ | ||
| 1567 | #newsContent .swiper-block .swiper-pagination-bullet::after { | 1567 | #newsContent .swiper-block .swiper-pagination-bullet::after { |
| 1568 | display: block; | 1568 | display: block; |
| 1569 | content: ""; | 1569 | content: ""; |
| 1570 | - background: url("../image/swiper_not_active.svg"); | 1570 | + background: url("../../../../../../../wdComponent/src/main/resources/rawfile/apph5/image/swiper_not_active.svg"); |
| 1571 | width: 0.26666667rem; | 1571 | width: 0.26666667rem; |
| 1572 | height: 0.08rem; | 1572 | height: 0.08rem; |
| 1573 | background-repeat: no-repeat; | 1573 | background-repeat: no-repeat; |
| @@ -1584,7 +1584,7 @@ | @@ -1584,7 +1584,7 @@ | ||
| 1584 | #newsContent .swiper-block .swiper-pagination-bullet-active::after { | 1584 | #newsContent .swiper-block .swiper-pagination-bullet-active::after { |
| 1585 | display: block; | 1585 | display: block; |
| 1586 | content: ""; | 1586 | content: ""; |
| 1587 | - background: url("../image/swiper_active.svg"); | 1587 | + background: url("../../../../../../../wdComponent/src/main/resources/rawfile/apph5/image/swiper_active.svg"); |
| 1588 | width: 0.37333333rem; | 1588 | width: 0.37333333rem; |
| 1589 | height: 0.08rem; | 1589 | height: 0.08rem; |
| 1590 | background-repeat: no-repeat; | 1590 | background-repeat: no-repeat; |
| @@ -2212,7 +2212,7 @@ | @@ -2212,7 +2212,7 @@ | ||
| 2212 | top: 0.08rem; | 2212 | top: 0.08rem; |
| 2213 | position: absolute; | 2213 | position: absolute; |
| 2214 | content: ''; | 2214 | content: ''; |
| 2215 | - background-image: url("../image/sourceIocn.svg"); | 2215 | + background-image: url("../../../../../../../wdComponent/src/main/resources/rawfile/apph5/image/sourceIocn.svg"); |
| 2216 | background-repeat: no-repeat; | 2216 | background-repeat: no-repeat; |
| 2217 | background-size: 100%; | 2217 | background-size: 100%; |
| 2218 | width: 0.08rem; | 2218 | width: 0.08rem; |
| @@ -280,7 +280,7 @@ body #app::-webkit-scrollbar-track { | @@ -280,7 +280,7 @@ body #app::-webkit-scrollbar-track { | ||
| 280 | display: inline-block; | 280 | display: inline-block; |
| 281 | width: 20px; | 281 | width: 20px; |
| 282 | height: 20px; | 282 | height: 20px; |
| 283 | - background-image: url("../image/loading.svg"); | 283 | + background-image: url("../../../../../../../wdComponent/src/main/resources/rawfile/apph5/image/loading.svg"); |
| 284 | background-position: 50%; | 284 | background-position: 50%; |
| 285 | background-size: 100%; | 285 | background-size: 100%; |
| 286 | background-repeat: no-repeat; | 286 | background-repeat: no-repeat; |
| @@ -91,7 +91,7 @@ | @@ -91,7 +91,7 @@ | ||
| 91 | position: absolute; | 91 | position: absolute; |
| 92 | left: 0.32rem; | 92 | left: 0.32rem; |
| 93 | top: -0.13333rem; | 93 | top: -0.13333rem; |
| 94 | - background-image: url("../image/yh-icon.svg"); | 94 | + background-image: url("../../../../../../../wdComponent/src/main/resources/rawfile/apph5/image/yh-icon.svg"); |
| 95 | background-size: 100% 100%; | 95 | background-size: 100% 100%; |
| 96 | } | 96 | } |
| 97 | .gx-mobile .head-link-block { | 97 | .gx-mobile .head-link-block { |
| @@ -1337,7 +1337,7 @@ | @@ -1337,7 +1337,7 @@ | ||
| 1337 | .vote .title .t-icon .icon-img { | 1337 | .vote .title .t-icon .icon-img { |
| 1338 | width: 0.48rem; | 1338 | width: 0.48rem; |
| 1339 | height: 0.48rem; | 1339 | height: 0.48rem; |
| 1340 | - background-image: url("../image/vote/icon_live.png"); | 1340 | + background-image: url("../../../../../../../wdComponent/src/main/resources/rawfile/apph5/image/vote/icon_live.png"); |
| 1341 | background-size: 100% 100%; | 1341 | background-size: 100% 100%; |
| 1342 | } | 1342 | } |
| 1343 | .vote .title .t-icon span { | 1343 | .vote .title .t-icon span { |
| @@ -1889,7 +1889,7 @@ | @@ -1889,7 +1889,7 @@ | ||
| 1889 | #newsContent .swiper-block .swiper-pagination-bullet::after { | 1889 | #newsContent .swiper-block .swiper-pagination-bullet::after { |
| 1890 | display: block; | 1890 | display: block; |
| 1891 | content: ""; | 1891 | content: ""; |
| 1892 | - background: url("../image/swiper_not_active.svg"); | 1892 | + background: url("../../../../../../../wdComponent/src/main/resources/rawfile/apph5/image/swiper_not_active.svg"); |
| 1893 | width: 0.26666667rem; | 1893 | width: 0.26666667rem; |
| 1894 | height: 0.08rem; | 1894 | height: 0.08rem; |
| 1895 | background-repeat: no-repeat; | 1895 | background-repeat: no-repeat; |
| @@ -1906,7 +1906,7 @@ | @@ -1906,7 +1906,7 @@ | ||
| 1906 | #newsContent .swiper-block .swiper-pagination-bullet-active::after { | 1906 | #newsContent .swiper-block .swiper-pagination-bullet-active::after { |
| 1907 | display: block; | 1907 | display: block; |
| 1908 | content: ""; | 1908 | content: ""; |
| 1909 | - background: url("../image/swiper_active.svg"); | 1909 | + background: url("../../../../../../../wdComponent/src/main/resources/rawfile/apph5/image/swiper_active.svg"); |
| 1910 | width: 0.37333333rem; | 1910 | width: 0.37333333rem; |
| 1911 | height: 0.08rem; | 1911 | height: 0.08rem; |
| 1912 | background-repeat: no-repeat; | 1912 | background-repeat: no-repeat; |
| @@ -2672,7 +2672,7 @@ | @@ -2672,7 +2672,7 @@ | ||
| 2672 | top: 0.08rem; | 2672 | top: 0.08rem; |
| 2673 | position: absolute; | 2673 | position: absolute; |
| 2674 | content: ''; | 2674 | content: ''; |
| 2675 | - background-image: url("../image/sourceIocn.svg"); | 2675 | + background-image: url("../../../../../../../wdComponent/src/main/resources/rawfile/apph5/image/sourceIocn.svg"); |
| 2676 | background-repeat: no-repeat; | 2676 | background-repeat: no-repeat; |
| 2677 | background-size: 100%; | 2677 | background-size: 100%; |
| 2678 | width: 0.08rem; | 2678 | width: 0.08rem; |
| @@ -13,6 +13,11 @@ export struct WdWebComponent { | @@ -13,6 +13,11 @@ export struct WdWebComponent { | ||
| 13 | private webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 13 | private webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 14 | //TODO 默认网页 | 14 | //TODO 默认网页 |
| 15 | webUrl: string = ConfigConstants.DETAIL_URL | 15 | webUrl: string = ConfigConstants.DETAIL_URL |
| 16 | + | ||
| 17 | + // 0网页, 1本地html | ||
| 18 | + type: number = 0 | ||
| 19 | + | ||
| 20 | + webResource: Resource = {} as Resource | ||
| 16 | /** | 21 | /** |
| 17 | * 对外暴露webview的回调,能力 | 22 | * 对外暴露webview的回调,能力 |
| 18 | */ | 23 | */ |
| @@ -63,7 +68,7 @@ export struct WdWebComponent { | @@ -63,7 +68,7 @@ export struct WdWebComponent { | ||
| 63 | .height(44) | 68 | .height(44) |
| 64 | .visibility(this.backVisibility ? Visibility.Visible : Visibility.None) | 69 | .visibility(this.backVisibility ? Visibility.Visible : Visibility.None) |
| 65 | 70 | ||
| 66 | - Web({ src: this.webUrl, controller: this.webviewControl }) | 71 | + Web({ src: this.type == 0 ? this.webUrl : this.webResource, controller: this.webviewControl }) |
| 67 | .domStorageAccess(true) | 72 | .domStorageAccess(true) |
| 68 | .databaseAccess(true) | 73 | .databaseAccess(true) |
| 69 | .javaScriptAccess(true) | 74 | .javaScriptAccess(true) |
-
Please register or login to post a comment