陈剑华

Merge remote-tracking branch 'origin/main'

@@ -399,22 +399,6 @@ export class ProcessUtils { @@ -399,22 +399,6 @@ export class ProcessUtils {
399 return 399 return
400 } 400 }
401 ProcessUtils.processPage(contentBean) 401 ProcessUtils.processPage(contentBean)
402 - // let taskAction: Action = {  
403 - // type: 'JUMP_INNER_NEW_PAGE',  
404 - // params: {  
405 - // contentID: content?.newsId,  
406 - // url:content?.linkUrl,  
407 - // pageID: 'IMAGE_TEXT_DETAIL',  
408 - // extra: {  
409 - // relType: content?.relType,  
410 - // relId: content?.relId,  
411 - // sourcePage: '5',  
412 - // commentId: content?.commentId  
413 - // } as ExtraDTO  
414 - // } as Params,  
415 - // };  
416 - // WDRouterRule.jumpWithAction(taskAction)  
417 - // Logger.debug(TAG, `commentGotoWeb, ${content.newsId}`);  
418 } 402 }
419 403
420 public static gotoH5NewsWeb(content: ContentDTO) { 404 public static gotoH5NewsWeb(content: ContentDTO) {
@@ -433,7 +417,6 @@ export class ProcessUtils { @@ -433,7 +417,6 @@ export class ProcessUtils {
433 title: content?.newsTitle 417 title: content?.newsTitle
434 } as ExtraDTO, 418 } as ExtraDTO,
435 targetLayout: content.customParamTargetLayout, 419 targetLayout: content.customParamTargetLayout,
436 - clickComment: content.clickComment  
437 } as Params, 420 } as Params,
438 }; 421 };
439 WDRouterRule.jumpWithAction(taskAction) 422 WDRouterRule.jumpWithAction(taskAction)
@@ -456,7 +439,6 @@ export class ProcessUtils { @@ -456,7 +439,6 @@ export class ProcessUtils {
456 commentId: content?.commentInfo?.commentId 439 commentId: content?.commentInfo?.commentId
457 } as ExtraDTO, 440 } as ExtraDTO,
458 targetLayout: content.customParamTargetLayout, 441 targetLayout: content.customParamTargetLayout,
459 - clickComment: content.clickComment  
460 } as Params, 442 } as Params,
461 }; 443 };
462 WDRouterRule.jumpWithAction(taskAction) 444 WDRouterRule.jumpWithAction(taskAction)
@@ -144,7 +144,6 @@ export class ContentDTO implements BaseDTO { @@ -144,7 +144,6 @@ export class ContentDTO implements BaseDTO {
144 isMourning?: boolean = false; 144 isMourning?: boolean = false;
145 145
146 author: string = ""; ///撰稿人 146 author: string = ""; ///撰稿人
147 - clickComment:boolean = false;  
148 147
149 // 号主页评论列表点击跳转到视频详情判断评论弹框是否展开 148 // 号主页评论列表点击跳转到视频详情判断评论弹框是否展开
150 showComment?:boolean = false; 149 showComment?:boolean = false;
@@ -24,6 +24,5 @@ export interface Params { @@ -24,6 +24,5 @@ export interface Params {
24 videoCoverUrl?: string; 24 videoCoverUrl?: string;
25 pageId?: string; 25 pageId?: string;
26 backVisibility?: boolean; //展示顶部返回栏 26 backVisibility?: boolean; //展示顶部返回栏
27 - clickComment?:boolean;//点击评论按钮进入稿件详情页定位到评论区  
28 targetLayout?: string; // "comment" 表示进入对应页面后,跳转至评论区 27 targetLayout?: string; // "comment" 表示进入对应页面后,跳转至评论区
29 } 28 }
@@ -125,7 +125,7 @@ export struct CarderInteraction { @@ -125,7 +125,7 @@ export struct CarderInteraction {
125 } 125 }
126 .justifyContent(FlexAlign.Center) 126 .justifyContent(FlexAlign.Center)
127 .onClick(() => { 127 .onClick(() => {
128 - this.contentDTO.clickComment = true 128 + this.contentDTO.customParamTargetLayout = "comment"
129 ProcessUtils.processPage(this.contentDTO); 129 ProcessUtils.processPage(this.contentDTO);
130 }) 130 })
131 } 131 }
@@ -93,12 +93,7 @@ export struct ImageAndTextPageComponent { @@ -93,12 +93,7 @@ export struct ImageAndTextPageComponent {
93 } 93 }
94 94
95 webPageIsPageEnd() { 95 webPageIsPageEnd() {
96 - if (this.action.params?.clickComment) {  
97 - setTimeout(()=>{  
98 - this.pageScrollToCommonent()  
99 - },  
100 - 800)  
101 - } 96 + this.checkToScrollCommentArea()
102 } 97 }
103 98
104 build() { 99 build() {
@@ -255,7 +250,7 @@ export struct ImageAndTextPageComponent { @@ -255,7 +250,7 @@ export struct ImageAndTextPageComponent {
255 showMainText:this.showMainText, 250 showMainText:this.showMainText,
256 styleType: 1, 251 styleType: 1,
257 onCommentIconClick: () => { 252 onCommentIconClick: () => {
258 - this.pageScrollToCommonent() 253 + this.toggleScrollToCommonentOrTop()
259 } 254 }
260 }) 255 })
261 } 256 }
@@ -502,28 +497,6 @@ export struct ImageAndTextPageComponent { @@ -502,28 +497,6 @@ export struct ImageAndTextPageComponent {
502 } 497 }
503 } 498 }
504 499
505 - private pageScrollToCommonent() {  
506 - const info = componentUtils.getRectangleById('comment');  
507 - //评论区当前位置  
508 - let currentCommonentOffSetY = this.info?.globalPosition.y as number - 70  
509 - // 当前页面滚动位置  
510 - let currentScrollOffSetY = this.scroller.currentOffset().yOffset  
511 - let offSetY = 0  
512 - if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) {  
513 - offSetY = currentScrollOffSetY + (currentCommonentOffSetY - this.screenHeight+this.bottomHeight) + 400  
514 - }  
515 - // 定位到评论区域  
516 - if (!this.showMainText) {  
517 - this.scroller.scrollTo({  
518 - xOffset: 0,  
519 - yOffset: offSetY,  
520 - animation: { duration: 1000, curve: Curve.Ease }  
521 - })  
522 - } else {  
523 - this.scroller.scrollEdge(Edge.Top)  
524 - }  
525 - }  
526 -  
527 aboutToAppear() { 500 aboutToAppear() {
528 // Logger.debug(TAG, '文章详情页 aboutToAppear,开始请求接口数据'); 501 // Logger.debug(TAG, '文章详情页 aboutToAppear,开始请求接口数据');
529 this.getDetail() 502 this.getDetail()
@@ -582,19 +555,37 @@ export struct ImageAndTextPageComponent { @@ -582,19 +555,37 @@ export struct ImageAndTextPageComponent {
582 this.showMainText = true 555 this.showMainText = true
583 } 556 }
584 557
585 - if (this.action.params?.targetLayout && this.action.params.targetLayout == "comment") { 558 + if (!this.showMainText && this.action.params?.targetLayout == "comment") {
586 if (this.lastTimeoutId) { 559 if (this.lastTimeoutId) {
587 clearTimeout(this.lastTimeoutId) 560 clearTimeout(this.lastTimeoutId)
588 } 561 }
589 this.lastTimeoutId = setTimeout(() => { 562 this.lastTimeoutId = setTimeout(() => {
590 - //头部距离48  
591 - this.scroller.scrollTo({  
592 - yOffset: offSetY,  
593 - xOffset: 0,  
594 - animation: { duration: 1000, curve: Curve.Ease }  
595 - }) 563 + this.toggleScrollToCommonentOrTop(true)
596 this.action.params!.targetLayout = undefined 564 this.action.params!.targetLayout = undefined
597 }, 600) 565 }, 600)
598 } 566 }
599 } 567 }
  568 +
  569 + private toggleScrollToCommonentOrTop(forceToComment?: boolean) {
  570 +
  571 + // 定位到评论区域
  572 + if ((forceToComment == undefined || forceToComment == false) && this.showMainText) {
  573 + this.scroller.scrollEdge(Edge.Top)
  574 + return
  575 + }
  576 +
  577 + //评论区当前位置
  578 + let currentCommonentOffSetY = this.info?.globalPosition.y as number - 70
  579 + // 当前页面滚动位置
  580 + let currentScrollOffSetY = this.scroller.currentOffset().yOffset
  581 + let offSetY = 0
  582 + if (currentCommonentOffSetY >= (this.screenHeight-this.bottomHeight) ) {
  583 + offSetY = currentScrollOffSetY + (currentCommonentOffSetY - this.screenHeight+this.bottomHeight) + 400
  584 + }
  585 + this.scroller.scrollTo({
  586 + xOffset: 0,
  587 + yOffset: offSetY,
  588 + animation: { duration: 1000, curve: Curve.Ease }
  589 + })
  590 + }
