yangchenggong1_wd
... ... @@ -66,6 +66,29 @@ export struct ENewspaperPageComponent {
offset: { dx: 0, dy: 0 }
})
async aboutToAppear() {
//获取宽高尺寸
this.screenWidth = this.displayTool.width
this.picWidth = this.screenWidth - vp2px(52)
this.picHeight = this.picWidth * 566 / 378
//注册字体
font.registerFont({
familyName: 'BebasNeue_Regular',
familySrc: $rawfile('font/BebasNeue_Regular.otf')
})
this.getNewspaperTime()
this.getNewspaperList()
}
aboutToDisappear() {
// if (this.calendarDialogController) {
// this.calendarDialogController = null
// }
// if (this.listDialogController) {
// this.listDialogController = null
// }
}
build() {
RelativeContainer() {
RelativeContainer() {
... ... @@ -245,26 +268,11 @@ export struct ENewspaperPageComponent {
.id('e_newspaper_container')
}
async aboutToAppear() {
//获取宽高尺寸
this.screenWidth = this.displayTool.width
this.picWidth = this.screenWidth - vp2px(52)
this.picHeight = this.picWidth * 566 / 378
//注册字体
font.registerFont({
familyName: 'BebasNeue_Regular',
familySrc: $rawfile('font/BebasNeue_Regular.otf')
})
this.getNewspaperTime()
this.getNewspaperList()
}
private async getNewspaperTime() {
let newspaperTimes = await NewspaperViewModel.getNewspaperTime(this.calendarDate)
if (newspaperTimes && newspaperTimes.length > 0) {
this.calendarDate = newspaperTimes[0].date
this.currentPageNum = '01'
this.swiperIndex = 0
}
}
... ...
// import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean';
import { PageInfoBean } from 'wdBean';
import { CompList, PageInfoBean } from 'wdBean';
import { DateTimeUtils, Logger } from 'wdKit/Index';
import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel';
import { AudioBarView } from './AudioBarView';
... ... @@ -15,6 +15,9 @@ const PATTERN_DATE_CN_RN: string = 'yyyy年\nMM月dd日'; // 日期中包含包
@Component
export struct MorningEveningPaperComponent {
@State pageInfoBean: PageInfoBean = {} as PageInfoBean
// @State compInfoBean: CompInfoBean = {} as CompInfoBean
@State compListItem: CompList = {} as CompList
// @Provide compListItem: CompList = {} as CompList
// @State morningEveningPaperDTO: MorningEveningPaperDTO = {
// name: "新闻夜读",
// topicInfo: {
... ... @@ -41,7 +44,7 @@ export struct MorningEveningPaperComponent {
Logger.info(TAG, "currentTime = " + currentTime)
Logger.info(TAG, `currentTime = ${currentTime}`)
try {
let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("28927")
let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("28949")
this.pageInfoBean = pageInfoBean;
this.title = this.pageInfoBean?.topicInfo?.title
let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN);
... ... @@ -52,7 +55,12 @@ export struct MorningEveningPaperComponent {
Logger.info(TAG, "pageInfoBean dateTime = " + dateTime)
Logger.info(TAG, "pageInfoBean subTitle = " + this.subTitle)
let compInfoBean = await MorningEveningViewModel.getMorningEveningCompInfo(pageInfoBean?.id, pageInfoBean?.groups[0]?.id, currentTime + "")
let compInfoBean = await MorningEveningViewModel.getMorningEveningCompInfo(pageInfoBean?.id, pageInfoBean?.groups[0]?.id, currentTime + "", pageInfoBean?.topicInfo?.topicId)
// this.compInfoBean = compInfoBean
if (compInfoBean?.compList[0]) {
this.compListItem = compInfoBean?.compList[0]
}
Logger.info(TAG, "compInfoBean compStyle = " + compInfoBean.compList[0].compStyle)
} catch (exception) {
... ... @@ -67,32 +75,33 @@ export struct MorningEveningPaperComponent {
ListItem() {
topicInfoView({ frontLinkObject: this.pageInfoBean?.topicInfo?.frontLinkObject })
}
}
ListItem() {
AudioBarView()
ListItem() {
AudioBarView()
}
}
ListItem() {
SingleColumn999Component()
SingleColumn999Component({ compListItem: this.compListItem }).margin({ top: $r('app.float.top_bar_height') })
}
}
// .backgroundColor('#FFF1F3F5')
// .backgroundColor(Color.Blue)
.height('100%')
.margin({ left: 14, right: 14 })
PaperTitleComponent()
// PaperTitleComponent({
// // title: this.morningEveningPaperDTO?.topicInfo?.title ?? "",
// title: this.title ?? "",
// // subtitle: this.morningEveningPaperDTO?.topicInfo?.topicDate ?? ''
// subtitle: this.subTitle
// })
// .margin({ left: 12, right: 12 })
PaperTitleComponent()// PaperTitleComponent({
// // title: this.morningEveningPaperDTO?.topicInfo?.title ?? "",
// title: this.title ?? "",
// // subtitle: this.morningEveningPaperDTO?.topicInfo?.topicDate ?? ''
// subtitle: this.subTitle
// })
.margin({ left: 14, right: 14 })
}
.width('100%')
// .backgroundColor('#000080')
.backgroundColor(Color.Black)
// .backgroundColor(Color.Black)
.backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black)
}
}
\ No newline at end of file
... ...
... ... @@ -61,6 +61,7 @@ export struct PaperTitleComponent {
// console.info(TAG, "img_close")
router.back()
})
.margin({ right: 16 })
Image($r('app.media.icon_share'))
.height($r('app.float.top_arrow_size'))
... ... @@ -69,9 +70,11 @@ export struct PaperTitleComponent {
right: { anchor: "img_close", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center } })
.id('img_share')
.margin({ right: 13 })
}
// .margin({ left: 14, right: 14 })
.height($r('app.float.top_bar_height'))
.backgroundColor(Color.Black)
// .backgroundColor(Color.Black)
}
}
\ No newline at end of file
... ...
import { CompDTO, ContentDTO, VideoInfoDTO, } from 'wdBean';
import { CompList, ContentDTO } from 'wdBean';
import { BreakpointConstants } from 'wdConstant';
import { Logger } from 'wdKit';
import { PaperSingleColumn999CardView } from '../page/CardView';
... ... @@ -11,67 +11,71 @@ const TAG = 'SingleColumn999Component';
*/
@Component
export struct SingleColumn999Component {
// @Consume compListItem?: CompList
@Prop compListItem?: CompList
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
@State compDTO: CompDTO = {
compStyle: 'compStyle3',
operDataList: [
{
newsTitle: '时政微观察丨从外贸“成绩单”看中国经济新亮色',
description: "description0",
coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/a9028e7011bb440e94ba7c63d80b39b7.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
} as ContentDTO,
{
newsTitle: '画好强国建设、民族复兴的最大同心圆',
description: "description1",
coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240116/image/display/80351784d4da4fc08b8987ba45a7647f.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO,
{
newsTitle: '绿色“一带一路”十周年创新理念与实践案例',
description: "description2",
newsSummary: "共建“一带一路”倡议提出10年多来,在各方共同努力下,共建“一带一路”绿色发展取得积极进展,理念引领不断增强,交流机制不断完善,务实合作不断深化。",
coverUrl: "",
} as ContentDTO,
{
newsTitle: '瞭望 | 在深海聆听“幽灵粒子”',
description: "description3",
coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/b77a3577594d4d24b84e7b2b20e38e41.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
} as ContentDTO,
{
newsTitle: '一图读懂|未来三年,长三角示范区安排了这些重大项目',
description: "description4",
coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/8d54ef1cbbe14ef08d6ab38f07867e4c.jpeg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO,
{
newsTitle: '一头江豚的自述',
description: "description5",
newsSummary: "我是生活在长江里的一头江豚,是长江中唯一的水生哺乳动物,更是国家一级保护动物。但曾几何时,我和我的江中小伙伴出现了生存危机……直到有一天,我突然发现,打渔人变成护渔人,江水变清澈了,长江逐渐恢复了生机,我的家族数量上升到了1249头。当长江之水再一次悠悠流淌,我们相拥在清澈波光中起舞。长江,我的家园。",
coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240116/image/display/2ec7bccff2324b05ac4b6503d868a381.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
visitorComment: 10,
videoInfo: {
// clarity: 0,
// resolutionHeight: 0,
// resolutionWidth: 0,
videoDuration: 229,
videoLandScape: 1,
// videoType: 0,
videoUrl: "https://cdnjdout.aikan.pdnews.cn/zhbj-20240116/vod/content/output/c72f4170db2c4d34befa453f60d39a69_opt.mp4",
firstFrameImageUri: ""
} as VideoInfoDTO
} as ContentDTO,
{
newsTitle: '遇见习近平丨北京正在书写历史',
description: "description6",
coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/7c54d59b63844464a261dcbba82c7aed.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
} as ContentDTO
]
} as CompDTO
// @State compDTO: CompDTO = {
// compStyle: 'compStyle3',
// operDataList: [
// {
// newsTitle: '时政微观察丨从外贸“成绩单”看中国经济新亮色',
// description: "description0",
// coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/a9028e7011bb440e94ba7c63d80b39b7.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
// } as ContentDTO,
// {
// newsTitle: '画好强国建设、民族复兴的最大同心圆',
// description: "description1",
// coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240116/image/display/80351784d4da4fc08b8987ba45a7647f.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
// } as ContentDTO,
// {
// newsTitle: '绿色“一带一路”十周年创新理念与实践案例',
// description: "description2",
// newsSummary: "共建“一带一路”倡议提出10年多来,在各方共同努力下,共建“一带一路”绿色发展取得积极进展,理念引领不断增强,交流机制不断完善,务实合作不断深化。",
// coverUrl: "",
// } as ContentDTO,
// {
// newsTitle: '瞭望 | 在深海聆听“幽灵粒子”',
// description: "description3",
// coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/b77a3577594d4d24b84e7b2b20e38e41.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
// } as ContentDTO,
// {
// newsTitle: '一图读懂|未来三年,长三角示范区安排了这些重大项目',
// description: "description4",
// coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/8d54ef1cbbe14ef08d6ab38f07867e4c.jpeg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
// } as ContentDTO,
// {
// newsTitle: '一头江豚的自述',
// description: "description5",
// newsSummary: "我是生活在长江里的一头江豚,是长江中唯一的水生哺乳动物,更是国家一级保护动物。但曾几何时,我和我的江中小伙伴出现了生存危机……直到有一天,我突然发现,打渔人变成护渔人,江水变清澈了,长江逐渐恢复了生机,我的家族数量上升到了1249头。当长江之水再一次悠悠流淌,我们相拥在清澈波光中起舞。长江,我的家园。",
// coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240116/image/display/2ec7bccff2324b05ac4b6503d868a381.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
// visitorComment: 10,
// videoInfo: {
// // clarity: 0,
// // resolutionHeight: 0,
// // resolutionWidth: 0,
// videoDuration: 229,
// videoLandScape: 1,
// // videoType: 0,
// videoUrl: "https://cdnjdout.aikan.pdnews.cn/zhbj-20240116/vod/content/output/c72f4170db2c4d34befa453f60d39a69_opt.mp4",
// firstFrameImageUri: ""
// } as VideoInfoDTO
// } as ContentDTO,
// {
// newsTitle: '遇见习近平丨北京正在书写历史',
// description: "description6",
// coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/7c54d59b63844464a261dcbba82c7aed.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
// } as ContentDTO
// ]
// } as CompDTO
watchCurrentBreakpoint() {
Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
}
aboutToAppear() {
Logger.info(TAG, `aboutToAppear, beanList:${this.compDTO?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`);
// Logger.info(TAG, `aboutToAppear, beanList:${this.compDTO?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`);
Logger.info(TAG, `aboutToAppear, beanList:${this.compListItem?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`);
}
aboutToDisappear() {
... ... @@ -106,16 +110,18 @@ export struct SingleColumn999Component {
}
build() {
if (this.compDTO && this.compDTO?.operDataList?.length > 0) {
// if (this.compDTO && this.compDTO?.operDataList?.length > 0) {
if (this.compListItem && this.compListItem?.operDataList?.length > 0) {
List({ space: 2, initialIndex: 0 }) {
// ListItemGroup({
// // footer: this.itemFooter("")
// }) {
ForEach(this.compDTO?.operDataList, (item: ContentDTO, index: number) => {
ListItem() {
this.buildPaperItem(item, index)
}
}, (item: ContentDTO, index: number) => JSON.stringify(item))
// ForEach(this.compDTO?.operDataList, (item: ContentDTO, index: number) => {
ForEach(this.compListItem?.operDataList, (item: ContentDTO, index: number) => {
ListItem() {
this.buildPaperItem(item, index)
}
}, (item: ContentDTO, index: number) => JSON.stringify(item))
// }
// .divider({ strokeWidth: 1, color: '#EFEFEF' }) // 每行之间的分界线
... ...
... ... @@ -3,7 +3,6 @@ import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant';
import { Logger } from 'wdKit';
import { CompUtils } from '../../utils/CompUtils';
import { WDRouterRule } from 'wdRouter';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { ProcessUtils } from '../../utils/ProcessUtils';
const TAG: string = 'CardView';
... ... @@ -400,7 +399,8 @@ export struct PaperSingleColumn999CardView {
.fontWeight(FontWeight.Bold)
.alignSelf(ItemAlign.Start)
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.margin({ left: 22, right: 22, top: 28 })
if (this.item?.coverUrl) {
Stack({ alignContent: Alignment.BottomEnd }) {
Image(this.item?.coverUrl)
... ... @@ -418,7 +418,7 @@ export struct PaperSingleColumn999CardView {
.fitOriginalSize(true)
}.width(CommonConstants.FULL_PARENT)
}
}
}.margin({ left: 22, right: 22 })
}
if (this.item?.newsSummary) {
Text(this.item?.newsSummary)
... ... @@ -426,23 +426,26 @@ export struct PaperSingleColumn999CardView {
.padding({ top: 10 })
.alignSelf(ItemAlign.Start)
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.margin({ left: 22, right: 22 })
}
if (this.item?.visitorComment) {
Row() {
Text(this.item?.visitorComment + "评")
.fontSize(12)
.fontColor(Color.Gray)
.margin({ left: 22 })
Image($r('app.media.icon_share'))
.width(16)
.height(16)
.margin(10)
.margin({ left: 10, right: 22, top: 10, bottom: 10 })
.backgroundColor(Color.Brown)
}.width(CommonConstants.FULL_PARENT)
.justifyContent(FlexAlign.SpaceBetween)
}
}
.backgroundColor(Color.White)
.margin({ bottom: 5 })
.margin({ bottom: 5, left: 12, right: 12 })
.borderRadius(4)
}
}
\ No newline at end of file
... ...
... ... @@ -12,16 +12,6 @@ export struct ENewspaperListDialog {
@State scrollIndex: number = 0
newspaperListBean: NewspaperListBean = {} as NewspaperListBean
private listScroller: Scroller = new Scroller();
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
let _scrollIndex = Number.parseInt(this.currentPageNum)
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "_swiperIndex:", _scrollIndex)
this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
this.listScroller.scrollToIndex(this.scrollIndex)
}
//文字版选择弹框
pageListDialogController: CustomDialogController = new CustomDialogController({
builder: ENewspaperPageDialog({
... ... @@ -37,6 +27,29 @@ export struct ENewspaperListDialog {
// 那么此处需要将指向自己的controller放在所有controller的后面
listDialogController: CustomDialogController
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
let _scrollIndex = Number.parseInt(this.currentPageNum)
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "_scrollIndex:", _scrollIndex)
this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
this.listScroller.scrollToIndex(this.scrollIndex)
}
aboutToAppear(): void {
console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum)
let _scrollIndex = Number.parseInt(this.currentPageNum)
console.log("ENewspaperListDialog-aboutToAppear", "_scrollIndex:", _scrollIndex)
this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
// this.listScroller.scrollToIndex(this.scrollIndex)
}
aboutToDisappear() {
// if (this.pageListDialogController) {
// this.pageListDialogController = null
// }
}
build() {
Column() {
Row()
... ... @@ -80,57 +93,61 @@ export struct ENewspaperListDialog {
.margin({ top: 20, left: 16, right: 16 })
.objectFit(ImageFit.Contain)
List({ scroller: this.listScroller }) {
List({ scroller: this.listScroller, initialIndex: this.scrollIndex }) {
ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {
ForEach(item.items, (positionItem: NewspaperPositionItemBean, itemIndex: number) => {
ListItem() {
Column() {
if (itemIndex == 0) {
Text(item.pageNum + item.pageName)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_ED2800'))
.fontWeight(600)
.margin({ top: 16, bottom: 16 })
.maxLines(1)
}
if (positionItem.shortTitle) {
Text(positionItem.shortTitle)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.maxLines(2)
ListItem() {
List() {
ForEach(item.items, (positionItem: NewspaperPositionItemBean, itemIndex: number) => {
ListItem() {
Column() {
if (itemIndex == 0) {
Text(item.pageNum + item.pageName)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_ED2800'))
.fontWeight(600)
.margin({ top: 16, bottom: 16 })
.maxLines(1)
}
if (positionItem.shortTitle) {
Text(positionItem.shortTitle)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.maxLines(2)
}
if (positionItem.title) {
Text(positionItem.title)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.margin({ top: 8 })
.maxLines(2)
}
if (positionItem.downTitle) {
Text(positionItem.downTitle)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.margin({ top: 8 })
.maxLines(2)
}
if (positionItem.newsTxt) {
Text(positionItem.newsTxt)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_999999'))
.margin({ top: 15, bottom: 15 })
.maxLines(5)
}
}
.alignItems(HorizontalAlign.Start)
}
if (positionItem.title) {
Text(positionItem.title)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.margin({ top: 8 })
.maxLines(2)
}
if (positionItem.downTitle) {
Text(positionItem.downTitle)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.margin({ top: 8 })
.maxLines(2)
}
if (positionItem.newsTxt) {
Text(positionItem.newsTxt)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_999999'))
.margin({ top: 15, bottom: 15 })
.maxLines(5)
}
}
.alignItems(HorizontalAlign.Start)
})
}
})
}
})
}
.width('100%')
... ... @@ -141,7 +158,17 @@ export struct ENewspaperListDialog {
color: '#EDEDED'
})
.onScrollIndex((firstIndex: number) => {
this.updateCurrentPageNum(firstIndex)
console.log('firstIndex', firstIndex)
})
.onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => {
console.info('first' + firstIndex)
console.info('last' + lastIndex)
console.info('center' + centerIndex)
// this.updateCurrentPageNum(firstIndex)
this.currentPageNum = `${centerIndex < 9 ? '0' + (centerIndex + 1) : centerIndex + 1}`
})
.onScroll((scrollOffset: number, scrollState: ScrollState) => {
console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset)
})
}
.width('100%')
... ... @@ -157,7 +184,7 @@ export struct ENewspaperListDialog {
for (let item of itemBean.items) {
index++
if (index == firstIndex) {
// this.currentPageNum = itemBean.pageNum
this.currentPageNum = itemBean.pageNum
return
}
}
... ...
... ... @@ -14,6 +14,7 @@ import {
} from 'wdBean';
const TAG = 'HttpRequest';
export class PageRepository {
static getBottomNavGroupUrl() {
// https: //pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup
... ... @@ -30,7 +31,7 @@ export class PageRepository {
+ "&refreshTime=" + DateTimeUtils.getTimeStamp()
+ "&pageId=" + pageId
// Logger.debug("TAG", 'getCompInfoUrl url: '+url);
Logger.info(TAG,"getPageInfoUrl url = "+url)
Logger.info(TAG, "getPageInfoUrl url = " + url)
return url;
}
... ... @@ -48,29 +49,29 @@ export class PageRepository {
+ "&pageSize=" + pageSize
+ "&pageNum=" + currentPage;
// Logger.debug("TAG", 'getCompInfoUrl url: '+url);
Logger.info(TAG,"getCompInfoUrl url = "+url)
Logger.info(TAG, "getCompInfoUrl url = " + url)
return url;
}
static getDetailInfoUrl(relId: string, contentId: string, relType: string) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.DETAIL_PATH;
url = url + "?relId=" + relId
+ "&contentId=" + contentId
+ "&relType=" + relType;
+ "&contentId=" + contentId
+ "&relType=" + relType;
// Logger.debug("TAG", 'getCompInfoUrl url: '+url);
Logger.info(TAG,"getDetailInfoUrl url = "+url)
Logger.info(TAG, "getDetailInfoUrl url = " + url)
return url;
}
static getInteractDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH;
Logger.info(TAG,"getInteractDataUrl url = "+url)
Logger.info(TAG, "getInteractDataUrl url = " + url)
return url;
}
static getNewspaperInfoUrl(date: string) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.E_NEWSPAPER_INFO_PATH + "?date=" + date;
Logger.info(TAG,"getNewspaperInfoUrl url = "+url)
Logger.info(TAG, "getNewspaperInfoUrl url = " + url)
return url;
}
... ... @@ -78,7 +79,7 @@ export class PageRepository {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.E_NEWSPAPER_LIST_PATH;
url = url + "?date=" + date
+ "&pagesSize=" + pageSize;
Logger.info(TAG,"getNewspaperListUrl url = "+url)
Logger.info(TAG, "getNewspaperListUrl url = " + url)
return url;
}
... ... @@ -88,7 +89,7 @@ export class PageRepository {
static getMorningEveningPageInfoUrl(pageId: string) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_PAGE_INFO_PATH;
url = url + "?pageId=" + pageId;
Logger.info(TAG,"getMorningEveningPageInfoUrl url = "+url)
Logger.info(TAG, "getMorningEveningPageInfoUrl url = " + url)
return url;
}
... ... @@ -105,11 +106,11 @@ export class PageRepository {
* channelStrategy:频道策略
* topicId:专题id
* */
static getMorningEveningCompInfoUrl(pageId: number,groupId:number,refreshTime:string,pageNum:number,pageSize:number) {
static getMorningEveningCompInfoUrl(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number, pageSize: number) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH;
url = url + "?loadStrategy=first_load&pageNum="+pageNum+"&refreshTime="+refreshTime+"&pageId="
+pageId+"&channelStrategy=2&groupId="+groupId+"&topicId=10000009445&pageSize="+pageSize;
Logger.info(TAG,"getMorningEveningCompInfoUrl url = "+url)
url = url + "?loadStrategy=first_load&pageNum=" + pageNum + "&refreshTime=" + refreshTime + "&pageId="
+ pageId + "&channelStrategy=2&groupId=" + groupId + "&topicId=" + topicId + "&pageSize=" + pageSize;
Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url)
return url;
}
... ... @@ -176,8 +177,8 @@ export class PageRepository {
/**
* 获取早晚报compInfo
* */
static fetchMorningEveningCompInfo(pageId: number,groupId:number,refreshTime:string,pageNum:number,pageSize:number) {
let url = PageRepository.getMorningEveningCompInfoUrl(pageId,groupId,refreshTime,pageNum,pageSize)
static fetchMorningEveningCompInfo(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number, pageSize: number) {
let url = PageRepository.getMorningEveningCompInfoUrl(pageId, groupId, refreshTime, topicId, pageNum, pageSize)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<CompInfoBean>>(url, headers)
};
... ...
... ... @@ -6,7 +6,6 @@ import { PageRepository } from '../repository/PageRepository';
const TAG = 'MorningEveningViewModel'
export class MorningEveningViewModel {
static async getMorningEveningPageInfo(pageId: string): Promise<PageInfoBean> {
return new Promise<PageInfoBean>((success, error) => {
Logger.info(TAG, `getMorningEveningPageInfo pageInfo start`);
... ... @@ -31,27 +30,29 @@ export class MorningEveningViewModel {
})
}
static async getMorningEveningCompInfo(pageId: number,groupId:number,refreshTime:string,pageNum:number = 1,pageSize:number = 20): Promise<CompInfoBean> {
static async getMorningEveningCompInfo(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number = 1, pageSize: number = 20): Promise<CompInfoBean> {
return new Promise<CompInfoBean>((success, error) => {
Logger.info(TAG, `getMorningEveningCompInfo pageInfo start`);
PageRepository.fetchMorningEveningCompInfo(pageId,groupId,refreshTime,pageNum,pageSize).then((resDTO: ResponseDTO<CompInfoBean>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getMorningEveningCompInfo then navResDTO is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getMorningEveningCompInfo then code:${resDTO.code}, message:${resDTO.message}`);
error('resDTO Response Code is failure');
return
}
// let navResStr = JSON.stringify(navResDTO);
Logger.info(TAG, "getMorningEveningCompInfo then,navResDTO.timestamp:" + resDTO.timestamp);
success(resDTO.data);
}).catch((err: Error) => {
Logger.error(TAG, `getMorningEveningCompInfo catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
PageRepository.fetchMorningEveningCompInfo(pageId, groupId, refreshTime, topicId, pageNum, pageSize)
.then((resDTO: ResponseDTO<CompInfoBean>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getMorningEveningCompInfo then navResDTO is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getMorningEveningCompInfo then code:${resDTO.code}, message:${resDTO.message}`);
error('resDTO Response Code is failure');
return
}
// let navResStr = JSON.stringify(navResDTO);
Logger.info(TAG, "getMorningEveningCompInfo then,navResDTO.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getMorningEveningCompInfo catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
}
\ No newline at end of file
... ...
... ... @@ -81,22 +81,23 @@
"value": "#994D00"
},
{
"name":"color_B15900",
"name": "color_B15900",
"value": "#B15900"
},
{
"name": "main_red",
"value": "#E84026"
}, {
"name":"color_4D000000",
},
{
"name": "color_4D000000",
"value": "#4D000000"
},
{
"name":"color_CCCCCC",
"name": "color_CCCCCC",
"value": "#CCCCCC"
},
{
"name":"color_EDEDED",
"name": "color_EDEDED",
"value": "#EDEDED"
},
{
... ... @@ -108,9 +109,14 @@
"value": "#B2FFFFFF"
},
{
"name": "color_00304c",
"value": "#00304c"
},
{
"name": "color_transparent",
"value": "#00000000"
}
]
}
\ No newline at end of file
... ...