Showing
2 changed files
with
55 additions
and
17 deletions
| 1 | -import { AccountManagerUtils, Logger, DateTimeUtils } from 'wdKit'; | 1 | +import { AccountManagerUtils, Logger, DateTimeUtils, SPHelper } from 'wdKit'; |
| 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 3 | -import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams, | 3 | +import { ContentDetailDTO,postBatchAttentionStatusParams, |
| 4 | PhotoListBean, | 4 | PhotoListBean, |
| 5 | ContentDTO, | 5 | ContentDTO, |
| 6 | RmhInfoDTO, } from 'wdBean'; | 6 | RmhInfoDTO, } from 'wdBean'; |
| 7 | import media from '@ohos.multimedia.media'; | 7 | import media from '@ohos.multimedia.media'; |
| 8 | import { OperRowListView } from './view/OperRowListView'; | 8 | import { OperRowListView } from './view/OperRowListView'; |
| 9 | import { WDPlayerController } from 'wdPlayer/Index'; | 9 | import { WDPlayerController } from 'wdPlayer/Index'; |
| 10 | +import { | ||
| 11 | + batchLikeAndCollectParams, | ||
| 12 | + batchLikeAndCollectResult, | ||
| 13 | + ContentDetailRequest, | ||
| 14 | + contentListParams, | ||
| 15 | + postExecuteCollectRecordParams, | ||
| 16 | + postExecuteLikeParams, | ||
| 17 | + postInteractAccentionOperateParams | ||
| 18 | +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | ||
| 10 | import { ContentConstants } from '../constants/ContentConstants'; | 19 | import { ContentConstants } from '../constants/ContentConstants'; |
| 11 | -import { ProcessUtils } from 'wdRouter'; | 20 | +import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 12 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; | 21 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; |
| 13 | import display from '@ohos.display'; | 22 | import display from '@ohos.display'; |
| 14 | import { BusinessError } from '@ohos.base'; | 23 | import { BusinessError } from '@ohos.base'; |
| 15 | -import { CommonConstants } from 'wdConstant/Index'; | 24 | +import { CommonConstants, SpConstants } from 'wdConstant/Index'; |
| 16 | import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo' | 25 | import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo' |
| 17 | import router from '@ohos.router'; | 26 | import router from '@ohos.router'; |
| 18 | const TAG = 'DynamicDetailComponent' | 27 | const TAG = 'DynamicDetailComponent' |
| @@ -24,20 +33,13 @@ export struct DynamicDetailComponent { | @@ -24,20 +33,13 @@ export struct DynamicDetailComponent { | ||
| 24 | private contentId: string = '' | 33 | private contentId: string = '' |
| 25 | private relType: string = '' | 34 | private relType: string = '' |
| 26 | //出参 fixme 模拟数据用json转换 | 35 | //出参 fixme 模拟数据用json转换 |
| 27 | - @State contentDetailData: ContentDetailDTO = { | ||
| 28 | - publishTime: "2023年03月14日 08:16", | ||
| 29 | - rmhInfo:{rmhHeadUrl:"",rmhName:"人民号名称",rmhDesc:"人民号描述单行展示"}, | ||
| 30 | - newsContent:"优先展示这个内容", | ||
| 31 | - newsSummary:"其次展示这个内容", | ||
| 32 | - newsTitle:"上面两个都没有再展示这个内容", | ||
| 33 | - newsType:15 | ||
| 34 | - } as ContentDetailDTO | 36 | + @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 35 | //变量 | 37 | //变量 |
| 36 | scroller: Scroller = new Scroller(); | 38 | scroller: Scroller = new Scroller(); |
| 37 | /** | 39 | /** |
| 38 | * 默认未关注 点击去关注 | 40 | * 默认未关注 点击去关注 |
| 39 | */ | 41 | */ |
| 40 | - private followStatus: String = '0'; | 42 | + @State followStatus: String = '0'; |
| 41 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 43 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 42 | 44 | ||
| 43 | //跳转 | 45 | //跳转 |
| @@ -130,7 +132,7 @@ export struct DynamicDetailComponent { | @@ -130,7 +132,7 @@ export struct DynamicDetailComponent { | ||
| 130 | .backgroundColor($r('app.color.color_ED2800')) | 132 | .backgroundColor($r('app.color.color_ED2800')) |
| 131 | .fontColor($r('app.color.color_fff')) | 133 | .fontColor($r('app.color.color_fff')) |
| 132 | .onClick(() => { | 134 | .onClick(() => { |
| 133 | - // this.handleAccention(this.item, 1) | 135 | + this.handleAccention() |
| 134 | }) | 136 | }) |
| 135 | } else { | 137 | } else { |
| 136 | Text('已关注') | 138 | Text('已关注') |
| @@ -143,7 +145,7 @@ export struct DynamicDetailComponent { | @@ -143,7 +145,7 @@ export struct DynamicDetailComponent { | ||
| 143 | .borderColor($r('app.color.color_CCCCCC')) | 145 | .borderColor($r('app.color.color_CCCCCC')) |
| 144 | .fontColor($r('app.color.color_CCCCCC')) | 146 | .fontColor($r('app.color.color_CCCCCC')) |
| 145 | .onClick(() => { | 147 | .onClick(() => { |
| 146 | - // this.handleAccention(this.item, 0) | 148 | + this.handleAccention() |
| 147 | }) | 149 | }) |
| 148 | } | 150 | } |
| 149 | } | 151 | } |
| @@ -224,6 +226,9 @@ export struct DynamicDetailComponent { | @@ -224,6 +226,9 @@ export struct DynamicDetailComponent { | ||
| 224 | item.height = callback?.height || 0; | 226 | item.height = callback?.height || 0; |
| 225 | }) | 227 | }) |
| 226 | } | 228 | } |
| 229 | + .onClick((event: ClickEvent) => { | ||
| 230 | + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) | ||
| 231 | + }) | ||
| 227 | } | 232 | } |
| 228 | } else if (this.contentDetailData.photoList.length === 4) { | 233 | } else if (this.contentDetailData.photoList.length === 4) { |
| 229 | GridCol({ | 234 | GridCol({ |
| @@ -233,6 +238,9 @@ export struct DynamicDetailComponent { | @@ -233,6 +238,9 @@ export struct DynamicDetailComponent { | ||
| 233 | .aspectRatio(1) | 238 | .aspectRatio(1) |
| 234 | .borderRadius(this.caclImageRadius(index)) | 239 | .borderRadius(this.caclImageRadius(index)) |
| 235 | } | 240 | } |
| 241 | + .onClick((event: ClickEvent) => { | ||
| 242 | + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) | ||
| 243 | + }) | ||
| 236 | } else { | 244 | } else { |
| 237 | GridCol({ | 245 | GridCol({ |
| 238 | span: { sm: 4, lg: 3 } | 246 | span: { sm: 4, lg: 3 } |
| @@ -241,6 +249,9 @@ export struct DynamicDetailComponent { | @@ -241,6 +249,9 @@ export struct DynamicDetailComponent { | ||
| 241 | .aspectRatio(1) | 249 | .aspectRatio(1) |
| 242 | .borderRadius(this.caclImageRadius(index)) | 250 | .borderRadius(this.caclImageRadius(index)) |
| 243 | } | 251 | } |
| 252 | + .onClick((event: ClickEvent) => { | ||
| 253 | + ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList) | ||
| 254 | + }) | ||
| 244 | } | 255 | } |
| 245 | }) | 256 | }) |
| 246 | } | 257 | } |
| @@ -414,7 +425,7 @@ export struct DynamicDetailComponent { | @@ -414,7 +425,7 @@ export struct DynamicDetailComponent { | ||
| 414 | console.error(TAG, JSON.stringify(this.contentDetailData)) | 425 | console.error(TAG, JSON.stringify(this.contentDetailData)) |
| 415 | let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) | 426 | let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) |
| 416 | console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) | 427 | console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) |
| 417 | - this.newsStatusOfUser = data[0]; | 428 | + // this.newsStatusOfUser = data[0]; |
| 418 | Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) | 429 | Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) |
| 419 | } catch (exception) { | 430 | } catch (exception) { |
| 420 | console.error(TAG, JSON.stringify(exception)) | 431 | console.error(TAG, JSON.stringify(exception)) |
| @@ -486,6 +497,33 @@ export struct DynamicDetailComponent { | @@ -486,6 +497,33 @@ export struct DynamicDetailComponent { | ||
| 486 | return 3; //普通图 | 497 | return 3; //普通图 |
| 487 | } | 498 | } |
| 488 | } | 499 | } |
| 500 | + | ||
| 501 | + /** | ||
| 502 | + * 关注号主 | ||
| 503 | + */ | ||
| 504 | + async handleAccention() { | ||
| 505 | + // 未登录,跳转登录 | ||
| 506 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 507 | + if (!user_id) { | ||
| 508 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 509 | + return | ||
| 510 | + } | ||
| 511 | + | ||
| 512 | + const params2: postInteractAccentionOperateParams = { | ||
| 513 | + attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | ||
| 514 | + attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id | ||
| 515 | + attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id | ||
| 516 | + status: this.followStatus == '0'? 1:0, | ||
| 517 | + } | ||
| 518 | + ContentDetailRequest.postInteractAccentionOperate(params2).then(res => { | ||
| 519 | + console.log('关注号主==', JSON.stringify(res.data)) | ||
| 520 | + if (this.followStatus == '1') { | ||
| 521 | + this.followStatus = '0' | ||
| 522 | + } else { | ||
| 523 | + this.followStatus = '1' | ||
| 524 | + } | ||
| 525 | + }) | ||
| 526 | + } | ||
| 489 | } | 527 | } |
| 490 | 528 | ||
| 491 | interface radiusType { | 529 | interface radiusType { |
| @@ -13,7 +13,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; | @@ -13,7 +13,7 @@ import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 13 | import { WDPlayerController } from 'wdPlayer/Index'; | 13 | import { WDPlayerController } from 'wdPlayer/Index'; |
| 14 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 14 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 15 | import { SpConstants } from 'wdConstant/Index' | 15 | import { SpConstants } from 'wdConstant/Index' |
| 16 | - | 16 | +//视频点播页右侧操作栏:点赞/收藏/评论/分享 竖着排列 |
| 17 | export interface OperationItem { | 17 | export interface OperationItem { |
| 18 | icon: Resource; | 18 | icon: Resource; |
| 19 | icon_check?: Resource; | 19 | icon_check?: Resource; |
-
Please register or login to post a comment