王士厅

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

... ... @@ -33,7 +33,8 @@ export {
batchLikeAndCollectResult,
postExecuteLikeParams,
postExecuteCollectRecordParams,
contentListParams
contentListParams,
postInteractAccentionOperateParams
} from './src/main/ets/bean/detail/MultiPictureDetailPageDTO';
export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam';
... ...
... ... @@ -167,4 +167,14 @@ interface contentListItem {
export interface contentListParams {
contentList: contentListItem[];
}
export interface postInteractAccentionOperateParams {
attentionUserType: string;
attentionUserId: string;
attentionCreatorId: string;
// userType: number;
// userId: string;
status: number;
}
\ No newline at end of file
... ...
import { Logger } from 'wdKit';
import { ContentDetailDTO, PhotoListBean, postInteractBrowsOperateParams, postBatchAttentionStatusParams } from 'wdBean';
import {
ContentDetailDTO,
PhotoListBean,
postInteractBrowsOperateParams,
postBatchAttentionStatusParams,
postInteractAccentionOperateParams
} from 'wdBean';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import display from '@ohos.display';
import font from '@ohos.font';
... ... @@ -7,6 +13,8 @@ import { OperRowListView } from './view/OperRowListView';
import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent';
import { DateTimeUtils } from 'wdKit/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../repository/PageRepository';
const TAG = 'MultiPictureDetailPageComponent';
... ... @@ -80,6 +88,84 @@ export struct MultiPictureDetailPageComponent {
.onChange((index: number) => {
this.swiperIndex = index
})
if(this.contentDetailData.rmhPlatform == 1) {
Row() {
Row(){
Row({space: 8}) {
Image(this.contentDetailData?.rmhInfo?.rmhHeadUrl)
.borderRadius('50%')
.alt($r('app.media.picture_loading'))
.width(36)
.height(36)
.objectFit(ImageFit.Fill)
.interpolation(ImageInterpolation.High)
}
.width('13%')
.height('100%')
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
Text(`${this.contentDetailData?.rmhInfo?.rmhName}`)
.fontColor(Color.White)
.fontSize(14)
.fontFamily('PingFang PingFang SC-Medium')
.fontWeight(500)
.lineHeight(17)
.margin(0)
Text(`${this.contentDetailData?.rmhInfo?.rmhDesc}`)
.fontColor('#676767')
.fontSize(12)
.fontFamily('PingFang SC-Regular')
.fontWeight(400)
.lineHeight(14)
.textOverflow({ overflow: TextOverflow.Clip })
.margin (0)
}
}
.width('81%')
.height('100%')
}
.width('74.4%')
.height('100%')
.margin({
top: 0,
bottom: 0,
left: 16,
right:0
})
if(this.followStatus == '0') {
Row(){
Button('+关注', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(4)
.backgroundColor('#ED2800')
.width(48)
.height(24)
.onClick(() => {
this.handleAccention()
})
.margin({
top: 10,
bottom: 10,
left: 16,
right:16
})
.fontSize(12)
.fontColor(Color.White)
}
.width('21.6%')
.height('100%')
}
}
.width('100%')
.height(44)
.alignRules({
top: { anchor: "e_swiper_content", align: VerticalAlign.Top },
middle: { anchor: "e_swiper_content", align: HorizontalAlign.Center }
})
.id('e_attention')
}
OperRowListView({
contentDetailData: this.contentDetailData,
... ... @@ -141,4 +227,31 @@ export struct MultiPictureDetailPageComponent {
}
}
/**
* 关注号主
*/
handleAccention() {
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
const params: postInteractAccentionOperateParams = {
attentionUserType: this.contentDetailData?.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
attentionUserId: this.contentDetailData?.rmhInfo?.userId || '', // 被关注用户号主id
attentionCreatorId: this.contentDetailData?.rmhInfo?.rmhId || '', // 被关注用户号主id
// userType: 1,
// userId: '1',
status: 1,
}
PageRepository.postInteractAccentionOperate(params).then(res => {
console.log(TAG, '关注号主==', JSON.stringify(res.data))
if (this.followStatus == '1') {
this.followStatus = '0'
} else {
this.followStatus = '1'
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -16,7 +16,8 @@ import {
postBatchAttentionStatusResult,
postExecuteLikeParams,
postExecuteCollectRecordParams,
contentListParams
contentListParams,
postInteractAccentionOperateParams
} from 'wdBean';
const TAG = 'HttpRequest';
... ... @@ -231,6 +232,15 @@ export class PageRepository {
return WDHttp.post0(url, params, headers)
}
/**
* 关注号主
*/
static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post0(url, params, headers)
}
static fetchNewspaperInfo(date: string) {
let url = PageRepository.getNewspaperInfoUrl(date)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
... ...