陈剑华

Merge remote-tracking branch 'origin/main'

... ... @@ -33,8 +33,8 @@ export default struct MinePageUserSimpleInfoUI {
Stack(){
Image(this.headPhotoUrl)
.alt($r('app.media.default_head'))
.width('108lpx')
.height('108lpx')
.width('100lpx')
.height('100lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
Image(this.levelHead)
... ...
... ... @@ -18,7 +18,7 @@ export struct FollowFirstTabsComponent{
value.forEach((element)=>{
this.data.push(element)
})
console.log("ycg",this.data.length.toString());
if(this.controller != null && this.data.length>1 && this.changeIndex === 1){
//个人主页 跳转 关注页 tab 2
let intervalID = setInterval(() => {
... ...
... ... @@ -171,6 +171,7 @@ struct ChildComponent {
.fontSize('31lpx')
.lineHeight('38lpx')
.fontColor($r('app.color.color_222222'))
.maxLines(1)
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
... ...
... ... @@ -35,25 +35,45 @@ export struct FollowSecondTabsComponent{
@Builder FollowSecondUI(){
Row() {
Row(){
// 页签
Column({ space: 7 }) {
Scroll() {
Column() {
ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => {
this.TabBuilder(index,item)
})
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Top)
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.Off)
.height('100%')
}.height('100%')
.alignItems(HorizontalAlign.Center)
}
.alignItems(VerticalAlign.Top)
.height('100%')
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
ForEach(this.data[this.firstIndex].children, (item: FollowSecondListItem, index: number ) => {
TabContent(){
FollowThirdTabsComponent({data:$data,firstIndex:$firstIndex,secondIndex:index})
}.tabBar(this.TabBuilder(index,item))
}
.backgroundColor($r('app.color.white'))
}, (item: FollowListItem, index: number) => index.toString())
}
.vertical(true)
.barMode(BarMode.Scrollable)
.barWidth('140lpx')
.animationDuration(0)
.onChange((index: number) => {
this.currentIndex = index
})
.width('100%')
.barWidth(0)
.height('100%')
.layoutWeight(1)
}.width('100%')
.alignItems(VerticalAlign.Top)
.backgroundColor('#0FF')
}
@Builder TabBuilder(index: number, item: FollowSecondListItem) {
... ... @@ -73,6 +93,7 @@ export struct FollowSecondTabsComponent{
})
.justifyContent(FlexAlign.Center)
.height('84lpx')
.width('140lpx')
.backgroundColor(this.currentIndex === index?$r('app.color.white'):$r('app.color.color_F9F9F9'))
}
... ...
... ... @@ -34,19 +34,45 @@ export struct FollowThirdTabsComponent{
.lineHeight('38lpx')
.backgroundColor($r('app.color.color_F9F9F9'))
.padding('13lpx')
.maxLines(1)
}
.onClick(()=>{
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('100%')
.height('84lpx')
.margin({right:'9lpx'})
.padding({left:'20lpx',right:index === this.data[this.firstIndex].children[this.secondIndex].children.length-1?"20lpx":"0lpx"})
.justifyContent(FlexAlign.Center)
}
@Builder FollowThirdUI(){
Column(){
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => {
this.TabBuilder(index,item)
})
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'11lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.backgroundColor($r('app.color.white'))
.alignItems(HorizontalAlign.Start)
.width('100%')
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
ForEach(this.data[this.firstIndex].children[this.secondIndex].children, (item: FollowThirdListItem, index: number ) => {
TabContent(){
... ... @@ -58,20 +84,19 @@ export struct FollowThirdTabsComponent{
.margin({left:'20lpx'})
FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].children[this.secondIndex].children[index].id})
}
}.tabBar(this.TabBuilder(index,item))
}
.backgroundColor($r('app.color.white'))
}, (item: FollowListItem, index: number) => index.toString())
}
.barHeight(0)
.vertical(false)
.barMode(BarMode.Scrollable)
.barWidth('100%')
.barHeight('84lpx')
.animationDuration(0)
.onChange((index: number) => {
this.currentIndex = index
})
.width('100%')
}.width('100%')
}
}
}
\ No newline at end of file
... ...
import { Logger, DateTimeUtils, CollectionUtils } from 'wdKit';
import { CollectionUtils, DateTimeUtils, Logger } from 'wdKit';
import { CommonConstants, CompStyle, ViewType } from 'wdConstant';
import PageViewModel from '../../viewmodel/PageViewModel';
import { EmptyComponent } from '../view/EmptyComponent';
... ... @@ -14,7 +13,7 @@ import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { CompParser } from '../CompParser';
import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO';
import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
import { CompDTO, LiveReviewDTO, PageDTO ,PageInfoDTO} from 'wdBean';
import { CompDTO, LiveReviewDTO, PageDTO, PageInfoBean } from 'wdBean';
const TAG = 'PageComponent';
... ... @@ -158,6 +157,16 @@ export struct PageComponent {
this.pageModel.viewType = ViewType.EMPTY;
return;
}
if (this.navIndex === 0) {
await this.getVideoListData(pageInfo);
} else {
await this.getLiveListData(pageInfo);
}
}
private async getVideoListData(pageInfo: PageInfoBean) {
let groupInfo: GroupInfoDTO = CollectionUtils.getElement(pageInfo.groups, 0);
if (groupInfo != null) {
this.pageModel.isRecGroup = groupInfo.groupStrategy === 1;
... ... @@ -165,7 +174,89 @@ export struct PageComponent {
}
// pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
// for (const group of pageInfo.groups) {
this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this))
this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this));
this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString();
if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
this.pageDto.compList.forEach((comp) => {
if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) {
comp.operDataList.push(...this.liveReviewDTO.list);
}
});
this.pageModel.viewType = ViewType.LOADED;
this.pageModel.compList.push(...this.pageDto.compList);
if (this.pageDto.compList.length === this.pageModel.pageSize) {
this.pageModel.currentPage++;
this.pageModel.hasMore = true;
} else {
this.pageModel.hasMore = false;
}
// // 二次请求,批查互动数据
// PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => {
// // 刷新,替换所有数据
// this.pageModel.compList.replaceAll(...data)
// this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
// })
this.isFirstIn = false;
Logger.debug(TAG, 'cj111');
// } else {
// Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
// this.pageModel.viewType = ViewType.EMPTY;
// }
}
}
// private async getLiveListData(pageInfo: PageInfoBean) {
// // pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
// for (const group of pageInfo.groups) {
// this.pageDto = await PageViewModel.getPageData(this.pageModel, getContext(this));
// this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString();
// if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
// this.pageDto.compList.forEach((comp) => {
// if (comp.compStyle === CompStyle.Zh_Grid_Layout_02 && this.liveReviewDTO && this.liveReviewDTO.list && this.liveReviewDTO.list.length > 0) {
// comp.operDataList.push(...this.liveReviewDTO.list);
// }
// });
//
// this.pageModel.viewType = ViewType.LOADED;
// this.pageModel.compList.push(...this.pageDto.compList);
// if (this.pageDto.compList.length === this.pageModel.pageSize) {
// this.pageModel.currentPage++;
// this.pageModel.hasMore = true;
// } else {
// this.pageModel.hasMore = false;
// }
// // // 二次请求,批查互动数据
// // PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => {
// // // 刷新,替换所有数据
// // this.pageModel.compList.replaceAll(...data)
// // this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
// // })
// this.isFirstIn = false;
// Logger.debug(TAG, 'cj111');
// // } else {
// // Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
// // this.pageModel.viewType = ViewType.EMPTY;
// }
// }
// }
async getLiveListData(pageInfo: PageInfoBean) {
// Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
// this.pageModel.pageId = this.pageId;
// this.pageModel.groupId = this.pageId;
// this.pageModel.channelId = this.channelId;
// this.pageModel.currentPage = 1;
// let pageInfo = await PageViewModel.getPageUrlData(this.pageModel.pageId);
// if (pageInfo == null) {
// this.pageModel.viewType = ViewType.EMPTY;
// return;
// }
Logger.debug(TAG, 'getPageUrlData ' + pageInfo.id);
// pageInfo.groups.forEach(async (group) => { 不能按顺序加载用for...of替代
for (const group of pageInfo.groups) {
this.pageDto = await PageViewModel.getLivePageData(this.pageModel.pageId, `${group.id}`, this.pageModel.channelId, group.groupStrategy
, this.pageModel.currentPage, this.pageModel.pageSize, getContext(this))
this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
if (this.pageDto && this.pageDto.compList && this.pageDto.compList.length > 0) {
this.pageDto.compList.forEach((comp) => {
... ... @@ -189,12 +280,11 @@ export struct PageComponent {
this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
})
this.isFirstIn = false
// } else {
// Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
// this.pageModel.viewType = ViewType.EMPTY;
// }
} else {
Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
this.pageModel.viewType = ViewType.EMPTY;
}
}
}
async getPreviewData() {
... ...
import { SearchResultContentComponent } from './SearchResultContentComponent'
const TAG = "SearchResultComponent"
/**
... ... @@ -19,7 +20,7 @@ export struct SearchResultComponent{
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
ForEach(this.count, (item: string, index: number ) => {
TabContent(){
Text(item)
SearchResultContentComponent()
}.tabBar(this.TabBuilder(index,item))
}, (item: string, index: number) => index.toString())
}
... ... @@ -63,4 +64,5 @@ export struct SearchResultComponent{
.margin({right:'9lpx'})
.padding({left:'31lpx',right:index === this.count.length-1?"31lpx":"0lpx"})
}
}
\ No newline at end of file
... ...
const TAG = "SearchResultContentComponent"
@Component
export struct SearchResultContentComponent{
aboutToAppear(): void {
}
build() {
}
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@ import router from '@ohos.router'
import { Params } from 'wdBean';
import { StringUtils } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { CardParser } from '../components/CardParser';
import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent';
import MinePageDatasModel from '../model/MinePageDatasModel';
... ... @@ -182,14 +183,37 @@ struct MineHomePage {
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
Column(){
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
this.TabBuilder(0,"评论")
this.TabBuilder(1,"关注")
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'31lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.alignItems(HorizontalAlign.Start)
.width('100%')
//tab 页面
Tabs({controller: this.controller}) {
TabContent() {
HomePageBottomComponent({style:0})
}.tabBar(this.TabBuilder(0,"评论"))
}
TabContent() {
HomePageBottomComponent({style:1})
}.tabBar(this.TabBuilder(1,"关注"))
}
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
... ... @@ -197,6 +221,8 @@ struct MineHomePage {
this.currentIndex = index
})
.vertical(false)
.barHeight(0)
}
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
... ... @@ -206,8 +232,8 @@ struct MineHomePage {
}
}.width('100%')
.layoutWeight(1)
}
@Builder MineHomeTitleTransparent() {
RelativeContainer() {
//标题栏目
... ... @@ -342,9 +368,9 @@ struct MineHomePage {
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('100%')
.width('100%')
.margin({right:'9lpx'})
.height('77lpx')
.width('70lpx')
.margin({right:'29lpx'})
}
/**
... ...
... ... @@ -172,17 +172,42 @@ struct OtherNormalUserHomePage {
.width('100%')
.backgroundColor($r('app.color.white'))
}
//间隔符
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
Column(){
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
this.TabBuilder(0,"评论")
this.TabBuilder(1,"关注")
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'31lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.backgroundColor($r('app.color.white'))
.alignItems(HorizontalAlign.Start)
.width('100%')
//tab 页面
Tabs({controller: this.controller}) {
TabContent() {
OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum})
}.tabBar(this.TabBuilder(0,"评论"))
}
TabContent() {
OtherHomePageBottomFollowComponent({curUserId:this.curUserId})
}.tabBar(this.TabBuilder(1,"关注"))
}
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
... ... @@ -190,6 +215,8 @@ struct OtherNormalUserHomePage {
this.currentIndex = index
})
.vertical(false)
.barHeight(0)
}
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
... ... @@ -300,9 +327,9 @@ struct OtherNormalUserHomePage {
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('100%')
.width('100%')
.margin({right:'9lpx'})
.height('77lpx')
.width('70lpx')
.margin({right:'29lpx'})
}
... ...
... ... @@ -6,6 +6,7 @@ import {
CompInfoBean,
ContentDetailDTO,
ContentDTO,
contentListParams,
InteractDataDTO,
LiveReviewDTO,
MorningEveningPaperDTO,
... ... @@ -14,11 +15,10 @@ import {
NewspaperTimeInfoBean,
PageDTO,
PageInfoBean,
PageInfoDTO,
postBatchAttentionStatusParams,
postBatchAttentionStatusResult,
postExecuteCollectRecordParams,
contentListParams,
PageInfoDTO,
postExecuteLikeParams,
postInteractAccentionOperateParams,
postRecommendListParams
... ... @@ -48,10 +48,10 @@ export class PageRepository {
static getCompInfoUrl(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number, pageSize: number) {
let url = HttpUrlUtils.getHost();
if(1 == groupStrategy){
if (1 == groupStrategy) {
//推荐
url = url + HttpUrlUtils.COMP_REC_PATH;
}else{
} else {
//非推荐
url = url + HttpUrlUtils.COMP_PATH;
}
... ... @@ -194,8 +194,14 @@ export class PageRepository {
return WDHttp.get<ResponseDTO<PageInfoDTO>>(url, headers)
};
static fetchCompData(pageId: string, groupId: string, channelId: string,groupStrategy:number, currentPage: number, pageSize: number) {
let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId,groupStrategy, currentPage, pageSize)
static fetchLivePageData(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number, pageSize: number) {
let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId, groupStrategy, currentPage, pageSize)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageDTO>>(url, headers)
};
static fetchCompData(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number, pageSize: number) {
let url = PageRepository.getCompInfoUrl(pageId, groupId, channelId, groupStrategy, currentPage, pageSize)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageDTO>>(url, headers)
};
... ...
... ... @@ -7,11 +7,9 @@ import {
MorningEveningPaperDTO,
NavigationBodyDTO,
PageDTO,
PageInfoBean,
PageInfoDTO
PageInfoBean
} from 'wdBean';
import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit';
import { ResponseDTO, } from 'wdNetwork';
import { PageRepository } from '../repository/PageRepository';
... ... @@ -145,7 +143,36 @@ export class PageViewModel extends BaseViewModel {
async getPageData(pageModel: PageModel, context?: Context): Promise<PageDTO> {
Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId);
return this.parseComp(PageRepository.fetchCompData(pageModel.pageId, pageModel.groupId, pageModel.channelId, pageModel.isRecGroup==true?1:0,pageModel.currentPage, pageModel.pageSize))
return this.parseComp(PageRepository.fetchCompData(pageModel.pageId, pageModel.groupId, pageModel.channelId, pageModel.isRecGroup == true ? 1 : 0, pageModel.currentPage, pageModel.pageSize))
}
async getLivePageData(pageId: string, groupId: string, channelId: string, groupStrategy: number, currentPage: number
, pageSize: number, context: Context): Promise<PageDTO> {
Logger.debug(TAG, 'getPageData pageId: ' + pageId);
if (mock_switch) {
return this.getPageData1(currentPage, context);
}
return new Promise<PageDTO>((success, error) => {
PageRepository.fetchLivePageData(pageId, groupId, channelId, groupStrategy, currentPage, pageSize)
.then((resDTO: ResponseDTO<PageDTO>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getNavData then resDTO is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getNavData then code:${resDTO.code}, message:${resDTO.message}`);
error('resDTO Response Code is failure');
return
}
Logger.info(TAG, "getNavData then,resDTO.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getPageData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
private parseComp(getData: Promise<ResponseDTO<PageDTO>>): Promise<PageDTO> {
... ...
import { SearchResultContentItem } from './SearchResultContentItem'
@Observed
export class SearchResultContentData{
list:SearchResultContentItem[] = []
keyword:string = ""
pageNum: number = 0
pageSize: number = 20
totalCount: number = 0
}
\ No newline at end of file
... ...
import { ContentDTO } from 'wdBean/Index'
export interface SearchResultContentItem{
data:ContentDTO
resultType:string
}
\ No newline at end of file
... ...