yuzhilin

推荐列表

@@ -210,6 +210,10 @@ export class HttpUrlUtils { @@ -210,6 +210,10 @@ export class HttpUrlUtils {
210 * */ 210 * */
211 static readonly DAILY_PAPER_TOPIC: string = "/api/rmrb-bff-display-zh/display/zh/c/dailyPaperTopic"; 211 static readonly DAILY_PAPER_TOPIC: string = "/api/rmrb-bff-display-zh/display/zh/c/dailyPaperTopic";
212 private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; 212 private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT;
  213 + /**
  214 + * 推荐列表
  215 + */
  216 + static readonly RECOMMEND_LIST: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list";
213 217
214 public static set hostUrl(value: string) { 218 public static set hostUrl(value: string) {
215 HttpUrlUtils._hostUrl = value; 219 HttpUrlUtils._hostUrl = value;
@@ -12,7 +12,7 @@ const TAG = 'WdWebComponent'; @@ -12,7 +12,7 @@ const TAG = 'WdWebComponent';
12 export struct WdWebComponent { 12 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 | Resource = ConfigConstants.DETAIL_URL
16 /** 16 /**
17 * 对外暴露webview的回调,能力 17 * 对外暴露webview的回调,能力
18 */ 18 */
@@ -34,7 +34,8 @@ export { @@ -34,7 +34,8 @@ export {
34 postExecuteLikeParams, 34 postExecuteLikeParams,
35 postExecuteCollectRecordParams, 35 postExecuteCollectRecordParams,
36 contentListParams, 36 contentListParams,
37 - postInteractAccentionOperateParams 37 + postInteractAccentionOperateParams,
  38 + postRecommendListParams
38 } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO'; 39 } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO';
39 40
40 export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam'; 41 export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam';
@@ -177,4 +177,14 @@ export interface postInteractAccentionOperateParams { @@ -177,4 +177,14 @@ export interface postInteractAccentionOperateParams {
177 // userType: number; 177 // userType: number;
178 // userId: string; 178 // userId: string;
179 status: number; 179 status: number;
  180 +}
  181 +
  182 +export interface postRecommendListParams {
  183 + imei: string;
  184 + userId ?: string;
  185 + contentId ?: string;
  186 + relId ?: string;
  187 + contentType ?: number;
  188 + recType: number;
  189 + channelId ? : string
180 } 190 }
1 -import { Action, ContentDetailDTO } from 'wdBean'; 1 +import { Logger, NumberFormatterUtils } from 'wdKit';
  2 +import {
  3 + Action,
  4 + ContentDetailDTO,
  5 + ContentDTO,
  6 + postRecommendListParams,
  7 + postExecuteLikeParams,
  8 + batchLikeAndCollectResult,
  9 + batchLikeAndCollectParams,
  10 + InteractDataDTO,
  11 + contentListParams,
  12 +} from 'wdBean';
2 import DetailViewModel from '../viewmodel/DetailViewModel'; 13 import DetailViewModel from '../viewmodel/DetailViewModel';
3 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; 14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
4 import router from '@ohos.router'; 15 import router from '@ohos.router';
  16 +import { RecommendList } from '../components/view/RecommendList'
  17 +import { CommonConstants } from 'wdConstant'
  18 +import { HttpUrlUtils } from 'wdNetwork/Index';
  19 +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  20 +import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
  21 +import { PageRepository } from '../repository/PageRepository';
  22 +
  23 +const TAG = 'ImageAndTextPageComponent'
  24 +
  25 +export interface OperationItem {
  26 + icon: Resource;
  27 + icon_check?: Resource;
  28 + text: string | Resource;
  29 + num?: number; // 个数
  30 +}
5 31
6 @Component 32 @Component
7 export struct ImageAndTextPageComponent { 33 export struct ImageAndTextPageComponent {
8 scroller: Scroller = new Scroller(); 34 scroller: Scroller = new Scroller();
9 action: Action = {} as Action 35 action: Action = {} as Action
10 - @State detailData: ContentDetailDTO = {} as ContentDetailDTO 36 + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
  37 + @State recommendList: ContentDTO[] = []
  38 + @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
  39 + @State interactData: InteractDataDTO = {} as InteractDataDTO
  40 + @State operationList: OperationItem[] = [
  41 + {
  42 + icon: $r('app.media.ic_comment'),
  43 + text: "评论",
  44 + },
  45 + {
  46 + icon: $r('app.media.ic_like_uncheck'),
  47 + icon_check: $r('app.media.ic_like_check'),
  48 + text: "点赞",
  49 + },
  50 + {
  51 + icon: $r('app.media.ic_collect_uncheck'),
  52 + icon_check: $r('app.media.ic_collect_check'),
  53 + text: "收藏",
  54 + },
  55 + {
  56 + icon: $r('app.media.ic_share'),
  57 + text: "分享"
  58 + }
  59 + ]
11 60
12 build() { 61 build() {
13 - RelativeContainer() {  
14 - RelativeContainer() {  
15 - Text(this.detailData?.publishTime)  
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 -  
22 - Image($r('app.media.icon_ren_min_ri_bao'))  
23 - .width(70)  
24 - .height(28)  
25 - .alignRules({ left: { anchor: "__container__", align: HorizontalAlign.Start },  
26 - center: { anchor: "__container__", align: VerticalAlign.Center } })  
27 - }  
28 - .height(32)  
29 - .width('100%')  
30 - .id('image_text_detail_top')  
31 - .alignRules({ top: { anchor: "__container__", align: VerticalAlign.Top } })  
32 - .visibility(Visibility.None)  
33 -  
34 - Image($r('app.media.line'))  
35 - .width('100%')  
36 - .height(6)  
37 - .objectFit(ImageFit.Contain)  
38 - .id('image_text_detail_top_line')  
39 - .alignRules({ top: { anchor: "image_text_detail_top", align: VerticalAlign.Bottom } })  
40 - .margin({ top: 10 })  
41 - .visibility(Visibility.Hidden)  
42 -  
43 - RelativeContainer() {  
44 - Image($r('app.media.icon_arrow_left'))  
45 - .width(24)  
46 - .height(24)  
47 - .id('back')  
48 - .alignRules({ left: { anchor: "__container__", align: HorizontalAlign.Start },  
49 - center: { anchor: "__container__", align: VerticalAlign.Center } })  
50 - .onClick((event: ClickEvent) => {  
51 - router.back()  
52 - })  
53 -  
54 - Image($r('app.media.icon_forward'))  
55 - .width(24)  
56 - .height(24)  
57 - .id('forward')  
58 - .alignRules({ right: { anchor: "__container__", align: HorizontalAlign.End },  
59 - center: { anchor: "back", align: VerticalAlign.Center } })  
60 -  
61 - Image($r('app.media.icon_listen'))  
62 - .width(24)  
63 - .height(24)  
64 - .margin({ right: 24 })  
65 - .id('listen')  
66 - .alignRules({ right: { anchor: "forward", align: HorizontalAlign.Start },  
67 - center: { anchor: "back", align: VerticalAlign.Center } })  
68 -  
69 - Image($r('app.media.icon_star'))  
70 - .width(24)  
71 - .height(24)  
72 - .margin({ right: 24 })  
73 - .id('star')  
74 - .alignRules({ right: { anchor: "listen", align: HorizontalAlign.Start },  
75 - center: { anchor: "back", align: VerticalAlign.Center } })  
76 -  
77 - Image($r('app.media.icon_comment'))  
78 - .width(24)  
79 - .height(24)  
80 - .margin({ right: 24 })  
81 - .id('comment')  
82 - .alignRules({ right: { anchor: "star", align: HorizontalAlign.Start },  
83 - center: { anchor: "back", align: VerticalAlign.Center } }) 62 + Column() {
  63 + Column() {
  64 + // 发布时间
  65 + // Row() {
  66 + // Image($r('app.media.icon_ren_min_ri_bao'))
  67 + // .width(70)
  68 + // .height(28)
  69 + // Text(this.contentDetailData.publishTime)
  70 + // .fontColor($r('app.color.color_B0B0B0'))
  71 + // .fontSize($r('app.float.font_size_13'))
  72 + // .height('100%')
  73 + // .align(Alignment.End)
  74 + // }
  75 + // .width(CommonConstants.FULL_WIDTH)
  76 + // .height(32)
  77 + // .padding({ left: 15, right: 15, })
  78 + // .justifyContent(FlexAlign.SpaceBetween)
  79 + // .backgroundColor(Color.White)
  80 + // Row() {
  81 + // Image($r('app.media.line'))
  82 + // .width('100%')
  83 + // .height(6)
  84 + // .objectFit(ImageFit.Cover)
  85 + // .margin({ top: 10 })
  86 + // }
  87 + // .padding({ left: 15, right: 15, })
  88 + // .backgroundColor(Color.White)
84 89
85 - }  
86 - .width('100%')  
87 - .height(56)  
88 - .id('image_text_detail_bottom')  
89 - .alignRules({ bottom: { anchor: "__container__", align: VerticalAlign.Bottom } })  
90 90
91 - Column() {  
92 - ImageAndTextWebComponent({ detailData: this.detailData, action: this.action })  
93 - }  
94 - .width('100%')  
95 - .alignRules({ top: { anchor: "image_text_detail_top_line", align: VerticalAlign.Bottom },  
96 - bottom: { anchor: "image_text_detail_bottom", align: VerticalAlign.Top } })  
97 - .id('image_text_detail_content') 91 + Stack({ alignContent: Alignment.Bottom }) {
  92 + List() {
  93 + //详情展示区
  94 + ListItem() {
  95 + Column() {
  96 + ImageAndTextWebComponent({ contentDetailData: this.contentDetailData, action: this.action })
  97 + }.width(CommonConstants.FULL_WIDTH)
  98 + .height(CommonConstants.FULL_HEIGHT)
  99 + }
  100 + .backgroundColor(Color.White)
98 101
99 - }  
100 - .width('100%')  
101 - .height('100%')  
102 - .padding({ left: 16, right: 16 })  
103 - .backgroundColor(Color.White) 102 + // if (this.contentDetailData.openLikes === 1) {
  103 + // ListItem() {
  104 + // // 点赞
  105 + // Row() {
  106 + // Row() {
  107 + // if (this.newsStatusOfUser?.likeStatus === '1') {
  108 + // Image(this.contentDetailData.likesStyle === 1 ? $r('app.media.ic_like_check') : (this.contentDetailData.likesStyle === 2 ? $r('app.media.icon_prayer_active') : $r('app.media.icon_candle_active')))
  109 + // .width(24)
  110 + // .height(24)
  111 + // .margin({ right: 5 })
  112 + // } else {
  113 + // Image(this.contentDetailData.likesStyle === 1 ? $r('app.media.icon_like') : (this.contentDetailData.likesStyle === 2 ? $r('app.media.icon_prayer') : $r('app.media.icon_candle')))
  114 + // .width(24)
  115 + // .height(24)
  116 + // .margin({ right: 5 })
  117 + // }
  118 + // Text(`${this.interactData?.likeNum || 0}`)
  119 + // .fontSize(16)
  120 + // .fontColor(this.newsStatusOfUser?.likeStatus === '1' ? '#ED2800' : '#999999')
  121 + // .fontWeight(500)
  122 + // }.alignItems(VerticalAlign.Center)
  123 + // .onClick(() => {
  124 + // this.toggleLikeStatus()
  125 + // })
  126 + //
  127 + // }.width(CommonConstants.FULL_WIDTH).height(80)
  128 + // .justifyContent(FlexAlign.Center)
  129 + // }
  130 + // .backgroundColor(Color.White)
  131 + // .margin({ bottom: 5 })
  132 + // }
  133 +
  134 + //相关推荐区
  135 + // ListItem() {
  136 + // RecommendList({ recommendList: this.recommendList })
  137 + // }
  138 + // .backgroundColor(Color.White)
  139 + }
  140 + .width(CommonConstants.FULL_WIDTH)
  141 + .height(CommonConstants.FULL_HEIGHT)
  142 + .padding({ bottom: 56 })
  143 + .scrollBar(BarState.Off)
  144 + .edgeEffect(EdgeEffect.None)
  145 +
  146 + //底部交互区
  147 + Row() {
  148 + Image($r('app.media.icon_arrow_left'))
  149 + .width(24)
  150 + .height(24)
  151 + .onClick((event: ClickEvent) => {
  152 + router.back()
  153 + })
  154 +
  155 + Row() {
  156 + Image($r('app.media.icon_comment'))
  157 + .width(24)
  158 + .height(24)
  159 + .margin({ right: 24 })
  160 + .id('comment')
  161 +
  162 + Image($r('app.media.icon_star'))
  163 + .width(24)
  164 + .height(24)
  165 + .margin({ right: 24 })
  166 +
  167 + Image($r('app.media.icon_listen'))
  168 + .width(24)
  169 + .height(24)
  170 + .margin({ right: 24 })
  171 +
  172 + Image($r('app.media.icon_forward'))
  173 + .width(24)
  174 + .height(24)
  175 +
  176 + }
  177 + }
  178 + .width(CommonConstants.FULL_WIDTH)
  179 + .height(56)
  180 + .backgroundColor(Color.White)
  181 + .padding({ left: 15, right: 15, })
  182 + .justifyContent(FlexAlign.SpaceBetween)
  183 + }
  184 + }.backgroundColor("#f5f5f5")
  185 + }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
104 } 186 }
105 187
106 - async aboutToAppear() { 188 + private async getDetail() {
107 let contentId: string = '' 189 let contentId: string = ''
108 let relId: string = '' 190 let relId: string = ''
109 let relType: string = '' 191 let relType: string = ''
@@ -122,14 +204,106 @@ export struct ImageAndTextPageComponent { @@ -122,14 +204,106 @@ export struct ImageAndTextPageComponent {
122 } 204 }
123 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) 205 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
124 if (detailBeans && detailBeans.length > 0) { 206 if (detailBeans && detailBeans.length > 0) {
125 - this.detailData = detailBeans[0]; 207 + this.contentDetailData = detailBeans[0];
  208 + //TODO
  209 + // if (this.contentDetailData.recommendShow === 1) {
  210 + // this.getRecommend()
  211 + // }
  212 + // if (this.contentDetailData.openLikes === 1) {
  213 + // this.getInteractDataStatus()
  214 + // this.queryContentInteractCount()
  215 + // }
  216 + }
  217 + }
  218 + }
  219 +
  220 + private async getRecommend() {
  221 + let params: postRecommendListParams = {
  222 + imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e",
  223 + userId: HttpUrlUtils.getUserId(),
  224 + contentId: String(this.contentDetailData.newsId),
  225 + recType: 1,
  226 + contentType: this.contentDetailData.newsType,
  227 + relId: this.contentDetailData?.reLInfo?.relId,
  228 + channelId: String(this.contentDetailData?.reLInfo?.channelId)
  229 + }
  230 + let recommendList = await DetailViewModel.postRecommendList(params)
  231 + if (recommendList && recommendList.length > 0) {
  232 + this.recommendList = recommendList;
  233 + }
  234 + }
  235 +
  236 + // 已登录->查询用户对作品点赞、收藏状态
  237 + private async getInteractDataStatus() {
  238 + try {
  239 + const params: batchLikeAndCollectParams = {
  240 + contentList: [
  241 + {
  242 + contentId: this.contentDetailData?.newsId + '',
  243 + contentType: this.contentDetailData?.newsType + '',
  244 + }
  245 + ]
  246 + }
  247 + console.error(TAG, JSON.stringify(this.contentDetailData))
  248 + let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
  249 + console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
  250 + this.newsStatusOfUser = data[0];
  251 + Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
  252 + } catch (exception) {
  253 + console.error(TAG, JSON.stringify(exception))
  254 + }
  255 + }
  256 +
  257 + /**
  258 + * 点赞、取消点赞
  259 + */
  260 + toggleLikeStatus() {
  261 + // 未登录,跳转登录
  262 + if (!HttpUrlUtils.getUserId()) {
  263 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  264 + return
  265 + }
  266 + const params: postExecuteLikeParams = {
  267 + status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1',
  268 + contentId: this.contentDetailData?.newsId + '',
  269 + contentType: this.contentDetailData?.newsType + '',
  270 + }
  271 + PageRepository.postExecuteLike(params).then(res => {
  272 + console.log(TAG, '点赞、取消点赞', 'toggleLikeStatus==',)
  273 + if (this.newsStatusOfUser) {
  274 + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
  275 + this.queryContentInteractCount()
126 } 276 }
127 277
  278 + })
  279 + }
  280 +
  281 + /**
  282 + * 查询点赞、收藏数量
  283 + */
  284 + queryContentInteractCount() {
  285 + console.error(TAG, 'contentDetailData2222', JSON.stringify(this.contentDetailData))
  286 + const params: contentListParams = {
  287 + contentList: [{
  288 + contentId: this.contentDetailData?.newsId + '',
  289 + contentType: this.contentDetailData?.newsType,
  290 + }]
128 } 291 }
  292 + PageRepository.getContentInteract(params).then(res => {
  293 + if (res.data) {
  294 + this.interactData.likeNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.likeNum)
  295 + this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum)
  296 + this.interactData.commentNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.commentNum)
  297 + }
  298 + console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res))
  299 + console.log(TAG, 'this.interactData', JSON.stringify(this.interactData))
  300 + })
  301 + }
129 302
  303 + aboutToAppear() {
  304 + this.getDetail()
130 } 305 }
131 306
132 aboutToDisappear() { 307 aboutToDisappear() {
133 -  
134 } 308 }
135 } 309 }
@@ -8,14 +8,12 @@ import { @@ -8,14 +8,12 @@ import {
8 } from 'wdBean'; 8 } from 'wdBean';
9 import { Logger } from 'wdKit'; 9 import { Logger } from 'wdKit';
10 import { WdWebComponent, WdWebLocalComponent } from 'wdWebComponent'; 10 import { WdWebComponent, WdWebLocalComponent } from 'wdWebComponent';
11 -import { BridgeWebViewControl } from '../../../../../../commons/wdWebComponent/oh_modules/wdJsBridge/Index';  
12 11
13 @Component 12 @Component
14 export struct ImageAndTextWebComponent { 13 export struct ImageAndTextWebComponent {
15 - webviewControl: BridgeWebViewControl = new BridgeWebViewControl()  
16 action: Action = {} as Action 14 action: Action = {} as Action
17 @State reload: number = 0; 15 @State reload: number = 0;
18 - @Prop @Watch('onDetailDataUpdated') detailData: ContentDetailDTO = {} as ContentDetailDTO 16 + @Prop @Watch('onDetailDataUpdated') contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
19 17
20 onDetailDataUpdated() { 18 onDetailDataUpdated() {
21 // if (this.action) { 19 // if (this.action) {
@@ -77,10 +75,10 @@ export struct ImageAndTextWebComponent { @@ -77,10 +75,10 @@ export struct ImageAndTextWebComponent {
77 75
78 build() { 76 build() {
79 Column() { 77 Column() {
80 - if (this.detailData && this.detailData.shareInfo && this.detailData.shareInfo.shareUrl){ 78 + if (this.contentDetailData && this.contentDetailData.shareInfo && this.contentDetailData.shareInfo.shareUrl){
81 WdWebComponent({ 79 WdWebComponent({
82 - webviewControl: this.webviewControl,  
83 - webUrl: this.detailData?.shareInfo?.shareUrl, 80 + webUrl: this.contentDetailData?.shareInfo?.shareUrl,
  81 + // webUrl: $rawfile('apph5/index.html'),
84 backVisibility: false, 82 backVisibility: false,
85 }) 83 })
86 } 84 }
@@ -287,15 +287,18 @@ struct ChannelDialog { @@ -287,15 +287,18 @@ struct ChannelDialog {
287 .height('100%') 287 .height('100%')
288 .justifyContent(FlexAlign.Center) 288 .justifyContent(FlexAlign.Center)
289 .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') 289 .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
290 - .onClick(() => {  
291 - if (this.isEditIng) {  
292 - if (item.delPermitted === 1) {  
293 - this.delChannelItem(index)  
294 - }  
295 - } else {  
296 - this.confirm(index)  
297 - this.controller?.close()  
298 - } 290 + .onTouch((event?: TouchEvent) => {
  291 + if(event&&event.type === TouchType.Down){
  292 + console.log('onTouch')
  293 + if (this.isEditIng) {
  294 + if (item.delPermitted === 1) {
  295 + this.delChannelItem(index)
  296 + }
  297 + } else {
  298 + this.confirm(index)
  299 + this.controller?.close()
  300 + }
  301 + }
299 }) 302 })
300 } 303 }
301 .width('23%') 304 .width('23%')
  1 +import { ContentDTO } from 'wdBean';
  2 +import { CommonConstants } from 'wdConstant';
  3 +import { Card3Component } from '../cardview/Card3Component'
  4 +import { Card6Component } from '../cardview/Card6Component'
  5 +
  6 +const RECOMMEND_LIST_TITLE = '相关推荐'
  7 +
  8 +@Component
  9 +export struct RecommendList {
  10 + @Prop recommendList: ContentDTO[] = [] as ContentDTO []
  11 +
  12 + build() {
  13 + Column() {
  14 + if (this.recommendList.length > 0) {
  15 + Row() {
  16 + Image($r("app.media.redLine"))
  17 + .width(3)
  18 + .height(16)
  19 + .margin({ right: 4 })
  20 + Text(RECOMMEND_LIST_TITLE)
  21 + .width(CommonConstants.FULL_PARENT)
  22 + .fontSize($r('app.float.normal_text_size'))
  23 + .fontWeight(FontWeight.Bold)
  24 + .maxLines(1)
  25 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
  26 + }
  27 + .padding({ top: 15, left: 15, right: 15 })
  28 + .width(CommonConstants.FULL_PARENT)
  29 + .justifyContent(FlexAlign.Start)
  30 + }
  31 + ForEach(this.recommendList, (item: ContentDTO, index: number) => {
  32 + if (item.coverUrl) {
  33 + Card6Component({ contentDTO: item })
  34 + } else {
  35 + Card3Component({ contentDTO: item })
  36 + }
  37 + }, (item: ContentDTO) => JSON.stringify(item))
  38 + }.width('100%')
  39 + }
  40 +}
@@ -17,7 +17,9 @@ import { @@ -17,7 +17,9 @@ import {
17 postBatchAttentionStatusResult, 17 postBatchAttentionStatusResult,
18 postExecuteCollectRecordParams, 18 postExecuteCollectRecordParams,
19 postExecuteLikeParams, 19 postExecuteLikeParams,
20 - postInteractAccentionOperateParams 20 + postInteractAccentionOperateParams,
  21 + postRecommendListParams,
  22 + ContentDTO
21 } from 'wdBean'; 23 } from 'wdBean';
22 24
23 const TAG = 'HttpRequest'; 25 const TAG = 'HttpRequest';
@@ -325,4 +327,17 @@ export class PageRepository { @@ -325,4 +327,17 @@ export class PageRepository {
325 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 327 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
326 return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers) 328 return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers)
327 }; 329 };
  330 +
  331 + /**
  332 + * 获取推荐列表
  333 + * https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/recommend/zh/c/list
  334 + * @param params
  335 + * @returns
  336 + * */
  337 + static postRecommendList(params:postRecommendListParams){
  338 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.RECOMMEND_LIST
  339 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  340 + Logger.info(TAG, "postRecommendList url = " + url + JSON.stringify(params))
  341 + return WDHttp.post<ResponseDTO<ContentDTO[]>>(url, params, headers)
  342 + };
328 } 343 }
1 -import { ContentDetailDTO } from 'wdBean'; 1 +import { ContentDetailDTO, ContentDTO, postRecommendListParams } from 'wdBean';
2 import { Logger, StringUtils } from 'wdKit'; 2 import { Logger, StringUtils } from 'wdKit';
3 import { ResponseDTO, } from 'wdNetwork'; 3 import { ResponseDTO, } from 'wdNetwork';
4 import { PageRepository } from '../repository/PageRepository'; 4 import { PageRepository } from '../repository/PageRepository';
@@ -19,7 +19,7 @@ export class DetailViewModel extends BaseViewModel { @@ -19,7 +19,7 @@ export class DetailViewModel extends BaseViewModel {
19 * 例:https://pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500000008738&contentId=30001373964&relType=1 19 * 例:https://pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500000008738&contentId=30001373964&relType=1
20 * @return {string} resDTO.data 20 * @return {string} resDTO.data
21 */ 21 */
22 - getDetailPageData(relId: string, contentId: string, relType: string): Promise<ContentDetailDTO[]> { 22 + getDetailPageData(relId: string, contentId: string, relType: string): Promise<ContentDetailDTO[]> {
23 Logger.debug(TAG, 'getDetailPageData contentId: ' + contentId); 23 Logger.debug(TAG, 'getDetailPageData contentId: ' + contentId);
24 return new Promise<ContentDetailDTO[]>((success, error) => { 24 return new Promise<ContentDetailDTO[]>((success, error) => {
25 PageRepository.fetchDetailData(relId, contentId, relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => { 25 PageRepository.fetchDetailData(relId, contentId, relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => {
@@ -42,6 +42,40 @@ export class DetailViewModel extends BaseViewModel { @@ -42,6 +42,40 @@ export class DetailViewModel extends BaseViewModel {
42 }) 42 })
43 } 43 }
44 44
  45 + /**
  46 + * 获取推荐列表
  47 + * @return {string} resDTO.data
  48 + * @param imei
  49 + * @param relType
  50 + * @param contentId
  51 + * @param userId
  52 + * @param relId
  53 + * @param contentType
  54 + * @returns
  55 + */
  56 + postRecommendList(params: postRecommendListParams): Promise<ContentDTO[]> {
  57 + Logger.debug(TAG, 'postRecommendList contentId: ' + params.contentId);
  58 + return new Promise((success, error) => {
  59 + PageRepository.postRecommendList(params).then((resDTO: ResponseDTO<ContentDTO[]>) => {
  60 + if (!resDTO || !resDTO.data) {
  61 + Logger.error(TAG, 'postRecommendList then resDTO is empty');
  62 + error('resDTO is empty');
  63 + return
  64 + }
  65 + if (resDTO.code != 0) {
  66 + Logger.error(TAG, `postRecommendList then code:${resDTO.code}, message:${resDTO.message}`);
  67 + error('resDTO Response Code is failure');
  68 + return
  69 + }
  70 + Logger.info(TAG, "postRecommendList then,resDTO.timeStamp:" + resDTO.timestamp);
  71 + success(resDTO.data);
  72 + }).catch((err: Error) => {
  73 + Logger.error(TAG, `postRecommendList catch, error.name : ${err.name}, error.message:${err.message}`);
  74 + error(err);
  75 + })
  76 + })
  77 + }
  78 +
45 private dataTranslate(json: string): ContentDetailDTO | null { 79 private dataTranslate(json: string): ContentDetailDTO | null {
46 if (StringUtils.isEmpty(json)) { 80 if (StringUtils.isEmpty(json)) {
47 return null; 81 return null;