王士厅

fix: 关注号主后,进去号主图集稿件页,关注状态会由未关注变为已关注

... ... @@ -44,6 +44,7 @@ export struct MultiPictureDetailPageComponent {
private swiperController: SwiperController = new SwiperController()
@State swiperIndex: number = 0;
@Provide followStatus: string | undefined = '0' // 关注状态
@State isShowButton: boolean = false // 展示关注按钮,默认不展示
@Provide showCommentList: boolean = false
private scroller: Scroller = new Scroller()
private listScroller: ListScroller = new ListScroller()
... ... @@ -261,7 +262,7 @@ export struct MultiPictureDetailPageComponent {
.height(24)
.onClick(() => {
this.handleAccention()
})
}).visibility(this.isShowButton ? Visibility.Visible : Visibility.None)
} else {
Button({ type: ButtonType.Normal, stateEffect: true }) {
Row() {
... ... @@ -274,7 +275,7 @@ export struct MultiPictureDetailPageComponent {
.height(24)
.onClick(() => {
this.handleAccention()
})
}).visibility(this.isShowButton ? Visibility.Visible : Visibility.None)
}
}
... ... @@ -536,11 +537,11 @@ export struct MultiPictureDetailPageComponent {
.then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
this.isOffLine = resDTO.data == null ? true : false
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'fetchDetailData is empty');
// Logger.error(TAG, 'fetchDetailData is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`);
// Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`);
return
}
this.netStatus = undefined
... ... @@ -565,9 +566,9 @@ export struct MultiPictureDetailPageComponent {
// 暂无内容
this.netStatus = 0
this.operationButtonList = []
Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`)
// Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`)
}
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
// Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (user_id) {
... ... @@ -576,7 +577,7 @@ export struct MultiPictureDetailPageComponent {
}
})
.catch((err: Error) => {
console.log(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
// console.log(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
// 内容获取失败
this.netStatus = 9
this.operationButtonList = []
... ... @@ -592,35 +593,26 @@ export struct MultiPictureDetailPageComponent {
// 记录浏览历史
private getInteractBrowsOperate() {
try {
const params: postInteractBrowsOperateParams = {
delStatus: 0,
contentList: [{
browseTime: DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN),
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType || 0,
}]
}
MultiPictureDetailViewModel.getInteractBrowsOperate(params).then(res => {
console.log(TAG, '记录浏览历史==', JSON.stringify(res.data))
})
} catch (exception) {
const params: postInteractBrowsOperateParams = {
delStatus: 0,
contentList: [{
browseTime: DateTimeUtils.getCurDate(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN),
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType || 0,
}]
}
MultiPictureDetailViewModel.getInteractBrowsOperate(params)
}
// 已登录->批量查作品是否被号主关注
private async getBatchAttentionStatus() {
try {
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
this.isShowButton = true
// Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
}
/**
... ... @@ -643,7 +635,7 @@ export struct MultiPictureDetailPageComponent {
status: this.followStatus == '1' ? 0 : 1,
}
PageRepository.postInteractAccentionOperate(params).then(res => {
console.log(TAG, '关注号主==', JSON.stringify(res.data))
// console.log(TAG, '关注号主==', JSON.stringify(res.data))
if (this.followStatus == '1') {
this.followStatus = '0'
TrackingContent.follow(true,this.followUserId,this.followUserName,TrackConstants.PageName.Atlas_Detail,TrackConstants.PageName.Atlas_Detail,this.pageParam)
... ...