wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  fix:somebug
  fix:somebug
  feat(信息流):一行两图卡业务数据转换成本地 稿件数据  Card_Comp_Zh_Grid_Layout-02
  fix:预约状态修改问题
  feat:意图框架事件推荐
  稿件 缺省图-内容找不到了,类型判断错误
  desc;搜索异常(先去除网络监听,后续再加)
  fix:somebug
  fix: 17539 功能缺陷-页面加载-信息流图片加载,手机打开仅wifi加载图片控制,时间轴图片未显示
Showing 23 changed files with 586 additions and 138 deletions
... ... @@ -39,7 +39,7 @@ export const enum CompStyle {
Zh_Single_Column_10 = 'Zh_Single_Column-10', //18 服务组合卡
Zh_Single_Column_11 = 'Zh_Single_Column-11', //19 问政组合卡
Zh_Grid_Layout_01 = 'Zh_Grid_Layout-01', //4 信息流组合卡
Zh_Grid_Layout_02 = 'Zh_Grid_Layout-02', //7 双列流小视频,一行两图卡
Zh_Grid_Layout_02 = 'Zh_Grid_Layout-02', //7 双列流小视频,一行两图卡 ->标题
Zh_Grid_Layout_03 = 'Zh_Grid_Layout-03', //11 金刚位卡
Card_01 = '1', // 小图卡
Card_02 = '2', // 大图卡
... ... @@ -80,5 +80,7 @@ export const enum CompStyle {
/**
* 本地稿件和组件样式
*/
Card_Comp_Adv = 'card_comp_adv', //
Card_Comp_Adv = 'card_comp_adv', // 信息流广告稿件
Card_Comp_Zh_Grid_Layout_02 = 'Card_Comp_Zh_Grid_Layout-02', // 一行两列卡业务内容
}
... ...
... ... @@ -238,7 +238,6 @@ export class ProcessUtils {
}
Logger.debug(TAG, `gotoWeb, ${content.objectId}`)
}
... ...
... ... @@ -7,10 +7,11 @@ import { VoiceInfoDTO } from '../detail/VoiceInfoDTO';
import { RmhInfoDTO } from '../detail/RmhInfoDTO';
import { commentInfo } from './commentInfo';
import { BaseDTO } from '../component/BaseDTO';
import { LiveRoomDataBean } from '../live/LiveRoomDataBean';
@Observed
export class ContentDTO implements BaseDTO {
shareFlag?:string='1';
shareFlag?: string = '1';
appStyle: string = '';
cityCode: string = '';
coverSize: string = '';
... ... @@ -62,8 +63,7 @@ export class ContentDTO implements BaseDTO {
videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的
newsSummary: string = ''; //appstyle:2 ,新闻详情
contentText?: string ='';
contentText?: string = '';
// 二次请求接口,返回的数据,这里组装到content里;
interactData?: InteractDataDTO;
hasMore: number = -1;
... ... @@ -85,6 +85,10 @@ export class ContentDTO implements BaseDTO {
// 链接类型: 0:无链接;1:内链(文章);2:外链
openType: string = '';
extra: string = ''
/*
本地辅助字段
*/
liveRoomDataBean?: LiveRoomDataBean // 批查获取到的直播观看人数
static clone(old: ContentDTO): ContentDTO {
let content = new ContentDTO();
... ...
... ... @@ -42,6 +42,16 @@ export interface PageInfoDTO {
pageAdList:CompAdvBean[]
md5:string
/*
信息流页面,最后一个楼层的最后一个组件的信息源
lastCompSourceType = 0 从楼层接口获取数据(compinfor)
= 1 表示 直播回看数据源
*/
lastCompSourceType: number
}
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, compDTO: this.compDTO })
Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy})
} else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle
.Card_13) {
Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO })
... ...
... ... @@ -8,6 +8,8 @@ import { Card5Component } from './cardview/Card5Component';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
import { ZhGridLayout02 } from './compview/ZhGridLayout02';
import { ZhGridLayout02News } from './compview/ZhGridLayout02News';
import { ZhGridLayout02NewsContent } from './compview/ZhGridLayout02NewsContent';
import { ZhGridLayout03 } from './compview/ZhGridLayout03';
import { ZhSingleColumn04 } from './compview/ZhSingleColumn04';
import { ZhSingleColumn05 } from './compview/ZhSingleColumn05';
... ... @@ -37,10 +39,8 @@ export struct CompParser {
build() {
Column() {
if (this.compDTO.name != "月度排行卡") {
this.componentBuilder();
}
this.componentBuilder();
}
}
... ... @@ -75,9 +75,14 @@ export struct CompParser {
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
ZhSingleRow03({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
ZhGridLayout02({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { //双列流小视频,一行两图卡 ->标题
//ZhGridLayout02({ compDTO: this.compDTO })
ZhGridLayout02News({ compDTO: this.compDTO })
// Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (this.compDTO.compStyle === CompStyle.Card_Comp_Zh_Grid_Layout_02) { //双列流小视频,一行两图卡
ZhGridLayout02NewsContent({ compDTO: this.compDTO })
} else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
ZhGridLayout03({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
... ... @@ -105,7 +110,7 @@ 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(3).color('#ffffff').padding({ left: 16, right: 16 }).margin({ top: -3 })
Divider().strokeWidth(6).color('#f5f5f5')
ZhSingleColumn09({ compDTO: this.compDTO })
Divider().strokeWidth(6).color('#f5f5f5')
... ...
... ... @@ -41,6 +41,8 @@ import { publishCommentModel } from './comment/model/PublishCommentModel';
import { CommentComponent } from './comment/view/CommentComponent';
import { EmptyComponent } from './view/EmptyComponent';
import { detailedSkeleton } from './skeleton/detailSkeleton';
import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG = 'DynamicDetailComponent'
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
... ... @@ -602,6 +604,7 @@ export struct DynamicDetailComponent {
this.getInteractDataStatus()
this.makeJumpInfo()
this.interactDataV2()
this.viewBlogInsightIntentShare()
}
private async interactDataV2() {
... ... @@ -761,6 +764,14 @@ export struct DynamicDetailComponent {
console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum)
})
}
/**
* 意图上报
*/
private viewBlogInsightIntentShare(){
let context = getContext(this) as common.UIAbilityContext;
viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactDataDTO)
}
}
interface radiusType {
... ...
... ... @@ -31,6 +31,8 @@ import { publishCommentModel } from '../components/comment/model/PublishCommentM
import { EmptyComponent } from '../components/view/EmptyComponent';
import { CommentComponent } from '../components/comment/view/CommentComponent'
import { HttpUtils } from 'wdNetwork/Index';
import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
... ... @@ -56,7 +58,6 @@ export struct ImageAndTextPageComponent {
@State likeNum: number = 0
@State reachEndIncreament: number = 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
build() {
Stack({ alignContent: Alignment.Top }) {
Stack({ alignContent: Alignment.Bottom }) {
... ... @@ -261,10 +262,20 @@ export struct ImageAndTextPageComponent {
} else {
this.operationButtonList = ['comment', 'collect', 'share']
}
//意图上报
this.viewBlogInsightIntentShare()
}
}
}
//意图上报
private viewBlogInsightIntentShare(){
let context = getContext(this) as common.UIAbilityContext;
viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactData)
}
private async getRecommend() {
let params: postRecommendListParams = {
imei: HttpUtils.getImei(),
... ... @@ -341,6 +352,7 @@ export struct ImageAndTextPageComponent {
}
PageRepository.getContentInteract(params).then(res => {
if (res.data) {
this.interactData = res.data[0]
this.likeNum = Number(res.data[0]?.likeNum) || 0
}
})
... ...
... ... @@ -22,6 +22,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../repository/PageRepository';
import { SpConstants } from 'wdConstant/Index';
import { router } from '@kit.ArkUI';
import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG = 'MultiPictureDetailPageComponent';
... ... @@ -467,6 +469,7 @@ export struct MultiPictureDetailPageComponent {
this.getInteractBrowsOperate()
this.getBatchAttentionStatus()
}
this.viewBlogInsightIntentShare()
})
.catch((err: Error) => {
Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
... ... @@ -544,4 +547,12 @@ export struct MultiPictureDetailPageComponent {
}
})
}
/**
* 意图上报
*/
private viewBlogInsightIntentShare(){
let context = getContext(this) as common.UIAbilityContext;
viewBlogItemInsightIntentShare(context,this.contentDetailData)
}
}
\ No newline at end of file
... ...
... ... @@ -10,6 +10,8 @@ import DetailViewModel from '../viewmodel/DetailViewModel';
import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
import { EmptyComponent } from '../components/view/EmptyComponent';
import { NetworkUtil, WindowModel } from 'wdKit';
import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare'
import { common } from '@kit.AbilityKit';
const TAG: string = 'SpacialTopicPageComponent'
... ... @@ -49,6 +51,12 @@ export struct SpacialTopicPageComponent {
})
}
//意图上报
private viewBlogInsightIntentShare(){
let context = getContext(this) as common.UIAbilityContext;
viewBlogItemInsightIntentShare(context,this.contentDetailData)
}
private async getDetail() {
this.isNetConnected = NetworkUtil.isNetConnected()
... ... @@ -71,6 +79,7 @@ export struct SpacialTopicPageComponent {
let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans[0];
this.viewBlogInsightIntentShare()
// if (this.contentDetailData[0]?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '')
... ...
... ... @@ -3,8 +3,6 @@ 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';
... ... @@ -15,7 +13,6 @@ 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;
... ... @@ -100,8 +97,6 @@ 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)
})
}
... ...
... ... @@ -13,7 +13,7 @@ const TAG: string = 'Card9Component';
@Component
export struct Card9Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State loadImg: boolean = true;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
@State str01: string = '';
... ... @@ -22,7 +22,7 @@ export struct Card9Component {
async aboutToAppear(): Promise<void> {
this.titleInit();
this.loadImg = await onlyWifiLoadImg();
// this.loadImg = await onlyWifiLoadImg();
}
titleInit() {
... ...
import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { Logger } from 'wdKit/Index';
import { ProcessUtils } from 'wdRouter';
import PageViewModel from '../../viewmodel/PageViewModel';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
/**
* 双图卡 的标题组件
*
*/
@Component
export struct ZhGridLayout02News {
@State compDTO: CompDTO = new CompDTO
aboutToAppear() {
}
build() {
Column() {
Row() {
Image($r("app.media.redLine"))
.width(3)
.height(16)
.margin({ right: 4 })
Text(this.compDTO.objectTitle)
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
}
.justifyContent(FlexAlign.Start)
.margin({ top: 16, bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
}
.width(CommonConstants.FULL_WIDTH)
.padding({ left: 16, right: 16 })
}
}
... ...
import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { Logger } from 'wdKit/Index';
import { ProcessUtils } from 'wdRouter';
import PageViewModel from '../../viewmodel/PageViewModel';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
let listSize: number = 2;
/**
* 双图卡 的标题组件
*
*/
@Component
export struct ZhGridLayout02NewsContent {
@ObjectLink compDTO: CompDTO
@State loadImg: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
}
build() {
if (this.compDTO != undefined) {
GridRow({
gutter: { x: 12, y: 13 },
columns: { sm: listSize, md: 2 },
breakpoints: { value: ['320vp', '520vp', '840vp'] }
}) {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
GridCol() {
this.buildItemCard(item);
}
})
}.width("100%").padding({ left: 16, right: 16 })
}
}
@Builder
buildItemCard(item: ContentDTO) {
Column() {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.loadImg ? item.fullColumnImgUrls[0].url : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.height(95)
.borderRadius(4)
if (item.liveRoomDataBean != null && item.liveRoomDataBean.pv > 0) {
Text(this.computeShowNum(item.liveRoomDataBean.pv))
.fontSize('11vp')
.fontWeight(400)
.fontColor(Color.White)
.margin({
right: '5vp',
bottom: '5vp'
})
}
}
Text(item.newsTitle)
.margin({ top: '6',bottom:'10' })
.fontSize(13)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.width('100%')
.onClick(() => {
ProcessUtils.processPage(item)
})
}
private computeShowNum(count: number): string {
if (count >= 10000) {
let num = (count / 10000).toFixed(1)
if (Number(num.substring(num.length - 1)) == 0) {
num = num.substring(0, num.length - 2)
}
return num + '万人参加'
}
return `${count}人参加`
}
}
... ...
import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent'
import { RmhRecommendDTO } from 'wdBean';
import { faceDetector } from '@kit.CoreVisionKit';
@Component
export struct PeopleShipRecommendComponent {
... ...
... ... @@ -28,7 +28,7 @@ const TAG: string = 'ReserveMorePage';
@Component
struct ReserveMorePage {
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
@State reserveList: ReserveItemBean[] = []
private reserveList: ReserveItemBean[] = []
topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
type: number = 2;
pageSize: number = 20;
... ... @@ -312,8 +312,15 @@ struct ReserveMorePage {
Logger.debug(TAG,'是否关注元数据2:' +` ${JSON.stringify(element.subscribe)}`)
element.subscribe = !element.subscribe
Logger.debug(TAG,'是否关注元数据3:' +` ${JSON.stringify(element.subscribe)}`)
this.data.reloadData()
this.isShow = true
if (element.subscribe) {
this.reservedIds.push(element.liveId.toString())
}else {
const num = this.reservedIds.indexOf(element.liveId.toString())
if (num >= 0 && num < this.reservedIds.length) {
this.reservedIds.splice(num, 1)
}
}
}
}
})
... ... @@ -349,6 +356,7 @@ struct ReserveMorePage {
if (this.currentPage == 1) {
this.data.clear()
this.reserveList = []
this.reservedIds = []
}
this.data.push(...liveReviewDTO.list)
//批量查询关注状态
... ... @@ -396,7 +404,12 @@ struct ReserveMorePage {
Logger.debug(TAG,'是否预约数据:' +` ${JSON.stringify(result)}`)
if (result && result.length > 0) {
this.reserveList.push(...result)
this.data.reloadData()
// this.reserveStatus = res;
result.map((item: ReserveItemBean) => {
if (item.subscribe) {
this.reservedIds.push(item.liveId.toString())
}
})
}
}).catch(() =>{
// this.data.push(...list)
... ... @@ -409,11 +422,7 @@ struct ReserveMorePage {
// 判断是否预约
isReserved(item: ContentDTO) {
const objc = this.getAttentionItem(item)
if (objc) {
return objc.subscribe
}
return false
return this.reservedIds.includes(item.objectId)
}
getAttentionItem(item: ContentDTO) {
... ... @@ -460,9 +469,17 @@ struct ReserveMorePage {
Logger.debug(TAG,'是否关注元数据:' +` ${JSON.stringify(element.subscribe)}`)
element.subscribe = !element.subscribe
Logger.debug(TAG,'是否关注元数据1:' +` ${JSON.stringify(element.subscribe)}`)
this.data.reloadData()
if (element.subscribe) {
this.reservedIds.push(element.liveId.toString())
}else {
const num = this.reservedIds.indexOf(element.liveId.toString())
if (num >= 0 && num < this.reservedIds.length) {
this.reservedIds.splice(num, 1)
}
}
}
})
}
this.isLoadingAttention = false
this.liveId = ''
... ...
... ... @@ -31,7 +31,6 @@ export struct SearchComponent {
scroller: Scroller = new Scroller()
@State count:string[] = []
@State isGetRequest:boolean = false;
@State isConnectNetwork : boolean = NetworkUtil.isNetConnected()
aboutToAppear() {
//获取提示滚动
... ... @@ -129,16 +128,8 @@ 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})
}
//搜索结果
SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest})
} else {
//联想搜索
SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText})
... ... @@ -339,12 +330,10 @@ 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()
})
}
... ...
... ... @@ -216,7 +216,7 @@ export struct EmptyComponent {
contentString = '暂无关注'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) {
contentString = '暂无评论,快来抢沙发'
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) {
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent2) {
contentString = '内容找不到了'
}
... ... @@ -230,7 +230,7 @@ export struct EmptyComponent {
this.emptyType === WDViewDefaultType.WDViewDefaultType_NoHistory) {
imageString = $r('app.media.icon_no_collection')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) {
imageString = $r('app.media.icon_no_message')
imageString = $r('app.media.icon_no_message1')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment ||
this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) {
imageString = $r('app.media.icon_no_comment')
... ...
import { common } from '@kit.AbilityKit';
import { insightIntent } from '@kit.IntentsKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { CompDTO, CompList, ContentDTO, PageInfoBean } from 'wdBean';
import { CompDTO, CompList, ContentDTO, PageInfoBean, ContentDetailDTO, InteractDataDTO } from 'wdBean';
function generateUUID() {
let dt = new Date().getTime(); // 获取当前时间的时间戳(毫秒)
... ... @@ -82,12 +82,58 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent
}
}
//ViewBlog意图共享-节目详情 目前单独在详情页上报
export function viewBlogItemInsightIntentShare(context: common.UIAbilityContext, item: ContentDetailDTO,
interactData?: InteractDataDTO) {
let identifier = generateUUID()
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewBlog',
intentVersion: '1.0.1',
identifier,
intentActionInfo: {
actionMode: ActionMode.EXECUTED,
currentPercentage: 50,
},
intentEntityInfo: {
entityName: 'Blog',
entityId: String(item?.newsId),
displayName: item?.newsTitle,
entityGroupId: String(item?.reLInfo?.channelId), //channelId
logoURL: item.fullColumnImgUrls.length > 0 ? item.fullColumnImgUrls[0]?.url : item.firstFrameImageUri,
metadataModificationTime: item?.publishTime,
blogTitle: item?.newsTitle,
blogType: 'Normal',
blogCategory: item,
categoryDisplayName: '', //TODO 分类名称
blogSubTitle: item?.newsSummary.length > 20 ?
item?.newsSummary.substring(0, 20) : item?.newsSummary,
blogAuthor: item?.newsSourceName,
blogPublishTime: item?.publishTime,
tag: item?.newsTags.split(','),
viewCount: item?.viewCount || 0,
likeCount: interactData?.likeNum || 0,
forwardCount: interactData?.shareNum || 0,
commentCount: interactData?.commentNum || 0,
favorites: interactData?.collectNum || 0,
rankingHint: 99,
isPublicData: true
}
}
//ViewBlog意图共享-早晚报
console.log('yzl', JSON.stringify(viewBlogInsightIntentItem))
// 共享数据
insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => {
console.log('yzl shareIntent success');
}).catch((err: BusinessError) => {
console.error(`yzl failed because ${err?.message}`);
});
}
//ViewColumn意图共享-早晚报
export function viewColumInsightIntentShare(context: common.UIAbilityContext, entityId: string,
pageInfoBean: PageInfoBean) {
console.log('viewColumInsightIntentShare')
let viewBlogInsightIntentItem: insightIntent.InsightIntent = {
let viewColumInsightIntentItem: insightIntent.InsightIntent = {
intentName: 'ViewColumn',
intentVersion: '1.0.1',
identifier: generateUUID(),
... ... @@ -108,10 +154,10 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en
isPublicData: true
}
}
console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewBlogInsightIntentItem))
console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewColumInsightIntentItem))
// 共享数据
insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => {
insightIntent.shareIntent(context, [viewColumInsightIntentItem]).then(() => {
console.log('yzl shareIntent success');
}).catch((err: BusinessError) => {
console.error(`yzl failed because ${err?.message}`);
... ...
import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, PageDTO, PageInfoDTO } from 'wdBean';
import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, LiveRoomDataBean, PageDTO, PageInfoDTO } from 'wdBean';
import { CompStyle, ViewType } from 'wdConstant/Index';
import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils } from 'wdKit';
import { closeRefresh } from '../utils/PullDownRefresh';
... ... @@ -75,7 +75,7 @@ export class PageHelper {
// 清空comp列表
pageModel.compList.clear()
}
this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1)
this.analysisPageGroupCompData(pageDto, pageInfo)
Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length);
}
... ... @@ -178,14 +178,31 @@ export class PageHelper {
// await,确保groups接口顺序执行
let pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO
let index = pageInfo.groups.indexOf(group)
if (index == 0) {
// 清空comp列表
pageModel.compList.clear()
// 解析楼层组件
this.analysisPageGroupCompData(pageDto, pageInfo)
// 最后一个楼层,特殊处理
if (index == pageInfo.groups.length - 1) {
// 检测楼层最后一个组件业务数据是否需要通过访问接口获取
let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1]
// 直播回放,需要二次请求数据
if (comp.compStyle == CompStyle.Zh_Grid_Layout_02) {
pageInfo.lastCompSourceType = 1
let listReviewDtoBean = await PageViewModel.getLiveReviewUrl(1, 20) as LiveReviewDTO
Logger.error("ZZZXXXXX", 'getLiveReviewData------1---' + listReviewDtoBean.list.length);
// 创建一行两图卡组件
this.createDoubleColumComp(listReviewDtoBean, pageInfo)
Logger.error("ZZZXXXXX", 'getLiveReviewData-----2----' + listReviewDtoBean.list.length);
} else {
pageInfo.lastCompSourceType = 0
}
// // 保存缓存
// CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto,
// pageDto.md5)
}
this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1)
Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length);
}
... ... @@ -196,9 +213,11 @@ export class PageHelper {
// 处理页面广告数据,投放到页面的位置
this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList);
// 清空comp列表
pageModel.compList.clear()
//遍历所有组件和稿件数据 push到页面
for (let element of pageInfo.oneRequestPageGroupCompList) {
pageModel.compList.push(CompDTO.createNewsBean(element))
pageModel.compList.push(element)
}
// 批查互动数据
... ... @@ -225,26 +244,11 @@ export class PageHelper {
* @param pageInfo 信息流页面信息
* @param isLastGroup pageDto信息是不是最后一个楼层
*/
private async analysisPageGroupCompData(pageModel: PageModel,pageDto: PageDTO, pageInfo: PageInfoDTO, isLastGroup: boolean) {
private async analysisPageGroupCompData(pageDto: PageDTO, pageInfo: PageInfoDTO) {
if (pageDto && pageDto.compList && pageDto.compList.length > 0) {
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)
}
}
})
let pageCompList = this.factoryCompArray(pageDto.compList)
// pageInfor 记录
pageCompList.forEach((comp: CompDTO) => {
pageInfo.oneRequestPageGroupCompList.add(comp)
... ... @@ -255,19 +259,6 @@ export class PageHelper {
pageInfo.pageAdList.push(...pageDto.compAdList)
}
// 检测最后一个楼层是否有一行两图卡
if (isLastGroup) {
// 最后一个楼层,特殊处理
// 检测楼层最后一个组件业务数据是否需要通过访问接口获取
let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1]
// 直播回放,需要二次请求数据
if ( comp.compStyle == CompStyle.Zh_Grid_Layout_02) {
// 这个comp,数据自己二次请求,自己分页处理,这里加flag,将page层滑动及loadmore ui去掉
pageModel.contentNeedScroll = true
//this.getLiveReviewData(pageInfo,comp)
}
}
}
}
... ... @@ -295,23 +286,32 @@ export class PageHelper {
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 });
})
if (pageModel.pageInfo.lastCompSourceType == 1) {
// 加载更多 走 直播回看接口
this.getLiveReviewData(pageModel, pageModel.pageInfo)
} 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 });
})
}
}
}
... ... @@ -321,9 +321,34 @@ export class PageHelper {
*/
private loadMorePageComp(pageModel: PageModel, pageDto: PageDTO) {
let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器
let pageCompList = this.factoryCompArray(pageDto.compList) // 收集页面组件、稿件和本地组件容器
pageDto.compList.forEach((element: CompDTO) => {
// pageInfor 记录
pageModel.pageInfo.oneRequestPageGroupCompList.clear()
pageCompList.forEach((comp: CompDTO) => {
pageModel.pageInfo.oneRequestPageGroupCompList.add(comp)
})
// 记录
pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize
// 处理页面广告数据,投放到页面的位置
this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto.compAdList);
//遍历所有组件和稿件数据 push到页面
for (let element of pageCompList) {
pageModel.compList.push(element)
}
}
/**
* 加工 组件数组信息
* @param compList
* @returns
*/
private factoryCompArray(compList: CompDTO[]): ArrayList<CompDTO> {
let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器
compList.forEach((element: CompDTO) => {
let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0);
//移除音频 和 活动
if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) {
... ... @@ -332,22 +357,17 @@ export class PageHelper {
// 暂时屏蔽活动和音频详情入口
if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') {
} else {
pageCompList.add(element)
if (element.name == "月度排行卡") {
} else {
pageCompList.add(CompDTO.createNewsBean(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))
}
return pageCompList
}
/**
... ... @@ -356,6 +376,8 @@ export class PageHelper {
* @param pageModel
*/
private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) {
// 批查人数
PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => {
// 刷新,替换所有数据
this.resetInteract(data, pageModel.compList)
... ... @@ -366,6 +388,9 @@ export class PageHelper {
}
})
// 批查直播观看人数
// this.getLiveRoomDataInfo(compList)
// 测试数据
// setTimeout(() => {
// let index = 1
... ... @@ -381,6 +406,59 @@ export class PageHelper {
}
/**
* 直播回看的批查数据
* @param list
* @param compList
*/
private getLiveRoomDataInfo(compList: CompDTO[]) {
let list: ContentDTO[] = []
compList.forEach((comp: CompDTO) => {
if (comp.compStyle == CompStyle.Card_Comp_Zh_Grid_Layout_02) {
list.push(...comp.operDataList)
}
})
let time = DateTimeUtils.getTimeStamp().toString()
const reserveIds = this.getLiveDetailIds(list)
PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => {
if (result && result.length > 0) {
result.forEach((bean: LiveRoomDataBean) => {
for (let item of list) {
if (item.objectId == bean.liveId.toString()) {
item.liveRoomDataBean = bean
outer: for (let compBean of compList) {
for (let contentBean of compBean.operDataList) {
if (contentBean === item) {
compBean.timestamp = time
break outer
}
}
}
break
}
}
})
}
}).catch(() => {
})
}
/**
* 获取直播详情id入参
* @param list
* @returns
*/
private getLiveDetailIds(list: ContentDTO[]): string {
let idList: string[] = []
list.forEach(item => {
idList.push(item.objectId)
});
return idList.join(',')
}
/**
* 刷新互动数据到compList
* @param interact 批查互动数据结果
* @param compList comp list
... ... @@ -560,12 +638,99 @@ export class PageHelper {
/**
* 获取直播回看数据
*/
private async getLiveReviewData(pageInfo: PageInfoDTO,comp: CompDTO) {
private async getLiveReviewData(pageModel: PageModel, pageInfo: PageInfoDTO) {
let currentPage = 1
let currentPage = pageModel.currentPage
let pageSize = 20
let listReviewDtoBean = await PageViewModel.getLiveReviewUrl(currentPage, pageSize) as LiveReviewDTO
Logger.error("ZZZXXXXX", 'getLiveReviewData---------'+listReviewDtoBean.list.length);
PageViewModel.getLiveReviewUrl(currentPage, pageSize).then((liveReviewDTO) => {
if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) {
pageModel.hasMore = false;
} else {
pageInfo.oneRequestPageGroupCompList.clear()
// 直接认为有分页,一直加载分页。直到没有数据,再停止
pageModel.currentPage++;
pageModel.hasMore = true;
let haveMoveContent = false
//获取当前页面最后一个组件
let lastIndex = pageModel.compList.totalCount() - 1
let lastComp = pageModel.compList.getData(lastIndex) as CompDTO
// 一行两图卡,需要从奇数 补齐成偶数内容
if (lastComp.compStyle == CompStyle.Card_Comp_Zh_Grid_Layout_02) {
let operLength = lastComp.operDataList.length
Logger.error("ZZZXXXXX", 'getLiveReviewData------1---operLength=' + operLength);
// 最后一个组件的业务数据是奇数,需要从获取更多的业务数据中补一个数据
if (operLength === 1) {
lastComp.operDataList.push(liveReviewDTO.list[0])
// 更新某个组件
pageModel.compList.updateItem(lastComp, lastIndex)
// 移走新获取的数据中第一条数据
liveReviewDTO.list.splice(0, 1)
}
}
this.createDoubleColumComp(liveReviewDTO, pageInfo)
// 统计页面的总的组件和稿件数量
pageModel.pageTotalCompSize = pageInfo.oneRequestPageGroupCompList.length + pageModel.pageTotalCompSize
//遍历所有组件和稿件数据 push到页面
for (let element of pageInfo.oneRequestPageGroupCompList) {
pageModel.compList.push(element)
}
// 批查直播观看人数
// if (haveMoveContent) {
// // 把当前获取到的直播回看数据
// liveReviewDTO.list.push(lastComp.operDataList[1])
// pageInfo.oneRequestPageGroupCompList.add(lastComp)
// }
// this.getLiveRoomDataInfo(liveReviewDTO.list, pageInfo.oneRequestPageGroupCompList)
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
})
}
/**
* 创建一行两图卡 自定义的业务稿件
* @param listReviewDtoBean
* @param pageInfo
*/
private async createDoubleColumComp(listReviewDtoBean: LiveReviewDTO, pageInfo: PageInfoDTO, test?: boolean) {
/*
两个业务 内容 配置一个comp
*/
let length = listReviewDtoBean.list.length
Logger.error("ZZZXXXXX", 'createDoubleColumComp------1---test=' + test + " length=" + length);
if (test) {
// 偶数变成奇数
if (length % 2 === 0) {
listReviewDtoBean.list.splice(length - 1, 1)
length = listReviewDtoBean.list.length
}
}
for (let i = 0; i < length; i = i + 2) {
let sliceArray: ContentDTO[]
let j = i + 2
if (j < length) {
sliceArray = listReviewDtoBean.list.slice(i, j)
} else {
sliceArray = listReviewDtoBean.list.slice(i)
}
// 创建一行两图卡 自定义的业务稿件
let doubleColumnLiveReviewComp = new CompDTO()
doubleColumnLiveReviewComp.compStyle = CompStyle.Card_Comp_Zh_Grid_Layout_02
let operDataList: ContentDTO[] = sliceArray
doubleColumnLiveReviewComp.operDataList = operDataList
pageInfo.oneRequestPageGroupCompList.add(doubleColumnLiveReviewComp)
}
}
}
... ...
... ... @@ -184,9 +184,8 @@ export struct DetailVideoListPage {
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
} else {
Column() {
}
Column() {
Swiper(this.swiperController) {
ForEach(this.data, (item: ContentDetailDTO, index: number) => {
DetailPlayShortVideoPage({
... ... @@ -220,6 +219,6 @@ export struct DetailVideoListPage {
// .padding({
// bottom: this.bottomSafeHeight + 'px'
// })
}
}
}
\ No newline at end of file
... ...
import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit';
import { window } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
import { ProcessUtils } from 'wdRouter';
/**
* 意图调用
*/
export default class InsightIntentExecutorImpl extends InsightIntentExecutor {
private static readonly ViewColumn = 'ViewColumn';
private static readonly ViewBlog = 'ViewBlog';
private static readonly ViewColumnUpdate = 'ViewColumnUpdate';
/**
* override 执行前台UIAbility意图
*
... ... @@ -17,10 +19,13 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor {
*/
onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage):
Promise<insightIntent.ExecuteResult> {
console.log('yzl onExecuteInUIAbilityForegroundMode',name,JSON.stringify(param))
// 根据意图名称分发处理逻辑
switch (name) {
case InsightIntentExecutorImpl.ViewColumn:
return this.jumpToView(param, pageLoader);
case InsightIntentExecutorImpl.ViewBlog:
return this.jumpToViewBlog(param, pageLoader);
case InsightIntentExecutorImpl.ViewColumnUpdate:
return this.jumpToViewColumnUpdate(param, pageLoader);
default:
break;
}
... ... @@ -32,18 +37,47 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor {
} as insightIntent.ExecuteResult)
}
/**
* 实现跳转新闻页面功能
*
* 实现习惯推荐功能
* @param param 意图参数
* @param pageLoader 窗口
*/
private jumpToView(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> {
private jumpToViewBlog(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> {
console.log('yzl jumpToView',JSON.stringify(param))
return new Promise((resolve, reject) => {
// TODO 实现意图调用,loadContent的入参为歌曲落地页路径,例如:pages/SongPage
pageLoader.loadContent('pages/MainPage')
.then(() => {
let entityId: string = (param.items as Array<object>)?.[0]?.['entityId'];
// TODO 调用成功的情况,此处可以打印日志
let entityGroupId: string = (param.items as Array<object>)?.[0]?.['entityGroupId'];
ProcessUtils.jumpChannelTab(entityGroupId,'')
resolve({
code: 0,
result: {
message: 'Intent execute success'
}
});
})
.catch((err: BusinessError) => {
resolve({
code: -1,
result: {
message: 'Intent execute failed'
}
})
});
})
}
/**
* 实现事件推荐功能
* @param param 意图参数
* @param pageLoader 窗口
*/
private jumpToViewColumnUpdate(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> {
console.log('yzl jumpToViewColum',JSON.stringify(param))
return new Promise((resolve, reject) => {
pageLoader.loadContent('pages/MainPage')
.then(() => {
// TODO 事件推荐调用
resolve({
code: 0,
result: {
... ... @@ -52,7 +86,6 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor {
});
})
.catch((err: BusinessError) => {
// TODO 调用失败的情况
resolve({
code: -1,
result: {
... ...
{
"insightIntents": [
{
"intentName": "ViewColumn",
"intentName": "ViewBlog",
"domain": "",
"intentVersion": "1.0.1",
"srcEntry": "./ets/utils/InsightIntentExecutorImpl.ets",
"uiAbility": {
"ability": "EntryAbility",
"executeMode": [
"background",
"foreground"
]
}
},
{
"intentName": "ViewColumnUpdate",
"domain": "",
"intentVersion": "1.0.1",
"srcEntry": "./ets/utils/InsightIntentExecutorImpl.ets",
... ...