Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
13 changed files
with
97 additions
and
67 deletions
| @@ -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) |
| @@ -57,12 +57,24 @@ export struct CardMediaInfo { | @@ -57,12 +57,24 @@ export struct CardMediaInfo { | ||
| 57 | if (Number.parseInt(num) <= 9999) { | 57 | if (Number.parseInt(num) <= 9999) { |
| 58 | return Number.parseInt(num).toString() | 58 | return Number.parseInt(num).toString() |
| 59 | } else if (Number.parseInt(num) > 9999 && Number.parseInt(num) <= 99999999) { | 59 | } else if (Number.parseInt(num) > 9999 && Number.parseInt(num) <= 99999999) { |
| 60 | - const num1: string = num.slice(0, -4); // 万 | ||
| 61 | - const num2: string = num.slice(-4, -3); // 千 | 60 | + let num1: string = num.slice(0, -4); // 万 |
| 61 | + let num2: string = num.slice(-4, -3); // 千 | ||
| 62 | + const num3: string = num.slice(-3, -2); // 百 | ||
| 63 | + if (Math.round(Number(`0.${num3}`)) === 1) num2 = `${Number(num2) + 1}` | ||
| 64 | + if (Number(num2) === 10) { | ||
| 65 | + num2 = '0'; | ||
| 66 | + num1 = `${Number(num1) + 1}` | ||
| 67 | + } | ||
| 62 | return num2 === '0' ? num1 +'万' : num1 + '.' + num2 + '万' | 68 | return num2 === '0' ? num1 +'万' : num1 + '.' + num2 + '万' |
| 63 | } else if (Number.parseInt(num) > 99999999) { | 69 | } else if (Number.parseInt(num) > 99999999) { |
| 64 | - const num1: string = num.slice(0, -8); // 亿 | ||
| 65 | - const num2: string = num.slice(-8, -7); | 70 | + let num1: string = num.slice(0, -8); // 亿 |
| 71 | + let num2: string = num.slice(-8, -7); | ||
| 72 | + const num3: string = num.slice(-3, -2); // 百 | ||
| 73 | + if (Math.round(Number(`0.${num3}`)) === 1) num2 = `${Number(num2) + 1}` | ||
| 74 | + if (Number(num2) === 10) { | ||
| 75 | + num2 = '0'; | ||
| 76 | + num1 = `${Number(num1) + 1}` | ||
| 77 | + } | ||
| 66 | return num2 === '0' ? num1 +'亿' : num1 + '.' + num2 + '亿' | 78 | return num2 === '0' ? num1 +'亿' : num1 + '.' + num2 + '亿' |
| 67 | } | 79 | } |
| 68 | return num | 80 | return num |
| @@ -78,6 +90,7 @@ export struct CardMediaInfo { | @@ -78,6 +90,7 @@ export struct CardMediaInfo { | ||
| 78 | let liveIdList: string = this.contentDTO.objectId | 90 | let liveIdList: string = this.contentDTO.objectId |
| 79 | let data: joinPeopleNum[] = await LiveModel.getJoinPeopleNum(liveIdList) | 91 | let data: joinPeopleNum[] = await LiveModel.getJoinPeopleNum(liveIdList) |
| 80 | this.joinPeopleNum = data[0].pv; | 92 | this.joinPeopleNum = data[0].pv; |
| 93 | + console.log('getJoinPeopleNum ', this.joinPeopleNum) | ||
| 81 | } | 94 | } |
| 82 | 95 | ||
| 83 | build() { | 96 | build() { |
| @@ -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) |
| @@ -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) |
No preview for this file type
-
Please register or login to post a comment