zhenghy

图文详情评论定位(未完成)

... ... @@ -5,7 +5,6 @@ import {
EmitterUtils,
EmitterEventId,
NetworkUtil,
DisplayUtils
} from 'wdKit';
import {
Action,
... ... @@ -33,6 +32,7 @@ import { CommentComponent } from '../components/comment/view/CommentComponent'
import { HttpUtils } from 'wdNetwork/Index';
import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
import { componentUtils, window } from '@kit.ArkUI';
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
... ... @@ -58,6 +58,9 @@ export struct ImageAndTextPageComponent {
@State likeNum: number = 0
@State reachEndIncreament: number = 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State isScrollTop: boolean = true
@State offsetY: number = 0
build() {
Stack({ alignContent: Alignment.Top }) {
Stack({ alignContent: Alignment.Bottom }) {
... ... @@ -125,9 +128,11 @@ export struct ImageAndTextPageComponent {
fixedHeightMode: false,
reachEndIncreament: this.reachEndIncreament,
reachEndLoadMoreFinish: () => {
}
}).onAreaChange((oldValue: Area, newValue: Area) => {
}).id('comment')
.onAreaChange((oldValue: Area, newValue: Area) => {
this.info = newValue
})
// .onMeasureSize()
... ... @@ -135,6 +140,7 @@ export struct ImageAndTextPageComponent {
}
}
}
.id('imgTextContainer')
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
... ... @@ -163,8 +169,27 @@ export struct ImageAndTextPageComponent {
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
styleType: 1,
onCommentIconClick: () => {
const info = componentUtils.getRectangleById('comment');
console.log(JSON.stringify(info))
if (!this.offsetY) {
this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y
}
// 定位到评论区域
if (this.isScrollTop) {
this.scroller.scrollTo({
xOffset: 0,
yOffset: this.offsetY,
animation: true
})
} else {
this.scroller.scrollEdge(Edge.Top)
}
this.isScrollTop = !this.isScrollTop
}
})
.position({y: '100%'})
.position({ y: '100%' })
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
... ... @@ -174,7 +199,7 @@ export struct ImageAndTextPageComponent {
// 发布时间
Column() {
Row() {
if(this.isNetConnected && !this.detailContentEmpty) {
if (this.isNetConnected && !this.detailContentEmpty) {
Image(this.contentDetailData?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
.width(80)
.height(28)
... ... @@ -207,7 +232,7 @@ export struct ImageAndTextPageComponent {
private async getDetail() {
this.isNetConnected = NetworkUtil.isNetConnected()
if(!this.isNetConnected) {
if (!this.isNetConnected) {
this.emptyType = 1
}
let contentId: string = ''
... ... @@ -229,7 +254,7 @@ export struct ImageAndTextPageComponent {
let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
// 判断内容是否已下线,空数组表示下线
this.detailContentEmpty = detailBeans.length === 0 ? true : false
if(this.detailContentEmpty) {
if (this.detailContentEmpty) {
this.emptyType = 18
}
console.log(TAG, JSON.stringify(detailBeans))
... ... @@ -270,12 +295,11 @@ export struct ImageAndTextPageComponent {
}
//意图上报
private viewBlogInsightIntentShare(){
private viewBlogInsightIntentShare() {
let context = getContext(this) as common.UIAbilityContext;
viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactData)
viewBlogItemInsightIntentShare(context, this.contentDetailData, this.interactData)
}
private async getRecommend() {
let params: postRecommendListParams = {
imei: HttpUtils.getImei(),
... ...
... ... @@ -9,7 +9,7 @@ import { ContentDetailDTO } from 'wdBean/Index'
export struct CommentTabComponent {
private onCommentFocus: () => void = () => {
}
private onLoad: (dialogController: CustomDialogController) => void = () => {
private onLoad: (dialogController: CustomDialogController | null) => void = () => {
}
@ObjectLink publishCommentModel: publishCommentModel
@Prop contentDetail: ContentDetailDTO
... ...
... ... @@ -64,6 +64,7 @@ export struct OperRowListView {
/**
* 用于区分页面类型,在哪个页面嵌套就传相应的值
* 1:视频详情页 2:竖屏直播页 3:图集 4:横屏直播页
* 8: 评论弹框内
*/
@Prop pageComponentType?: number = -1
@Prop showBackIcon?: boolean = true
... ... @@ -208,7 +209,7 @@ export struct OperRowListView {
contentDetail: this.contentDetailData,
onCommentFocus: this.onCommentFocus,
pageComponentType: this.pageComponentType,
onLoad: (dialogController: CustomDialogController) => {
onLoad: (dialogController: CustomDialogController | null) => {
this.dialogController = dialogController
}
})
... ...
... ... @@ -91,6 +91,7 @@ export struct DetailDialog {
OperRowListView({
componentType: 1,
pageComponentType: 8,
showBackIcon: false,
operationButtonList: ['comment', 'like', 'collect', 'share'],
contentDetailData: this.contentDetailData,
... ...