张善主

Merge remote-tracking branch 'origin/main'

@@ -56,7 +56,7 @@ export struct topicInfoView { @@ -56,7 +56,7 @@ export struct topicInfoView {
56 contentDTO.linkUrl = this.frontLinkObject?.linkUrl 56 contentDTO.linkUrl = this.frontLinkObject?.linkUrl
57 ProcessUtils.processPage(contentDTO) 57 ProcessUtils.processPage(contentDTO)
58 } 58 }
59 - }) 59 + }).width(80)
60 .alignRules({ 60 .alignRules({
61 left: { anchor: "__container__", align: HorizontalAlign.Start }, 61 left: { anchor: "__container__", align: HorizontalAlign.Start },
62 bottom: { anchor: "__container__", align: VerticalAlign.Bottom } 62 bottom: { anchor: "__container__", align: VerticalAlign.Bottom }
@@ -411,7 +411,9 @@ export struct PaperSingleColumn999CardView { @@ -411,7 +411,9 @@ export struct PaperSingleColumn999CardView {
411 result = `${minutes}分钟前`; 411 result = `${minutes}分钟前`;
412 } else if (hours < 24) { 412 } else if (hours < 24) {
413 result = `${hours}小时前`; 413 result = `${hours}小时前`;
414 - } else { 414 + } else if(hours > 24 && hours <48){
  415 + result = '1天前';
  416 + }else {
415 result = ''; 417 result = '';
416 } 418 }
417 419
@@ -483,11 +485,15 @@ export struct PaperSingleColumn999CardView { @@ -483,11 +485,15 @@ export struct PaperSingleColumn999CardView {
483 .fontSize(12) 485 .fontSize(12)
484 .fontColor('#B0B0B0') 486 .fontColor('#B0B0B0')
485 .margin({ left: 16 }) 487 .margin({ left: 16 })
  488 +
  489 + ///不显示时间或者不显示评论
  490 + if (this.getPublishTime().length > 0 || this.item.objectType != '2' && this.interactData && this.interactData.commentNum && Number(this.interactData.collectNum) > 0) {
486 Image($r('app.media.point')) 491 Image($r('app.media.point'))
487 .width(16) 492 .width(16)
488 .height(16) 493 .height(16)
489 .margin({ top: 10, bottom: 10 }) 494 .margin({ top: 10, bottom: 10 })
490 } 495 }
  496 + }
491 497
492 Text(this.getPublishTime()) 498 Text(this.getPublishTime())
493 .fontSize(12) 499 .fontSize(12)
@@ -497,7 +503,7 @@ export struct PaperSingleColumn999CardView { @@ -497,7 +503,7 @@ export struct PaperSingleColumn999CardView {
497 Text(this.interactData.commentNum + "评") 503 Text(this.interactData.commentNum + "评")
498 .fontSize(12) 504 .fontSize(12)
499 .fontColor('#B0B0B0') 505 .fontColor('#B0B0B0')
500 - .margin({ left: 6 }) 506 + .margin({ left: this.getPublishTime().length >0? 6:0 })
501 } 507 }
502 } 508 }
503 .justifyContent(FlexAlign.Start) 509 .justifyContent(FlexAlign.Start)
@@ -2,7 +2,7 @@ import { CommonConstants, ViewType } from 'wdConstant'; @@ -2,7 +2,7 @@ import { CommonConstants, ViewType } from 'wdConstant';
2 import { Logger } from 'wdKit'; 2 import { Logger } from 'wdKit';
3 import { EmptyComponent } from '../view/EmptyComponent'; 3 import { EmptyComponent } from '../view/EmptyComponent';
4 import PageModel from '../../viewmodel/PageModel'; 4 import PageModel from '../../viewmodel/PageModel';
5 -import { autoRefresh, listTouchEvent } from '../../utils/PullDownRefresh'; 5 +import { autoRefresh, onActionEnd, onActionStart, onActionUpdate } from '../../utils/PullDownRefresh';
6 import LoadMoreLayout from './LoadMoreLayout'; 6 import LoadMoreLayout from './LoadMoreLayout';
7 import { CompParser } from '../CompParser'; 7 import { CompParser } from '../CompParser';
8 import { CompDTO } from 'wdBean'; 8 import { CompDTO } from 'wdBean';
@@ -14,9 +14,6 @@ import PageNoMoreLayout from './PageNoMoreLayout'; @@ -14,9 +14,6 @@ import PageNoMoreLayout from './PageNoMoreLayout';
14 import { NoMoreBean } from './NoMoreBean'; 14 import { NoMoreBean } from './NoMoreBean';
15 import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean'; 15 import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean';
16 import RefreshLayout from '../refresh/RefreshLayout'; 16 import RefreshLayout from '../refresh/RefreshLayout';
17 -import json from '@ohos.util.json';  
18 -import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare'  
19 -import { common } from '@kit.AbilityKit';  
20 const TAG = 'PageComponent'; 17 const TAG = 'PageComponent';
21 18
22 @Component 19 @Component
@@ -31,6 +28,7 @@ export struct PageComponent { @@ -31,6 +28,7 @@ export struct PageComponent {
31 // 自动刷新通知 28 // 自动刷新通知
32 @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 29 @Prop @Watch('onAutoRefresh') autoRefresh: number = 0
33 private listScroller: Scroller = new Scroller(); 30 private listScroller: Scroller = new Scroller();
  31 + private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down })
34 needload: boolean = true; 32 needload: boolean = true;
35 build() { 33 build() {
36 Column() { 34 Column() {
@@ -51,13 +49,26 @@ export struct PageComponent { @@ -51,13 +49,26 @@ export struct PageComponent {
51 } 49 }
52 .width(CommonConstants.FULL_PARENT) 50 .width(CommonConstants.FULL_PARENT)
53 .height(CommonConstants.FULL_PARENT) 51 .height(CommonConstants.FULL_PARENT)
54 - .onTouch((event: TouchEvent | undefined) => {  
55 - if (event) {  
56 - if (this.pageModel.viewType === ViewType.LOADED) {  
57 - listTouchEvent(this.pageModel, this.pageAdvModel, event);  
58 - }  
59 - } 52 + // .onTouch((event: TouchEvent | undefined) => {
  53 + // if (event) {
  54 + // if (this.pageModel.viewType === ViewType.LOADED) {
  55 + // listTouchEvent(this.pageModel, this.pageAdvModel, event);
  56 + // }
  57 + // }
  58 + // })
  59 + // 对接新的下拉刷新手势,替换touch事件
  60 + .parallelGesture(
  61 + PanGesture(this.panOption)
  62 + .onActionStart((event?: GestureEvent) => {
  63 + onActionStart(this.pageModel, this.pageAdvModel, event)
  64 + })
  65 + .onActionUpdate((event?: GestureEvent) => {
  66 + onActionUpdate(this.pageModel, this.pageAdvModel, event)
  67 + })
  68 + .onActionEnd(() => {
  69 + onActionEnd(this.pageModel, this.pageAdvModel)
60 }) 70 })
  71 + )
61 72
62 } 73 }
63 74
@@ -88,8 +88,7 @@ export struct OperRowListView { @@ -88,8 +88,7 @@ export struct OperRowListView {
88 @State dialogController: CustomDialogController | null = null; 88 @State dialogController: CustomDialogController | null = null;
89 89
90 async aboutToAppear() { 90 async aboutToAppear() {
91 - console.info(TAG, '22222----', this.styleType)  
92 - console.info(TAG, '3333----', this.needLike) 91 + console.info(TAG, 'this.needLike', this.needLike)
93 this.handleStyle() 92 this.handleStyle()
94 this.onDetailUpdated() 93 this.onDetailUpdated()
95 EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => { 94 EmitterUtils.receiveEvent(EmitterEventId.AUDIO_CHANGE_STATUS, (val: number | string | undefined) => {
@@ -108,7 +107,7 @@ export struct OperRowListView { @@ -108,7 +107,7 @@ export struct OperRowListView {
108 } 107 }
109 108
110 async onDetailUpdated() { 109 async onDetailUpdated() {
111 - console.info(TAG, '111111----', this.styleType) 110 + console.info(TAG, 'this.styleType', this.styleType)
112 this.handleStyle() 111 this.handleStyle()
113 if (!this.contentDetailData) { 112 if (!this.contentDetailData) {
114 return 113 return
@@ -380,7 +379,7 @@ export struct OperRowListView { @@ -380,7 +379,7 @@ export struct OperRowListView {
380 { 379 {
381 contentId: this.contentDetailData?.newsId + '', 380 contentId: this.contentDetailData?.newsId + '',
382 contentType: this.contentDetailData?.newsType + '', 381 contentType: this.contentDetailData?.newsType + '',
383 - contentRelId: this.contentDetailData?.reLInfo?.relId + '', 382 + contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
384 } 383 }
385 ] 384 ]
386 } 385 }
@@ -397,7 +396,6 @@ export struct OperRowListView { @@ -397,7 +396,6 @@ export struct OperRowListView {
397 * 收藏、取消收藏 396 * 收藏、取消收藏
398 */ 397 */
399 async toggleCollectStatus() { 398 async toggleCollectStatus() {
400 - console.log(TAG, '收藏点击')  
401 // 未登录,跳转登录 399 // 未登录,跳转登录
402 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') 400 const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
403 console.log(TAG, '收藏点击,登录', user_id) 401 console.log(TAG, '收藏点击,登录', user_id)
@@ -411,15 +409,13 @@ export struct OperRowListView { @@ -411,15 +409,13 @@ export struct OperRowListView {
411 contentList: [{ 409 contentList: [{
412 contentId: this.contentDetailData?.newsId + '', 410 contentId: this.contentDetailData?.newsId + '',
413 contentType: this.contentDetailData?.newsType + '', 411 contentType: this.contentDetailData?.newsType + '',
414 - relType: this.contentDetailData?.reLInfo?.relType + '',  
415 - contentRelId: this.contentDetailData?.reLInfo?.relId + '', 412 + relType: this.contentDetailData?.reLInfo?.relType || '' + '',
  413 + contentRelId: this.contentDetailData?.reLInfo?.relId || '' + '',
416 }], 414 }],
417 415
418 } 416 }
419 - // console.log(TAG, '收藏点击', JSON.stringify(params)) 417 + console.log(TAG, '收藏点击', JSON.stringify(params))
420 PageRepository.postExecuteCollectRecord(params).then(res => { 418 PageRepository.postExecuteCollectRecord(params).then(res => {
421 - console.log(TAG, '收藏点击 res', JSON.stringify(res))  
422 - console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))  
423 if (this.newsStatusOfUser) { 419 if (this.newsStatusOfUser) {
424 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 420 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
425 if (this.newsStatusOfUser.collectStatus === 1) { 421 if (this.newsStatusOfUser.collectStatus === 1) {
@@ -427,6 +423,7 @@ export struct OperRowListView { @@ -427,6 +423,7 @@ export struct OperRowListView {
427 } 423 }
428 this.queryContentInteractCount() 424 this.queryContentInteractCount()
429 } 425 }
  426 + console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
430 }) 427 })
431 428
432 } 429 }
@@ -4,7 +4,87 @@ import PageModel from '../viewmodel/PageModel'; @@ -4,7 +4,87 @@ import PageModel from '../viewmodel/PageModel';
4 import PageHelper from '../viewmodel/PageHelper'; 4 import PageHelper from '../viewmodel/PageHelper';
5 import PageAdModel from '../viewmodel/PageAdvModel'; 5 import PageAdModel from '../viewmodel/PageAdvModel';
6 import { LoadStatus } from '../components/refresh/RefreshLayoutBean'; 6 import { LoadStatus } from '../components/refresh/RefreshLayoutBean';
  7 +import { Logger } from 'wdKit/Index';
  8 +
  9 +/***********新的下拉、上拉手势 start **********/
  10 +export function onActionStart(pageModel: PageModel, pageAdvModel: PageAdModel, event?: GestureEvent) {
  11 + if (event === undefined) {
  12 + return
  13 + }
  14 + pageModel.downY = event.offsetY;
  15 + pageModel.lastMoveY = event.offsetY;
  16 +}
  17 +
  18 +export function onActionUpdate(pageModel: PageModel, pageAdvModel: PageAdModel, event?: GestureEvent) {
  19 + if (event === undefined) {
  20 + return
  21 + }
  22 + if ((pageModel.isRefreshing === true) || (pageModel.isLoading === true)) {
  23 + return;
  24 + }
  25 + let isDownPull = event.offsetY - pageModel.lastMoveY > 0;
  26 + if (((isDownPull === true) || (pageModel.isPullRefreshOperation === true)) &&
  27 + (pageModel.isCanLoadMore === false)) {
  28 + actionUpdatePullRefresh(pageModel, event);
  29 + } else {
  30 + actionUpdateLoadMore(pageModel, event);
  31 + }
  32 + pageModel.lastMoveY = event.offsetY;
  33 +}
  34 +
  35 +export function onActionEnd(pageModel: PageModel, pageAdvModel: PageAdModel) {
  36 + if ((pageModel.isRefreshing === true) || (pageModel.isLoading === true)) {
  37 + return;
  38 + }
  39 + if ((pageModel.isPullRefreshOperation === true)) {
  40 + touchUpPullRefresh(pageModel, pageAdvModel);
  41 + } else {
  42 + // touchUpLoadMore(pageModel);
  43 + }
  44 +}
  45 +
  46 +export function actionUpdatePullRefresh(pageModel: PageModel, event: GestureEvent) {
  47 + if (pageModel.startIndex === 0) {
  48 + pageModel.isPullRefreshOperation = true;
  49 + let height = vp2px(Const.CUSTOM_REFRESH_DECIDE_HEIGHT);
  50 + pageModel.offsetY = event.offsetY - pageModel.downY;
  51 + if (pageModel.offsetY >= height) {
  52 + pullRefreshState(pageModel, RefreshState.Release);
  53 + pageModel.offsetY = height + pageModel.offsetY * Const.Y_OFF_SET_COEFFICIENT;
  54 + } else {
  55 + pullRefreshState(pageModel, RefreshState.DropDown);
  56 + }
  57 + if (pageModel.offsetY < 0) {
  58 + pageModel.offsetY = 0;
  59 + pageModel.isPullRefreshOperation = false;
  60 + }
  61 + }
  62 +}
  63 +
  64 +export function actionUpdateLoadMore(model: PageModel, event: GestureEvent) {
  65 + // list size +1
  66 + if (model.endIndex >= model.compList.totalCount() - 3 && model.endIndex <= model.compList.totalCount()) {
  67 + // model.offsetY = event.touches[0].y - model.downY;
  68 + // if (Math.abs(model.offsetY) > vp2px(model.pullUpLoadHeight) / 2) {
  69 + // model.isCanLoadMore = true;
  70 + // model.isVisiblePullUpLoad = true;
  71 + // model.offsetY = -vp2px(model.pullUpLoadHeight) + model.offsetY * Const.Y_OFF_SET_COEFFICIENT;
  72 + // }
  73 +
  74 + // 不用分页动画,直接预加载
  75 + model.isCanLoadMore = true;
  76 + model.isVisiblePullUpLoad = true;
  77 + touchUpLoadMore(model);
  78 + }
  79 +}
  80 +
  81 +/***********新的下拉、上拉手势 end **********/
  82 +
  83 +
7 //下拉刷新上拉加载更多组件 84 //下拉刷新上拉加载更多组件
  85 +/**
  86 + * @deprecated
  87 + */
8 export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, event: TouchEvent) { 88 export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, event: TouchEvent) {
9 switch (event.type) { 89 switch (event.type) {
10 case TouchType.Down: 90 case TouchType.Down:
@@ -16,7 +96,8 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, @@ -16,7 +96,8 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel,
16 return; 96 return;
17 } 97 }
18 let isDownPull = event.touches[0].y - pageModel.lastMoveY > 0; 98 let isDownPull = event.touches[0].y - pageModel.lastMoveY > 0;
19 - if (((isDownPull === true) || (pageModel.isPullRefreshOperation === true)) && (pageModel.isCanLoadMore === false)) { 99 + if (((isDownPull === true) || (pageModel.isPullRefreshOperation === true)) &&
  100 + (pageModel.isCanLoadMore === false)) {
20 // Finger movement, processing pull-down refresh. 101 // Finger movement, processing pull-down refresh.
21 touchMovePullRefresh(pageModel, event); 102 touchMovePullRefresh(pageModel, event);
22 } else { 103 } else {
@@ -44,6 +125,9 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, @@ -44,6 +125,9 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel,
44 } 125 }
45 } 126 }
46 127
  128 +/**
  129 + * @deprecated
  130 + */
47 export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) { 131 export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) {
48 if (pageModel.startIndex === 0) { 132 if (pageModel.startIndex === 0) {
49 pageModel.isPullRefreshOperation = true; 133 pageModel.isPullRefreshOperation = true;