Showing
19 changed files
with
729 additions
and
19 deletions
| @@ -253,6 +253,13 @@ export class HttpUrlUtils { | @@ -253,6 +253,13 @@ export class HttpUrlUtils { | ||
| 253 | * 早晚报获取PAGEID | 253 | * 早晚报获取PAGEID |
| 254 | * */ | 254 | * */ |
| 255 | static readonly DAILY_PAPER_TOPIC: string = "/api/rmrb-bff-display-zh/display/zh/c/dailyPaperTopic"; | 255 | static readonly DAILY_PAPER_TOPIC: string = "/api/rmrb-bff-display-zh/display/zh/c/dailyPaperTopic"; |
| 256 | + | ||
| 257 | + /** | ||
| 258 | + * app启动页 兴趣偏好 | ||
| 259 | + */ | ||
| 260 | + static readonly INTERESTS_HOTS_DATA_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/queryTags"; | ||
| 261 | + | ||
| 262 | + | ||
| 256 | private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; | 263 | private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; |
| 257 | /** | 264 | /** |
| 258 | * 推荐列表 | 265 | * 推荐列表 |
| @@ -650,6 +657,12 @@ export class HttpUrlUtils { | @@ -650,6 +657,12 @@ export class HttpUrlUtils { | ||
| 650 | return url | 657 | return url |
| 651 | } | 658 | } |
| 652 | 659 | ||
| 660 | + static getInterestsUrl() { | ||
| 661 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERESTS_HOTS_DATA_PATH; | ||
| 662 | + return url; | ||
| 663 | + | ||
| 664 | + } | ||
| 665 | + | ||
| 653 | static getLiveDetailsUrl() { | 666 | static getLiveDetailsUrl() { |
| 654 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH | 667 | let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH |
| 655 | return url | 668 | return url |
| @@ -87,6 +87,9 @@ export class WDRouterPage { | @@ -87,6 +87,9 @@ export class WDRouterPage { | ||
| 87 | static launchAdvertisingPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchAdvertisingPage"); | 87 | static launchAdvertisingPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchAdvertisingPage"); |
| 88 | //主页 | 88 | //主页 |
| 89 | static mainPage = new WDRouterPage("phone", "ets/pages/MainPage"); | 89 | static mainPage = new WDRouterPage("phone", "ets/pages/MainPage"); |
| 90 | + | ||
| 91 | + static launchInterestsPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchInterestsHobbiesPage"); | ||
| 92 | + | ||
| 90 | // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); | 93 | // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); |
| 91 | 94 | ||
| 92 | //播报页面 | 95 | //播报页面 |
| @@ -18,7 +18,7 @@ export class WDRouterRule { | @@ -18,7 +18,7 @@ export class WDRouterRule { | ||
| 18 | if (page) { | 18 | if (page) { |
| 19 | if (params) { | 19 | if (params) { |
| 20 | // router.pushUrl({ url: 'pages/routerpage2', , params: params }) | 20 | // router.pushUrl({ url: 'pages/routerpage2', , params: params }) |
| 21 | - console.log('page.url()==',page.url()) | 21 | + console.log('page.url()==',page.url(),JSON.stringify(params)) |
| 22 | router.pushUrl({ url: page.url(), params: params }) | 22 | router.pushUrl({ url: page.url(), params: params }) |
| 23 | } else { | 23 | } else { |
| 24 | router.pushUrl({ url: page.url() }).catch((error:Error)=>{ | 24 | router.pushUrl({ url: page.url() }).catch((error:Error)=>{ |
| @@ -14,7 +14,7 @@ export struct WdWebLocalComponent { | @@ -14,7 +14,7 @@ export struct WdWebLocalComponent { | ||
| 14 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 14 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 15 | @Prop backVisibility: boolean = false | 15 | @Prop backVisibility: boolean = false |
| 16 | @Prop webResource: Resource = {} as Resource | 16 | @Prop webResource: Resource = {} as Resource |
| 17 | - @State webHeight : string = '100%' | 17 | + @State webHeight: string | number = '100%' |
| 18 | 18 | ||
| 19 | build() { | 19 | build() { |
| 20 | Column() { | 20 | Column() { |
| @@ -39,7 +39,7 @@ export struct WdWebLocalComponent { | @@ -39,7 +39,7 @@ export struct WdWebLocalComponent { | ||
| 39 | .mixedMode(MixedMode.All) | 39 | .mixedMode(MixedMode.All) |
| 40 | .onlineImageAccess(true) | 40 | .onlineImageAccess(true) |
| 41 | .enableNativeEmbedMode(true) | 41 | .enableNativeEmbedMode(true) |
| 42 | - .height(this.webHeight === '100%' ? '100%' : Number(this.webHeight)) | 42 | + .height(this.webHeight) |
| 43 | .onPageBegin((event) => { | 43 | .onPageBegin((event) => { |
| 44 | this.onPageBegin(event?.url); | 44 | this.onPageBegin(event?.url); |
| 45 | }) | 45 | }) |
| @@ -79,9 +79,16 @@ export struct WdWebLocalComponent { | @@ -79,9 +79,16 @@ export struct WdWebLocalComponent { | ||
| 79 | 79 | ||
| 80 | //webview 高度设置 | 80 | //webview 高度设置 |
| 81 | private setCurrentPageOperate: (data: Message) => void = (data) => { | 81 | private setCurrentPageOperate: (data: Message) => void = (data) => { |
| 82 | - console.log("setCurrentPageOperate",JSON.stringify(data)) | 82 | + console.log("setCurrentPageOperate", JSON.stringify(data)) |
| 83 | if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate) { | 83 | if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate) { |
| 84 | - this.webHeight = data?.data?.webViewHeight || '100%' | 84 | + if (typeof this.webHeight === 'number') { |
| 85 | + if (Number(data?.data?.webViewHeight) > this.webHeight) { | ||
| 86 | + this.webHeight = Number(data?.data?.webViewHeight) | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + { | ||
| 90 | + this.webHeight = Number(data?.data?.webViewHeight) || '100%' | ||
| 91 | + } | ||
| 85 | } | 92 | } |
| 86 | } | 93 | } |
| 87 | /** | 94 | /** |
| @@ -72,5 +72,6 @@ export interface ContentDTO { | @@ -72,5 +72,6 @@ export interface ContentDTO { | ||
| 72 | corner: string; | 72 | corner: string; |
| 73 | rmhPlatform: number; | 73 | rmhPlatform: number; |
| 74 | newTags: string; | 74 | newTags: string; |
| 75 | + titleShow?: number; | ||
| 75 | isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 | 76 | isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 |
| 76 | } | 77 | } |
| @@ -58,9 +58,9 @@ export struct CardParser { | @@ -58,9 +58,9 @@ export struct CardParser { | ||
| 58 | } | 58 | } |
| 59 | else { | 59 | else { |
| 60 | // todo:组件未实现 / Component Not Implemented | 60 | // todo:组件未实现 / Component Not Implemented |
| 61 | - Text(contentDTO.appStyle) | ||
| 62 | - .width(CommonConstants.FULL_PARENT) | ||
| 63 | - .padding(10) | 61 | + // Text(contentDTO.appStyle) |
| 62 | + // .width(CommonConstants.FULL_PARENT) | ||
| 63 | + // .padding(10) | ||
| 64 | // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle | 64 | // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle |
| 65 | } | 65 | } |
| 66 | } | 66 | } |
| @@ -66,9 +66,9 @@ export struct CompParser { | @@ -66,9 +66,9 @@ export struct CompParser { | ||
| 66 | } | 66 | } |
| 67 | else { | 67 | else { |
| 68 | // todo:组件未实现 / Component Not Implemented | 68 | // todo:组件未实现 / Component Not Implemented |
| 69 | - Text(compDTO.compStyle) | ||
| 70 | - .width(CommonConstants.FULL_PARENT) | ||
| 71 | - .padding(10) | 69 | + // Text(compDTO.compStyle) |
| 70 | + // .width(CommonConstants.FULL_PARENT) | ||
| 71 | + // .padding(10) | ||
| 72 | // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle | 72 | // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle |
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| @@ -20,12 +20,18 @@ export struct CardSourceInfo { | @@ -20,12 +20,18 @@ export struct CardSourceInfo { | ||
| 20 | .fontColor($r("app.color.color_B0B0B0")) | 20 | .fontColor($r("app.color.color_B0B0B0")) |
| 21 | .maxLines(1) | 21 | .maxLines(1) |
| 22 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 22 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 23 | + Image($r("app.media.point")) | ||
| 24 | + .width(16) | ||
| 25 | + .height(16) | ||
| 23 | } else if (this.contentDTO.source) { | 26 | } else if (this.contentDTO.source) { |
| 24 | Text(`${this.contentDTO.source}`) | 27 | Text(`${this.contentDTO.source}`) |
| 25 | .fontSize($r("app.float.font_size_12")) | 28 | .fontSize($r("app.float.font_size_12")) |
| 26 | .fontColor($r("app.color.color_B0B0B0")) | 29 | .fontColor($r("app.color.color_B0B0B0")) |
| 27 | .maxLines(1) | 30 | .maxLines(1) |
| 28 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 31 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 32 | + Image($r("app.media.point")) | ||
| 33 | + .width(16) | ||
| 34 | + .height(16) | ||
| 29 | } | 35 | } |
| 30 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | 36 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 |
| 31 | if (this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | 37 | if (this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime |
| @@ -34,9 +40,6 @@ export struct CardSourceInfo { | @@ -34,9 +40,6 @@ export struct CardSourceInfo { | ||
| 34 | .contentDTO.publishTime)) | 40 | .contentDTO.publishTime)) |
| 35 | .indexOf | 41 | .indexOf |
| 36 | ('-') === -1) { | 42 | ('-') === -1) { |
| 37 | - Image($r("app.media.point")) | ||
| 38 | - .width(16) | ||
| 39 | - .height(16) | ||
| 40 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | 43 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 41 | .fontSize($r("app.float.font_size_12")) | 44 | .fontSize($r("app.float.font_size_12")) |
| 42 | .fontColor($r("app.color.color_B0B0B0")) | 45 | .fontColor($r("app.color.color_B0B0B0")) |
| @@ -17,7 +17,7 @@ export struct Card10Component { | @@ -17,7 +17,7 @@ export struct Card10Component { | ||
| 17 | build() { | 17 | build() { |
| 18 | Column() { | 18 | Column() { |
| 19 | // 顶部标题,最多两行 | 19 | // 顶部标题,最多两行 |
| 20 | - if (this.contentDTO.newsTitle) { | 20 | + if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { |
| 21 | Text(this.contentDTO.newsTitle) | 21 | Text(this.contentDTO.newsTitle) |
| 22 | .width(CommonConstants.FULL_WIDTH) | 22 | .width(CommonConstants.FULL_WIDTH) |
| 23 | .fontSize($r('app.float.font_size_17')) | 23 | .fontSize($r('app.float.font_size_17')) |
| @@ -42,9 +42,9 @@ export struct Card6Component { | @@ -42,9 +42,9 @@ export struct Card6Component { | ||
| 42 | .alignItems(HorizontalAlign.Start) | 42 | .alignItems(HorizontalAlign.Start) |
| 43 | .justifyContent(FlexAlign.Start) | 43 | .justifyContent(FlexAlign.Start) |
| 44 | .width('58%') | 44 | .width('58%') |
| 45 | - if (this.contentDTO.coverUrl) { | ||
| 46 | Stack() { | 45 | Stack() { |
| 47 | Image(this.contentDTO.coverUrl) | 46 | Image(this.contentDTO.coverUrl) |
| 47 | + .backgroundColor($r('app.color.color_B0B0B0')) | ||
| 48 | .borderRadius(5) | 48 | .borderRadius(5) |
| 49 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) | 49 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) |
| 50 | .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) | 50 | .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 90 : 180) |
| @@ -52,7 +52,6 @@ export struct Card6Component { | @@ -52,7 +52,6 @@ export struct Card6Component { | ||
| 52 | } | 52 | } |
| 53 | .alignContent(Alignment.BottomEnd) | 53 | .alignContent(Alignment.BottomEnd) |
| 54 | } | 54 | } |
| 55 | - } | ||
| 56 | .onClick((event: ClickEvent) => { | 55 | .onClick((event: ClickEvent) => { |
| 57 | ProcessUtils.processPage(this.contentDTO) | 56 | ProcessUtils.processPage(this.contentDTO) |
| 58 | }) | 57 | }) |
| @@ -15,7 +15,7 @@ export struct Card9Component { | @@ -15,7 +15,7 @@ export struct Card9Component { | ||
| 15 | build() { | 15 | build() { |
| 16 | Column() { | 16 | Column() { |
| 17 | // 顶部标题,最多两行 | 17 | // 顶部标题,最多两行 |
| 18 | - if (this.contentDTO.newsTitle) { | 18 | + if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { |
| 19 | Text(this.contentDTO.newsTitle) | 19 | Text(this.contentDTO.newsTitle) |
| 20 | .width(CommonConstants.FULL_WIDTH) | 20 | .width(CommonConstants.FULL_WIDTH) |
| 21 | .fontSize($r('app.float.font_size_17')) | 21 | .fontSize($r('app.float.font_size_17')) |
| 1 | +import { CompDTO, ContentDTO, Params } from 'wdBean'; | ||
| 2 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 3 | +import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 4 | +import { postInteractAccentionOperateParams } from 'wdBean'; | ||
| 5 | +import { PageRepository } from '../../repository/PageRepository'; | ||
| 6 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 小视频横划卡 | ||
| 10 | + * Zh_Single_Row-02 | ||
| 11 | + */ | ||
| 12 | +const TAG = 'Zh_Single_Row-02' | ||
| 13 | + | ||
| 14 | +@Entry | ||
| 15 | +@Component | ||
| 16 | +export struct ZhSingleRow02 { | ||
| 17 | + @State compDTO: CompDTO = { | ||
| 18 | + objectTitle: '大标题', | ||
| 19 | + operDataList: [ | ||
| 20 | + { | ||
| 21 | + rmhInfo: { | ||
| 22 | + rmhId: '2489729', | ||
| 23 | + rmhName: '陕西青年职业学院', | ||
| 24 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 25 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 26 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 27 | + } | ||
| 28 | + }, | ||
| 29 | + { | ||
| 30 | + rmhInfo: { | ||
| 31 | + rmhId: '2489729', | ||
| 32 | + rmhName: '陕西青年职业学院', | ||
| 33 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 34 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 35 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 36 | + } | ||
| 37 | + }, | ||
| 38 | + { | ||
| 39 | + rmhInfo: { | ||
| 40 | + rmhId: '2489729', | ||
| 41 | + rmhName: '陕西青年职业学院', | ||
| 42 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 43 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 44 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 45 | + } | ||
| 46 | + }, | ||
| 47 | + { | ||
| 48 | + rmhInfo: { | ||
| 49 | + rmhId: '2489729', | ||
| 50 | + rmhName: '陕西青年职业学院', | ||
| 51 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 52 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 53 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 54 | + } | ||
| 55 | + }, | ||
| 56 | + { | ||
| 57 | + rmhInfo: { | ||
| 58 | + rmhId: '2489729', | ||
| 59 | + rmhName: '陕西青年职业学院', | ||
| 60 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 61 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 62 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 63 | + } | ||
| 64 | + }, | ||
| 65 | + ] | ||
| 66 | + } as CompDTO | ||
| 67 | + | ||
| 68 | + build() { | ||
| 69 | + Column() { | ||
| 70 | + //顶部 | ||
| 71 | + this.CompHeader(this.compDTO) | ||
| 72 | + Row(){ | ||
| 73 | + // 列表内容 | ||
| 74 | + List() { | ||
| 75 | + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => { | ||
| 76 | + CreatorItem({ | ||
| 77 | + item | ||
| 78 | + }) | ||
| 79 | + .margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0}) | ||
| 80 | + }) | ||
| 81 | + } | ||
| 82 | + .listDirection(Axis.Horizontal) | ||
| 83 | + } | ||
| 84 | + .width(CommonConstants.FULL_WIDTH) | ||
| 85 | + .height(208) | ||
| 86 | + } | ||
| 87 | + .padding({ | ||
| 88 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 89 | + // right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 90 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 91 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 92 | + }) | ||
| 93 | + .backgroundColor($r('app.color.white')) | ||
| 94 | + .margin({ bottom: 8 }) | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + @Builder | ||
| 98 | + CompHeader(item: CompDTO) { | ||
| 99 | + Row() { | ||
| 100 | + Row() { | ||
| 101 | + Image($r("app.media.redLine")) | ||
| 102 | + .width(3) | ||
| 103 | + .height(16) | ||
| 104 | + .margin({ right: 4 }) | ||
| 105 | + Text(item.objectTitle) | ||
| 106 | + .fontSize($r("app.float.font_size_17")) | ||
| 107 | + .fontColor($r("app.color.color_222222")) | ||
| 108 | + .fontWeight(600) | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + Row() { | ||
| 112 | + Text("更多") | ||
| 113 | + .fontSize($r("app.float.font_size_14")) | ||
| 114 | + .fontColor($r("app.color.color_999999")) | ||
| 115 | + .margin({ right: 1 }) | ||
| 116 | + Image($r("app.media.more")) | ||
| 117 | + .width(14) | ||
| 118 | + .height(14) | ||
| 119 | + .onClick(() => { | ||
| 120 | + // TODO 跳转的页面,定义的入参可能不合理。推荐id: 41 | ||
| 121 | + let params: Params = { | ||
| 122 | + pageID: "1" | ||
| 123 | + } | ||
| 124 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 125 | + }) | ||
| 126 | + } | ||
| 127 | + .padding({ | ||
| 128 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 129 | + }) | ||
| 130 | + } | ||
| 131 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 132 | + .margin({ top: 8, bottom: 8 }) | ||
| 133 | + .width('100%') | ||
| 134 | + } | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +@Extend(Text) | ||
| 138 | +function textOverflowStyle(maxLine: number) { | ||
| 139 | + .maxLines(maxLine) | ||
| 140 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +@Component | ||
| 144 | +struct CreatorItem { | ||
| 145 | + @Prop item: ContentDTO | ||
| 146 | + @State rmhIsAttention: number = 0 | ||
| 147 | + build() { | ||
| 148 | + ListItem() { | ||
| 149 | + Column() { | ||
| 150 | + Stack({ alignContent: Alignment.Bottom }) { | ||
| 151 | + Image('') | ||
| 152 | + .width(156) | ||
| 153 | + .height(208) | ||
| 154 | + Row() | ||
| 155 | + .width(156) | ||
| 156 | + .height(80) | ||
| 157 | + .linearGradient({ | ||
| 158 | + direction: GradientDirection.Bottom, | ||
| 159 | + colors: [[0xffffff, 0.0], [0x000000, 1.0]] | ||
| 160 | + }) | ||
| 161 | + .opacity(0.3) | ||
| 162 | + Text('这里显示卡片标题这里显示卡片标题这里显示卡片标题这里显示卡片标题这里显示卡片标题') | ||
| 163 | + .fontColor(0xffffff) | ||
| 164 | + .fontSize(14) | ||
| 165 | + .maxLines(2) | ||
| 166 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 167 | + .width(140) | ||
| 168 | + .height(40) | ||
| 169 | + .margin({bottom: 8}) | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + } | ||
| 173 | + .width(156) | ||
| 174 | + .height(208) | ||
| 175 | + .margin({ right: 11 }) | ||
| 176 | + .borderWidth(1) | ||
| 177 | + .borderColor($r('app.color.color_EDEDED')) | ||
| 178 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 179 | + } | ||
| 180 | + .onClick(() => { | ||
| 181 | + console.log('跳转到rmh'); | ||
| 182 | + }) | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + /** | ||
| 186 | + * 关注号主 TODO 这里后面需要抽离 | ||
| 187 | + */ | ||
| 188 | + handleAccention(item: ContentDTO, status: number) { | ||
| 189 | + this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 | ||
| 190 | + return | ||
| 191 | + // 未登录,跳转登录 | ||
| 192 | + if (!HttpUrlUtils.getUserId()) { | ||
| 193 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 194 | + return | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + const params: postInteractAccentionOperateParams = { | ||
| 198 | + attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | ||
| 199 | + attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id | ||
| 200 | + attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id | ||
| 201 | + // userType: 1, | ||
| 202 | + // userId: '1', // TODO 用户id需要从本地获取 | ||
| 203 | + status: status, | ||
| 204 | + } | ||
| 205 | + PageRepository.postInteractAccentionOperate(params).then(res => { | ||
| 206 | + console.log(TAG, '关注号主==', JSON.stringify(res.data)) | ||
| 207 | + if (status === 1) { | ||
| 208 | + this.rmhIsAttention = 0 | ||
| 209 | + } else { | ||
| 210 | + this.rmhIsAttention = 1 | ||
| 211 | + } | ||
| 212 | + }) | ||
| 213 | + } | ||
| 214 | +} |
| 1 | +import { CompDTO, ContentDTO, Params } from 'wdBean'; | ||
| 2 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 3 | +import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 4 | +import { postInteractAccentionOperateParams } from 'wdBean'; | ||
| 5 | +import { PageRepository } from '../../repository/PageRepository'; | ||
| 6 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 精选评论卡 | ||
| 10 | + * Zh_Single_Row-06 | ||
| 11 | + */ | ||
| 12 | +const TAG = 'Zh_Single_Row-06' | ||
| 13 | + | ||
| 14 | +@Entry | ||
| 15 | +@Component | ||
| 16 | +export struct ZhSingleRow06 { | ||
| 17 | + @State compDTO: CompDTO = { | ||
| 18 | + objectTitle: '大标题', | ||
| 19 | + operDataList: [ | ||
| 20 | + { | ||
| 21 | + rmhInfo: { | ||
| 22 | + rmhId: '2489729', | ||
| 23 | + rmhName: '陕西青年职业学院', | ||
| 24 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 25 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 26 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 27 | + } | ||
| 28 | + }, | ||
| 29 | + { | ||
| 30 | + rmhInfo: { | ||
| 31 | + rmhId: '2489729', | ||
| 32 | + rmhName: '陕西青年职业学院', | ||
| 33 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 34 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 35 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 36 | + } | ||
| 37 | + }, | ||
| 38 | + { | ||
| 39 | + rmhInfo: { | ||
| 40 | + rmhId: '2489729', | ||
| 41 | + rmhName: '陕西青年职业学院', | ||
| 42 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 43 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 44 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 45 | + } | ||
| 46 | + }, | ||
| 47 | + { | ||
| 48 | + rmhInfo: { | ||
| 49 | + rmhId: '2489729', | ||
| 50 | + rmhName: '陕西青年职业学院', | ||
| 51 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 52 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 53 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 54 | + } | ||
| 55 | + }, | ||
| 56 | + { | ||
| 57 | + rmhInfo: { | ||
| 58 | + rmhId: '2489729', | ||
| 59 | + rmhName: '陕西青年职业学院', | ||
| 60 | + rmhDesc: '陕西青年职业学院陕西青年职业学院是经陕西省人民政陕西青年职业学院是经陕西省人民政是经陕西省人民政', | ||
| 61 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20210113/a_533807397399949312' + | ||
| 62 | + '.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg' | ||
| 63 | + } | ||
| 64 | + }, | ||
| 65 | + ] | ||
| 66 | + } as CompDTO | ||
| 67 | + | ||
| 68 | + build() { | ||
| 69 | + Column() { | ||
| 70 | + //顶部 | ||
| 71 | + this.CompHeader(this.compDTO) | ||
| 72 | + Row(){ | ||
| 73 | + // 列表内容 | ||
| 74 | + List() { | ||
| 75 | + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => { | ||
| 76 | + CreatorItem({ | ||
| 77 | + item | ||
| 78 | + }) | ||
| 79 | + .margin({right: index === this.compDTO.operDataList.length - 1 ? $r('app.float.card_comp_pagePadding_lf') : 0}) | ||
| 80 | + }) | ||
| 81 | + } | ||
| 82 | + .listDirection(Axis.Horizontal) | ||
| 83 | + } | ||
| 84 | + .width(CommonConstants.FULL_WIDTH) | ||
| 85 | + .height(208) | ||
| 86 | + } | ||
| 87 | + .padding({ | ||
| 88 | + left: $r('app.float.card_comp_pagePadding_lf'), | ||
| 89 | + // right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 90 | + top: $r('app.float.card_comp_pagePadding_tb'), | ||
| 91 | + bottom: $r('app.float.card_comp_pagePadding_tb') | ||
| 92 | + }) | ||
| 93 | + .backgroundColor($r('app.color.white')) | ||
| 94 | + .margin({ bottom: 8 }) | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + @Builder | ||
| 98 | + CompHeader(item: CompDTO) { | ||
| 99 | + Row() { | ||
| 100 | + Row() { | ||
| 101 | + Image($r("app.media.icon_elite_comment")) | ||
| 102 | + .width(24) | ||
| 103 | + .height(24) | ||
| 104 | + .margin({ right: 4 }) | ||
| 105 | + Text('精选评论') | ||
| 106 | + .fontSize($r("app.float.font_size_17")) | ||
| 107 | + .fontColor($r("app.color.color_222222")) | ||
| 108 | + .fontWeight(600) | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + Row() { | ||
| 112 | + Text("更多") | ||
| 113 | + .fontSize($r("app.float.font_size_14")) | ||
| 114 | + .fontColor($r("app.color.color_999999")) | ||
| 115 | + .margin({ right: 1 }) | ||
| 116 | + Image($r("app.media.more")) | ||
| 117 | + .width(14) | ||
| 118 | + .height(14) | ||
| 119 | + .onClick(() => { | ||
| 120 | + // TODO 跳转的页面,定义的入参可能不合理。推荐id: 41 | ||
| 121 | + let params: Params = { | ||
| 122 | + pageID: "1" | ||
| 123 | + } | ||
| 124 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 125 | + }) | ||
| 126 | + } | ||
| 127 | + .padding({ | ||
| 128 | + right: $r('app.float.card_comp_pagePadding_lf'), | ||
| 129 | + }) | ||
| 130 | + } | ||
| 131 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 132 | + .margin({ top: 8, bottom: 8 }) | ||
| 133 | + .width('100%') | ||
| 134 | + } | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +@Extend(Text) | ||
| 138 | +function textOverflowStyle(maxLine: number) { | ||
| 139 | + .maxLines(maxLine) | ||
| 140 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +@Component | ||
| 144 | +struct CreatorItem { | ||
| 145 | + @Prop item: ContentDTO | ||
| 146 | + @State rmhIsAttention: number = 0 | ||
| 147 | + build() { | ||
| 148 | + ListItem() { | ||
| 149 | + Column() { | ||
| 150 | + Flex({direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween}) { | ||
| 151 | + Column() { | ||
| 152 | + Row() { | ||
| 153 | + Image('') | ||
| 154 | + .width(20) | ||
| 155 | + .height(20) | ||
| 156 | + .margin({right: 4}) | ||
| 157 | + .border({width: 1, color: 0xcccccc, radius: 10}) | ||
| 158 | + Text('立志之间') | ||
| 159 | + .fontColor(0x212228) | ||
| 160 | + .fontSize(12) | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + Column() { | ||
| 165 | + Row() { | ||
| 166 | + Image($r('app.media.icon_like_no')) | ||
| 167 | + .width(16) | ||
| 168 | + .height(16) | ||
| 169 | + .margin({right: 4}) | ||
| 170 | + Text('3835') | ||
| 171 | + .fontSize(14) | ||
| 172 | + .fontColor(0x999999) | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | + } | ||
| 176 | + .margin({top: 10, left: 10, right: 10, bottom: 8}) | ||
| 177 | + | ||
| 178 | + Text('就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,') | ||
| 179 | + .maxLines(2) | ||
| 180 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 181 | + .margin({left: 10, right: 10, bottom: 8}) | ||
| 182 | + .fontSize(17) | ||
| 183 | + .fontColor(0x212228) | ||
| 184 | + .lineHeight(25) | ||
| 185 | + | ||
| 186 | + Row() { | ||
| 187 | + Image('') | ||
| 188 | + .width(66) | ||
| 189 | + .height(44) | ||
| 190 | + .borderRadius({topLeft: 3, topRight: 0, bottomLeft: 3, bottomRight: 0}) | ||
| 191 | + Text('原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制') | ||
| 192 | + .margin({left: 8}) | ||
| 193 | + .width(172) | ||
| 194 | + .maxLines(2) | ||
| 195 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 196 | + } | ||
| 197 | + .linearGradient({ | ||
| 198 | + direction: GradientDirection.Right, | ||
| 199 | + colors: [[0xffffff, 0.0],[0xffffff, 0.8], [0xf9f9f9, 1.0]] | ||
| 200 | + }) | ||
| 201 | + } | ||
| 202 | + .width(276) | ||
| 203 | + .height(150) | ||
| 204 | + .margin({ right: 10 }) | ||
| 205 | + .borderWidth(1) | ||
| 206 | + .borderColor($r('app.color.color_EDEDED')) | ||
| 207 | + .borderRadius($r('app.float.image_border_radius')) | ||
| 208 | + .backgroundColor(0xf9f9f9) | ||
| 209 | + } | ||
| 210 | + .onClick(() => { | ||
| 211 | + console.log('跳转到rmh'); | ||
| 212 | + }) | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + /** | ||
| 216 | + * 关注号主 TODO 这里后面需要抽离 | ||
| 217 | + */ | ||
| 218 | + handleAccention(item: ContentDTO, status: number) { | ||
| 219 | + this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 | ||
| 220 | + return | ||
| 221 | + // 未登录,跳转登录 | ||
| 222 | + if (!HttpUrlUtils.getUserId()) { | ||
| 223 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 224 | + return | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + const params: postInteractAccentionOperateParams = { | ||
| 228 | + attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | ||
| 229 | + attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id | ||
| 230 | + attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id | ||
| 231 | + // userType: 1, | ||
| 232 | + // userId: '1', // TODO 用户id需要从本地获取 | ||
| 233 | + status: status, | ||
| 234 | + } | ||
| 235 | + PageRepository.postInteractAccentionOperate(params).then(res => { | ||
| 236 | + console.log(TAG, '关注号主==', JSON.stringify(res.data)) | ||
| 237 | + if (status === 1) { | ||
| 238 | + this.rmhIsAttention = 0 | ||
| 239 | + } else { | ||
| 240 | + this.rmhIsAttention = 1 | ||
| 241 | + } | ||
| 242 | + }) | ||
| 243 | + } | ||
| 244 | +} |
| @@ -447,5 +447,8 @@ export struct PaperSingleColumn999CardView { | @@ -447,5 +447,8 @@ export struct PaperSingleColumn999CardView { | ||
| 447 | .backgroundColor(Color.White) | 447 | .backgroundColor(Color.White) |
| 448 | .margin({ bottom: 5, left: 12, right: 12 }) | 448 | .margin({ bottom: 5, left: 12, right: 12 }) |
| 449 | .borderRadius(4) | 449 | .borderRadius(4) |
| 450 | + .onClick(()=>{ | ||
| 451 | + ProcessUtils.processPage(this.item) | ||
| 452 | + }) | ||
| 450 | } | 453 | } |
| 451 | } | 454 | } |
2.55 KB
| @@ -59,7 +59,9 @@ struct GuidePages { | @@ -59,7 +59,9 @@ struct GuidePages { | ||
| 59 | .onClick(() => { | 59 | .onClick(() => { |
| 60 | if (index == 3) { | 60 | if (index == 3) { |
| 61 | // 跳转到首页 | 61 | // 跳转到首页 |
| 62 | - WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage) | 62 | + //WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage) |
| 63 | + //跳转到兴趣偏好选择页 | ||
| 64 | + WDRouterRule.jumpWithReplacePage(WDRouterPage.launchInterestsPage) | ||
| 63 | } | 65 | } |
| 64 | }) | 66 | }) |
| 65 | .id('index') | 67 | .id('index') |
sight_harmony/products/phone/src/main/ets/pages/launchPage/LaunchInterestsHobbiesPage.ets
0 → 100644
| 1 | +import {InterestsHobbiesModel, InterestsList} from '../viewModel/InterestsHobbiesModel' | ||
| 2 | +import { WDRouterRule } from 'wdRouter'; | ||
| 3 | +import { WDRouterPage } from 'wdRouter'; | ||
| 4 | + | ||
| 5 | +@Entry | ||
| 6 | +@Component | ||
| 7 | +struct LaunchInterestsHobbiesPage { | ||
| 8 | + @State message: string = 'Hello World' | ||
| 9 | + @State dataArray: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] | ||
| 10 | + @State selectCount: number = 0 | ||
| 11 | + @State interestsArray: InterestsList[] = [] | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + aboutToAppear(){ | ||
| 15 | + //请求接口,获取兴趣偏好数据 | ||
| 16 | + this.requestInterestsData() | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + build() { | ||
| 21 | + Column() { | ||
| 22 | + Row(){ | ||
| 23 | + Blank() | ||
| 24 | + Text('跳过') | ||
| 25 | + .fontSize('27lpx') | ||
| 26 | + .fontColor('#333333') | ||
| 27 | + .width('54lpx') | ||
| 28 | + .height('35lpx') | ||
| 29 | + .margin({top:'27lpx',right:'46lpx'}) | ||
| 30 | + .onClick(()=>{ | ||
| 31 | + //直接跳过到首页 | ||
| 32 | + //跳转首页 | ||
| 33 | + WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage) | ||
| 34 | + }) | ||
| 35 | + } | ||
| 36 | + .width('100%') | ||
| 37 | + .justifyContent(FlexAlign.End) | ||
| 38 | + | ||
| 39 | + Text('选择感兴趣的内容') | ||
| 40 | + .fontSize('46lpx') | ||
| 41 | + .fontWeight(FontWeight.Bold) | ||
| 42 | + .textAlign(TextAlign.Center) | ||
| 43 | + .fontColor('#333333') | ||
| 44 | + .width('100%') | ||
| 45 | + .height('61lpx') | ||
| 46 | + .margin({top:'84lpx'}) | ||
| 47 | + Text('完善信息,将为您推荐个性化的内容') | ||
| 48 | + .fontSize('27lpx') | ||
| 49 | + .textAlign(TextAlign.Center) | ||
| 50 | + .fontColor('#9E9E9E') | ||
| 51 | + .width('100%') | ||
| 52 | + .height('35lpx') | ||
| 53 | + .margin({top:'12lpx'}) | ||
| 54 | + | ||
| 55 | + Grid( ){ | ||
| 56 | + ForEach(this.interestsArray,(item:InterestsList,index:number)=>{ | ||
| 57 | + GridItem(){ | ||
| 58 | + Stack({alignContent:Alignment.TopStart}){ | ||
| 59 | + | ||
| 60 | + Image(item.pic) | ||
| 61 | + .width('100%') | ||
| 62 | + .height('100%') | ||
| 63 | + .backgroundColor(Color.White) | ||
| 64 | + .borderRadius(5) | ||
| 65 | + Stack(){ | ||
| 66 | + Column({}){ | ||
| 67 | + Text(item.name) | ||
| 68 | + .fontSize('35lpx') | ||
| 69 | + .fontColor('#FFFFFF') | ||
| 70 | + .margin({top:'21lpx',left:'19lpx'}) | ||
| 71 | + .width('100%') | ||
| 72 | + .height('46lpx') | ||
| 73 | + .fontWeight(FontWeight.Bold) | ||
| 74 | + Text(item.title) | ||
| 75 | + .fontSize('23lpx') | ||
| 76 | + .fontColor('#FFFFFF') | ||
| 77 | + .margin({top:'2lpx',left:'19lpx'}) | ||
| 78 | + .width('100%') | ||
| 79 | + .height('31lpx') | ||
| 80 | + }.justifyContent(FlexAlign.Start) | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + Stack(){ | ||
| 84 | + Image('') | ||
| 85 | + .width('100%') | ||
| 86 | + .height('100%') | ||
| 87 | + .backgroundColor(Color.White) | ||
| 88 | + .opacity(item.choose?0:0.7) | ||
| 89 | + .borderRadius(5) | ||
| 90 | + } | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + .width('192lpx') | ||
| 94 | + .height('230lpx') | ||
| 95 | + .borderRadius('8lpx') | ||
| 96 | + .onClick(()=>{ | ||
| 97 | + //选择后改变已选择属性 | ||
| 98 | + item.choose = !item.choose | ||
| 99 | + this.interestsArray.splice(index,1,item) | ||
| 100 | + this.selectCount = this.interestsArray.filter(item => item.choose).length | ||
| 101 | + }) | ||
| 102 | + | ||
| 103 | + }) | ||
| 104 | + | ||
| 105 | + } | ||
| 106 | + .width('90%') | ||
| 107 | + .height('70%') | ||
| 108 | + .margin({top:'61lpx'}) | ||
| 109 | + .columnsTemplate('1fr 1fr 1fr') | ||
| 110 | + // .rowsTemplate('1fr 1fr 1fr 1fr') | ||
| 111 | + .columnsGap('23lpx') | ||
| 112 | + .rowsGap('23lpx') | ||
| 113 | + | ||
| 114 | + Stack({alignContent:Alignment.Center}){ | ||
| 115 | + Button(this.selectCount == 0?'选好了':'选好了(' + this.selectCount + ')') | ||
| 116 | + .fontSize('35lpx') | ||
| 117 | + .fontColor('#FFFFFF') | ||
| 118 | + .backgroundColor('#ED2800') | ||
| 119 | + .type(ButtonType.Normal) | ||
| 120 | + .borderRadius('10lpx') | ||
| 121 | + .width('662lpx') | ||
| 122 | + .height('84lpx') | ||
| 123 | + .onClick(()=>{ | ||
| 124 | + //跳转首页 | ||
| 125 | + WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage) | ||
| 126 | + }) | ||
| 127 | + } | ||
| 128 | + .width('100%') | ||
| 129 | + .height('108lpx') | ||
| 130 | + // .position({y:}) | ||
| 131 | + // .margin({bottom:'1',top:'1'}) | ||
| 132 | + .backgroundColor('#FFFFFF') | ||
| 133 | + | ||
| 134 | + } | ||
| 135 | + .width('100%') | ||
| 136 | + .height('100%') | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + | ||
| 140 | + requestInterestsData() { | ||
| 141 | + //请求隐私协议接口 | ||
| 142 | + let interestsModel = new InterestsHobbiesModel() | ||
| 143 | + interestsModel.getInterestsHobbiesData() | ||
| 144 | + .then((value:InterestsList[])=>{ | ||
| 145 | + this.interestsArray = value | ||
| 146 | + }) | ||
| 147 | + .catch((err:Error)=>{ | ||
| 148 | + console.log('获取兴趣偏好数据出错' + err) | ||
| 149 | + }) | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | +} |
| 1 | +import HashMap from '@ohos.util.HashMap'; | ||
| 2 | +import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | ||
| 3 | +import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index'; | ||
| 4 | +import { Logger, SPHelper } from 'wdKit/Index'; | ||
| 5 | +import data from '@ohos.telephony.data'; | ||
| 6 | + | ||
| 7 | + | ||
| 8 | +export interface InterestsBean { | ||
| 9 | + | ||
| 10 | + // code : string | ||
| 11 | + // message : string | ||
| 12 | + // success : boolean | ||
| 13 | + // timestamp : number | ||
| 14 | + data : InterestsList[] | ||
| 15 | + | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | + | ||
| 19 | +export interface InterestsList{ | ||
| 20 | + | ||
| 21 | + id : number | ||
| 22 | + title : string | ||
| 23 | + pic : string | ||
| 24 | + name : string | ||
| 25 | + choose : boolean | ||
| 26 | + | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | + | ||
| 30 | +export class InterestsHobbiesModel { | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + getInterestsHobbiesData() { | ||
| 34 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 35 | + return new Promise<InterestsList[]>((success, fail) => { | ||
| 36 | + HttpRequest.get<ResponseDTO<InterestsList[]>>(HttpUrlUtils.getInterestsUrl(), headers).then((data: ResponseDTO<InterestsList[]>) => { | ||
| 37 | + if (!data || !data.data) { | ||
| 38 | + fail("数据为空") | ||
| 39 | + return | ||
| 40 | + } | ||
| 41 | + if (data.code != 0) { | ||
| 42 | + fail(data.message) | ||
| 43 | + return | ||
| 44 | + } | ||
| 45 | + Logger.debug("InterestsHobbiesModel兴趣偏好数据获取成功:success ", JSON.stringify(data)) | ||
| 46 | + success(data.data); | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + //保存数据 | ||
| 50 | + // for (let i = 0; i < data.data.length; i++) { | ||
| 51 | + // if (data.data[i].type == 1) { | ||
| 52 | + // SPHelper.default.save(SpConstants.USER_PROTOCOL, data.data[i].linkUrl) | ||
| 53 | + // } else if (data.data[i].type == 2) { | ||
| 54 | + // SPHelper.default.save(SpConstants.PRIVATE_PROTOCOL, data.data[i].linkUrl) | ||
| 55 | + // } | ||
| 56 | + // } | ||
| 57 | + | ||
| 58 | + }, (error: Error) => { | ||
| 59 | + Logger.debug("InterestsHobbiesModel兴趣偏好数据获取失败:error ", error.toString()) | ||
| 60 | + fail(error.message) | ||
| 61 | + }) | ||
| 62 | + }) | ||
| 63 | + | ||
| 64 | + | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + | ||
| 68 | +} |
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 11 | "pages/launchPage/LaunchPage", | 11 | "pages/launchPage/LaunchPage", |
| 12 | "pages/launchPage/LaunchAdvertisingPage", | 12 | "pages/launchPage/LaunchAdvertisingPage", |
| 13 | "pages/broadcast/BroadcastPage", | 13 | "pages/broadcast/BroadcastPage", |
| 14 | + "pages/launchPage/LaunchInterestsHobbiesPage", | ||
| 14 | "pages/SpacialTopicPage" | 15 | "pages/SpacialTopicPage" |
| 15 | ] | 16 | ] |
| 16 | } | 17 | } |
-
Please register or login to post a comment