lichengjun

Merge remote-tracking branch 'origin/main' into main

# Conflicts:
#	PeopleDaily_Harmony/wdComponent/src/main/ets/Index.ets
#	PeopleDaily_Harmony/wdComponent/src/main/ets/components/PageComponent.ets
#	PeopleDaily_Harmony/wdComponent/src/main/ets/repository/bean/ContentDTO.ets
Showing 96 changed files with 2944 additions and 657 deletions

Too many changes to show.

To preserve performance only 96 of 96+ files are displayed.

import { ColumnPageComponent } from 'wdComponent';
import { Logger } from 'wdKit';
const TAG = 'ColumnPage';
/**
* 二级栏目页面,显示展排数据(comp list)
*/
@Entry
@Component
struct ColumnPage {
aboutToAppear() {
Logger.info(TAG, `aboutToAppear `);
}
aboutToDisappear() {
Logger.info(TAG, 'aboutToDisappear');
}
onPageShow() {
Logger.info(TAG, 'onPageShow');
}
onPageHide() {
Logger.info(TAG, 'onPageHide');
}
onBackPress() {
Logger.info(TAG, 'onBackPress');
}
build() {
Column() {
// TODO 跳转获取id
ColumnPageComponent({ pageId: "20011", channelId: "2001"});
}
}
}
\ No newline at end of file
... ...
{
"src": [
"pages/Index",
"pages/MainPage"
"pages/MainPage",
"pages/ColumnPage"
]
}
\ No newline at end of file
... ...
... ... @@ -1636,4 +1636,4 @@
"requestId":"",
"success":true,
"timestamp":1702881464711
}
\ No newline at end of file
}
... ...
export { PageViewModel } from "./viewmodel/PageViewModel"
export { EmptyComponent } from "./components/EmptyComponent"
export { EmptyComponent } from "./components/view/EmptyComponent"
export { DemoPreviewerComponent } from "./components/DemoPreviewerComponent"
export { ErrorComponent } from "./components/view/ErrorComponent"
export { ErrorComponent } from "./components/ErrorComponent"
export { LoadingComponent } from "./components/view/LoadingComponent"
export { LoadingComponent } from "./components/LoadingComponent"
export { PageComponent } from "./components/page/PageComponent"
export { PageComponent } from "./components/PageComponent"
export { BottomNavigationComponent } from "./components/page/BottomNavigationComponent"
export { BottomNavigationComponent } from "./components/BottomNavigationComponent"
export { TopNavigationComponent } from "./components/page/TopNavigationComponent"
export { TopNavigationComponent } from "./components/TopNavigationComponent"
export { LabelComponent } from "./components/view/LabelComponent"
export { LabelComponent } from "./components/LabelComponent"
export { SmallVideoCardComponent } from "./components/view/SmallVideoCardComponent"
export { SmallVideoCardComponent } from "./components/SmallVideoCardComponent"
export { BannerComponent } from "./components/view/BannerComponent"
export { ColumnPageComponent } from "./components/page/ColumnPageComponent"
export { TriPicCardComponent } from "./components/TriPicCardComponent"
export { BigPicCardComponent } from "./components/BigPicCardComponent"
\ No newline at end of file
export { BigPicCardComponent } from "./components/BigPicCardComponent"
... ...
import { CommonConstants, CompStyle } from 'wdConstant';
import { CompDTO } from '../repository/bean/CompDTO';
import { BannerComponent } from './view/BannerComponent';
import { LabelComponent } from './view/LabelComponent';
import { TitleAbbrComponent } from './view/TitleAbbrComponent';
import { TitleAllComponent } from './view/TitleAllComponent';
import { HorizontalStrokeCardThreeTwoRadioForOneComponent } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import { HorizontalStrokeCardThreeTwoRadioForTwoComponent } from './view/HorizontalStrokeCardThreeTwoRadioForTwoComponent';
import { HorizontalStrokeCardThreeTwoRadioForMoreComponent } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
/**
* comp适配器.
*/
@Component
export struct CompParser {
compDTO: CompDTO = {} as CompDTO;
compIndex: number = 0;
build() {
this.componentBuilder(this.compDTO, this.compIndex);
}
@Builder
componentBuilder(compDTO: CompDTO, compIndex: number) {
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Title_Abbr_01) {
TitleAbbrComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Title_All_01) {
TitleAllComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) {
BannerComponent({ compDTO: compDTO })
} else {
// todo:组件未实现 / Component Not Implemented
Text(compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
}
\ No newline at end of file
... ...
import { CompDTO } from '../repository/bean/CompDTO';
import { ContentDTO } from '../repository/bean/ContentDTO';
const FULL_PARENT: string = '100%';
const COLUMNS_TEMPLATE_ONE: string = '1fr';
const COLUMNS_TEMPLATE_TWO: string = '1fr 1fr';
const COLUMNS_TEMPLATE_THREE: string = '1fr 1fr 1fr';
const COLUMNS_TEMPLATE_FOUR: string = '1fr 1fr 1fr 1fr';
const COLUMNS_TEMPLATE_SIX: string = '1fr 1fr 1fr 1fr 1fr 1fr';
const TAG = 'DemoPreviewerComponent';
/**
* xxxx 布局及功能说明
*
* 【查看ArkUI预览效果】在线参考文档:
* https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/previewer-0000001054328973-V3#section146052489820
*/
@Entry
@Component
export struct DemoPreviewerComponent {
@State compDTO: CompDTO = {
compStyle: 'compStyle3',
operDataList: [
{
title: 'title0',
description: "description0",
coverUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
} as ContentDTO,
{
title: 'title1 title1 title1 title1 title1 title1 title1 title1 title1',
description: "description1",
"coverUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240104/image/display/c4a9b526e0994d1bbd3ac8450f5cfc6c.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO,
{
title: 'title2',
description: "description2",
"coverUrl": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231206/image/live/bbe6d821e92b48919d90c7dadfd1f05a.jpg?x-oss-process=image/resize,l_850/auto-orient,1/quality,q_95/format,jpg",
} as ContentDTO,
{
title: 'title3',
description: "description3",
coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231109/image/live/102e6eb9356b4ef19405b04c1f6ff875.png?x-oss-process=image/resize,l_850/auto-orient,1/quality,q_95/format,jpg'
} as ContentDTO,
{
title: 'title4',
description: "description4",
"coverUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/62bdbbb35dbd45689e00790c81f04c4b.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO,
{
title: 'title5',
description: "description5",
"coverUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/f79bbaa5a33b4bd88176071c4f797ff6.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO,
{
title: 'title6',
description: "description6",
"coverUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/2c1d917009584ce2bb4a35cbb3a860a0.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO,
{
title: 'title7',
description: "description7",
"coverUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231222/image/display/117dc516ca5c42d5843c0d32050c9fc6.jpeg?x-oss-process=image/resize,w_240/quality,q_90/format,jpg",
} as ContentDTO,
{
title: 'title8',
description: "description8",
"coverUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231228/image/display/90a2db4077d44a1f887f068fc659d977.jpeg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO
]
} as CompDTO
aboutToAppear() {
// this.compDTO = {
// compStyle: 'compStyle3',
// operDataList: [
// {
// title: 'title0',
// description: "description0",
// coverUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
// } as ContentDTO
// ]
// } as CompDTO
this.compDTO.operDataList[0].title = 'title_first_0'
}
build() {
Grid() {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
GridItem() {
this.gridItemView(item, index)
}
}, (item: ContentDTO, index: number) => JSON.stringify(item))
}
.height(FULL_PARENT)
.margin({ top: 10, bottom: 10, left: $r('app.float.main_margin'), right: $r('app.float.main_margin') })
.columnsTemplate(COLUMNS_TEMPLATE_TWO)
.columnsGap(4)
.rowsGap(2)
}
/**
* 布局描述
*
* @param ContentDTO item 组件项
* @param index
*/
@Builder
gridItemView(item: ContentDTO, index: number) {
Column() {
Image(item.coverUrl)
.width(FULL_PARENT)// .aspectRatio(3 / 4) // 宽/高比:纵向
// .aspectRatio(1 / 1) // 宽/高比:正方形
.aspectRatio(16 / 9)// 宽/高比:横向
.margin({ top: 8 })
.borderRadius(10)
Text(item.title)
.width(FULL_PARENT)
.margin({ top: 4, left: 2, right: 2, bottom: 4 })
.backgroundColor(Color.White)
.fontWeight(FontWeight.Bold)// .textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.fontColor('#808080')
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.width(FULL_PARENT)
.backgroundColor(Color.Yellow)
.justifyContent(FlexAlign.Center)
.onClick(() => {
console.info(TAG, `gridItemView onClick, index: ${index}`);
// MGRouterRule.jumpWithAction(item.action)
})
}
}
\ No newline at end of file
... ...
import { CommonConstants } from 'wdConstant';
import { CompDTO } from '../repository/bean/CompDTO';
import { CompUtils } from '../utils/CompUtils';
@Component
export struct HeadPictureCardComponent {
@State compDTO: CompDTO = {} as CompDTO
build() {
Stack() {
Image(this.compDTO.backgroundImgUrl)
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
Row()
.width(CommonConstants.FULL_WIDTH)
.height(59)
.linearGradient({
colors:[
['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]
]
})
Row() {
Text(CompUtils.getLabelTitle(this.compDTO.extraData))
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.fontColor(Color.White)
.fontSize($r('app.float.normal_text_size'))
.fontWeight(FontWeight.Bold)
}
.height(25)
.margin({left: 12, bottom: 10, right: 12})
}
.alignContent(Alignment.Bottom)
}
}
... ...
import { CommonConstants, CompStyle, ViewType } from 'wdConstant';
import { LazyDataSource, Logger } from 'wdKit';
import { CompDTO } from '../repository/bean/CompDTO';
import PageViewModel from '../viewmodel/PageViewModel';
import { EmptyComponent } from './EmptyComponent';
import { ErrorComponent } from './ErrorComponent';
import { LabelComponent } from './LabelComponent';
import { LoadingComponent } from './LoadingComponent';
import { TitleAbbrComponent } from './TitleAbbrComponent';
import { TitleAllComponent } from './TitleAllComponent';
import { BigPicCardComponent } from './BigPicCardComponent';
import { TriPicCardComponent } from './TriPicCardComponent';
const TAG = 'PageComponent';
@Component
export struct PageComponent {
@State viewType: number = ViewType.LOADED;
// Group数据及子组件数据
@State compList: LazyDataSource<CompDTO> = new LazyDataSource();
@State currentTopNavSelectedIndex: number = 0;
@State pageId: string = "";
@State channelId: string = "";
// @Link @Watch('onChange') paIndex:number
build() {
if (this.viewType == ViewType.LOADING) {
LoadingComponent()
} else if (this.viewType == ViewType.ERROR) {
ErrorComponent()
} else if (this.viewType == ViewType.EMPTY) {
EmptyComponent()
} else {
List() {
LazyForEach(this.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
Column() {
this.componentBuilder(compDTO, compIndex)
}
}
})
}
.cachedCount(5)
.height(CommonConstants.FULL_PARENT)
}
}
@Builder
componentBuilder(compDTO: CompDTO, compIndex: number) {
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Title_Abbr_01) {
TitleAbbrComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Title_All_01) {
TitleAllComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === "2") {
BigPicCardComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === "4") {
TriPicCardComponent({ compDTO: compDTO })
} else {
// todo:组件未实现 / Component Not Implemented
Text(compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
async aboutToAppear() {
Logger.info(TAG, `aboutToAppear, this.pageId: ${this.viewType} this.currentTopNavSelectedIndex: ${this.currentTopNavSelectedIndex}`);
// if (this.currentTopNavSelectedIndex === 1) { // 顶导tab的第0个item是【热点】,第1个item是【推荐】
// this.compList.replaceAll()
// let pageDto = await PageViewModel.getPageData2(getContext(this))
// if (pageDto && pageDto.compList) {
// this.compList.push(...pageDto.compList)
// }
// } else {
// let pageDto = await PageViewModel.getPageData1(getContext(this))
// if (pageDto && pageDto.compList) {
// this.compList.push(...pageDto.compList)
// }
// }
// if (this.currentTopNavSelectedIndex != 1) { // 顶导tab的第0个item是【热点】,第1个item是【推荐】
// return
// }
Logger.debug(TAG,'lllllalalal: ' + this.pageId+' , ' + this.channelId);
let pageDto = await PageViewModel.getPageData(this.pageId, this.pageId, this.channelId)
if (pageDto && pageDto.compList) {
this.compList.push(...pageDto.compList)
}
}
}
import { BottomNavi, CommonConstants } from 'wdConstant';
import { Logger } from 'wdKit';
import { TopNavigationComponent } from './TopNavigationComponent';
import { BottomNavDTO } from '../repository/bean/BottomNavDTO';
import { UIUtils } from '../repository/UIUtils';
import { BottomNavDTO } from '../../repository/bean/BottomNavDTO';
import { UIUtils } from '../../repository/UIUtils';
import { MinePageComponent } from './MinePageComponent';
import PageViewModel from '../viewmodel/PageViewModel';
import PageViewModel from '../../viewmodel/PageViewModel';
const TAG = 'BottomNavigationComponent';
... ... @@ -31,7 +31,7 @@ export struct BottomNavigationComponent {
async aboutToAppear() {
Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
let bottomNav = await PageViewModel.getBottomNavData()
let bottomNav = await PageViewModel.getBottomNavData(getContext(this))
if (bottomNav && bottomNav.bottomNavList != null) {
Logger.info(TAG, `aboutToAppear, bottomNav.length: ${bottomNav.bottomNavList.length}`);
this.bottomNavList = bottomNav.bottomNavList
... ...
import { PageComponent } from './PageComponent';
const TAG = 'ColumnPageComponent';
/**
* 二级栏目页面,展排数据
*/
@Component
export struct ColumnPageComponent {
@State currentTopNavSelectedIndex: number = 0;
pageId: string = "";
channelId: string = "";
build() {
PageComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: this.currentTopNavSelectedIndex,
pageId: this.pageId,
channelId: this.channelId,
});
}
}
... ...
import { RefreshConstants } from '../../utils/RefreshConstants';
import { RefreshLayoutBean } from './RefreshLayoutBean';
/**
* Custom layout to show refresh or load.
*/
@Component
export default struct CustomLayout {
@ObjectLink refreshBean: RefreshLayoutBean;
build() {
Row() {
Image(this.refreshBean.imageSrc)
.width(RefreshConstants.RefreshLayout_IMAGE_WIDTH)
.height(RefreshConstants.RefreshLayout_IMAGE_HEIGHT)
Text(this.refreshBean.textValue)
.margin({
left: RefreshConstants.RefreshLayout_TEXT_MARGIN_LEFT,
bottom: RefreshConstants.RefreshLayout_TEXT_MARGIN_BOTTOM
})
.fontSize(RefreshConstants.RefreshLayout_TEXT_FONT_SIZE)
.textAlign(TextAlign.Center)
}
.clip(true)
.width(RefreshConstants.FULL_WIDTH)
.justifyContent(FlexAlign.Center)
.height(this.refreshBean.heightValue)
}
}
\ No newline at end of file
... ...
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { RefreshLayoutBean } from './RefreshLayoutBean';
/**
* The load more layout component.
*/
@Component
export default struct LoadMoreLayout {
@ObjectLink refreshBean: RefreshLayoutBean;
build() {
Column() {
if (this.refreshBean.isVisible) {
CustomRefreshLoadLayout({
refreshBean: new RefreshLayoutBean(this.refreshBean.isVisible,
this.refreshBean.imageSrc, this.refreshBean.textValue, this.refreshBean.heightValue)
})
} else {
CustomRefreshLoadLayout({
refreshBean: new RefreshLayoutBean(this.refreshBean.isVisible,
this.refreshBean.imageSrc, this.refreshBean.textValue, 0)
})
}
}
}
}
\ No newline at end of file
... ...
import { RefreshConstants } from '../../utils/RefreshConstants'
/**
* The No more data layout component.
*/
@Component
export default struct NoMoreLayout {
build() {
Row() {
Text($r('app.string.footer_text'))
.margin({ left: RefreshConstants.NoMoreLayoutConstant_NORMAL_PADDING })
.fontSize(RefreshConstants.NoMoreLayoutConstant_TITLE_FONT)
.textAlign(TextAlign.Center)
}
.width(RefreshConstants.FULL_WIDTH)
.justifyContent(FlexAlign.Center)
.height(RefreshConstants.CUSTOM_LAYOUT_HEIGHT)
}
}
\ No newline at end of file
... ...
import { CommonConstants, ViewType } from 'wdConstant';
import { Logger } from 'wdKit';
import { CompDTO } from '../../repository/bean/CompDTO';
import PageViewModel from '../../viewmodel/PageViewModel';
import { EmptyComponent } from '../view/EmptyComponent';
import { ErrorComponent } from '../view/ErrorComponent';
import PageModel from '../../viewmodel/PageModel';
import { listTouchEvent } from '../../utils/PullDownRefresh';
import RefreshLayout from './RefreshLayout';
import { RefreshLayoutBean } from './RefreshLayoutBean';
import NoMoreLayout from './NoMoreLayout';
import LoadMoreLayout from './LoadMoreLayout';
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { CompParser } from '../CompParser';
const TAG = 'PageComponent';
@Component
export struct PageComponent {
@State private pageModel: PageModel = new PageModel();
navIndex: number = 0;
pageId: string = "";
channelId: string = "";
@Link @Watch('onChange') currentTopNavSelectedIndex: number
build() {
Column() {
if (this.pageModel.viewType == ViewType.LOADING) {
// LoadingComponent()
this.LoadingLayout()
} else if (this.pageModel.viewType == ViewType.ERROR) {
ErrorComponent()
} else if (this.pageModel.viewType == ViewType.EMPTY) {
EmptyComponent()
} else {
this.ListLayout()
}
}
.width(CommonConstants.FULL_PARENT)
.height(CommonConstants.FULL_PARENT)
.onTouch((event: TouchEvent | undefined) => {
if (event) {
if (this.pageModel.viewType === ViewType.LOADED) {
listTouchEvent(this.pageModel, event);
}
}
})
}
@Builder ListLayout() {
List() {
// 下拉刷新
ListItem() {
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
})
}
LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
Column() {
CompParser({ compDTO: compDTO, compIndex: compIndex });
}
}
})
// 加载更多
ListItem() {
if (this.pageModel.hasMore) {
LoadMoreLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,
this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
})
} else {
NoMoreLayout()
}
}
}
.cachedCount(5)
.height(CommonConstants.FULL_PARENT)
.onScrollIndex((start: number, end: number) => {
// Listen to the first index of the current list.
this.pageModel.startIndex = start;
// 包含了 头尾item,判断时需要考虑+2
this.pageModel.endIndex = end;
})
}
@Builder LoadingLayout() {
CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight) })
}
async aboutToAppear() {
// 选中tab,才请求数据。拦截大量接口请求
if (this.navIndex === this.currentTopNavSelectedIndex) {
this.getData();
}
}
onChange() {
if (this.navIndex === this.currentTopNavSelectedIndex) {
this.getData();
}
}
async getData() {
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 pageDto = await PageViewModel.getPageData(this.pageModel.pageId, this.pageModel.pageId, this.pageModel.channelId
, this.pageModel.currentPage, this.pageModel.pageSize, getContext(this))
if (pageDto && pageDto.compList && pageDto.compList.length > 0) {
this.pageModel.viewType = ViewType.LOADED;
this.pageModel.compList.push(...pageDto.compList)
if (pageDto.compList.length === this.pageModel.pageSize) {
this.pageModel.currentPage++;
this.pageModel.hasMore = true;
} else {
this.pageModel.hasMore = false;
}
} else {
Logger.debug(TAG, 'aboutToAppear, data response page ' + this.pageId + ', comp list is empty.');
this.pageModel.viewType = ViewType.EMPTY;
}
}
}
... ...
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { RefreshLayoutBean } from './RefreshLayoutBean';
/**
* The refresh layout component.
*/
@Component
export default struct RefreshLayout {
@ObjectLink refreshBean: RefreshLayoutBean;
build() {
Column() {
if (this.refreshBean.isVisible) {
CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean
(this.refreshBean.isVisible, this.refreshBean.imageSrc, this.refreshBean.textValue,
this.refreshBean.heightValue) })
}
}
}
}
\ No newline at end of file
... ...
/**
* Custom refresh load layout data.
*/
@Observed
export class RefreshLayoutBean {
/**
* Custom refresh load layout isVisible.
*/
isVisible: boolean;
/**
* Custom refresh load layout imageSrc.
*/
imageSrc: Resource;
/**
* Custom refresh load layout textValue.
*/
textValue: Resource;
/**
* Custom refresh load layout heightValue.
*/
heightValue: number;
constructor(isVisible: boolean, imageSrc: Resource, textValue: Resource, heightValue: number) {
this.isVisible = isVisible;
this.imageSrc = imageSrc;
this.textValue = textValue;
this.heightValue = heightValue;
}
}
\ No newline at end of file
... ...
import { LazyDataSource, Logger } from 'wdKit';
import { CompDTO } from '../repository/bean/CompDTO';
import { TopNavDTO } from '../repository/bean/TopNavDTO';
import { CompDTO } from '../../repository/bean/CompDTO';
import { TopNavDTO } from '../../repository/bean/TopNavDTO';
import { PageComponent } from './PageComponent';
const TAG = 'TopNavigationComponent';
... ... @@ -21,7 +21,12 @@ export struct TopNavigationComponent {
Tabs() {
ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => {
TabContent() {
PageComponent({ currentTopNavSelectedIndex: index, pageId: navItem.pageId, channelId: navItem.channelId })
PageComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
pageId: navItem.pageId,
channelId: navItem.channelId
})
}
.tabBar(this.tabBarBuilder(navItem, index))
}, (navItem: TopNavDTO) => JSON.stringify(navItem));
... ...
/**
* BannerComponent
* 轮播图卡/单图
* 邢照杰
*/
import { CommonConstants } from 'wdConstant';
import colorSpaceManager from '@ohos.graphics.colorSpaceManager';
import { CompDTO } from '../../repository/bean/CompDTO';
import { CompUtils } from '../../utils/CompUtils';
import { ContentDTO } from '../../repository/bean/ContentDTO';
const TAG = 'BannerComponent';
let timerIds: number[] = [];
/**
* 轮播卡(暂时仅展示主标题,不展示子标题)
* comp类型
* 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/
*/
@Entry
@Component
export struct BannerComponent {
@State compDTO: CompDTO = {} as CompDTO
@State index: number = 0;
private bannerContent:ContentDTO;
private swiperController: SwiperController = new SwiperController();
aboutToAppear() {
// Data Initialization.
this.bannerContent = this.compDTO.operDataList[0];
// Turn on scheduled task.
if (this.compDTO.operDataList.length > 1) {
startPlay(this.swiperController);
}
}
aboutToDisappear() {
stopPlay();
}
build() {
// 整体父视图
Column() {
// 判断数组元素个数
if (this.compDTO.operDataList.length > 1) {
// 滚动banner
Swiper(this.swiperController) {
ForEach(this.compDTO.operDataList, item => {
Stack() {
// 背景图
Image(item.coverUrl)
.objectFit(ImageFit.Fill)
.borderRadius(5)
// 底部标题和时间
Column() {
Text(item.description)
.fontSize(18)
.margin({ bottom: 4 })
.fontColor(Color.White)
.fontWeight(600)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.padding({ left: 10, right: 5 })
.width('100%')
.textAlign(TextAlign.Start)
if (item.lengthTime) {
Row() {
Image($r('app.media.videoTypeIcon'))
.height(20)
.width(20)
// .margin({right:3})
Text(item.lengthTime)
.padding({ left: 5, right: 5 })
.fontColor(Color.White)
}
.backgroundColor('#333333')
.height(20)
.margin({ right: 5, bottom: 3 })
.alignSelf(ItemAlign.End)
.borderRadius(2)
}
}
.height('50')
.width('100%')
}
.alignContent(Alignment.BottomStart)
}, item => JSON.stringify(item))
}
.width('100%')
.height('100%')
.index(this.index)
.indicatorStyle({
selectedColor: Color.White,
color: Color.Gray,
size: 18,
left: 15
})
.indicator(true)
.duration(500)
} else {
// 不滚动banner
Stack() {
// 背景图
Image(this.bannerContent.coverUrl.toString())
.objectFit(ImageFit.Fill)
.borderRadius(5)
// 底部标题和时间
Row() {
// 标题
Text(this.bannerContent.description.toString())
.fontSize(18)
.fontColor(Color.White)
.fontWeight(600)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.padding({ left: 10, right: 0 ,bottom: 5 })
.width('80%')
// 时间
if (this.bannerContent.lengthTime) {
Row() {
Image($r('app.media.videoTypeIcon'))
.height(20)
.width(20)
// .margin({right:3})
Text(this.bannerContent.lengthTime.toString())
.padding({ left: 5, right: 5 })
.fontColor(Color.White)
}
.backgroundColor('#333333')
.height(20)
.borderRadius(2)
.margin({ bottom: 6 })
}
}
.width('100%')
.height('100%')
.alignItems(VerticalAlign.Bottom)
}
.alignContent(Alignment.BottomStart)
.width('100%')
.height('100%')
}
}
.width('100%')
.aspectRatio(1.7)
.padding({left:10,right:15,top:10,bottom:10})
}
}
/**
* start scheduled task.
*
* @param swiperController Controller.
*/
export function startPlay(swiperController: SwiperController) {
let timerId = setInterval(() => {
swiperController.showNext();
}, 3000);
timerIds.push(timerId);
}
/**
* stop scheduled task.
*/
export function stopPlay() {
timerIds.forEach((item) => {
clearTimeout(item);
})
}
\ No newline at end of file
... ...
... ... @@ -46,7 +46,7 @@ export struct EmptyComponent {
Text(this.buildNoDataTip())
.fontSize($r('app.float.normal_text_size'))
.fontColor('#B2B2B2')
.fontColor('#000000')
.fontWeight(FontWeight.Normal)
.opacity(this.TEXT_OPACITY)
.margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP })
... ...
import { CommonConstants } from 'wdConstant'
import { CompDTO } from '../../repository/bean/CompDTO'
@Component
export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
@State compDTO: CompDTO = {} as CompDTO
private arr: number[] = [0, 1, 2]
build() {
Column() {
Row() {
Row() {
Image($r("app.media.redLine"))
.width(3)
.height(16)
.margin({ right: 4 })
Text("大标题")
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
}
Row() {
Text("更多")
.fontSize($r("app.float.font_size_14"))
.fontColor($r("app.color.color_999999"))
.margin({ right: 1 })
Image($r("app.media.more"))
.width(14)
.height(14)
}
}.justifyContent(FlexAlign.SpaceBetween)
.padding({left:16,right:16})
.margin({top:8 ,bottom:8})
.width('100%')
// .backgroundColor($r("app.color.white"))
List({ space: 12 }) {
ForEach(this.arr, (item: number) => {
ListItem() {
Column() {
Image($r("app.media.setting"))
.aspectRatio(1.5)
.width(150)
.borderRadius(4)
.objectFit(ImageFit.Cover)
Text("大发大法师法师打发大水发生发大水发大水发大发大法师法师打发大水发生发大水发大水发大发大法师法师打发大水发生发大水发大水发")
.fontSize($r("app.float.font_size_14"))
.fontColor($r("app.color.color_212228"))
.fontWeight(400)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textAlign(TextAlign.Start)
.margin({ top: 8 })
.width(150)
}
}
.padding({left:(item == 0)? 16:0, right:(item == this.arr.length - 1) ? 16:0})
// .offset({x:16})
}, item => item)
}.listDirection(Axis.Horizontal)
.width('100%')
// .backgroundColor($r("app.color.color_FE4B05"))
// .padding({left:16,right:16})
// .margin({left:16,right:16})
}
.width("100%")
.padding({
top: 14,
left: 0,
right: 0,
bottom: 14
})
.backgroundColor($r("app.color.white"))
// .backgroundColor($r("app.color.color_FE4B05"))
.margin({ bottom: 8 })
}
}
... ...
import { CommonConstants } from 'wdConstant'
import { CompDTO } from '../../repository/bean/CompDTO'
@Component
export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
@State compDTO: CompDTO = {} as CompDTO
build() {
Column() {
Row() {
Row() {
Image($r("app.media.redLine"))
.width(3)
.height(16)
.margin({ right: 4 })
Text("大标题")
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
}
Row() {
Text("更多")
.fontSize($r("app.float.font_size_14"))
.fontColor($r("app.color.color_999999"))
.margin({ right: 1 })
Image($r("app.media.more"))
.width(14)
.height(14)
}
}.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 8 ,bottom: 8})
.width('100%')
Image($r("app.media.setting"))
.aspectRatio(1.5)
.width('100%')
.borderRadius(4)
.objectFit(ImageFit.Cover)
Text("大发大法师法师打发大水发生发大水发大水发大发大法师法师打发大水发生发大水发大水发大发大法师法师打发大水发生发大水发大水发")
.fontSize($r("app.float.font_size_14"))
.fontColor($r("app.color.color_212228"))
.fontWeight(400)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textAlign(TextAlign.Start)
.margin({ top: 8 })
.width('100%')
}.width("100%")
.padding({
top: 14,
left: 16,
right: 16,
bottom: 14
})
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
}
}
\ No newline at end of file
... ...
import { CommonConstants } from 'wdConstant'
import { CompDTO } from '../../repository/bean/CompDTO'
@Component
export struct HorizontalStrokeCardThreeTwoRadioForTwoComponent {
@State compDTO: CompDTO = {} as CompDTO
private arr: number[] = [0, 1, 2]
build() {
Column() {
Row() {
Row() {
Image($r("app.media.redLine"))
.width(3)
.height(16)
.margin({ right: 4 })
Text("大标题")
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
}
Row() {
Text("更多")
.fontSize($r("app.float.font_size_14"))
.fontColor($r("app.color.color_999999"))
.margin({ right: 1 })
Image($r("app.media.more"))
.width(14)
.height(14)
}
}.justifyContent(FlexAlign.SpaceBetween)
.padding({left:16,right:16})
.margin({top:8 ,bottom:8})
.width('100%')
// .backgroundColor($r("app.color.white"))
List({ space: 12 }) {
ForEach(this.arr, (item: number) => {
ListItem() {
Column() {
Image($r("app.media.setting"))
.aspectRatio(1.5)
.width(210)
.borderRadius(4)
.objectFit(ImageFit.Cover)
Text("大发大法师法师打发大水发生发大水发大水发大发大法师法师打发大水发生发大水发大水发大发大法师法师打发大水发生发大水发大水发")
.fontSize($r("app.float.font_size_14"))
.fontColor($r("app.color.color_212228"))
.fontWeight(400)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textAlign(TextAlign.Start)
.margin({ top: 8 })
.width(210)
}
}
.padding({left:(item == 0)? 16:0, right:(item == this.arr.length - 1) ? 16:0})
// .offset({x:16})
}, item => item)
}.listDirection(Axis.Horizontal)
.width('100%')
// .backgroundColor($r("app.color.color_FE4B05"))
// .padding({left:16,right:16})
// .margin({left:16,right:16})
}
.width("100%")
.padding({
top: 14,
left: 0,
right: 0,
bottom: 14
})
.backgroundColor($r("app.color.white"))
// .backgroundColor($r("app.color.color_FE4B05"))
.margin({ bottom: 8 })
}
}
... ...
import { CommonConstants } from 'wdConstant';
import { CompDTO } from '../repository/bean/CompDTO';
import { CompUtils } from '../utils/CompUtils';
import { CompDTO } from '../../repository/bean/CompDTO';
import { CompUtils } from '../../utils/CompUtils';
const TAG = 'LabelComponent';
... ...
import { CommonConstants } from 'wdConstant/src/main/ets/constants/CommonConstants'
// import { CommonConstants } from 'wdConstant/src/main/ets/constants/CommonConstants'
@Entry
@Component
... ... @@ -57,7 +57,8 @@ export struct SmallVideoCardComponent {
.backgroundColor($r('app.color.color_4d000000'))
}
}
.width(CommonConstants.FULL_WIDTH)
// .width(CommonConstants.FULL_WIDTH)
.width('100%')
.height(184)
.padding({
top: 14,
... ...
//缩略标题
import { CommonConstants } from 'wdConstant'
import { CompDTO } from '../repository/bean/CompDTO'
import { CompDTO } from '../../repository/bean/CompDTO'
@Component
export struct TitleAbbrComponent {
... ...
//全标题 "compStyle":"3",
import { CommonConstants } from 'wdConstant'
import { CompDTO } from '../repository/bean/CompDTO'
import { CompDTO } from '../../repository/bean/CompDTO'
@Component
export struct TitleAllComponent {
... ...
export class ContentConstants {
/* content#objectType,跳转类型:0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14动态图文,15动态视频 */
/**
* 0:不跳转
*/
static readonly TYPE_NONE: string = "0";
/**
* 1:点播
*/
static readonly TYPE_VOD: string = "1";
/**
* 8:图文详情,这里是h5页面
*/
static readonly TYPE_TELETEXT: string = "8";
}
\ No newline at end of file
... ...
... ... @@ -18,6 +18,10 @@ export class HttpUrlUtils {
* 展现comp接口
*/
static readonly COMP_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo";
/**
* 详情页面详情接口
*/
static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail";
static getCommonHeaders(): HashMap<string, string> {
let headers: HashMap<string, string> = new HashMap<string, string>()
... ... @@ -46,7 +50,12 @@ export class HttpUrlUtils {
// TODO 判断是否登录
headers.set('userId', this.getUserId())
headers.set('userType', this.getUserType())
Logger.debug("TAG", 'getCommonHeaders headers: ' + headers);
// Logger.debug("TAG", '******************* commonHeaders headers start ******************************** ');
// headers.forEach((v,k)=>{
// Logger.debug("TAG", 'getCommonHeaders header: ' + k + ': ' + v);
// })
// Logger.debug("TAG", '******************* commonHeaders headers end ******************************** ');
return headers;
}
... ... @@ -55,21 +64,32 @@ export class HttpUrlUtils {
return this.HOST + this.BOTTOM_NAV_PATH;
}
static getCompInfoUrl(pageId: string, groupId: string, channelId: string) {
static getCompInfoUrl(pageId: string, groupId: string, channelId: string, currentPage: number
, pageSize: number) {
let url = this.HOST + this.COMP_PATH;
// TODO 暂定只请求第一页,后续对接分页加载,参数再调整
url = url + "?channelStrategy=2&pageSize=20&pageNum=1&loadStrategy=first_load"
// TODO 暂定只请求第一页,后续对接分页加载,参数再调整 first_load?
url = url + "?channelStrategy=2&loadStrategy=first_load"
+ "&districtCode=" + this.getDistrictCode()
+ "&provinceCode=" + this.getProvinceCode()
+ "&cityCode=" + this.getCityCode()
// + "&refreshTime=" + DateTimeUtils.getCurrentTimeMillis()
+ "&refreshTime=" + "1703472405653"
+ "&refreshTime=" + DateTimeUtils.getCurrentTimeMillis()
+ "&pageId=" + pageId
+ "&groupId=" + groupId
+ "&channelId=" + channelId;
+ "&channelId=" + channelId
+ "&pageSize=" + pageSize
+ "&pageNum=" + currentPage;
// Logger.debug("TAG", 'getCompInfoUrl url: '+url);
return url;
}
static getDetailInfoUrl(relId: string, contentId: string, relType: string) {
let url = this.HOST + this.DETAIL_PATH;
url = url + "?relId=" + relId
+ "&contentId=" + contentId
+ "&relType=" + relType;
// Logger.debug("TAG", 'getCompInfoUrl url: '+url);
return url;
}
private static getCity() {
// TODO 对接定位
... ... @@ -87,6 +107,7 @@ export class HttpUrlUtils {
private static getTimestamp() {
// return DateTimeUtils.getCurrentTime() + '';
// TODO 暂时写死,有些page 真实时间戳 返回数据为空
return '155203523';
}
... ...
... ... @@ -11,9 +11,16 @@ export class PageRepository {
return WDHttp.get<ResponseDTO<NavigationBodyDTO>>(url, headers)
};
static fetchPageData(pageId: string, groupId: string, channelId: string) {
let url = HttpUrlUtils.getCompInfoUrl(pageId, groupId, channelId)
static fetchPageData(pageId: string, groupId: string, channelId: string, currentPage: number
, pageSize: number) {
let url = HttpUrlUtils.getCompInfoUrl(pageId, groupId, channelId, currentPage, pageSize)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageDTO>>(url, headers)
};
static fetchDetailData(relId: string, contentId: string, relType: string) {
let url = HttpUrlUtils.getDetailInfoUrl(relId, contentId, relType)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<string>>(url, headers)
};
}
\ No newline at end of file
... ...
export interface AuthorListDTO {
authorName: string;
}
... ...
import { FullColumnImgUrlsDTO } from './FullColumnImgUrlsDTO';
export interface ContentDTO {
cityCode: string;
coverSize: string;
... ... @@ -11,7 +10,7 @@ export interface ContentDTO {
heatValue: string;
innerUrl: string;
landscape: number;
// lengthTime?: any;
lengthTime?: any;
linkUrl: string;
openLikes: number;
openUrl: string;
... ... @@ -35,6 +34,11 @@ export interface ContentDTO {
vImageUrl: string;
screenType: string;
source:string;
objectId:string;
objectType:string;
channelId:string;
relId:string;
relType:string;
newsTitle:string;
publishTime:string;
fullColumnImgUrls:FullColumnImgUrlsDTO[];
... ...
import { AuthorListDTO } from './AuthorListDTO';
import { FullColumnImgUrlDTO } from './FullColumnImgUrlDTO';
import { ReLInfoDTO } from './ReLInfoDTO';
import { ShareInfoDTO } from './ShareInfoDTO';
import { VideoInfoDTO } from './VideoInfoDTO';
/**
* 接口定义:
* http://192.168.1.3:3300/project/3802/interface/api/200915
*/
export interface ContentDetailDTO {
newsId: string;
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;
newLinkObject?: any;
newIntroduction: string;
authorList: AuthorListDTO[];
editorName: string;
openAudio: number;
audioList: any[];
hasPopUp?: any;
popUps?: any[];
firstFrameImageUri: string;
reLInfo?: ReLInfoDTO;
fullColumnImgUrls: FullColumnImgUrlDTO[];
shareInfo: ShareInfoDTO;
photoList: any[];
videoInfo: VideoInfoDTO[];
liveInfo?: any;
voteInfo?: any;
rmhInfo?: any;
userInfo?: any;
openLikes: number;
openComment: number;
likesStyle: number;
preCommentFlag: number;
commentDisplay: number;
keyArticle: number;
rmhPlatform: number;
readFlag?: number;
topicInfo?: any;
traceId: string;
itemId: string;
sceneId: string;
subSceneId: string;
activityInfos: any[];
recommendShow: number;
visitorComment: number;
itemTypeCode: string;
menuShow: number;
newsTags: string;
specialColumnId?: any;
specialColumnName: string;
timeline?: any;
traceInfo: string;
viewCount: number;
}
\ No newline at end of file
... ...
export interface FullColumnImgUrlDTO {
format?: any;
height: number;
landscape: number;
size: number;
url: string;
weight: number;
}
... ...
export interface ReLInfoDTO {
channelId: number;
relId: string;
relObjectId: number;
relType: string;
}
... ...
export interface ShareInfoDTO {
shareCoverUrl: string;
shareOpen: number;
sharePosterCoverUrl: string;
sharePosterOpen: number;
shareSummary: string;
shareTitle: string;
shareUrl: string;
}
... ...
export interface VideoInfoDTO {
clarity: number;
resolutionHeight: number;
resolutionWidth: number;
videoDuration: number;
videoLandScape: number;
videoType: number;
videoUrl: string;
}
\ No newline at end of file
... ...
import { Logger } from 'wdKit';
import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
import { ContentConstants } from '../constants/ContentConstants';
import { ContentDTO } from '../repository/bean/ContentDTO';
/**
* 页面跳转业务封装
*/
export class ProcessUtils {
static readonly TAG: string = "ProcessUtils";
/**
* 页面跳转
*/
static processPage(content: ContentDTO) {
if (content == null) {
Logger.error(this.TAG, "processPage, content is null");
return;
}
if (StringUtils.isEmpty(content.objectType)) {
Logger.error(this.TAG, "processPage, objectType is empty");
return;
}
let type = content.objectType;
switch (type) {
case ContentConstants.TYPE_NONE:
Logger.debug(this.TAG, "processPage, do nothing");
break;
case ContentConstants.TYPE_VOD:
Logger.debug(this.TAG, "processPage, nonsupport!!!");
// TODO 待对接更多页面
break;
case ContentConstants.TYPE_TELETEXT:
// 图文详情,跳转h5
this.gotoWeb(content);
break;
default:
break;
}
}
private static gotoWeb(content: ContentDTO) {
// // topicId
// content.channelId;
// content.linkUrl;
// content.objectId;
// // CompId
// content.relId;
// content.relType;
// // ScrollToBottom
// // FromPage
// TODO 对接路由
Logger.debug(this.TAG, `gotoWeb, ${content.objectId}`);
}
}
\ No newline at end of file
... ...
import promptAction from '@ohos.promptAction';
import PageModel from '../viewmodel/PageModel';
import { RefreshConstants as Const, RefreshState } from './RefreshConstants';
import PageViewModel from '../viewmodel/PageViewModel';
import { PageDTO } from '../repository/bean/PageDTO';
import { touchMoveLoadMore, touchUpLoadMore } from './PullUpLoadMore';
export function listTouchEvent(pageModel: PageModel, event: TouchEvent) {
switch (event.type) {
case TouchType.Down:
pageModel.downY = event.touches[0].y;
pageModel.lastMoveY = event.touches[0].y;
break;
case TouchType.Move:
if ((pageModel.isRefreshing === true) || (pageModel.isLoading === true)) {
return;
}
let isDownPull = event.touches[0].y - pageModel.lastMoveY > 0;
if (((isDownPull === true) || (pageModel.isPullRefreshOperation === true)) && (pageModel.isCanLoadMore === false)) {
// Finger movement, processing pull-down refresh.
touchMovePullRefresh(pageModel, event);
} else {
// Finger movement, processing load more.
touchMoveLoadMore(pageModel, event);
}
pageModel.lastMoveY = event.touches[0].y;
break;
case TouchType.Cancel:
break;
case TouchType.Up:
if ((pageModel.isRefreshing === true) || (pageModel.isLoading === true)) {
return;
}
if ((pageModel.isPullRefreshOperation === true)) {
// Lift your finger and pull down to refresh.
touchUpPullRefresh(pageModel);
} else {
// Fingers up, handle loading more.
touchUpLoadMore(pageModel);
}
break;
default:
break;
}
}
export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) {
if (pageModel.startIndex === 0) {
pageModel.isPullRefreshOperation = true;
let height = vp2px(pageModel.pullDownRefreshHeight);
pageModel.offsetY = event.touches[0].y - pageModel.downY;
// The sliding offset is greater than the pull-down refresh layout height, and the refresh condition is met.
if (pageModel.offsetY >= height) {
pullRefreshState(pageModel, RefreshState.Release);
pageModel.offsetY = height + pageModel.offsetY * Const.Y_OFF_SET_COEFFICIENT;
} else {
pullRefreshState(pageModel, RefreshState.DropDown);
}
if (pageModel.offsetY < 0) {
pageModel.offsetY = 0;
pageModel.isPullRefreshOperation = false;
}
}
}
export function touchUpPullRefresh(pageModel: PageModel) {
if (pageModel.isCanRefresh === true) {
pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight);
pullRefreshState(pageModel, RefreshState.Refreshing);
pageModel.currentPage = 1;
setTimeout(() => {
let self: PageModel = pageModel;
PageViewModel.getPageData(self.pageId, self.groupId, self.channelId, self.currentPage, self.pageSize)
.then((data: PageDTO) => {
if (data == null || data.compList == null || data.compList.length == 0) {
self.hasMore = false;
} else {
if (data.compList.length == self.pageSize) {
self.currentPage++;
self.hasMore = true;
} else {
self.hasMore = false;
}
// 刷新,替换所有数据
self.compList.replaceAll(...data.compList)
}
closeRefresh(self, true);
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
closeRefresh(self, false);
});
}, Const.DELAY_TIME);
} else {
closeRefresh(pageModel, false);
}
}
export function pullRefreshState(pageModel: PageModel, state: number) {
switch (state) {
case RefreshState.DropDown:
pageModel.pullDownRefreshText = $r('app.string.pull_down_refresh_text');
pageModel.pullDownRefreshImage = $r('app.media.ic_pull_down_refresh');
pageModel.isCanRefresh = false;
pageModel.isRefreshing = false;
pageModel.isVisiblePullDown = true;
break;
case RefreshState.Release:
pageModel.pullDownRefreshText = $r('app.string.release_refresh_text');
pageModel.pullDownRefreshImage = $r('app.media.ic_pull_up_refresh');
pageModel.isCanRefresh = true;
pageModel.isRefreshing = false;
break;
case RefreshState.Refreshing:
pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight);
pageModel.pullDownRefreshText = $r('app.string.refreshing_text');
pageModel.pullDownRefreshImage = $r('app.media.ic_pull_up_load');
pageModel.isCanRefresh = true;
pageModel.isRefreshing = true;
break;
case RefreshState.Success:
pageModel.pullDownRefreshText = $r('app.string.refresh_success_text');
pageModel.pullDownRefreshImage = $r('app.media.ic_succeed_refresh');
pageModel.isCanRefresh = true;
pageModel.isRefreshing = true;
break;
case RefreshState.Fail:
pageModel.pullDownRefreshText = $r('app.string.refresh_fail_text');
pageModel.pullDownRefreshImage = $r('app.media.ic_fail_refresh');
pageModel.isCanRefresh = true;
pageModel.isRefreshing = true;
break;
default:
break;
}
}
export function closeRefresh(pageModel: PageModel, isRefreshSuccess: boolean) {
let self = pageModel;
setTimeout(() => {
let delay = Const.RefreshConstant_DELAY_PULL_DOWN_REFRESH;
if (self.isCanRefresh === true) {
pullRefreshState(pageModel, isRefreshSuccess ? RefreshState.Success : RefreshState.Fail);
delay = Const.RefreshConstant_DELAY_SHRINK_ANIMATION_TIME;
}
animateTo({
duration: Const.RefreshConstant_CLOSE_PULL_DOWN_REFRESH_TIME,
delay: delay,
onFinish: () => {
pullRefreshState(pageModel, RefreshState.DropDown);
self.isVisiblePullDown = false;
self.isPullRefreshOperation = false;
}
}, () => {
self.offsetY = 0;
})
}, self.isCanRefresh ? Const.DELAY_ANIMATION_DURATION : 0);
}
\ No newline at end of file
... ...
import promptAction from '@ohos.promptAction';
import PageModel from '../viewmodel/PageModel';
import { RefreshConstants as Const } from './RefreshConstants';
import PageViewModel from '../viewmodel/PageViewModel';
import { PageDTO } from '../repository/bean/PageDTO';
export function touchMoveLoadMore(model: PageModel, event: TouchEvent) {
// list size +1
if (model.endIndex === model.compList.size() || model.endIndex === model.compList.size() + 1) {
model.offsetY = event.touches[0].y - model.downY;
if (Math.abs(model.offsetY) > vp2px(model.pullUpLoadHeight) / 2) {
model.isCanLoadMore = true;
model.isVisiblePullUpLoad = true;
model.offsetY = -vp2px(model.pullUpLoadHeight) + model.offsetY * Const.Y_OFF_SET_COEFFICIENT;
}
}
}
export function touchUpLoadMore(model: PageModel) {
let self: PageModel = model;
animateTo({
duration: Const.ANIMATION_DURATION,
}, () => {
self.offsetY = 0;
})
if ((self.isCanLoadMore === true) && (self.hasMore === true)) {
self.isLoading = true;
setTimeout(() => {
closeLoadMore(model);
PageViewModel.getPageData(self.pageId, self.groupId, self.channelId, self.currentPage, self.pageSize)
.then((data: PageDTO) => {
if (data == null || data.compList == null || data.compList.length == 0) {
self.hasMore = false;
} else {
if (data.compList.length == self.pageSize) {
self.currentPage++;
self.hasMore = true;
} else {
self.hasMore = false;
}
self.compList.push(...data.compList)
}
}).catch((err: string | Resource) => {
promptAction.showToast({ message: err });
})
}, Const.DELAY_TIME);
} else {
closeLoadMore(self);
}
}
export function closeLoadMore(model: PageModel) {
model.isCanLoadMore = false;
model.isLoading = false;
model.isVisiblePullUpLoad = false;
}
\ No newline at end of file
... ...
/**
* The constant of refresh.
*/
export class RefreshConstants {
/**
* The off set coefficient.
*/
static readonly Y_OFF_SET_COEFFICIENT: number = 0.1;
/**
* The animation delay time.
*/
static readonly DELAY_ANIMATION_DURATION: number = 300;
/**
* The delay time.
*/
static readonly DELAY_TIME: number = 1000;
/**
* The animation duration.
*/
static readonly ANIMATION_DURATION: number = 2000;
/**
* The RefreshConstant constants.
*/
static readonly RefreshConstant_DELAY_PULL_DOWN_REFRESH: number = 50;
static readonly RefreshConstant_CLOSE_PULL_DOWN_REFRESH_TIME: number = 150;
static readonly RefreshConstant_DELAY_SHRINK_ANIMATION_TIME: number = 500;
/**
* The page size.
*/
static readonly PAGE_SIZE: number = 20;
/**
* The refresh and load height.
*/
static readonly CUSTOM_LAYOUT_HEIGHT: number = 70;
/**
* Full the width.
*/
static readonly FULL_WIDTH: string = '100%';
/**
* The NoMoreLayout constants.
*/
static readonly NoMoreLayoutConstant_NORMAL_PADDING: number = 8;
static readonly NoMoreLayoutConstant_TITLE_FONT: string = '16fp';
/**
* The RefreshLayout constants.
*/
static readonly RefreshLayout_MARGIN_LEFT: string = '40%';
static readonly RefreshLayout_TEXT_MARGIN_BOTTOM: number = 1;
static readonly RefreshLayout_TEXT_MARGIN_LEFT: number = 7;
static readonly RefreshLayout_TEXT_FONT_SIZE: number = 17;
static readonly RefreshLayout_IMAGE_WIDTH: number = 18;
static readonly RefreshLayout_IMAGE_HEIGHT: number = 18;
}
/**
* The refresh state enum.
*/
export const enum RefreshState {
DropDown = 0,
Release = 1,
Refreshing = 2,
Success = 3,
Fail = 4
}
\ No newline at end of file
... ...
import { Logger, StringUtils } from 'wdKit';
import { ResponseDTO, } from 'wdNetwork';
import { ContentDetailDTO } from '../repository/bean/ContentDetailDTO';
import { PageRepository } from '../repository/PageRepository';
import { BaseViewModel } from './BaseViewModel';
const TAG = 'DetailViewModel';
/**
* 处理返回后的数据
*/
export class DetailViewModel extends BaseViewModel {
getLogTag() {
return TAG;
}
/**
* 获取详情数据.
* 例:https://pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500000008738&contentId=30001373964&relType=1
* @return {string} resDTO.data
*/
async getDetailPageData(relId: string, contentId: string, relType: string): Promise<string> {
Logger.debug(TAG, 'getDetailPageData contentId: ' + contentId);
return new Promise<string>((success, error) => {
PageRepository.fetchDetailData(relId, contentId, relType)
.then((resDTO: ResponseDTO<string>) => {
if (this.isRespondsInvalid(resDTO, 'getDetailPageData')) {
error("detail data invalid");
return
}
Logger.info(TAG, "getDetailPageData then,resDTO.timeStamp:" + resDTO.timestamp);
success(JSON.stringify(resDTO.data));
})
.catch((err: Error) => {
Logger.error(TAG, `getDetailPageData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
private dataTranslate(json: string): ContentDetailDTO {
if (StringUtils.isEmpty(json)) {
return null;
}
try {
let data: ContentDetailDTO = JSON.parse(json)
return data;
} catch (err) {
// json解析异常
Logger.error(TAG, `dataTranslate catch parse failed.: ${err}`);
}
return null;
}
}
let detailViewModel = new DetailViewModel();
export default detailViewModel as DetailViewModel;
\ No newline at end of file
... ...
import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType';
import { LazyDataSource } from 'wdKit';
import { CompDTO } from '../repository/bean/CompDTO';
import { RefreshConstants as Const } from '../utils/RefreshConstants';
export default class PageModel {
// 页面数据
pageId: string = "";
groupId: string = "";
channelId: string = "";
compList: LazyDataSource<CompDTO> = new LazyDataSource();
// 页面状态,刷新、加载更多等
currentPage: number = 1;
pageSize: number = Const.PAGE_SIZE;
pullDownRefreshText: Resource = $r('app.string.pull_down_refresh_text');
pullDownRefreshImage: Resource = $r('app.media.ic_pull_down_refresh');
pullDownRefreshHeight: number = Const.CUSTOM_LAYOUT_HEIGHT;
isVisiblePullDown: boolean = false;
pullUpLoadText: Resource = $r('app.string.pull_up_load_text');
pullUpLoadImage: Resource = $r('app.media.ic_pull_up_load');
pullUpLoadHeight: number = Const.CUSTOM_LAYOUT_HEIGHT;
isVisiblePullUpLoad: boolean = false;
offsetY: number = 0;
viewType: number = ViewType.LOADING;
hasMore: boolean = true;
startIndex = 0;
endIndex = 0;
downY = 0;
lastMoveY = 0;
isRefreshing: boolean = false;
isCanRefresh = false;
isPullRefreshOperation = false;
isLoading: boolean = false;
isCanLoadMore: boolean = false;
}
\ No newline at end of file
... ...
import { AppContext, Logger, ResourcesUtils } from 'wdKit';
import { Logger, ResourcesUtils } from 'wdKit';
import { ResponseDTO, } from 'wdNetwork';
import { PageRepository } from '../repository/PageRepository';
import http from '@ohos.net.http';
import { NavigationBodyDTO } from '../repository/bean/NavigationBodyDTO';
import { BottomNavDTO } from '../repository/bean/BottomNavDTO';
import { PageDTO } from '../repository/bean/PageDTO';
import { BaseViewModel } from './BaseViewModel';
import Router from '@system.router';
import router from '@ohos.router';
const TAG = 'PageViewModel';
/**
... ... @@ -29,17 +25,17 @@ export class PageViewModel extends BaseViewModel {
*
* @return BottomNavBean[] Nav Data List
*/
async getBottomNavData(): Promise<NavigationBodyDTO> {
async getBottomNavData(context?: Context): Promise<NavigationBodyDTO> {
Logger.info(TAG, `getBottomNavData start`);
if (mock_switch) {
return this.getBottomNavDataMock();
return this.getBottomNavDataMock(context);
}
return this.getNavData();
}
async getBottomNavDataMock(): Promise<NavigationBodyDTO> {
async getBottomNavDataMock(context?: Context): Promise<NavigationBodyDTO> {
Logger.info(TAG, `getBottomNavDataMock start`);
let compRes: ResponseDTO<NavigationBodyDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<NavigationBodyDTO>>('bottom_nav.json');
let compRes: ResponseDTO<NavigationBodyDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<NavigationBodyDTO>>('bottom_nav.json', context);
if (!compRes || !compRes.data) {
Logger.info(TAG, `getBottomNavDataMock compRes bottomNavList is empty`);
return null
... ... @@ -71,8 +67,12 @@ export class PageViewModel extends BaseViewModel {
*
* @return {GroupDTO} compRes.data
*/
private async getPageData1(): Promise<PageDTO> {
let compRes: ResponseDTO<PageDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>('comp_list0.json');
private async getPageData1(currentPage: number, context?: Context): Promise<PageDTO> {
if (currentPage > 1) {
// 加载更多,返回无数据
return {} as PageDTO
}
let compRes: ResponseDTO<PageDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>('comp_list0.json', context);
if (!compRes || !compRes.data) {
Logger.info(TAG, `getCompList compRes is empty`);
return {} as PageDTO
... ... @@ -87,7 +87,7 @@ export class PageViewModel extends BaseViewModel {
* @return {GroupDTO} compRes.data
* @deprecated
*/
private async getPageData2(): Promise<PageDTO> {
private async getPageData2(context?: Context): Promise<PageDTO> {
let compRes: ResponseDTO<PageDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>('comp_list2.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getCompList compRes is empty`);
... ... @@ -98,23 +98,26 @@ export class PageViewModel extends BaseViewModel {
return compRes.data
}
async getPageData(pageId: string, groupId: string, channelId: string): Promise<PageDTO> {
Logger.error(TAG, 'getPageData pageId: ' + pageId);
async getPageData(pageId: string, groupId: string, channelId: string, currentPage: number
, pageSize: number, context?: Context): Promise<PageDTO> {
Logger.debug(TAG, 'getPageData pageId: ' + pageId);
if (mock_switch) {
return this.getPageData1();
return this.getPageData1(currentPage, context);
}
return new Promise<PageDTO>((success, error) => {
PageRepository.fetchPageData(pageId, groupId, channelId).then((resDTO: ResponseDTO<PageDTO>) => {
if (this.isRespondsInvalid(resDTO, 'getPageData')) {
error("page data invalid");
return
}
Logger.info(TAG, "getPageData 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);
})
PageRepository.fetchPageData(pageId, groupId, channelId, currentPage, pageSize)
.then((resDTO: ResponseDTO<PageDTO>) => {
if (this.isRespondsInvalid(resDTO, 'getPageData')) {
error("page data invalid");
return
}
Logger.info(TAG, "getPageData 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);
})
})
}
}
... ...
... ... @@ -33,6 +33,10 @@
"value": "#B0B0B0"
},
{
"name": "color_212228",
"value": "#212228"
},
{
"name": "color_fff",
"value": "#ffffff"
},
... ...
... ... @@ -7,6 +7,30 @@
{
"name": "footer_text",
"value": "已经到底了"
},
{
"name": "pull_up_load_text",
"value": "加载中..."
},
{
"name": "pull_down_refresh_text",
"value": "下拉刷新"
},
{
"name": "release_refresh_text",
"value": "松开刷新"
},
{
"name": "refreshing_text",
"value": "正在刷新"
},
{
"name": "refresh_success_text",
"value": "刷新成功"
},
{
"name": "refresh_fail_text",
"value": "刷新失败"
}
]
}
\ No newline at end of file
... ...
{
"src": [
"components/DemoPreviewerComponent",
"components/view/SmallVideoCardComponent"
]
}
\ No newline at end of file
... ...
... ... @@ -36,6 +36,10 @@ export class LazyDataSource<T> extends BasicDataSource<T> {
return this.dataArray;
}
public size(): number {
return this.dataArray.length
}
// 增加/插入1个Item/数据,若index为undefined,则在数据尾部增加1个元素;否则,在指定索引(可为负/或大于数组长度)位置插入1个元素
public addItem(data: T, index?: number): void {
if (index == undefined) {
... ...
... ... @@ -20,7 +20,7 @@ export class ResourcesUtils {
}
return new Promise((success, error) => {
Logger.info(TAG, "ResourcesUtils getResourcesText filename:" + filename);
context.resourceManager.getRawFileContent(filename).then((content: Uint8Array) => {
context?.resourceManager.getRawFileContent(filename).then((content: Uint8Array) => {
if (!content) {
Logger.warn(TAG, 'getResourcesText then content is empty');
error("file is empty");
... ...
... ... @@ -6,9 +6,9 @@
"type": "HarmonyOS",
"material": {
"certpath": "C:\\Users\\PC\\.ohos\\config\\auto_debug_sight_harmony_com.wondertek.sight_70086000309521319.cer",
"storePassword": "0000001AB8EC943F2BE2E18A8AEFE1FCA450B66E91DFD2548DD09FD6AB15755699E084327B0CC2ED695B",
"storePassword": "0000001B264B065AE68D1C7F3C0863A33C083D91E12CC54AA36D44179AA8DBA37EA3C50E7F3692F5EB6F3E",
"keyAlias": "debugKey",
"keyPassword": "0000001AAB9FF41A89BB2C32EA7122E2EE2E6C97447932FDC7E91010CC02128130B6040A09EBC04CD07E",
"keyPassword": "0000001BFB62A8007F44B0EAAF9CF878A92620ED75A21E53B3740EA60DEBF6543F6E16AA7200542280D746",
"profile": "C:\\Users\\PC\\.ohos\\config\\auto_debug_sight_harmony_com.wondertek.sight_70086000309521319.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "C:\\Users\\PC\\.ohos\\config\\auto_debug_sight_harmony_com.wondertek.sight_70086000309521319.p12"
... ... @@ -133,18 +133,78 @@
]
}
]
},
// {
// "name": "wdLayout",
// "srcPath": "./wdLayout",
// "targets": [
// {
// "name": "default",
// "applyToProducts": [
// "default"
// ]
// }
// ]
// },
{
"name": "wdPlayer",
"srcPath": "./wdPlayer",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "wdDetailPlayApi",
"srcPath": "./wdDetailPlayApi",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "wdDetailPlayShortVideo",
"srcPath": "./wdDetailPlayShortVideo",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "wdDetailPlayVod",
"srcPath": "./wdDetailPlayVod",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "wdDetailPlayLive",
"srcPath": "./wdDetailPlayLive",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
// {
// "name": "wdLayout",
// "srcPath": "./wdLayout",
// "targets": [
// {
// "name": "default",
// "applyToProducts": [
// "default"
// ]
// }
// ]
// }
]
}
\ No newline at end of file
... ...
... ... @@ -4,11 +4,15 @@ import UIAbility from '@ohos.app.ability.UIAbility';
import Want from '@ohos.app.ability.Want';
import window from '@ohos.window';
import { registerRouter } from 'wdRouter';
import { SPHelper, WindowModel } from 'wdKit';
import { WDHttp } from 'wdNetwork'
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
SPHelper.init(this.context);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
registerRouter();
WDHttp.initHttpHeader()
}
onDestroy(): void {
... ... @@ -18,8 +22,17 @@ export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err, data) => {
WindowModel.shared.setWindowStage(windowStage);
// let a = new WindowModel();
// 设置窗口的显示方向属性
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)
.then(() => {
hilog.info(0x0000, 'testTag', 'setPreferredOrientation Succeeded');
})
.catch((err: Error) => {
hilog.error(0x0000, 'testTag', `setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`);
})
windowStage.loadContent('pages/MainPage', (err, data) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
... ...
import { ENewspaperPageComponent } from 'wdComponent';
import { Logger } from 'wdKit'
const TAG = 'ENewspaper';
@Entry
@Component
struct ENewspaper {
build() {
Column() {
ENewspaperPageComponent()
}
}
pageTransition(){
// 定义页面进入时的效果,从底侧滑入
PageTransitionEnter({ type: RouteType.None, duration: 300 })
.slide(SlideEffect.Bottom)
// 定义页面退出时的效果,向底侧滑出
PageTransitionExit({ type: RouteType.None, duration: 300 })
.slide(SlideEffect.Bottom)
}
aboutToAppear() {
Logger.info(TAG, 'aboutToAppear');
}
aboutToDisappear() {
Logger.info(TAG, 'aboutToDisappear');
}
onPageShow() {
Logger.info(TAG, 'onPageShow');
}
onPageHide() {
Logger.info(TAG, 'onPageHide');
}
onBackPress() {
Logger.info(TAG, 'onBackPress');
}
}
\ No newline at end of file
... ...
import { BottomNavBean } from 'wdBean';
import { BottomNavigationComponent, PageViewModel } from 'wdComponent';
import { BottomNavigationComponent} from 'wdComponent';
import { BreakpointConstants } from 'wdConstant';
import { BreakpointSystem, Logger } from 'wdKit';
const TAG = 'Index';
const TAG = 'MainPage';
@Entry
@Component
struct Index {
struct MainPage {
private breakpointSystem: BreakpointSystem = new BreakpointSystem()
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
@State bottomNavList: BottomNavBean[] = []
watchCurrentBreakpoint() {
Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
}
build() {
Column() {
BottomNavigationComponent({ bottomNavList: this.bottomNavList })
}
}
aboutToAppear() {
this.breakpointSystem.register()
let bottomNav = PageViewModel.getBottomNavData(getContext(this))
if (bottomNav) {
Logger.info(TAG, `aboutToAppear, bottomNav.length: ${bottomNav.length}`);
this.bottomNavList = bottomNav
}
Logger.info(TAG, `aboutToAppear `);
}
aboutToDisappear() {
... ... @@ -47,4 +36,10 @@ struct Index {
onBackPress() {
Logger.info(TAG, 'onBackPress');
}
build() {
Column() {
BottomNavigationComponent()
}
}
}
\ No newline at end of file
... ...
{
"src": [
"pages/Index",
"pages/web/DefaultWebPage"
"pages/MainPage",
"pages/web/DefaultWebPage",
"pages/ENewspaper"
]
}
}
\ No newline at end of file
... ...
... ... @@ -4,39 +4,40 @@
"backgroundColor": "#FFFFFF",
"bottomNavList": [
{
"backgroundUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231214/image/display/2e1d5f235d1a44cfb9fc120e8596c56b.png",
"channelChooseActionUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231227/vod/display/7c92f5b2a08b4a65aa9da13e66d5ad4a.pag",
"channelChooseCColor": "#666666",
"channelChooseColor": "#222222",
"channelMoreColor": "#666666",
"backgroundUrl": "",
"channelChooseActionUrl": "",
"channelChooseCColor": "",
"channelChooseColor": "",
"channelMoreColor": "",
"extraData": "{\"haveSearch\":\"1\",\"haveTopNav\":\"1\",\"leftIconurl\":\"\",\"rightIconUrl\":\"\"}",
"homePageColor": "#FFFFF",
"icon": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231220/image/display/0dc20f38da09405ea0ab675d700bc2ce.png",
"iconC": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231220/image/display/e162a5d3401045f298c237f1c795c015.gif",
"homePageColor": "",
"icon": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231015/image/display/a59ee3978357490bb58cbc378d70b557.png",
"iconC": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231015/image/display/213ab95c788d41f2838771e1eaaba62d.png",
"id": 201,
"immersiveIconCUrl": "",
"immersiveIconUrl": "",
"immersiveNameCColor": "#FFFFFF",
"immersiveNameColor": "#FFFFFF",
"logoUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231229/image/display/51d568f9af05421f9754a2c08906dc42.png",
"morningAndEveningUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231214/image/display/0f37cc0c86194c969d2143f85c056c9c.png",
"immersiveNameCColor": "",
"immersiveNameColor": "",
"logoUrl": "",
"morningAndEveningUrl": "",
"name": "新闻",
"nameCColor": "#ED2800",
"nameCColor": "#CB0000",
"nameColor": "#999999",
"nightIconCUrl": "",
"nightIconUrl": "",
"nightNameCColor": "",
"nightNameColor": "",
"noticeColor": "#FFFFFF",
"noticeColor": "",
"pageId": null,
"pageType": null,
"searchBothColor": "#666666",
"searchUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231214/image/display/2f2a9b3af5334eac8d7c3b6007240b83.png",
"searchBothColor": "",
"searchUrl": "",
"sortValue": 1,
"statusBarColor": 1,
"statusBarColor": null,
"topNavChannelList": [
{
"channelId": 2002,
"channelId": 2001,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 1,
... ... @@ -53,21 +54,22 @@
"moreChannel": "0",
"movePermitted": 0,
"myChannel": "0",
"name": "热点",
"name": "推荐",
"num": 1,
"pageId": 20012,
"pageId": 20011,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2001,
"channelId": 2002,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 1,
"delPermitted": 0,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"headlinesOn": 1,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
... ... @@ -77,15 +79,16 @@
"moreChannel": "0",
"movePermitted": 0,
"myChannel": "0",
"name": "推荐",
"name": "热点",
"num": 2,
"pageId": 20011,
"pageId": 20012,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2009,
"channelStyle": 2,
"channelId": 2066,
"channelStrategy": 2,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
... ... @@ -101,14 +104,15 @@
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "社会",
"name": "播报",
"num": 3,
"pageId": 20019,
"pageId": 21003,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2066,
"channelId": 2006,
"channelStrategy": 2,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -125,14 +129,15 @@
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "播报",
"name": "版面",
"num": 4,
"pageId": 21003,
"pageId": 20016,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2012,
"channelId": 2065,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -147,16 +152,17 @@
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 0,
"movePermitted": 1,
"myChannel": "0",
"name": "文化",
"name": "三农",
"num": 5,
"pageId": 20022,
"pageId": 21002,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2007,
"channelId": 2063,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -173,38 +179,15 @@
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "镜头",
"name": "两会",
"num": 6,
"pageId": 20017,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2006,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "版面",
"num": 7,
"pageId": 20016,
"pageId": 21000,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2015,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -214,9 +197,9 @@
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "210*60",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "210*60",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
... ... @@ -228,11 +211,12 @@
"underlineCColor": ""
},
{
"channelId": 2063,
"channelId": 2003,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
... ... @@ -245,14 +229,15 @@
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "两会",
"name": "锐评",
"num": 9,
"pageId": 21000,
"pageId": 20013,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2064,
"channelId": 2011,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -269,14 +254,15 @@
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "二十大",
"name": "体育",
"num": 10,
"pageId": 21001,
"pageId": 20021,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2003,
"channelId": 2005,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -293,14 +279,15 @@
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "锐评",
"num": 11,
"pageId": 20013,
"name": "文件",
"num": 12,
"pageId": 20015,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2011,
"channelId": 2016,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -317,14 +304,15 @@
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "体育",
"num": 12,
"pageId": 20021,
"name": "乡村振兴",
"num": 13,
"pageId": 20026,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2005,
"channelId": 2007,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -341,14 +329,15 @@
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "文件",
"name": "镜头",
"num": 14,
"pageId": 20015,
"pageId": 20017,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2065,
"channelId": 2009,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -365,14 +354,15 @@
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "三农",
"num": 15,
"pageId": 21002,
"name": "社会",
"num": 16,
"pageId": 20019,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2016,
"channelId": 2010,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -389,14 +379,15 @@
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "乡村振兴",
"num": 16,
"pageId": 20026,
"name": "财经",
"num": 17,
"pageId": 20020,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2010,
"channelId": 2012,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -411,16 +402,17 @@
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"movePermitted": 0,
"myChannel": "0",
"name": "财经",
"name": "文化",
"num": 18,
"pageId": 20020,
"pageId": 20022,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2013,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -445,6 +437,7 @@
},
{
"channelId": 2017,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -469,6 +462,7 @@
},
{
"channelId": 2014,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -493,6 +487,7 @@
},
{
"channelId": 2018,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -517,6 +512,7 @@
},
{
"channelId": 2019,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -541,6 +537,7 @@
},
{
"channelId": 2027,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -565,6 +562,7 @@
},
{
"channelId": 2029,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -589,6 +587,7 @@
},
{
"channelId": 2030,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -613,6 +612,7 @@
},
{
"channelId": 2031,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -637,6 +637,7 @@
},
{
"channelId": 2032,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -661,6 +662,7 @@
},
{
"channelId": 2033,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -685,6 +687,7 @@
},
{
"channelId": 2034,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -709,6 +712,7 @@
},
{
"channelId": 2035,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -733,6 +737,7 @@
},
{
"channelId": 2028,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -757,6 +762,7 @@
},
{
"channelId": 2036,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -781,6 +787,7 @@
},
{
"channelId": 2037,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -805,6 +812,7 @@
},
{
"channelId": 2038,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -829,6 +837,7 @@
},
{
"channelId": 2039,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -853,6 +862,7 @@
},
{
"channelId": 2040,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -877,6 +887,7 @@
},
{
"channelId": 2041,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -901,6 +912,7 @@
},
{
"channelId": 2042,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -925,6 +937,7 @@
},
{
"channelId": 2043,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -949,6 +962,7 @@
},
{
"channelId": 2044,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -973,6 +987,7 @@
},
{
"channelId": 2045,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -997,6 +1012,7 @@
},
{
"channelId": 2046,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -1021,6 +1037,7 @@
},
{
"channelId": 2047,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -1045,6 +1062,7 @@
},
{
"channelId": 2048,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -1069,6 +1087,7 @@
},
{
"channelId": 2049,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -1093,6 +1112,7 @@
},
{
"channelId": 2050,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -1117,6 +1137,7 @@
},
{
"channelId": 2051,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -1141,6 +1162,7 @@
},
{
"channelId": 2052,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -1165,6 +1187,7 @@
},
{
"channelId": 2053,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -1189,6 +1212,7 @@
},
{
"channelId": 2054,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -1213,6 +1237,7 @@
},
{
"channelId": 2055,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -1237,6 +1262,7 @@
},
{
"channelId": 2056,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -1261,6 +1287,7 @@
},
{
"channelId": 2057,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
... ... @@ -1285,6 +1312,7 @@
},
{
"channelId": 2020,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -1309,6 +1337,7 @@
},
{
"channelId": 2021,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -1332,7 +1361,8 @@
"underlineCColor": ""
},
{
"channelId": 2022,
"channelId": 2069,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -1349,18 +1379,19 @@
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "生活",
"num": 59,
"pageId": 20032,
"name": "冬奥",
"num": 66,
"pageId": 21006,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2092,
"channelId": 2070,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
... ... @@ -1373,18 +1404,19 @@
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "设计",
"num": 68,
"pageId": 21063,
"name": "旅游",
"num": 67,
"pageId": 21007,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2098,
"channelId": 2077,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
... ... @@ -1395,35 +1427,11 @@
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 0,
"myChannel": "0",
"name": "设计组件",
"num": 72,
"pageId": 21299,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2099,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 0,
"fontCColor": "",
"fontColor": "",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "设计号",
"num": 73,
"pageId": 21736,
"name": "设计",
"num": 69,
"pageId": 21528,
"pageType": "",
"underlineCColor": ""
}
... ... @@ -1432,39 +1440,40 @@
"type": "1"
},
{
"backgroundUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231214/image/display/2e1d5f235d1a44cfb9fc120e8596c56b.png",
"channelChooseActionUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231227/vod/display/3835f09a973443cb824af179e30e87ed.pag",
"channelChooseCColor": "#666666",
"channelChooseColor": "#222222",
"backgroundUrl": "",
"channelChooseActionUrl": "",
"channelChooseCColor": "",
"channelChooseColor": "",
"channelMoreColor": "",
"extraData": "{\"haveSearch\":\"0\",\"haveTopNav\":\"1\",\"leftIconurl\":\"\",\"rightIconUrl\":\"\"}",
"homePageColor": "#FFFFFF",
"icon": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231220/image/display/460f61a48c6a4993af442d54aedb682b.png",
"iconC": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231220/image/display/9aa759f72ccb4848b3ded2dee9502c25.gif",
"homePageColor": "",
"icon": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231015/image/display/e54cb55897604f099940d0a8526680c0.png",
"iconC": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231015/image/display/29e827defea748e295fa4397022b6cc9.png",
"id": 202,
"immersiveIconCUrl": "",
"immersiveIconUrl": "",
"immersiveNameCColor": "#FFFFFF",
"immersiveNameColor": "#FFFFFF",
"immersiveNameCColor": "",
"immersiveNameColor": "",
"logoUrl": "",
"morningAndEveningUrl": "",
"name": "人民号",
"nameCColor": "#ED2800",
"nameCColor": "#CB0000",
"nameColor": "#999999",
"nightIconCUrl": "",
"nightIconUrl": "",
"nightNameCColor": "",
"nightNameColor": "",
"noticeColor": "#FFFFFF",
"noticeColor": "",
"pageId": null,
"pageType": null,
"searchBothColor": "#222222",
"searchBothColor": "",
"searchUrl": "",
"sortValue": 2,
"statusBarColor": 1,
"statusBarColor": null,
"topNavChannelList": [
{
"channelId": 2058,
"channelStrategy": 1,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -1489,6 +1498,7 @@
},
{
"channelId": 2059,
"channelStrategy": 2,
"channelStyle": 3,
"channelType": 3,
"defaultPermitted": 0,
... ... @@ -1513,6 +1523,7 @@
},
{
"channelId": 2073,
"channelStrategy": 2,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -1540,39 +1551,40 @@
"type": "1"
},
{
"backgroundUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231214/image/display/2e1d5f235d1a44cfb9fc120e8596c56b.png",
"channelChooseActionUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231221/vod/display/65c6eb2ca91849c582d057adc9e76d46.pag",
"channelChooseCColor": "#666666",
"channelChooseColor": "#222222",
"backgroundUrl": "",
"channelChooseActionUrl": "",
"channelChooseCColor": "",
"channelChooseColor": "",
"channelMoreColor": "",
"extraData": "{\"haveSearch\":\"1\",\"haveTopNav\":\"1\",\"leftIconurl\":\"\",\"rightIconUrl\":\"\"}",
"homePageColor": "#FFFFFF",
"icon": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231221/image/display/bf77561966654001a538857ebef8a15c.png",
"iconC": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231224/image/display/1a42d5b8183a4eb1a044ddd64223c687.png",
"homePageColor": "",
"icon": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231015/image/display/551a687fccdc44ce916a391cc10eabdd.png",
"iconC": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231015/image/display/8ebb3bfe44534b059d5af53aafba8919.png",
"id": 203,
"immersiveIconCUrl": "",
"immersiveIconUrl": "",
"immersiveNameCColor": "#FFFFFF",
"immersiveNameColor": "#FFFFFF",
"immersiveNameCColor": "",
"immersiveNameColor": "",
"logoUrl": "",
"morningAndEveningUrl": "",
"name": "视频",
"nameCColor": "#ED2800",
"nameCColor": "#CB0000",
"nameColor": "#999999",
"nightIconCUrl": "",
"nightIconUrl": "",
"nightNameCColor": "",
"nightNameColor": "",
"noticeColor": "#FFFFFF",
"noticeColor": "",
"pageId": null,
"pageType": null,
"searchBothColor": "#222222",
"searchBothColor": "",
"searchUrl": "",
"sortValue": 3,
"statusBarColor": 1,
"statusBarColor": null,
"topNavChannelList": [
{
"channelId": 2060,
"channelStrategy": 1,
"channelStyle": 1,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -1597,6 +1609,7 @@
},
{
"channelId": 2061,
"channelStrategy": 2,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -1624,39 +1637,40 @@
"type": "1"
},
{
"backgroundUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231214/image/display/2e1d5f235d1a44cfb9fc120e8596c56b.png",
"channelChooseActionUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231221/vod/display/65c6eb2ca91849c582d057adc9e76d46.pag",
"channelChooseCColor": "#666666",
"channelChooseColor": "#222222",
"backgroundUrl": "",
"channelChooseActionUrl": "",
"channelChooseCColor": "",
"channelChooseColor": "",
"channelMoreColor": "",
"extraData": "{\"haveSearch\":\"1\",\"haveTopNav\":\"1\",\"leftIconurl\":\"\",\"rightIconUrl\":\"\"}",
"homePageColor": "#FFFFFF",
"icon": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231220/image/display/5a6cf95f7b9e489390ec73faf458b58a.png",
"iconC": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231220/image/display/1b075ed30a6b43d2ae319e5d892c66e4.gif",
"homePageColor": "",
"icon": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231015/image/display/a35a51ac415343bb8122b48f84b5ca70.png",
"iconC": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231015/image/display/972642ec160b4fc2a5dad2de3488d903.png",
"id": 204,
"immersiveIconCUrl": "",
"immersiveIconUrl": "",
"immersiveNameCColor": "#FFFFFF",
"immersiveNameColor": "#FFFFFF",
"immersiveNameCColor": "",
"immersiveNameColor": "",
"logoUrl": "",
"morningAndEveningUrl": "",
"name": "服务",
"nameCColor": "#ED2800",
"nameCColor": "#CB0000",
"nameColor": "#999999",
"nightIconCUrl": "",
"nightIconUrl": "",
"nightNameCColor": "",
"nightNameColor": "",
"noticeColor": "#FFFFFF",
"noticeColor": "",
"pageId": null,
"pageType": null,
"searchBothColor": "#222222",
"searchBothColor": "",
"searchUrl": "",
"sortValue": 4,
"statusBarColor": 1,
"statusBarColor": null,
"topNavChannelList": [
{
"channelId": 2062,
"channelStrategy": 2,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
... ... @@ -1684,36 +1698,36 @@
"type": "1"
},
{
"backgroundUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231214/image/display/3e1f4fe85b0445b6a0be24f3759d0ff6.png",
"backgroundUrl": "",
"channelChooseActionUrl": "",
"channelChooseCColor": "#FFFFFF",
"channelChooseColor": "#FFFFFF",
"channelChooseCColor": "",
"channelChooseColor": "",
"channelMoreColor": "",
"extraData": "{\"haveSearch\":\"0\",\"haveTopNav\":\"0\"}",
"homePageColor": "#222222",
"icon": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231220/image/display/f55f0ac25b764809bc8285c284adb147.png",
"iconC": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231220/image/display/3b5cff54d2a546f5b523a8aa8c33352e.gif",
"homePageColor": "",
"icon": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231015/image/display/3fa1832f3fbf49e6ad6765e64d27e60e.png",
"iconC": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231015/image/display/39a357a0f0954b86b993a18988d29f96.png",
"id": 205,
"immersiveIconCUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/inen-20230403/image/display/9f22b579db15497797e8204b1ec12d14.png",
"immersiveIconUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/inen-20230403/image/display/5be23055a4dc4d869be2139e9deb7a55.png",
"immersiveIconCUrl": "https://cdnjdphoto.aikan.pdnews.cn/inen-20230403/image/display/9f22b579db15497797e8204b1ec12d14.png",
"immersiveIconUrl": "https://cdnjdphoto.aikan.pdnews.cn/inen-20230403/image/display/5be23055a4dc4d869be2139e9deb7a55.png",
"immersiveNameCColor": "#FFFFFF",
"immersiveNameColor": "#FFFFFF",
"immersiveNameColor": "#6A6B75",
"logoUrl": "",
"morningAndEveningUrl": "",
"name": "我的",
"nameCColor": "#ED2800",
"nameCColor": "#CB0000",
"nameColor": "#999999",
"nightIconCUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/inen-20230403/image/display/9d584ddcfdf74e3ea8e445d102127b97.png",
"nightIconUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/inen-20230403/image/display/1f79063b6ecb493c95703e45529d3a5f.png",
"nightIconCUrl": "https://cdnjdphoto.aikan.pdnews.cn/inen-20230403/image/display/9d584ddcfdf74e3ea8e445d102127b97.png",
"nightIconUrl": "https://cdnjdphoto.aikan.pdnews.cn/inen-20230403/image/display/1f79063b6ecb493c95703e45529d3a5f.png",
"nightNameCColor": "#DA1C1C",
"nightNameColor": "#6A6B75",
"noticeColor": "#ED2800",
"noticeColor": "",
"pageId": null,
"pageType": null,
"searchBothColor": "#FFFFFF",
"searchBothColor": "",
"searchUrl": "",
"sortValue": 5,
"statusBarColor": 1,
"statusBarColor": null,
"topNavChannelList": [],
"topStyle": "",
"type": "2"
... ... @@ -1728,9 +1742,9 @@
},
"message": "Success",
"meta": {
"md5": "e2942dbcd76710d1bac0d98f9a0a9d0a"
"md5": "bab17ef603000513258f3ff7c4add868"
},
"requestId": "",
"success": true,
"timestamp": 1704765430031
"timestamp": 1706625315509
}
\ No newline at end of file
... ...
... ... @@ -155,6 +155,130 @@
"subType": ""
},
{
"audioDataList": [],
"backgroundImgUrl": "",
"bottomNavId": null,
"cardItemId": "",
"cardUpdateStrategy": null,
"compStyle": "Single_Imagecard_03",
"compType": "appStyle",
"dataSourceType": "",
"extraData": "",
"fullColumnImgUrls": [],
"hasMore": 1,
"id": null,
"imageScale": null,
"imgSize": "",
"itemId": "",
"itemType": "",
"itemTypeCode": "",
"linkUrl": "",
"name": "",
"objectId": "",
"objectLevel": "",
"objectSummary": "",
"objectTitle": "",
"objectType": "",
"openComment": null,
"openLikes": null,
"operDataList": [
{
"activityExt": null,
"appStyle": "13",
"askInfo": null,
"axisColor": "",
"bestNoticer": null,
"bottomNavId": null,
"cardItemId": "",
"channelId": 2001,
"commentInfo": null,
"corner": "",
"coverSize": "660*440",
"coverType": 1,
"coverUrl": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231215/image/display/846c62e2411e4eb39d2ac37bf72910df.png?x-oss-process=image/resize,w_240/quality,q_90/format,jpg",
"extra": "",
"fullColumnImgUrls": [
{
"format": null,
"height": 440,
"landscape": 1,
"size": 445035,
"url": "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231215/image/display/846c62e2411e4eb39d2ac37bf72910df.png?x-oss-process=image/resize,w_240/quality,q_90/format,jpg",
"weight": 660
}
],
"hasMore": null,
"itemId": "",
"itemType": "",
"itemTypeCode": "",
"keyArticle": null,
"landscape": null,
"likeStyle": null,
"linkUrl": "",
"liveInfo": null,
"menuShow": 1,
"newTags": "",
"newsAuthor": "",
"newsSubTitle": "",
"newsSummary": "",
"newsTitle": "特稿:《巴黎协定》首次全球“大考” 中国“答卷”尽显大国担当",
"newsTitleColor": "",
"objectId": "30001374647",
"objectLevel": "",
"objectType": "8",
"openComment": null,
"openLikes": null,
"pageId": "",
"photoNum": null,
"position": null,
"publishTime": "1702627948000",
"pushTime": null,
"pushUnqueId": null,
"readFlag": 0,
"recommend": null,
"relId": 500000008765,
"relObjectId": "2001",
"relType": 1,
"rmhInfo": null,
"rmhPlatform": 0,
"sceneId": "",
"shareInfo": null,
"slideShows": [],
"sortValue": null,
"source": "",
"subSceneId": "",
"tagIds": [],
"tagWord": null,
"titleShow": null,
"titleShowPolicy": null,
"topicTemplate": null,
"traceId": "",
"traceInfo": "",
"userInfo": null,
"videoInfo": null,
"visitorComment": 1,
"voiceInfo": null
}
],
"pageId": "",
"position": null,
"posterSize": "",
"posterUrl": "",
"recommend": 0,
"relId": null,
"sceneId": "",
"sortValue": null,
"subSceneId": "",
"summaryName": "",
"tabOperDataList": [],
"titleShowPolicy": null,
"topicTemplate": null,
"traceId": "",
"traceInfo": "",
"viewTime": "",
"viewTimeBlurred": null
},
{
"backgroundColor": "",
"backgroundImgUrl": "",
"cityCode": "",
... ...
{
"code":"0",
"data":[
{
"activityInfos":[
],
"appstyle":13,
"audioList":[
],
"authorList":[
{
"authorName":""
}
],
"bestNoticer":1,
"commentDisplay":1,
"editorName":"韩文鋆",
"firstFrameImageUri":"https://cdnjdout.aikan.pdnews.cn/zhbj-20240127/vod/content/output/f45ef51bb33f4ffd9458f8b386aa3227_opt.png",
"fullColumnImgUrls":[
{
"format":null,
"height":837,
"landscape":1,
"size":1222753,
"url":"https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240127/image/display/efd5771a861f45dd8170da1c3c8c4d04.png",
"weight":1256
}
],
"hasPopUp":null,
"itemId":"",
"itemTypeCode":"",
"keyArticle":0,
"likesStyle":1,
"liveInfo":null,
"menuShow":1,
"newIntroduction":"",
"newLinkObject":null,
"newsBodyTitle":"",
"newsContent":"",
"newsContentBak":"",
"newsDownTitle":"",
"newsId":30013266075,
"newsLinkUrl":"",
"newsShortTitle":"",
"newsSource":"41",
"newsSourceName":"中国铁路微信公号",
"newsSummary":"",
"newsTags":"",
"newsTitle":"旅途平安!这首歌送给即将启程回家的你",
"newsType":1,
"openAudio":1,
"openComment":1,
"openLikes":1,
"photoList":[
],
"popUps":[
],
"preCommentFlag":1,
"publishTime":"2024-01-27 14:18:52",
"reLInfo":{
"channelId":2002,
"relId":"500000301942",
"relObjectId":2002,
"relType":"1"
},
"readFlag":0,
"recommendShow":1,
"rmhInfo":null,
"rmhPlatform":0,
"sceneId":"",
"shareInfo":{
"shareCoverUrl":"https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240127/image/content/6706775f96a346a8a1e7393c325e043d.png?x-oss-process=image/resize,w_200",
"shareOpen":1,
"sharePosterCoverUrl":"https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240127/image/display/efd5771a861f45dd8170da1c3c8c4d04.png",
"sharePosterOpen":1,
"shareSummary":"人民日报,有品质的新闻",
"shareTitle":"旅途平安!这首歌送给即将启程回家的你",
"shareUrl":"https://people.pdnews.cn/vod/rel/500000301942/30013266075"
},
"specialColumnId":null,
"specialColumnName":"",
"subSceneId":"",
"timeline":null,
"topicInfo":null,
"traceId":"",
"traceInfo":"",
"userInfo":null,
"videoInfo":[
{
"clarity":5,
"resolutionHeight":1080,
"resolutionWidth":1920,
"videoDuration":143,
"videoLandScape":1,
"videoType":1,
"videoUrl":"https://cdnjdout.aikan.pdnews.cn/zhbj-20240127/vod/content/output/f45ef51bb33f4ffd9458f8b386aa3227_opt.mp4"
}
],
"viewCount":0,
"voteInfo":null
}
],
"message":"Success",
"meta":null,
"requestId":"",
"success":true,
"timestamp":1706514747211
}
\ No newline at end of file
... ...
This diff could not be displayed because it is too large.
{
"code": "0",
"data": [{
"date": "49997-06-15",
"list": [{
"exist": 1,
"pageName": "",
"pageNum": "05",
"periodNum": "49997-06-15"
}]
}],
"message": "Success",
"meta": null,
"requestId": "",
"success": true,
"timestamp": 1706170629625
}
\ No newline at end of file
... ...
// enum
export { BottomNavi } from './src/main/ets/enum/BottomNavi';
export { CompStyle } from './src/main/ets/enum/CompStyle';
export { CompType } from './src/main/ets/enum/CompType';
export { NetDataStatusType } from './src/main/ets/enum/NetDataStatusType';
export { ViewType } from './src/main/ets/enum/ViewType';
export { DelayTimeEnum } from './src/main/ets/enum/DelayTimeEnum';
export { ScreenType } from './src/main/ets/enum/ScreenType';
// navigation
export { NavigationBody } from './src/main/ets/bean/navigation/NavigationBody';
export { NavigationBodyDTO } from './src/main/ets/bean/navigation/NavigationBodyDTO';
export { BottomNavBean } from './src/main/ets/bean/navigation/BottomNavBean';
export { BottomNavDTO } from './src/main/ets/bean/navigation/BottomNavDTO';
export { TopNavBean } from './src/main/ets/bean/navigation/TopNavBean';
export { TopNavDTO } from './src/main/ets/bean/navigation/TopNavDTO';
// entity
export { ItemDTO } from './src/main/ets/bean/ItemDTO';
... ... @@ -30,12 +15,28 @@ export { Action } from './src/main/ets/bean/programme/Action'
export { Params } from './src/main/ets/bean/programme/Params'
export { Pic } from './src/main/ets/bean/programme/Pic'
export { LabelBean } from './src/main/ets/bean/component/extra/LabelBean';
export { LabelDTO } from './src/main/ets/bean/component/extra/LabelDTO';
export { PageDTO } from './src/main/ets/bean/component/PageDTO';
export { GroupDTO } from './src/main/ets/bean/component/GroupDTO';
export { CompDTO } from './src/main/ets/bean/component/CompDTO';
export { ContentDTO } from './src/main/ets/bean/component/ContentDTO';
export { NewspaperListBean } from './src/main/ets/bean/newspaper/NewspaperListBean';
export { NewspaperListItemBean } from './src/main/ets/bean/newspaper/NewspaperListItemBean';
export { NewspaperPositionItemBean } from './src/main/ets/bean/newspaper/NewspaperPositionItemBean';
export { NewspaperShareBean } from './src/main/ets/bean/newspaper/NewspaperShareBean';
export { NewspaperTimeInfoBean } from './src/main/ets/bean/newspaper/NewspaperTimeInfoBean';
export { NewspaperTimeItemBean } from './src/main/ets/bean/newspaper/NewspaperTimeItemBean';
... ...
... ... @@ -6,14 +6,9 @@ import { Pic } from './programme/Pic';
* 绑定到组件comp/view的数据Bean
*/
@Observed
// export abstract class ItemBean<DTO> implements Mapper<DTO> {
export abstract class ItemBean extends ItemDTO {
landscapeCover?: string; // 横向低分辨封面图片
portraitCover?: string; // 竖向低分辨封面图片
highLandscapeCover?: string; // 横向高分辨封面图片
highPortraitCover?: string; // 竖向高分辨封面图片
lowResolutionV34?: string; // 低清竖图(3:4比例), 取图逻辑 3:4低清竖图-->3:4高清竖图-->低分辨率竖图-->高分辨率竖图
highResolutionV34?: string; // 高清竖图(3:4比例), 取图逻辑 3:4高清竖图-->3:4低清竖图-->高分辨率竖图-->低分辨率竖图
export abstract class ItemBean {
action?: Action; // 事件行为
pics?: Pic
/**
* 是否被曝光
*/
... ... @@ -23,18 +18,20 @@ export abstract class ItemBean extends ItemDTO {
*/
position: string;
constructor(dto: ItemDTO) {
super(dto.action, dto.actionId, dto.pics, dto.h5pics)
this.landscapeCover = !dto.pics ? "" : !dto.pics.lowResolutionH ? dto.pics.highResolutionH : dto.pics.lowResolutionH;
this.portraitCover = !dto.pics ? "" : !dto.pics.lowResolutionV ? dto.pics.highResolutionV : dto.pics.lowResolutionV;
this.highLandscapeCover = !dto.pics ? "" : !dto.pics.highResolutionH ? dto.pics.lowResolutionH : dto.pics.highResolutionH;
this.highPortraitCover = !dto.pics ? "" : !dto.pics.highResolutionV ? dto.pics.lowResolutionV : dto.pics.highResolutionV;
this.lowResolutionV34 = !dto.pics ? "" : (!dto.pics.lowResolutionV34 ? dto.pics.lowResolutionV34 : (!dto.pics.highResolutionV34 ? dto.pics.highResolutionV34 : this.portraitCover));
this.highResolutionV34 = !dto.pics ? "" : (!dto.pics.highResolutionV34 ? dto.pics.highResolutionV34 : (!dto.pics.lowResolutionV34 ? dto.pics.lowResolutionV34 : this.highPortraitCover));
constructor(dto?: ItemDTO) {
if (dto) {
this.action = dto.action
this.pics = dto.pics
}
this.exposed = false
this.position = "0"
}
public setAction(action: Action): void {
this.action = action
}
public getAction(): Action {
return this.action ?? {} as Action
}
}
... ...
... ... @@ -5,16 +5,7 @@ import { Pic } from './programme/Pic';
* 组件comp/view对应的服务端数据
* DTO 数据传输实体类接口,所有数据传输层数据结构体需实现该接口
*/
export abstract class ItemDTO {
export interface ItemDTO {
action?: Action; // 事件对象
actionId?: string; // 点击事件id
pics?: Pic // 图片
h5pics?: Pic; // h5图片
constructor(action?: Action, actionId?: string, pics?: Pic, h5pics?: Pic) {
this.action = action;
this.actionId = actionId;
this.pics = pics;
this.h5pics = h5pics;
}
}
... ...
... ... @@ -10,7 +10,7 @@ export interface ContentDTO {
heatValue: string;
innerUrl: string;
landscape: number;
// lengthTime?: any;
lengthTime?: object;
linkUrl: string;
openLikes: number;
openUrl: string;
... ... @@ -33,4 +33,16 @@ export interface ContentDTO {
title: string;
vImageUrl: string;
screenType: string;
source: string;
objectId: string;
objectType: string;
channelId: string;
relId: string;
relType: string;
//单图卡/2行标题/3行标题
newsTitle:string;
publishTime:string;
visitorComment:number;
}
\ No newline at end of file
... ...
import { GroupDTO } from './GroupDTO';
import { CompDTO } from './CompDTO';
/**
* Page数据DTO
*/
export interface PageDTO {
id: number; // 页面id
name: string; // 页面名称
description: string; // 描述
groups: GroupDTO[]; // page下的group列表
pageId: string; // 页面id
id: number; // 楼层id
name: string; // 名称
branchMark: boolean;
compList: CompDTO[]; // Components集合的布局信息
}
\ No newline at end of file
... ...
import { TopNavBean } from './TopNavBean';
import { TopNavDTO } from './TopNavDTO';
/**
* 底导(包含顶导列表)数据
*/
export interface BottomNavBean {
export interface BottomNavDTO {
backgroundUrl: string;
channelChooseActionUrl: string;
channelChooseCColor: string;
... ... @@ -34,7 +34,7 @@ export interface BottomNavBean {
searchUrl: string;
sortValue: number;
statusBarColor: number;
topNavChannelList: TopNavBean[];
topNavChannelList: TopNavDTO[];
topStyle: string;
type: string;
}
\ No newline at end of file
... ...
import { BottomNavBean } from './BottomNavBean';
import { BottomNavDTO } from './BottomNavDTO';
/**
* 导航Body数据
*/
export interface NavigationBody {
export interface NavigationBodyDTO {
backgroundColor: string;
bottomNavList: BottomNavBean[];
bottomNavList: BottomNavDTO[];
// greyBottomNav: GreyBottomNav;
immersiveBackgroundColor: string;
nightBackgroundColor: string;
... ...
/**
* 顶导
*/
export interface TopNavBean {
export interface TopNavDTO {
channelId: number;
channelStyle: number;
channelType: number;
... ...
import { NewspaperListItemBean } from './NewspaperListItemBean';
export interface NewspaperListBean {
list:NewspaperListItemBean[];
}
\ No newline at end of file
... ...
import { NewspaperPositionItemBean } from './NewspaperPositionItemBean';
import { NewspaperShareBean } from './NewspaperShareBean';
export interface NewspaperListItemBean {
items:NewspaperPositionItemBean[];
pageName:string;
pageNum:string;
pagePic:string;
periodNum:string;
sharePagePic:NewspaperShareBean;
}
\ No newline at end of file
... ...
export interface NewspaperPositionItemBean {
image:string[];
downTitle:string;
imageHeight:number;
imageWidth:number;
newsId:number;
newsTxt:string;
newsType:number;
points:string;
relId:number;
relObjectId: string;
relType: string;
shortTitle: string;
title: string;
}
\ No newline at end of file
... ...
export interface NewspaperShareBean {
shareUrl:string;
sharePosterOpen:number;
}
\ No newline at end of file
... ...
import { NewspaperTimeItemBean } from './NewspaperTimeItemBean';
export interface NewspaperTimeInfoBean {
date:string;
list:NewspaperTimeItemBean[];
}
\ No newline at end of file
... ...
export interface NewspaperTimeItemBean {
pageName:string;
pageNum:string;
periodNum:string;
exit:number;
}
\ No newline at end of file
... ...
... ... @@ -3,6 +3,5 @@ import { Params } from './Params';
// 事件对象
export interface Action {
type: string;
name?: string; // 行为的名称,目前值与type相同,暂不启用
params?: Params; // 参数集合
}
\ No newline at end of file
... ...
... ... @@ -6,5 +6,15 @@ export interface Params {
path?: string;
url?: string;
extra?: ExtraDTO; // 跳转时额外需要带的参数:map<String,String> 即仅有一层的json
// 详情页类型
// 1.点播详情页
// 2.直播详情页
// 3.图文详情页
// 4.全民播详情页
// 5.欢喜详情页
// 6.挂件详情页
// 7.沉浸式竖屏详情页
// 8.专辑竖屏详情页
detailPageType?:number; // 详情页类型
}
... ...
/**
* 延时枚举常量值
*/
export const enum DelayTimeEnum {
DURATION_50 = 50, // 50毫秒
DURATION_100 = 100, // 50毫秒
DURATION_1000 = 1000, // 1秒/1000ms
DURATION_2000 = 2000, // 2秒/2000ms
LAUNCHER_DELAY_TIME = 1500, // 1.5秒
INTERVAL_4000 = 4000, //4秒
}
... ... @@ -2,26 +2,36 @@ export { PageViewModel } from "./src/main/ets/viewmodel/PageViewModel"
export { CompUtils } from "./src/main/ets/utils/CompUtils"
export { EmptyComponent } from "./src/main/ets/components/EmptyComponent"
export { EmptyComponent } from "./src/main/ets/components/view/EmptyComponent"
export { ErrorComponent } from "./src/main/ets/components/ErrorComponent"
export { ErrorComponent } from "./src/main/ets/components/view/ErrorComponent"
export { LoadingComponent } from "./src/main/ets/components/LoadingComponent"
export { LoadingComponent } from "./src/main/ets/components/view/LoadingComponent"
export { PageComponent } from "./src/main/ets/components/PageComponent"
export { PageComponent } from "./src/main/ets/components/page/PageComponent"
export { BottomNavigationComponent } from "./src/main/ets/components/BottomNavigationComponent"
export { BottomNavigationComponent } from "./src/main/ets/components/page/BottomNavigationComponent"
export { TopNavigationComponent } from "./src/main/ets/components/TopNavigationComponent"
export { TopNavigationComponent } from "./src/main/ets/components/page/TopNavigationComponent"
export { LabelComponent } from "./src/main/ets/components/LabelComponent"
export { LabelComponent } from "./src/main/ets/components/view/LabelComponent"
export { BannerComponent } from "./src/main/ets/components/BannerComponent"
export { BannerComponent } from "./src/main/ets/components/view/BannerComponent"
export { SingleRow03Component } from "./src/main/ets/components/SingleRow03Component"
export { SingleRow03Component } from "./src/main/ets/components/page/SingleRow03Component"
export { SingleColumnComponent } from "./src/main/ets/components/SingleColumnComponent"
export { SingleColumnComponent } from "./src/main/ets/components/page/SingleColumnComponent"
export { GridLayout01Component } from "./src/main/ets/components/GridLayout01Component"
export { GridLayout01Component } from "./src/main/ets/components/page/GridLayout01Component"
export { WaterFlowComponent } from "./src/main/ets/components/WaterFlowComponent"
export { WaterFlowComponent } from "./src/main/ets/components/page/WaterFlowComponent"
export { NewspaperViewModel } from "./src/main/ets/viewmodel/NewspaperViewModel"
export { ENewspaperPageComponent } from "./src/main/ets/components/ENewspaperPageComponent"
export { ENewspaperItemComponent } from "./src/main/ets/components/ENewspaperItemComponent"
export { ENewspaperListDialog } from "./src/main/ets/dialog/ENewspaperListDialog"
export { SingleImageCardComponent } from "./src/main/ets/components/view/SingleImageCardComponent"
\ No newline at end of file
... ...
... ... @@ -10,7 +10,7 @@
"wdConstant": "file:../wdConstant",
"wdKit": "file:../wdKit",
"wdBean": "file:../wdBean",
"wdNetwork": "file:../wdNetwork",
"wdRouter": "file:../wdRouter"
"wdRouter": "file:../wdRouter",
"wdNetwork": "file:../wdNetwork"
}
}
... ...
import { CompDTO, ContentDTO, DelayTimeEnum } from 'wdBean';
import { BreakpointConstants, CommonConstants } from 'wdConstant';
import { BreakPointType, Logger } from 'wdKit';
import { CompUtils } from '../utils/CompUtils';
import { CarouselLayout01CardView } from './CardView';
import { EmptyComponent } from './EmptyComponent';
const TAG = 'BannerComponent';
/**
* 轮播组件,即Banner/轮播大图/焦点图/自动滑动
* 样式:
* 'Carousel_Layout-01', // 通用轮播卡:视频、直播、活动、专题、榜单、外链
*/
@Component
export struct BannerComponent {
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
@State compDTO: CompDTO = {} as CompDTO
watchCurrentBreakpoint() {
Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
}
aboutToAppear() {
Logger.info(TAG, `aboutToAppear, beanList:${this.compDTO?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`);
}
aboutToDisappear() {
Logger.info(TAG, 'aboutToDisappear');
}
onPageShow() {
Logger.info(TAG, 'onPageShow');
}
onPageHide() {
Logger.info(TAG, 'onPageHide');
}
onBackPress() {
Logger.info(TAG, 'onBackPress');
}
build() {
if (this.compDTO && this.compDTO?.operDataList?.length > 0) {
Swiper() {
ForEach(this.compDTO?.operDataList, (item: ContentDTO, index: number) => {
this.buildItemBanner01(item, index)
})
}
.margin({ left: $r('app.float.main_margin'), right: $r('app.float.main_margin') })
.padding({ bottom: 14 })
.displayCount(this.buildDisplayCount()) // 仅展示1个图片
.cachedCount(2)
.index(1) // The default index of Swiper.
.autoPlay(true)
.interval(DelayTimeEnum.INTERVAL_4000)
.indicator(Indicator.dot()
.right(5)
.itemWidth(4)
.itemHeight(4)
.selectedItemWidth(10)
.selectedItemHeight(6))
.loop(true)
.duration(DelayTimeEnum.DURATION_1000)
.vertical(false)
.curve(Curve.Linear)
.onChange((index: number) => {
Logger.info(TAG, `Swiper onChange index : ${index}`);
})
} else {
EmptyComponent({ emptyHeight: 200 })
}
}
public buildDisplayCount(): number {
return new BreakPointType({ xs: 1, sm: 1, md: 2, lg: 3 }).getValue(this.currentBreakpoint)
}
/**
* 组件项
*
* @param programmeBean item 组件项
*/
@Builder
buildItemBanner01(item: ContentDTO, index: number) {
CarouselLayout01CardView({
item: item,
index: index
})
}
}
\ No newline at end of file
import { CommonConstants, CompStyle } from 'wdConstant';
import { BannerComponent } from './view/BannerComponent';
import { LabelComponent } from './view/LabelComponent';
import { TitleAbbrComponent } from './view/TitleAbbrComponent';
import { TitleAllComponent } from './view/TitleAllComponent';
import { HorizontalStrokeCardThreeTwoRadioForOneComponent } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import { HorizontalStrokeCardThreeTwoRadioForTwoComponent } from './view/HorizontalStrokeCardThreeTwoRadioForTwoComponent';
import { HorizontalStrokeCardThreeTwoRadioForMoreComponent } from './view/HorizontalStrokeCardThreeTwoRadioForMoreComponent';
import { CompDTO } from 'wdBean';
import { SingleImageCardComponent } from './view/SingleImageCardComponent';
/**
* comp适配器.
*/
@Component
export struct CompParser {
compDTO: CompDTO = {} as CompDTO;
compIndex: number = 0;
build() {
this.componentBuilder(this.compDTO, this.compIndex);
}
@Builder
componentBuilder(compDTO: CompDTO, compIndex: number) {
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Title_Abbr_01) {
TitleAbbrComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Title_All_01) {
TitleAllComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) {
BannerComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Single_Imagecard_02 || compDTO.compStyle === CompStyle.Single_Imagecard_03) {
SingleImageCardComponent({ compDTO: compDTO })
} else {
// todo:组件未实现 / Component Not Implemented
Text(compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
}
\ No newline at end of file
... ...
import { CompDTO, ContentDTO } from 'wdBean';
const FULL_PARENT: string = '100%';
const COLUMNS_TEMPLATE_ONE: string = '1fr';
const COLUMNS_TEMPLATE_TWO: string = '1fr 1fr';
const COLUMNS_TEMPLATE_THREE: string = '1fr 1fr 1fr';
const COLUMNS_TEMPLATE_FOUR: string = '1fr 1fr 1fr 1fr';
const COLUMNS_TEMPLATE_SIX: string = '1fr 1fr 1fr 1fr 1fr 1fr';
const TAG = 'DemoPreviewerComponent';
/**
* xxxx 布局及功能说明
*
* 【查看ArkUI预览效果】在线参考文档:
* https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/previewer-0000001054328973-V3#section146052489820
*/
@Entry
@Component
export struct DemoPreviewerComponent {
@State compDTO: CompDTO = {
compStyle: 'compStyle3',
operDataList: [
{
title: 'title0',
description: "description0",
coverUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
} as ContentDTO,
{
title: 'title1 title1 title1 title1 title1 title1 title1 title1 title1',
description: "description1",
coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240104/image/display/c4a9b526e0994d1bbd3ac8450f5cfc6c.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO,
{
title: 'title2',
description: "description2",
coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231206/image/live/bbe6d821e92b48919d90c7dadfd1f05a.jpg?x-oss-process=image/resize,l_850/auto-orient,1/quality,q_95/format,jpg",
} as ContentDTO,
{
title: 'title3',
description: "description3",
coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/sjbj-20231109/image/live/102e6eb9356b4ef19405b04c1f6ff875.png?x-oss-process=image/resize,l_850/auto-orient,1/quality,q_95/format,jpg'
} as ContentDTO,
{
title: 'title4',
description: "description4",
coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/62bdbbb35dbd45689e00790c81f04c4b.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO,
{
title: 'title5',
description: "description5",
coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/f79bbaa5a33b4bd88176071c4f797ff6.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO,
{
title: 'title6',
description: "description6",
coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231218/image/display/2c1d917009584ce2bb4a35cbb3a860a0.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO,
{
title: 'title7',
description: "description7",
coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231222/image/display/117dc516ca5c42d5843c0d32050c9fc6.jpeg?x-oss-process=image/resize,w_240/quality,q_90/format,jpg",
} as ContentDTO,
{
title: 'title8',
description: "description8",
coverUrl: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231228/image/display/90a2db4077d44a1f887f068fc659d977.jpeg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO
]
} as CompDTO
aboutToAppear() {
// this.compDTO = {
// compStyle: 'compStyle3',
// operDataList: [
// {
// title: 'title0',
// description: "description0",
// coverUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
// } as ContentDTO
// ]
// } as CompDTO
this.compDTO.operDataList[0].title = 'title_first_0'
}
build() {
Grid() {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
GridItem() {
this.gridItemView(item, index)
}
}, (item: ContentDTO, index: number) => JSON.stringify(item))
}
.height(FULL_PARENT)
.margin({ top: 10, bottom: 10, left: $r('app.float.main_margin'), right: $r('app.float.main_margin') })
.columnsTemplate(COLUMNS_TEMPLATE_TWO)
.columnsGap(4)
.rowsGap(2)
}
/**
* 布局描述
*
* @param ContentDTO item 组件项
* @param index
*/
@Builder
gridItemView(item: ContentDTO, index: number) {
Column() {
Image(item.coverUrl)
.width(FULL_PARENT)// .aspectRatio(3 / 4) // 宽/高比:纵向
// .aspectRatio(1 / 1) // 宽/高比:正方形
.aspectRatio(16 / 9)// 宽/高比:横向
.margin({ top: 8 })
.borderRadius(10)
Text(item.title)
.width(FULL_PARENT)
.margin({ top: 4, left: 2, right: 2, bottom: 4 })
.backgroundColor(Color.White)
.fontWeight(FontWeight.Bold)// .textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.fontColor('#808080')
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.width(FULL_PARENT)
.backgroundColor(Color.Yellow)
.justifyContent(FlexAlign.Center)
.onClick(() => {
console.info(TAG, `gridItemView onClick, index: ${index}`);
// MGRouterRule.jumpWithAction(item.action)
})
}
}
\ No newline at end of file
... ...
import { NewspaperListItemBean, NewspaperPositionItemBean } from 'wdBean';
import { StringUtils } from 'wdKit';
@Component
export struct ENewspaperItemComponent {
private newspaperListItemBean: NewspaperListItemBean = {} as NewspaperListItemBean
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
private startX: number = 0
private startY: number = 0
private itemBeanClicked: NewspaperPositionItemBean = {} as NewspaperPositionItemBean
build() {
Stack() {
Image(this.newspaperListItemBean.pagePic)
.width('100%')
.aspectRatio(0.68688)
.objectFit(ImageFit.Contain)
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor(Color.Transparent)
.onReady(() => {
})
}
.width('100%')
.aspectRatio(0.68688)
.onClick((event: ClickEvent) =>{
if (this.itemBeanClicked && this.itemBeanClicked.newsId){
// todo 跳转事件
this.itemBeanClicked = {} as NewspaperPositionItemBean
}
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
let x = event.touches[0].x;
let y = event.touches[0].y;
this.startX = x;
this.startY = y;
let points: number[][] = this.getArea(x, y, this.newspaperListItemBean.items);
if (points && points.length > 2){
let path = new Path2D();
path.moveTo(px2vp(points[0][0]), px2vp(points[0][1]));
for(let point of points.slice(1, points.length)){
path.lineTo(px2vp(point[0]), px2vp(point[1]));
}
path.closePath();
// 设定填充色为蓝色
this.context.fillStyle = '#33000000';
// 使用填充的方式,将Path2D描述的五边形绘制在canvas组件内部
this.context.fill(path);
}
}
if (event.type === TouchType.Up) {
this.context.clearRect(0, 0, this.context.width, this.context.height)
}
if (event.type === TouchType.Move) {
let mx = event.touches[0].x;
let my = event.touches[0].y;
if (this.startX - mx > 5 || mx - this.startX > 5 || this.startY - my > 5 || my - this.startY > 5){
this.itemBeanClicked = {} as NewspaperPositionItemBean
this.context.clearRect(0, 0, this.context.width, this.context.height)
}
}
})
}
public getArea(x: number, y: number, itemBeans: NewspaperPositionItemBean[]): number[][] {
if (itemBeans && itemBeans.length > 0) {
for (let itemBean of itemBeans) {
if (itemBean.points) {
let area: string[] = itemBean.points.split(';')
if (area && area.length > 0) {
let xys: number[][] = []
let minX: number = -1;
let maxX: number = -1;
let minY: number = -1;
let maxY: number = -1;
for (let item of area) {
let pair: string[] = item.split(',');
if (pair && pair.length > 1) {
// todo 因为数据是根据安卓手机抓的,这里根据分辨率倍数做了数据放大处理,真实数据不用乘以放大倍数
let xy: number[] = [StringUtils.parseNumber(pair[0])*1.28, StringUtils.parseNumber(pair[1])*1.24]
if (minX < 0) {
minX = xy[0]
} else {
if (minX > xy[0]) {
minX = xy[0]
}
}
if (maxX < 0) {
maxX = xy[0]
} else {
if (maxX < xy[0]) {
maxX = xy[0]
}
}
if (minY < 0) {
minY = xy[1]
} else {
if (minY > xy[1]) {
minY = xy[1]
}
}
if (maxY < 0) {
maxY = xy[1]
} else {
if (maxY < xy[1]) {
maxY = xy[1]
}
}
xys.push(xy);
}
}
if (vp2px(x) > minX && vp2px(x) < maxX && vp2px(y) > minY && vp2px(y) < maxY) {
this.itemBeanClicked = itemBean;
return xys;
}
}
}
}
}
return []
}
}
\ No newline at end of file
... ...
import { NewspaperListBean, NewspaperListItemBean } from 'wdBean';
import { NewspaperViewModel } from '../viewmodel/NewspaperViewModel';
import router from '@ohos.router';
import { Logger } from 'wdKit';
import { ENewspaperItemComponent } from './ENewspaperItemComponent';
import { ENewspaperListDialog } from '../dialog/ENewspaperListDialog';
@Component
export struct ENewspaperPageComponent {
@State newspaperListBean: NewspaperListBean = {} as NewspaperListBean
@State currentPageNum: string = '01'
@State pageNumPopup: boolean = false
private swiperController: SwiperController = new SwiperController()
listDialogController: CustomDialogController = new CustomDialogController({
builder: ENewspaperListDialog({ newspaperListBean: this.newspaperListBean,
currentPageNum: this.currentPageNum,
}),
alignment: DialogAlignment.Bottom
})
@Builder
popupBuilder() {
Row() {
GridRow({ columns: 5 }) {
ForEach(this.newspaperListBean.list, (item: NewspaperListItemBean, index) => {
GridCol() {
Row() {
Text(item.pageNum)
.fontSize($r('app.float.normal_text_size'))
.fontColor(this.currentPageNum == item.pageNum ? Color.White : $r('app.color.color_222222'))
}
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.width(30)
.height(30)
.backgroundColor(this.currentPageNum != item.pageNum ? Color.White : $r('app.color.color_ED2800'))
.onClick((event: ClickEvent) => {
this.pageNumPopup = !this.pageNumPopup
})
}
})
}
}
.padding({ top: 20, bottom: 20 })
.margin({ left: 10 })
.width(260)
}
build() {
RelativeContainer() {
RelativeContainer() {
Image($r('app.media.icon_arrow_down'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({ left: { anchor: "__container__", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center } })
.id('e_newspaper_back')
.onClick((event: ClickEvent) => {
Logger.info("sfsfsd", "" + vp2px(10))
router.back()
})
Row() {
Text('2024.01.26')
.fontSize($r('app.float.font_size_20'))
.fontColor($r('app.color.white'))
Image($r('app.media.icon_triangle'))
.width($r('app.float.border_radius_6'))
.height($r('app.float.border_radius_6'))
.margin({ left: 2, bottom: 5 })
}
.alignItems(VerticalAlign.Bottom)
.alignRules({ middle: { anchor: "__container__", align: HorizontalAlign.Center },
center: { anchor: "__container__", align: VerticalAlign.Center } })
.id('e_newspaper_date')
Image($r('app.media.icon_share'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
.alignRules({ right: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center } })
.id('e_newspaper_share')
}
.margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
.height($r('app.float.top_bar_height'))
.alignRules({ top: { anchor: '__container__', align: VerticalAlign.Top },
left: { anchor: '__container__', align: HorizontalAlign.Start },
right: { anchor: '__container__', align: HorizontalAlign.End } })
.id('e_newspaper_top')
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
Swiper(this.swiperController) {
ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {
ENewspaperItemComponent({ newspaperListItemBean: item })
})
}
.width('100%')
.vertical(true)
.autoPlay(false)
.cachedCount(3)
.indicator(false)
.displayCount(1)
.aspectRatio(0.68688)
.margin({ top: $r('app.float.vp_55'), left: 10, right: 10 })
.id('e_newspaper_content')
.alignRules({ top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center } })
.onChange((index: number) => {
this.currentPageNum = this.newspaperListBean?.list[index]?.pageNum
})
Image($r('app.media.newspaper_shadow'))
.height($r('app.float.vp_12'))
.margin({ left: 12, right: 12, top: -5 })
.objectFit(ImageFit.Contain)
.alignRules({ top: { anchor: "e_newspaper_content", align: VerticalAlign.Bottom },
left: { anchor: 'e_newspaper_content', align: HorizontalAlign.Start },
right: { anchor: 'e_newspaper_content', align: HorizontalAlign.End } })
.id('e_newspaper_shadow')
Row() {
Text('滑动查看下一版')
.fontColor(Color.White)
.fontSize($r('app.float.font_size_14'))
Image($r('app.media.icon_next_page'))
.width($r('app.float.vp_16'))
.height($r('app.float.vp_16'))
}
.justifyContent(FlexAlign.Center)
.margin({ top: $r('app.float.margin_16') })
.alignRules({ top: { anchor: "e_newspaper_shadow", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center } })
.id('e_newspaper_next')
.onClick((event: ClickEvent) => {
this.swiperController.showNext()
})
}
Row() {
Text(this.currentPageNum)
.fontSize($r('app.float.font_size_36'))
.fontColor($r('app.color.white'))
Text('版')
.fontSize($r('app.float.font_size_16'))
.fontColor($r('app.color.white'))
.margin({ bottom: 6 })
Image($r('app.media.icon_triangle'))
.width($r('app.float.border_radius_6'))
.height($r('app.float.border_radius_6'))
.margin({ left: 2, bottom: 6 })
}
.alignItems(VerticalAlign.Bottom)
.margin({ left: $r('app.float.margin_16'), bottom: $r('app.float.top_tab_bar_height') })
.alignRules({ bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
left: { anchor: '__container__', align: HorizontalAlign.Start } })
.id('e_newspaper_page_num')
.onClick((event: ClickEvent) => {
this.pageNumPopup = !this.pageNumPopup
})
.bindPopup(this.pageNumPopup, {
builder: this.popupBuilder,
placement: Placement.Top,
popupColor: Color.White
})
Row() {
Image($r('app.media.icon_read_paper'))
.width($r('app.float.vp_20'))
.height($r('app.float.vp_20'))
.margin({ right: $r('app.float.vp_3') })
Text('读报纸')
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.white'))
}
.alignItems(VerticalAlign.Center)
.margin({ right: $r('app.float.margin_16'), bottom: $r('app.float.top_tab_bar_height') })
.alignRules({ bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
right: { anchor: '__container__', align: HorizontalAlign.End } })
.id('e_newspaper_read')
.onClick((event: ClickEvent) => {
this.listDialogController.open()
})
}
.width('100%')
.height('100%')
.backgroundColor($r('app.color.color_80000000'))
.id('e_newspaper_container')
}
aboutToAppear() {
let listBean = NewspaperViewModel.getNewspaperListFromLocal(getContext(this));
this.newspaperListBean = listBean;
}
aboutToDisappear() {
}
}
\ No newline at end of file
... ...
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { CompUtils } from '../utils/CompUtils';
@Component
export struct HeadPictureCardComponent {
@State compDTO: CompDTO = {} as CompDTO
build() {
Stack() {
Image(this.compDTO.backgroundImgUrl)
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
Row()
.width(CommonConstants.FULL_WIDTH)
.height(59)
.linearGradient({
colors:[
['rgba(0, 0, 0, 0.0)', 0.0], ['rgba(0, 0, 0, 0.3)', 1.0]
]
})
Row() {
Text(CompUtils.getLabelTitle(this.compDTO.extraData))
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.fontColor(Color.White)
.fontSize($r('app.float.normal_text_size'))
.fontWeight(FontWeight.Bold)
}
.height(25)
.margin({left: 12, bottom: 10, right: 12})
}
.alignContent(Alignment.Bottom)
}
}
... ...
import { CompDTO, CompStyle, GroupDTO, ViewType } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { LazyDataSource, Logger } from 'wdKit';
import { PageViewModel } from '../viewmodel/PageViewModel';
import { BannerComponent } from './BannerComponent';
import { EmptyComponent } from './EmptyComponent';
import { ErrorComponent } from './ErrorComponent';
import { GridLayout01Component } from './GridLayout01Component';
import { LabelComponent } from './LabelComponent';
import { LoadingComponent } from './LoadingComponent';
import { SingleColumnComponent } from './SingleColumnComponent';
import { SingleRow03Component } from './SingleRow03Component';
import { WaterFlowComponent } from './WaterFlowComponent';
const TAG = 'PageComponent';
@Component
export struct PageComponent {
@Prop viewType: number = ViewType.LOADED;
// Group数据及子组件数据
@State groupList: LazyDataSource<GroupDTO> = new LazyDataSource();
@State currentTopNavSelectedIndex: number = 0;
build() {
if (this.viewType == ViewType.LOADING) {
LoadingComponent()
} else if (this.viewType == ViewType.ERROR) {
ErrorComponent()
} else if (this.viewType == ViewType.EMPTY) {
EmptyComponent()
} else {
List() {
LazyForEach(this.groupList, (groupDTO: GroupDTO, groupIndex: number) => {
ListItem() {
Column() {
ForEach(groupDTO.compList, (compDTO: CompDTO, compIndex: number) => {
this.componentBuilder(compDTO, groupIndex, compIndex)
})
}
}
})
}
.cachedCount(5)
.height(CommonConstants.FULL_PARENT)
}
}
@Builder
componentBuilder(compDTO: CompDTO, groupIndex: number, compIndex: number) {
if (compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Carousel_Layout_01) {
BannerComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Single_Row_03) {
SingleRow03Component({ dataList: compDTO.operDataList })
} else if (compDTO.compStyle === CompStyle.Single_Column_01 || compDTO.compStyle === CompStyle.Single_Column_02) {
SingleColumnComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Grid_Layout_01) {
GridLayout01Component({ dataList: compDTO.operDataList })
} else if (compDTO.compStyle === CompStyle.Masonry_Layout_01) {
WaterFlowComponent({ compDTO: compDTO })
} else {
// todo:组件未实现 / Component Not Implemented
Text(compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
aboutToAppear() {
Logger.info(TAG, `aboutToAppear, this.pageId: ${this.viewType} this.currentTopNavSelectedIndex: ${this.currentTopNavSelectedIndex}`);
if (this.currentTopNavSelectedIndex === 1) { // 顶导tab的第0个item是【热点】,第1个item是【推荐】
this.groupList.replaceAll()
let groupDto = PageViewModel.getGroup2DTO(getContext(this))
if (groupDto) {
this.groupList.push(groupDto)
}
} else {
let groupDto = PageViewModel.getGroupDTO(getContext(this))
if (groupDto) {
this.groupList.push(groupDto)
}
}
}
}
import { BottomNavBean, BottomNavi } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { LazyDataSource, Logger } from 'wdKit';
import { BottomNavi, CommonConstants } from 'wdConstant';
import { BottomNavDTO } from 'wdBean';
import { Logger } from 'wdKit';
import { TopNavigationComponent } from './TopNavigationComponent';
import { PageComponent } from './PageComponent';
import { MinePageComponent } from './MinePageComponent';
import { CompUtils } from '../../utils/CompUtils';
import PageViewModel from '../../viewmodel/PageViewModel';
const TAG = 'BottomNavigationComponent';
... ... @@ -12,7 +14,7 @@ const TAG = 'BottomNavigationComponent';
@Component
export struct BottomNavigationComponent {
// 底导/顶导全部数据
@Prop @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavBean[] = []
@State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = []
// 底导当前选中/焦点下标
@Provide currentNavIndex: number = BottomNavi.NEWS;
// 底导TabsController
... ... @@ -27,8 +29,13 @@ export struct BottomNavigationComponent {
*/
readonly SIXTY_OPACITY: number = 0.6;
aboutToAppear() {
async aboutToAppear() {
Logger.info(TAG, `aboutToAppear currentNavIndex: ${this.currentNavIndex}`);
let bottomNav = await PageViewModel.getBottomNavData(getContext(this))
if (bottomNav && bottomNav.bottomNavList != null) {
Logger.info(TAG, `aboutToAppear, bottomNav.length: ${bottomNav.bottomNavList.length}`);
this.bottomNavList = bottomNav.bottomNavList
}
}
aboutToDisappear() {
... ... @@ -37,11 +44,12 @@ export struct BottomNavigationComponent {
build() {
Tabs({ barPosition: BarPosition.End, index: this.currentNavIndex, controller: this.navController }) {
ForEach(this.bottomNavList, (navItem: BottomNavBean, index: number) => {
ForEach(this.bottomNavList, (navItem: BottomNavDTO, index: number) => {
TabContent() {
Column() {
if (navItem.topNavChannelList && navItem.topNavChannelList.length == 0 && navItem.name == '我的') {
PageComponent({ groupList: new LazyDataSource() }) // todo:我的页面组件数据列表
if (CompUtils.isMine(navItem)) {
// 我的页面组件数据列表
MinePageComponent()
} else {
TopNavigationComponent({ topNavList: navItem.topNavChannelList })
}
... ... @@ -60,7 +68,7 @@ export struct BottomNavigationComponent {
}
@Builder
tabBarBuilder(navItem: BottomNavBean, index: number) {
tabBarBuilder(navItem: BottomNavDTO, index: number) {
Stack({ alignContent: Alignment.Bottom }) {
Image(this.currentNavIndex === index ? navItem.iconC : navItem.icon)
.height(CommonConstants.FULL_PARENT)
... ...