王士厅

多图(图集)详情页(人民号)关注增加部分代码

@@ -33,7 +33,8 @@ export { @@ -33,7 +33,8 @@ export {
33 batchLikeAndCollectResult, 33 batchLikeAndCollectResult,
34 postExecuteLikeParams, 34 postExecuteLikeParams,
35 postExecuteCollectRecordParams, 35 postExecuteCollectRecordParams,
36 - contentListParams 36 + contentListParams,
  37 + postInteractAccentionOperateParams
37 } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO'; 38 } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO';
38 39
39 export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam'; 40 export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam';
@@ -167,4 +167,14 @@ interface contentListItem { @@ -167,4 +167,14 @@ interface contentListItem {
167 167
168 export interface contentListParams { 168 export interface contentListParams {
169 contentList: contentListItem[]; 169 contentList: contentListItem[];
  170 +}
  171 +
  172 +export interface postInteractAccentionOperateParams {
  173 + attentionUserType: string;
  174 + attentionUserId: string;
  175 + attentionCreatorId: string;
  176 +
  177 + // userType: number;
  178 + // userId: string;
  179 + status: number;
170 } 180 }
1 import { Logger } from 'wdKit'; 1 import { Logger } from 'wdKit';
2 -import { ContentDetailDTO, PhotoListBean, postInteractBrowsOperateParams, postBatchAttentionStatusParams } from 'wdBean'; 2 +import {
  3 + ContentDetailDTO,
  4 + PhotoListBean,
  5 + postInteractBrowsOperateParams,
  6 + postBatchAttentionStatusParams,
  7 + postInteractAccentionOperateParams
  8 +} from 'wdBean';
3 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 9 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
4 import display from '@ohos.display'; 10 import display from '@ohos.display';
5 import font from '@ohos.font'; 11 import font from '@ohos.font';
@@ -7,6 +13,8 @@ import { OperRowListView } from './view/OperRowListView'; @@ -7,6 +13,8 @@ import { OperRowListView } from './view/OperRowListView';
7 import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; 13 import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent';
8 import { DateTimeUtils } from 'wdKit/Index'; 14 import { DateTimeUtils } from 'wdKit/Index';
9 import { HttpUrlUtils } from 'wdNetwork/Index'; 15 import { HttpUrlUtils } from 'wdNetwork/Index';
  16 +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  17 +import { PageRepository } from '../repository/PageRepository';
10 18
11 const TAG = 'MultiPictureDetailPageComponent'; 19 const TAG = 'MultiPictureDetailPageComponent';
12 20
@@ -80,6 +88,84 @@ export struct MultiPictureDetailPageComponent { @@ -80,6 +88,84 @@ export struct MultiPictureDetailPageComponent {
80 .onChange((index: number) => { 88 .onChange((index: number) => {
81 this.swiperIndex = index 89 this.swiperIndex = index
82 }) 90 })
  91 + if(this.contentDetailData.rmhPlatform == 1) {
  92 + Row() {
  93 + Row(){
  94 + Row({space: 8}) {
  95 + Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)
  96 + .borderRadius('50%')
  97 + .alt($r('app.media.picture_loading'))
  98 + .width(36)
  99 + .height(36)
  100 + .objectFit(ImageFit.Fill)
  101 + .interpolation(ImageInterpolation.High)
  102 + }
  103 + .width('13%')
  104 + .height('100%')
  105 + Row() {
  106 + Flex({
  107 + direction: FlexDirection.Column,
  108 + justifyContent: FlexAlign.Start
  109 + }) {
  110 + Text(`${this.contentDetailData?.rmhInfo?.rmhName}`)
  111 + .fontColor(Color.White)
  112 + .fontSize(14)
  113 + .fontFamily('PingFang PingFang SC-Medium')
  114 + .fontWeight(500)
  115 + .lineHeight(17)
  116 + .margin(0)
  117 + Text(`${this.contentDetailData?.rmhInfo?.rmhDesc}`)
  118 + .fontColor('#676767')
  119 + .fontSize(12)
  120 + .fontFamily('PingFang SC-Regular')
  121 + .fontWeight(400)
  122 + .lineHeight(14)
  123 + .textOverflow({ overflow: TextOverflow.Clip })
  124 + .margin (0)
  125 + }
  126 + }
  127 + .width('81%')
  128 + .height('100%')
  129 + }
  130 + .width('74.4%')
  131 + .height('100%')
  132 + .margin({
  133 + top: 0,
  134 + bottom: 0,
  135 + left: 16,
  136 + right:0
  137 + })
  138 + if(this.followStatus == '0') {
  139 + Row(){
  140 + Button('+关注', { type: ButtonType.Normal, stateEffect: true })
  141 + .borderRadius(4)
  142 + .backgroundColor('#ED2800')
  143 + .width(48)
  144 + .height(24)
  145 + .onClick(() => {
  146 + this.handleAccention()
  147 + })
  148 + .margin({
  149 + top: 10,
  150 + bottom: 10,
  151 + left: 16,
  152 + right:16
  153 + })
  154 + .fontSize(12)
  155 + .fontColor(Color.White)
  156 + }
  157 + .width('21.6%')
  158 + .height('100%')
  159 + }
  160 + }
  161 + .width('100%')
  162 + .height(44)
  163 + .alignRules({
  164 + top: { anchor: "e_swiper_content", align: VerticalAlign.Top },
  165 + middle: { anchor: "e_swiper_content", align: HorizontalAlign.Center }
  166 + })
  167 + .id('e_attention')
  168 + }
83 169
84 OperRowListView({ 170 OperRowListView({
85 contentDetailData: this.contentDetailData, 171 contentDetailData: this.contentDetailData,
@@ -141,4 +227,31 @@ export struct MultiPictureDetailPageComponent { @@ -141,4 +227,31 @@ export struct MultiPictureDetailPageComponent {
141 227
142 } 228 }
143 } 229 }
  230 + /**
  231 + * 关注号主
  232 + */
  233 + handleAccention() {
  234 + // 未登录,跳转登录
  235 + if (!HttpUrlUtils.getUserId()) {
  236 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  237 + return
  238 + }
  239 +
  240 + const params: postInteractAccentionOperateParams = {
  241 + attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
  242 + attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id
  243 + attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id
  244 + // userType: 1,
  245 + // userId: '1',
  246 + status: 1,
  247 + }
  248 + PageRepository.postInteractAccentionOperate(params).then(res => {
  249 + console.log(TAG, '关注号主==', JSON.stringify(res.data))
  250 + if (this.followStatus == '1') {
  251 + this.followStatus = '0'
  252 + } else {
  253 + this.followStatus = '1'
  254 + }
  255 + })
  256 + }
144 } 257 }
@@ -16,7 +16,8 @@ import { @@ -16,7 +16,8 @@ import {
16 postBatchAttentionStatusResult, 16 postBatchAttentionStatusResult,
17 postExecuteLikeParams, 17 postExecuteLikeParams,
18 postExecuteCollectRecordParams, 18 postExecuteCollectRecordParams,
19 - contentListParams 19 + contentListParams,
  20 + postInteractAccentionOperateParams
20 } from 'wdBean'; 21 } from 'wdBean';
21 22
22 const TAG = 'HttpRequest'; 23 const TAG = 'HttpRequest';
@@ -231,6 +232,15 @@ export class PageRepository { @@ -231,6 +232,15 @@ export class PageRepository {
231 return WDHttp.post0(url, params, headers) 232 return WDHttp.post0(url, params, headers)
232 } 233 }
233 234
  235 + /**
  236 + * 关注号主
  237 + */
  238 + static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
  239 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
  240 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  241 + return WDHttp.post0(url, params, headers)
  242 + }
  243 +
234 static fetchNewspaperInfo(date: string) { 244 static fetchNewspaperInfo(date: string) {
235 let url = PageRepository.getNewspaperInfoUrl(date) 245 let url = PageRepository.getNewspaperInfoUrl(date)
236 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 246 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();