douaojie

Merge remote-tracking branch 'origin/main'

Showing 80 changed files with 1083 additions and 456 deletions
... ... @@ -220,6 +220,9 @@ export class ProcessUtils {
}
public static gotoDefaultWeb(content: ContentDTO) {
// 内链
if(content.openType == '1'){
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
... ... @@ -227,7 +230,16 @@ export class ProcessUtils {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
}else if(content.openType == '2') {
// 外链
ProcessUtils.jumpExternalWebPage(content.linkUrl);
}else {
// 无需跳转
}
Logger.debug(TAG, `gotoWeb, ${content.objectId}`)
}
static commentGotoWeb(content: commentInfo) {
... ...
... ... @@ -18,7 +18,6 @@ export function handleJsCallAppService(data: Message, callback: (res: string) =>
if (queryString) {
url = url + `?${queryString}`
}
console.log('yzl', queryString, url)
WDHttp.get(url).then((res) => {
callback(JSON.stringify({
netError: '0',
... ...
... ... @@ -15,6 +15,7 @@ export struct WdWebComponent {
onWebPrepared: () => void = () => {
}
@Prop webUrl: string = ''
@Prop @Watch('onReloadStateChanged') reload: number = 0
@Link isPageEnd: boolean
build() {
... ... @@ -87,5 +88,11 @@ export struct WdWebComponent {
Logger.debug(TAG, 'onLoadIntercept return false');
return false
}
onReloadStateChanged() {
Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
if (this.reload > 0) {
this.webviewControl.refresh()
}
}
}
... ...
... ... @@ -15,6 +15,7 @@ export struct WdWebLocalComponent {
}
@Prop backVisibility: boolean = false
@Prop webResource: Resource = {} as Resource
@Prop @Watch('onReloadStateChanged') reload: number = 0
@State webHeight: string | number = '100%'
@Link isPageEnd: boolean
@State videoUrl: string = ''
... ... @@ -240,5 +241,11 @@ export struct WdWebLocalComponent {
Logger.debug(TAG, 'onLoadIntercept return false');
return false
}
onReloadStateChanged() {
Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
if (this.reload > 0) {
this.webviewControl.refresh()
}
}
}
... ...
... ... @@ -10,73 +10,77 @@
/*
信息流广告素材解析累
*/
export interface CompAdvMatInfoBean {
export class CompAdvMatInfoBean {
id:number = 0
/**
* 广告标题
*/
advTitle: string
advTitle: string = ''
/**
* 3:信息流广告
*/
advType: string
advType: string =''
/**
* 信息流广告类型(4:轮播图 5:三图广告 6:小图广告 7:长通栏广告 8:大图广告 9:视频广告 10:展会广告 11:冠名广告 12:顶部长通栏广告)
*/
advSubType: number
advSubType: number = 0
/**
* 素材图片信息;adv_subtype=4,5,6,7,8,9,12 时使用
*/
matImageUrl: string[]
matImageUrl: string[] = []
/**
* 视频广告地址(adv_subtype=9)
*/
matVideoUrl: string
matVideoUrl: string = ''
/**
* 扩展信息:advSubType=10,11时使用,字段示例见接口备注。
*/
extraData: string
extraData: string = ''
/**
* 链接类型: 0:无链接;1:内链(文章);2:外链
*/
linkType: string
linkType: string = ''
/**
* 链接跳转类型 :0-没链接,不用打开,1-端内打开,2-端外打开
*/
openType: string
openType: string = ''
/**
* 广告跳转链接
*/
linkUrl: string
linkUrl: string = ''
/**
* 素材类型(0:图片 1:视频)
*/
matType: string
matType: string = ''
/**
* 开屏样式(1:全屏样式 0:底部固定Logo)
*/
startStyle: string
startStyle: string = ''
// 本地字段
originalPostion : number = -1 // 广告原始投放位置
}
/**
* 信息流广告位
*/
export interface CompAdvSlotInfoBean {
export class CompAdvSlotInfoBean {
/**
* 组件id
*/
compId: string;
compId: string = '';
/**
* 广告位位置 从1开始
*/
position: number;
position: number = 0;
/**
* 频道id
*/
channelId: string;
channelId: string = '';
}
\ No newline at end of file
... ...
... ... @@ -40,7 +40,7 @@ export class CompDTO implements BaseDTO {
/**
* 信息流广告素材
*/
matInfo: CompAdvMatInfoBean = {} as CompAdvMatInfoBean
matInfo: CompAdvMatInfoBean = new CompAdvMatInfoBean
pageId?: string;
objectType?: string;
hasMore: number = 1
... ...
... ... @@ -10,6 +10,7 @@ import { BaseDTO } from '../component/BaseDTO';
@Observed
export class ContentDTO implements BaseDTO {
shareFlag?:string='1';
appStyle: string = '';
cityCode: string = '';
coverSize: string = '';
... ...
... ... @@ -2,6 +2,8 @@
* page接口返回的Page数据DTO
*/
import { AdvRuleBean, CompAdvBean } from '../adv/AdvsRuleBean';
import { ArrayList } from '@kit.ArkTS';
import { CompDTO } from '../component/CompDTO';
export interface PageInfoDTO {
pageId: string; // 页面id
... ... @@ -27,6 +29,18 @@ export interface PageInfoDTO {
*/
cornersAdv2: CompAdvBean[]
// 本地字段
/*
记录一次请求获取到的楼层comp数据,如 完成一次刷新到结束,获取所有楼层的稿件数据
*/
oneRequestPageGroupCompList: ArrayList<CompDTO>
/*
记录页面楼层所有的信息流广告数据
*/
pageAdList:CompAdvBean[]
}
export interface ChannelInfoDTO {
... ...
... ... @@ -44,7 +44,7 @@ export struct CardParser {
} else if (contentDTO.appStyle === CompStyle.Card_04) {
Card4Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_05) {
Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy })
Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy, compDTO: this.compDTO })
} else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle
.Card_13) {
Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO })
... ...
... ... @@ -30,10 +30,13 @@ export struct CarderInteraction {
this.likeBean['title'] = this.contentDetailData.newsTitle + ''
this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
this.contentDTO.shareFlag = this.contentDTO.shareFlag?this.contentDTO.shareFlag:'1'
console.log('是否显示分享',this.contentDTO.shareFlag)
}
build() {
Row() {
if(this.contentDTO.shareFlag === '1'){
Row() {
Image($r('app.media.CarderInteraction_share'))
.width(18)
... ... @@ -47,6 +50,8 @@ export struct CarderInteraction {
.onClick(() => {
WDShare.shareContent(this.contentDetailData)
})
}
Row() {
Image($r('app.media.CarderInteraction_comment'))
... ... @@ -66,11 +71,11 @@ export struct CarderInteraction {
}
.width('100%')
.margin({ top: 11 })
.padding({
left: 21,
right: 21
})
.justifyContent(FlexAlign.SpaceBetween)
// .padding({
// left: 21,
// right: 21
// })
.justifyContent(FlexAlign.SpaceAround)
.alignItems(VerticalAlign.Center)
}
... ...
... ... @@ -105,8 +105,10 @@ export struct CompParser {
// ZhSingleColumn05({ compDTO: compDTO })
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
Divider().strokeWidth(3).color('#ffffff').padding({ left: 16, right: 16 }).margin({top: -3})
Divider().strokeWidth(6).color('#f5f5f5')
ZhSingleColumn09({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
Divider().strokeWidth(6).color('#f5f5f5')
} else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
AdvCardParser({ pageModel: this.pageModel, compDTO: this.compDTO })
//Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 })
... ...
... ... @@ -103,7 +103,7 @@ export struct DynamicDetailComponent {
//分割线
Image($r('app.media.ic_news_detail_division'))
.width('100%')
.height($r('app.float.margin_7'))
.height($r('app.float.margin_12'))
.padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
Stack({ alignContent: Alignment.Bottom }) {
if (!this.isNetConnected) {
... ...
... ... @@ -23,7 +23,6 @@ export struct ImageAndTextWebComponent {
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
private dataPrepared = false;
async onDetailDataUpdated() {
if (this.action) {
let contentId: string = ''
... ... @@ -96,6 +95,7 @@ export struct ImageAndTextWebComponent {
Column() {
WdWebLocalComponent({
webviewControl: this.webviewControl,
reload:this.reload,
webResource: $rawfile('apph5/index.html'),
backVisibility: false,
onWebPrepared: this.onWebPrepared.bind(this),
... ...
... ... @@ -25,6 +25,7 @@ export struct ImageDownloadComponent {
build() {
Column() {
SaveButton({ icon: SaveIconStyle.LINES })
.iconSize(24)
.iconColor(Color.White)
.onClick(async () => {
console.info(`cj2024 onClick ${this.imageBuffer}`)
... ...
import { ContentDTO } from 'wdBean/Index';
import { ProcessUtils } from 'wdRouter/Index';
import { InteractMessageModel } from '../../model/InteractMessageModel'
import { DateTimeUtils} from 'wdKit/Index'
@Component
export struct InteractMComponent {
messageModel:InteractMessageModel = new InteractMessageModel;
... ... @@ -15,6 +15,7 @@ export struct InteractMComponent {
build() {
Row(){
Image(this.messageModel.InteractMsubM.headUrl)
.alt($r('app.media.default_head'))
.width(36)
.height(36)
.borderRadius(18)
... ... @@ -29,7 +30,7 @@ export struct InteractMComponent {
.margin({left:5})
}.width('100%')
Text(this.messageModel.time)
Text(this.getPublishTime(this.messageModel.time,DateTimeUtils.getDateTimestamp(this.messageModel.time)+""))
.margin({top:2})
.fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10})
... ... @@ -41,6 +42,7 @@ export struct InteractMComponent {
.constraintSize({maxHeight:500})
}
if(this.messageModel.contentType != '211'){
Column(){
if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){
Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500})
... ... @@ -77,6 +79,7 @@ export struct InteractMComponent {
contentDTO.objectId = this.messageModel.InteractMsubM.contentId
ProcessUtils.processPage(contentDTO)
})
}
}.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%')
}.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top)
}
... ... @@ -102,4 +105,49 @@ export struct InteractMComponent {
let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply;
return contentString;
}
getPublishTime(data:string,publishTime: string): string {
const publishTimestamp = parseInt(publishTime)
const currentTime = Date.now(); // 当前时间戳
// 计算差异
const timeDifference = currentTime - publishTimestamp;
// 转换为分钟、小时和天
const minutes = Math.floor(timeDifference / (1000 * 60));
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
// 根据时间差返回对应的字符串
let result: string;
if (minutes < 60) {
result = `${minutes}分钟前`;
if (minutes === 0) {
result = `刚刚`;
}
} else if (hours < 24) {
result = `${hours}小时前`;
} else {
result = `${days}天前`;
if (days > 1) {
let arr = data.split(" ")
if (arr.length === 2) {
let arr2 = arr[0].split("-")
if (arr2.length === 3) {
result = `${arr2[1]}-${arr2[2]}`
}
} else {
//原始数据是时间戳 需要转成dateString
let time = DateTimeUtils.formatDate(Number(publishTime))
let arr = time.split("-")
if (arr.length === 3) {
result = `${arr[1]}-${arr[2]}`
}
}
}
}
console.log(result);
return result
}
}
\ No newline at end of file
... ...
... ... @@ -21,6 +21,8 @@ import { effectKit } from '@kit.ArkGraphics2D';
import { window } from '@kit.ArkUI';
import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel';
import { AudioSuspensionModel } from '../../viewmodel/AudioSuspensionModel'
import { viewColumInsightIntentShare } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG = 'MorningEveningPaperComponent';
... ... @@ -126,6 +128,10 @@ export struct MorningEveningPaperComponent {
// let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + this.dailyPaperTopicPageId)
let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("" + dailyPaperTopicPageId) //"25091"
this.pageInfoBean = pageInfoBean;
//早晚报意图上报
let context = getContext(this) as common.UIAbilityContext;
viewColumInsightIntentShare(context,String(dailyPaperTopicPageId), this.pageInfoBean)
this.title = this.pageInfoBean?.topicInfo?.title
let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN)
const dateShow = new Date(dateTime)
... ...
... ... @@ -20,6 +20,7 @@ export struct SpacialTopicPageComponent {
action: Action = {} as Action
@State webUrl: string = '';
@State isPageEnd: boolean = false
@Prop reload: number = 0;
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
... ... @@ -101,6 +102,7 @@ export struct SpacialTopicPageComponent {
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.webUrl,
reload: this.reload,
onWebPrepared: this.onWebPrepared.bind(this),
isPageEnd: $isPageEnd,
})
... ... @@ -132,12 +134,6 @@ export struct SpacialTopicPageComponent {
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
}
onPageShow() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(true)
}
}
aboutToAppear() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(true)
... ... @@ -146,12 +142,6 @@ export struct SpacialTopicPageComponent {
this.getDetail()
}
onPageHide() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(false)
}
}
aboutToDisappear() {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(false)
... ...
... ... @@ -11,19 +11,19 @@ export struct CardSourceInfo {
Flex() {
if (this.contentDTO.corner) {
Text(this.contentDTO.corner)
.fontSize($r("app.float.font_size_12"))
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_ED2800"))
.margin({ right: 2 })
}
if (this.contentDTO.rmhPlatform === 1) {
Text(this.contentDTO.rmhInfo?.rmhName)
.fontSize($r("app.float.font_size_12"))
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
} else if (this.contentDTO.source) {
Text(`${this.contentDTO.source}`)
.fontSize($r("app.float.font_size_12"))
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ... @@ -43,13 +43,13 @@ export struct CardSourceInfo {
.height(16)
}
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
.flexShrink(0)
}
if (this.getContentDtoBean()?.interactData?.commentNum) {
Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`)
.fontSize($r("app.float.font_size_12"))
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_B0B0B0"))
.flexShrink(0)
.margin({ left: 6 })
... ... @@ -66,10 +66,10 @@ export struct CardSourceInfo {
*/
private getContentDtoBean(): ContentDTO {
if (this.compDTO == undefined) {
return new ContentDTO
return this.contentDTO
}
if(this.compDTO.operDataList.length == 0){
return new ContentDTO
return this.contentDTO
}
return this.compDTO.operDataList[0]
}
... ...
... ... @@ -13,11 +13,13 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import router from '@ohos.router'
import { postBatchAttentionStatusParams } from 'wdBean/Index';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
@Component
export struct RmhTitle {
@Prop rmhInfo: RmhInfoDTO
@Prop publishTime: string | undefined
@State loadImg: boolean = false;
/**
* 是否需要隐藏发布时间超过2天的时间展示,默认不隐藏
*/
... ... @@ -76,13 +78,15 @@ export struct RmhTitle {
}
}
aboutToAppear(): void {
async aboutToAppear(): Promise<void> {
this.getBatchAttentionStatus()
let page = router.getState();
if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) {
this.hideTime = true;
}
this.loadImg = await onlyWifiLoadImg();
}
getDaysBetweenDates(date: number) {
... ... @@ -96,7 +100,7 @@ export struct RmhTitle {
build() {
Flex() {
Stack() {
Image(this.rmhInfo?.rmhHeadUrl)
Image(this.loadImg ? this.rmhInfo?.rmhHeadUrl : $r('app.media.comment_rmh_tag'))
.width(36)
.height(36).borderRadius(50)
Image(this.rmhInfo?.authIcon)
... ...
... ... @@ -54,7 +54,7 @@ export struct CardAdvBottom {
let currentIndex = -1
for (let i = 0; i < this.pageModel.compList.size(); i++) {
let b = this.pageModel.compList.getData(i) as CompDTO
if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) {
if (a.compStyle == b.compStyle && a.matInfo.id == b.matInfo.id && a.matInfo.originalPostion == b.matInfo.originalPostion) {
currentIndex = i
break;
}
... ...
... ... @@ -66,7 +66,7 @@ export struct CardAdvTop {
let currentIndex = -1
for (let i = 0; i < this.pageModel.compList.size(); i++) {
let b = this.pageModel.compList.getData(i) as CompDTO
if (a.compStyle === b.compStyle && a.matInfo === b.matInfo) {
if (a.compStyle == b.compStyle && a.matInfo.id == b.matInfo.id && a.matInfo.originalPostion == b.matInfo.originalPostion) {
currentIndex = i
break;
}
... ...
... ... @@ -51,7 +51,7 @@ export struct Card10Component {
}
}
.width(CommonConstants.FULL_WIDTH)
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontWeight(600)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ...
... ... @@ -52,7 +52,7 @@ export struct Card11Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r("app.float.font_size_16"))
.fontSize($r("app.float.font_size_18"))
.fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ...
... ... @@ -50,7 +50,7 @@ export struct Card12Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(3)
... ...
... ... @@ -54,7 +54,7 @@ export struct Card14Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.textOverflowStyle(3)
.lineHeight(25)
... ...
... ... @@ -55,7 +55,7 @@ export struct Card15Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(2)
... ...
... ... @@ -58,7 +58,7 @@ export struct Card16Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(2)
... ...
... ... @@ -49,7 +49,7 @@ export struct Card17Component {
}
}
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.lineHeight(25)
.maxLines(3)
... ...
... ... @@ -21,6 +21,7 @@ export struct Card19Component {
async aboutToAppear(): Promise<void> {
this.titleInit();
console.log('card19',JSON.stringify(this.contentDTO))
}
titleInit() {
... ... @@ -48,12 +49,12 @@ export struct Card19Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.textOverflowStyle(3)
.margin({ bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
.lineHeight(22)
.lineHeight(25)
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
... ... @@ -66,7 +67,7 @@ export struct Card19Component {
const photo: PhotoListBean = {
width: item.weight,
height: item.height,
picPath: item.fullUrl,
picPath: item.fullUrl||item.url,
picDesc: ''
}
return photo
... ... @@ -110,6 +111,7 @@ struct createImg {
fullUrl: ''
} as FullColumnImgUrlDTO)
}
console.log('card19-this.fullColumnImgUrls',JSON.stringify(this.fullColumnImgUrls))
}
caclImageRadius(index: number) {
... ... @@ -163,14 +165,14 @@ struct createImg {
alignContent: Alignment.BottomEnd
}) {
if (this.getPicType() === 1) {
Image(this.loadImg ? item.fullUrl : '')
Image(this.loadImg ? item.fullUrl||item.url : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.height(172)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
} else if (this.getPicType() === 2) {
Image(this.loadImg ? item.fullUrl : '')
Image(this.loadImg ? item.fullUrl||item.url : '')
.width('100%')
.height(305)
.autoResize(true)
... ...
... ... @@ -50,7 +50,7 @@ export struct Card20Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(3)
... ...
... ... @@ -52,7 +52,7 @@ export struct Card21Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.selected_text_size'))
.fontSize(18)
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.maxLines(4)
... ...
... ... @@ -7,7 +7,6 @@ import { CardSourceInfo } from '../cardCommon/CardSourceInfo';
import { Notes } from './notes';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
// import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
const TAG: string = 'Card2Component';
/**
... ... @@ -48,7 +47,9 @@ export struct Card2Component {
Column() {
Stack() {
//新闻标题
if (this.contentDTO.objectType == '5') {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
... ... @@ -62,14 +63,18 @@ export struct Card2Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
}
.alignContent(Alignment.TopStart)
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
}.alignContent(Alignment.TopStart)
//.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
// }
// .alignContent(Alignment.TopStart)
//大图
Stack() {
... ...
... ... @@ -50,7 +50,8 @@ export struct Card3Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r("app.float.font_size_16"))
.lineHeight(27)
.fontSize($r("app.float.font_size_18"))
.fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
.width(CommonConstants.FULL_WIDTH)
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
... ...
... ... @@ -4,7 +4,7 @@ import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from './notes';
const TAG: string = 'Card4Component';
/**
... ... @@ -44,6 +44,11 @@ export struct Card4Component {
//body
Column() {
//新闻标题
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text() {
if (this.titleMarked) {
Span(this.str01)
... ... @@ -54,10 +59,14 @@ export struct Card4Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
.alignContent(Alignment.TopStart)// 超出的部分显示省略号。
//三图
Stack(){
Row() {
... ...
import { ContentDTO } from 'wdBean';
import { ContentDTO, CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { Notes } from './notes';
import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG: string = 'Card5Component';
... ... @@ -13,6 +15,7 @@ const TAG: string = 'Card5Component';
export struct Card5Component {
@State contentDTO: ContentDTO = new ContentDTO();
@Prop titleShowPolicy: number | string
@Prop compDTO: CompDTO = {} as CompDTO
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
... ... @@ -71,10 +74,11 @@ export struct Card5Component {
}
.width(CommonConstants.FULL_WIDTH)
.fontColor(Color.White)
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontWeight(FontWeight.Bold)
.maxLines(2)
.align(Alignment.TopStart)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
... ... @@ -96,6 +100,8 @@ export struct Card5Component {
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
let context = getContext(this) as common.UIAbilityContext;
viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED)
})
}
... ...
... ... @@ -70,8 +70,8 @@ export struct Card6Component {
}
}
.fontColor(this.clicked ? 0x848484 : 0x222222)
.fontSize(16)
.lineHeight(24)
.fontSize(18)
.lineHeight(27)
.fontWeight(FontWeight.Normal)
.maxLines(3)
.alignSelf(ItemAlign.Start)
... ...
... ... @@ -38,6 +38,11 @@ export struct Card9Component {
Column() {
// 顶部标题,最多两行
if (this.contentDTO.titleShow === 1 && this.contentDTO.newsTitle) {
if (this.contentDTO.newTags) {
Notes({ newTags: this.contentDTO.newTags })
} else if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text() {
if (this.titleMarked) {
Span(this.str01)
... ... @@ -50,11 +55,16 @@ export struct Card9Component {
}
.fontColor(this.clicked ? 0x848484 : 0x222222)
.width(CommonConstants.FULL_WIDTH)
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontWeight(600)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 19 })
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
.alignContent(Alignment.TopStart)
}
// 大图
Stack() {
... ... @@ -102,7 +112,7 @@ export struct Card9Component {
}
.width(CommonConstants.FULL_WIDTH)
.padding({
top: 14,
top: 5,
left: 16,
right: 16,
bottom: 14
... ...
... ... @@ -36,7 +36,7 @@ export struct SearchContentComponent {
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
... ...
... ... @@ -156,7 +156,7 @@ export struct CommentIconComponent {
// Stack({alignContent:Alignment.Start}) {
if (Number.parseInt(this.publishCommentModel.totalCommentNumer) != 0) {
RelativeContainer() {
Image($r('app.media.comment_icon_number_bg'))
Image(this.styleType == 1 ? $r('app.media.comment_icon_number_bg'):$r('app.media.ic_like_back_Select'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
... ...
... ... @@ -38,20 +38,19 @@ export struct QualityCommentsComponent {
aboutToDisappear(): void {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
windowClass.setWindowBackgroundColor(this.lastWindowColor)
windowClass.setWindowLayoutFullScreen(false)
// windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' })
this.dialogController = null // 将dialogController置空
}
onPageShow(): void {
WindowModel.shared.setWindowLayoutFullScreen(true)
}
aboutToAppear(): void {
onPageHide(): void {
WindowModel.shared.setWindowLayoutFullScreen(false)
}
this.fullScreen();
aboutToAppear(): void {
this.getData();
this.showAlert()
}
... ... @@ -100,13 +99,6 @@ export struct QualityCommentsComponent {
})
}
fullScreen() {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
windowClass.setWindowLayoutFullScreen(true)
}
@Builder
titleHeader() {
Row() {
... ... @@ -249,7 +241,7 @@ export struct QualityCommentsComponent {
}
// ListItem() {
//
// }.height(this.bottomSafeHeight)
// }.height(`${this.bottomSafeHeight}` + 'px')
}.onReachEnd(()=>{
this.currentPage++
this.getData()
... ...
... ... @@ -208,7 +208,7 @@ struct CarouselLayout01CardView {
Text(`${this.item.corner}${this.item.newsTitle}`)
.width(CommonConstants.FULL_PARENT)
.fontColor(Color.White)
.fontSize($r('app.float.font_size_16'))
.fontSize($r('app.float.font_size_18'))
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Start)
.align(Alignment.Bottom)
... ...
... ... @@ -55,7 +55,7 @@ export struct ZhGridLayout02 {
.width(CommonConstants.FULL_WIDTH)
GridRow({
gutter: { x: 12, y: 15 },
gutter: { x: 12, y: 13 },
columns: { sm: listSize, md: 2 },
breakpoints: { value: ['320vp', '520vp', '840vp'] }
}) {
... ... @@ -120,7 +120,7 @@ export struct ZhGridLayout02 {
}
Text(item.newsTitle)
.margin({ top: '5' })
.margin({top:'6'})
.fontSize(13)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ...
... ... @@ -59,12 +59,16 @@ export struct ZhGridLayout03 {
.backgroundColor(0xf5f5f5)
.width(44)
.aspectRatio(1 / 1)
.margin({
bottom: 16
})
// .margin({
// bottom: 16
// })
Text(item.newsTitle)
.fontSize(13)
.maxLines(1)
.margin({
top: 8,
bottom:11
})
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.width('100%')
... ...
... ... @@ -57,7 +57,7 @@ export struct ZhSingleColumn04 {
.width(12)
.margin({ left: 12, right: 8 })
Text(item.newsTitle)
.fontSizeColorWeight($r('app.float.font_size_17'), $r('app.color.color_222222'), 400)
.fontSizeColorWeight($r('app.float.font_size_18'), $r('app.color.color_222222'), 400)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.layoutWeight(1)
... ...
... ... @@ -40,7 +40,6 @@ export struct ZhSingleRow03 {
// 请求所有预约状态
async getReserveState() {
this.reservedIds = []
const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => {
const reqItem: reserveReqItem = {
liveId: item.objectId.toString(),
... ... @@ -49,6 +48,7 @@ export struct ZhSingleRow03 {
return reqItem;
})
const res = await LiveModel.getAppointmentStatus(reserveBean);
this.reservedIds = []
// this.reserveStatus = res;
Logger.debug(TAG, '数据信息:' + `${JSON.stringify(res)}`)
res.map((item: ReserveItemBean) => {
... ... @@ -280,6 +280,8 @@ struct CreatorItem {
.backgroundColor(0xf5f5f5)
.width(156)
.height(208)
.border({width: 1})
.borderRadius(3)
Row()
.width(156)
.height(80)
... ...
... ... @@ -101,7 +101,7 @@ struct localCard {
Text(this.operDataListItem.newsTitle)
.width(CommonConstants.FULL_PARENT)
.height(CommonConstants.FULL_PARENT)
.fontSize($r('app.float.font_size_16'))
.fontSize($r('app.float.font_size_18'))
.fontColor('#000000')
.align(Alignment.TopStart)
.maxLines(3)
... ...
... ... @@ -168,7 +168,7 @@ export struct ZhSingleRow06 {
? item.operDataList[0]?.commentInfo?.userHeaderUrl
? item.operDataList[0].commentInfo.userHeaderUrl
: $r('app.media.default_head')
: '')
: $r('app.media.comment_rmh_tag'))
.width(32)
.height(32)
.borderRadius(16)
... ...
... ... @@ -7,6 +7,7 @@ import { EmptyComponent } from '../../view/EmptyComponent';
import { ChildCommentComponent } from './ChildCommentComponent';
import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
const TAG = "HomePageBottomCommentComponent"
... ... @@ -22,6 +23,7 @@ export struct HomePageBottomCommentComponent {
@State count: number = 0;
@Link commentNum: number
@State isGetRequest: boolean = false
private scroller: Scroller = new Scroller();
aboutToAppear() {
this.getNewPageData()
... ... @@ -42,7 +44,40 @@ export struct HomePageBottomCommentComponent {
.offset({ y: "-200lpx" })
}
} else {
List({ space: 3 }) {
CustomPullToRefresh({
alldata:this.data_comment,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_comment.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
@Builder ListLayout(){
List({ space: 3,scroller: this.scroller }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({
... ... @@ -68,18 +103,6 @@ export struct HomePageBottomCommentComponent {
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
getNewPageData() {
... ...
... ... @@ -7,6 +7,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from '../follow/FollowChildComponent';
import dataPreferences from '@ohos.data.preferences';
import { EmptyComponent } from '../../view/EmptyComponent';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
const TAG = "HomePageBottomFollowComponent"
/**
... ... @@ -14,6 +15,7 @@ const TAG = "HomePageBottomFollowComponent"
*/
@Component
export struct HomePageBottomFollowComponent {
private scroller: Scroller = new Scroller();
@State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource();
@State isLoading: boolean = false
@State hasMore: boolean = true
... ... @@ -104,8 +106,40 @@ export struct HomePageBottomFollowComponent {
})
}.layoutWeight(1)
} else {
List({ space: 3 }) {
CustomPullToRefresh({
alldata:this.data_follow,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_follow.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
@Builder ListLayout(){
List({ space: 3 ,scroller:this.scroller}) {
ListItem() {
Row() {
Text("关注更多人民号")
... ... @@ -136,7 +170,6 @@ export struct HomePageBottomFollowComponent {
FollowChildComponent({ data: item, type: 2 })
}
}, (item: FollowListDetailItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
... ... @@ -153,18 +186,6 @@ export struct HomePageBottomFollowComponent {
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
@Styles
... ...
... ... @@ -7,6 +7,7 @@ import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDet
import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { ChildCommentComponent } from './ChildCommentComponent';
import { EmptyComponent } from '../../view/EmptyComponent';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
const TAG = "HomePageBottomComponent"
/**
... ... @@ -23,6 +24,8 @@ export struct OtherHomePageBottomCommentComponent {
@Prop levelHead: string
@Link commentNum: number
@State isGetRequest: boolean = false
private scroller: Scroller = new Scroller();
aboutToAppear() {
this.getNewPageData()
... ... @@ -41,7 +44,41 @@ export struct OtherHomePageBottomCommentComponent {
.layoutWeight(1)
}
} else {
List({ space: 3 }) {
CustomPullToRefresh({
alldata:this.data_comment,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_comment.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
})
}
}
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}
@Builder ListLayout(){
List({ space: 3 ,scroller: this.scroller}) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({
... ... @@ -50,8 +87,6 @@ export struct OtherHomePageBottomCommentComponent {
isLastItem: index === this.data_comment.totalCount() - 1
})
}
.onClick(() => {
})
}, (item: CommentListItem, index: number) => index.toString())
//没有更多数据 显示提示
... ... @@ -69,19 +104,6 @@ export struct OtherHomePageBottomCommentComponent {
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}
@Styles
... ...
... ... @@ -4,6 +4,7 @@ import { WDRouterRule, WDRouterPage } from 'wdRouter';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { EmptyComponent } from '../../view/EmptyComponent';
import { FollowChildComponent } from '../follow/FollowChildComponent';
... ... @@ -22,7 +23,7 @@ export struct OtherHomePageBottomFollowComponent{
@State count:number = 0;
@Prop curUserId: string
@State isGetRequest:boolean = false
private scroller: Scroller = new Scroller();
aboutToAppear(){
this.getNewPageData()
... ... @@ -66,8 +67,39 @@ export struct OtherHomePageBottomFollowComponent{
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}else{
List({ space: 3 }) {
CustomPullToRefresh({
alldata:this.data_follow,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_follow.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
})
}
}
.width('100%')
}
@Builder ListLayout(){
List({ space: 3 ,scroller:this.scroller}) {
ListItem() {
Row(){
Text("关注更多人民号")
... ... @@ -115,19 +147,7 @@ export struct OtherHomePageBottomFollowComponent{
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}
.width('100%')
}
@Styles
listStyle() {
... ...
... ... @@ -27,7 +27,7 @@ struct EditUserInfoPage {
}
}),
alignment: DialogAlignment.Bottom,
offset:{dx:0,dy:-20}
offset:{dx:0,dy:0},
})
aboutToAppear() {
... ... @@ -97,14 +97,14 @@ struct EditUserInfoPage {
Row(){
Text(r.title)
.fontSize(15)
.fontColor(Color.Gray)
.fontColor('#666666')
Blank()
Text(r.subTitle)
.textOverflow({overflow:TextOverflow.Ellipsis})
.maxLines(1)
.fontSize(14)
.fontColor(Color.Gray)
.fontColor(r.subTitle === '待完善'?'#cccccc':'#666666')
.padding({right:10})
.width('70%')
.textAlign(TextAlign.End)
... ...
... ... @@ -45,7 +45,7 @@ struct EditUserIntroductionPage {
Divider()
.margin(20)
Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多60个字,只能输入中文、数字、英文字母。')
Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多60个字,只能输入中文、数字、英文字母。')
.fontSize(13)
.padding(12)
.fontColor(Color.Gray).lineHeight(25)
... ... @@ -54,6 +54,8 @@ struct EditUserIntroductionPage {
.type(ButtonType.Normal)
.width('90%')
.backgroundColor('#ED2800')
.opacity(this.numCount === 0 ? 0.6 : 1)
.fontColor(this.numCount === 0 ? '#999999' : Color.White)
.borderRadius(5)
.margin(30)
.onClick(()=>{
... ...
... ... @@ -47,7 +47,7 @@ struct EditUserNikeNamePage {
Divider()
.margin(20)
Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。')
Text('1、账号中(头像、昵称等)不允许含有违禁违规内容;\n2、最多16个字,只能输入中文、数字、英文字母。')
.fontSize(13)
.padding(12)
.fontColor(Color.Gray).lineHeight(25)
... ... @@ -56,6 +56,8 @@ struct EditUserNikeNamePage {
.type(ButtonType.Normal)
.width('90%')
.backgroundColor('#ED2800')
.opacity(this.numCount === 0 ? 0.6 : 1)
.fontColor(this.numCount === 0 ? '#999999' : Color.White)
.borderRadius(5)
.margin(30)
.onClick(()=>{
... ...
... ... @@ -8,6 +8,7 @@ import { CustomTitleUI } from '../reusable/CustomTitleUI';
import { InteractMComponent } from '../InteractMessage/InteractMComponent';
import { InteractMessageModel, WDMessageCenterMessageType } from '../../model/InteractMessageModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { NetworkUtil } from 'wdKit/Index';
@Entry
@Component
... ... @@ -28,24 +29,28 @@ struct InteractMessagePage {
build() {
Column(){
CustomTitleUI({titleName:'互动消息'})
if(this.browSingModel.viewType == ViewType.ERROR){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed})
}else if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory})
if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:this.browSingModel.emptyType})
}else {
CustomPullToRefresh({
alldata:this.allDatas,
scroller:this.scroller,
hasMore:this.browSingModel.hasMore,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.browSingModel.currentPage = 0
this.currentPage = 1
this.getData(resolve)
},
onLoadMore:(resolve)=> {
this.browSingModel.currentPage++
this.getData()
if (this.browSingModel.hasMore === false) {
if(resolve) resolve('')
return
}
this.currentPage++
this.getData(resolve)
}
})
}
... ... @@ -75,6 +80,7 @@ struct InteractMessagePage {
}
}
}
.scrollBar(BarState.Off)
.height(CommonConstants.FULL_PARENT)
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
}
... ... @@ -108,6 +114,9 @@ struct InteractMessagePage {
}
async getData(resolve?: (value: string | PromiseLike<string>) => void){
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
InteractMessageViewModel.fetchMessageList(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact,this.currentPage).then(InteractMessageMItem => {
if(resolve) resolve('刷新成功')
if (InteractMessageMItem && InteractMessageMItem.list && InteractMessageMItem.list.length > 0) {
... ... @@ -120,19 +129,25 @@ struct InteractMessagePage {
for (let index = 0; index < InteractMessageMItem.list.length; index++) {
const element = InteractMessageMItem.list[index];
element.InteractMsubM = JSON.parse(element.remark)
this.allDatas.push(element)
}
this.allDatas.push(...InteractMessageMItem.list)
if (InteractMessageMItem.list.length === this.browSingModel.pageSize) {
this.browSingModel.currentPage++;
this.browSingModel.hasMore = true;
} else {
if (InteractMessageMItem.hasNext === 0) {
this.browSingModel.hasMore = false;
} else {
this.browSingModel.hasMore = true;
}
} else {
if (this.currentPage === 1) {
this.browSingModel.viewType = ViewType.EMPTY;
this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoMessage;
}
}
})
}else {
this.browSingModel.viewType = ViewType.EMPTY;
this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork;
}
}
async getMessageLikeCount(){
... ...
... ... @@ -11,6 +11,8 @@ import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
import { BigPicCardComponent } from '../view/BigPicCardComponent';
import { contentListItemParams } from '../../model/MyCollectionModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { MyCustomDialog } from '../reusable/MyCustomDialog'
import { NetworkUtil } from 'wdKit/Index';
@Entry
@Component
... ... @@ -25,6 +27,20 @@ struct MyCollectionListPage {
@State currentPage: number = 1;
private scroller: Scroller = new Scroller();
emptyType: WDViewDefaultType = WDViewDefaultType.WDViewDefaultType_Default
dialogController: CustomDialogController = new CustomDialogController({
builder: MyCustomDialog({
confirm: () => {
this.deleteDatas()
},
titleShow:false,
tipValue: this.isAllSelect?'是否确认清空?':'确认删除'+this.deleteNum.toString()+'条收藏'
}),
autoCancel: true,
alignment: DialogAlignment.Center,
customStyle: true
})
aboutToAppear(){
this.getData()
... ... @@ -32,17 +48,15 @@ struct MyCollectionListPage {
build() {
Column(){
CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:true,editCallback:()=>{
CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:this.browSingModel.viewType == ViewType.ERROR || this.browSingModel.viewType == ViewType.EMPTY?false:true,editCallback:()=>{
this.allSelectDatas(false)
this.isAllSelect = false
this.selectDatas = []
this.deleteNum = 0
}})
if(this.browSingModel.viewType == ViewType.ERROR){
ErrorComponent()
}else if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoCollection})
if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:this.browSingModel.emptyType})
}else {
CustomPullToRefresh({
alldata:this.allDatas,
... ... @@ -73,7 +87,7 @@ struct MyCollectionListPage {
this.allSelectDatas(isAllSelect)
},
confirmCallback:()=>{
this.deleteDatas()
this.dialogController.open()
}
})
}
... ... @@ -100,6 +114,7 @@ struct MyCollectionListPage {
if (this.browSingModel.hasMore === false) NoMoreLayout()
}
}
.scrollBar(BarState.Off)
.height(CommonConstants.FULL_PARENT)
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
}
... ... @@ -122,7 +137,10 @@ struct MyCollectionListPage {
}
}
async getData(resolve?: (value: string | PromiseLike<string>) => void) {
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => {
if(resolve) resolve('刷新成功')
if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
... ... @@ -144,9 +162,14 @@ struct MyCollectionListPage {
} else {
if (this.currentPage === 1) {
this.browSingModel.viewType = ViewType.EMPTY;
this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoCollection
}
}
})
} else {
this.browSingModel.viewType = ViewType.EMPTY;
this.browSingModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoNetwork;
}
}
//数据处理
... ...
... ... @@ -15,7 +15,8 @@ import { NoMoreBean } from './NoMoreBean';
import { RefreshLayoutBean } from '../refresh/RefreshLayoutBean';
import RefreshLayout from '../refresh/RefreshLayout';
import json from '@ohos.util.json';
import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG = 'PageComponent';
@Component
... ... @@ -31,7 +32,6 @@ export struct PageComponent {
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
private listScroller: Scroller = new Scroller();
needload: boolean = true;
build() {
Column() {
if (this.pageModel.viewType == ViewType.LOADING) {
... ... @@ -257,7 +257,6 @@ export struct PageComponent {
this.pageModel.pageTotalCompSize = 0;
PageHelper.getInitData(this.pageModel, this.pageAdvModel)
}, 100)
}
}
... ...
import { insightIntent } from '@kit.IntentsKit';
import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean';
import { SpConstants } from 'wdConstant';
import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
... ... @@ -9,8 +8,6 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent
import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent';
import { channelSkeleton } from '../skeleton/channelSkeleton';
import { common } from '@kit.AbilityKit';
const TAG = 'TopNavigationComponent';
... ... @@ -61,8 +58,6 @@ export struct TopNavigationComponent {
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
// 传递给page的自动刷新通知
@State autoRefresh2Page: number = 0
//保存当前导航选中时的时间戳 意图开始时间
@State executedStartTime: number = new Date().getTime()
// 当前底导index
@State navIndex: number = 0
@State animationDuration: number = 0
... ... @@ -190,48 +185,6 @@ export struct TopNavigationComponent {
return item.channelType === 3
}
//意图共享
topNavInsightIntentShare(item: TopNavDTO){
let tapNavIntent: insightIntent.InsightIntent = {
intentName: 'ViewBlog',
intentVersion: '1.0.1',
identifier: '52dac3b0-6520-4974-81e5-25f0879449b5',
intentActionInfo: {
actionMode: 'EXPECTED',
currentPercentage: 50,
executedTimeSlots: {
executedEndTime: new Date().getTime(),
executedStartTime: this.executedStartTime
}
},
intentEntityInfo: {
entityName: 'Blog',
entityId: String(item.pageId) || '',
displayName: item.name,
logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png',
rankingHint: 99,
isPublicData: true
}
}
console.log('yzl',JSON.stringify(tapNavIntent))
try {
let context = getContext(this) as common.UIAbilityContext;
// 共享数据
insightIntent.shareIntent(context, [tapNavIntent], (error) => {
if (error?.code) {
// 处理业务逻辑错误
console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`);
return;
}
// 执行正常业务
console.log('shareIntent succeed');
});
} catch (error) {
// 处理异常
console.error(`error.code: ${error?.code}, error.message: ${error?.message}`);
}
}
build() {
Column() {
... ...
import router from '@ohos.router'
import { StringUtils, ToastUtils } from 'wdKit'
import { NetworkUtil, StringUtils, ToastUtils } from 'wdKit'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { SearchHistoryItem } from '../../viewmodel/SearchHistoryItem'
import { SearchRelatedItem } from '../../viewmodel/SearchRelatedItem'
import { EmptyComponent } from '../view/EmptyComponent'
import { SearchHistoryComponent } from './SearchHistoryComponent'
import { SearchHotsComponent } from './SearchHotsComponent'
import { SearchRelatedComponent } from './SearchRelatedComponent'
... ... @@ -30,6 +31,7 @@ export struct SearchComponent {
scroller: Scroller = new Scroller()
@State count:string[] = []
@State isGetRequest:boolean = false;
@State isConnectNetwork : boolean = NetworkUtil.isNetConnected()
aboutToAppear() {
//获取提示滚动
... ... @@ -127,8 +129,16 @@ export struct SearchComponent {
.padding({ left: '31lpx', right: '31lpx' })
} else {
if (this.hasChooseSearch) {
if(!this.isConnectNetwork){
EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => {
this.getSearchInputResData(this.searchText)
}})
.layoutWeight(1)
.width('100%')
}else{
//搜索结果
SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest})
}
} else {
//联想搜索
SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText})
... ... @@ -138,7 +148,6 @@ export struct SearchComponent {
.width('100%')
}
/**
* 点击搜索记录列表回调
* @param content
... ... @@ -330,10 +339,12 @@ export struct SearchComponent {
}
this.isGetRequest = true
this.resetSearch()
this.isConnectNetwork = NetworkUtil.isNetConnected()
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isGetRequest = true
this.resetSearch()
this.isConnectNetwork = NetworkUtil.isNetConnected()
})
}
... ...
... ... @@ -15,6 +15,7 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import MinePageDatasModel from '../../model/MinePageDatasModel'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem'
import { CreatorDetailResponseItem } from '../../viewmodel/CreatorDetailResponseItem';
import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'
import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem'
import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem'
... ... @@ -63,6 +64,7 @@ export struct SearchResultContentComponent {
if (this.hasMore) {
SearcherAboutDataModel.getSearchResultListData("15", `${this.curPageNum}`, this.searchType, this.keywords,
getContext(this)).then((value) => {
if (!this.data || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
... ... @@ -70,7 +72,6 @@ export struct SearchResultContentComponent {
} else {
if (value.list[0].dataList != null) {
let data_temp: SearchRmhDescription[] = []
data_temp = value.list[0].dataList
//TODO 查询创作者详情接口
... ... @@ -121,7 +122,6 @@ export struct SearchResultContentComponent {
data_temp.forEach((data) => {
this.data_rmh.push(data)
})
//只有一条创作者,获取 创作者信息
if (this.data_rmh.length === 1) {
if(StringUtils.isNotEmpty(UserDataLocal.getUserId())){
... ... @@ -178,21 +178,34 @@ export struct SearchResultContentComponent {
}
})
})
// 批量号主信息
let creatorIdList: string[] = []
resultData.list.forEach((value:SearchResultContentItem) => {
creatorIdList.push(value.data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList}).then((rem) => {
resultData.list.forEach((value) => {
let photos: FullColumnImgUrlDTO[] = []
if (value.data.appStyle === 4) {
// if (value.data.appStyle === 4) {
value.data.appStyleImages.split("&&").forEach((value) => {
photos.push({ url: value } as FullColumnImgUrlDTO)
const resizeParams = this.extractResizeParams(value)
photos.push({ fullUrl: value,weight:resizeParams.width,height:resizeParams.height, } as FullColumnImgUrlDTO)
})
}
let contentDTO = this.dataTransform(value, photos);
// }
let contentDTO = this.dataTransform(rem,value, photos);
if(value.data.type != "13"){
this.data.push(contentDTO)
}
})
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < resultData.totalCount) {
... ... @@ -380,7 +393,10 @@ export struct SearchResultContentComponent {
.strokeWidth('12lpx')
}
private dataTransform(value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO {
private dataTransform(rem:CreatorDetailResponseItem[],value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO {
let rmhInfo = this.getRmhInfo(rem,value)
console.log('获取photos',JSON.stringify(photos))
console.log('获取value2',JSON.stringify(value))
let contentDTO = new ContentDTO();
contentDTO.appStyle = value.data.appStyle + ""
contentDTO.cityCode = value.data.cityCode
... ... @@ -456,8 +472,92 @@ export struct SearchResultContentComponent {
contentDTO.openType = '';
contentDTO.extra = '';
contentDTO.titleShow = value.data.type == "5" ? 1 : 0;
contentDTO.contentText = value.data.contentText;
contentDTO.rmhInfo = rmhInfo
contentDTO.shareFlag = value.data.shareFlag
return contentDTO;
}
// 搜索数据转化rmhInfo
private getRmhInfo(rem:CreatorDetailResponseItem[],value:SearchResultContentItem){
let obj = value.data
let rmhInfo:RmhInfoDTO = {
rmhHeadUrl:obj.headerPhotoUrl,
rmhName:obj.creatorName,
rmhId:obj.creatorId,
authIcon:obj.authIcon,
authTitle: obj.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention: 0,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:0,
posterShareControl: 0,
rmhDesc: obj.introduction,
userId: obj.userId,
userType: obj.userType,
honoraryIcon:''
}
if(rem.length>0){
rem.forEach(item=>{
if(item.creatorId === obj.creatorId){
rmhInfo = {
rmhHeadUrl:item.headPhotoUrl,
rmhName:item.userName,
rmhId:item.creatorId,
authIcon:item.authIcon,
authTitle: item.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention:item.isAttention,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:0,
posterShareControl: 0,
rmhDesc: item.introduction,
userId: item.userId,
userType: item.userType,
honoraryIcon:''
}
}
})
}
return rmhInfo
}
private extractResizeParams(url: string) {
const heightRegex = /h_(\d+)/; // 匹配高度参数,如h_450
const widthRegex = /w_(\d+)/; // 匹配宽度参数,如w_800
const heightMatch = url.match(heightRegex);
const widthMatch = url.match(widthRegex);
let height = heightMatch ? `h_${heightMatch[1]}` : undefined
let width = widthMatch ? `w_${widthMatch[1]}` : undefined
let h:number =0
let w:number =0
if(height){
h = Number(height.split('_')[1])
}
if(width){
w = Number(width.split('_')[1])
}
interface Obj{
width:number;
height:number
}
let obj:Obj = {
width:w,
height:h
}
return obj
}
}
\ No newline at end of file
... ...
... ... @@ -19,7 +19,7 @@ export struct BigPicCardComponent {
aboutToAppear() {
// 取第一个数据
if (this.compDTO.operDataList) {
if (this.compDTO.operDataList.length > 0) {
this.contentDTO = this.compDTO.operDataList[0];
this.contentDTO.appStyle = "2";
}
... ...
import { Logger, NumberFormatterUtils } from 'wdKit/Index'
import { DisplayUtils,Logger, NumberFormatterUtils } from 'wdKit/Index'
import { LikeViewModel } from '../../viewmodel/LikeViewModel'
import { SPHelper } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { SpConstants } from 'wdConstant/Index';
import { ContentDetailDTO } from 'wdBean/Index';
import measure from '@ohos.measure'
const TAG = 'LikeComponent';
... ... @@ -168,30 +168,74 @@ export struct LikeComponent {
likeCompStyle5() {
//1: 底部栏目样式 默认样式
Stack({ alignContent: Alignment.Bottom }) {
Column() {
// Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
Image(this.transLikeStyle().url)
.width(24)
.height(24)
.onClick(() => {
this.clickButtonEvent()
})
if (this.likeCount > 0){
RelativeContainer() {
Image(this.likeStatus ? $r('app.media.ic_like_back_Select') : $r('app.media.ic_like_back'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
top: 1,
left: 20,
right: 1,
bottom: 1
}
})
.alignRules({
top: { anchor: "Text", align: VerticalAlign.Top },
left: { anchor: "Text", align: HorizontalAlign.Start },
right: { anchor: "Text", align: HorizontalAlign.End },
bottom: { anchor: "Text", align: VerticalAlign.Bottom },
})
.id("Image")
Row() {
Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))
Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))// Text("44444444")
.fontSize(8)
.fontColor(Color.White)
.padding({ left: 4, right: 2 })
}
.fontColor('#ffffff')// .backgroundColor('#ED2800')
.height(12)
.alignItems(VerticalAlign.Center)
.position({ x: '100%', })
.markAnchor({ x: '100%' })
.backgroundImage(this.likeStatus ? $r('app.media.ic_like_back_Select') : $r('app.media.ic_like_back'))
.backgroundImageSize(ImageSize.Auto)
.textAlign(TextAlign.Center)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})/*动态计算文字宽度*/
.width(this.getMeasureText(NumberFormatterUtils.formatNumberWithWan(this.likeCount || '')) +
12)// .backgroundColor(Color.Green)
.id("Text")
.visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden)
}.width(24).height(24)
}
.offset({
x: 12
})
}
// Column() {
// // Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
// Image(this.transLikeStyle().url)
// .width(24)
// .height(24)
// .onClick(() => {
// this.clickButtonEvent()
// })
// }
//
// Row() {
// Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))
// .fontSize(8)
// .fontColor(Color.White)
// .padding({ left: 4, right: 2 })
// }
// .height(12)
// .alignItems(VerticalAlign.Center)
// .position({ x: '100%', })
// .markAnchor({ x: '100%' })
// .backgroundImage(this.likeStatus ? $r('app.media.ic_like_back_Select') : $r('app.media.ic_like_back'))
// .backgroundImageSize(ImageSize.Auto)
// .visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden)
}.width(24).height(24).onClick(() => {
this.clickButtonEvent()
})
}
@Builder
... ... @@ -210,8 +254,6 @@ export struct LikeComponent {
.height(36)
.borderRadius(18)
.backgroundColor((this.pageComponentType === 4 || this.pageComponentType === 2) ? '#4D000000' : '#FFF5F5F5')
Row() {
Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))
.fontSize(8)
... ... @@ -306,4 +348,14 @@ export struct LikeComponent {
this.likeCount = 0
})
}
private getMeasureText(text: string) {
let width = measure.measureText({
textContent: text,
fontSize: 8,
lineHeight: 12,
constraintWidth: DisplayUtils.getDeviceWidth(),
})
width = px2vp(width)
return width
}
}
\ No newline at end of file
... ...
... ... @@ -132,6 +132,12 @@ export struct OperRowListView {
build() {
// 视频详情页
Column() {
Image($r('app.media.ic_news_detail_division'))
.width('100%')
.height($r('app.float.margin_1'))
.margin({bottom: -2})
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
// AudioDialog()
Row() {
... ... @@ -150,7 +156,7 @@ export struct OperRowListView {
}
router.back();
})
.width(42)
.width(48)
if (this.contentDetailData?.newsId) {
ForEach(this.operationButtonList, (item: string, index: number) => {
... ... @@ -180,6 +186,7 @@ export struct OperRowListView {
bottom: `${this.bottomSafeHeight}px`
// bottom: 50
})
}
}
... ... @@ -200,7 +207,7 @@ export struct OperRowListView {
}
.layoutWeight(1)
.margin({
right: this.pageComponentType === 1 ? 16 : 0,
right: this.pageComponentType === 1 ? 22 : 0,
})
if (this.showCommentIcon) {
... ... @@ -212,7 +219,7 @@ export struct OperRowListView {
})
}
}
.width(46)
.width(48)
}
}
... ... @@ -233,7 +240,7 @@ export struct OperRowListView {
})
// }
}
.width(42)
.width(48)
.visibility(this.likesStyle !== 4 ? Visibility.Visible : Visibility.None)
}
... ... @@ -261,7 +268,7 @@ export struct OperRowListView {
})*/
}
.height(36)
.width(36)
.width(48)
.borderRadius(18)
.backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent)
.onClick(() => {
... ... @@ -289,7 +296,7 @@ export struct OperRowListView {
})
}
.height(36)
.width(36)
.width(48)
.justifyContent(FlexAlign.Center)
}
... ... @@ -312,7 +319,7 @@ export struct OperRowListView {
}
.justifyContent(FlexAlign.Center)
.height(36)
.width(36)
.width(48)
.borderRadius(18)
.backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent)
}
... ...
... ... @@ -9,7 +9,7 @@ export struct AreaPickerDialog {
@Provide currentSecondBean: AreaListManageModel = new AreaListManageModel('','','',[])
@Provide currentThirdBean: AreaListManageModel = new AreaListManageModel('','','',[])
controller: CustomDialogController
title: string = '地区选择'
title: string = '修改地区'
@Provide dataSource: AreaListModel[] = []
result: JSON[] = [];
confirmCallback: (province:string,city:string,county:string,address:string) => void = () => {
... ... @@ -33,7 +33,7 @@ export struct AreaPickerDialog {
Blank()
Button('确定',{type:ButtonType.Normal})
Button('提交',{type:ButtonType.Normal})
.onClick(()=> {
this.controller.close()
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 {
this.currentFirst = EditInfoViewModel.getAreaListManageModel(this.dataSource[index as number])
})
.backgroundColor(Color.White)
.border({color:'#e2e2e2',width:{right:0.5}})
// .border({color:'#e2e2e2',width:{right:0.5}})
.width('100%')
.layoutWeight(1)
.selectedTextStyle({color:'#666666'})
.textStyle({color:'#999999'})
}
}
.justifyContent(FlexAlign.Center)
... ...
... ... @@ -21,9 +21,11 @@ export struct SecondLevelComponent {
this.currentSecondBean = EditInfoViewModel.getAreaListManageModel(this.currentFirst.children[index as number])
})
.backgroundColor(Color.White)
.border({color:'#e2e2e2',width:{right:0.5}})
// .border({color:'#e2e2e2',width:{right:0.5}})
.width('100%')
.layoutWeight(1)
.selectedTextStyle({color:'#666666'})
.textStyle({color:'#999999'})
}
}
.justifyContent(FlexAlign.Center)
... ...
... ... @@ -22,9 +22,11 @@ export struct ThirdLevelComponent {
this.currentThirdBean = EditInfoViewModel.getAreaListManageModel(this.currentSecondBean.children[index as number])
})
.backgroundColor(Color.White)
.border({color:'#e2e2e2',width:{right:0.5}})
// .border({color:'#e2e2e2',width:{right:0.5}})
.width('100%')
.layoutWeight(1)
.selectedTextStyle({color:'#666666'})
.textStyle({color:'#999999'})
}
}
.justifyContent(FlexAlign.Center)
... ...
import { common } from '@kit.AbilityKit';
import { insightIntent } from '@kit.IntentsKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { CompDTO, CompList, ContentDTO, PageInfoBean } from 'wdBean';
function generateUUID() {
let dt = new Date().getTime(); // 获取当前时间的时间戳(毫秒)
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
let r = (dt + Math.random() * 16) % 16 | 0;
dt = Math.floor(dt / 16);
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
return uuid;
}
export const enum ActionMode {
// 将来时
EXPECTED = 'EXPECTED',
// 完成时
EXECUTED = 'EXECUTED',
}
//ViewBlog意图共享-频道列表
export function viewBlogInsightIntentShare(context: common.UIAbilityContext, entityGroupId: string,
compList: CompDTO[] | CompList[], actionMode: ActionMode) {
console.log('viewBlogInsightIntentShare', actionMode)
let insightIntentArray: insightIntent.InsightIntent [] = []
let identifier = generateUUID()
if (compList?.length > 0) {
compList?.forEach((item: CompDTO | CompList) => {
item.operDataList.forEach((_item: ContentDTO) => {
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewBlog',
intentVersion: '1.0.1',
identifier,
intentActionInfo: {
actionMode,
currentPercentage: 50,
//目前不考虑发生时段
// executedTimeSlots: {
// executedEndTime: new Date().getTime(),
// executedStartTime: pageModel.executedStartTime
// }
},
intentEntityInfo: {
entityName: 'Blog',
entityId: _item?.objectId,
displayName: _item?.newsTitle,
entityGroupId, //channelId
logoURL: _item?.coverUrl,
metadataModificationTime: _item?.publishTimestamp,
blogTitle: _item?.newsTitle,
blogType: 'Normal',
blogCategory: item.name,
categoryDisplayName: item.name,
blogSubTitle: _item?.newsSummary.length > 20 ?
_item?.newsSummary.substring(0, 20) : _item?.newsSummary,
blogAuthor: _item?.source,
blogPublishTime: _item?.publishTimestamp,
tag: _item?.newTags.split(','),
likeCount: _item?.interactData?.likeNum || 0,
forwardCount: _item?.interactData?.shareNum || 0,
commentCount: _item?.interactData?.commentNum || 0,
favorites: _item?.interactData?.collectNum || 0,
viewCount: _item?.interactData?.readNum || 0,
rankingHint: 99,
isPublicData: true
}
}
insightIntentArray.push(viewBlogInsightIntentItem)
})
})
console.log('yzl', JSON.stringify(insightIntentArray[0]))
// 共享数据
insightIntent.shareIntent(context, insightIntentArray).then(() => {
console.log('yzl shareIntent success');
}).catch((err: BusinessError) => {
console.error(`yzl failed because ${err?.message}`);
});
}
}
//ViewBlog意图共享-早晚报
export function viewColumInsightIntentShare(context: common.UIAbilityContext, entityId: string,
pageInfoBean: PageInfoBean) {
console.log('viewColumInsightIntentShare')
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewColumn',
intentVersion: '1.0.1',
identifier: generateUUID(),
intentActionInfo: {
actionMode: ActionMode.EXECUTED,
currentPercentage: 50,
},
intentEntityInfo: {
entityName: 'Column',
entityId,
displayName: pageInfoBean?.topicInfo?.title,
description: pageInfoBean?.shareSummary,
logoURL: pageInfoBean?.shareCoverUrl,
activityType: ['RecentViews'],
columnTitle: pageInfoBean?.topicInfo?.title,
columnSubTitle: pageInfoBean?.shareSummary,
rankingHint: 99,
isPublicData: true
}
}
console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewBlogInsightIntentItem))
// 共享数据
insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => {
console.log('yzl shareIntent success');
}).catch((err: BusinessError) => {
console.error(`yzl failed because ${err?.message}`);
});
}
... ...
... ... @@ -52,11 +52,11 @@ class EditInfoViewModel {
if (editDTO.code == 0) {
success(editDTO.data)
}else {
success(this.GetqueryAccountOwnerLocal(context))
// success(this.GetqueryAccountOwnerLocal(context))
}
}).catch((error: Error) => {
Logger.info(TAG,'queryAccountOwnerInfo','EditInfoViewModel')
success(this.GetqueryAccountOwnerLocal(context))
// success(this.GetqueryAccountOwnerLocal(context))
})
}))
}
... ... @@ -125,7 +125,7 @@ class EditInfoViewModel {
this.BasePostRequest(item.editDataType == WDEditDataModelType.WDEditDataModelType_nickname?HttpUrlUtils.APPOINTMENT_editUserDetail1_PATH:HttpUrlUtils.APPOINTMENT_editUserDetail_PATH,this.params)
.then((navResDTO: ResponseDTO) => {
if (navResDTO.code == 0) {
promptAction.showToast({ message: '修改成功' })
promptAction.showToast({ message: '您的资料已提交' })
success(navResDTO)
}else {
promptAction.showToast({ message: navResDTO.message })
... ...
import { CompDTO, ContentDTO, InteractDataDTO, PageDTO, PageInfoDTO } from 'wdBean';
import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, PageDTO, PageInfoDTO } from 'wdBean';
import { CompStyle, ViewType } from 'wdConstant/Index';
import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils } from 'wdKit';
import { closeRefresh } from '../utils/PullDownRefresh';
... ... @@ -11,6 +11,8 @@ import { ArrayList } from '@kit.ArkTS';
import { WDViewDefaultType } from '../components/view/EmptyComponent';
import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean';
import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO';
import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG = 'PageHelper';
... ... @@ -74,7 +76,7 @@ export class PageHelper {
return;
}
pageModel.pageInfo = pageInfo;
//解析广告资源
//解析页面挂角广告资源
pageAdvModel.analysisAdvSource(pageInfo);
this.parseGroup(pageModel)
}).catch(() => {
... ... @@ -85,10 +87,17 @@ export class PageHelper {
}
/**
* 解析信息流页面楼层数据
* @param pageModel
*/
async parseGroup(pageModel: PageModel) {
let pageInfo: PageInfoDTO = pageModel.pageInfo
pageModel.groupList = []
pageInfo.pageAdList = []
pageInfo.oneRequestPageGroupCompList = new ArrayList()
pageModel.groupList.push(...pageInfo.groups)
Logger.error("ZZZXXXXX", 'parseGroup----1-----');
for (const group of pageInfo.groups) {
pageModel.isRecGroup = group.groupStrategy === 1;
pageModel.groupId = group.id;
... ... @@ -98,17 +107,40 @@ export class PageHelper {
pageModel.pageSize = 20
}
pageModel.groupData = group
Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId);
// await,确保groups接口顺序执行
let pageDto = await PageViewModel.getPageData(pageModel.bizCopy()) as PageDTO
let pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO
let index = pageInfo.groups.indexOf(group)
if (index == 0) {
// 清空comp列表
pageModel.compList.clearAllData()
pageModel.compList.clear()
}
this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1)
Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length);
}
this.getGroupData(pageModel, pageDto, index == pageInfo.groups.length - 1)
/*
收集页面所有楼层的组件信息,同步完成广告投放计算,异步完成稿件批查,
*/
pageModel.pageTotalCompSize = pageInfo.oneRequestPageGroupCompList.length + pageModel.pageTotalCompSize
// 处理页面广告数据,投放到页面的位置
this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList);
//遍历所有组件和稿件数据 push到页面
for (let element of pageInfo.oneRequestPageGroupCompList) {
pageModel.compList.push(CompDTO.createNewsBean(element))
}
// 批查互动数据
this.allCompBatchRequest(pageInfo.oneRequestPageGroupCompList.convertToArray(), pageModel)
//
pageModel.currentPage++
pageModel.viewType = ViewType.LOADED
closeRefresh(pageModel, true)
Logger.error("ZZZXXXXX", 'parseGroup----3----->' + pageInfo.oneRequestPageGroupCompList.length);
if (pageModel.compList.isEmpty()) {
// 没数据,展示空页面
Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.');
... ... @@ -118,49 +150,207 @@ export class PageHelper {
}
}
private async getGroupData(pageModel: PageModel, pageDto: PageDTO, isLastGroup: boolean) {
/**
* 解析页面的楼层数据
* @param pageDto 楼层的组件信息
* @param pageInfo 信息流页面信息
* @param isLastGroup pageDto信息是不是最后一个楼层
*/
private async analysisPageGroupCompData(pageModel: PageModel,pageDto: PageDTO, pageInfo: PageInfoDTO, isLastGroup: boolean) {
if (pageDto && pageDto.compList && pageDto.compList.length > 0) {
pageModel.viewType = ViewType.LOADED;
if (isLastGroup) {
// 认为分页只会在最后一个group里
pageModel.currentPage++;
}
// pageModel.currentPage++;
pageModel.hasMore = true;
let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集楼层组件、稿件和本地组件容器
// 遍历楼层的组件数据
pageDto.compList.forEach((element: CompDTO) => {
let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0);
//移除音频 和 活动
this.collectPageComp(pageModel, pageDto)
if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) {
Logger.debug(TAG, 'getGroupData 移除音频 和 活动');
} else {
// 暂时屏蔽活动和音频详情入口
if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') {
} else {
pageCompList.add(element)
}
}
})
// TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上)
// TODO updateItems(sizeBefore, data),这里可能有时序问题,导致覆盖别的group数据,需要优化,考虑精准替换
// 二次请求,批查互动数据
this.allCompBatchRequest(pageDto.compList, pageModel)
// pageInfor 记录
pageCompList.forEach((comp: CompDTO) => {
pageInfo.oneRequestPageGroupCompList.add(comp)
})
// pageInfor 记录广告
if (pageDto.compAdList != null) {
pageInfo.pageAdList.push(...pageDto.compAdList)
}
// content级别的展现加载丢给comp自己,这里只需要处理屏蔽分页加载,pageModel.pageScroll
// 检测最后一个楼层是否有一行两图卡
if (isLastGroup) {
closeRefresh(pageModel, true);
// 最后一个楼层,特殊处理
// 检测楼层最后一个组件业务数据是否需要通过访问接口获取
let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1]
let compSize = CollectionUtils.getListSize(comp.operDataList)
// 直播回放,需要二次请求数据
if (compSize <= 0 && comp.compStyle == CompStyle.Zh_Grid_Layout_02) {
if ( comp.compStyle == CompStyle.Zh_Grid_Layout_02) {
// 这个comp,数据自己二次请求,自己分页处理,这里加flag,将page层滑动及loadmore ui去掉
pageModel.contentNeedScroll = true
//this.getLiveReviewData(pageInfo,comp)
}
}
}
}
/**
* comp加载更多,分页加载
*/
private compLoadMore(pageModel: PageModel) {
//聚合页
if (pageModel.pageType == 1) {
PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => {
if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) {
pageModel.hasMore = false;
return;
} else {
//更新数据
pageModel.compList.addItems(liveReviewDTO.list);
// 直接认为有分页,一直加载分页。直到没有数据,再停止
pageModel.currentPage++;
pageModel.hasMore = true;
pageModel.pageTotalCompSize = liveReviewDTO.list.length + pageModel.pageTotalCompSize
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
})
} else {
PageViewModel.getPageGroupCompData(pageModel.bizCopy())
.then((data: PageDTO) => {
if (data == null || data.compList == null || data.compList.length == 0) {
pageModel.hasMore = false;
} else {
// 直接认为有分页,一直加载分页。直到没有数据,再停止
pageModel.currentPage++;
pageModel.hasMore = true;
//移除音频 和 活动
this.loadMorePageComp(pageModel, data)
// 参与批查
this.allCompBatchRequest(data.compList, pageModel)
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
})
}
}
/**
* 加载更多页面组件和稿件信息
*/
private loadMorePageComp(pageModel: PageModel, pageDto: PageDTO) {
let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器
pageDto.compList.forEach((element: CompDTO) => {
let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0);
//移除音频 和 活动
if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) {
Logger.debug(TAG, 'getGroupData 移除音频 和 活动');
} else {
// 暂时屏蔽活动和音频详情入口
if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') {
} else {
pageCompList.add(element)
}
}
})
// 记录
pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize
// 处理页面广告数据,投放到页面的位置
this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto.compAdList);
//遍历所有组件和稿件数据 push到页面
for (let element of pageCompList) {
pageModel.compList.push(CompDTO.createNewsBean(element))
}
}
/**
* 信息流页面,所有稿件需要参与批查,如 批查评论、批查关注状态等接口
* @param compList
* @param pageModel
*/
private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) {
PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => {
// 刷新,替换所有数据
this.resetInteract(data, pageModel.compList)
if (pageModel?.channelId === '2001' || pageModel?.channelId === '2002') {
//早晚报意图上报
let context = getContext(this) as common.UIAbilityContext;
viewBlogInsightIntentShare(context, pageModel?.channelId, compList, ActionMode.EXPECTED)
}
})
// 测试数据
// setTimeout(() => {
// let index = 1
// let comp = pageModel.compList.getData(index) as CompDTO
// comp.hasMore = 0
// //comp.operDataList[0].newsTitle = '测试111'
// let con :InteractDataDTO = new InteractDataDTO;
// con.commentNum=1000
// comp.operDataList[0].interactData = con
// Logger.debug("ZZZXXXXX",
// "-----setTimeout--------->" + comp.hasMore)
// }, 4 * 1000)
}
/**
* 刷新互动数据到compList
* @param interact 批查互动数据结果
* @param compList comp list
*/
private resetInteract(interact: InteractDataDTO[], compList: LazyDataSource<BaseDTO>) {
if (interact == null || interact.length == 0) {
return
}
let time = DateTimeUtils.getTimeStamp().toString()
interact.forEach((interactData) => {
let id = interactData.contentId;
outer: for (let i = 0; i < compList.totalCount(); i++) {
let comp = compList.getData(i) as CompDTO;
if (comp == null || comp.operDataList == null || comp.operDataList.length == 0) {
continue;
}
for (let j = 0; j < comp.operDataList.length; j++) {
let content = comp.operDataList[j];
if (content == null) {
continue;
}
if (id == content.objectId) {
content.interactData = interactData;
comp.timestamp = time
break outer;
}
}
}
})
}
/**
* 处理页面中的广告组件信息
* @param pageDto
*/
private handlePageCompAdvPostion(pageCompList: ArrayList<CompDTO>, pageModel: PageModel, pageDto: PageDTO) {
private handlePageCompAdvPostion(pageCompList: ArrayList<CompDTO>, pageModel: PageModel, compAdList: CompAdvBean[]) {
let compAdvList = pageDto.compAdList
let compAdvList = compAdList
let flag = true;
if (compAdvList == null) {
... ... @@ -272,15 +462,17 @@ export class PageHelper {
let b = advPosition - a;
// console.error('ZZZXXXXX', matInfo.advSubType + '-------------' + matInfo.advTitle + " " + advPosition + " " + a + " " + b)
if (b <= pageCompSize && b >= 0) {
// 创建广告稿件
let advComp: CompDTO = new CompDTO;
advComp.compStyle = CompStyle.Card_Comp_Adv
advComp.matInfo = matInfo
if (pageCompSize == slotInfo.position) {
pageCompList.add(advComp)
} else {
pageCompList.insert(advComp, b + layoutAdvIndex)
}
matInfo.originalPostion = pageCompList.getIndexOf(advComp)
layoutAdvIndex = layoutAdvIndex + 1;
... ... @@ -297,137 +489,15 @@ export class PageHelper {
/**
* comp加载更多,分页加载
*/
private compLoadMore(pageModel: PageModel) {
//聚合页
if (pageModel.pageType == 1) {
PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => {
if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) {
pageModel.hasMore = false;
return;
} else {
//更新数据
pageModel.compList.addItems(liveReviewDTO.list);
// 直接认为有分页,一直加载分页。直到没有数据,再停止
pageModel.currentPage++;
pageModel.hasMore = true;
pageModel.pageTotalCompSize = liveReviewDTO.list.length + pageModel.pageTotalCompSize
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
})
} else {
PageViewModel.getPageData(pageModel.bizCopy())
.then((data: PageDTO) => {
if (data == null || data.compList == null || data.compList.length == 0) {
pageModel.hasMore = false;
} else {
// 直接认为有分页,一直加载分页。直到没有数据,再停止
pageModel.currentPage++;
pageModel.hasMore = true;
//移除音频 和 活动
this.collectPageComp(pageModel, data)
// 参与批查
this.allCompBatchRequest(data.compList, pageModel)
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
})
}
}
/**
* 信息流页面,所有稿件需要参与批查,如 批查评论、批查关注状态等接口
* @param compList
* @param pageModel
*/
private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) {
PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => {
// 刷新,替换所有数据
this.resetInteract(data, pageModel.compList)
})
// 测试数据
// setTimeout(() => {
// let index = 1
// let comp = pageModel.compList.getData(index) as CompDTO
// comp.hasMore = 0
// //comp.operDataList[0].newsTitle = '测试111'
// let con :InteractDataDTO = new InteractDataDTO;
// con.commentNum=1000
// comp.operDataList[0].interactData = con
// Logger.debug("ZZZXXXXX",
// "-----setTimeout--------->" + comp.hasMore)
// }, 4 * 1000)
}
/**
* 移除comp
* 获取直播回看数据
*/
private collectPageComp(pageModel: PageModel, pageDto: PageDTO) {
private async getLiveReviewData(pageInfo: PageInfoDTO,comp: CompDTO) {
let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器
let currentPage = 1
let pageSize = 20
let listReviewDtoBean = await PageViewModel.getLiveReviewUrl(currentPage, pageSize) as LiveReviewDTO
Logger.error("ZZZXXXXX", 'getLiveReviewData---------'+listReviewDtoBean.list.length);
pageDto.compList.forEach((element: CompDTO) => {
let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0);
//移除音频 和 活动
if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) {
Logger.debug(TAG, 'getGroupData 移除音频 和 活动');
} else {
// 暂时屏蔽活动和音频详情入口
if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') {
} else {
pageCompList.add(element)
}
}
})
// 记录
pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize
// 处理页面广告数据,投放到页面的位置
this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto);
//遍历所有组件和稿件数据 push到页面
for (let element of pageCompList) {
pageModel.compList.push(CompDTO.createNewsBean(element))
}
}
/**
* 刷新互动数据到compList
* @param interact 批查互动数据结果
* @param compList comp list
*/
private resetInteract(interact: InteractDataDTO[], compList: LazyDataSource<BaseDTO>) {
if (interact == null || interact.length == 0) {
return
}
let time = DateTimeUtils.getTimeStamp().toString()
interact.forEach((interactData) => {
let id = interactData.contentId;
outer: for (let i = 0; i < compList.totalCount(); i++) {
let comp = compList.getData(i) as CompDTO;
if (comp == null || comp.operDataList == null || comp.operDataList.length == 0) {
continue;
}
for (let j = 0; j < comp.operDataList.length; j++) {
let content = comp.operDataList[j];
if (content == null) {
continue;
}
if (id == content.objectId) {
content.interactData = interactData;
comp.timestamp = time
break outer;
}
}
}
})
}
}
... ...
... ... @@ -178,7 +178,12 @@ export class PageViewModel extends BaseViewModel {
return compRes.data
}
async getPageData(pageModel: PageUIReqBean): Promise<PageDTO> {
/**
* 获取页面楼层的组件信息
* @param pageModel
* @returns
*/
async getPageGroupCompData(pageModel: PageUIReqBean): Promise<PageDTO> {
Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId);
if (pageModel.isRecGroup) {
return this.parseComp(PageRepository.fetchRecCompData(pageModel))
... ...
... ... @@ -65,14 +65,26 @@
"value": "14vp"
},
{
"name": "margin_4",
"value": "4vp"
},
{
"name": "margin_8",
"value": "8vp"
},
{
"name": "margin_9",
"value": "9vp"
},
{
"name": "label_margin_top",
"value": "10vp"
},
{
"name": "margin_12",
"value": "12vp"
},
{
"name": "margin_bottom_16",
"value": "16vp"
},
... ...
... ... @@ -273,7 +273,8 @@ export struct DetailPlayShortVideoPage {
this.playerCoverBuilder()
// 横屏-全屏观看
if (this.videoLandScape === 1) {
// 点击查看详情 不展示
if (this.videoLandScape === 1 && !this.isOpenDetail) {
this.playerFullscreenBuilder()
}
}
... ...
import { Action, ContentDetailDTO, InteractDataDTO } from 'wdBean/Index';
import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel, StringUtils } from 'wdKit';
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
import { ResponseDTO } from 'wdNetwork/Index';
import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
import router from '@ohos.router';
import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { WindowModel } from 'wdKit';
import { DisplayDirection } from 'wdConstant/Index';
import { window } from '@kit.ArkUI';
import { EmptyComponent } from '../../../../../wdComponent/src/main/ets/components/view/EmptyComponent';
const storage = LocalStorage.getShared();
const TAG = 'DetailVideoListPage'
... ... @@ -29,11 +30,14 @@ export struct DetailVideoListPage {
@Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL
@State data: ContentDetailDTO[] = []
@State currentIndex: number = 0
@State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
@State interactDataList: InteractDataDTO[] = []
async aboutToAppear(): Promise<void> {
// 注册监听网络连接
let netStatus = NetworkUtil.isNetConnected()
if (netStatus) {
this.openFullScreen()
const action: Action = router.getParams() as Action
if (action) {
this.contentId = action.params?.contentID || ''
... ... @@ -45,6 +49,12 @@ export struct DetailVideoListPage {
}
await this.queryVideoList()
console.log(TAG, 'aboutToAppear', JSON.stringify(action.params))
} else {
// 无网络
this.netStatus = 1
}
}
aboutToDisappear(): void {
... ... @@ -163,6 +173,19 @@ export struct DetailVideoListPage {
}
build() {
if (this.netStatus !== undefined) {
EmptyComponent({
emptyType: this.netStatus, emptyButton: true, retry: () => {
this.getContentDetail(this.contentId, this.relId, this.relType)
}
})
.id('e_empty_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
} else {
Column() {
Swiper(this.swiperController) {
ForEach(this.data, (item: ContentDetailDTO, index: number) => {
... ... @@ -198,4 +221,5 @@ export struct DetailVideoListPage {
// bottom: this.bottomSafeHeight + 'px'
// })
}
}
}
\ No newline at end of file
... ...
... ... @@ -178,7 +178,7 @@ export struct PlayerRightView {
.width(58)
.position({ x: '100%', y: '100%' })
.markAnchor({ x: '100%', y: '100%' })
.padding({ bottom: 10, right: 10 })
.padding({ bottom: 7, right: 10 })
.visibility(this.isOpenDetail || this.isDragging || this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ?
Visibility.None : Visibility.Visible)
... ...
... ... @@ -13,6 +13,10 @@
"value": "12fp"
},
{
"name": "margin_4",
"value": "4vp"
},
{
"name": "normal_text_size",
"value": "16fp"
},
... ...
... ... @@ -9,11 +9,12 @@ const TAG = 'SpacialTopicPage';
@Entry
@Component
struct SpacialTopicPage {
action: Action = {} as Action
@State action: Action = {} as Action
@State reload: number = 0
@State count: number = 0
build() {
Column() {
SpacialTopicPageComponent({ action: this.action })
SpacialTopicPageComponent({ action: this.action ,reload:this.reload })
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
}
... ... @@ -30,8 +31,12 @@ struct SpacialTopicPage {
}
aboutToAppear() {
Logger.info(TAG, 'aboutToAppear');
Logger.info(TAG, `aboutToAppearcount:${this.reload}`);
let action: Action = router.getParams() as Action
this.action = action
}
onPageShow() {
this.reload = this.reload + 1
Logger.info(TAG, `onPageShowcount:${this.reload}`);
}
}
\ No newline at end of file
... ...
... ... @@ -47,7 +47,7 @@ struct LaunchInterestsHobbiesPage {
.width('100%')
.height('61lpx')
.margin({top:'84lpx'})
Text('完善信息将为您推荐个性化的内容')
Text('完善信息,将为您推荐个性化的内容')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.fontColor('#9E9E9E')
... ... @@ -69,8 +69,8 @@ struct LaunchInterestsHobbiesPage {
Image('')
.width('100%')
.height('100%')
.backgroundColor(Color.Gray)
.opacity(item.choose?0.85:0)
.backgroundColor(Color.Black)
.opacity(item.choose?0.5:0)
.borderRadius(5)
}
... ... @@ -134,14 +134,14 @@ struct LaunchInterestsHobbiesPage {
.width('662lpx')
.height('84lpx')
.backgroundColor(Color.White)
.opacity(this.selectCount == 0 ? 0.3 : 0)
.opacity(this.selectCount == 0 ? 0.6 : 0)
.borderRadius('10lpx')
.onClick(()=>{
if (this.selectCount == 0) {
promptAction.showToast({
message : '请先选择您感兴趣的内容哦',
duration: 2000,
bottom: '50%'
bottom: '50%',
})
return
}
... ...