Showing
80 changed files
with
1457 additions
and
830 deletions
| @@ -220,14 +220,26 @@ export class ProcessUtils { | @@ -220,14 +220,26 @@ export class ProcessUtils { | ||
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | public static gotoDefaultWeb(content: ContentDTO) { | 222 | public static gotoDefaultWeb(content: ContentDTO) { |
| 223 | - let taskAction: Action = { | ||
| 224 | - type: 'JUMP_H5_BY_WEB_VIEW', | ||
| 225 | - params: { | ||
| 226 | - url: content.linkUrl, | ||
| 227 | - } as Params, | ||
| 228 | - }; | ||
| 229 | - WDRouterRule.jumpWithAction(taskAction) | ||
| 230 | - Logger.debug(TAG, `gotoWeb, ${content.objectId}`); | 223 | + |
| 224 | + // 内链 | ||
| 225 | + if(content.openType == '1'){ | ||
| 226 | + let taskAction: Action = { | ||
| 227 | + type: 'JUMP_H5_BY_WEB_VIEW', | ||
| 228 | + params: { | ||
| 229 | + url: content.linkUrl, | ||
| 230 | + } as Params, | ||
| 231 | + }; | ||
| 232 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 233 | + }else if(content.openType == '2') { | ||
| 234 | + // 外链 | ||
| 235 | + ProcessUtils.jumpExternalWebPage(content.linkUrl); | ||
| 236 | + }else { | ||
| 237 | + // 无需跳转 | ||
| 238 | + | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + | ||
| 242 | + Logger.debug(TAG, `gotoWeb, ${content.objectId}`) | ||
| 231 | } | 243 | } |
| 232 | 244 | ||
| 233 | static commentGotoWeb(content: commentInfo) { | 245 | static commentGotoWeb(content: commentInfo) { |
| @@ -18,7 +18,6 @@ export function handleJsCallAppService(data: Message, callback: (res: string) => | @@ -18,7 +18,6 @@ export function handleJsCallAppService(data: Message, callback: (res: string) => | ||
| 18 | if (queryString) { | 18 | if (queryString) { |
| 19 | url = url + `?${queryString}` | 19 | url = url + `?${queryString}` |
| 20 | } | 20 | } |
| 21 | - console.log('yzl', queryString, url) | ||
| 22 | WDHttp.get(url).then((res) => { | 21 | WDHttp.get(url).then((res) => { |
| 23 | callback(JSON.stringify({ | 22 | callback(JSON.stringify({ |
| 24 | netError: '0', | 23 | netError: '0', |
| @@ -15,6 +15,7 @@ export struct WdWebComponent { | @@ -15,6 +15,7 @@ export struct WdWebComponent { | ||
| 15 | onWebPrepared: () => void = () => { | 15 | onWebPrepared: () => void = () => { |
| 16 | } | 16 | } |
| 17 | @Prop webUrl: string = '' | 17 | @Prop webUrl: string = '' |
| 18 | + @Prop @Watch('onReloadStateChanged') reload: number = 0 | ||
| 18 | @Link isPageEnd: boolean | 19 | @Link isPageEnd: boolean |
| 19 | 20 | ||
| 20 | build() { | 21 | build() { |
| @@ -87,5 +88,11 @@ export struct WdWebComponent { | @@ -87,5 +88,11 @@ export struct WdWebComponent { | ||
| 87 | Logger.debug(TAG, 'onLoadIntercept return false'); | 88 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| 88 | return false | 89 | return false |
| 89 | } | 90 | } |
| 91 | + onReloadStateChanged() { | ||
| 92 | + Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); | ||
| 93 | + if (this.reload > 0) { | ||
| 94 | + this.webviewControl.refresh() | ||
| 95 | + } | ||
| 96 | + } | ||
| 90 | } | 97 | } |
| 91 | 98 |
| @@ -15,6 +15,7 @@ export struct WdWebLocalComponent { | @@ -15,6 +15,7 @@ export struct WdWebLocalComponent { | ||
| 15 | } | 15 | } |
| 16 | @Prop backVisibility: boolean = false | 16 | @Prop backVisibility: boolean = false |
| 17 | @Prop webResource: Resource = {} as Resource | 17 | @Prop webResource: Resource = {} as Resource |
| 18 | + @Prop @Watch('onReloadStateChanged') reload: number = 0 | ||
| 18 | @State webHeight: string | number = '100%' | 19 | @State webHeight: string | number = '100%' |
| 19 | @Link isPageEnd: boolean | 20 | @Link isPageEnd: boolean |
| 20 | @State videoUrl: string = '' | 21 | @State videoUrl: string = '' |
| @@ -240,5 +241,11 @@ export struct WdWebLocalComponent { | @@ -240,5 +241,11 @@ export struct WdWebLocalComponent { | ||
| 240 | Logger.debug(TAG, 'onLoadIntercept return false'); | 241 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| 241 | return false | 242 | return false |
| 242 | } | 243 | } |
| 244 | + onReloadStateChanged() { | ||
| 245 | + Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); | ||
| 246 | + if (this.reload > 0) { | ||
| 247 | + this.webviewControl.refresh() | ||
| 248 | + } | ||
| 249 | + } | ||
| 243 | } | 250 | } |
| 244 | 251 |
| @@ -10,73 +10,77 @@ | @@ -10,73 +10,77 @@ | ||
| 10 | /* | 10 | /* |
| 11 | 信息流广告素材解析累 | 11 | 信息流广告素材解析累 |
| 12 | */ | 12 | */ |
| 13 | -export interface CompAdvMatInfoBean { | 13 | +export class CompAdvMatInfoBean { |
| 14 | 14 | ||
| 15 | + id:number = 0 | ||
| 15 | /** | 16 | /** |
| 16 | * 广告标题 | 17 | * 广告标题 |
| 17 | */ | 18 | */ |
| 18 | - advTitle: string | 19 | + advTitle: string = '' |
| 19 | /** | 20 | /** |
| 20 | * 3:信息流广告 | 21 | * 3:信息流广告 |
| 21 | */ | 22 | */ |
| 22 | - advType: string | 23 | + advType: string ='' |
| 23 | /** | 24 | /** |
| 24 | * 信息流广告类型(4:轮播图 5:三图广告 6:小图广告 7:长通栏广告 8:大图广告 9:视频广告 10:展会广告 11:冠名广告 12:顶部长通栏广告) | 25 | * 信息流广告类型(4:轮播图 5:三图广告 6:小图广告 7:长通栏广告 8:大图广告 9:视频广告 10:展会广告 11:冠名广告 12:顶部长通栏广告) |
| 25 | */ | 26 | */ |
| 26 | - advSubType: number | 27 | + advSubType: number = 0 |
| 27 | /** | 28 | /** |
| 28 | * 素材图片信息;adv_subtype=4,5,6,7,8,9,12 时使用 | 29 | * 素材图片信息;adv_subtype=4,5,6,7,8,9,12 时使用 |
| 29 | */ | 30 | */ |
| 30 | - matImageUrl: string[] | 31 | + matImageUrl: string[] = [] |
| 31 | /** | 32 | /** |
| 32 | * 视频广告地址(adv_subtype=9) | 33 | * 视频广告地址(adv_subtype=9) |
| 33 | */ | 34 | */ |
| 34 | - matVideoUrl: string | 35 | + matVideoUrl: string = '' |
| 35 | /** | 36 | /** |
| 36 | * 扩展信息:advSubType=10,11时使用,字段示例见接口备注。 | 37 | * 扩展信息:advSubType=10,11时使用,字段示例见接口备注。 |
| 37 | */ | 38 | */ |
| 38 | - extraData: string | 39 | + extraData: string = '' |
| 39 | /** | 40 | /** |
| 40 | * 链接类型: 0:无链接;1:内链(文章);2:外链 | 41 | * 链接类型: 0:无链接;1:内链(文章);2:外链 |
| 41 | */ | 42 | */ |
| 42 | - linkType: string | 43 | + linkType: string = '' |
| 43 | /** | 44 | /** |
| 44 | * 链接跳转类型 :0-没链接,不用打开,1-端内打开,2-端外打开 | 45 | * 链接跳转类型 :0-没链接,不用打开,1-端内打开,2-端外打开 |
| 45 | */ | 46 | */ |
| 46 | - openType: string | 47 | + openType: string = '' |
| 47 | /** | 48 | /** |
| 48 | * 广告跳转链接 | 49 | * 广告跳转链接 |
| 49 | */ | 50 | */ |
| 50 | - linkUrl: string | 51 | + linkUrl: string = '' |
| 51 | /** | 52 | /** |
| 52 | * 素材类型(0:图片 1:视频) | 53 | * 素材类型(0:图片 1:视频) |
| 53 | */ | 54 | */ |
| 54 | - matType: string | 55 | + matType: string = '' |
| 55 | /** | 56 | /** |
| 56 | * 开屏样式(1:全屏样式 0:底部固定Logo) | 57 | * 开屏样式(1:全屏样式 0:底部固定Logo) |
| 57 | */ | 58 | */ |
| 58 | - startStyle: string | 59 | + startStyle: string = '' |
| 60 | + | ||
| 61 | + // 本地字段 | ||
| 62 | + originalPostion : number = -1 // 广告原始投放位置 | ||
| 59 | } | 63 | } |
| 60 | 64 | ||
| 61 | /** | 65 | /** |
| 62 | * 信息流广告位 | 66 | * 信息流广告位 |
| 63 | */ | 67 | */ |
| 64 | -export interface CompAdvSlotInfoBean { | 68 | +export class CompAdvSlotInfoBean { |
| 65 | 69 | ||
| 66 | 70 | ||
| 67 | /** | 71 | /** |
| 68 | * 组件id | 72 | * 组件id |
| 69 | */ | 73 | */ |
| 70 | - compId: string; | 74 | + compId: string = ''; |
| 71 | 75 | ||
| 72 | /** | 76 | /** |
| 73 | * 广告位位置 从1开始 | 77 | * 广告位位置 从1开始 |
| 74 | */ | 78 | */ |
| 75 | - position: number; | 79 | + position: number = 0; |
| 76 | 80 | ||
| 77 | /** | 81 | /** |
| 78 | * 频道id | 82 | * 频道id |
| 79 | */ | 83 | */ |
| 80 | - channelId: string; | 84 | + channelId: string = ''; |
| 81 | 85 | ||
| 82 | } | 86 | } |
| @@ -40,7 +40,7 @@ export class CompDTO implements BaseDTO { | @@ -40,7 +40,7 @@ export class CompDTO implements BaseDTO { | ||
| 40 | /** | 40 | /** |
| 41 | * 信息流广告素材 | 41 | * 信息流广告素材 |
| 42 | */ | 42 | */ |
| 43 | - matInfo: CompAdvMatInfoBean = {} as CompAdvMatInfoBean | 43 | + matInfo: CompAdvMatInfoBean = new CompAdvMatInfoBean |
| 44 | pageId?: string; | 44 | pageId?: string; |
| 45 | objectType?: string; | 45 | objectType?: string; |
| 46 | hasMore: number = 1 | 46 | hasMore: number = 1 |
| @@ -10,6 +10,7 @@ import { BaseDTO } from '../component/BaseDTO'; | @@ -10,6 +10,7 @@ import { BaseDTO } from '../component/BaseDTO'; | ||
| 10 | 10 | ||
| 11 | @Observed | 11 | @Observed |
| 12 | export class ContentDTO implements BaseDTO { | 12 | export class ContentDTO implements BaseDTO { |
| 13 | + shareFlag?:string='1'; | ||
| 13 | appStyle: string = ''; | 14 | appStyle: string = ''; |
| 14 | cityCode: string = ''; | 15 | cityCode: string = ''; |
| 15 | coverSize: string = ''; | 16 | coverSize: string = ''; |
| @@ -2,6 +2,8 @@ | @@ -2,6 +2,8 @@ | ||
| 2 | * page接口返回的Page数据DTO | 2 | * page接口返回的Page数据DTO |
| 3 | */ | 3 | */ |
| 4 | import { AdvRuleBean, CompAdvBean } from '../adv/AdvsRuleBean'; | 4 | import { AdvRuleBean, CompAdvBean } from '../adv/AdvsRuleBean'; |
| 5 | +import { ArrayList } from '@kit.ArkTS'; | ||
| 6 | +import { CompDTO } from '../component/CompDTO'; | ||
| 5 | 7 | ||
| 6 | export interface PageInfoDTO { | 8 | export interface PageInfoDTO { |
| 7 | pageId: string; // 页面id | 9 | pageId: string; // 页面id |
| @@ -27,6 +29,18 @@ export interface PageInfoDTO { | @@ -27,6 +29,18 @@ export interface PageInfoDTO { | ||
| 27 | */ | 29 | */ |
| 28 | cornersAdv2: CompAdvBean[] | 30 | cornersAdv2: CompAdvBean[] |
| 29 | 31 | ||
| 32 | + | ||
| 33 | + // 本地字段 | ||
| 34 | + /* | ||
| 35 | + 记录一次请求获取到的楼层comp数据,如 完成一次刷新到结束,获取所有楼层的稿件数据 | ||
| 36 | + */ | ||
| 37 | + oneRequestPageGroupCompList: ArrayList<CompDTO> | ||
| 38 | + | ||
| 39 | + /* | ||
| 40 | + 记录页面楼层所有的信息流广告数据 | ||
| 41 | + */ | ||
| 42 | + pageAdList:CompAdvBean[] | ||
| 43 | + | ||
| 30 | } | 44 | } |
| 31 | 45 | ||
| 32 | export interface ChannelInfoDTO { | 46 | export interface ChannelInfoDTO { |
| @@ -44,7 +44,7 @@ export struct CardParser { | @@ -44,7 +44,7 @@ export struct CardParser { | ||
| 44 | } else if (contentDTO.appStyle === CompStyle.Card_04) { | 44 | } else if (contentDTO.appStyle === CompStyle.Card_04) { |
| 45 | Card4Component({ compDTO: this.compDTO, contentDTO }) | 45 | Card4Component({ compDTO: this.compDTO, contentDTO }) |
| 46 | } else if (contentDTO.appStyle === CompStyle.Card_05) { | 46 | } else if (contentDTO.appStyle === CompStyle.Card_05) { |
| 47 | - Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy }) | 47 | + Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy, compDTO: this.compDTO }) |
| 48 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle | 48 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle |
| 49 | .Card_13) { | 49 | .Card_13) { |
| 50 | Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) | 50 | Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| @@ -30,23 +30,28 @@ export struct CarderInteraction { | @@ -30,23 +30,28 @@ export struct CarderInteraction { | ||
| 30 | this.likeBean['title'] = this.contentDetailData.newsTitle + '' | 30 | this.likeBean['title'] = this.contentDetailData.newsTitle + '' |
| 31 | this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' | 31 | this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' |
| 32 | this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' | 32 | this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' |
| 33 | + this.contentDTO.shareFlag = this.contentDTO.shareFlag?this.contentDTO.shareFlag:'1' | ||
| 34 | + console.log('是否显示分享',this.contentDTO.shareFlag) | ||
| 33 | } | 35 | } |
| 34 | 36 | ||
| 35 | build() { | 37 | build() { |
| 36 | Row() { | 38 | Row() { |
| 37 | - Row() { | ||
| 38 | - Image($r('app.media.CarderInteraction_share')) | ||
| 39 | - .width(18) | ||
| 40 | - .height(18) | ||
| 41 | - Text('分享') | ||
| 42 | - .margin({ left: 4 }) | ||
| 43 | - .fontSize(14) | ||
| 44 | - .fontColor('#666666') | 39 | + if(this.contentDTO.shareFlag === '1'){ |
| 40 | + Row() { | ||
| 41 | + Image($r('app.media.CarderInteraction_share')) | ||
| 42 | + .width(18) | ||
| 43 | + .height(18) | ||
| 44 | + Text('分享') | ||
| 45 | + .margin({ left: 4 }) | ||
| 46 | + .fontSize(14) | ||
| 47 | + .fontColor('#666666') | ||
| 48 | + } | ||
| 49 | + .justifyContent(FlexAlign.Center) | ||
| 50 | + .onClick(() => { | ||
| 51 | + WDShare.shareContent(this.contentDetailData) | ||
| 52 | + }) | ||
| 45 | } | 53 | } |
| 46 | - .justifyContent(FlexAlign.Center) | ||
| 47 | - .onClick(() => { | ||
| 48 | - WDShare.shareContent(this.contentDetailData) | ||
| 49 | - }) | 54 | + |
| 50 | 55 | ||
| 51 | Row() { | 56 | Row() { |
| 52 | Image($r('app.media.CarderInteraction_comment')) | 57 | Image($r('app.media.CarderInteraction_comment')) |
| @@ -66,11 +71,11 @@ export struct CarderInteraction { | @@ -66,11 +71,11 @@ export struct CarderInteraction { | ||
| 66 | } | 71 | } |
| 67 | .width('100%') | 72 | .width('100%') |
| 68 | .margin({ top: 11 }) | 73 | .margin({ top: 11 }) |
| 69 | - .padding({ | ||
| 70 | - left: 21, | ||
| 71 | - right: 21 | ||
| 72 | - }) | ||
| 73 | - .justifyContent(FlexAlign.SpaceBetween) | 74 | + // .padding({ |
| 75 | + // left: 21, | ||
| 76 | + // right: 21 | ||
| 77 | + // }) | ||
| 78 | + .justifyContent(FlexAlign.SpaceAround) | ||
| 74 | .alignItems(VerticalAlign.Center) | 79 | .alignItems(VerticalAlign.Center) |
| 75 | } | 80 | } |
| 76 | 81 |
| @@ -105,8 +105,10 @@ export struct CompParser { | @@ -105,8 +105,10 @@ export struct CompParser { | ||
| 105 | // ZhSingleColumn05({ compDTO: compDTO }) | 105 | // ZhSingleColumn05({ compDTO: compDTO }) |
| 106 | // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 106 | // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 107 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) { | 107 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) { |
| 108 | + Divider().strokeWidth(3).color('#ffffff').padding({ left: 16, right: 16 }).margin({top: -3}) | ||
| 109 | + Divider().strokeWidth(6).color('#f5f5f5') | ||
| 108 | ZhSingleColumn09({ compDTO: this.compDTO }) | 110 | ZhSingleColumn09({ compDTO: this.compDTO }) |
| 109 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 111 | + Divider().strokeWidth(6).color('#f5f5f5') |
| 110 | } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 | 112 | } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告 |
| 111 | AdvCardParser({ pageModel: this.pageModel, compDTO: this.compDTO }) | 113 | AdvCardParser({ pageModel: this.pageModel, compDTO: this.compDTO }) |
| 112 | //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 }) | 114 | //Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 }) |
| @@ -103,7 +103,7 @@ export struct DynamicDetailComponent { | @@ -103,7 +103,7 @@ export struct DynamicDetailComponent { | ||
| 103 | //分割线 | 103 | //分割线 |
| 104 | Image($r('app.media.ic_news_detail_division')) | 104 | Image($r('app.media.ic_news_detail_division')) |
| 105 | .width('100%') | 105 | .width('100%') |
| 106 | - .height($r('app.float.margin_7')) | 106 | + .height($r('app.float.margin_12')) |
| 107 | .padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) | 107 | .padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) |
| 108 | Stack({ alignContent: Alignment.Bottom }) { | 108 | Stack({ alignContent: Alignment.Bottom }) { |
| 109 | if (!this.isNetConnected) { | 109 | if (!this.isNetConnected) { |
| @@ -23,7 +23,6 @@ export struct ImageAndTextWebComponent { | @@ -23,7 +23,6 @@ export struct ImageAndTextWebComponent { | ||
| 23 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 23 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| 24 | private webPrepared = false; | 24 | private webPrepared = false; |
| 25 | private dataPrepared = false; | 25 | private dataPrepared = false; |
| 26 | - | ||
| 27 | async onDetailDataUpdated() { | 26 | async onDetailDataUpdated() { |
| 28 | if (this.action) { | 27 | if (this.action) { |
| 29 | let contentId: string = '' | 28 | let contentId: string = '' |
| @@ -96,6 +95,7 @@ export struct ImageAndTextWebComponent { | @@ -96,6 +95,7 @@ export struct ImageAndTextWebComponent { | ||
| 96 | Column() { | 95 | Column() { |
| 97 | WdWebLocalComponent({ | 96 | WdWebLocalComponent({ |
| 98 | webviewControl: this.webviewControl, | 97 | webviewControl: this.webviewControl, |
| 98 | + reload:this.reload, | ||
| 99 | webResource: $rawfile('apph5/index.html'), | 99 | webResource: $rawfile('apph5/index.html'), |
| 100 | backVisibility: false, | 100 | backVisibility: false, |
| 101 | onWebPrepared: this.onWebPrepared.bind(this), | 101 | onWebPrepared: this.onWebPrepared.bind(this), |
| @@ -25,6 +25,7 @@ export struct ImageDownloadComponent { | @@ -25,6 +25,7 @@ export struct ImageDownloadComponent { | ||
| 25 | build() { | 25 | build() { |
| 26 | Column() { | 26 | Column() { |
| 27 | SaveButton({ icon: SaveIconStyle.LINES }) | 27 | SaveButton({ icon: SaveIconStyle.LINES }) |
| 28 | + .iconSize(24) | ||
| 28 | .iconColor(Color.White) | 29 | .iconColor(Color.White) |
| 29 | .onClick(async () => { | 30 | .onClick(async () => { |
| 30 | console.info(`cj2024 onClick ${this.imageBuffer}`) | 31 | console.info(`cj2024 onClick ${this.imageBuffer}`) |
| 1 | import { ContentDTO } from 'wdBean/Index'; | 1 | import { ContentDTO } from 'wdBean/Index'; |
| 2 | import { ProcessUtils } from 'wdRouter/Index'; | 2 | import { ProcessUtils } from 'wdRouter/Index'; |
| 3 | import { InteractMessageModel } from '../../model/InteractMessageModel' | 3 | import { InteractMessageModel } from '../../model/InteractMessageModel' |
| 4 | - | 4 | +import { DateTimeUtils} from 'wdKit/Index' |
| 5 | @Component | 5 | @Component |
| 6 | export struct InteractMComponent { | 6 | export struct InteractMComponent { |
| 7 | messageModel:InteractMessageModel = new InteractMessageModel; | 7 | messageModel:InteractMessageModel = new InteractMessageModel; |
| @@ -15,6 +15,7 @@ export struct InteractMComponent { | @@ -15,6 +15,7 @@ export struct InteractMComponent { | ||
| 15 | build() { | 15 | build() { |
| 16 | Row(){ | 16 | Row(){ |
| 17 | Image(this.messageModel.InteractMsubM.headUrl) | 17 | Image(this.messageModel.InteractMsubM.headUrl) |
| 18 | + .alt($r('app.media.default_head')) | ||
| 18 | .width(36) | 19 | .width(36) |
| 19 | .height(36) | 20 | .height(36) |
| 20 | .borderRadius(18) | 21 | .borderRadius(18) |
| @@ -29,7 +30,7 @@ export struct InteractMComponent { | @@ -29,7 +30,7 @@ export struct InteractMComponent { | ||
| 29 | .margin({left:5}) | 30 | .margin({left:5}) |
| 30 | }.width('100%') | 31 | }.width('100%') |
| 31 | 32 | ||
| 32 | - Text(this.messageModel.time) | 33 | + Text(this.getPublishTime(this.messageModel.time,DateTimeUtils.getDateTimestamp(this.messageModel.time)+"")) |
| 33 | .margin({top:2}) | 34 | .margin({top:2}) |
| 34 | .fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10}) | 35 | .fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10}) |
| 35 | 36 | ||
| @@ -41,42 +42,44 @@ export struct InteractMComponent { | @@ -41,42 +42,44 @@ export struct InteractMComponent { | ||
| 41 | .constraintSize({maxHeight:500}) | 42 | .constraintSize({maxHeight:500}) |
| 42 | } | 43 | } |
| 43 | 44 | ||
| 44 | - Column(){ | ||
| 45 | - if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){ | ||
| 46 | - Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500}) | ||
| 47 | - .margin({top:15,bottom:10}) | ||
| 48 | - .width('100%') | 45 | + if(this.messageModel.contentType != '211'){ |
| 46 | + Column(){ | ||
| 47 | + if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){ | ||
| 48 | + Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500}) | ||
| 49 | + .margin({top:15,bottom:10}) | ||
| 50 | + .width('100%') | ||
| 49 | 51 | ||
| 50 | - Divider() | ||
| 51 | - .color('#EDEDED') | ||
| 52 | - .backgroundColor('#EDEDED') | ||
| 53 | - .width('100%') | ||
| 54 | - .height(1) | ||
| 55 | - } | ||
| 56 | - Row(){ | ||
| 57 | - Image($r('app.media.MessageOriginTextIcon')) | ||
| 58 | - .width('12') | ||
| 59 | - .height('12') | ||
| 60 | - Text(this.messageModel.InteractMsubM.contentTitle) | ||
| 61 | - .fontSize('12fp') | ||
| 62 | - .fontColor('#666666') | ||
| 63 | - .maxLines(1) | ||
| 64 | - .width('90%') | ||
| 65 | - .textOverflow({overflow:TextOverflow.Ellipsis}) | 52 | + Divider() |
| 53 | + .color('#EDEDED') | ||
| 54 | + .backgroundColor('#EDEDED') | ||
| 55 | + .width('100%') | ||
| 56 | + .height(1) | ||
| 57 | + } | ||
| 58 | + Row(){ | ||
| 59 | + Image($r('app.media.MessageOriginTextIcon')) | ||
| 60 | + .width('12') | ||
| 61 | + .height('12') | ||
| 62 | + Text(this.messageModel.InteractMsubM.contentTitle) | ||
| 63 | + .fontSize('12fp') | ||
| 64 | + .fontColor('#666666') | ||
| 65 | + .maxLines(1) | ||
| 66 | + .width('90%') | ||
| 67 | + .textOverflow({overflow:TextOverflow.Ellipsis}) | ||
| 66 | 68 | ||
| 67 | - Blank() | 69 | + Blank() |
| 68 | 70 | ||
| 69 | - Image($r('app.media.mine_user_edit')) | ||
| 70 | - .width('12') | ||
| 71 | - .height('12') | ||
| 72 | - }.margin({top:10,bottom:15}) | ||
| 73 | - }.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5) | ||
| 74 | - .onClick(()=>{ | ||
| 75 | - let contentDTO :ContentDTO = new ContentDTO(); | ||
| 76 | - contentDTO.objectType = this.messageModel.InteractMsubM.contentType | ||
| 77 | - contentDTO.objectId = this.messageModel.InteractMsubM.contentId | ||
| 78 | - ProcessUtils.processPage(contentDTO) | ||
| 79 | - }) | 71 | + Image($r('app.media.mine_user_edit')) |
| 72 | + .width('12') | ||
| 73 | + .height('12') | ||
| 74 | + }.margin({top:10,bottom:15}) | ||
| 75 | + }.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5) | ||
| 76 | + .onClick(()=>{ | ||
| 77 | + let contentDTO :ContentDTO = new ContentDTO(); | ||
| 78 | + contentDTO.objectType = this.messageModel.InteractMsubM.contentType | ||
| 79 | + contentDTO.objectId = this.messageModel.InteractMsubM.contentId | ||
| 80 | + ProcessUtils.processPage(contentDTO) | ||
| 81 | + }) | ||
| 82 | + } | ||
| 80 | }.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%') | 83 | }.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%') |
| 81 | }.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top) | 84 | }.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top) |
| 82 | } | 85 | } |
| @@ -102,4 +105,49 @@ export struct InteractMComponent { | @@ -102,4 +105,49 @@ export struct InteractMComponent { | ||
| 102 | let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply; | 105 | let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply; |
| 103 | return contentString; | 106 | return contentString; |
| 104 | } | 107 | } |
| 108 | + | ||
| 109 | + getPublishTime(data:string,publishTime: string): string { | ||
| 110 | + const publishTimestamp = parseInt(publishTime) | ||
| 111 | + const currentTime = Date.now(); // 当前时间戳 | ||
| 112 | + | ||
| 113 | + // 计算差异 | ||
| 114 | + const timeDifference = currentTime - publishTimestamp; | ||
| 115 | + | ||
| 116 | + // 转换为分钟、小时和天 | ||
| 117 | + const minutes = Math.floor(timeDifference / (1000 * 60)); | ||
| 118 | + const hours = Math.floor(timeDifference / (1000 * 60 * 60)); | ||
| 119 | + const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24)); | ||
| 120 | + | ||
| 121 | + // 根据时间差返回对应的字符串 | ||
| 122 | + let result: string; | ||
| 123 | + | ||
| 124 | + if (minutes < 60) { | ||
| 125 | + result = `${minutes}分钟前`; | ||
| 126 | + if (minutes === 0) { | ||
| 127 | + result = `刚刚`; | ||
| 128 | + } | ||
| 129 | + } else if (hours < 24) { | ||
| 130 | + result = `${hours}小时前`; | ||
| 131 | + } else { | ||
| 132 | + result = `${days}天前`; | ||
| 133 | + if (days > 1) { | ||
| 134 | + let arr = data.split(" ") | ||
| 135 | + if (arr.length === 2) { | ||
| 136 | + let arr2 = arr[0].split("-") | ||
| 137 | + if (arr2.length === 3) { | ||
| 138 | + result = `${arr2[1]}-${arr2[2]}` | ||
| 139 | + } | ||
| 140 | + } else { | ||
| 141 | + //原始数据是时间戳 需要转成dateString | ||
| 142 | + let time = DateTimeUtils.formatDate(Number(publishTime)) | ||
| 143 | + let arr = time.split("-") | ||
| 144 | + if (arr.length === 3) { | ||
| 145 | + result = `${arr[1]}-${arr[2]}` | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + console.log(result); | ||
| 151 | + return result | ||
| 152 | + } | ||
| 105 | } | 153 | } |
| @@ -21,6 +21,8 @@ import { effectKit } from '@kit.ArkGraphics2D'; | @@ -21,6 +21,8 @@ import { effectKit } from '@kit.ArkGraphics2D'; | ||
| 21 | import { window } from '@kit.ArkUI'; | 21 | import { window } from '@kit.ArkUI'; |
| 22 | import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; | 22 | import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; |
| 23 | import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel' | 23 | import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel' |
| 24 | +import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare' | ||
| 25 | +import { common } from '@kit.AbilityKit'; | ||
| 24 | 26 | ||
| 25 | const TAG = 'MorningEveningPaperComponent'; | 27 | const TAG = 'MorningEveningPaperComponent'; |
| 26 | 28 | ||
| @@ -126,6 +128,10 @@ export struct MorningEveningPaperComponent { | @@ -126,6 +128,10 @@ export struct MorningEveningPaperComponent { | ||
| 126 | // let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId) | 128 | // let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId) |
| 127 | let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091" | 129 | let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091" |
| 128 | this.pageInfoBean = pageInfoBean; | 130 | this.pageInfoBean = pageInfoBean; |
| 131 | + //早晚报意图上报 | ||
| 132 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 133 | + viewColumInsightIntentShare(context,String(dailyPaperTopicPageId), this.pageInfoBean) | ||
| 134 | + | ||
| 129 | this.title = this.pageInfoBean?.topicInfo?.title | 135 | this.title = this.pageInfoBean?.topicInfo?.title |
| 130 | let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN) | 136 | let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN) |
| 131 | const dateShow = new Date(dateTime) | 137 | const dateShow = new Date(dateTime) |
| @@ -20,6 +20,7 @@ export struct SpacialTopicPageComponent { | @@ -20,6 +20,7 @@ export struct SpacialTopicPageComponent { | ||
| 20 | action: Action = {} as Action | 20 | action: Action = {} as Action |
| 21 | @State webUrl: string = ''; | 21 | @State webUrl: string = ''; |
| 22 | @State isPageEnd: boolean = false | 22 | @State isPageEnd: boolean = false |
| 23 | + @Prop reload: number = 0; | ||
| 23 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 24 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 24 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 25 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| 25 | private webPrepared = false; | 26 | private webPrepared = false; |
| @@ -101,6 +102,7 @@ export struct SpacialTopicPageComponent { | @@ -101,6 +102,7 @@ export struct SpacialTopicPageComponent { | ||
| 101 | WdWebComponent({ | 102 | WdWebComponent({ |
| 102 | webviewControl: this.webviewControl, | 103 | webviewControl: this.webviewControl, |
| 103 | webUrl: this.webUrl, | 104 | webUrl: this.webUrl, |
| 105 | + reload: this.reload, | ||
| 104 | onWebPrepared: this.onWebPrepared.bind(this), | 106 | onWebPrepared: this.onWebPrepared.bind(this), |
| 105 | isPageEnd: $isPageEnd, | 107 | isPageEnd: $isPageEnd, |
| 106 | }) | 108 | }) |
| @@ -132,12 +134,6 @@ export struct SpacialTopicPageComponent { | @@ -132,12 +134,6 @@ export struct SpacialTopicPageComponent { | ||
| 132 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 134 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 133 | } | 135 | } |
| 134 | 136 | ||
| 135 | - onPageShow() { | ||
| 136 | - if (!this.action?.params?.backVisibility) { | ||
| 137 | - WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 138 | - } | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | aboutToAppear() { | 137 | aboutToAppear() { |
| 142 | if (!this.action?.params?.backVisibility) { | 138 | if (!this.action?.params?.backVisibility) { |
| 143 | WindowModel.shared.setWindowLayoutFullScreen(true) | 139 | WindowModel.shared.setWindowLayoutFullScreen(true) |
| @@ -146,12 +142,6 @@ export struct SpacialTopicPageComponent { | @@ -146,12 +142,6 @@ export struct SpacialTopicPageComponent { | ||
| 146 | this.getDetail() | 142 | this.getDetail() |
| 147 | } | 143 | } |
| 148 | 144 | ||
| 149 | - onPageHide() { | ||
| 150 | - if (!this.action?.params?.backVisibility) { | ||
| 151 | - WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 152 | - } | ||
| 153 | - } | ||
| 154 | - | ||
| 155 | aboutToDisappear() { | 145 | aboutToDisappear() { |
| 156 | if (!this.action?.params?.backVisibility) { | 146 | if (!this.action?.params?.backVisibility) { |
| 157 | WindowModel.shared.setWindowLayoutFullScreen(false) | 147 | WindowModel.shared.setWindowLayoutFullScreen(false) |
| @@ -11,19 +11,19 @@ export struct CardSourceInfo { | @@ -11,19 +11,19 @@ export struct CardSourceInfo { | ||
| 11 | Flex() { | 11 | Flex() { |
| 12 | if (this.contentDTO.corner) { | 12 | if (this.contentDTO.corner) { |
| 13 | Text(this.contentDTO.corner) | 13 | Text(this.contentDTO.corner) |
| 14 | - .fontSize($r("app.float.font_size_12")) | 14 | + .fontSize($r("app.float.font_size_11")) |
| 15 | .fontColor($r("app.color.color_ED2800")) | 15 | .fontColor($r("app.color.color_ED2800")) |
| 16 | .margin({ right: 2 }) | 16 | .margin({ right: 2 }) |
| 17 | } | 17 | } |
| 18 | if (this.contentDTO.rmhPlatform === 1) { | 18 | if (this.contentDTO.rmhPlatform === 1) { |
| 19 | Text(this.contentDTO.rmhInfo?.rmhName) | 19 | Text(this.contentDTO.rmhInfo?.rmhName) |
| 20 | - .fontSize($r("app.float.font_size_12")) | 20 | + .fontSize($r("app.float.font_size_11")) |
| 21 | .fontColor($r("app.color.color_B0B0B0")) | 21 | .fontColor($r("app.color.color_B0B0B0")) |
| 22 | .maxLines(1) | 22 | .maxLines(1) |
| 23 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 23 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 24 | } else if (this.contentDTO.source) { | 24 | } else if (this.contentDTO.source) { |
| 25 | Text(`${this.contentDTO.source}`) | 25 | Text(`${this.contentDTO.source}`) |
| 26 | - .fontSize($r("app.float.font_size_12")) | 26 | + .fontSize($r("app.float.font_size_11")) |
| 27 | .fontColor($r("app.color.color_B0B0B0")) | 27 | .fontColor($r("app.color.color_B0B0B0")) |
| 28 | .maxLines(1) | 28 | .maxLines(1) |
| 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| @@ -43,13 +43,13 @@ export struct CardSourceInfo { | @@ -43,13 +43,13 @@ export struct CardSourceInfo { | ||
| 43 | .height(16) | 43 | .height(16) |
| 44 | } | 44 | } |
| 45 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | 45 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 46 | - .fontSize($r("app.float.font_size_12")) | 46 | + .fontSize($r("app.float.font_size_11")) |
| 47 | .fontColor($r("app.color.color_B0B0B0")) | 47 | .fontColor($r("app.color.color_B0B0B0")) |
| 48 | .flexShrink(0) | 48 | .flexShrink(0) |
| 49 | } | 49 | } |
| 50 | if (this.getContentDtoBean()?.interactData?.commentNum) { | 50 | if (this.getContentDtoBean()?.interactData?.commentNum) { |
| 51 | Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`) | 51 | Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`) |
| 52 | - .fontSize($r("app.float.font_size_12")) | 52 | + .fontSize($r("app.float.font_size_11")) |
| 53 | .fontColor($r("app.color.color_B0B0B0")) | 53 | .fontColor($r("app.color.color_B0B0B0")) |
| 54 | .flexShrink(0) | 54 | .flexShrink(0) |
| 55 | .margin({ left: 6 }) | 55 | .margin({ left: 6 }) |
| @@ -66,10 +66,10 @@ export struct CardSourceInfo { | @@ -66,10 +66,10 @@ export struct CardSourceInfo { | ||
| 66 | */ | 66 | */ |
| 67 | private getContentDtoBean(): ContentDTO { | 67 | private getContentDtoBean(): ContentDTO { |
| 68 | if (this.compDTO == undefined) { | 68 | if (this.compDTO == undefined) { |
| 69 | - return new ContentDTO | 69 | + return this.contentDTO |
| 70 | } | 70 | } |
| 71 | if(this.compDTO.operDataList.length == 0){ | 71 | if(this.compDTO.operDataList.length == 0){ |
| 72 | - return new ContentDTO | 72 | + return this.contentDTO |
| 73 | } | 73 | } |
| 74 | return this.compDTO.operDataList[0] | 74 | return this.compDTO.operDataList[0] |
| 75 | } | 75 | } |
| @@ -13,11 +13,13 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | @@ -13,11 +13,13 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 13 | import router from '@ohos.router' | 13 | import router from '@ohos.router' |
| 14 | import { postBatchAttentionStatusParams } from 'wdBean/Index'; | 14 | import { postBatchAttentionStatusParams } from 'wdBean/Index'; |
| 15 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel' | 15 | import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel' |
| 16 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 16 | 17 | ||
| 17 | @Component | 18 | @Component |
| 18 | export struct RmhTitle { | 19 | export struct RmhTitle { |
| 19 | @Prop rmhInfo: RmhInfoDTO | 20 | @Prop rmhInfo: RmhInfoDTO |
| 20 | @Prop publishTime: string | undefined | 21 | @Prop publishTime: string | undefined |
| 22 | + @State loadImg: boolean = false; | ||
| 21 | /** | 23 | /** |
| 22 | * 是否需要隐藏发布时间超过2天的时间展示,默认不隐藏 | 24 | * 是否需要隐藏发布时间超过2天的时间展示,默认不隐藏 |
| 23 | */ | 25 | */ |
| @@ -76,13 +78,15 @@ export struct RmhTitle { | @@ -76,13 +78,15 @@ export struct RmhTitle { | ||
| 76 | } | 78 | } |
| 77 | } | 79 | } |
| 78 | 80 | ||
| 79 | - aboutToAppear(): void { | 81 | + async aboutToAppear(): Promise<void> { |
| 80 | this.getBatchAttentionStatus() | 82 | this.getBatchAttentionStatus() |
| 81 | 83 | ||
| 82 | let page = router.getState(); | 84 | let page = router.getState(); |
| 83 | if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) { | 85 | if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) { |
| 84 | this.hideTime = true; | 86 | this.hideTime = true; |
| 85 | } | 87 | } |
| 88 | + | ||
| 89 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 86 | } | 90 | } |
| 87 | 91 | ||
| 88 | getDaysBetweenDates(date: number) { | 92 | getDaysBetweenDates(date: number) { |
| @@ -96,7 +100,7 @@ export struct RmhTitle { | @@ -96,7 +100,7 @@ export struct RmhTitle { | ||
| 96 | build() { | 100 | build() { |
| 97 | Flex() { | 101 | Flex() { |
| 98 | Stack() { | 102 | Stack() { |
| 99 | - Image(this.rmhInfo?.rmhHeadUrl) | 103 | + Image(this.loadImg ? this.rmhInfo?.rmhHeadUrl : $r('app.media.comment_rmh_tag')) |
| 100 | .width(36) | 104 | .width(36) |
| 101 | .height(36).borderRadius(50) | 105 | .height(36).borderRadius(50) |
| 102 | Image(this.rmhInfo?.authIcon) | 106 | Image(this.rmhInfo?.authIcon) |
| @@ -54,7 +54,7 @@ export struct CardAdvBottom { | @@ -54,7 +54,7 @@ export struct CardAdvBottom { | ||
| 54 | let currentIndex = -1 | 54 | let currentIndex = -1 |
| 55 | for (let i = 0; i < this.pageModel.compList.size(); i++) { | 55 | for (let i = 0; i < this.pageModel.compList.size(); i++) { |
| 56 | let b = this.pageModel.compList.getData(i) as CompDTO | 56 | let b = this.pageModel.compList.getData(i) as CompDTO |
| 57 | - if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) { | 57 | + if (a.compStyle == b.compStyle && a.matInfo.id == b.matInfo.id && a.matInfo.originalPostion == b.matInfo.originalPostion) { |
| 58 | currentIndex = i | 58 | currentIndex = i |
| 59 | break; | 59 | break; |
| 60 | } | 60 | } |
| @@ -66,7 +66,7 @@ export struct CardAdvTop { | @@ -66,7 +66,7 @@ export struct CardAdvTop { | ||
| 66 | let currentIndex = -1 | 66 | let currentIndex = -1 |
| 67 | for (let i = 0; i < this.pageModel.compList.size(); i++) { | 67 | for (let i = 0; i < this.pageModel.compList.size(); i++) { |
| 68 | let b = this.pageModel.compList.getData(i) as CompDTO | 68 | let b = this.pageModel.compList.getData(i) as CompDTO |
| 69 | - if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) { | 69 | + if (a.compStyle == b.compStyle && a.matInfo.id == b.matInfo.id && a.matInfo.originalPostion == b.matInfo.originalPostion) { |
| 70 | currentIndex = i | 70 | currentIndex = i |
| 71 | break; | 71 | break; |
| 72 | } | 72 | } |
| @@ -51,7 +51,7 @@ export struct Card10Component { | @@ -51,7 +51,7 @@ export struct Card10Component { | ||
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | .width(CommonConstants.FULL_WIDTH) | 53 | .width(CommonConstants.FULL_WIDTH) |
| 54 | - .fontSize($r('app.float.font_size_17')) | 54 | + .fontSize($r('app.float.font_size_18')) |
| 55 | .fontWeight(600) | 55 | .fontWeight(600) |
| 56 | .maxLines(2) | 56 | .maxLines(2) |
| 57 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 57 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| @@ -52,7 +52,7 @@ export struct Card11Component { | @@ -52,7 +52,7 @@ export struct Card11Component { | ||
| 52 | Span(this.contentDTO.newsTitle) | 52 | Span(this.contentDTO.newsTitle) |
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | - .fontSize($r("app.float.font_size_16")) | 55 | + .fontSize($r("app.float.font_size_18")) |
| 56 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) | 56 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 57 | .maxLines(3) | 57 | .maxLines(3) |
| 58 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 58 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| @@ -50,7 +50,7 @@ export struct Card12Component { | @@ -50,7 +50,7 @@ export struct Card12Component { | ||
| 50 | Span(this.contentDTO.newsTitle) | 50 | Span(this.contentDTO.newsTitle) |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | - .fontSize($r('app.float.font_size_17')) | 53 | + .fontSize($r('app.float.font_size_18')) |
| 54 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 54 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 55 | .width(CommonConstants.FULL_WIDTH) | 55 | .width(CommonConstants.FULL_WIDTH) |
| 56 | .textOverflowStyle(3) | 56 | .textOverflowStyle(3) |
| @@ -54,7 +54,7 @@ export struct Card14Component { | @@ -54,7 +54,7 @@ export struct Card14Component { | ||
| 54 | Span(this.contentDTO.newsTitle) | 54 | Span(this.contentDTO.newsTitle) |
| 55 | } | 55 | } |
| 56 | } | 56 | } |
| 57 | - .fontSize($r('app.float.font_size_17')) | 57 | + .fontSize($r('app.float.font_size_18')) |
| 58 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 58 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 59 | .textOverflowStyle(3) | 59 | .textOverflowStyle(3) |
| 60 | .lineHeight(25) | 60 | .lineHeight(25) |
| @@ -55,7 +55,7 @@ export struct Card15Component { | @@ -55,7 +55,7 @@ export struct Card15Component { | ||
| 55 | Span(this.contentDTO.newsTitle) | 55 | Span(this.contentDTO.newsTitle) |
| 56 | } | 56 | } |
| 57 | } | 57 | } |
| 58 | - .fontSize($r('app.float.font_size_17')) | 58 | + .fontSize($r('app.float.font_size_18')) |
| 59 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 59 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 60 | .width(CommonConstants.FULL_WIDTH) | 60 | .width(CommonConstants.FULL_WIDTH) |
| 61 | .textOverflowStyle(2) | 61 | .textOverflowStyle(2) |
| @@ -58,7 +58,7 @@ export struct Card16Component { | @@ -58,7 +58,7 @@ export struct Card16Component { | ||
| 58 | Span(this.contentDTO.newsTitle) | 58 | Span(this.contentDTO.newsTitle) |
| 59 | } | 59 | } |
| 60 | } | 60 | } |
| 61 | - .fontSize($r('app.float.font_size_17')) | 61 | + .fontSize($r('app.float.font_size_18')) |
| 62 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 62 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 63 | .width(CommonConstants.FULL_WIDTH) | 63 | .width(CommonConstants.FULL_WIDTH) |
| 64 | .textOverflowStyle(2) | 64 | .textOverflowStyle(2) |
| @@ -49,7 +49,7 @@ export struct Card17Component { | @@ -49,7 +49,7 @@ export struct Card17Component { | ||
| 49 | } | 49 | } |
| 50 | } | 50 | } |
| 51 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 51 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 52 | - .fontSize($r('app.float.font_size_17')) | 52 | + .fontSize($r('app.float.font_size_18')) |
| 53 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 53 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 54 | .lineHeight(25) | 54 | .lineHeight(25) |
| 55 | .maxLines(3) | 55 | .maxLines(3) |
| @@ -21,6 +21,7 @@ export struct Card19Component { | @@ -21,6 +21,7 @@ export struct Card19Component { | ||
| 21 | 21 | ||
| 22 | async aboutToAppear(): Promise<void> { | 22 | async aboutToAppear(): Promise<void> { |
| 23 | this.titleInit(); | 23 | this.titleInit(); |
| 24 | + console.log('card19',JSON.stringify(this.contentDTO)) | ||
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | titleInit() { | 27 | titleInit() { |
| @@ -48,12 +49,12 @@ export struct Card19Component { | @@ -48,12 +49,12 @@ export struct Card19Component { | ||
| 48 | Span(this.contentDTO.newsTitle) | 49 | Span(this.contentDTO.newsTitle) |
| 49 | } | 50 | } |
| 50 | } | 51 | } |
| 51 | - .fontSize($r('app.float.font_size_17')) | 52 | + .fontSize($r('app.float.font_size_18')) |
| 52 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 53 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 53 | .textOverflowStyle(3) | 54 | .textOverflowStyle(3) |
| 54 | .margin({ bottom: 8 }) | 55 | .margin({ bottom: 8 }) |
| 55 | .width(CommonConstants.FULL_WIDTH) | 56 | .width(CommonConstants.FULL_WIDTH) |
| 56 | - .lineHeight(22) | 57 | + .lineHeight(25) |
| 57 | .onClick((event: ClickEvent) => { | 58 | .onClick((event: ClickEvent) => { |
| 58 | this.clicked = true; | 59 | this.clicked = true; |
| 59 | ProcessUtils.processPage(this.contentDTO) | 60 | ProcessUtils.processPage(this.contentDTO) |
| @@ -66,7 +67,7 @@ export struct Card19Component { | @@ -66,7 +67,7 @@ export struct Card19Component { | ||
| 66 | const photo: PhotoListBean = { | 67 | const photo: PhotoListBean = { |
| 67 | width: item.weight, | 68 | width: item.weight, |
| 68 | height: item.height, | 69 | height: item.height, |
| 69 | - picPath: item.fullUrl, | 70 | + picPath: item.fullUrl||item.url, |
| 70 | picDesc: '' | 71 | picDesc: '' |
| 71 | } | 72 | } |
| 72 | return photo | 73 | return photo |
| @@ -110,6 +111,7 @@ struct createImg { | @@ -110,6 +111,7 @@ struct createImg { | ||
| 110 | fullUrl: '' | 111 | fullUrl: '' |
| 111 | } as FullColumnImgUrlDTO) | 112 | } as FullColumnImgUrlDTO) |
| 112 | } | 113 | } |
| 114 | + console.log('card19-this.fullColumnImgUrls',JSON.stringify(this.fullColumnImgUrls)) | ||
| 113 | } | 115 | } |
| 114 | 116 | ||
| 115 | caclImageRadius(index: number) { | 117 | caclImageRadius(index: number) { |
| @@ -163,14 +165,14 @@ struct createImg { | @@ -163,14 +165,14 @@ struct createImg { | ||
| 163 | alignContent: Alignment.BottomEnd | 165 | alignContent: Alignment.BottomEnd |
| 164 | }) { | 166 | }) { |
| 165 | if (this.getPicType() === 1) { | 167 | if (this.getPicType() === 1) { |
| 166 | - Image(this.loadImg ? item.fullUrl : '') | 168 | + Image(this.loadImg ? item.fullUrl||item.url : '') |
| 167 | .backgroundColor(0xf5f5f5) | 169 | .backgroundColor(0xf5f5f5) |
| 168 | .width('100%') | 170 | .width('100%') |
| 169 | .height(172) | 171 | .height(172) |
| 170 | .autoResize(true) | 172 | .autoResize(true) |
| 171 | .borderRadius(this.caclImageRadius(index)) | 173 | .borderRadius(this.caclImageRadius(index)) |
| 172 | } else if (this.getPicType() === 2) { | 174 | } else if (this.getPicType() === 2) { |
| 173 | - Image(this.loadImg ? item.fullUrl : '') | 175 | + Image(this.loadImg ? item.fullUrl||item.url : '') |
| 174 | .width('100%') | 176 | .width('100%') |
| 175 | .height(305) | 177 | .height(305) |
| 176 | .autoResize(true) | 178 | .autoResize(true) |
| @@ -50,7 +50,7 @@ export struct Card20Component { | @@ -50,7 +50,7 @@ export struct Card20Component { | ||
| 50 | Span(this.contentDTO.newsTitle) | 50 | Span(this.contentDTO.newsTitle) |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | - .fontSize($r('app.float.font_size_17')) | 53 | + .fontSize($r('app.float.font_size_18')) |
| 54 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 54 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 55 | .width(CommonConstants.FULL_WIDTH) | 55 | .width(CommonConstants.FULL_WIDTH) |
| 56 | .textOverflowStyle(3) | 56 | .textOverflowStyle(3) |
| @@ -52,7 +52,7 @@ export struct Card21Component { | @@ -52,7 +52,7 @@ export struct Card21Component { | ||
| 52 | Span(this.contentDTO.newsTitle) | 52 | Span(this.contentDTO.newsTitle) |
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | - .fontSize($r('app.float.selected_text_size')) | 55 | + .fontSize(18) |
| 56 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 56 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 57 | .width(CommonConstants.FULL_WIDTH) | 57 | .width(CommonConstants.FULL_WIDTH) |
| 58 | .maxLines(4) | 58 | .maxLines(4) |
| @@ -7,7 +7,6 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | @@ -7,7 +7,6 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | ||
| 7 | import { Notes } from './notes'; | 7 | import { Notes } from './notes'; |
| 8 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 8 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 9 | // import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; | 9 | // import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; |
| 10 | - | ||
| 11 | const TAG: string = 'Card2Component'; | 10 | const TAG: string = 'Card2Component'; |
| 12 | 11 | ||
| 13 | /** | 12 | /** |
| @@ -48,8 +47,10 @@ export struct Card2Component { | @@ -48,8 +47,10 @@ export struct Card2Component { | ||
| 48 | Column() { | 47 | Column() { |
| 49 | Stack() { | 48 | Stack() { |
| 50 | //新闻标题 | 49 | //新闻标题 |
| 51 | - if (this.contentDTO.objectType == '5') { | ||
| 52 | - Notes({ objectType: this.contentDTO.objectType }) | 50 | + if (this.contentDTO.newTags) { |
| 51 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 52 | + } else if (this.contentDTO.objectType == '5') { | ||
| 53 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | Text() { | 56 | Text() { |
| @@ -62,14 +63,18 @@ export struct Card2Component { | @@ -62,14 +63,18 @@ export struct Card2Component { | ||
| 62 | Span(this.contentDTO.newsTitle) | 63 | Span(this.contentDTO.newsTitle) |
| 63 | } | 64 | } |
| 64 | } | 65 | } |
| 65 | - .fontSize($r('app.float.font_size_17')) | 66 | + .fontSize($r('app.float.font_size_18')) |
| 66 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 67 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 67 | .maxLines(2) | 68 | .maxLines(2) |
| 68 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 69 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 69 | .align(Alignment.Start) | 70 | .align(Alignment.Start) |
| 70 | - .textIndent(this.contentDTO.objectType == '5' ? 35 : 0) | ||
| 71 | - } | ||
| 72 | - .alignContent(Alignment.TopStart) | 71 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| 72 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 73 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 74 | + }.alignContent(Alignment.TopStart) | ||
| 75 | + //.textIndent(this.contentDTO.objectType == '5' ? 35 : 0) | ||
| 76 | + // } | ||
| 77 | + // .alignContent(Alignment.TopStart) | ||
| 73 | 78 | ||
| 74 | //大图 | 79 | //大图 |
| 75 | Stack() { | 80 | Stack() { |
| @@ -50,7 +50,8 @@ export struct Card3Component { | @@ -50,7 +50,8 @@ export struct Card3Component { | ||
| 50 | Span(this.contentDTO.newsTitle) | 50 | Span(this.contentDTO.newsTitle) |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | - .fontSize($r("app.float.font_size_16")) | 53 | + .lineHeight(27) |
| 54 | + .fontSize($r("app.float.font_size_18")) | ||
| 54 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) | 55 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 55 | .width(CommonConstants.FULL_WIDTH) | 56 | .width(CommonConstants.FULL_WIDTH) |
| 56 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | 57 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| @@ -4,7 +4,7 @@ import { ProcessUtils } from 'wdRouter'; | @@ -4,7 +4,7 @@ import { ProcessUtils } from 'wdRouter'; | ||
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 7 | - | 7 | +import { Notes } from './notes'; |
| 8 | const TAG: string = 'Card4Component'; | 8 | const TAG: string = 'Card4Component'; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| @@ -44,6 +44,11 @@ export struct Card4Component { | @@ -44,6 +44,11 @@ export struct Card4Component { | ||
| 44 | //body | 44 | //body |
| 45 | Column() { | 45 | Column() { |
| 46 | //新闻标题 | 46 | //新闻标题 |
| 47 | + if (this.contentDTO.newTags) { | ||
| 48 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 49 | + } else if (this.contentDTO.objectType == '5') { | ||
| 50 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 51 | + } | ||
| 47 | Text() { | 52 | Text() { |
| 48 | if (this.titleMarked) { | 53 | if (this.titleMarked) { |
| 49 | Span(this.str01) | 54 | Span(this.str01) |
| @@ -54,10 +59,14 @@ export struct Card4Component { | @@ -54,10 +59,14 @@ export struct Card4Component { | ||
| 54 | Span(this.contentDTO.newsTitle) | 59 | Span(this.contentDTO.newsTitle) |
| 55 | } | 60 | } |
| 56 | } | 61 | } |
| 57 | - .fontSize($r('app.float.font_size_17')) | 62 | + .fontSize($r('app.float.font_size_18')) |
| 58 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 63 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 59 | .maxLines(3) | 64 | .maxLines(3) |
| 60 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 65 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 66 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 67 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 68 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 69 | + .alignContent(Alignment.TopStart)// 超出的部分显示省略号。 | ||
| 61 | //三图 | 70 | //三图 |
| 62 | Stack(){ | 71 | Stack(){ |
| 63 | Row() { | 72 | Row() { |
| 1 | -import { ContentDTO } from 'wdBean'; | 1 | +import { ContentDTO, CompDTO } from 'wdBean'; |
| 2 | import { CommonConstants } from 'wdConstant'; | 2 | import { CommonConstants } from 'wdConstant'; |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 5 | import { Notes } from './notes'; | 5 | import { Notes } from './notes'; |
| 6 | +import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare' | ||
| 7 | +import { common } from '@kit.AbilityKit'; | ||
| 6 | 8 | ||
| 7 | const TAG: string = 'Card5Component'; | 9 | const TAG: string = 'Card5Component'; |
| 8 | 10 | ||
| @@ -13,6 +15,7 @@ const TAG: string = 'Card5Component'; | @@ -13,6 +15,7 @@ const TAG: string = 'Card5Component'; | ||
| 13 | export struct Card5Component { | 15 | export struct Card5Component { |
| 14 | @State contentDTO: ContentDTO = new ContentDTO(); | 16 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 15 | @Prop titleShowPolicy: number | string | 17 | @Prop titleShowPolicy: number | string |
| 18 | + @Prop compDTO: CompDTO = {} as CompDTO | ||
| 16 | @State loadImg: boolean = false; | 19 | @State loadImg: boolean = false; |
| 17 | @State clicked: boolean = false; | 20 | @State clicked: boolean = false; |
| 18 | @State titleMarked: boolean = false; | 21 | @State titleMarked: boolean = false; |
| @@ -71,10 +74,11 @@ export struct Card5Component { | @@ -71,10 +74,11 @@ export struct Card5Component { | ||
| 71 | } | 74 | } |
| 72 | .width(CommonConstants.FULL_WIDTH) | 75 | .width(CommonConstants.FULL_WIDTH) |
| 73 | .fontColor(Color.White) | 76 | .fontColor(Color.White) |
| 74 | - .fontSize($r('app.float.font_size_17')) | 77 | + .fontSize($r('app.float.font_size_18')) |
| 75 | .fontWeight(FontWeight.Bold) | 78 | .fontWeight(FontWeight.Bold) |
| 76 | .maxLines(2) | 79 | .maxLines(2) |
| 77 | .align(Alignment.TopStart) | 80 | .align(Alignment.TopStart) |
| 81 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | ||
| 78 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | 82 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| 79 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | 83 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || |
| 80 | this.contentDTO.objectType == '5' ? 30 : 0) | 84 | this.contentDTO.objectType == '5' ? 30 : 0) |
| @@ -96,6 +100,8 @@ export struct Card5Component { | @@ -96,6 +100,8 @@ export struct Card5Component { | ||
| 96 | .onClick((event: ClickEvent) => { | 100 | .onClick((event: ClickEvent) => { |
| 97 | this.clicked = true; | 101 | this.clicked = true; |
| 98 | ProcessUtils.processPage(this.contentDTO) | 102 | ProcessUtils.processPage(this.contentDTO) |
| 103 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 104 | + viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED) | ||
| 99 | }) | 105 | }) |
| 100 | 106 | ||
| 101 | } | 107 | } |
| @@ -70,8 +70,8 @@ export struct Card6Component { | @@ -70,8 +70,8 @@ export struct Card6Component { | ||
| 70 | } | 70 | } |
| 71 | } | 71 | } |
| 72 | .fontColor(this.clicked ? 0x848484 : 0x222222) | 72 | .fontColor(this.clicked ? 0x848484 : 0x222222) |
| 73 | - .fontSize(16) | ||
| 74 | - .lineHeight(24) | 73 | + .fontSize(18) |
| 74 | + .lineHeight(27) | ||
| 75 | .fontWeight(FontWeight.Normal) | 75 | .fontWeight(FontWeight.Normal) |
| 76 | .maxLines(3) | 76 | .maxLines(3) |
| 77 | .alignSelf(ItemAlign.Start) | 77 | .alignSelf(ItemAlign.Start) |
| @@ -38,6 +38,11 @@ export struct Card9Component { | @@ -38,6 +38,11 @@ export struct Card9Component { | ||
| 38 | Column() { | 38 | Column() { |
| 39 | // 顶部标题,最多两行 | 39 | // 顶部标题,最多两行 |
| 40 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { | 40 | if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) { |
| 41 | + if (this.contentDTO.newTags) { | ||
| 42 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 43 | + } else if (this.contentDTO.objectType == '5') { | ||
| 44 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 45 | + } | ||
| 41 | Text() { | 46 | Text() { |
| 42 | if (this.titleMarked) { | 47 | if (this.titleMarked) { |
| 43 | Span(this.str01) | 48 | Span(this.str01) |
| @@ -48,13 +53,18 @@ export struct Card9Component { | @@ -48,13 +53,18 @@ export struct Card9Component { | ||
| 48 | Span(this.contentDTO.newsTitle) | 53 | Span(this.contentDTO.newsTitle) |
| 49 | } | 54 | } |
| 50 | } | 55 | } |
| 51 | - .fontColor(this.clicked ? 0x848484 : 0x222222) | ||
| 52 | - .width(CommonConstants.FULL_WIDTH) | ||
| 53 | - .fontSize($r('app.float.font_size_17')) | ||
| 54 | - .fontWeight(600) | ||
| 55 | - .maxLines(2) | ||
| 56 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 57 | - .margin({ bottom: 19 }) | 56 | + .fontColor(this.clicked ? 0x848484 : 0x222222) |
| 57 | + .width(CommonConstants.FULL_WIDTH) | ||
| 58 | + .fontSize($r('app.float.font_size_18')) | ||
| 59 | + .fontWeight(600) | ||
| 60 | + .maxLines(2) | ||
| 61 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 62 | + .margin({ bottom: 19 }) | ||
| 63 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | ||
| 64 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 65 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 66 | + .alignContent(Alignment.TopStart) | ||
| 67 | + | ||
| 58 | } | 68 | } |
| 59 | // 大图 | 69 | // 大图 |
| 60 | Stack() { | 70 | Stack() { |
| @@ -102,7 +112,7 @@ export struct Card9Component { | @@ -102,7 +112,7 @@ export struct Card9Component { | ||
| 102 | } | 112 | } |
| 103 | .width(CommonConstants.FULL_WIDTH) | 113 | .width(CommonConstants.FULL_WIDTH) |
| 104 | .padding({ | 114 | .padding({ |
| 105 | - top: 14, | 115 | + top: 5, |
| 106 | left: 16, | 116 | left: 16, |
| 107 | right: 16, | 117 | right: 16, |
| 108 | bottom: 14 | 118 | bottom: 14 |
| @@ -36,7 +36,7 @@ export struct SearchContentComponent { | @@ -36,7 +36,7 @@ export struct SearchContentComponent { | ||
| 36 | Column() { | 36 | Column() { |
| 37 | //新闻标题 | 37 | //新闻标题 |
| 38 | Text(this.contentDTO.newsTitle) | 38 | Text(this.contentDTO.newsTitle) |
| 39 | - .fontSize($r('app.float.font_size_17')) | 39 | + .fontSize($r('app.float.font_size_18')) |
| 40 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 40 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 41 | .maxLines(3) | 41 | .maxLines(3) |
| 42 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 42 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| @@ -156,7 +156,7 @@ export struct CommentIconComponent { | @@ -156,7 +156,7 @@ export struct CommentIconComponent { | ||
| 156 | // Stack({alignContent:Alignment.Start}) { | 156 | // Stack({alignContent:Alignment.Start}) { |
| 157 | if (Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0) { | 157 | if (Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0) { |
| 158 | RelativeContainer() { | 158 | RelativeContainer() { |
| 159 | - Image($r('app.media.comment_icon_number_bg')) | 159 | + Image(this.styleType == 1 ? $r('app.media.comment_icon_number_bg'):$r('app.media.ic_like_back_Select')) |
| 160 | .objectFit(ImageFit.Fill) | 160 | .objectFit(ImageFit.Fill) |
| 161 | .resizable({ | 161 | .resizable({ |
| 162 | slice: { | 162 | slice: { |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| @@ -38,20 +38,19 @@ export struct QualityCommentsComponent { | @@ -38,20 +38,19 @@ export struct QualityCommentsComponent { | ||
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | aboutToDisappear(): void { | 40 | aboutToDisappear(): void { |
| 41 | - | ||
| 42 | - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage | ||
| 43 | - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 | ||
| 44 | - windowClass.setWindowBackgroundColor(this.lastWindowColor) | ||
| 45 | - windowClass.setWindowLayoutFullScreen(false) | ||
| 46 | // windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' }) | 41 | // windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' }) |
| 47 | - | ||
| 48 | this.dialogController = null // 将dialogController置空 | 42 | this.dialogController = null // 将dialogController置空 |
| 43 | + } | ||
| 49 | 44 | ||
| 45 | + onPageShow(): void { | ||
| 46 | + WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 50 | } | 47 | } |
| 51 | 48 | ||
| 52 | - aboutToAppear(): void { | 49 | + onPageHide(): void { |
| 50 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 51 | + } | ||
| 53 | 52 | ||
| 54 | - this.fullScreen(); | 53 | + aboutToAppear(): void { |
| 55 | this.getData(); | 54 | this.getData(); |
| 56 | this.showAlert() | 55 | this.showAlert() |
| 57 | } | 56 | } |
| @@ -100,13 +99,6 @@ export struct QualityCommentsComponent { | @@ -100,13 +99,6 @@ export struct QualityCommentsComponent { | ||
| 100 | }) | 99 | }) |
| 101 | } | 100 | } |
| 102 | 101 | ||
| 103 | - fullScreen() { | ||
| 104 | - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage | ||
| 105 | - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 | ||
| 106 | - windowClass.setWindowLayoutFullScreen(true) | ||
| 107 | - | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | @Builder | 102 | @Builder |
| 111 | titleHeader() { | 103 | titleHeader() { |
| 112 | Row() { | 104 | Row() { |
| @@ -249,7 +241,7 @@ export struct QualityCommentsComponent { | @@ -249,7 +241,7 @@ export struct QualityCommentsComponent { | ||
| 249 | } | 241 | } |
| 250 | // ListItem() { | 242 | // ListItem() { |
| 251 | // | 243 | // |
| 252 | - // }.height(this.bottomSafeHeight) | 244 | + // }.height(`${this.bottomSafeHeight}` + 'px') |
| 253 | }.onReachEnd(()=>{ | 245 | }.onReachEnd(()=>{ |
| 254 | this.currentPage++ | 246 | this.currentPage++ |
| 255 | this.getData() | 247 | this.getData() |
| @@ -208,7 +208,7 @@ struct CarouselLayout01CardView { | @@ -208,7 +208,7 @@ struct CarouselLayout01CardView { | ||
| 208 | Text(`${this.item.corner}${this.item.newsTitle}`) | 208 | Text(`${this.item.corner}${this.item.newsTitle}`) |
| 209 | .width(CommonConstants.FULL_PARENT) | 209 | .width(CommonConstants.FULL_PARENT) |
| 210 | .fontColor(Color.White) | 210 | .fontColor(Color.White) |
| 211 | - .fontSize($r('app.float.font_size_16')) | 211 | + .fontSize($r('app.float.font_size_18')) |
| 212 | .fontWeight(FontWeight.Medium) | 212 | .fontWeight(FontWeight.Medium) |
| 213 | .textAlign(TextAlign.Start) | 213 | .textAlign(TextAlign.Start) |
| 214 | .align(Alignment.Bottom) | 214 | .align(Alignment.Bottom) |
| @@ -55,7 +55,7 @@ export struct ZhGridLayout02 { | @@ -55,7 +55,7 @@ export struct ZhGridLayout02 { | ||
| 55 | .width(CommonConstants.FULL_WIDTH) | 55 | .width(CommonConstants.FULL_WIDTH) |
| 56 | 56 | ||
| 57 | GridRow({ | 57 | GridRow({ |
| 58 | - gutter: { x: 12, y: 15 }, | 58 | + gutter: { x: 12, y: 13 }, |
| 59 | columns: { sm: listSize, md: 2 }, | 59 | columns: { sm: listSize, md: 2 }, |
| 60 | breakpoints: { value: ['320vp', '520vp', '840vp'] } | 60 | breakpoints: { value: ['320vp', '520vp', '840vp'] } |
| 61 | }) { | 61 | }) { |
| @@ -120,7 +120,7 @@ export struct ZhGridLayout02 { | @@ -120,7 +120,7 @@ export struct ZhGridLayout02 { | ||
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | Text(item.newsTitle) | 122 | Text(item.newsTitle) |
| 123 | - .margin({ top: '5' }) | 123 | + .margin({top:'6'}) |
| 124 | .fontSize(13) | 124 | .fontSize(13) |
| 125 | .maxLines(2) | 125 | .maxLines(2) |
| 126 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 126 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| @@ -59,12 +59,16 @@ export struct ZhGridLayout03 { | @@ -59,12 +59,16 @@ export struct ZhGridLayout03 { | ||
| 59 | .backgroundColor(0xf5f5f5) | 59 | .backgroundColor(0xf5f5f5) |
| 60 | .width(44) | 60 | .width(44) |
| 61 | .aspectRatio(1 / 1) | 61 | .aspectRatio(1 / 1) |
| 62 | - .margin({ | ||
| 63 | - bottom: 16 | ||
| 64 | - }) | 62 | + // .margin({ |
| 63 | + // bottom: 16 | ||
| 64 | + // }) | ||
| 65 | Text(item.newsTitle) | 65 | Text(item.newsTitle) |
| 66 | .fontSize(13) | 66 | .fontSize(13) |
| 67 | .maxLines(1) | 67 | .maxLines(1) |
| 68 | + .margin({ | ||
| 69 | + top: 8, | ||
| 70 | + bottom:11 | ||
| 71 | + }) | ||
| 68 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 72 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 69 | } | 73 | } |
| 70 | .width('100%') | 74 | .width('100%') |
| @@ -57,7 +57,7 @@ export struct ZhSingleColumn04 { | @@ -57,7 +57,7 @@ export struct ZhSingleColumn04 { | ||
| 57 | .width(12) | 57 | .width(12) |
| 58 | .margin({ left: 12, right: 8 }) | 58 | .margin({ left: 12, right: 8 }) |
| 59 | Text(item.newsTitle) | 59 | Text(item.newsTitle) |
| 60 | - .fontSizeColorWeight($r('app.float.font_size_17'), $r('app.color.color_222222'), 400) | 60 | + .fontSizeColorWeight($r('app.float.font_size_18'), $r('app.color.color_222222'), 400) |
| 61 | .maxLines(1) | 61 | .maxLines(1) |
| 62 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 62 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 63 | .layoutWeight(1) | 63 | .layoutWeight(1) |
| @@ -40,7 +40,6 @@ export struct ZhSingleRow03 { | @@ -40,7 +40,6 @@ export struct ZhSingleRow03 { | ||
| 40 | 40 | ||
| 41 | // 请求所有预约状态 | 41 | // 请求所有预约状态 |
| 42 | async getReserveState() { | 42 | async getReserveState() { |
| 43 | - this.reservedIds = [] | ||
| 44 | const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => { | 43 | const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => { |
| 45 | const reqItem: reserveReqItem = { | 44 | const reqItem: reserveReqItem = { |
| 46 | liveId: item.objectId.toString(), | 45 | liveId: item.objectId.toString(), |
| @@ -49,6 +48,7 @@ export struct ZhSingleRow03 { | @@ -49,6 +48,7 @@ export struct ZhSingleRow03 { | ||
| 49 | return reqItem; | 48 | return reqItem; |
| 50 | }) | 49 | }) |
| 51 | const res = await LiveModel.getAppointmentStatus(reserveBean); | 50 | const res = await LiveModel.getAppointmentStatus(reserveBean); |
| 51 | + this.reservedIds = [] | ||
| 52 | // this.reserveStatus = res; | 52 | // this.reserveStatus = res; |
| 53 | Logger.debug(TAG, '数据信息:' + `${JSON.stringify(res)}`) | 53 | Logger.debug(TAG, '数据信息:' + `${JSON.stringify(res)}`) |
| 54 | res.map((item: ReserveItemBean) => { | 54 | res.map((item: ReserveItemBean) => { |
| @@ -280,6 +280,8 @@ struct CreatorItem { | @@ -280,6 +280,8 @@ struct CreatorItem { | ||
| 280 | .backgroundColor(0xf5f5f5) | 280 | .backgroundColor(0xf5f5f5) |
| 281 | .width(156) | 281 | .width(156) |
| 282 | .height(208) | 282 | .height(208) |
| 283 | + .border({width: 1}) | ||
| 284 | + .borderRadius(3) | ||
| 283 | Row() | 285 | Row() |
| 284 | .width(156) | 286 | .width(156) |
| 285 | .height(80) | 287 | .height(80) |
| @@ -101,7 +101,7 @@ struct localCard { | @@ -101,7 +101,7 @@ struct localCard { | ||
| 101 | Text(this.operDataListItem.newsTitle) | 101 | Text(this.operDataListItem.newsTitle) |
| 102 | .width(CommonConstants.FULL_PARENT) | 102 | .width(CommonConstants.FULL_PARENT) |
| 103 | .height(CommonConstants.FULL_PARENT) | 103 | .height(CommonConstants.FULL_PARENT) |
| 104 | - .fontSize($r('app.float.font_size_16')) | 104 | + .fontSize($r('app.float.font_size_18')) |
| 105 | .fontColor('#000000') | 105 | .fontColor('#000000') |
| 106 | .align(Alignment.TopStart) | 106 | .align(Alignment.TopStart) |
| 107 | .maxLines(3) | 107 | .maxLines(3) |
| @@ -168,7 +168,7 @@ export struct ZhSingleRow06 { | @@ -168,7 +168,7 @@ export struct ZhSingleRow06 { | ||
| 168 | ? item.operDataList[0]?.commentInfo?.userHeaderUrl | 168 | ? item.operDataList[0]?.commentInfo?.userHeaderUrl |
| 169 | ? item.operDataList[0].commentInfo.userHeaderUrl | 169 | ? item.operDataList[0].commentInfo.userHeaderUrl |
| 170 | : $r('app.media.default_head') | 170 | : $r('app.media.default_head') |
| 171 | - : '') | 171 | + : $r('app.media.comment_rmh_tag')) |
| 172 | .width(32) | 172 | .width(32) |
| 173 | .height(32) | 173 | .height(32) |
| 174 | .borderRadius(16) | 174 | .borderRadius(16) |
| @@ -7,6 +7,7 @@ import { EmptyComponent } from '../../view/EmptyComponent'; | @@ -7,6 +7,7 @@ import { EmptyComponent } from '../../view/EmptyComponent'; | ||
| 7 | import { ChildCommentComponent } from './ChildCommentComponent'; | 7 | import { ChildCommentComponent } from './ChildCommentComponent'; |
| 8 | import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; | 8 | import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; |
| 9 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; | 9 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; |
| 10 | +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | ||
| 10 | 11 | ||
| 11 | const TAG = "HomePageBottomCommentComponent" | 12 | const TAG = "HomePageBottomCommentComponent" |
| 12 | 13 | ||
| @@ -22,6 +23,7 @@ export struct HomePageBottomCommentComponent { | @@ -22,6 +23,7 @@ export struct HomePageBottomCommentComponent { | ||
| 22 | @State count: number = 0; | 23 | @State count: number = 0; |
| 23 | @Link commentNum: number | 24 | @Link commentNum: number |
| 24 | @State isGetRequest: boolean = false | 25 | @State isGetRequest: boolean = false |
| 26 | + private scroller: Scroller = new Scroller(); | ||
| 25 | 27 | ||
| 26 | aboutToAppear() { | 28 | aboutToAppear() { |
| 27 | this.getNewPageData() | 29 | this.getNewPageData() |
| @@ -42,39 +44,31 @@ export struct HomePageBottomCommentComponent { | @@ -42,39 +44,31 @@ export struct HomePageBottomCommentComponent { | ||
| 42 | .offset({ y: "-200lpx" }) | 44 | .offset({ y: "-200lpx" }) |
| 43 | } | 45 | } |
| 44 | } else { | 46 | } else { |
| 45 | - List({ space: 3 }) { | ||
| 46 | - LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { | ||
| 47 | - ListItem() { | ||
| 48 | - ChildCommentComponent({ | ||
| 49 | - data: item, | ||
| 50 | - levelHead: UserDataLocal.getUserLevelHeaderUrl(), | ||
| 51 | - isLastItem: index === this.data_comment.totalCount() - 1 | ||
| 52 | - }) | 47 | + CustomPullToRefresh({ |
| 48 | + alldata:this.data_comment, | ||
| 49 | + scroller:this.scroller, | ||
| 50 | + customList:()=>{ | ||
| 51 | + this.ListLayout() | ||
| 52 | + }, | ||
| 53 | + onRefresh:(resolve)=>{ | ||
| 54 | + this.curPageNum = 1; | ||
| 55 | + this.hasMore = true | ||
| 56 | + this.isGetRequest = false | ||
| 57 | + this.data_comment.clear() | ||
| 58 | + | ||
| 59 | + if (!this.isLoading){ | ||
| 60 | + this.getNewPageData() | ||
| 61 | + if(resolve) resolve('刷新成功') | ||
| 53 | } | 62 | } |
| 54 | - }, (item: CommentListItem, index: number) => index.toString()) | ||
| 55 | - | ||
| 56 | - //没有更多数据 显示提示 | ||
| 57 | - if (!this.hasMore) { | ||
| 58 | - ListItem() { | ||
| 59 | - ListHasNoMoreDataUI() | 63 | + }, |
| 64 | + onLoadMore:(resolve)=> { | ||
| 65 | + console.log(TAG, "触底了"); | ||
| 66 | + if (!this.isLoading) { | ||
| 67 | + this.isLoading = true | ||
| 68 | + //加载分页数据 | ||
| 69 | + this.getNewPageData() | ||
| 60 | } | 70 | } |
| 61 | } | 71 | } |
| 62 | - } | ||
| 63 | - .cachedCount(15) | ||
| 64 | - .layoutWeight(1) | ||
| 65 | - .scrollBar(BarState.Off) | ||
| 66 | - .edgeEffect(EdgeEffect.None) | ||
| 67 | - .nestedScroll({ | ||
| 68 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 69 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 70 | - }) | ||
| 71 | - .onReachEnd(() => { | ||
| 72 | - console.log(TAG, "触底了"); | ||
| 73 | - if (!this.isLoading) { | ||
| 74 | - this.isLoading = true | ||
| 75 | - //加载分页数据 | ||
| 76 | - this.getNewPageData() | ||
| 77 | - } | ||
| 78 | }) | 72 | }) |
| 79 | } | 73 | } |
| 80 | }.layoutWeight(1) | 74 | }.layoutWeight(1) |
| @@ -82,6 +76,35 @@ export struct HomePageBottomCommentComponent { | @@ -82,6 +76,35 @@ export struct HomePageBottomCommentComponent { | ||
| 82 | .width('100%') | 76 | .width('100%') |
| 83 | } | 77 | } |
| 84 | 78 | ||
| 79 | + @Builder ListLayout(){ | ||
| 80 | + List({ space: 3,scroller: this.scroller }) { | ||
| 81 | + LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { | ||
| 82 | + ListItem() { | ||
| 83 | + ChildCommentComponent({ | ||
| 84 | + data: item, | ||
| 85 | + levelHead: UserDataLocal.getUserLevelHeaderUrl(), | ||
| 86 | + isLastItem: index === this.data_comment.totalCount() - 1 | ||
| 87 | + }) | ||
| 88 | + } | ||
| 89 | + }, (item: CommentListItem, index: number) => index.toString()) | ||
| 90 | + | ||
| 91 | + //没有更多数据 显示提示 | ||
| 92 | + if (!this.hasMore) { | ||
| 93 | + ListItem() { | ||
| 94 | + ListHasNoMoreDataUI() | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + .cachedCount(15) | ||
| 99 | + .layoutWeight(1) | ||
| 100 | + .scrollBar(BarState.Off) | ||
| 101 | + .edgeEffect(EdgeEffect.None) | ||
| 102 | + .nestedScroll({ | ||
| 103 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 104 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 105 | + }) | ||
| 106 | + } | ||
| 107 | + | ||
| 85 | getNewPageData() { | 108 | getNewPageData() { |
| 86 | this.isLoading = true | 109 | this.isLoading = true |
| 87 | if (this.hasMore) { | 110 | if (this.hasMore) { |
| @@ -7,6 +7,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | @@ -7,6 +7,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | ||
| 7 | import { FollowChildComponent } from '../follow/FollowChildComponent'; | 7 | import { FollowChildComponent } from '../follow/FollowChildComponent'; |
| 8 | import dataPreferences from '@ohos.data.preferences'; | 8 | import dataPreferences from '@ohos.data.preferences'; |
| 9 | import { EmptyComponent } from '../../view/EmptyComponent'; | 9 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 10 | +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | ||
| 10 | 11 | ||
| 11 | const TAG = "HomePageBottomFollowComponent" | 12 | const TAG = "HomePageBottomFollowComponent" |
| 12 | /** | 13 | /** |
| @@ -14,6 +15,7 @@ const TAG = "HomePageBottomFollowComponent" | @@ -14,6 +15,7 @@ const TAG = "HomePageBottomFollowComponent" | ||
| 14 | */ | 15 | */ |
| 15 | @Component | 16 | @Component |
| 16 | export struct HomePageBottomFollowComponent { | 17 | export struct HomePageBottomFollowComponent { |
| 18 | + private scroller: Scroller = new Scroller(); | ||
| 17 | @State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); | 19 | @State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); |
| 18 | @State isLoading: boolean = false | 20 | @State isLoading: boolean = false |
| 19 | @State hasMore: boolean = true | 21 | @State hasMore: boolean = true |
| @@ -104,61 +106,30 @@ export struct HomePageBottomFollowComponent { | @@ -104,61 +106,30 @@ export struct HomePageBottomFollowComponent { | ||
| 104 | }) | 106 | }) |
| 105 | }.layoutWeight(1) | 107 | }.layoutWeight(1) |
| 106 | } else { | 108 | } else { |
| 107 | - List({ space: 3 }) { | 109 | + CustomPullToRefresh({ |
| 110 | + alldata:this.data_follow, | ||
| 111 | + scroller:this.scroller, | ||
| 112 | + customList:()=>{ | ||
| 113 | + this.ListLayout() | ||
| 114 | + }, | ||
| 115 | + onRefresh:(resolve)=>{ | ||
| 116 | + this.curPageNum = 1; | ||
| 117 | + this.hasMore = true | ||
| 118 | + this.isGetRequest = false | ||
| 119 | + this.data_follow.clear() | ||
| 108 | 120 | ||
| 109 | - ListItem() { | ||
| 110 | - Row() { | ||
| 111 | - Text("关注更多人民号") | ||
| 112 | - .fontWeight('400lpx') | ||
| 113 | - .fontColor($r('app.color.color_222222')) | ||
| 114 | - .lineHeight('38lpx') | ||
| 115 | - .fontSize('27lpx') | ||
| 116 | - .textAlign(TextAlign.Center) | ||
| 117 | - .margin({ right: '4lpx' }) | ||
| 118 | - Image($r('app.media.arrow_icon_right')) | ||
| 119 | - .objectFit(ImageFit.Auto) | ||
| 120 | - .width('27lpx') | ||
| 121 | - .height('27lpx') | 121 | + if (!this.isLoading){ |
| 122 | + this.getNewPageData() | ||
| 123 | + if(resolve) resolve('刷新成功') | ||
| 122 | } | 124 | } |
| 123 | - .height('69lpx') | ||
| 124 | - .width('659lpx') | ||
| 125 | - .alignItems(VerticalAlign.Center) | ||
| 126 | - .justifyContent(FlexAlign.Center) | ||
| 127 | - .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 128 | - .margin({ top: '31lpx', bottom: '4lpx' }) | ||
| 129 | - }.onClick(() => { | ||
| 130 | - let params = { 'index': "1" } as Record<string, string> | ||
| 131 | - WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 132 | - }) | ||
| 133 | - | ||
| 134 | - LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | ||
| 135 | - ListItem() { | ||
| 136 | - FollowChildComponent({ data: item, type: 2 }) | 125 | + }, |
| 126 | + onLoadMore:(resolve)=> { | ||
| 127 | + console.log(TAG, "触底了"); | ||
| 128 | + if (!this.isLoading) { | ||
| 129 | + this.isLoading = true | ||
| 130 | + //加载分页数据 | ||
| 131 | + this.getNewPageData() | ||
| 137 | } | 132 | } |
| 138 | - }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 139 | - | ||
| 140 | - //没有更多数据 显示提示 | ||
| 141 | - if (!this.hasMore) { | ||
| 142 | - ListItem() { | ||
| 143 | - ListHasNoMoreDataUI() | ||
| 144 | - } | ||
| 145 | - } | ||
| 146 | - } | ||
| 147 | - .cachedCount(15) | ||
| 148 | - .padding({ left: '31lpx', right: '31lpx' }) | ||
| 149 | - .layoutWeight(1) | ||
| 150 | - .scrollBar(BarState.Off) | ||
| 151 | - .edgeEffect(EdgeEffect.None) | ||
| 152 | - .nestedScroll({ | ||
| 153 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 154 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 155 | - }) | ||
| 156 | - .onReachEnd(() => { | ||
| 157 | - console.log(TAG, "触底了"); | ||
| 158 | - if (!this.isLoading) { | ||
| 159 | - this.isLoading = true | ||
| 160 | - //加载分页数据 | ||
| 161 | - this.getNewPageData() | ||
| 162 | } | 133 | } |
| 163 | }) | 134 | }) |
| 164 | } | 135 | } |
| @@ -167,6 +138,56 @@ export struct HomePageBottomFollowComponent { | @@ -167,6 +138,56 @@ export struct HomePageBottomFollowComponent { | ||
| 167 | .width('100%') | 138 | .width('100%') |
| 168 | } | 139 | } |
| 169 | 140 | ||
| 141 | + @Builder ListLayout(){ | ||
| 142 | + List({ space: 3 ,scroller:this.scroller}) { | ||
| 143 | + ListItem() { | ||
| 144 | + Row() { | ||
| 145 | + Text("关注更多人民号") | ||
| 146 | + .fontWeight('400lpx') | ||
| 147 | + .fontColor($r('app.color.color_222222')) | ||
| 148 | + .lineHeight('38lpx') | ||
| 149 | + .fontSize('27lpx') | ||
| 150 | + .textAlign(TextAlign.Center) | ||
| 151 | + .margin({ right: '4lpx' }) | ||
| 152 | + Image($r('app.media.arrow_icon_right')) | ||
| 153 | + .objectFit(ImageFit.Auto) | ||
| 154 | + .width('27lpx') | ||
| 155 | + .height('27lpx') | ||
| 156 | + } | ||
| 157 | + .height('69lpx') | ||
| 158 | + .width('659lpx') | ||
| 159 | + .alignItems(VerticalAlign.Center) | ||
| 160 | + .justifyContent(FlexAlign.Center) | ||
| 161 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 162 | + .margin({ top: '31lpx', bottom: '4lpx' }) | ||
| 163 | + }.onClick(() => { | ||
| 164 | + let params = { 'index': "1" } as Record<string, string> | ||
| 165 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params) | ||
| 166 | + }) | ||
| 167 | + | ||
| 168 | + LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | ||
| 169 | + ListItem() { | ||
| 170 | + FollowChildComponent({ data: item, type: 2 }) | ||
| 171 | + } | ||
| 172 | + }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 173 | + //没有更多数据 显示提示 | ||
| 174 | + if (!this.hasMore) { | ||
| 175 | + ListItem() { | ||
| 176 | + ListHasNoMoreDataUI() | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + .cachedCount(15) | ||
| 181 | + .padding({ left: '31lpx', right: '31lpx' }) | ||
| 182 | + .layoutWeight(1) | ||
| 183 | + .scrollBar(BarState.Off) | ||
| 184 | + .edgeEffect(EdgeEffect.None) | ||
| 185 | + .nestedScroll({ | ||
| 186 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 187 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 188 | + }) | ||
| 189 | + } | ||
| 190 | + | ||
| 170 | @Styles | 191 | @Styles |
| 171 | listStyle() { | 192 | listStyle() { |
| 172 | .backgroundColor(Color.White) | 193 | .backgroundColor(Color.White) |
| @@ -7,6 +7,7 @@ import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDet | @@ -7,6 +7,7 @@ import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDet | ||
| 7 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; | 7 | import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; |
| 8 | import { ChildCommentComponent } from './ChildCommentComponent'; | 8 | import { ChildCommentComponent } from './ChildCommentComponent'; |
| 9 | import { EmptyComponent } from '../../view/EmptyComponent'; | 9 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 10 | +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | ||
| 10 | 11 | ||
| 11 | const TAG = "HomePageBottomComponent" | 12 | const TAG = "HomePageBottomComponent" |
| 12 | /** | 13 | /** |
| @@ -23,6 +24,8 @@ export struct OtherHomePageBottomCommentComponent { | @@ -23,6 +24,8 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 23 | @Prop levelHead: string | 24 | @Prop levelHead: string |
| 24 | @Link commentNum: number | 25 | @Link commentNum: number |
| 25 | @State isGetRequest: boolean = false | 26 | @State isGetRequest: boolean = false |
| 27 | + private scroller: Scroller = new Scroller(); | ||
| 28 | + | ||
| 26 | 29 | ||
| 27 | aboutToAppear() { | 30 | aboutToAppear() { |
| 28 | this.getNewPageData() | 31 | this.getNewPageData() |
| @@ -41,41 +44,31 @@ export struct OtherHomePageBottomCommentComponent { | @@ -41,41 +44,31 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 41 | .layoutWeight(1) | 44 | .layoutWeight(1) |
| 42 | } | 45 | } |
| 43 | } else { | 46 | } else { |
| 44 | - List({ space: 3 }) { | ||
| 45 | - LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { | ||
| 46 | - ListItem() { | ||
| 47 | - ChildCommentComponent({ | ||
| 48 | - data: item, | ||
| 49 | - levelHead: this.levelHead, | ||
| 50 | - isLastItem: index === this.data_comment.totalCount() - 1 | ||
| 51 | - }) | 47 | + CustomPullToRefresh({ |
| 48 | + alldata:this.data_comment, | ||
| 49 | + scroller:this.scroller, | ||
| 50 | + customList:()=>{ | ||
| 51 | + this.ListLayout() | ||
| 52 | + }, | ||
| 53 | + onRefresh:(resolve)=>{ | ||
| 54 | + this.curPageNum = 1; | ||
| 55 | + this.hasMore = true | ||
| 56 | + this.isGetRequest = false | ||
| 57 | + this.data_comment.clear() | ||
| 58 | + | ||
| 59 | + if (!this.isLoading){ | ||
| 60 | + this.getNewPageData() | ||
| 61 | + if(resolve) resolve('刷新成功') | ||
| 52 | } | 62 | } |
| 53 | - .onClick(() => { | ||
| 54 | - }) | ||
| 55 | - }, (item: CommentListItem, index: number) => index.toString()) | ||
| 56 | - | ||
| 57 | - //没有更多数据 显示提示 | ||
| 58 | - if (!this.hasMore) { | ||
| 59 | - ListItem() { | ||
| 60 | - ListHasNoMoreDataUI() | 63 | + }, |
| 64 | + onLoadMore:(resolve)=> { | ||
| 65 | + console.log(TAG, "触底了"); | ||
| 66 | + if (!this.isLoading) { | ||
| 67 | + this.isLoading = true | ||
| 68 | + //加载分页数据 | ||
| 69 | + this.getNewPageData() | ||
| 61 | } | 70 | } |
| 62 | } | 71 | } |
| 63 | - } | ||
| 64 | - .cachedCount(15) | ||
| 65 | - .layoutWeight(1) | ||
| 66 | - .scrollBar(BarState.Off) | ||
| 67 | - .edgeEffect(EdgeEffect.None) | ||
| 68 | - .nestedScroll({ | ||
| 69 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 70 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 71 | - }) | ||
| 72 | - .onReachEnd(() => { | ||
| 73 | - console.log(TAG, "触底了"); | ||
| 74 | - if (!this.isLoading) { | ||
| 75 | - this.isLoading = true | ||
| 76 | - //加载分页数据 | ||
| 77 | - this.getNewPageData() | ||
| 78 | - } | ||
| 79 | }) | 72 | }) |
| 80 | } | 73 | } |
| 81 | } | 74 | } |
| @@ -84,6 +77,35 @@ export struct OtherHomePageBottomCommentComponent { | @@ -84,6 +77,35 @@ export struct OtherHomePageBottomCommentComponent { | ||
| 84 | .justifyContent(FlexAlign.Start) | 77 | .justifyContent(FlexAlign.Start) |
| 85 | } | 78 | } |
| 86 | 79 | ||
| 80 | + @Builder ListLayout(){ | ||
| 81 | + List({ space: 3 ,scroller: this.scroller}) { | ||
| 82 | + LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { | ||
| 83 | + ListItem() { | ||
| 84 | + ChildCommentComponent({ | ||
| 85 | + data: item, | ||
| 86 | + levelHead: this.levelHead, | ||
| 87 | + isLastItem: index === this.data_comment.totalCount() - 1 | ||
| 88 | + }) | ||
| 89 | + } | ||
| 90 | + }, (item: CommentListItem, index: number) => index.toString()) | ||
| 91 | + | ||
| 92 | + //没有更多数据 显示提示 | ||
| 93 | + if (!this.hasMore) { | ||
| 94 | + ListItem() { | ||
| 95 | + ListHasNoMoreDataUI() | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + .cachedCount(15) | ||
| 100 | + .layoutWeight(1) | ||
| 101 | + .scrollBar(BarState.Off) | ||
| 102 | + .edgeEffect(EdgeEffect.None) | ||
| 103 | + .nestedScroll({ | ||
| 104 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 105 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 106 | + }) | ||
| 107 | + } | ||
| 108 | + | ||
| 87 | @Styles | 109 | @Styles |
| 88 | listStyle() { | 110 | listStyle() { |
| 89 | .backgroundColor(Color.White) | 111 | .backgroundColor(Color.White) |
| @@ -4,6 +4,7 @@ import { WDRouterRule, WDRouterPage } from 'wdRouter'; | @@ -4,6 +4,7 @@ import { WDRouterRule, WDRouterPage } from 'wdRouter'; | ||
| 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 5 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; | 5 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; |
| 6 | import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem'; | 6 | import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem'; |
| 7 | +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh'; | ||
| 7 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | 8 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; |
| 8 | import { EmptyComponent } from '../../view/EmptyComponent'; | 9 | import { EmptyComponent } from '../../view/EmptyComponent'; |
| 9 | import { FollowChildComponent } from '../follow/FollowChildComponent'; | 10 | import { FollowChildComponent } from '../follow/FollowChildComponent'; |
| @@ -22,7 +23,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -22,7 +23,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 22 | @State count:number = 0; | 23 | @State count:number = 0; |
| 23 | @Prop curUserId: string | 24 | @Prop curUserId: string |
| 24 | @State isGetRequest:boolean = false | 25 | @State isGetRequest:boolean = false |
| 25 | - | 26 | + private scroller: Scroller = new Scroller(); |
| 26 | 27 | ||
| 27 | aboutToAppear(){ | 28 | aboutToAppear(){ |
| 28 | this.getNewPageData() | 29 | this.getNewPageData() |
| @@ -66,68 +67,87 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -66,68 +67,87 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 66 | }.layoutWeight(1) | 67 | }.layoutWeight(1) |
| 67 | .justifyContent(FlexAlign.Start) | 68 | .justifyContent(FlexAlign.Start) |
| 68 | }else{ | 69 | }else{ |
| 69 | - List({ space: 3 }) { | ||
| 70 | - | ||
| 71 | - ListItem() { | ||
| 72 | - Row(){ | ||
| 73 | - Text("关注更多人民号") | ||
| 74 | - .fontWeight('400lpx') | ||
| 75 | - .fontColor($r('app.color.color_222222')) | ||
| 76 | - .lineHeight('38lpx') | ||
| 77 | - .fontSize('27lpx') | ||
| 78 | - .textAlign(TextAlign.Center) | ||
| 79 | - .margin({right:'4lpx'}) | ||
| 80 | - Image($r('app.media.arrow_icon_right')) | ||
| 81 | - .objectFit(ImageFit.Auto) | ||
| 82 | - .width('27lpx') | ||
| 83 | - .height('27lpx') | ||
| 84 | - }.height('69lpx') | ||
| 85 | - .width('659lpx') | ||
| 86 | - .alignItems(VerticalAlign.Center) | ||
| 87 | - .justifyContent(FlexAlign.Center) | ||
| 88 | - .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 89 | - .margin({top:'31lpx',bottom:'4lpx'}) | ||
| 90 | - }.onClick(()=>{ | ||
| 91 | - let params = {'index': "1"} as Record<string, string>; | ||
| 92 | - WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) | ||
| 93 | - }) | 70 | + CustomPullToRefresh({ |
| 71 | + alldata:this.data_follow, | ||
| 72 | + scroller:this.scroller, | ||
| 73 | + customList:()=>{ | ||
| 74 | + this.ListLayout() | ||
| 75 | + }, | ||
| 76 | + onRefresh:(resolve)=>{ | ||
| 77 | + this.curPageNum = 1; | ||
| 78 | + this.hasMore = true | ||
| 79 | + this.isGetRequest = false | ||
| 80 | + this.data_follow.clear() | ||
| 94 | 81 | ||
| 95 | - LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | ||
| 96 | - ListItem() { | ||
| 97 | - FollowChildComponent({data: item,type:2}) | 82 | + if (!this.isLoading){ |
| 83 | + this.getNewPageData() | ||
| 84 | + if(resolve) resolve('刷新成功') | ||
| 98 | } | 85 | } |
| 99 | - .onClick(() => { | ||
| 100 | - }) | ||
| 101 | - }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 102 | - | ||
| 103 | - //没有更多数据 显示提示 | ||
| 104 | - if(!this.hasMore){ | ||
| 105 | - ListItem(){ | ||
| 106 | - ListHasNoMoreDataUI() | 86 | + }, |
| 87 | + onLoadMore:(resolve)=> { | ||
| 88 | + console.log(TAG, "触底了"); | ||
| 89 | + if (!this.isLoading) { | ||
| 90 | + this.isLoading = true | ||
| 91 | + //加载分页数据 | ||
| 92 | + this.getNewPageData() | ||
| 107 | } | 93 | } |
| 108 | } | 94 | } |
| 109 | - }.cachedCount(15) | ||
| 110 | - .padding({left:'31lpx',right:'31lpx'}) | ||
| 111 | - .layoutWeight(1) | ||
| 112 | - .scrollBar(BarState.Off) | ||
| 113 | - .edgeEffect(EdgeEffect.None) | ||
| 114 | - .nestedScroll({ | ||
| 115 | - scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 116 | - scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 117 | - }) | ||
| 118 | - .onReachEnd(()=>{ | ||
| 119 | - console.log(TAG,"触底了"); | ||
| 120 | - if(!this.isLoading){ | ||
| 121 | - this.isLoading = true | ||
| 122 | - //加载分页数据 | ||
| 123 | - this.getNewPageData() | ||
| 124 | - } | ||
| 125 | }) | 95 | }) |
| 126 | } | 96 | } |
| 127 | } | 97 | } |
| 128 | .width('100%') | 98 | .width('100%') |
| 129 | } | 99 | } |
| 130 | 100 | ||
| 101 | + @Builder ListLayout(){ | ||
| 102 | + List({ space: 3 ,scroller:this.scroller}) { | ||
| 103 | + ListItem() { | ||
| 104 | + Row(){ | ||
| 105 | + Text("关注更多人民号") | ||
| 106 | + .fontWeight('400lpx') | ||
| 107 | + .fontColor($r('app.color.color_222222')) | ||
| 108 | + .lineHeight('38lpx') | ||
| 109 | + .fontSize('27lpx') | ||
| 110 | + .textAlign(TextAlign.Center) | ||
| 111 | + .margin({right:'4lpx'}) | ||
| 112 | + Image($r('app.media.arrow_icon_right')) | ||
| 113 | + .objectFit(ImageFit.Auto) | ||
| 114 | + .width('27lpx') | ||
| 115 | + .height('27lpx') | ||
| 116 | + }.height('69lpx') | ||
| 117 | + .width('659lpx') | ||
| 118 | + .alignItems(VerticalAlign.Center) | ||
| 119 | + .justifyContent(FlexAlign.Center) | ||
| 120 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 121 | + .margin({top:'31lpx',bottom:'4lpx'}) | ||
| 122 | + }.onClick(()=>{ | ||
| 123 | + let params = {'index': "1"} as Record<string, string>; | ||
| 124 | + WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) | ||
| 125 | + }) | ||
| 126 | + | ||
| 127 | + LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | ||
| 128 | + ListItem() { | ||
| 129 | + FollowChildComponent({data: item,type:2}) | ||
| 130 | + } | ||
| 131 | + .onClick(() => { | ||
| 132 | + }) | ||
| 133 | + }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 134 | + | ||
| 135 | + //没有更多数据 显示提示 | ||
| 136 | + if(!this.hasMore){ | ||
| 137 | + ListItem(){ | ||
| 138 | + ListHasNoMoreDataUI() | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + }.cachedCount(15) | ||
| 142 | + .padding({left:'31lpx',right:'31lpx'}) | ||
| 143 | + .layoutWeight(1) | ||
| 144 | + .scrollBar(BarState.Off) | ||
| 145 | + .edgeEffect(EdgeEffect.None) | ||
| 146 | + .nestedScroll({ | ||
| 147 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 148 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 149 | + }) | ||
| 150 | + } | ||
| 131 | 151 | ||
| 132 | @Styles | 152 | @Styles |
| 133 | listStyle() { | 153 | listStyle() { |
| @@ -27,7 +27,7 @@ struct EditUserInfoPage { | @@ -27,7 +27,7 @@ struct EditUserInfoPage { | ||
| 27 | } | 27 | } |
| 28 | }), | 28 | }), |
| 29 | alignment: DialogAlignment.Bottom, | 29 | alignment: DialogAlignment.Bottom, |
| 30 | - offset:{dx:0,dy:-20} | 30 | + offset:{dx:0,dy:0}, |
| 31 | }) | 31 | }) |
| 32 | 32 | ||
| 33 | aboutToAppear() { | 33 | aboutToAppear() { |
| @@ -97,14 +97,14 @@ struct EditUserInfoPage { | @@ -97,14 +97,14 @@ struct EditUserInfoPage { | ||
| 97 | Row(){ | 97 | Row(){ |
| 98 | Text(r.title) | 98 | Text(r.title) |
| 99 | .fontSize(15) | 99 | .fontSize(15) |
| 100 | - .fontColor(Color.Gray) | 100 | + .fontColor('#666666') |
| 101 | Blank() | 101 | Blank() |
| 102 | 102 | ||
| 103 | Text(r.subTitle) | 103 | Text(r.subTitle) |
| 104 | .textOverflow({overflow:TextOverflow.Ellipsis}) | 104 | .textOverflow({overflow:TextOverflow.Ellipsis}) |
| 105 | .maxLines(1) | 105 | .maxLines(1) |
| 106 | .fontSize(14) | 106 | .fontSize(14) |
| 107 | - .fontColor(Color.Gray) | 107 | + .fontColor(r.subTitle === '待完善'?'#cccccc':'#666666') |
| 108 | .padding({right:10}) | 108 | .padding({right:10}) |
| 109 | .width('70%') | 109 | .width('70%') |
| 110 | .textAlign(TextAlign.End) | 110 | .textAlign(TextAlign.End) |
| @@ -45,7 +45,7 @@ struct EditUserIntroductionPage { | @@ -45,7 +45,7 @@ struct EditUserIntroductionPage { | ||
| 45 | Divider() | 45 | Divider() |
| 46 | .margin(20) | 46 | .margin(20) |
| 47 | 47 | ||
| 48 | - Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多60个字,只能输入中文、数字、英文字母。') | 48 | + Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多60个字,只能输入中文、数字、英文字母。') |
| 49 | .fontSize(13) | 49 | .fontSize(13) |
| 50 | .padding(12) | 50 | .padding(12) |
| 51 | .fontColor(Color.Gray).lineHeight(25) | 51 | .fontColor(Color.Gray).lineHeight(25) |
| @@ -54,6 +54,8 @@ struct EditUserIntroductionPage { | @@ -54,6 +54,8 @@ struct EditUserIntroductionPage { | ||
| 54 | .type(ButtonType.Normal) | 54 | .type(ButtonType.Normal) |
| 55 | .width('90%') | 55 | .width('90%') |
| 56 | .backgroundColor('#ED2800') | 56 | .backgroundColor('#ED2800') |
| 57 | + .opacity(this.numCount === 0 ? 0.6 : 1) | ||
| 58 | + .fontColor(this.numCount === 0 ? '#999999' : Color.White) | ||
| 57 | .borderRadius(5) | 59 | .borderRadius(5) |
| 58 | .margin(30) | 60 | .margin(30) |
| 59 | .onClick(()=>{ | 61 | .onClick(()=>{ |
| @@ -47,7 +47,7 @@ struct EditUserNikeNamePage { | @@ -47,7 +47,7 @@ struct EditUserNikeNamePage { | ||
| 47 | Divider() | 47 | Divider() |
| 48 | .margin(20) | 48 | .margin(20) |
| 49 | 49 | ||
| 50 | - Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。') | 50 | + Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。') |
| 51 | .fontSize(13) | 51 | .fontSize(13) |
| 52 | .padding(12) | 52 | .padding(12) |
| 53 | .fontColor(Color.Gray).lineHeight(25) | 53 | .fontColor(Color.Gray).lineHeight(25) |
| @@ -56,6 +56,8 @@ struct EditUserNikeNamePage { | @@ -56,6 +56,8 @@ struct EditUserNikeNamePage { | ||
| 56 | .type(ButtonType.Normal) | 56 | .type(ButtonType.Normal) |
| 57 | .width('90%') | 57 | .width('90%') |
| 58 | .backgroundColor('#ED2800') | 58 | .backgroundColor('#ED2800') |
| 59 | + .opacity(this.numCount === 0 ? 0.6 : 1) | ||
| 60 | + .fontColor(this.numCount === 0 ? '#999999' : Color.White) | ||
| 59 | .borderRadius(5) | 61 | .borderRadius(5) |
| 60 | .margin(30) | 62 | .margin(30) |
| 61 | .onClick(()=>{ | 63 | .onClick(()=>{ |
| @@ -8,6 +8,7 @@ import { CustomTitleUI } from '../reusable/CustomTitleUI'; | @@ -8,6 +8,7 @@ import { CustomTitleUI } from '../reusable/CustomTitleUI'; | ||
| 8 | import { InteractMComponent } from '../InteractMessage/InteractMComponent'; | 8 | import { InteractMComponent } from '../InteractMessage/InteractMComponent'; |
| 9 | import { InteractMessageModel, WDMessageCenterMessageType } from '../../model/InteractMessageModel'; | 9 | import { InteractMessageModel, WDMessageCenterMessageType } from '../../model/InteractMessageModel'; |
| 10 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | 10 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; |
| 11 | +import { NetworkUtil } from 'wdKit/Index'; | ||
| 11 | 12 | ||
| 12 | @Entry | 13 | @Entry |
| 13 | @Component | 14 | @Component |
| @@ -28,24 +29,28 @@ struct InteractMessagePage { | @@ -28,24 +29,28 @@ struct InteractMessagePage { | ||
| 28 | build() { | 29 | build() { |
| 29 | Column(){ | 30 | Column(){ |
| 30 | CustomTitleUI({titleName:'互动消息'}) | 31 | CustomTitleUI({titleName:'互动消息'}) |
| 31 | - if(this.browSingModel.viewType == ViewType.ERROR){ | ||
| 32 | - EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed}) | ||
| 33 | - }else if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 34 | - EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory}) | 32 | + |
| 33 | + if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 34 | + EmptyComponent({emptyType:this.browSingModel.emptyType}) | ||
| 35 | }else { | 35 | }else { |
| 36 | CustomPullToRefresh({ | 36 | CustomPullToRefresh({ |
| 37 | alldata:this.allDatas, | 37 | alldata:this.allDatas, |
| 38 | scroller:this.scroller, | 38 | scroller:this.scroller, |
| 39 | + hasMore:this.browSingModel.hasMore, | ||
| 39 | customList:()=>{ | 40 | customList:()=>{ |
| 40 | this.ListLayout() | 41 | this.ListLayout() |
| 41 | }, | 42 | }, |
| 42 | onRefresh:(resolve)=>{ | 43 | onRefresh:(resolve)=>{ |
| 43 | - this.browSingModel.currentPage = 0 | 44 | + this.currentPage = 1 |
| 44 | this.getData(resolve) | 45 | this.getData(resolve) |
| 45 | }, | 46 | }, |
| 46 | onLoadMore:(resolve)=> { | 47 | onLoadMore:(resolve)=> { |
| 47 | - this.browSingModel.currentPage++ | ||
| 48 | - this.getData() | 48 | + if (this.browSingModel.hasMore === false) { |
| 49 | + if(resolve) resolve('') | ||
| 50 | + return | ||
| 51 | + } | ||
| 52 | + this.currentPage++ | ||
| 53 | + this.getData(resolve) | ||
| 49 | } | 54 | } |
| 50 | }) | 55 | }) |
| 51 | } | 56 | } |
| @@ -75,6 +80,7 @@ struct InteractMessagePage { | @@ -75,6 +80,7 @@ struct InteractMessagePage { | ||
| 75 | } | 80 | } |
| 76 | } | 81 | } |
| 77 | } | 82 | } |
| 83 | + .scrollBar(BarState.Off) | ||
| 78 | .height(CommonConstants.FULL_PARENT) | 84 | .height(CommonConstants.FULL_PARENT) |
| 79 | .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 | 85 | .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 |
| 80 | } | 86 | } |
| @@ -108,31 +114,40 @@ struct InteractMessagePage { | @@ -108,31 +114,40 @@ struct InteractMessagePage { | ||
| 108 | } | 114 | } |
| 109 | 115 | ||
| 110 | async getData(resolve?: (value: string | PromiseLike<string>) => void){ | 116 | async getData(resolve?: (value: string | PromiseLike<string>) => void){ |
| 111 | - InteractMessageViewModel.fetchMessageList(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact,this.currentPage).then(InteractMessageMItem => { | ||
| 112 | - if(resolve) resolve('刷新成功') | ||
| 113 | - if (InteractMessageMItem && InteractMessageMItem.list && InteractMessageMItem.list.length > 0) { | ||
| 114 | - this.browSingModel.viewType = ViewType.LOADED; | ||
| 115 | 117 | ||
| 116 | - if (this.currentPage === 1) { | ||
| 117 | - this.allDatas = [] | ||
| 118 | - } | 118 | + let netStatus = NetworkUtil.isNetConnected() |
| 119 | + if (netStatus) { | ||
| 120 | + InteractMessageViewModel.fetchMessageList(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact,this.currentPage).then(InteractMessageMItem => { | ||
| 121 | + if(resolve) resolve('刷新成功') | ||
| 122 | + if (InteractMessageMItem && InteractMessageMItem.list && InteractMessageMItem.list.length > 0) { | ||
| 123 | + this.browSingModel.viewType = ViewType.LOADED; | ||
| 119 | 124 | ||
| 120 | - for (let index = 0; index < InteractMessageMItem.list.length; index++) { | ||
| 121 | - const element = InteractMessageMItem.list[index]; | ||
| 122 | - element.InteractMsubM = JSON.parse(element.remark) | ||
| 123 | - } | 125 | + if (this.currentPage === 1) { |
| 126 | + this.allDatas = [] | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + for (let index = 0; index < InteractMessageMItem.list.length; index++) { | ||
| 130 | + const element = InteractMessageMItem.list[index]; | ||
| 131 | + element.InteractMsubM = JSON.parse(element.remark) | ||
| 132 | + this.allDatas.push(element) | ||
| 133 | + } | ||
| 124 | 134 | ||
| 125 | - this.allDatas.push(...InteractMessageMItem.list) | ||
| 126 | - if (InteractMessageMItem.list.length === this.browSingModel.pageSize) { | ||
| 127 | - this.browSingModel.currentPage++; | ||
| 128 | - this.browSingModel.hasMore = true; | 135 | + if (InteractMessageMItem.hasNext === 0) { |
| 136 | + this.browSingModel.hasMore = false; | ||
| 137 | + } else { | ||
| 138 | + this.browSingModel.hasMore = true; | ||
| 139 | + } | ||
| 129 | } else { | 140 | } else { |
| 130 | - this.browSingModel.hasMore = false; | 141 | + if (this.currentPage === 1) { |
| 142 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 143 | + this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoMessage; | ||
| 144 | + } | ||
| 131 | } | 145 | } |
| 132 | - } else { | ||
| 133 | - this.browSingModel.viewType = ViewType.EMPTY; | ||
| 134 | - } | ||
| 135 | - }) | 146 | + }) |
| 147 | + }else { | ||
| 148 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 149 | + this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork; | ||
| 150 | + } | ||
| 136 | } | 151 | } |
| 137 | 152 | ||
| 138 | async getMessageLikeCount(){ | 153 | async getMessageLikeCount(){ |
| @@ -11,6 +11,8 @@ import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | @@ -11,6 +11,8 @@ import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | ||
| 11 | import { BigPicCardComponent } from '../view/BigPicCardComponent'; | 11 | import { BigPicCardComponent } from '../view/BigPicCardComponent'; |
| 12 | import { contentListItemParams } from '../../model/MyCollectionModel'; | 12 | import { contentListItemParams } from '../../model/MyCollectionModel'; |
| 13 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | 13 | import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; |
| 14 | +import { MyCustomDialog } from '../reusable/MyCustomDialog' | ||
| 15 | +import { NetworkUtil } from 'wdKit/Index'; | ||
| 14 | 16 | ||
| 15 | @Entry | 17 | @Entry |
| 16 | @Component | 18 | @Component |
| @@ -25,6 +27,20 @@ struct MyCollectionListPage { | @@ -25,6 +27,20 @@ struct MyCollectionListPage { | ||
| 25 | 27 | ||
| 26 | @State currentPage: number = 1; | 28 | @State currentPage: number = 1; |
| 27 | private scroller: Scroller = new Scroller(); | 29 | private scroller: Scroller = new Scroller(); |
| 30 | + emptyType: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default | ||
| 31 | + | ||
| 32 | + dialogController: CustomDialogController = new CustomDialogController({ | ||
| 33 | + builder: MyCustomDialog({ | ||
| 34 | + confirm: () => { | ||
| 35 | + this.deleteDatas() | ||
| 36 | + }, | ||
| 37 | + titleShow:false, | ||
| 38 | + tipValue: this.isAllSelect?'是否确认清空?':'确认删除'+this.deleteNum.toString()+'条收藏' | ||
| 39 | + }), | ||
| 40 | + autoCancel: true, | ||
| 41 | + alignment: DialogAlignment.Center, | ||
| 42 | + customStyle: true | ||
| 43 | + }) | ||
| 28 | 44 | ||
| 29 | aboutToAppear(){ | 45 | aboutToAppear(){ |
| 30 | this.getData() | 46 | this.getData() |
| @@ -32,17 +48,15 @@ struct MyCollectionListPage { | @@ -32,17 +48,15 @@ struct MyCollectionListPage { | ||
| 32 | 48 | ||
| 33 | build() { | 49 | build() { |
| 34 | Column(){ | 50 | Column(){ |
| 35 | - CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:true,editCallback:()=>{ | 51 | + CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:this.browSingModel.viewType == ViewType.ERROR || this.browSingModel.viewType == ViewType.EMPTY?false:true,editCallback:()=>{ |
| 36 | this.allSelectDatas(false) | 52 | this.allSelectDatas(false) |
| 37 | this.isAllSelect = false | 53 | this.isAllSelect = false |
| 38 | this.selectDatas = [] | 54 | this.selectDatas = [] |
| 39 | this.deleteNum = 0 | 55 | this.deleteNum = 0 |
| 40 | }}) | 56 | }}) |
| 41 | 57 | ||
| 42 | - if(this.browSingModel.viewType == ViewType.ERROR){ | ||
| 43 | - ErrorComponent() | ||
| 44 | - }else if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 45 | - EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoCollection}) | 58 | + if(this.browSingModel.viewType == ViewType.EMPTY){ |
| 59 | + EmptyComponent({emptyType:this.browSingModel.emptyType}) | ||
| 46 | }else { | 60 | }else { |
| 47 | CustomPullToRefresh({ | 61 | CustomPullToRefresh({ |
| 48 | alldata:this.allDatas, | 62 | alldata:this.allDatas, |
| @@ -73,7 +87,7 @@ struct MyCollectionListPage { | @@ -73,7 +87,7 @@ struct MyCollectionListPage { | ||
| 73 | this.allSelectDatas(isAllSelect) | 87 | this.allSelectDatas(isAllSelect) |
| 74 | }, | 88 | }, |
| 75 | confirmCallback:()=>{ | 89 | confirmCallback:()=>{ |
| 76 | - this.deleteDatas() | 90 | + this.dialogController.open() |
| 77 | } | 91 | } |
| 78 | }) | 92 | }) |
| 79 | } | 93 | } |
| @@ -100,6 +114,7 @@ struct MyCollectionListPage { | @@ -100,6 +114,7 @@ struct MyCollectionListPage { | ||
| 100 | if (this.browSingModel.hasMore === false) NoMoreLayout() | 114 | if (this.browSingModel.hasMore === false) NoMoreLayout() |
| 101 | } | 115 | } |
| 102 | } | 116 | } |
| 117 | + .scrollBar(BarState.Off) | ||
| 103 | .height(CommonConstants.FULL_PARENT) | 118 | .height(CommonConstants.FULL_PARENT) |
| 104 | .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 | 119 | .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 |
| 105 | } | 120 | } |
| @@ -122,31 +137,39 @@ struct MyCollectionListPage { | @@ -122,31 +137,39 @@ struct MyCollectionListPage { | ||
| 122 | } | 137 | } |
| 123 | } | 138 | } |
| 124 | 139 | ||
| 140 | + | ||
| 125 | async getData(resolve?: (value: string | PromiseLike<string>) => void) { | 141 | async getData(resolve?: (value: string | PromiseLike<string>) => void) { |
| 126 | - MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => { | ||
| 127 | - if(resolve) resolve('刷新成功') | ||
| 128 | - if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | ||
| 129 | - if (this.currentPage === 1) { | ||
| 130 | - this.allDatas = [] | ||
| 131 | - } | 142 | + let netStatus = NetworkUtil.isNetConnected() |
| 143 | + if (netStatus) { | ||
| 144 | + MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => { | ||
| 145 | + if(resolve) resolve('刷新成功') | ||
| 146 | + if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | ||
| 147 | + if (this.currentPage === 1) { | ||
| 148 | + this.allDatas = [] | ||
| 149 | + } | ||
| 132 | 150 | ||
| 133 | - for (let index = 0; index < collectionItem.list.length; index++) { | ||
| 134 | - const compDTO = collectionItem.list[index]; | ||
| 135 | - compDTO.isCollection = true ///用于时间展示 | ||
| 136 | - this.allDatas.push(compDTO) | ||
| 137 | - } | 151 | + for (let index = 0; index < collectionItem.list.length; index++) { |
| 152 | + const compDTO = collectionItem.list[index]; | ||
| 153 | + compDTO.isCollection = true ///用于时间展示 | ||
| 154 | + this.allDatas.push(compDTO) | ||
| 155 | + } | ||
| 138 | 156 | ||
| 139 | - if (collectionItem.hasNext === 0) { | ||
| 140 | - this.browSingModel.hasMore = false; | 157 | + if (collectionItem.hasNext === 0) { |
| 158 | + this.browSingModel.hasMore = false; | ||
| 159 | + } else { | ||
| 160 | + this.browSingModel.hasMore = true; | ||
| 161 | + } | ||
| 141 | } else { | 162 | } else { |
| 142 | - this.browSingModel.hasMore = true; | ||
| 143 | - } | ||
| 144 | - } else { | ||
| 145 | - if (this.currentPage === 1) { | ||
| 146 | - this.browSingModel.viewType = ViewType.EMPTY; | 163 | + if (this.currentPage === 1) { |
| 164 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 165 | + this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoCollection | ||
| 166 | + } | ||
| 147 | } | 167 | } |
| 148 | - } | ||
| 149 | - }) | 168 | + }) |
| 169 | + } else { | ||
| 170 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 171 | + this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork; | ||
| 172 | + } | ||
| 150 | } | 173 | } |
| 151 | 174 | ||
| 152 | //数据处理 | 175 | //数据处理 |
| @@ -15,7 +15,8 @@ import { NoMoreBean } from './NoMoreBean'; | @@ -15,7 +15,8 @@ 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'; | 17 | import json from '@ohos.util.json'; |
| 18 | - | 18 | +import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare' |
| 19 | +import { common } from '@kit.AbilityKit'; | ||
| 19 | const TAG = 'PageComponent'; | 20 | const TAG = 'PageComponent'; |
| 20 | 21 | ||
| 21 | @Component | 22 | @Component |
| @@ -31,7 +32,6 @@ export struct PageComponent { | @@ -31,7 +32,6 @@ export struct PageComponent { | ||
| 31 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | 32 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 |
| 32 | private listScroller: Scroller = new Scroller(); | 33 | private listScroller: Scroller = new Scroller(); |
| 33 | needload: boolean = true; | 34 | needload: boolean = true; |
| 34 | - | ||
| 35 | build() { | 35 | build() { |
| 36 | Column() { | 36 | Column() { |
| 37 | if (this.pageModel.viewType == ViewType.LOADING) { | 37 | if (this.pageModel.viewType == ViewType.LOADING) { |
| @@ -257,7 +257,6 @@ export struct PageComponent { | @@ -257,7 +257,6 @@ export struct PageComponent { | ||
| 257 | this.pageModel.pageTotalCompSize = 0; | 257 | this.pageModel.pageTotalCompSize = 0; |
| 258 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) | 258 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) |
| 259 | }, 100) | 259 | }, 100) |
| 260 | - | ||
| 261 | } | 260 | } |
| 262 | } | 261 | } |
| 263 | 262 |
| 1 | -import { insightIntent } from '@kit.IntentsKit'; | ||
| 2 | import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean'; | 1 | import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean'; |
| 3 | import { SpConstants } from 'wdConstant'; | 2 | import { SpConstants } from 'wdConstant'; |
| 4 | import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; | 3 | import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; |
| @@ -9,8 +8,6 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent | @@ -9,8 +8,6 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent | ||
| 9 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; | 8 | import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils'; |
| 10 | import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; | 9 | import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent'; |
| 11 | import { channelSkeleton } from '../skeleton/channelSkeleton'; | 10 | import { channelSkeleton } from '../skeleton/channelSkeleton'; |
| 12 | -import { common } from '@kit.AbilityKit'; | ||
| 13 | - | ||
| 14 | 11 | ||
| 15 | const TAG = 'TopNavigationComponent'; | 12 | const TAG = 'TopNavigationComponent'; |
| 16 | 13 | ||
| @@ -61,8 +58,6 @@ export struct TopNavigationComponent { | @@ -61,8 +58,6 @@ export struct TopNavigationComponent { | ||
| 61 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 | 58 | @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 |
| 62 | // 传递给page的自动刷新通知 | 59 | // 传递给page的自动刷新通知 |
| 63 | @State autoRefresh2Page: number = 0 | 60 | @State autoRefresh2Page: number = 0 |
| 64 | - //保存当前导航选中时的时间戳 意图开始时间 | ||
| 65 | - @State executedStartTime: number = new Date().getTime() | ||
| 66 | // 当前底导index | 61 | // 当前底导index |
| 67 | @State navIndex: number = 0 | 62 | @State navIndex: number = 0 |
| 68 | @State animationDuration: number = 0 | 63 | @State animationDuration: number = 0 |
| @@ -190,48 +185,6 @@ export struct TopNavigationComponent { | @@ -190,48 +185,6 @@ export struct TopNavigationComponent { | ||
| 190 | return item.channelType === 3 | 185 | return item.channelType === 3 |
| 191 | } | 186 | } |
| 192 | 187 | ||
| 193 | - //意图共享 | ||
| 194 | - topNavInsightIntentShare(item: TopNavDTO){ | ||
| 195 | - let tapNavIntent: insightIntent.InsightIntent = { | ||
| 196 | - intentName: 'ViewBlog', | ||
| 197 | - intentVersion: '1.0.1', | ||
| 198 | - identifier: '52dac3b0-6520-4974-81e5-25f0879449b5', | ||
| 199 | - intentActionInfo: { | ||
| 200 | - actionMode: 'EXPECTED', | ||
| 201 | - currentPercentage: 50, | ||
| 202 | - executedTimeSlots: { | ||
| 203 | - executedEndTime: new Date().getTime(), | ||
| 204 | - executedStartTime: this.executedStartTime | ||
| 205 | - } | ||
| 206 | - }, | ||
| 207 | - intentEntityInfo: { | ||
| 208 | - entityName: 'Blog', | ||
| 209 | - entityId: String(item.pageId) || '', | ||
| 210 | - displayName: item.name, | ||
| 211 | - logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png', | ||
| 212 | - rankingHint: 99, | ||
| 213 | - isPublicData: true | ||
| 214 | - } | ||
| 215 | - } | ||
| 216 | - console.log('yzl',JSON.stringify(tapNavIntent)) | ||
| 217 | - try { | ||
| 218 | - let context = getContext(this) as common.UIAbilityContext; | ||
| 219 | - // 共享数据 | ||
| 220 | - insightIntent.shareIntent(context, [tapNavIntent], (error) => { | ||
| 221 | - if (error?.code) { | ||
| 222 | - // 处理业务逻辑错误 | ||
| 223 | - console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 224 | - return; | ||
| 225 | - } | ||
| 226 | - // 执行正常业务 | ||
| 227 | - console.log('shareIntent succeed'); | ||
| 228 | - }); | ||
| 229 | - } catch (error) { | ||
| 230 | - // 处理异常 | ||
| 231 | - console.error(`error.code: ${error?.code}, error.message: ${error?.message}`); | ||
| 232 | - } | ||
| 233 | - } | ||
| 234 | - | ||
| 235 | 188 | ||
| 236 | build() { | 189 | build() { |
| 237 | Column() { | 190 | Column() { |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | -import { StringUtils, ToastUtils } from 'wdKit' | 2 | +import { NetworkUtil, StringUtils, ToastUtils } from 'wdKit' |
| 3 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 3 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 4 | import { SearchHistoryItem } from '../../viewmodel/SearchHistoryItem' | 4 | import { SearchHistoryItem } from '../../viewmodel/SearchHistoryItem' |
| 5 | import { SearchRelatedItem } from '../../viewmodel/SearchRelatedItem' | 5 | import { SearchRelatedItem } from '../../viewmodel/SearchRelatedItem' |
| 6 | +import { EmptyComponent } from '../view/EmptyComponent' | ||
| 6 | import { SearchHistoryComponent } from './SearchHistoryComponent' | 7 | import { SearchHistoryComponent } from './SearchHistoryComponent' |
| 7 | import { SearchHotsComponent } from './SearchHotsComponent' | 8 | import { SearchHotsComponent } from './SearchHotsComponent' |
| 8 | import { SearchRelatedComponent } from './SearchRelatedComponent' | 9 | import { SearchRelatedComponent } from './SearchRelatedComponent' |
| @@ -30,6 +31,7 @@ export struct SearchComponent { | @@ -30,6 +31,7 @@ export struct SearchComponent { | ||
| 30 | scroller: Scroller = new Scroller() | 31 | scroller: Scroller = new Scroller() |
| 31 | @State count:string[] = [] | 32 | @State count:string[] = [] |
| 32 | @State isGetRequest:boolean = false; | 33 | @State isGetRequest:boolean = false; |
| 34 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 33 | 35 | ||
| 34 | aboutToAppear() { | 36 | aboutToAppear() { |
| 35 | //获取提示滚动 | 37 | //获取提示滚动 |
| @@ -127,8 +129,16 @@ export struct SearchComponent { | @@ -127,8 +129,16 @@ export struct SearchComponent { | ||
| 127 | .padding({ left: '31lpx', right: '31lpx' }) | 129 | .padding({ left: '31lpx', right: '31lpx' }) |
| 128 | } else { | 130 | } else { |
| 129 | if (this.hasChooseSearch) { | 131 | if (this.hasChooseSearch) { |
| 130 | - //搜索结果 | ||
| 131 | - SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest}) | 132 | + if(!this.isConnectNetwork){ |
| 133 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 134 | + this.getSearchInputResData(this.searchText) | ||
| 135 | + }}) | ||
| 136 | + .layoutWeight(1) | ||
| 137 | + .width('100%') | ||
| 138 | + }else{ | ||
| 139 | + //搜索结果 | ||
| 140 | + SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest}) | ||
| 141 | + } | ||
| 132 | } else { | 142 | } else { |
| 133 | //联想搜索 | 143 | //联想搜索 |
| 134 | SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) | 144 | SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) |
| @@ -138,7 +148,6 @@ export struct SearchComponent { | @@ -138,7 +148,6 @@ export struct SearchComponent { | ||
| 138 | .width('100%') | 148 | .width('100%') |
| 139 | } | 149 | } |
| 140 | 150 | ||
| 141 | - | ||
| 142 | /** | 151 | /** |
| 143 | * 点击搜索记录列表回调 | 152 | * 点击搜索记录列表回调 |
| 144 | * @param content | 153 | * @param content |
| @@ -329,11 +338,13 @@ export struct SearchComponent { | @@ -329,11 +338,13 @@ export struct SearchComponent { | ||
| 329 | // } | 338 | // } |
| 330 | } | 339 | } |
| 331 | this.isGetRequest = true | 340 | this.isGetRequest = true |
| 332 | - this.resetSearch() | 341 | + this.resetSearch() |
| 342 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 333 | }).catch((err: Error) => { | 343 | }).catch((err: Error) => { |
| 334 | console.log(TAG, JSON.stringify(err)) | 344 | console.log(TAG, JSON.stringify(err)) |
| 335 | this.isGetRequest = true | 345 | this.isGetRequest = true |
| 336 | this.resetSearch() | 346 | this.resetSearch() |
| 347 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 337 | }) | 348 | }) |
| 338 | } | 349 | } |
| 339 | 350 |
| @@ -15,6 +15,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | @@ -15,6 +15,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 15 | import MinePageDatasModel from '../../model/MinePageDatasModel' | 15 | import MinePageDatasModel from '../../model/MinePageDatasModel' |
| 16 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 16 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 17 | import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' | 17 | import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' |
| 18 | +import { CreatorDetailResponseItem } from '../../viewmodel/CreatorDetailResponseItem'; | ||
| 18 | import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem' | 19 | import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem' |
| 19 | import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem' | 20 | import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem' |
| 20 | import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem' | 21 | import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem' |
| @@ -63,6 +64,7 @@ export struct SearchResultContentComponent { | @@ -63,6 +64,7 @@ export struct SearchResultContentComponent { | ||
| 63 | if (this.hasMore) { | 64 | if (this.hasMore) { |
| 64 | SearcherAboutDataModel.getSearchResultListData("15", `${this.curPageNum}`, this.searchType, this.keywords, | 65 | SearcherAboutDataModel.getSearchResultListData("15", `${this.curPageNum}`, this.searchType, this.keywords, |
| 65 | getContext(this)).then((value) => { | 66 | getContext(this)).then((value) => { |
| 67 | + | ||
| 66 | if (!this.data || value.list.length == 0) { | 68 | if (!this.data || value.list.length == 0) { |
| 67 | this.hasMore = false | 69 | this.hasMore = false |
| 68 | this.isLoading = false | 70 | this.isLoading = false |
| @@ -70,7 +72,6 @@ export struct SearchResultContentComponent { | @@ -70,7 +72,6 @@ export struct SearchResultContentComponent { | ||
| 70 | } else { | 72 | } else { |
| 71 | if (value.list[0].dataList != null) { | 73 | if (value.list[0].dataList != null) { |
| 72 | let data_temp: SearchRmhDescription[] = [] | 74 | let data_temp: SearchRmhDescription[] = [] |
| 73 | - | ||
| 74 | data_temp = value.list[0].dataList | 75 | data_temp = value.list[0].dataList |
| 75 | 76 | ||
| 76 | //TODO 查询创作者详情接口 | 77 | //TODO 查询创作者详情接口 |
| @@ -121,7 +122,6 @@ export struct SearchResultContentComponent { | @@ -121,7 +122,6 @@ export struct SearchResultContentComponent { | ||
| 121 | data_temp.forEach((data) => { | 122 | data_temp.forEach((data) => { |
| 122 | this.data_rmh.push(data) | 123 | this.data_rmh.push(data) |
| 123 | }) | 124 | }) |
| 124 | - | ||
| 125 | //只有一条创作者,获取 创作者信息 | 125 | //只有一条创作者,获取 创作者信息 |
| 126 | if (this.data_rmh.length === 1) { | 126 | if (this.data_rmh.length === 1) { |
| 127 | if(StringUtils.isNotEmpty(UserDataLocal.getUserId())){ | 127 | if(StringUtils.isNotEmpty(UserDataLocal.getUserId())){ |
| @@ -178,21 +178,34 @@ export struct SearchResultContentComponent { | @@ -178,21 +178,34 @@ export struct SearchResultContentComponent { | ||
| 178 | } | 178 | } |
| 179 | }) | 179 | }) |
| 180 | }) | 180 | }) |
| 181 | + // 批量号主信息 | ||
| 182 | + let creatorIdList: string[] = [] | ||
| 183 | + resultData.list.forEach((value:SearchResultContentItem) => { | ||
| 184 | + creatorIdList.push(value.data.creatorId) | ||
| 185 | + }) | ||
| 186 | + SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => { | ||
| 181 | 187 | ||
| 182 | - resultData.list.forEach((value) => { | ||
| 183 | - let photos: FullColumnImgUrlDTO[] = [] | ||
| 184 | - if (value.data.appStyle === 4) { | ||
| 185 | - value.data.appStyleImages.split("&&").forEach((value) => { | ||
| 186 | - photos.push({ url: value } as FullColumnImgUrlDTO) | ||
| 187 | - }) | ||
| 188 | - } | ||
| 189 | 188 | ||
| 190 | - let contentDTO = this.dataTransform(value, photos); | ||
| 191 | - if(value.data.type != "13"){ | ||
| 192 | - this.data.push(contentDTO) | ||
| 193 | - } | 189 | + resultData.list.forEach((value) => { |
| 190 | + let photos: FullColumnImgUrlDTO[] = [] | ||
| 191 | + // if (value.data.appStyle === 4) { | ||
| 192 | + value.data.appStyleImages.split("&&").forEach((value) => { | ||
| 193 | + const resizeParams = this.extractResizeParams(value) | ||
| 194 | + photos.push({ fullUrl: value,weight:resizeParams.width,height:resizeParams.height, } as FullColumnImgUrlDTO) | ||
| 195 | + }) | ||
| 196 | + // } | ||
| 197 | + let contentDTO = this.dataTransform(rem,value, photos); | ||
| 198 | + if(value.data.type != "13"){ | ||
| 199 | + this.data.push(contentDTO) | ||
| 200 | + } | ||
| 201 | + }) | ||
| 202 | + | ||
| 194 | 203 | ||
| 204 | + }).catch((err: Error) => { | ||
| 205 | + console.log(TAG, JSON.stringify(err)) | ||
| 195 | }) | 206 | }) |
| 207 | + | ||
| 208 | + | ||
| 196 | this.data.notifyDataReload() | 209 | this.data.notifyDataReload() |
| 197 | this.count = this.data.totalCount() | 210 | this.count = this.data.totalCount() |
| 198 | if (this.data.totalCount() < resultData.totalCount) { | 211 | if (this.data.totalCount() < resultData.totalCount) { |
| @@ -380,84 +393,171 @@ export struct SearchResultContentComponent { | @@ -380,84 +393,171 @@ export struct SearchResultContentComponent { | ||
| 380 | .strokeWidth('12lpx') | 393 | .strokeWidth('12lpx') |
| 381 | } | 394 | } |
| 382 | 395 | ||
| 383 | - private dataTransform(value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO { | ||
| 384 | - let contentDTO = new ContentDTO(); | ||
| 385 | - contentDTO.appStyle = value.data.appStyle + "" | ||
| 386 | - contentDTO.cityCode = value.data.cityCode | ||
| 387 | - contentDTO.coverSize = "" | ||
| 388 | - contentDTO.coverType = value.data.type == "5" ? 1 : -1 | ||
| 389 | - contentDTO.coverUrl = | ||
| 390 | - this.searchType == "activity" ? value.data.zhChannelPageImg : value.data.appStyleImages.split("&&")[0]; | ||
| 391 | - contentDTO.description = value.data.description | ||
| 392 | - contentDTO.districtCode = value.data.districtCode | ||
| 393 | - contentDTO.endTime = value.data.endTime | ||
| 394 | - contentDTO.hImageUrl = "" | ||
| 395 | - contentDTO.heatValue = "" | ||
| 396 | - contentDTO.innerUrl = "" | ||
| 397 | - contentDTO.landscape = Number.parseInt(value.data.landscape) | ||
| 398 | - contentDTO.linkUrl = value.data.linkUrl | ||
| 399 | - contentDTO.openLikes = Number.parseInt(value.data.openLikes) | ||
| 400 | - contentDTO.openUrl = "" | ||
| 401 | - contentDTO.pageId = value.data.pageId | ||
| 402 | - contentDTO.programAuth = "" | ||
| 403 | - contentDTO.programId = "" | ||
| 404 | - contentDTO.programName = "" | ||
| 405 | - contentDTO.programSource = -1 | ||
| 406 | - contentDTO.programType = Number.parseInt(value.data.status) | ||
| 407 | - contentDTO.provinceCode = value.data.provinceCode | ||
| 408 | - contentDTO.showTitleEd = value.data.showTitleEd | ||
| 409 | - contentDTO.showTitleIng = value.data.showTitleIng | ||
| 410 | - contentDTO.showTitleNo = value.data.showTitleNo | ||
| 411 | - contentDTO.startTime = value.data.startTime | ||
| 412 | - contentDTO.subType = "" | ||
| 413 | - contentDTO.subtitle = "" | ||
| 414 | - contentDTO.title = value.data.title | ||
| 415 | - contentDTO.vImageUrl = "" | ||
| 416 | - contentDTO.screenType = "" | ||
| 417 | - contentDTO.source = StringUtils.isEmpty(value.data.creatorName) ? value.data.sourceName : value.data.creatorName | ||
| 418 | - contentDTO.objectId = value.data.id | ||
| 419 | - contentDTO.objectType = value.data.type | ||
| 420 | - contentDTO.channelId = value.data.channelId | ||
| 421 | - contentDTO.relId = value.data.relId | ||
| 422 | - contentDTO.relType = value.data.relType | ||
| 423 | - contentDTO.newsTitle = value.data.titleLiteral; | ||
| 424 | - contentDTO.publishTime = | ||
| 425 | - StringUtils.isNotEmpty(value.data.firstPublishTime) ? value.data.firstPublishTime : value.data.publishTime | ||
| 426 | - contentDTO.visitorComment = -1 | ||
| 427 | - contentDTO.fullColumnImgUrls = photos | ||
| 428 | - contentDTO.newsSummary = "" | ||
| 429 | - contentDTO.hasMore = -1 | ||
| 430 | - contentDTO.slideShows = [] | ||
| 431 | - contentDTO.voiceInfo = {} as VoiceInfoDTO | ||
| 432 | - contentDTO.tagWord = -1 | ||
| 433 | - contentDTO.isSelect = true | ||
| 434 | - contentDTO.rmhInfo = {} as RmhInfoDTO | ||
| 435 | - contentDTO.photoNum = -1 | ||
| 436 | - contentDTO.liveInfo = {} as LiveInfoDTO; | ||
| 437 | - contentDTO.videoInfo = { | ||
| 438 | - videoDuration: Number.parseInt(value.data.duration) | ||
| 439 | - } as VideoInfoDTO; | ||
| 440 | - | ||
| 441 | - let interact = new InteractDataDTO() | ||
| 442 | - interact.collectNum = value.data.collectNum | ||
| 443 | - interact.commentNum = value.data.commentNum | ||
| 444 | - interact.contentId = value.data.id | ||
| 445 | - interact.contentType = Number.parseInt(value.data.type) | ||
| 446 | - interact.likeNum = value.data.likeNum | ||
| 447 | - interact.readNum = Number.parseInt(value.data.readNum) | ||
| 448 | - interact.shareNum = Number.parseInt(value.data.shareNum) | ||
| 449 | - contentDTO.interactData = interact | ||
| 450 | - contentDTO.corner = '' | ||
| 451 | - contentDTO.rmhPlatform = 0 | ||
| 452 | - contentDTO.newTags = '' | ||
| 453 | - contentDTO.isSearch = true | ||
| 454 | - contentDTO.publishTimestamp = "" | ||
| 455 | - contentDTO.bottomNavId = ''; | ||
| 456 | - contentDTO.openType = ''; | ||
| 457 | - contentDTO.extra = ''; | ||
| 458 | - contentDTO.titleShow = value.data.type == "5" ? 1 : 0; | ||
| 459 | - contentDTO.contentText = value.data.contentText; | ||
| 460 | - | ||
| 461 | - return contentDTO; | 396 | + private dataTransform(rem:CreatorDetailResponseItem[],value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO { |
| 397 | + let rmhInfo = this.getRmhInfo(rem,value) | ||
| 398 | + console.log('获取photos',JSON.stringify(photos)) | ||
| 399 | + console.log('获取value2',JSON.stringify(value)) | ||
| 400 | + let contentDTO = new ContentDTO(); | ||
| 401 | + contentDTO.appStyle = value.data.appStyle + "" | ||
| 402 | + contentDTO.cityCode = value.data.cityCode | ||
| 403 | + contentDTO.coverSize = "" | ||
| 404 | + contentDTO.coverType = value.data.type == "5" ? 1 : -1 | ||
| 405 | + contentDTO.coverUrl = | ||
| 406 | + this.searchType == "activity" ? value.data.zhChannelPageImg : value.data.appStyleImages.split("&&")[0]; | ||
| 407 | + contentDTO.description = value.data.description | ||
| 408 | + contentDTO.districtCode = value.data.districtCode | ||
| 409 | + contentDTO.endTime = value.data.endTime | ||
| 410 | + contentDTO.hImageUrl = "" | ||
| 411 | + contentDTO.heatValue = "" | ||
| 412 | + contentDTO.innerUrl = "" | ||
| 413 | + contentDTO.landscape = Number.parseInt(value.data.landscape) | ||
| 414 | + contentDTO.linkUrl = value.data.linkUrl | ||
| 415 | + contentDTO.openLikes = Number.parseInt(value.data.openLikes) | ||
| 416 | + contentDTO.openUrl = "" | ||
| 417 | + contentDTO.pageId = value.data.pageId | ||
| 418 | + contentDTO.programAuth = "" | ||
| 419 | + contentDTO.programId = "" | ||
| 420 | + contentDTO.programName = "" | ||
| 421 | + contentDTO.programSource = -1 | ||
| 422 | + contentDTO.programType = Number.parseInt(value.data.status) | ||
| 423 | + contentDTO.provinceCode = value.data.provinceCode | ||
| 424 | + contentDTO.showTitleEd = value.data.showTitleEd | ||
| 425 | + contentDTO.showTitleIng = value.data.showTitleIng | ||
| 426 | + contentDTO.showTitleNo = value.data.showTitleNo | ||
| 427 | + contentDTO.startTime = value.data.startTime | ||
| 428 | + contentDTO.subType = "" | ||
| 429 | + contentDTO.subtitle = "" | ||
| 430 | + contentDTO.title = value.data.title | ||
| 431 | + contentDTO.vImageUrl = "" | ||
| 432 | + contentDTO.screenType = "" | ||
| 433 | + contentDTO.source = StringUtils.isEmpty(value.data.creatorName) ? value.data.sourceName : value.data.creatorName | ||
| 434 | + contentDTO.objectId = value.data.id | ||
| 435 | + contentDTO.objectType = value.data.type | ||
| 436 | + contentDTO.channelId = value.data.channelId | ||
| 437 | + contentDTO.relId = value.data.relId | ||
| 438 | + contentDTO.relType = value.data.relType | ||
| 439 | + contentDTO.newsTitle = value.data.titleLiteral; | ||
| 440 | + contentDTO.publishTime = | ||
| 441 | + StringUtils.isNotEmpty(value.data.firstPublishTime) ? value.data.firstPublishTime : value.data.publishTime | ||
| 442 | + contentDTO.visitorComment = -1 | ||
| 443 | + contentDTO.fullColumnImgUrls = photos | ||
| 444 | + contentDTO.newsSummary = "" | ||
| 445 | + contentDTO.hasMore = -1 | ||
| 446 | + contentDTO.slideShows = [] | ||
| 447 | + contentDTO.voiceInfo = {} as VoiceInfoDTO | ||
| 448 | + contentDTO.tagWord = -1 | ||
| 449 | + contentDTO.isSelect = true | ||
| 450 | + contentDTO.rmhInfo = {} as RmhInfoDTO | ||
| 451 | + contentDTO.photoNum = -1 | ||
| 452 | + contentDTO.liveInfo = {} as LiveInfoDTO; | ||
| 453 | + contentDTO.videoInfo = { | ||
| 454 | + videoDuration: Number.parseInt(value.data.duration) | ||
| 455 | + } as VideoInfoDTO; | ||
| 456 | + | ||
| 457 | + let interact = new InteractDataDTO() | ||
| 458 | + interact.collectNum = value.data.collectNum | ||
| 459 | + interact.commentNum = value.data.commentNum | ||
| 460 | + interact.contentId = value.data.id | ||
| 461 | + interact.contentType = Number.parseInt(value.data.type) | ||
| 462 | + interact.likeNum = value.data.likeNum | ||
| 463 | + interact.readNum = Number.parseInt(value.data.readNum) | ||
| 464 | + interact.shareNum = Number.parseInt(value.data.shareNum) | ||
| 465 | + contentDTO.interactData = interact | ||
| 466 | + contentDTO.corner = '' | ||
| 467 | + contentDTO.rmhPlatform = 0 | ||
| 468 | + contentDTO.newTags = '' | ||
| 469 | + contentDTO.isSearch = true | ||
| 470 | + contentDTO.publishTimestamp = "" | ||
| 471 | + contentDTO.bottomNavId = ''; | ||
| 472 | + contentDTO.openType = ''; | ||
| 473 | + contentDTO.extra = ''; | ||
| 474 | + contentDTO.titleShow = value.data.type == "5" ? 1 : 0; | ||
| 475 | + contentDTO.rmhInfo = rmhInfo | ||
| 476 | + contentDTO.shareFlag = value.data.shareFlag | ||
| 477 | + return contentDTO; | ||
| 478 | + | ||
| 479 | + | ||
| 480 | + | ||
| 481 | + } | ||
| 482 | + // 搜索数据转化rmhInfo | ||
| 483 | + private getRmhInfo(rem:CreatorDetailResponseItem[],value:SearchResultContentItem){ | ||
| 484 | + let obj = value.data | ||
| 485 | + let rmhInfo:RmhInfoDTO = { | ||
| 486 | + rmhHeadUrl:obj.headerPhotoUrl, | ||
| 487 | + rmhName:obj.creatorName, | ||
| 488 | + rmhId:obj.creatorId, | ||
| 489 | + authIcon:obj.authIcon, | ||
| 490 | + authTitle: obj.authTitle, | ||
| 491 | + authTitle2: '', | ||
| 492 | + banControl: 0, | ||
| 493 | + cnIsAttention: 0, | ||
| 494 | + cnAttention: 0, | ||
| 495 | + cnlsComment: 0, | ||
| 496 | + cnlsLike: 0, | ||
| 497 | + cnMainControl: 0, | ||
| 498 | + cnShareControl: 0, | ||
| 499 | + cnIsComment: 0, | ||
| 500 | + cnIsLike:0, | ||
| 501 | + posterShareControl: 0, | ||
| 502 | + rmhDesc: obj.introduction, | ||
| 503 | + userId: obj.userId, | ||
| 504 | + userType: obj.userType, | ||
| 505 | + honoraryIcon:'' | ||
| 506 | + } | ||
| 507 | + if(rem.length>0){ | ||
| 508 | + rem.forEach(item=>{ | ||
| 509 | + if(item.creatorId === obj.creatorId){ | ||
| 510 | + rmhInfo = { | ||
| 511 | + rmhHeadUrl:item.headPhotoUrl, | ||
| 512 | + rmhName:item.userName, | ||
| 513 | + rmhId:item.creatorId, | ||
| 514 | + authIcon:item.authIcon, | ||
| 515 | + authTitle: item.authTitle, | ||
| 516 | + authTitle2: '', | ||
| 517 | + banControl: 0, | ||
| 518 | + cnIsAttention:item.isAttention, | ||
| 519 | + cnAttention: 0, | ||
| 520 | + cnlsComment: 0, | ||
| 521 | + cnlsLike: 0, | ||
| 522 | + cnMainControl: 0, | ||
| 523 | + cnShareControl: 0, | ||
| 524 | + cnIsComment: 0, | ||
| 525 | + cnIsLike:0, | ||
| 526 | + posterShareControl: 0, | ||
| 527 | + rmhDesc: item.introduction, | ||
| 528 | + userId: item.userId, | ||
| 529 | + userType: item.userType, | ||
| 530 | + honoraryIcon:'' | ||
| 531 | + } | ||
| 532 | + } | ||
| 533 | + }) | ||
| 534 | + } | ||
| 535 | + return rmhInfo | ||
| 536 | + } | ||
| 537 | + private extractResizeParams(url: string) { | ||
| 538 | + const heightRegex = /h_(\d+)/; // 匹配高度参数,如h_450 | ||
| 539 | + const widthRegex = /w_(\d+)/; // 匹配宽度参数,如w_800 | ||
| 540 | + const heightMatch = url.match(heightRegex); | ||
| 541 | + const widthMatch = url.match(widthRegex); | ||
| 542 | + let height = heightMatch ? `h_${heightMatch[1]}` : undefined | ||
| 543 | + let width = widthMatch ? `w_${widthMatch[1]}` : undefined | ||
| 544 | + let h:number =0 | ||
| 545 | + let w:number =0 | ||
| 546 | + if(height){ | ||
| 547 | + h = Number(height.split('_')[1]) | ||
| 548 | + } | ||
| 549 | + if(width){ | ||
| 550 | + w = Number(width.split('_')[1]) | ||
| 551 | + } | ||
| 552 | + interface Obj{ | ||
| 553 | + width:number; | ||
| 554 | + height:number | ||
| 555 | + } | ||
| 556 | + let obj:Obj = { | ||
| 557 | + width:w, | ||
| 558 | + height:h | ||
| 559 | + } | ||
| 560 | + return obj | ||
| 462 | } | 561 | } |
| 562 | + | ||
| 463 | } | 563 | } |
| @@ -19,7 +19,7 @@ export struct BigPicCardComponent { | @@ -19,7 +19,7 @@ export struct BigPicCardComponent { | ||
| 19 | 19 | ||
| 20 | aboutToAppear() { | 20 | aboutToAppear() { |
| 21 | // 取第一个数据 | 21 | // 取第一个数据 |
| 22 | - if (this.compDTO.operDataList) { | 22 | + if (this.compDTO.operDataList.length > 0) { |
| 23 | this.contentDTO = this.compDTO.operDataList[0]; | 23 | this.contentDTO = this.compDTO.operDataList[0]; |
| 24 | this.contentDTO.appStyle = "2"; | 24 | this.contentDTO.appStyle = "2"; |
| 25 | } | 25 | } |
| 1 | -import { Logger, NumberFormatterUtils } from 'wdKit/Index' | 1 | +import { DisplayUtils,Logger, NumberFormatterUtils } from 'wdKit/Index' |
| 2 | import { LikeViewModel } from '../../viewmodel/LikeViewModel' | 2 | import { LikeViewModel } from '../../viewmodel/LikeViewModel' |
| 3 | import { SPHelper } from 'wdKit'; | 3 | import { SPHelper } from 'wdKit'; |
| 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 5 | import { SpConstants } from 'wdConstant/Index'; | 5 | import { SpConstants } from 'wdConstant/Index'; |
| 6 | import { ContentDetailDTO } from 'wdBean/Index'; | 6 | import { ContentDetailDTO } from 'wdBean/Index'; |
| 7 | - | 7 | +import measure from '@ohos.measure' |
| 8 | 8 | ||
| 9 | const TAG = 'LikeComponent'; | 9 | const TAG = 'LikeComponent'; |
| 10 | 10 | ||
| @@ -168,30 +168,74 @@ export struct LikeComponent { | @@ -168,30 +168,74 @@ export struct LikeComponent { | ||
| 168 | likeCompStyle5() { | 168 | likeCompStyle5() { |
| 169 | //1: 底部栏目样式 默认样式 | 169 | //1: 底部栏目样式 默认样式 |
| 170 | Stack({ alignContent: Alignment.Bottom }) { | 170 | Stack({ alignContent: Alignment.Bottom }) { |
| 171 | - Column() { | ||
| 172 | - // Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default')) | ||
| 173 | - Image(this.transLikeStyle().url) | ||
| 174 | - .width(24) | ||
| 175 | - .height(24) | ||
| 176 | - .onClick(() => { | ||
| 177 | - this.clickButtonEvent() | 171 | + Image(this.transLikeStyle().url) |
| 172 | + .width(24) | ||
| 173 | + .height(24) | ||
| 174 | + if (this.likeCount > 0){ | ||
| 175 | + RelativeContainer() { | ||
| 176 | + Image(this.likeStatus ? $r('app.media.ic_like_back_Select') : $r('app.media.ic_like_back')) | ||
| 177 | + .objectFit(ImageFit.Fill) | ||
| 178 | + .resizable({ | ||
| 179 | + slice: { | ||
| 180 | + top: 1, | ||
| 181 | + left: 20, | ||
| 182 | + right: 1, | ||
| 183 | + bottom: 1 | ||
| 184 | + } | ||
| 178 | }) | 185 | }) |
| 179 | - } | 186 | + .alignRules({ |
| 187 | + top: { anchor: "Text", align: VerticalAlign.Top }, | ||
| 188 | + left: { anchor: "Text", align: HorizontalAlign.Start }, | ||
| 189 | + right: { anchor: "Text", align: HorizontalAlign.End }, | ||
| 190 | + bottom: { anchor: "Text", align: VerticalAlign.Bottom }, | ||
| 191 | + }) | ||
| 192 | + .id("Image") | ||
| 180 | 193 | ||
| 181 | - Row() { | ||
| 182 | - Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) | 194 | + Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))// Text("44444444") |
| 183 | .fontSize(8) | 195 | .fontSize(8) |
| 184 | - .fontColor(Color.White) | ||
| 185 | - .padding({ left: 4, right: 2 }) | 196 | + .fontColor('#ffffff')// .backgroundColor('#ED2800') |
| 197 | + .height(12) | ||
| 198 | + .textAlign(TextAlign.Center) | ||
| 199 | + .alignRules({ | ||
| 200 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 201 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 202 | + })/*动态计算文字宽度*/ | ||
| 203 | + .width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) + | ||
| 204 | + 12)// .backgroundColor(Color.Green) | ||
| 205 | + .id("Text") | ||
| 206 | + .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden) | ||
| 186 | } | 207 | } |
| 187 | - .height(12) | ||
| 188 | - .alignItems(VerticalAlign.Center) | ||
| 189 | - .position({ x: '100%', }) | ||
| 190 | - .markAnchor({ x: '100%' }) | ||
| 191 | - .backgroundImage(this.likeStatus ? $r('app.media.ic_like_back_Select') : $r('app.media.ic_like_back')) | ||
| 192 | - .backgroundImageSize(ImageSize.Auto) | ||
| 193 | - .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden) | ||
| 194 | - }.width(24).height(24) | 208 | + .offset({ |
| 209 | + x: 12 | ||
| 210 | + }) | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + // Column() { | ||
| 214 | + // // Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default')) | ||
| 215 | + // Image(this.transLikeStyle().url) | ||
| 216 | + // .width(24) | ||
| 217 | + // .height(24) | ||
| 218 | + // .onClick(() => { | ||
| 219 | + // this.clickButtonEvent() | ||
| 220 | + // }) | ||
| 221 | + // } | ||
| 222 | + // | ||
| 223 | + // Row() { | ||
| 224 | + // Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) | ||
| 225 | + // .fontSize(8) | ||
| 226 | + // .fontColor(Color.White) | ||
| 227 | + // .padding({ left: 4, right: 2 }) | ||
| 228 | + // } | ||
| 229 | + // .height(12) | ||
| 230 | + // .alignItems(VerticalAlign.Center) | ||
| 231 | + // .position({ x: '100%', }) | ||
| 232 | + // .markAnchor({ x: '100%' }) | ||
| 233 | + // .backgroundImage(this.likeStatus ? $r('app.media.ic_like_back_Select') : $r('app.media.ic_like_back')) | ||
| 234 | + // .backgroundImageSize(ImageSize.Auto) | ||
| 235 | + // .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden) | ||
| 236 | + }.width(24).height(24).onClick(() => { | ||
| 237 | + this.clickButtonEvent() | ||
| 238 | + }) | ||
| 195 | } | 239 | } |
| 196 | 240 | ||
| 197 | @Builder | 241 | @Builder |
| @@ -210,8 +254,6 @@ export struct LikeComponent { | @@ -210,8 +254,6 @@ export struct LikeComponent { | ||
| 210 | .height(36) | 254 | .height(36) |
| 211 | .borderRadius(18) | 255 | .borderRadius(18) |
| 212 | .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : '#FFF5F5F5') | 256 | .backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : '#FFF5F5F5') |
| 213 | - | ||
| 214 | - | ||
| 215 | Row() { | 257 | Row() { |
| 216 | Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) | 258 | Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) |
| 217 | .fontSize(8) | 259 | .fontSize(8) |
| @@ -306,4 +348,14 @@ export struct LikeComponent { | @@ -306,4 +348,14 @@ export struct LikeComponent { | ||
| 306 | this.likeCount = 0 | 348 | this.likeCount = 0 |
| 307 | }) | 349 | }) |
| 308 | } | 350 | } |
| 351 | + private getMeasureText(text: string) { | ||
| 352 | + let width = measure.measureText({ | ||
| 353 | + textContent: text, | ||
| 354 | + fontSize: 8, | ||
| 355 | + lineHeight: 12, | ||
| 356 | + constraintWidth: DisplayUtils.getDeviceWidth(), | ||
| 357 | + }) | ||
| 358 | + width = px2vp(width) | ||
| 359 | + return width | ||
| 360 | + } | ||
| 309 | } | 361 | } |
| @@ -132,54 +132,61 @@ export struct OperRowListView { | @@ -132,54 +132,61 @@ export struct OperRowListView { | ||
| 132 | build() { | 132 | build() { |
| 133 | // 视频详情页 | 133 | // 视频详情页 |
| 134 | 134 | ||
| 135 | - Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { | ||
| 136 | - // AudioDialog() | ||
| 137 | - Row() { | ||
| 138 | - Column() { | ||
| 139 | - Image(this.styleType == 1 ? $r('app.media.icon_arrow_left') : | ||
| 140 | - $r('app.media.icon_arrow_left_white')) | ||
| 141 | - .width(24) | ||
| 142 | - .height(24) | ||
| 143 | - .aspectRatio(1) | ||
| 144 | - .interpolation(ImageInterpolation.High) | ||
| 145 | - } | ||
| 146 | - .hoverEffect(HoverEffect.Scale) | ||
| 147 | - .onClick(() => { | ||
| 148 | - if (this.onBack) { | ||
| 149 | - this.onBack() | ||
| 150 | - } | ||
| 151 | - router.back(); | ||
| 152 | - }) | ||
| 153 | - .width(42) | 135 | + Column() { |
| 136 | + Image($r('app.media.ic_news_detail_division')) | ||
| 137 | + .width('100%') | ||
| 138 | + .height($r('app.float.margin_1')) | ||
| 139 | + .margin({bottom: -2}) | ||
| 154 | 140 | ||
| 155 | - if (this.contentDetailData?.newsId) { | ||
| 156 | - ForEach(this.operationButtonList, (item: string, index: number) => { | ||
| 157 | - if (item == 'comment') { | ||
| 158 | - this.builderComment() | ||
| 159 | - } else if (item == 'like' && this.needLike) { | ||
| 160 | - this.builderLike() | ||
| 161 | - } else if (item == 'collect') { | ||
| 162 | - this.builderCollect() | ||
| 163 | - } else if (item == 'listen') { | ||
| 164 | - this.builderListen() | ||
| 165 | - } else if (item == 'share') { | ||
| 166 | - this.builderShare() | ||
| 167 | - } else { | 141 | + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { |
| 142 | + // AudioDialog() | ||
| 143 | + Row() { | ||
| 144 | + Column() { | ||
| 145 | + Image(this.styleType == 1 ? $r('app.media.icon_arrow_left') : | ||
| 146 | + $r('app.media.icon_arrow_left_white')) | ||
| 147 | + .width(24) | ||
| 148 | + .height(24) | ||
| 149 | + .aspectRatio(1) | ||
| 150 | + .interpolation(ImageInterpolation.High) | ||
| 151 | + } | ||
| 152 | + .hoverEffect(HoverEffect.Scale) | ||
| 153 | + .onClick(() => { | ||
| 154 | + if (this.onBack) { | ||
| 155 | + this.onBack() | ||
| 168 | } | 156 | } |
| 157 | + router.back(); | ||
| 169 | }) | 158 | }) |
| 159 | + .width(48) | ||
| 160 | + | ||
| 161 | + if (this.contentDetailData?.newsId) { | ||
| 162 | + ForEach(this.operationButtonList, (item: string, index: number) => { | ||
| 163 | + if (item == 'comment') { | ||
| 164 | + this.builderComment() | ||
| 165 | + } else if (item == 'like' && this.needLike) { | ||
| 166 | + this.builderLike() | ||
| 167 | + } else if (item == 'collect') { | ||
| 168 | + this.builderCollect() | ||
| 169 | + } else if (item == 'listen') { | ||
| 170 | + this.builderListen() | ||
| 171 | + } else if (item == 'share') { | ||
| 172 | + this.builderShare() | ||
| 173 | + } else { | ||
| 174 | + } | ||
| 175 | + }) | ||
| 176 | + } | ||
| 170 | } | 177 | } |
| 178 | + .width('100%') | ||
| 179 | + .justifyContent(FlexAlign.Start) | ||
| 171 | } | 180 | } |
| 172 | .width('100%') | 181 | .width('100%') |
| 173 | - .justifyContent(FlexAlign.Start) | 182 | + .backgroundColor(this.bgColor) |
| 183 | + .padding({ | ||
| 184 | + top: 10, | ||
| 185 | + // bottom: 10 | ||
| 186 | + bottom: `${this.bottomSafeHeight}px` | ||
| 187 | + // bottom: 50 | ||
| 188 | + }) | ||
| 174 | } | 189 | } |
| 175 | - .width('100%') | ||
| 176 | - .backgroundColor(this.bgColor) | ||
| 177 | - .padding({ | ||
| 178 | - top: 10, | ||
| 179 | - // bottom: 10 | ||
| 180 | - bottom: `${this.bottomSafeHeight}px` | ||
| 181 | - // bottom: 50 | ||
| 182 | - }) | ||
| 183 | 190 | ||
| 184 | } | 191 | } |
| 185 | 192 | ||
| @@ -200,7 +207,7 @@ export struct OperRowListView { | @@ -200,7 +207,7 @@ export struct OperRowListView { | ||
| 200 | } | 207 | } |
| 201 | .layoutWeight(1) | 208 | .layoutWeight(1) |
| 202 | .margin({ | 209 | .margin({ |
| 203 | - right: this.pageComponentType === 1 ? 16 : 0, | 210 | + right: this.pageComponentType === 1 ? 22 : 0, |
| 204 | }) | 211 | }) |
| 205 | 212 | ||
| 206 | if (this.showCommentIcon) { | 213 | if (this.showCommentIcon) { |
| @@ -212,7 +219,7 @@ export struct OperRowListView { | @@ -212,7 +219,7 @@ export struct OperRowListView { | ||
| 212 | }) | 219 | }) |
| 213 | } | 220 | } |
| 214 | } | 221 | } |
| 215 | - .width(46) | 222 | + .width(48) |
| 216 | } | 223 | } |
| 217 | 224 | ||
| 218 | } | 225 | } |
| @@ -233,7 +240,7 @@ export struct OperRowListView { | @@ -233,7 +240,7 @@ export struct OperRowListView { | ||
| 233 | }) | 240 | }) |
| 234 | // } | 241 | // } |
| 235 | } | 242 | } |
| 236 | - .width(42) | 243 | + .width(48) |
| 237 | .visibility(this.likesStyle !== 4 ? Visibility.Visible : Visibility.None) | 244 | .visibility(this.likesStyle !== 4 ? Visibility.Visible : Visibility.None) |
| 238 | } | 245 | } |
| 239 | 246 | ||
| @@ -261,7 +268,7 @@ export struct OperRowListView { | @@ -261,7 +268,7 @@ export struct OperRowListView { | ||
| 261 | })*/ | 268 | })*/ |
| 262 | } | 269 | } |
| 263 | .height(36) | 270 | .height(36) |
| 264 | - .width(36) | 271 | + .width(48) |
| 265 | .borderRadius(18) | 272 | .borderRadius(18) |
| 266 | .backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent) | 273 | .backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent) |
| 267 | .onClick(() => { | 274 | .onClick(() => { |
| @@ -289,7 +296,7 @@ export struct OperRowListView { | @@ -289,7 +296,7 @@ export struct OperRowListView { | ||
| 289 | }) | 296 | }) |
| 290 | } | 297 | } |
| 291 | .height(36) | 298 | .height(36) |
| 292 | - .width(36) | 299 | + .width(48) |
| 293 | .justifyContent(FlexAlign.Center) | 300 | .justifyContent(FlexAlign.Center) |
| 294 | } | 301 | } |
| 295 | 302 | ||
| @@ -312,7 +319,7 @@ export struct OperRowListView { | @@ -312,7 +319,7 @@ export struct OperRowListView { | ||
| 312 | } | 319 | } |
| 313 | .justifyContent(FlexAlign.Center) | 320 | .justifyContent(FlexAlign.Center) |
| 314 | .height(36) | 321 | .height(36) |
| 315 | - .width(36) | 322 | + .width(48) |
| 316 | .borderRadius(18) | 323 | .borderRadius(18) |
| 317 | .backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent) | 324 | .backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent) |
| 318 | } | 325 | } |
| @@ -9,7 +9,7 @@ export struct AreaPickerDialog { | @@ -9,7 +9,7 @@ export struct AreaPickerDialog { | ||
| 9 | @Provide currentSecondBean: AreaListManageModel = new AreaListManageModel('','','',[]) | 9 | @Provide currentSecondBean: AreaListManageModel = new AreaListManageModel('','','',[]) |
| 10 | @Provide currentThirdBean: AreaListManageModel = new AreaListManageModel('','','',[]) | 10 | @Provide currentThirdBean: AreaListManageModel = new AreaListManageModel('','','',[]) |
| 11 | controller: CustomDialogController | 11 | controller: CustomDialogController |
| 12 | - title: string = '地区选择' | 12 | + title: string = '修改地区' |
| 13 | @Provide dataSource: AreaListModel[] = [] | 13 | @Provide dataSource: AreaListModel[] = [] |
| 14 | result: JSON[] = []; | 14 | result: JSON[] = []; |
| 15 | confirmCallback: (province:string,city:string,county:string,address:string) => void = () => { | 15 | confirmCallback: (province:string,city:string,county:string,address:string) => void = () => { |
| @@ -33,7 +33,7 @@ export struct AreaPickerDialog { | @@ -33,7 +33,7 @@ export struct AreaPickerDialog { | ||
| 33 | 33 | ||
| 34 | Blank() | 34 | Blank() |
| 35 | 35 | ||
| 36 | - Button('确定',{type:ButtonType.Normal}) | 36 | + Button('提交',{type:ButtonType.Normal}) |
| 37 | .onClick(()=> { | 37 | .onClick(()=> { |
| 38 | this.controller.close() | 38 | this.controller.close() |
| 39 | this.confirmCallback(this.currentFirst.label,this.currentSecondBean.label,this.currentThirdBean.label,this.currentFirst.label+this.currentSecondBean.label+this.currentThirdBean.label); | 39 | this.confirmCallback(this.currentFirst.label,this.currentSecondBean.label,this.currentThirdBean.label,this.currentFirst.label+this.currentSecondBean.label+this.currentThirdBean.label); |
| @@ -28,9 +28,11 @@ export struct FirstLevelComponent { | @@ -28,9 +28,11 @@ export struct FirstLevelComponent { | ||
| 28 | this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[index as number]) | 28 | this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[index as number]) |
| 29 | }) | 29 | }) |
| 30 | .backgroundColor(Color.White) | 30 | .backgroundColor(Color.White) |
| 31 | - .border({color:'#e2e2e2',width:{right:0.5}}) | 31 | + // .border({color:'#e2e2e2',width:{right:0.5}}) |
| 32 | .width('100%') | 32 | .width('100%') |
| 33 | .layoutWeight(1) | 33 | .layoutWeight(1) |
| 34 | + .selectedTextStyle({color:'#666666'}) | ||
| 35 | + .textStyle({color:'#999999'}) | ||
| 34 | } | 36 | } |
| 35 | } | 37 | } |
| 36 | .justifyContent(FlexAlign.Center) | 38 | .justifyContent(FlexAlign.Center) |
| @@ -21,9 +21,11 @@ export struct SecondLevelComponent { | @@ -21,9 +21,11 @@ export struct SecondLevelComponent { | ||
| 21 | this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[index as number]) | 21 | this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[index as number]) |
| 22 | }) | 22 | }) |
| 23 | .backgroundColor(Color.White) | 23 | .backgroundColor(Color.White) |
| 24 | - .border({color:'#e2e2e2',width:{right:0.5}}) | 24 | + // .border({color:'#e2e2e2',width:{right:0.5}}) |
| 25 | .width('100%') | 25 | .width('100%') |
| 26 | .layoutWeight(1) | 26 | .layoutWeight(1) |
| 27 | + .selectedTextStyle({color:'#666666'}) | ||
| 28 | + .textStyle({color:'#999999'}) | ||
| 27 | } | 29 | } |
| 28 | } | 30 | } |
| 29 | .justifyContent(FlexAlign.Center) | 31 | .justifyContent(FlexAlign.Center) |
| @@ -22,9 +22,11 @@ export struct ThirdLevelComponent { | @@ -22,9 +22,11 @@ export struct ThirdLevelComponent { | ||
| 22 | this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[index as number]) | 22 | this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[index as number]) |
| 23 | }) | 23 | }) |
| 24 | .backgroundColor(Color.White) | 24 | .backgroundColor(Color.White) |
| 25 | - .border({color:'#e2e2e2',width:{right:0.5}}) | 25 | + // .border({color:'#e2e2e2',width:{right:0.5}}) |
| 26 | .width('100%') | 26 | .width('100%') |
| 27 | .layoutWeight(1) | 27 | .layoutWeight(1) |
| 28 | + .selectedTextStyle({color:'#666666'}) | ||
| 29 | + .textStyle({color:'#999999'}) | ||
| 28 | } | 30 | } |
| 29 | } | 31 | } |
| 30 | .justifyContent(FlexAlign.Center) | 32 | .justifyContent(FlexAlign.Center) |
| 1 | +import { common } from '@kit.AbilityKit'; | ||
| 2 | +import { insightIntent } from '@kit.IntentsKit'; | ||
| 3 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 4 | +import { CompDTO, CompList, ContentDTO, PageInfoBean } from 'wdBean'; | ||
| 5 | + | ||
| 6 | +function generateUUID() { | ||
| 7 | + let dt = new Date().getTime(); // 获取当前时间的时间戳(毫秒) | ||
| 8 | + let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { | ||
| 9 | + let r = (dt + Math.random() * 16) % 16 | 0; | ||
| 10 | + dt = Math.floor(dt / 16); | ||
| 11 | + return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); | ||
| 12 | + }); | ||
| 13 | + return uuid; | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +export const enum ActionMode { | ||
| 17 | + // 将来时 | ||
| 18 | + EXPECTED = 'EXPECTED', | ||
| 19 | + // 完成时 | ||
| 20 | + EXECUTED = 'EXECUTED', | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +//ViewBlog意图共享-频道列表 | ||
| 24 | +export function viewBlogInsightIntentShare(context: common.UIAbilityContext, entityGroupId: string, | ||
| 25 | + compList: CompDTO[] | CompList[], actionMode: ActionMode) { | ||
| 26 | + console.log('viewBlogInsightIntentShare', actionMode) | ||
| 27 | + let insightIntentArray: insightIntent.InsightIntent [] = [] | ||
| 28 | + let identifier = generateUUID() | ||
| 29 | + if (compList?.length > 0) { | ||
| 30 | + compList?.forEach((item: CompDTO | CompList) => { | ||
| 31 | + item.operDataList.forEach((_item: ContentDTO) => { | ||
| 32 | + let viewBlogInsightIntentItem: insightIntent.InsightIntent = { | ||
| 33 | + intentName: 'ViewBlog', | ||
| 34 | + intentVersion: '1.0.1', | ||
| 35 | + identifier, | ||
| 36 | + intentActionInfo: { | ||
| 37 | + actionMode, | ||
| 38 | + currentPercentage: 50, | ||
| 39 | + //目前不考虑发生时段 | ||
| 40 | + // executedTimeSlots: { | ||
| 41 | + // executedEndTime: new Date().getTime(), | ||
| 42 | + // executedStartTime: pageModel.executedStartTime | ||
| 43 | + // } | ||
| 44 | + }, | ||
| 45 | + intentEntityInfo: { | ||
| 46 | + entityName: 'Blog', | ||
| 47 | + entityId: _item?.objectId, | ||
| 48 | + displayName: _item?.newsTitle, | ||
| 49 | + entityGroupId, //channelId | ||
| 50 | + logoURL: _item?.coverUrl, | ||
| 51 | + metadataModificationTime: _item?.publishTimestamp, | ||
| 52 | + blogTitle: _item?.newsTitle, | ||
| 53 | + blogType: 'Normal', | ||
| 54 | + blogCategory: item.name, | ||
| 55 | + categoryDisplayName: item.name, | ||
| 56 | + blogSubTitle: _item?.newsSummary.length > 20 ? | ||
| 57 | + _item?.newsSummary.substring(0, 20) : _item?.newsSummary, | ||
| 58 | + blogAuthor: _item?.source, | ||
| 59 | + blogPublishTime: _item?.publishTimestamp, | ||
| 60 | + tag: _item?.newTags.split(','), | ||
| 61 | + likeCount: _item?.interactData?.likeNum || 0, | ||
| 62 | + forwardCount: _item?.interactData?.shareNum || 0, | ||
| 63 | + commentCount: _item?.interactData?.commentNum || 0, | ||
| 64 | + favorites: _item?.interactData?.collectNum || 0, | ||
| 65 | + viewCount: _item?.interactData?.readNum || 0, | ||
| 66 | + rankingHint: 99, | ||
| 67 | + isPublicData: true | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + insightIntentArray.push(viewBlogInsightIntentItem) | ||
| 71 | + }) | ||
| 72 | + | ||
| 73 | + }) | ||
| 74 | + console.log('yzl', JSON.stringify(insightIntentArray[0])) | ||
| 75 | + // 共享数据 | ||
| 76 | + insightIntent.shareIntent(context, insightIntentArray).then(() => { | ||
| 77 | + console.log('yzl shareIntent success'); | ||
| 78 | + }).catch((err: BusinessError) => { | ||
| 79 | + console.error(`yzl failed because ${err?.message}`); | ||
| 80 | + }); | ||
| 81 | + | ||
| 82 | + } | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | + | ||
| 86 | +//ViewBlog意图共享-早晚报 | ||
| 87 | +export function viewColumInsightIntentShare(context: common.UIAbilityContext, entityId: string, | ||
| 88 | + pageInfoBean: PageInfoBean) { | ||
| 89 | + console.log('viewColumInsightIntentShare') | ||
| 90 | + let viewBlogInsightIntentItem: insightIntent.InsightIntent = { | ||
| 91 | + intentName: 'ViewColumn', | ||
| 92 | + intentVersion: '1.0.1', | ||
| 93 | + identifier: generateUUID(), | ||
| 94 | + intentActionInfo: { | ||
| 95 | + actionMode: ActionMode.EXECUTED, | ||
| 96 | + currentPercentage: 50, | ||
| 97 | + }, | ||
| 98 | + intentEntityInfo: { | ||
| 99 | + entityName: 'Column', | ||
| 100 | + entityId, | ||
| 101 | + displayName: pageInfoBean?.topicInfo?.title, | ||
| 102 | + description: pageInfoBean?.shareSummary, | ||
| 103 | + logoURL: pageInfoBean?.shareCoverUrl, | ||
| 104 | + activityType: ['RecentViews'], | ||
| 105 | + columnTitle: pageInfoBean?.topicInfo?.title, | ||
| 106 | + columnSubTitle: pageInfoBean?.shareSummary, | ||
| 107 | + rankingHint: 99, | ||
| 108 | + isPublicData: true | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewBlogInsightIntentItem)) | ||
| 112 | + | ||
| 113 | + // 共享数据 | ||
| 114 | + insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => { | ||
| 115 | + console.log('yzl shareIntent success'); | ||
| 116 | + }).catch((err: BusinessError) => { | ||
| 117 | + console.error(`yzl failed because ${err?.message}`); | ||
| 118 | + }); | ||
| 119 | +} |
| @@ -52,11 +52,11 @@ class EditInfoViewModel { | @@ -52,11 +52,11 @@ class EditInfoViewModel { | ||
| 52 | if (editDTO.code == 0) { | 52 | if (editDTO.code == 0) { |
| 53 | success(editDTO.data) | 53 | success(editDTO.data) |
| 54 | }else { | 54 | }else { |
| 55 | - success(this.GetqueryAccountOwnerLocal(context)) | 55 | + // success(this.GetqueryAccountOwnerLocal(context)) |
| 56 | } | 56 | } |
| 57 | }).catch((error: Error) => { | 57 | }).catch((error: Error) => { |
| 58 | Logger.info(TAG,'queryAccountOwnerInfo','EditInfoViewModel') | 58 | Logger.info(TAG,'queryAccountOwnerInfo','EditInfoViewModel') |
| 59 | - success(this.GetqueryAccountOwnerLocal(context)) | 59 | + // success(this.GetqueryAccountOwnerLocal(context)) |
| 60 | }) | 60 | }) |
| 61 | })) | 61 | })) |
| 62 | } | 62 | } |
| @@ -125,7 +125,7 @@ class EditInfoViewModel { | @@ -125,7 +125,7 @@ class EditInfoViewModel { | ||
| 125 | this.BasePostRequest(item.editDataType == WDEditDataModelType.WDEditDataModelType_nickname?HttpUrlUtils.APPOINTMENT_editUserDetail1_PATH:HttpUrlUtils.APPOINTMENT_editUserDetail_PATH,this.params) | 125 | this.BasePostRequest(item.editDataType == WDEditDataModelType.WDEditDataModelType_nickname?HttpUrlUtils.APPOINTMENT_editUserDetail1_PATH:HttpUrlUtils.APPOINTMENT_editUserDetail_PATH,this.params) |
| 126 | .then((navResDTO: ResponseDTO) => { | 126 | .then((navResDTO: ResponseDTO) => { |
| 127 | if (navResDTO.code == 0) { | 127 | if (navResDTO.code == 0) { |
| 128 | - promptAction.showToast({ message: '修改成功' }) | 128 | + promptAction.showToast({ message: '您的资料已提交' }) |
| 129 | success(navResDTO) | 129 | success(navResDTO) |
| 130 | }else { | 130 | }else { |
| 131 | promptAction.showToast({ message: navResDTO.message }) | 131 | promptAction.showToast({ message: navResDTO.message }) |
| 1 | -import { CompDTO, ContentDTO, InteractDataDTO, PageDTO, PageInfoDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, PageDTO, PageInfoDTO } from 'wdBean'; |
| 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; | 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; |
| 3 | import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils } from 'wdKit'; | 3 | import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils } from 'wdKit'; |
| 4 | import { closeRefresh } from '../utils/PullDownRefresh'; | 4 | import { closeRefresh } from '../utils/PullDownRefresh'; |
| @@ -11,6 +11,8 @@ import { ArrayList } from '@kit.ArkTS'; | @@ -11,6 +11,8 @@ import { ArrayList } from '@kit.ArkTS'; | ||
| 11 | import { WDViewDefaultType } from '../components/view/EmptyComponent'; | 11 | import { WDViewDefaultType } from '../components/view/EmptyComponent'; |
| 12 | import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; | 12 | import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean'; |
| 13 | import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO'; | 13 | import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO'; |
| 14 | +import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare' | ||
| 15 | +import { common } from '@kit.AbilityKit'; | ||
| 14 | 16 | ||
| 15 | const TAG = 'PageHelper'; | 17 | const TAG = 'PageHelper'; |
| 16 | 18 | ||
| @@ -74,7 +76,7 @@ export class PageHelper { | @@ -74,7 +76,7 @@ export class PageHelper { | ||
| 74 | return; | 76 | return; |
| 75 | } | 77 | } |
| 76 | pageModel.pageInfo = pageInfo; | 78 | pageModel.pageInfo = pageInfo; |
| 77 | - //解析广告资源 | 79 | + //解析页面挂角广告资源 |
| 78 | pageAdvModel.analysisAdvSource(pageInfo); | 80 | pageAdvModel.analysisAdvSource(pageInfo); |
| 79 | this.parseGroup(pageModel) | 81 | this.parseGroup(pageModel) |
| 80 | }).catch(() => { | 82 | }).catch(() => { |
| @@ -85,10 +87,17 @@ export class PageHelper { | @@ -85,10 +87,17 @@ export class PageHelper { | ||
| 85 | } | 87 | } |
| 86 | 88 | ||
| 87 | 89 | ||
| 90 | + /** | ||
| 91 | + * 解析信息流页面楼层数据 | ||
| 92 | + * @param pageModel | ||
| 93 | + */ | ||
| 88 | async parseGroup(pageModel: PageModel) { | 94 | async parseGroup(pageModel: PageModel) { |
| 89 | let pageInfo: PageInfoDTO = pageModel.pageInfo | 95 | let pageInfo: PageInfoDTO = pageModel.pageInfo |
| 90 | pageModel.groupList = [] | 96 | pageModel.groupList = [] |
| 97 | + pageInfo.pageAdList = [] | ||
| 98 | + pageInfo.oneRequestPageGroupCompList = new ArrayList() | ||
| 91 | pageModel.groupList.push(...pageInfo.groups) | 99 | pageModel.groupList.push(...pageInfo.groups) |
| 100 | + Logger.error("ZZZXXXXX", 'parseGroup----1-----'); | ||
| 92 | for (const group of pageInfo.groups) { | 101 | for (const group of pageInfo.groups) { |
| 93 | pageModel.isRecGroup = group.groupStrategy === 1; | 102 | pageModel.isRecGroup = group.groupStrategy === 1; |
| 94 | pageModel.groupId = group.id; | 103 | pageModel.groupId = group.id; |
| @@ -98,17 +107,40 @@ export class PageHelper { | @@ -98,17 +107,40 @@ export class PageHelper { | ||
| 98 | pageModel.pageSize = 20 | 107 | pageModel.pageSize = 20 |
| 99 | } | 108 | } |
| 100 | pageModel.groupData = group | 109 | pageModel.groupData = group |
| 110 | + | ||
| 111 | + Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId); | ||
| 101 | // await,确保groups接口顺序执行 | 112 | // await,确保groups接口顺序执行 |
| 102 | - let pageDto = await PageViewModel.getPageData(pageModel.bizCopy()) as PageDTO | 113 | + let pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO |
| 103 | let index = pageInfo.groups.indexOf(group) | 114 | let index = pageInfo.groups.indexOf(group) |
| 104 | if (index == 0) { | 115 | if (index == 0) { |
| 105 | // 清空comp列表 | 116 | // 清空comp列表 |
| 106 | - pageModel.compList.clearAllData() | 117 | + pageModel.compList.clear() |
| 107 | } | 118 | } |
| 108 | - this.getGroupData(pageModel, pageDto, index == pageInfo.groups.length - 1) | 119 | + this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1) |
| 120 | + Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length); | ||
| 121 | + } | ||
| 109 | 122 | ||
| 123 | + /* | ||
| 124 | + 收集页面所有楼层的组件信息,同步完成广告投放计算,异步完成稿件批查, | ||
| 125 | + */ | ||
| 126 | + pageModel.pageTotalCompSize = pageInfo.oneRequestPageGroupCompList.length + pageModel.pageTotalCompSize | ||
| 127 | + // 处理页面广告数据,投放到页面的位置 | ||
| 128 | + this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList); | ||
| 110 | 129 | ||
| 130 | + //遍历所有组件和稿件数据 push到页面 | ||
| 131 | + for (let element of pageInfo.oneRequestPageGroupCompList) { | ||
| 132 | + pageModel.compList.push(CompDTO.createNewsBean(element)) | ||
| 111 | } | 133 | } |
| 134 | + | ||
| 135 | + // 批查互动数据 | ||
| 136 | + this.allCompBatchRequest(pageInfo.oneRequestPageGroupCompList.convertToArray(), pageModel) | ||
| 137 | + | ||
| 138 | + // | ||
| 139 | + pageModel.currentPage++ | ||
| 140 | + pageModel.viewType = ViewType.LOADED | ||
| 141 | + closeRefresh(pageModel, true) | ||
| 142 | + | ||
| 143 | + Logger.error("ZZZXXXXX", 'parseGroup----3----->' + pageInfo.oneRequestPageGroupCompList.length); | ||
| 112 | if (pageModel.compList.isEmpty()) { | 144 | if (pageModel.compList.isEmpty()) { |
| 113 | // 没数据,展示空页面 | 145 | // 没数据,展示空页面 |
| 114 | Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.'); | 146 | Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.'); |
| @@ -118,39 +150,197 @@ export class PageHelper { | @@ -118,39 +150,197 @@ export class PageHelper { | ||
| 118 | } | 150 | } |
| 119 | } | 151 | } |
| 120 | 152 | ||
| 121 | - private async getGroupData(pageModel: PageModel, pageDto: PageDTO, isLastGroup: boolean) { | 153 | + /** |
| 154 | + * 解析页面的楼层数据 | ||
| 155 | + * @param pageDto 楼层的组件信息 | ||
| 156 | + * @param pageInfo 信息流页面信息 | ||
| 157 | + * @param isLastGroup pageDto信息是不是最后一个楼层 | ||
| 158 | + */ | ||
| 159 | + private async analysisPageGroupCompData(pageModel: PageModel,pageDto: PageDTO, pageInfo: PageInfoDTO, isLastGroup: boolean) { | ||
| 160 | + | ||
| 122 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 161 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { |
| 123 | - pageModel.viewType = ViewType.LOADED; | ||
| 124 | - if (isLastGroup) { | ||
| 125 | - // 认为分页只会在最后一个group里 | ||
| 126 | - pageModel.currentPage++; | ||
| 127 | - } | ||
| 128 | - // pageModel.currentPage++; | ||
| 129 | - pageModel.hasMore = true; | ||
| 130 | 162 | ||
| 131 | - //移除音频 和 活动 | ||
| 132 | - this.collectPageComp(pageModel, pageDto) | 163 | + let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集楼层组件、稿件和本地组件容器 |
| 164 | + // 遍历楼层的组件数据 | ||
| 165 | + pageDto.compList.forEach((element: CompDTO) => { | ||
| 166 | + let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); | ||
| 167 | + //移除音频 和 活动 | ||
| 168 | + if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { | ||
| 169 | + Logger.debug(TAG, 'getGroupData 移除音频 和 活动'); | ||
| 170 | + } else { | ||
| 171 | + // 暂时屏蔽活动和音频详情入口 | ||
| 172 | + if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') { | ||
| 173 | + } else { | ||
| 174 | + pageCompList.add(element) | ||
| 175 | + } | ||
| 176 | + } | ||
| 177 | + }) | ||
| 133 | 178 | ||
| 134 | - // TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上) | ||
| 135 | - // TODO updateItems(sizeBefore, data),这里可能有时序问题,导致覆盖别的group数据,需要优化,考虑精准替换 | ||
| 136 | - // 二次请求,批查互动数据 | ||
| 137 | - this.allCompBatchRequest(pageDto.compList, pageModel) | 179 | + // pageInfor 记录 |
| 180 | + pageCompList.forEach((comp: CompDTO) => { | ||
| 181 | + pageInfo.oneRequestPageGroupCompList.add(comp) | ||
| 182 | + }) | ||
| 138 | 183 | ||
| 184 | + // pageInfor 记录广告 | ||
| 185 | + if (pageDto.compAdList != null) { | ||
| 186 | + pageInfo.pageAdList.push(...pageDto.compAdList) | ||
| 187 | + } | ||
| 139 | 188 | ||
| 140 | - // content级别的展现加载丢给comp自己,这里只需要处理屏蔽分页加载,pageModel.pageScroll | 189 | + // 检测最后一个楼层是否有一行两图卡 |
| 141 | if (isLastGroup) { | 190 | if (isLastGroup) { |
| 142 | - closeRefresh(pageModel, true); | ||
| 143 | // 最后一个楼层,特殊处理 | 191 | // 最后一个楼层,特殊处理 |
| 144 | // 检测楼层最后一个组件业务数据是否需要通过访问接口获取 | 192 | // 检测楼层最后一个组件业务数据是否需要通过访问接口获取 |
| 145 | let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1] | 193 | let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1] |
| 146 | - let compSize = CollectionUtils.getListSize(comp.operDataList) | ||
| 147 | // 直播回放,需要二次请求数据 | 194 | // 直播回放,需要二次请求数据 |
| 148 | - if (compSize <= 0 && comp.compStyle == CompStyle.Zh_Grid_Layout_02) { | 195 | + if ( comp.compStyle == CompStyle.Zh_Grid_Layout_02) { |
| 149 | // 这个comp,数据自己二次请求,自己分页处理,这里加flag,将page层滑动及loadmore ui去掉 | 196 | // 这个comp,数据自己二次请求,自己分页处理,这里加flag,将page层滑动及loadmore ui去掉 |
| 150 | pageModel.contentNeedScroll = true | 197 | pageModel.contentNeedScroll = true |
| 198 | + | ||
| 199 | + //this.getLiveReviewData(pageInfo,comp) | ||
| 151 | } | 200 | } |
| 152 | } | 201 | } |
| 153 | } | 202 | } |
| 203 | + | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + | ||
| 207 | + /** | ||
| 208 | + * comp加载更多,分页加载 | ||
| 209 | + */ | ||
| 210 | + private compLoadMore(pageModel: PageModel) { | ||
| 211 | + //聚合页 | ||
| 212 | + if (pageModel.pageType == 1) { | ||
| 213 | + PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => { | ||
| 214 | + if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) { | ||
| 215 | + pageModel.hasMore = false; | ||
| 216 | + return; | ||
| 217 | + } else { | ||
| 218 | + //更新数据 | ||
| 219 | + pageModel.compList.addItems(liveReviewDTO.list); | ||
| 220 | + // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 221 | + pageModel.currentPage++; | ||
| 222 | + pageModel.hasMore = true; | ||
| 223 | + pageModel.pageTotalCompSize = liveReviewDTO.list.length + pageModel.pageTotalCompSize | ||
| 224 | + } | ||
| 225 | + }).catch((err: string | Resource) => { | ||
| 226 | + promptAction.showToast({ message: err }); | ||
| 227 | + }) | ||
| 228 | + } else { | ||
| 229 | + PageViewModel.getPageGroupCompData(pageModel.bizCopy()) | ||
| 230 | + .then((data: PageDTO) => { | ||
| 231 | + if (data == null || data.compList == null || data.compList.length == 0) { | ||
| 232 | + pageModel.hasMore = false; | ||
| 233 | + } else { | ||
| 234 | + // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 235 | + pageModel.currentPage++; | ||
| 236 | + pageModel.hasMore = true; | ||
| 237 | + | ||
| 238 | + //移除音频 和 活动 | ||
| 239 | + this.loadMorePageComp(pageModel, data) | ||
| 240 | + // 参与批查 | ||
| 241 | + this.allCompBatchRequest(data.compList, pageModel) | ||
| 242 | + } | ||
| 243 | + }).catch((err: string | Resource) => { | ||
| 244 | + promptAction.showToast({ message: err }); | ||
| 245 | + }) | ||
| 246 | + } | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + | ||
| 250 | + /** | ||
| 251 | + * 加载更多页面组件和稿件信息 | ||
| 252 | + */ | ||
| 253 | + private loadMorePageComp(pageModel: PageModel, pageDto: PageDTO) { | ||
| 254 | + | ||
| 255 | + let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器 | ||
| 256 | + | ||
| 257 | + pageDto.compList.forEach((element: CompDTO) => { | ||
| 258 | + let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); | ||
| 259 | + //移除音频 和 活动 | ||
| 260 | + if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { | ||
| 261 | + Logger.debug(TAG, 'getGroupData 移除音频 和 活动'); | ||
| 262 | + } else { | ||
| 263 | + // 暂时屏蔽活动和音频详情入口 | ||
| 264 | + if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') { | ||
| 265 | + } else { | ||
| 266 | + pageCompList.add(element) | ||
| 267 | + } | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + }) | ||
| 271 | + | ||
| 272 | + // 记录 | ||
| 273 | + pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize | ||
| 274 | + // 处理页面广告数据,投放到页面的位置 | ||
| 275 | + this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto.compAdList); | ||
| 276 | + | ||
| 277 | + //遍历所有组件和稿件数据 push到页面 | ||
| 278 | + for (let element of pageCompList) { | ||
| 279 | + pageModel.compList.push(CompDTO.createNewsBean(element)) | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + } | ||
| 283 | + | ||
| 284 | + /** | ||
| 285 | + * 信息流页面,所有稿件需要参与批查,如 批查评论、批查关注状态等接口 | ||
| 286 | + * @param compList | ||
| 287 | + * @param pageModel | ||
| 288 | + */ | ||
| 289 | + private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) { | ||
| 290 | + PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => { | ||
| 291 | + // 刷新,替换所有数据 | ||
| 292 | + this.resetInteract(data, pageModel.compList) | ||
| 293 | + if (pageModel?.channelId === '2001' || pageModel?.channelId === '2002') { | ||
| 294 | + //早晚报意图上报 | ||
| 295 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 296 | + viewBlogInsightIntentShare(context, pageModel?.channelId, compList, ActionMode.EXPECTED) | ||
| 297 | + } | ||
| 298 | + }) | ||
| 299 | + | ||
| 300 | + // 测试数据 | ||
| 301 | + // setTimeout(() => { | ||
| 302 | + // let index = 1 | ||
| 303 | + // let comp = pageModel.compList.getData(index) as CompDTO | ||
| 304 | + // comp.hasMore = 0 | ||
| 305 | + // //comp.operDataList[0].newsTitle = '测试111' | ||
| 306 | + // let con :InteractDataDTO = new InteractDataDTO; | ||
| 307 | + // con.commentNum=1000 | ||
| 308 | + // comp.operDataList[0].interactData = con | ||
| 309 | + // Logger.debug("ZZZXXXXX", | ||
| 310 | + // "-----setTimeout--------->" + comp.hasMore) | ||
| 311 | + // }, 4 * 1000) | ||
| 312 | + } | ||
| 313 | + | ||
| 314 | + /** | ||
| 315 | + * 刷新互动数据到compList | ||
| 316 | + * @param interact 批查互动数据结果 | ||
| 317 | + * @param compList comp list | ||
| 318 | + */ | ||
| 319 | + private resetInteract(interact: InteractDataDTO[], compList: LazyDataSource<BaseDTO>) { | ||
| 320 | + if (interact == null || interact.length == 0) { | ||
| 321 | + return | ||
| 322 | + } | ||
| 323 | + let time = DateTimeUtils.getTimeStamp().toString() | ||
| 324 | + interact.forEach((interactData) => { | ||
| 325 | + let id = interactData.contentId; | ||
| 326 | + outer: for (let i = 0; i < compList.totalCount(); i++) { | ||
| 327 | + let comp = compList.getData(i) as CompDTO; | ||
| 328 | + if (comp == null || comp.operDataList == null || comp.operDataList.length == 0) { | ||
| 329 | + continue; | ||
| 330 | + } | ||
| 331 | + for (let j = 0; j < comp.operDataList.length; j++) { | ||
| 332 | + let content = comp.operDataList[j]; | ||
| 333 | + if (content == null) { | ||
| 334 | + continue; | ||
| 335 | + } | ||
| 336 | + if (id == content.objectId) { | ||
| 337 | + content.interactData = interactData; | ||
| 338 | + comp.timestamp = time | ||
| 339 | + break outer; | ||
| 340 | + } | ||
| 341 | + } | ||
| 342 | + } | ||
| 343 | + }) | ||
| 154 | } | 344 | } |
| 155 | 345 | ||
| 156 | 346 | ||
| @@ -158,9 +348,9 @@ export class PageHelper { | @@ -158,9 +348,9 @@ export class PageHelper { | ||
| 158 | * 处理页面中的广告组件信息 | 348 | * 处理页面中的广告组件信息 |
| 159 | * @param pageDto | 349 | * @param pageDto |
| 160 | */ | 350 | */ |
| 161 | - private handlePageCompAdvPostion(pageCompList: ArrayList<CompDTO>, pageModel: PageModel, pageDto: PageDTO) { | 351 | + private handlePageCompAdvPostion(pageCompList: ArrayList<CompDTO>, pageModel: PageModel, compAdList: CompAdvBean[]) { |
| 162 | 352 | ||
| 163 | - let compAdvList = pageDto.compAdList | 353 | + let compAdvList = compAdList |
| 164 | 354 | ||
| 165 | let flag = true; | 355 | let flag = true; |
| 166 | if (compAdvList == null) { | 356 | if (compAdvList == null) { |
| @@ -272,15 +462,17 @@ export class PageHelper { | @@ -272,15 +462,17 @@ export class PageHelper { | ||
| 272 | let b = advPosition - a; | 462 | let b = advPosition - a; |
| 273 | // console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " " + advPosition + " " + a + " " + b) | 463 | // console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " " + advPosition + " " + a + " " + b) |
| 274 | if (b <= pageCompSize && b >= 0) { | 464 | if (b <= pageCompSize && b >= 0) { |
| 275 | - | 465 | + // 创建广告稿件 |
| 276 | let advComp: CompDTO = new CompDTO; | 466 | let advComp: CompDTO = new CompDTO; |
| 277 | advComp.compStyle = CompStyle.Card_Comp_Adv | 467 | advComp.compStyle = CompStyle.Card_Comp_Adv |
| 278 | advComp.matInfo = matInfo | 468 | advComp.matInfo = matInfo |
| 469 | + | ||
| 279 | if (pageCompSize == slotInfo.position) { | 470 | if (pageCompSize == slotInfo.position) { |
| 280 | pageCompList.add(advComp) | 471 | pageCompList.add(advComp) |
| 281 | } else { | 472 | } else { |
| 282 | pageCompList.insert(advComp, b + layoutAdvIndex) | 473 | pageCompList.insert(advComp, b + layoutAdvIndex) |
| 283 | } | 474 | } |
| 475 | + matInfo.originalPostion = pageCompList.getIndexOf(advComp) | ||
| 284 | 476 | ||
| 285 | layoutAdvIndex = layoutAdvIndex + 1; | 477 | layoutAdvIndex = layoutAdvIndex + 1; |
| 286 | 478 | ||
| @@ -297,137 +489,15 @@ export class PageHelper { | @@ -297,137 +489,15 @@ export class PageHelper { | ||
| 297 | 489 | ||
| 298 | 490 | ||
| 299 | /** | 491 | /** |
| 300 | - * comp加载更多,分页加载 | 492 | + * 获取直播回看数据 |
| 301 | */ | 493 | */ |
| 302 | - private compLoadMore(pageModel: PageModel) { | ||
| 303 | - //聚合页 | ||
| 304 | - if (pageModel.pageType == 1) { | ||
| 305 | - PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => { | ||
| 306 | - if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) { | ||
| 307 | - pageModel.hasMore = false; | ||
| 308 | - return; | ||
| 309 | - } else { | ||
| 310 | - //更新数据 | ||
| 311 | - pageModel.compList.addItems(liveReviewDTO.list); | ||
| 312 | - // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 313 | - pageModel.currentPage++; | ||
| 314 | - pageModel.hasMore = true; | ||
| 315 | - pageModel.pageTotalCompSize = liveReviewDTO.list.length + pageModel.pageTotalCompSize | ||
| 316 | - } | ||
| 317 | - }).catch((err: string | Resource) => { | ||
| 318 | - promptAction.showToast({ message: err }); | ||
| 319 | - }) | ||
| 320 | - } else { | ||
| 321 | - PageViewModel.getPageData(pageModel.bizCopy()) | ||
| 322 | - .then((data: PageDTO) => { | ||
| 323 | - if (data == null || data.compList == null || data.compList.length == 0) { | ||
| 324 | - pageModel.hasMore = false; | ||
| 325 | - } else { | ||
| 326 | - // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 327 | - pageModel.currentPage++; | ||
| 328 | - pageModel.hasMore = true; | 494 | + private async getLiveReviewData(pageInfo: PageInfoDTO,comp: CompDTO) { |
| 329 | 495 | ||
| 330 | - //移除音频 和 活动 | ||
| 331 | - this.collectPageComp(pageModel, data) | ||
| 332 | - // 参与批查 | ||
| 333 | - this.allCompBatchRequest(data.compList, pageModel) | ||
| 334 | - } | ||
| 335 | - }).catch((err: string | Resource) => { | ||
| 336 | - promptAction.showToast({ message: err }); | ||
| 337 | - }) | ||
| 338 | - } | ||
| 339 | - } | 496 | + let currentPage = 1 |
| 497 | + let pageSize = 20 | ||
| 498 | + let listReviewDtoBean = await PageViewModel.getLiveReviewUrl(currentPage, pageSize) as LiveReviewDTO | ||
| 499 | + Logger.error("ZZZXXXXX", 'getLiveReviewData---------'+listReviewDtoBean.list.length); | ||
| 340 | 500 | ||
| 341 | - /** | ||
| 342 | - * 信息流页面,所有稿件需要参与批查,如 批查评论、批查关注状态等接口 | ||
| 343 | - * @param compList | ||
| 344 | - * @param pageModel | ||
| 345 | - */ | ||
| 346 | - private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) { | ||
| 347 | - PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => { | ||
| 348 | - // 刷新,替换所有数据 | ||
| 349 | - this.resetInteract(data, pageModel.compList) | ||
| 350 | - }) | ||
| 351 | - | ||
| 352 | - // 测试数据 | ||
| 353 | - // setTimeout(() => { | ||
| 354 | - // let index = 1 | ||
| 355 | - // let comp = pageModel.compList.getData(index) as CompDTO | ||
| 356 | - // comp.hasMore = 0 | ||
| 357 | - // //comp.operDataList[0].newsTitle = '测试111' | ||
| 358 | - // let con :InteractDataDTO = new InteractDataDTO; | ||
| 359 | - // con.commentNum=1000 | ||
| 360 | - // comp.operDataList[0].interactData = con | ||
| 361 | - // Logger.debug("ZZZXXXXX", | ||
| 362 | - // "-----setTimeout--------->" + comp.hasMore) | ||
| 363 | - // }, 4 * 1000) | ||
| 364 | - } | ||
| 365 | - | ||
| 366 | - /** | ||
| 367 | - * 移除comp | ||
| 368 | - */ | ||
| 369 | - private collectPageComp(pageModel: PageModel, pageDto: PageDTO) { | ||
| 370 | - | ||
| 371 | - let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器 | ||
| 372 | - | ||
| 373 | - pageDto.compList.forEach((element: CompDTO) => { | ||
| 374 | - let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); | ||
| 375 | - //移除音频 和 活动 | ||
| 376 | - if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { | ||
| 377 | - Logger.debug(TAG, 'getGroupData 移除音频 和 活动'); | ||
| 378 | - } else { | ||
| 379 | - // 暂时屏蔽活动和音频详情入口 | ||
| 380 | - if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') { | ||
| 381 | - } else { | ||
| 382 | - pageCompList.add(element) | ||
| 383 | - } | ||
| 384 | - } | ||
| 385 | - | ||
| 386 | - }) | ||
| 387 | - | ||
| 388 | - // 记录 | ||
| 389 | - pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize | ||
| 390 | - | ||
| 391 | - // 处理页面广告数据,投放到页面的位置 | ||
| 392 | - this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto); | ||
| 393 | - | ||
| 394 | - //遍历所有组件和稿件数据 push到页面 | ||
| 395 | - for (let element of pageCompList) { | ||
| 396 | - pageModel.compList.push(CompDTO.createNewsBean(element)) | ||
| 397 | - } | ||
| 398 | - | ||
| 399 | - } | ||
| 400 | - | ||
| 401 | - /** | ||
| 402 | - * 刷新互动数据到compList | ||
| 403 | - * @param interact 批查互动数据结果 | ||
| 404 | - * @param compList comp list | ||
| 405 | - */ | ||
| 406 | - private resetInteract(interact: InteractDataDTO[], compList: LazyDataSource<BaseDTO>) { | ||
| 407 | - if (interact == null || interact.length == 0) { | ||
| 408 | - return | ||
| 409 | - } | ||
| 410 | - let time = DateTimeUtils.getTimeStamp().toString() | ||
| 411 | - interact.forEach((interactData) => { | ||
| 412 | - let id = interactData.contentId; | ||
| 413 | - outer: for (let i = 0; i < compList.totalCount(); i++) { | ||
| 414 | - let comp = compList.getData(i) as CompDTO; | ||
| 415 | - if (comp == null || comp.operDataList == null || comp.operDataList.length == 0) { | ||
| 416 | - continue; | ||
| 417 | - } | ||
| 418 | - for (let j = 0; j < comp.operDataList.length; j++) { | ||
| 419 | - let content = comp.operDataList[j]; | ||
| 420 | - if (content == null) { | ||
| 421 | - continue; | ||
| 422 | - } | ||
| 423 | - if (id == content.objectId) { | ||
| 424 | - content.interactData = interactData; | ||
| 425 | - comp.timestamp = time | ||
| 426 | - break outer; | ||
| 427 | - } | ||
| 428 | - } | ||
| 429 | - } | ||
| 430 | - }) | ||
| 431 | } | 501 | } |
| 432 | } | 502 | } |
| 433 | 503 |
| @@ -178,7 +178,12 @@ export class PageViewModel extends BaseViewModel { | @@ -178,7 +178,12 @@ export class PageViewModel extends BaseViewModel { | ||
| 178 | return compRes.data | 178 | return compRes.data |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | - async getPageData(pageModel: PageUIReqBean): Promise<PageDTO> { | 181 | + /** |
| 182 | + * 获取页面楼层的组件信息 | ||
| 183 | + * @param pageModel | ||
| 184 | + * @returns | ||
| 185 | + */ | ||
| 186 | + async getPageGroupCompData(pageModel: PageUIReqBean): Promise<PageDTO> { | ||
| 182 | Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId); | 187 | Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId); |
| 183 | if (pageModel.isRecGroup) { | 188 | if (pageModel.isRecGroup) { |
| 184 | return this.parseComp(PageRepository.fetchRecCompData(pageModel)) | 189 | return this.parseComp(PageRepository.fetchRecCompData(pageModel)) |
| @@ -65,14 +65,26 @@ | @@ -65,14 +65,26 @@ | ||
| 65 | "value": "14vp" | 65 | "value": "14vp" |
| 66 | }, | 66 | }, |
| 67 | { | 67 | { |
| 68 | + "name": "margin_4", | ||
| 69 | + "value": "4vp" | ||
| 70 | + }, | ||
| 71 | + { | ||
| 68 | "name": "margin_8", | 72 | "name": "margin_8", |
| 69 | "value": "8vp" | 73 | "value": "8vp" |
| 70 | }, | 74 | }, |
| 71 | { | 75 | { |
| 76 | + "name": "margin_9", | ||
| 77 | + "value": "9vp" | ||
| 78 | + }, | ||
| 79 | + { | ||
| 72 | "name": "label_margin_top", | 80 | "name": "label_margin_top", |
| 73 | "value": "10vp" | 81 | "value": "10vp" |
| 74 | }, | 82 | }, |
| 75 | { | 83 | { |
| 84 | + "name": "margin_12", | ||
| 85 | + "value": "12vp" | ||
| 86 | + }, | ||
| 87 | + { | ||
| 76 | "name": "margin_bottom_16", | 88 | "name": "margin_bottom_16", |
| 77 | "value": "16vp" | 89 | "value": "16vp" |
| 78 | }, | 90 | }, |
496 Bytes
| @@ -273,7 +273,8 @@ export struct DetailPlayShortVideoPage { | @@ -273,7 +273,8 @@ export struct DetailPlayShortVideoPage { | ||
| 273 | this.playerCoverBuilder() | 273 | this.playerCoverBuilder() |
| 274 | 274 | ||
| 275 | // 横屏-全屏观看 | 275 | // 横屏-全屏观看 |
| 276 | - if (this.videoLandScape === 1) { | 276 | + // 点击查看详情 不展示 |
| 277 | + if (this.videoLandScape === 1 && !this.isOpenDetail) { | ||
| 277 | this.playerFullscreenBuilder() | 278 | this.playerFullscreenBuilder() |
| 278 | } | 279 | } |
| 279 | } | 280 | } |
| 1 | import { Action, ContentDetailDTO, InteractDataDTO } from 'wdBean/Index'; | 1 | import { Action, ContentDetailDTO, InteractDataDTO } from 'wdBean/Index'; |
| 2 | +import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel, StringUtils } from 'wdKit'; | ||
| 2 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index' | 3 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index' |
| 3 | import { ResponseDTO } from 'wdNetwork/Index'; | 4 | import { ResponseDTO } from 'wdNetwork/Index'; |
| 4 | import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' | 5 | import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' |
| 5 | import router from '@ohos.router'; | 6 | import router from '@ohos.router'; |
| 6 | import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 7 | import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 7 | -import { WindowModel } from 'wdKit'; | ||
| 8 | import { DisplayDirection } from 'wdConstant/Index'; | 8 | import { DisplayDirection } from 'wdConstant/Index'; |
| 9 | import { window } from '@kit.ArkUI'; | 9 | import { window } from '@kit.ArkUI'; |
| 10 | +import { EmptyComponent } from '../../../../../wdComponent/src/main/ets/components/view/EmptyComponent'; | ||
| 10 | 11 | ||
| 11 | const storage = LocalStorage.getShared(); | 12 | const storage = LocalStorage.getShared(); |
| 12 | const TAG = 'DetailVideoListPage' | 13 | const TAG = 'DetailVideoListPage' |
| @@ -29,22 +30,31 @@ export struct DetailVideoListPage { | @@ -29,22 +30,31 @@ export struct DetailVideoListPage { | ||
| 29 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL | 30 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL |
| 30 | @State data: ContentDetailDTO[] = [] | 31 | @State data: ContentDetailDTO[] = [] |
| 31 | @State currentIndex: number = 0 | 32 | @State currentIndex: number = 0 |
| 33 | + @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 | ||
| 32 | @State interactDataList: InteractDataDTO[] = [] | 34 | @State interactDataList: InteractDataDTO[] = [] |
| 33 | 35 | ||
| 34 | async aboutToAppear(): Promise<void> { | 36 | async aboutToAppear(): Promise<void> { |
| 35 | - this.openFullScreen() | ||
| 36 | - | ||
| 37 | - const action: Action = router.getParams() as Action | ||
| 38 | - if (action) { | ||
| 39 | - this.contentId = action.params?.contentID || '' | ||
| 40 | - if (action.params && action.params.extra) { | ||
| 41 | - this.relId = action.params.extra.relId || '' | ||
| 42 | - this.relType = action.params.extra.relType || '' | 37 | + // 注册监听网络连接 |
| 38 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 39 | + if (netStatus) { | ||
| 40 | + this.openFullScreen() | ||
| 41 | + const action: Action = router.getParams() as Action | ||
| 42 | + if (action) { | ||
| 43 | + this.contentId = action.params?.contentID || '' | ||
| 44 | + if (action.params && action.params.extra) { | ||
| 45 | + this.relId = action.params.extra.relId || '' | ||
| 46 | + this.relType = action.params.extra.relType || '' | ||
| 47 | + } | ||
| 48 | + await this.getContentDetail(this.contentId, this.relId, this.relType) | ||
| 43 | } | 49 | } |
| 44 | - await this.getContentDetail(this.contentId, this.relId, this.relType) | 50 | + await this.queryVideoList() |
| 51 | + console.log(TAG, 'aboutToAppear', JSON.stringify(action.params)) | ||
| 52 | + | ||
| 53 | + } else { | ||
| 54 | + // 无网络 | ||
| 55 | + this.netStatus = 1 | ||
| 45 | } | 56 | } |
| 46 | - await this.queryVideoList() | ||
| 47 | - console.log(TAG, 'aboutToAppear', JSON.stringify(action.params)) | 57 | + |
| 48 | } | 58 | } |
| 49 | 59 | ||
| 50 | aboutToDisappear(): void { | 60 | aboutToDisappear(): void { |
| @@ -163,39 +173,53 @@ export struct DetailVideoListPage { | @@ -163,39 +173,53 @@ export struct DetailVideoListPage { | ||
| 163 | } | 173 | } |
| 164 | 174 | ||
| 165 | build() { | 175 | build() { |
| 166 | - Column() { | ||
| 167 | - Swiper(this.swiperController) { | ||
| 168 | - ForEach(this.data, (item: ContentDetailDTO, index: number) => { | ||
| 169 | - DetailPlayShortVideoPage({ | ||
| 170 | - contentDetailData: item, | ||
| 171 | - currentIndex: this.currentIndex, | ||
| 172 | - index: index, | ||
| 173 | - interactData: this.interactDataList[index] | ||
| 174 | - }) | ||
| 175 | - }, (item: ContentDetailDTO) => item.newsId + '') | 176 | + if (this.netStatus !== undefined) { |
| 177 | + EmptyComponent({ | ||
| 178 | + emptyType: this.netStatus, emptyButton: true, retry: () => { | ||
| 179 | + this.getContentDetail(this.contentId, this.relId, this.relType) | ||
| 180 | + } | ||
| 181 | + }) | ||
| 182 | + .id('e_empty_content') | ||
| 183 | + .alignRules({ | ||
| 184 | + center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 185 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 186 | + }) | ||
| 187 | + } else { | ||
| 188 | + | ||
| 189 | + Column() { | ||
| 190 | + Swiper(this.swiperController) { | ||
| 191 | + ForEach(this.data, (item: ContentDetailDTO, index: number) => { | ||
| 192 | + DetailPlayShortVideoPage({ | ||
| 193 | + contentDetailData: item, | ||
| 194 | + currentIndex: this.currentIndex, | ||
| 195 | + index: index, | ||
| 196 | + interactData: this.interactDataList[index] | ||
| 197 | + }) | ||
| 198 | + }, (item: ContentDetailDTO) => item.newsId + '') | ||
| 199 | + } | ||
| 200 | + .disableSwipe(this.displayDirection === DisplayDirection.VERTICAL || !this.showComment ? false : true) | ||
| 201 | + .indicator(false) | ||
| 202 | + .vertical(true) | ||
| 203 | + .loop(false) | ||
| 204 | + .width('100%') | ||
| 205 | + .height('100%') | ||
| 206 | + .displayCount(1, true) | ||
| 207 | + .onChange((index: number) => { | ||
| 208 | + this.currentIndex = index | ||
| 209 | + if (this.currentIndex === this.data.length - 1) { | ||
| 210 | + // TODO:下拉刷新“努力加载中” | ||
| 211 | + this.queryVideoList() | ||
| 212 | + } | ||
| 213 | + }) | ||
| 176 | } | 214 | } |
| 177 | - .disableSwipe(this.displayDirection === DisplayDirection.VERTICAL || !this.showComment ? false : true) | ||
| 178 | - .indicator(false) | ||
| 179 | - .vertical(true) | ||
| 180 | - .loop(false) | ||
| 181 | .width('100%') | 215 | .width('100%') |
| 182 | .height('100%') | 216 | .height('100%') |
| 183 | - .displayCount(1, true) | ||
| 184 | - .onChange((index: number) => { | ||
| 185 | - this.currentIndex = index | ||
| 186 | - if (this.currentIndex === this.data.length - 1) { | ||
| 187 | - // TODO:下拉刷新“努力加载中” | ||
| 188 | - this.queryVideoList() | ||
| 189 | - } | ||
| 190 | - }) | 217 | + .backgroundColor(Color.Black) |
| 218 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 219 | + | ||
| 220 | + // .padding({ | ||
| 221 | + // bottom: this.bottomSafeHeight + 'px' | ||
| 222 | + // }) | ||
| 191 | } | 223 | } |
| 192 | - .width('100%') | ||
| 193 | - .height('100%') | ||
| 194 | - .backgroundColor(Color.Black) | ||
| 195 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 196 | - | ||
| 197 | - // .padding({ | ||
| 198 | - // bottom: this.bottomSafeHeight + 'px' | ||
| 199 | - // }) | ||
| 200 | } | 224 | } |
| 201 | } | 225 | } |
| @@ -178,7 +178,7 @@ export struct PlayerRightView { | @@ -178,7 +178,7 @@ export struct PlayerRightView { | ||
| 178 | .width(58) | 178 | .width(58) |
| 179 | .position({ x: '100%', y: '100%' }) | 179 | .position({ x: '100%', y: '100%' }) |
| 180 | .markAnchor({ x: '100%', y: '100%' }) | 180 | .markAnchor({ x: '100%', y: '100%' }) |
| 181 | - .padding({ bottom: 10, right: 10 }) | 181 | + .padding({ bottom: 7, right: 10 }) |
| 182 | .visibility(this.isOpenDetail || this.isDragging || this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? | 182 | .visibility(this.isOpenDetail || this.isDragging || this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? |
| 183 | Visibility.None : Visibility.Visible) | 183 | Visibility.None : Visibility.Visible) |
| 184 | 184 |
No preview for this file type
| @@ -9,11 +9,12 @@ const TAG = 'SpacialTopicPage'; | @@ -9,11 +9,12 @@ const TAG = 'SpacialTopicPage'; | ||
| 9 | @Entry | 9 | @Entry |
| 10 | @Component | 10 | @Component |
| 11 | struct SpacialTopicPage { | 11 | struct SpacialTopicPage { |
| 12 | - action: Action = {} as Action | ||
| 13 | - | 12 | + @State action: Action = {} as Action |
| 13 | + @State reload: number = 0 | ||
| 14 | + @State count: number = 0 | ||
| 14 | build() { | 15 | build() { |
| 15 | Column() { | 16 | Column() { |
| 16 | - SpacialTopicPageComponent({ action: this.action }) | 17 | + SpacialTopicPageComponent({ action: this.action ,reload:this.reload }) |
| 17 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) | 18 | }.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT) |
| 18 | } | 19 | } |
| 19 | 20 | ||
| @@ -30,8 +31,12 @@ struct SpacialTopicPage { | @@ -30,8 +31,12 @@ struct SpacialTopicPage { | ||
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | aboutToAppear() { | 33 | aboutToAppear() { |
| 33 | - Logger.info(TAG, 'aboutToAppear'); | 34 | + Logger.info(TAG, `aboutToAppearcount:${this.reload}`); |
| 34 | let action: Action = router.getParams() as Action | 35 | let action: Action = router.getParams() as Action |
| 35 | this.action = action | 36 | this.action = action |
| 36 | } | 37 | } |
| 38 | + onPageShow() { | ||
| 39 | + this.reload = this.reload + 1 | ||
| 40 | + Logger.info(TAG, `onPageShowcount:${this.reload}`); | ||
| 41 | + } | ||
| 37 | } | 42 | } |
| @@ -47,7 +47,7 @@ struct LaunchInterestsHobbiesPage { | @@ -47,7 +47,7 @@ struct LaunchInterestsHobbiesPage { | ||
| 47 | .width('100%') | 47 | .width('100%') |
| 48 | .height('61lpx') | 48 | .height('61lpx') |
| 49 | .margin({top:'84lpx'}) | 49 | .margin({top:'84lpx'}) |
| 50 | - Text('完善信息,将为您推荐个性化的内容') | 50 | + Text('完善信息,将为您推荐个性化的内容') |
| 51 | .fontSize('27lpx') | 51 | .fontSize('27lpx') |
| 52 | .textAlign(TextAlign.Center) | 52 | .textAlign(TextAlign.Center) |
| 53 | .fontColor('#9E9E9E') | 53 | .fontColor('#9E9E9E') |
| @@ -69,8 +69,8 @@ struct LaunchInterestsHobbiesPage { | @@ -69,8 +69,8 @@ struct LaunchInterestsHobbiesPage { | ||
| 69 | Image('') | 69 | Image('') |
| 70 | .width('100%') | 70 | .width('100%') |
| 71 | .height('100%') | 71 | .height('100%') |
| 72 | - .backgroundColor(Color.Gray) | ||
| 73 | - .opacity(item.choose?0.85:0) | 72 | + .backgroundColor(Color.Black) |
| 73 | + .opacity(item.choose?0.5:0) | ||
| 74 | .borderRadius(5) | 74 | .borderRadius(5) |
| 75 | } | 75 | } |
| 76 | 76 | ||
| @@ -134,14 +134,14 @@ struct LaunchInterestsHobbiesPage { | @@ -134,14 +134,14 @@ struct LaunchInterestsHobbiesPage { | ||
| 134 | .width('662lpx') | 134 | .width('662lpx') |
| 135 | .height('84lpx') | 135 | .height('84lpx') |
| 136 | .backgroundColor(Color.White) | 136 | .backgroundColor(Color.White) |
| 137 | - .opacity(this.selectCount == 0 ? 0.3 : 0) | 137 | + .opacity(this.selectCount == 0 ? 0.6 : 0) |
| 138 | .borderRadius('10lpx') | 138 | .borderRadius('10lpx') |
| 139 | .onClick(()=>{ | 139 | .onClick(()=>{ |
| 140 | if (this.selectCount == 0) { | 140 | if (this.selectCount == 0) { |
| 141 | promptAction.showToast({ | 141 | promptAction.showToast({ |
| 142 | message : '请先选择您感兴趣的内容哦', | 142 | message : '请先选择您感兴趣的内容哦', |
| 143 | duration: 2000, | 143 | duration: 2000, |
| 144 | - bottom: '50%' | 144 | + bottom: '50%', |
| 145 | }) | 145 | }) |
| 146 | return | 146 | return |
| 147 | } | 147 | } |
-
Please register or login to post a comment