Showing
30 changed files
with
533 additions
and
43 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": "0000001AB8EC943F2BE2E18A8AEFE1FCA450B66E91DFD2548DD09FD6AB15755699E084327B0CC2ED695B", | 8 | + "certpath": "C:\\Users\\PC\\.ohos\\config\\auto_debug_sight_harmony_com.wondertek.sight_70086000327424393.cer", |
| 9 | + "storePassword": "0000001B4100D63EDF7155D2954BDDEC8F40FA74E710B0D1FF3C0782DE2745F90F1B83D1C1C110398F4559", | ||
| 10 | "keyAlias": "debugKey", | 10 | "keyAlias": "debugKey", |
| 11 | - "keyPassword": "0000001AAB9FF41A89BB2C32EA7122E2EE2E6C97447932FDC7E91010CC02128130B6040A09EBC04CD07E", | ||
| 12 | - "profile": "C:\\Users\\PC\\.ohos\\config\\auto_debug_sight_harmony_com.wondertek.sight_70086000309521319.p7b", | 11 | + "keyPassword": "0000001B157D6824BE8F21F112459AD1B61654DE9396A50B0CE60898F02F4C95CBF127122F293DD6C80C62", |
| 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 | ], |
| @@ -134,17 +134,17 @@ | @@ -134,17 +134,17 @@ | ||
| 134 | } | 134 | } |
| 135 | ] | 135 | ] |
| 136 | } | 136 | } |
| 137 | -// { | ||
| 138 | -// "name": "wdLayout", | ||
| 139 | -// "srcPath": "./wdLayout", | ||
| 140 | -// "targets": [ | ||
| 141 | -// { | ||
| 142 | -// "name": "default", | ||
| 143 | -// "applyToProducts": [ | ||
| 144 | -// "default" | ||
| 145 | -// ] | ||
| 146 | -// } | ||
| 147 | -// ] | ||
| 148 | -// } | 137 | + // { |
| 138 | + // "name": "wdLayout", | ||
| 139 | + // "srcPath": "./wdLayout", | ||
| 140 | + // "targets": [ | ||
| 141 | + // { | ||
| 142 | + // "name": "default", | ||
| 143 | + // "applyToProducts": [ | ||
| 144 | + // "default" | ||
| 145 | + // ] | ||
| 146 | + // } | ||
| 147 | + // ] | ||
| 148 | + // } | ||
| 149 | ] | 149 | ] |
| 150 | } | 150 | } |
| 1 | +import { ENewspaperPageComponent } from 'wdComponent'; | ||
| 2 | +import { Logger } from 'wdKit' | ||
| 3 | + | ||
| 4 | +const TAG = 'ENewspaper'; | ||
| 5 | + | ||
| 6 | +@Entry | ||
| 7 | +@Component | ||
| 8 | +struct ENewspaper { | ||
| 9 | + | ||
| 10 | + build() { | ||
| 11 | + Column() { | ||
| 12 | + ENewspaperPageComponent() | ||
| 13 | + } | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + pageTransition(){ | ||
| 17 | + // 定义页面进入时的效果,从底侧滑入 | ||
| 18 | + PageTransitionEnter({ type: RouteType.None, duration: 300 }) | ||
| 19 | + .slide(SlideEffect.Bottom) | ||
| 20 | + // 定义页面退出时的效果,向底侧滑出 | ||
| 21 | + PageTransitionExit({ type: RouteType.None, duration: 300 }) | ||
| 22 | + .slide(SlideEffect.Bottom) | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + aboutToAppear() { | ||
| 26 | + Logger.info(TAG, 'aboutToAppear'); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + aboutToDisappear() { | ||
| 30 | + Logger.info(TAG, 'aboutToDisappear'); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + onPageShow() { | ||
| 34 | + Logger.info(TAG, 'onPageShow'); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + onPageHide() { | ||
| 38 | + Logger.info(TAG, 'onPageHide'); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + onBackPress() { | ||
| 42 | + Logger.info(TAG, 'onBackPress'); | ||
| 43 | + } | ||
| 44 | +} |
This diff could not be displayed because it is too large.
| 1 | +{ | ||
| 2 | + "code": "0", | ||
| 3 | + "data": [{ | ||
| 4 | + "date": "49997-06-15", | ||
| 5 | + "list": [{ | ||
| 6 | + "exist": 1, | ||
| 7 | + "pageName": "", | ||
| 8 | + "pageNum": "05", | ||
| 9 | + "periodNum": "49997-06-15" | ||
| 10 | + }] | ||
| 11 | + }], | ||
| 12 | + "message": "Success", | ||
| 13 | + "meta": null, | ||
| 14 | + "requestId": "", | ||
| 15 | + "success": true, | ||
| 16 | + "timestamp": 1706170629625 | ||
| 17 | +} |
| @@ -39,3 +39,15 @@ export { GroupDTO } from './src/main/ets/bean/component/GroupDTO'; | @@ -39,3 +39,15 @@ export { GroupDTO } from './src/main/ets/bean/component/GroupDTO'; | ||
| 39 | export { CompDTO } from './src/main/ets/bean/component/CompDTO'; | 39 | export { CompDTO } from './src/main/ets/bean/component/CompDTO'; |
| 40 | 40 | ||
| 41 | export { ContentDTO } from './src/main/ets/bean/component/ContentDTO'; | 41 | export { ContentDTO } from './src/main/ets/bean/component/ContentDTO'; |
| 42 | + | ||
| 43 | +export { NewspaperListBean } from './src/main/ets/bean/newspaper/NewspaperListBean'; | ||
| 44 | + | ||
| 45 | +export { NewspaperListItemBean } from './src/main/ets/bean/newspaper/NewspaperListItemBean'; | ||
| 46 | + | ||
| 47 | +export { NewspaperPositionItemBean } from './src/main/ets/bean/newspaper/NewspaperPositionItemBean'; | ||
| 48 | + | ||
| 49 | +export { NewspaperShareBean } from './src/main/ets/bean/newspaper/NewspaperShareBean'; | ||
| 50 | + | ||
| 51 | +export { NewspaperTimeInfoBean} from './src/main/ets/bean/newspaper/NewspaperTimeInfoBean'; | ||
| 52 | + | ||
| 53 | +export { NewspaperTimeItemBean } from './src/main/ets/bean/newspaper/NewspaperTimeItemBean'; |
| 1 | +import { NewspaperPositionItemBean } from './NewspaperPositionItemBean'; | ||
| 2 | +import { NewspaperShareBean } from './NewspaperShareBean'; | ||
| 3 | + | ||
| 4 | +export interface NewspaperListItemBean { | ||
| 5 | + items:NewspaperPositionItemBean[]; | ||
| 6 | + pageName:string; | ||
| 7 | + pageNum:string; | ||
| 8 | + pagePic:string; | ||
| 9 | + periodNum:string; | ||
| 10 | + sharePagePic:NewspaperShareBean; | ||
| 11 | +} |
| 1 | +export interface NewspaperPositionItemBean { | ||
| 2 | + image:string[]; | ||
| 3 | + downTitle:string; | ||
| 4 | + imageHeight:number; | ||
| 5 | + imageWidth:number; | ||
| 6 | + newsId:number; | ||
| 7 | + newsTxt:string; | ||
| 8 | + newsType:number; | ||
| 9 | + points:string; | ||
| 10 | + relId:number; | ||
| 11 | + relObjectId: string; | ||
| 12 | + relType: string; | ||
| 13 | + shortTitle: string; | ||
| 14 | + title: string; | ||
| 15 | +} |
| @@ -25,3 +25,7 @@ export { SingleColumnComponent } from "./src/main/ets/components/SingleColumnCom | @@ -25,3 +25,7 @@ export { SingleColumnComponent } from "./src/main/ets/components/SingleColumnCom | ||
| 25 | export { GridLayout01Component } from "./src/main/ets/components/GridLayout01Component" | 25 | export { GridLayout01Component } from "./src/main/ets/components/GridLayout01Component" |
| 26 | 26 | ||
| 27 | export { WaterFlowComponent } from "./src/main/ets/components/WaterFlowComponent" | 27 | export { WaterFlowComponent } from "./src/main/ets/components/WaterFlowComponent" |
| 28 | + | ||
| 29 | +export { NewspaperViewModel} from "./src/main/ets/viewmodel/NewspaperViewModel" | ||
| 30 | + | ||
| 31 | +export {ENewspaperPageComponent} from "./src/main/ets/components/ENewspaperPageComponent" |
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | "wdConstant": "file:../wdConstant", | 10 | "wdConstant": "file:../wdConstant", |
| 11 | "wdKit": "file:../wdKit", | 11 | "wdKit": "file:../wdKit", |
| 12 | "wdBean": "file:../wdBean", | 12 | "wdBean": "file:../wdBean", |
| 13 | - "wdNetwork": "file:../wdNetwork", | ||
| 14 | - "wdRouter": "file:../wdRouter" | 13 | + "wdRouter": "file:../wdRouter", |
| 14 | + "wdNetwork": "file:../wdNetwork" | ||
| 15 | } | 15 | } |
| 16 | } | 16 | } |
| 1 | +import { NewspaperListItemBean, NewspaperPositionItemBean } from 'wdBean'; | ||
| 2 | +import { StringUtils } from 'wdKit'; | ||
| 3 | + | ||
| 4 | +@Component | ||
| 5 | +export struct ENewspaperItemComponent { | ||
| 6 | + private newspaperListItemBean: NewspaperListItemBean = {} as NewspaperListItemBean | ||
| 7 | + private settings: RenderingContextSettings = new RenderingContextSettings(true); | ||
| 8 | + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings); | ||
| 9 | + | ||
| 10 | + build() { | ||
| 11 | + Stack() { | ||
| 12 | + Image(this.newspaperListItemBean.pagePic) | ||
| 13 | + .width('100%') | ||
| 14 | + .height('100%') | ||
| 15 | + .objectFit(ImageFit.Contain) | ||
| 16 | + | ||
| 17 | + Canvas(this.context) | ||
| 18 | + .width('100%') | ||
| 19 | + .height('100%') | ||
| 20 | + .backgroundColor(Color.Transparent) | ||
| 21 | + .onReady(() => { | ||
| 22 | + | ||
| 23 | + }) | ||
| 24 | + } | ||
| 25 | + .width('100%') | ||
| 26 | + .aspectRatio(0.7) | ||
| 27 | + .onTouch((event: TouchEvent) => { | ||
| 28 | + if (event.type === TouchType.Down) { | ||
| 29 | + let x = event.touches[0].x; | ||
| 30 | + let y = event.touches[0].y; | ||
| 31 | + let points: number[][] = this.getArea(x, y, this.newspaperListItemBean.items); | ||
| 32 | + if (points && points.length > 2){ | ||
| 33 | + let path = new Path2D(); | ||
| 34 | + path.moveTo(px2vp(points[0][0]), px2vp(points[0][1])); | ||
| 35 | + for(let point of points.slice(1, points.length)){ | ||
| 36 | + path.lineTo(px2vp(point[0]), px2vp(point[1])); | ||
| 37 | + } | ||
| 38 | + path.closePath(); | ||
| 39 | + // 设定填充色为蓝色 | ||
| 40 | + this.context.fillStyle = '#33000000'; | ||
| 41 | + // 使用填充的方式,将Path2D描述的五边形绘制在canvas组件内部 | ||
| 42 | + this.context.fill(path); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + } | ||
| 46 | + if (event.type === TouchType.Up) { | ||
| 47 | + this.context.clearRect(0, 0, this.context.width, this.context.height) | ||
| 48 | + } | ||
| 49 | + if (event.type === TouchType.Move) { | ||
| 50 | + // this.context.clearRect(0, 0, this.context.width, this.context.height) | ||
| 51 | + } | ||
| 52 | + }) | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public getArea(x: number, y: number, itemBeans: NewspaperPositionItemBean[]): number[][] { | ||
| 56 | + if (itemBeans && itemBeans.length > 0) { | ||
| 57 | + for (let itemBean of itemBeans) { | ||
| 58 | + if (itemBean.points) { | ||
| 59 | + let area: string[] = itemBean.points.split(';') | ||
| 60 | + if (area && area.length > 0) { | ||
| 61 | + let xys: number[][] = [] | ||
| 62 | + let minX: number = -1; | ||
| 63 | + let maxX: number = -1; | ||
| 64 | + let minY: number = -1; | ||
| 65 | + let maxY: number = -1; | ||
| 66 | + for (let item of area) { | ||
| 67 | + let pair: string[] = item.split(','); | ||
| 68 | + if (pair && pair.length > 1) { | ||
| 69 | + let xy: number[] = [StringUtils.parseNumber(pair[0]), StringUtils.parseNumber(pair[1])] | ||
| 70 | + if (minX < 0) { | ||
| 71 | + minX = xy[0] | ||
| 72 | + } else { | ||
| 73 | + if (minX > xy[0]) { | ||
| 74 | + minX = xy[0] | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + if (maxX < 0) { | ||
| 78 | + maxX = xy[0] | ||
| 79 | + } else { | ||
| 80 | + if (maxX < xy[0]) { | ||
| 81 | + maxX = xy[0] | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + if (minY < 0) { | ||
| 85 | + minY = xy[1] | ||
| 86 | + } else { | ||
| 87 | + if (minY > xy[1]) { | ||
| 88 | + minY = xy[1] | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + if (maxY < 0) { | ||
| 92 | + maxY = xy[1] | ||
| 93 | + } else { | ||
| 94 | + if (maxY < xy[1]) { | ||
| 95 | + maxY = xy[1] | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + xys.push(xy); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + if (vp2px(x) > minX && vp2px(x) < maxX && vp2px(y) > minY && vp2px(y) < maxY) { | ||
| 104 | + return xys; | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + return [] | ||
| 112 | + } | ||
| 113 | +} |
| 1 | +import { NewspaperListBean, NewspaperListItemBean } from 'wdBean' | ||
| 2 | +import { NewspaperViewModel } from '../viewmodel/NewspaperViewModel' | ||
| 3 | +import router from '@ohos.router' | ||
| 4 | +import { ENewspaperItemComponent } from './ENewspaperItemComponent' | ||
| 5 | + | ||
| 6 | +@Component | ||
| 7 | +export struct ENewspaperPageComponent { | ||
| 8 | + @State newspaperListBean: NewspaperListBean = {} as NewspaperListBean | ||
| 9 | + @State currentPageNum: string = '01'; | ||
| 10 | + private swiperController: SwiperController = new SwiperController() | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + build() { | ||
| 14 | + RelativeContainer() { | ||
| 15 | + RelativeContainer() { | ||
| 16 | + Image($r('app.media.icon_arrow_down')) | ||
| 17 | + .height($r('app.float.top_arrow_size')) | ||
| 18 | + .width($r('app.float.top_arrow_size')) | ||
| 19 | + .alignRules({ left: { anchor: "__container__", align: HorizontalAlign.Start }, | ||
| 20 | + center: { anchor: "__container__", align: VerticalAlign.Center } }) | ||
| 21 | + .id('e_newspaper_back') | ||
| 22 | + .onClick((event: ClickEvent) => { | ||
| 23 | + router.back() | ||
| 24 | + }) | ||
| 25 | + | ||
| 26 | + Row() { | ||
| 27 | + Text('2024.01.26') | ||
| 28 | + .fontSize($r('app.float.font_size_20')) | ||
| 29 | + .fontColor($r('app.color.white')) | ||
| 30 | + | ||
| 31 | + Image($r('app.media.icon_triangle')) | ||
| 32 | + .width($r('app.float.border_radius_6')) | ||
| 33 | + .height($r('app.float.border_radius_6')) | ||
| 34 | + .margin({ left: 2, bottom: 5 }) | ||
| 35 | + } | ||
| 36 | + .alignItems(VerticalAlign.Bottom) | ||
| 37 | + .alignRules({ middle: { anchor: "__container__", align: HorizontalAlign.Center }, | ||
| 38 | + center: { anchor: "__container__", align: VerticalAlign.Center } }) | ||
| 39 | + .id('e_newspaper_date') | ||
| 40 | + | ||
| 41 | + Image($r('app.media.icon_share')) | ||
| 42 | + .height($r('app.float.top_arrow_size')) | ||
| 43 | + .width($r('app.float.top_arrow_size')) | ||
| 44 | + .alignRules({ right: { anchor: "__container__", align: HorizontalAlign.End }, | ||
| 45 | + center: { anchor: "__container__", align: VerticalAlign.Center } }) | ||
| 46 | + .id('e_newspaper_share') | ||
| 47 | + } | ||
| 48 | + .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) | ||
| 49 | + .height($r('app.float.top_bar_height')) | ||
| 50 | + .alignRules({ top: { anchor: '__container__', align: VerticalAlign.Top }, | ||
| 51 | + left: { anchor: '__container__', align: HorizontalAlign.Start }, | ||
| 52 | + right: { anchor: '__container__', align: HorizontalAlign.End } }) | ||
| 53 | + .id('e_newspaper_top') | ||
| 54 | + | ||
| 55 | + if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { | ||
| 56 | + Swiper(this.swiperController) { | ||
| 57 | + ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { | ||
| 58 | + ENewspaperItemComponent({newspaperListItemBean: item}) | ||
| 59 | + }) | ||
| 60 | + } | ||
| 61 | + .width('100%') | ||
| 62 | + .vertical(true) | ||
| 63 | + .autoPlay(false) | ||
| 64 | + .cachedCount(3) | ||
| 65 | + .indicator(false) | ||
| 66 | + .displayCount(1) | ||
| 67 | + .aspectRatio(0.7) | ||
| 68 | + .margin({ top: $r('app.float.vp_55'), left: 10, right: 10 }) | ||
| 69 | + .id('e_newspaper_content') | ||
| 70 | + .alignRules({ top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom }, | ||
| 71 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } }) | ||
| 72 | + .onChange((index: number) => { | ||
| 73 | + this.currentPageNum = this.newspaperListBean?.list[index]?.pageNum | ||
| 74 | + }) | ||
| 75 | + | ||
| 76 | + Image($r('app.media.newspaper_shadow')) | ||
| 77 | + .height($r('app.float.vp_12')) | ||
| 78 | + .margin({ left: 12, right: 12, top: -2 }) | ||
| 79 | + .objectFit(ImageFit.Contain) | ||
| 80 | + .alignRules({ top: { anchor: "e_newspaper_content", align: VerticalAlign.Bottom }, | ||
| 81 | + left: { anchor: 'e_newspaper_content', align: HorizontalAlign.Start }, | ||
| 82 | + right: { anchor: 'e_newspaper_content', align: HorizontalAlign.End } }) | ||
| 83 | + .id('e_newspaper_shadow') | ||
| 84 | + | ||
| 85 | + Row() { | ||
| 86 | + Text('滑动查看下一版') | ||
| 87 | + .fontColor(Color.White) | ||
| 88 | + .fontSize($r('app.float.font_size_14')) | ||
| 89 | + Image($r('app.media.icon_next_page')) | ||
| 90 | + .width($r('app.float.vp_16')) | ||
| 91 | + .height($r('app.float.vp_16')) | ||
| 92 | + } | ||
| 93 | + .justifyContent(FlexAlign.Center) | ||
| 94 | + .margin({ top: $r('app.float.margin_16') }) | ||
| 95 | + .alignRules({ top: { anchor: "e_newspaper_shadow", align: VerticalAlign.Bottom }, | ||
| 96 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } }) | ||
| 97 | + .id('e_newspaper_next') | ||
| 98 | + .onClick((event: ClickEvent) => { | ||
| 99 | + this.swiperController.showNext() | ||
| 100 | + }) | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + Row() { | ||
| 104 | + Text(this.currentPageNum) | ||
| 105 | + .fontSize($r('app.float.font_size_36')) | ||
| 106 | + .fontColor($r('app.color.white')) | ||
| 107 | + Text('版') | ||
| 108 | + .fontSize($r('app.float.font_size_16')) | ||
| 109 | + .fontColor($r('app.color.white')) | ||
| 110 | + .margin({ bottom: 6 }) | ||
| 111 | + | ||
| 112 | + Image($r('app.media.icon_triangle')) | ||
| 113 | + .width($r('app.float.border_radius_6')) | ||
| 114 | + .height($r('app.float.border_radius_6')) | ||
| 115 | + .margin({ left: 2, bottom: 6 }) | ||
| 116 | + } | ||
| 117 | + .alignItems(VerticalAlign.Bottom) | ||
| 118 | + .margin({ left: $r('app.float.margin_16'), bottom: $r('app.float.top_tab_bar_height') }) | ||
| 119 | + .alignRules({ bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, | ||
| 120 | + left: { anchor: '__container__', align: HorizontalAlign.Start } }) | ||
| 121 | + .id('e_newspaper_page_num') | ||
| 122 | + | ||
| 123 | + Row() { | ||
| 124 | + Image($r('app.media.icon_read_paper')) | ||
| 125 | + .width($r('app.float.vp_20')) | ||
| 126 | + .height($r('app.float.vp_20')) | ||
| 127 | + .margin({ right: $r('app.float.vp_3') }) | ||
| 128 | + Text('读报纸') | ||
| 129 | + .fontSize($r('app.float.font_size_14')) | ||
| 130 | + .fontColor($r('app.color.white')) | ||
| 131 | + } | ||
| 132 | + .alignItems(VerticalAlign.Center) | ||
| 133 | + .margin({ right: $r('app.float.margin_16'), bottom: $r('app.float.top_tab_bar_height') }) | ||
| 134 | + .alignRules({ bottom: { anchor: '__container__', align: VerticalAlign.Bottom }, | ||
| 135 | + right: { anchor: '__container__', align: HorizontalAlign.End } }) | ||
| 136 | + .id('e_newspaper_read') | ||
| 137 | + } | ||
| 138 | + .width('100%') | ||
| 139 | + .height('100%') | ||
| 140 | + .backgroundColor($r('app.color.color_80000000')) | ||
| 141 | + .id('e_newspaper_container') | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + aboutToAppear() { | ||
| 145 | + let listBean = NewspaperViewModel.getNewspaperListFromLocal(getContext(this)); | ||
| 146 | + this.newspaperListBean = listBean; | ||
| 147 | + | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + aboutToDisappear() { | ||
| 151 | + | ||
| 152 | + } | ||
| 153 | +} |
| 1 | -import { GroupDTO, TopNavBean } from 'wdBean'; | 1 | +import { Action, GroupDTO, Params, TopNavBean } 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,21 +18,36 @@ export struct TopNavigationComponent { | @@ -17,21 +18,36 @@ 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: TopNavBean, index: number) => { | ||
| 22 | - TabContent() { | ||
| 23 | - PageComponent({ groupList: this.groupList, currentTopNavSelectedIndex:index}) | ||
| 24 | - } | ||
| 25 | - .tabBar(this.tabBarBuilder(navItem, index)) | ||
| 26 | - }, (navItem: TopNavBean) => 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: TopNavBean, index: number) => { | ||
| 36 | + TabContent() { | ||
| 37 | + PageComponent({ groupList: this.groupList, currentTopNavSelectedIndex:index}) | ||
| 38 | + } | ||
| 39 | + .tabBar(this.tabBarBuilder(navItem, index)) | ||
| 40 | + }, (navItem: TopNavBean) => JSON.stringify(navItem)); | ||
| 41 | + } | ||
| 42 | + .barHeight($r('app.float.top_tab_bar_height')) | ||
| 43 | + .barMode(BarMode.Scrollable) | ||
| 44 | + .vertical(false) | ||
| 45 | + .onChange((index: number) => { | ||
| 46 | + Logger.info(TAG, `onChange index : ${index}`); | ||
| 47 | + this.currentTopNavSelectedIndex = index; | ||
| 48 | + }) | ||
| 27 | } | 49 | } |
| 28 | - .barHeight($r('app.float.top_tab_bar_height')) | ||
| 29 | - .barMode(BarMode.Scrollable) | ||
| 30 | - .vertical(false) | ||
| 31 | - .onChange((index: number) => { | ||
| 32 | - Logger.info(TAG, `onChange index : ${index}`); | ||
| 33 | - this.currentTopNavSelectedIndex = index; | ||
| 34 | - }) | 50 | + |
| 35 | } | 51 | } |
| 36 | 52 | ||
| 37 | @Builder | 53 | @Builder |
| 1 | +import { BottomNavBean, GroupDTO, NavigationBody, NewspaperListBean, NewspaperTimeInfoBean } from 'wdBean'; | ||
| 2 | +import { Logger, ResourcesUtils } from 'wdKit'; | ||
| 3 | +import { ResponseDTO, WDHttp } from 'wdNetwork'; | ||
| 4 | +import { PageRepository } from '../repository/PageRepository'; | ||
| 5 | +import http from '@ohos.net.http'; | ||
| 6 | +import { BusinessError } from '@ohos.base'; | ||
| 7 | + | ||
| 8 | +const TAG = 'NewspaperViewModel'; | ||
| 9 | + | ||
| 10 | +export class NewspaperViewModel { | ||
| 11 | + | ||
| 12 | + static getNewspaperTimeFromLocal(context: Context): NewspaperTimeInfoBean[] { | ||
| 13 | + Logger.info(TAG, `getNewspaperTimeFromLocal start`); | ||
| 14 | + let newspaperTimeInfo: ResponseDTO<NewspaperTimeInfoBean[]> | null = ResourcesUtils.getResourcesJsonSync<ResponseDTO<NewspaperTimeInfoBean[]>>(context, 'newspaper_info.json'); | ||
| 15 | + if (!newspaperTimeInfo || !newspaperTimeInfo.data) { | ||
| 16 | + Logger.info(TAG, `getNewspaperTimeFromLocal List is empty`); | ||
| 17 | + return [] | ||
| 18 | + } | ||
| 19 | + return newspaperTimeInfo.data | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + static getNewspaperListFromLocal(context: Context): NewspaperListBean { | ||
| 23 | + let newspaperListBean: ResponseDTO<NewspaperListBean> | null = ResourcesUtils.getResourcesJsonSync<ResponseDTO<NewspaperListBean>>(context, 'newspaper_datalist.json'); | ||
| 24 | + if (!newspaperListBean || !newspaperListBean.data) { | ||
| 25 | + Logger.info(TAG, `getCompList compRes is empty`); | ||
| 26 | + return {} as NewspaperListBean | ||
| 27 | + } | ||
| 28 | + return newspaperListBean.data | ||
| 29 | + } | ||
| 30 | +} |
| @@ -19,6 +19,14 @@ | @@ -19,6 +19,14 @@ | ||
| 19 | { | 19 | { |
| 20 | "name": "color_FE4B05", | 20 | "name": "color_FE4B05", |
| 21 | "value": "#FE4B05" | 21 | "value": "#FE4B05" |
| 22 | + }, | ||
| 23 | + { | ||
| 24 | + "name": "color_505050", | ||
| 25 | + "value": "#505050" | ||
| 26 | + }, | ||
| 27 | + { | ||
| 28 | + "name": "color_80000000", | ||
| 29 | + "value": "#80000000" | ||
| 22 | } | 30 | } |
| 23 | ] | 31 | ] |
| 24 | } | 32 | } |
| @@ -32,7 +32,14 @@ | @@ -32,7 +32,14 @@ | ||
| 32 | "name": "font_size_24", | 32 | "name": "font_size_24", |
| 33 | "value": "24fp" | 33 | "value": "24fp" |
| 34 | }, | 34 | }, |
| 35 | - | 35 | + { |
| 36 | + "name": "font_size_20", | ||
| 37 | + "value": "20fp" | ||
| 38 | + }, | ||
| 39 | + { | ||
| 40 | + "name": "font_size_36", | ||
| 41 | + "value": "36fp" | ||
| 42 | + }, | ||
| 36 | { | 43 | { |
| 37 | "name": "main_margin", | 44 | "name": "main_margin", |
| 38 | "value": "14vp" | 45 | "value": "14vp" |
| @@ -104,6 +111,42 @@ | @@ -104,6 +111,42 @@ | ||
| 104 | { | 111 | { |
| 105 | "name": "top_tab_item_padding_top", | 112 | "name": "top_tab_item_padding_top", |
| 106 | "value": "2vp" | 113 | "value": "2vp" |
| 114 | + }, | ||
| 115 | + { | ||
| 116 | + "name": "top_bar_height", | ||
| 117 | + "value": "44vp" | ||
| 118 | + }, | ||
| 119 | + { | ||
| 120 | + "name": "top_arrow_size", | ||
| 121 | + "value": "24vp" | ||
| 122 | + }, | ||
| 123 | + { | ||
| 124 | + "name": "margin_16", | ||
| 125 | + "value": "16vp" | ||
| 126 | + }, | ||
| 127 | + { | ||
| 128 | + "name": "vp_20", | ||
| 129 | + "value": "20vp" | ||
| 130 | + }, | ||
| 131 | + { | ||
| 132 | + "name": "vp_3", | ||
| 133 | + "value": "3vp" | ||
| 134 | + }, | ||
| 135 | + { | ||
| 136 | + "name": "vp_55", | ||
| 137 | + "value": "55vp" | ||
| 138 | + }, | ||
| 139 | + { | ||
| 140 | + "name": "vp_12", | ||
| 141 | + "value": "12vp" | ||
| 142 | + }, | ||
| 143 | + { | ||
| 144 | + "name": "vp_8", | ||
| 145 | + "value": "8vp" | ||
| 146 | + }, | ||
| 147 | + { | ||
| 148 | + "name": "vp_16", | ||
| 149 | + "value": "16vp" | ||
| 107 | } | 150 | } |
| 108 | ] | 151 | ] |
| 109 | } | 152 | } |
772 Bytes
710 Bytes
792 Bytes
2.09 KB
167 Bytes
2.07 KB
| @@ -63,10 +63,10 @@ export function registerRouter() { | @@ -63,10 +63,10 @@ export function registerRouter() { | ||
| 63 | return WDRouterPage.defaultWebPage | 63 | return WDRouterPage.defaultWebPage |
| 64 | }) | 64 | }) |
| 65 | 65 | ||
| 66 | - // Action2Page.register("JUMP_INNER_NEW_PAGE", (action) => { | ||
| 67 | - // if (action.params?.pageID == "WORLDCUP_DETAIL") { | ||
| 68 | - // return WDRouterPage.livependantpage | ||
| 69 | - // } | ||
| 70 | - // return undefined | ||
| 71 | - // }) | 66 | + Action2Page.register("JUMP_INNER_NEW_PAGE", (action) => { |
| 67 | + if (action.params?.pageID == "E_NEWSPAPER") { | ||
| 68 | + return WDRouterPage.eNewspaper | ||
| 69 | + } | ||
| 70 | + return undefined | ||
| 71 | + }) | ||
| 72 | } | 72 | } |
| @@ -20,4 +20,6 @@ export class WDRouterPage { | @@ -20,4 +20,6 @@ export class WDRouterPage { | ||
| 20 | // static aboutPage = new WDRouterPage("entry", "ets/pages/about/AboutPage"); | 20 | // static aboutPage = new WDRouterPage("entry", "ets/pages/about/AboutPage"); |
| 21 | // web默认页面 | 21 | // web默认页面 |
| 22 | static defaultWebPage = new WDRouterPage("entry", "ets/pages/web/DefaultWebPage"); | 22 | static defaultWebPage = new WDRouterPage("entry", "ets/pages/web/DefaultWebPage"); |
| 23 | + // 电子报页面 | ||
| 24 | + static eNewspaper = new WDRouterPage("entry", "ets/pages/ENewspaper") | ||
| 23 | } | 25 | } |
-
Please register or login to post a comment