chenjun

设置视频缓存https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/performance/p…

…erformance-quick-switch-short-video.md
import { AuthorListDTO, FullColumnImgUrlDTO, ReLInfoDTO, RmhInfoDTO, ShareInfoDTO,
UserInfoDTO,
VideoInfoDTO } from 'wdBean';
@Observed
export class ContentDetailModel{
newsId: number = 0;
newsTitle: string = "";
newsShortTitle: string= "";
newsDownTitle: string= "";
newsBodyTitle: string= "";
publishTime: string= "";
appstyle: number= 0;
newsType: number= 0;
newsSummary: string= "";
newsSource: string= "";
newsSourceName: string= "";
newsContent: string= "";
newsContentBak: string= "";
newsLinkUrl: string="";
bestNoticer: number= 0;
// newLinkObject?: any = null;
newIntroduction: string= "";
authorList: AuthorListDTO[]=[];
editorName: string="";
openAudio: number= 0;
// audioList: any[];
// hasPopUp?: any;
// popUps?: any[];
firstFrameImageUri: string= "";
reLInfo?: ReLInfoDTO | null = null;
fullColumnImgUrls: FullColumnImgUrlDTO[]=[];
shareInfo?: ShareInfoDTO | null = null;
// photoList: any[];
videoInfo: VideoInfoDTO[]=[];
// liveInfo?: any ;
// voteInfo?: any;
rmhInfo?: RmhInfoDTO | null = null;
userInfo?: UserInfoDTO | null = null;
openLikes: number= 0;
openComment: number= 0;
likesStyle: number= 0;
preCommentFlag: number= 0;
commentDisplay: number= 0;
keyArticle: number= 0;
rmhPlatform: number= 0;
readFlag?: number= 0;
// topicInfo?: any;
traceId: string= "";
itemId: string= "";
sceneId: string= "";
subSceneId: string= "";
// activityInfos: any[]=[];
recommendShow: number= 0;
visitorComment: number= 0;
itemTypeCode: string= "";
menuShow: number= 0;
newsTags: string= "";
// specialColumnId?: any;
specialColumnName: string= "";
// timeline?: any;
constructor(newsId: number, newsTitle: string, newsShortTitle: string, newsDownTitle: string, newsBodyTitle: string,
publishTime: string, appstyle: number, newsType: number, newsSummary: string, newsSource: string,
newsSourceName: string, newsContent: string, newsContentBak: string, newsLinkUrl: string, bestNoticer: number,
newIntroduction: string, authorList: AuthorListDTO[], editorName: string, openAudio: number,
firstFrameImageUri: string,fullColumnImgUrls: FullColumnImgUrlDTO[], videoInfo: VideoInfoDTO[],
openLikes: number, openComment: number, likesStyle: number, preCommentFlag: number,
commentDisplay: number, keyArticle: number, rmhPlatform: number, readFlag: number, traceId: string,
itemId: string, sceneId: string, subSceneId: string, recommendShow: number,
visitorComment: number, itemTypeCode: string, menuShow: number, newsTags: string,
specialColumnName: string, traceInfo: string, viewCount: number, isNewspaper: boolean, oldNewsId: string,
showTime: boolean, isLogin: string) {
this.newsId = newsId;
this.newsTitle = newsTitle;
this.newsShortTitle = newsShortTitle;
this.newsDownTitle = newsDownTitle;
this.newsBodyTitle = newsBodyTitle;
this.publishTime = publishTime;
this.appstyle = appstyle;
this.newsType = newsType;
this.newsSummary = newsSummary;
this.newsSource = newsSource;
this.newsSourceName = newsSourceName;
this.newsContent = newsContent;
this.newsContentBak = newsContentBak;
this.newsLinkUrl = newsLinkUrl;
this.bestNoticer = bestNoticer;
this.newIntroduction = newIntroduction;
this.authorList = authorList;
this.editorName = editorName;
this.openAudio = openAudio;
this.firstFrameImageUri = firstFrameImageUri;
this.fullColumnImgUrls = fullColumnImgUrls;
this.videoInfo = videoInfo;
this.openLikes = openLikes;
this.openComment = openComment;
this.likesStyle = likesStyle;
this.preCommentFlag = preCommentFlag;
this.commentDisplay = commentDisplay;
this.keyArticle = keyArticle;
this.rmhPlatform = rmhPlatform;
this.readFlag = readFlag;
this.traceId = traceId;
this.itemId = itemId;
this.sceneId = sceneId;
this.subSceneId = subSceneId;
this.recommendShow = recommendShow;
this.visitorComment = visitorComment;
this.itemTypeCode = itemTypeCode;
this.menuShow = menuShow;
this.newsTags = newsTags;
this.specialColumnName = specialColumnName;
this.traceInfo = traceInfo;
this.viewCount = viewCount;
this.isNewspaper = isNewspaper;
this.oldNewsId = oldNewsId;
this.showTime = showTime;
this.isLogin = isLogin;
}
traceInfo: string= "";
viewCount: number= 0;
isNewspaper: boolean = false;
oldNewsId: string= "";
// 本地字段
showTime:boolean = false;
isLogin?:string = ""
}
\ No newline at end of file
... ...
... ... @@ -9,7 +9,7 @@ import {
contentListParams,
getRecCompInfoParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { NetworkUtil, Logger, WindowModel, DateTimeUtils } from 'wdKit/Index';
import { NetworkUtil, Logger, WindowModel, DateTimeUtils, LazyDataSource } from 'wdKit/Index';
import { PictureLoading } from './PictureLoading';
import { DisplayDirection } from 'wdConstant/Index';
import { window } from '@kit.ArkUI';
... ... @@ -57,6 +57,7 @@ export struct VideoChannelDetail {
@Consume displayDirection: DisplayDirection
@Provide showCommentList: boolean = false
@State data: ContentDetailDTO[] = []
@State dataContentDetail: LazyDataSource<ContentDetailDTO> = new LazyDataSource();
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
@State totalCount: number = 0
... ... @@ -256,6 +257,7 @@ export struct VideoChannelDetail {
if (res.data) {
await this.getContentInteract(list2)
this.data = this.data.concat(res.data)
this.dataContentDetail.addItems(res.data)
}
console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data))
}).finally(() => {
... ... @@ -304,7 +306,8 @@ export struct VideoChannelDetail {
.visibility(this.isMouted ? Visibility.None : Visibility.Visible)
Swiper(this.swiperController) {
ForEach(this.data, (item: ContentDetailDTO, index: number) => {
// LazyForEach(this.data, (item: ContentDetailDTO, index: number) => {
LazyForEach(this.dataContentDetail, (item: ContentDetailDTO, index: number) => {
DetailPlayShortVideoPage({
contentDetailData: item,
currentIndex: this.currentIndex,
... ... @@ -314,6 +317,7 @@ export struct VideoChannelDetail {
}, (item: ContentDetailDTO) => item.newsId + '')
}
.displayCount(1, true)
.cachedCount(3)
.disableSwipe(this.displayDirection === DisplayDirection.VERTICAL || this.showCommentList ? false : true)
.visibility(this.isMouted ? Visibility.Visible : Visibility.Hidden)
.indicator(false)
... ...