600 } 591 }
@@ -27,8 +27,7 @@ import { common } from '@kit.AbilityKit'; @@ -27,8 +27,7 @@ import { common } from '@kit.AbilityKit';
27 import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'; 27 import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent';
28 import { EmitterEventId, EmitterUtils } from 'wdKit/Index' 28 import { EmitterEventId, EmitterUtils } from 'wdKit/Index'
29 import { ColorUtils } from '../../utils/ColorUtils'; 29 import { ColorUtils } from '../../utils/ColorUtils';
30 -import { SpConstants } from 'wdConstant';  
31 - 30 +import DailyPaperTopicModel from '../../model/DailyPaperTopicModel';
32 31
33 const TAG = 'MorningEveningPaperComponent'; 32 const TAG = 'MorningEveningPaperComponent';
34 33
@@ -129,6 +128,19 @@ export struct MorningEveningPaperComponent { @@ -129,6 +128,19 @@ export struct MorningEveningPaperComponent {
129 async aboutToAppear() { 128 async aboutToAppear() {
130 this.dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as string 129 this.dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as string
131 130
  131 + if (this.dailyPaperTopicPageId.length > 0) {
  132 + this.fetchData()
  133 + } else {
  134 + const dailyPaperTopicBean = await DailyPaperTopicModel.getDailyPaperTopic()
  135 + if (dailyPaperTopicBean && dailyPaperTopicBean.id > 0) {
  136 + SPHelper.default.saveSync('dailyPaperTopicPageId', dailyPaperTopicBean.id + "");
  137 + this.dailyPaperTopicPageId = dailyPaperTopicBean.id + "";
  138 + this.fetchData()
  139 + }
  140 + }
  141 + }
  142 +
  143 + async fetchData() {
132 // console.info(TAG, `aboutToAppear = ` + this.dailyPaperTopicPageId) 144 // console.info(TAG, `aboutToAppear = ` + this.dailyPaperTopicPageId)
133 const currentTime = new Date().getTime() 145 const currentTime = new Date().getTime()
134 // console.log(TAG, "currentTime = " + currentTime) 146 // console.log(TAG, "currentTime = " + currentTime)
@@ -494,10 +494,26 @@ struct ChildCommentItem { @@ -494,10 +494,26 @@ struct ChildCommentItem {
494 .onClick(() => { 494 .onClick(() => {
495 this.replyComment() 495 this.replyComment()
496 }) 496 })
  497 + .gesture(
  498 + LongPressGesture()
  499 + .onAction((event: GestureEvent|undefined)=>{
  500 + if (event) {
  501 + //TODO: 显示功能菜单
  502 + }
  503 + })
  504 + )
497 if (this.item.commentPics.length > 0) { 505 if (this.item.commentPics.length > 0) {
498 Image(this.item.commentPics) 506 Image(this.item.commentPics)
499 .width(88).height(88) 507 .width(88).height(88)
500 .margin({top: 6 + (this.item.commentContent.length > 0 ? 0 : 15), left: this.leftGap}) 508 .margin({top: 6 + (this.item.commentContent.length > 0 ? 0 : 15), left: this.leftGap})
  509 + .gesture(
  510 + LongPressGesture()
  511 + .onAction((event: GestureEvent|undefined)=>{
  512 + if (event) {
  513 + //TODO: 显示功能菜单
  514 + }
  515 + })
  516 + )
501 } 517 }
502 518
503 commentFooterView({ 519 commentFooterView({
@@ -718,11 +734,27 @@ struct commentHeaderView { @@ -718,11 +734,27 @@ struct commentHeaderView {
718 .onClick(() => { 734 .onClick(() => {
719 this.replyComment() 735 this.replyComment()
720 }) 736 })
  737 + .gesture(
  738 + LongPressGesture()
  739 + .onAction((event: GestureEvent|undefined)=>{
  740 + if (event) {
  741 + //TODO: 显示功能菜单
  742 + }
  743 + })
  744 + )
721 745
722 if (this.item.commentPics.length > 0) { 746 if (this.item.commentPics.length > 0) {
723 Image(this.item.commentPics) 747 Image(this.item.commentPics)
724 .width(88).height(88) 748 .width(88).height(88)
725 .margin({top: 6 + (this.item.commentContent.length > 0 ? 0 : 15), left: this.leftGap}) 749 .margin({top: 6 + (this.item.commentContent.length > 0 ? 0 : 15), left: this.leftGap})
  750 + .gesture(
  751 + LongPressGesture()
  752 + .onAction((event: GestureEvent|undefined)=>{
  753 + if (event) {
  754 + //TODO: 显示功能菜单
  755 + }
  756 + })
  757 + )
726 } 758 }
727 759
728 commentFooterView({ 760 commentFooterView({
@@ -711,7 +711,7 @@ export struct TopNavigationComponentNew { @@ -711,7 +711,7 @@ export struct TopNavigationComponentNew {
711 if (NetworkUtil.isNetConnected()) { 711 if (NetworkUtil.isNetConnected()) {
712 DailyPaperTopicModel.getDailyPaperTopic().then(dailyPaperTopicBean => { 712 DailyPaperTopicModel.getDailyPaperTopic().then(dailyPaperTopicBean => {
713 if (dailyPaperTopicBean && dailyPaperTopicBean.id > 0) { 713 if (dailyPaperTopicBean && dailyPaperTopicBean.id > 0) {
714 - SPHelper.default.saveSync('dailyPaperTopicPageId', dailyPaperTopicBean.id); 714 + SPHelper.default.saveSync('dailyPaperTopicPageId', dailyPaperTopicBean.id + "");
715 ProcessUtils.gotoMorningEveningPaper() 715 ProcessUtils.gotoMorningEveningPaper()
716 } else { 716 } else {
717 ToastUtils.showToast('暂无早晚报信息', 1000) 717 ToastUtils.showToast('暂无早晚报信息', 1000)
@@ -100,11 +100,11 @@ export struct OperRowListView { @@ -100,11 +100,11 @@ export struct OperRowListView {
100 private shareOpen = 0; 100 private shareOpen = 0;
101 101
102 async aboutToAppear() { 102 async aboutToAppear() {
103 - console.info(TAG, 'this.needLike', this.needLike) 103 + // console.info(TAG, 'this.needLike', this.needLike)
104 this.handleStyle() 104 this.handleStyle()
105 this.onDetailUpdated() 105 this.onDetailUpdated()
106 EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => { 106 EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => {
107 - console.log(TAG, 'this.currentStatus', val) 107 + // console.log(TAG, 'this.currentStatus', val)
108 this.currentStatus = val 108 this.currentStatus = val
109 }) 109 })
110 //注册通知,来自别的组件的评论成功通知 110 //注册通知,来自别的组件的评论成功通知
@@ -134,7 +134,7 @@ export struct OperRowListView { @@ -134,7 +134,7 @@ export struct OperRowListView {
134 } 134 }
135 135
136 async onDetailUpdated() { 136 async onDetailUpdated() {
137 - console.info(TAG, 'this.styleType', this.styleType) 137 + // console.info(TAG, 'this.styleType', this.styleType)
138 this.handleStyle() 138 this.handleStyle()
139 if (!this.contentDetailData) { 139 if (!this.contentDetailData) {
140 return 140 return
@@ -168,10 +168,10 @@ export struct OperRowListView { @@ -168,10 +168,10 @@ export struct OperRowListView {
168 168
169 this.likeBean['contentType'] = this.contentDetailData.newsType + '' 169 this.likeBean['contentType'] = this.contentDetailData.newsType + ''
170 170
171 - console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))  
172 - console.info(TAG, 'this.contentDetailData.shareInfo.shareOpen', JSON.stringify(this.contentDetailData.shareInfo.shareOpen))  
173 - console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean))  
174 - console.info(TAG, 'this.operationButtonList', JSON.stringify(this.operationButtonList)) 171 + // console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
  172 + // console.info(TAG, 'this.contentDetailData.shareInfo.shareOpen', JSON.stringify(this.contentDetailData.shareInfo.shareOpen))
  173 + // console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean))
  174 + // console.info(TAG, 'this.operationButtonList', JSON.stringify(this.operationButtonList))
175 175
176 // 评论需要数据 176 // 评论需要数据
177 /* this.publishCommentModel.targetId = this.contentDetailData.newsId + '' 177 /* this.publishCommentModel.targetId = this.contentDetailData.newsId + ''
@@ -185,8 +185,8 @@ export struct OperRowListView { @@ -185,8 +185,8 @@ export struct OperRowListView {
185 if (this.operationButtonList?.includes('listen')) { 185 if (this.operationButtonList?.includes('listen')) {
186 this.audioUrl = this.contentDetailData.audioList[0]?.audioUrl || '' 186 this.audioUrl = this.contentDetailData.audioList[0]?.audioUrl || ''
187 this.audioTitle = this.contentDetailData.newsTitle || '' 187 this.audioTitle = this.contentDetailData.newsTitle || ''
188 - console.log(TAG, 'this.audioUrl+++', this.audioUrl)  
189 - console.log(TAG, 'this.audioTitle+++', this.audioTitle) 188 + // console.log(TAG, 'this.audioUrl+++', this.audioUrl)
  189 + // console.log(TAG, 'this.audioTitle+++', this.audioTitle)
190 } 190 }
191 // 2:竖屏直播页 3:图集 4:横屏直播页 191 // 2:竖屏直播页 3:图集 4:横屏直播页
192 if(this.pageComponentType == 2 || this.pageComponentType == 4) { 192 if(this.pageComponentType == 2 || this.pageComponentType == 4) {
@@ -289,7 +289,7 @@ export struct OperRowListView { @@ -289,7 +289,7 @@ export struct OperRowListView {
289 } 289 }
290 .layoutWeight(1) 290 .layoutWeight(1)
291 .margin({ 291 .margin({
292 - right: this.pageComponentType === 1 ? 20 : 0, 292 + right: 10,
293 left: 0 293 left: 0
294 }) 294 })
295 295
@@ -5,7 +5,7 @@ import { PageRepository } from '../repository/PageRepository'; @@ -5,7 +5,7 @@ import { PageRepository } from '../repository/PageRepository';
5 5
6 const TAG = "SearcherAboutDataModel" 6 const TAG = "SearcherAboutDataModel"
7 7
8 -class DailyPaperTopicModel { 8 + class DailyPaperTopicModel {
9 private static instance: DailyPaperTopicModel; 9 private static instance: DailyPaperTopicModel;
10 10
11 /** 11 /**
@@ -43,7 +43,9 @@ export class NewspaperDataFetcher { @@ -43,7 +43,9 @@ export class NewspaperDataFetcher {
43 43
44 let contents: ContentDTO[] = compInfo.compList[0].operDataList as ContentDTO[] 44 let contents: ContentDTO[] = compInfo.compList[0].operDataList as ContentDTO[]
45 if (contents && contents.length) { 45 if (contents && contents.length) {
46 - data.paperContents = contents.map((contentDTO) => { 46 + data.paperContents = contents.filter((value, index) => {
  47 + return index < 4
  48 + }).map((contentDTO) => {
47 let content : FormNewspaperPaperContent = { 49 let content : FormNewspaperPaperContent = {
48 title: contentDTO.newsTitle, 50 title: contentDTO.newsTitle,
49 coverUrl: contentDTO.coverUrl, 51 coverUrl: contentDTO.coverUrl,
@@ -97,7 +97,7 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { @@ -97,7 +97,7 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor {
97 } 97 }
98 DailyPaperTopicModel.getDailyPaperTopic().then(dailyPaperTopicBean => { 98 DailyPaperTopicModel.getDailyPaperTopic().then(dailyPaperTopicBean => {
99 if (dailyPaperTopicBean && dailyPaperTopicBean.id > 0) { 99 if (dailyPaperTopicBean && dailyPaperTopicBean.id > 0) {
100 - SPHelper.default.saveSync('dailyPaperTopicPageId', dailyPaperTopicBean.id); 100 + SPHelper.default.saveSync('dailyPaperTopicPageId', dailyPaperTopicBean.id + "");
101 ProcessUtils.gotoMorningEveningPaper() //跳转至早晚报页面 101 ProcessUtils.gotoMorningEveningPaper() //跳转至早晚报页面
102 } else { 102 } else {
103 ToastUtils.showToast('暂无早晚报信息', 1000) 103 ToastUtils.showToast('暂无早晚报信息', 1000)