yangsunyue_wd

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

# Conflicts:
#	sight_harmony/commons/wdRouter/src/main/ets/router/WDRouterPage.ets
Showing 46 changed files with 1593 additions and 399 deletions

Too many changes to show.

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

... ... @@ -81,6 +81,11 @@ export class HttpUrlUtils {
* 我的收藏
*/
static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-interact/content/zh/c/interact";
/**
* 个人中心 我的评论列表
*/
static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList";
/**
* 早晚报列表
* 根据页面id获取页面楼层列表
... ... @@ -320,6 +325,11 @@ export class HttpUrlUtils {
return url
}
static getMineCommentListDataUrl() {
let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.MINE_COMMENT_LIST_DATA_PATH
return url
}
static getYcgCommonHeaders(): HashMap<string, string> {
let headers: HashMap<string, string> = new HashMap<string, string>()
... ...
... ... @@ -54,6 +54,8 @@ export function registerRouter() {
// }
if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) {
return WDRouterPage.detailPlayShortVideoPage
} else if (action.params?.detailPageType == 9 ) {
return WDRouterPage.multiPictureDetailPage
}
return WDRouterPage.detailPlayVodPage
})
... ...
... ... @@ -32,6 +32,8 @@ export class WDRouterPage {
static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage");
// 直播详情页
static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage");
// 多图(图集)详情页
static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage");
static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage");
... ... @@ -46,9 +48,13 @@ export class WDRouterPage {
static editUserNikeNamePage = new WDRouterPage("wdComponent", "ets/components/page/EditUserNikeNamePage");
//修改简介
static editUserIntroductionPage = new WDRouterPage("wdComponent", "ets/components/page/EditUserIntroductionPage");
//浏览历史
static browsingHistoryPage = new WDRouterPage("wdComponent", "ets/components/page/BrowsingHistoryPage");
//我的收藏
static myCollectionListPagePage = new WDRouterPage("wdComponent", "ets/components/page/MyCollectionListPage");
static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview");
//我的主页
static mineHomePage = new WDRouterPage("wdComponent", "ets/pages/MineHomePage");
// 隐私设置页
static privacySettingPage = new WDRouterPage("wdComponent", "ets/components/page/PrivacySettingPage");
// 关于页
... ... @@ -58,4 +64,5 @@ export class WDRouterPage {
// 设置密码页、设置手机号页等等 (需要传参)
static settingPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/SettingPasswordPage");
// static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview");
}
... ...
... ... @@ -16,5 +16,6 @@ export interface Params {
// 6.挂件详情页
// 7.沉浸式竖屏详情页
// 8.专辑竖屏详情页
// 9.多图(图集)详情页
detailPageType?:number; // 详情页类型
}
... ...
import { CompDTO } from 'wdBean';
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant';
import { BannerComponent } from './view/BannerComponent';
import { LabelComponent } from './view/LabelComponent';
... ... @@ -16,14 +16,78 @@ import {
import {
HorizontalStrokeCardThreeTwoRadioForOneComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import {
HorizontalStrokeCardThreeTwoRadioForTwoComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForTwoComponent';
import { AlbumCardComponent } from './view/AlbumCardComponent';
/**
* comp适配器.
*/
@Preview
@Component
export struct CompParser {
compDTO: CompDTO = {} as CompDTO;
@State compDTO: CompDTO = {
compStyle: '17',
imageScale: 3,
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',
fullColumnImgUrls: [{
url: "https://uatjdcdnphoto.aikan.pdnews.cn/sjbj-20240104/image/display/c4a9b526e0994d1bbd3ac8450f5cfc6c.jpg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
},{
url:'https://uatjdcdnphoto.aikan.pdnews' +
'.cn/sjbj-20231208/image/display/d4496925a1264a749975ae9b01a4ef46.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
},{
url: '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
compIndex: number = 0;
build() {
... ...
... ... @@ -16,31 +16,38 @@ export struct ENewspaperPageComponent {
private picWidth: number = 0
@State picHeight: number = 0
@State newspaperListBean: NewspaperListBean = {} as NewspaperListBean
@State currentPageNum: string = '01'
@Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01'
@State pageDialogShow: boolean = false
@State calendarDialogShow: boolean = false
@State calendarDate: string = ''
private swiperController: SwiperController = new SwiperController()
@State swiperIndex: number = 0;
//当前选择的日期标记
@State selectDate: Date = new Date()
//watch监听报纸页码回调
// onCurrentPageNumUpdated(): void {
// console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "date:", this.currentPageNum)
// let _swiperIndex = Number.parseInt(this.currentPageNum)
// console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "_swiperIndex:", _swiperIndex)
// this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
// }
onCurrentPageNumUpdated(): void {
console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
let _swiperIndex = Number.parseInt(this.currentPageNum)
console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "_swiperIndex:", _swiperIndex)
this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
}
//日历选择弹框
calendarDialogController: CustomDialogController = new CustomDialogController({
builder: ENewspaperCalendarDialog({ onDateChange: (date: RMCalendarBean) => {
console.log("onDateChange-日历选择弹框", "date:", JSON.stringify(date))
if (date.fullYear && date.month && date.date) {
this.calendarDate = `${date.fullYear}-${date.month > 9 ? date.month + 1 : '0' + (date.month + 1)}-${date.date > 9 ? date.date : '0' + date.date}`
this.currentPageNum = '01'
this.getNewspaperTime()
this.getNewspaperList()
builder: ENewspaperCalendarDialog({
selectDate: this.selectDate,
onDateChange: (date: RMCalendarBean) => {
console.log("onDateChange-日历选择弹框", "date:", JSON.stringify(date))
if (date.fullYear && date.month && date.date) {
let month: number = date.month + 1
this.calendarDate = `${date.fullYear}-${month > 9 ? month : '0' + month}-${date.date > 9 ? date.date : '0' + date.date}`
this.getNewspaperTime()
this.getNewspaperList()
this.selectDate = new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0)
}
}
} }),
}),
alignment: DialogAlignment.Top,
offset: { dx: 0, dy: 80 },
customStyle: true,
... ... @@ -48,16 +55,8 @@ export struct ENewspaperPageComponent {
//图片版选择弹框
pageDialogController: CustomDialogController = new CustomDialogController({
builder: ENewspaperPageDialog({
currentPageNum: this.currentPageNum,
dialogType: 0,
newspaperListBean: this.newspaperListBean,
onDateChange: (date: string, dialogType: number) => {
if (dialogType == 0) {
let _swiperIndex = Number.parseInt(this.currentPageNum)
console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "_swiperIndex:", _swiperIndex)
this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
}
}
}),
alignment: DialogAlignment.BottomStart,
offset: { dx: 0, dy: -90 },
... ... @@ -66,20 +65,45 @@ export struct ENewspaperPageComponent {
//文字报纸弹框
listDialogController: CustomDialogController = new CustomDialogController({
builder: ENewspaperListDialog({
currentPageNum: this.currentPageNum,
newspaperListBean: this.newspaperListBean }),
newspaperListBean: this.newspaperListBean
}),
alignment: DialogAlignment.Bottom,
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() {
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 } })
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('e_newspaper_back')
.onClick((event: ClickEvent) => {
router.back()
... ... @@ -98,8 +122,10 @@ export struct ENewspaperPageComponent {
.margin({ left: 2, bottom: 5 })
}
.alignItems(VerticalAlign.Bottom)
.alignRules({ middle: { anchor: "__container__", align: HorizontalAlign.Center },
center: { anchor: "__container__", align: VerticalAlign.Center } })
.alignRules({
middle: { anchor: "__container__", align: HorizontalAlign.Center },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id('e_newspaper_date')
.onClick(() => {
this.calendarDialogShow = !this.calendarDialogShow
... ... @@ -113,15 +139,19 @@ export struct ENewspaperPageComponent {
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 } })
.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 },
.alignRules({
top: { anchor: '__container__', align: VerticalAlign.Top },
left: { anchor: '__container__', align: HorizontalAlign.Start },
right: { anchor: '__container__', align: HorizontalAlign.End } })
right: { anchor: '__container__', align: HorizontalAlign.End }
})
.id('e_newspaper_top')
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
... ... @@ -140,19 +170,24 @@ export struct ENewspaperPageComponent {
.displayCount(1)
.margin({ top: 35, left: 10, right: 10 })
.id('e_newspaper_content')
.alignRules({ top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center } })
.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
this.swiperIndex = index
})
Image($r('app.media.newspaper_shadow'))
.height($r('app.float.vp_12'))
.margin({ left: 20, right: 20, top: -1 })
.objectFit(ImageFit.Contain)
.alignRules({ top: { anchor: "e_newspaper_content", align: VerticalAlign.Bottom },
.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 } })
right: { anchor: 'e_newspaper_content', align: HorizontalAlign.End }
})
.id('e_newspaper_shadow')
Row() {
... ... @@ -165,8 +200,10 @@ export struct ENewspaperPageComponent {
}
.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 } })
.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()
... ... @@ -190,8 +227,10 @@ export struct ENewspaperPageComponent {
}
.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 } })
.alignRules({
bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
left: { anchor: '__container__', align: HorizontalAlign.Start }
})
.id('e_newspaper_page_num')
.onClick((event: ClickEvent) => {
this.pageDialogShow = !this.pageDialogShow
... ... @@ -219,8 +258,10 @@ export struct ENewspaperPageComponent {
}
.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 } })
.alignRules({
bottom: { anchor: '__container__', align: VerticalAlign.Bottom },
right: { anchor: '__container__', align: HorizontalAlign.End }
})
.id('e_newspaper_read')
.onClick((event: ClickEvent) => {
this.listDialogController.open()
... ... @@ -232,24 +273,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'
}
}
... ...
// 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' }) // 每行之间的分界线
... ...
... ... @@ -36,12 +36,14 @@ export struct topicInfoView {
.fontSize(16)
.fontColor($r('app.color.white'))
.maxLines(1)
.backgroundColor($r('app.color.color_99636363'))
.borderRadius(2)
Image($r('app.media.more'))
.height($r('app.float.top_arrow_size'))
.width(20)
}
.margin({ top: 10 })
.margin({ top: 10, left: 16, right: 16 })
// .backgroundColor(Color.Red)
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
... ...
... ... @@ -6,17 +6,18 @@ const TAG = "RMCalendar"
@Component
export struct RMCalendar {
@State selectItem: RMCalendarBean = new RMCalendarBean()
private today: Date = new Date() // 当天
//选中的日期
private selectDay: Date = new Date()
// 开始日期
startDate: Date = new Date()
// 截止日期
endDate: Date = new Date()
//当前日期-当前显示的月份的第一天
private startDay: Date = new Date(
this.today.getFullYear(),
this.today.getMonth(),
1
)
// private startDay: Date = new Date(
// this.selectDay.getFullYear(),
// this.selectDay.getMonth(),
// 1
// )
// 是否有上一个月
@State private hasPre: boolean = true
// 是否有下一个月
... ... @@ -42,12 +43,12 @@ export struct RMCalendar {
itemFontColor: ResourceColor = "#333333"
itemFontWeight: FontWeight = FontWeight.Bold
// 今日字体颜色
todayFontColor: ResourceColor = "#ED2800"
selectDayFontColor: ResourceColor = "#ED2800"
// 不能使用的日期字体颜色
disabledFontColor: ResourceColor = "#CCCCCC"
// 选中日期字体颜色
selectFontColor: ResourceColor = "#FFFFFF"
// 选中日期背景颜色, 默认与todayFontColor一致
// 选中日期背景颜色, 默认与selectDayFontColor一致
selectItemBgColor: ResourceColor = "#ED2800"
@State private title: string = ''
// 计算的总加载
... ... @@ -57,7 +58,7 @@ export struct RMCalendar {
// 自定义每一项布局
public cellLayout?: (item: RMCalendarBean) => void
// 仅自定义 今日 样式,当使用cellLayout时,tadayLayout无效
todayLayout?: (item: RMCalendarBean) => void
selectDayLayout?: (item: RMCalendarBean) => void
// 计算item时,如需添加更多自定义属性时使用
reBuildDateItem?: (item: RMCalendarBean) => RMCalendarBean
// 选择变化监听,
... ... @@ -84,10 +85,10 @@ export struct RMCalendar {
cellLayout: this.cellLayout,
itemFontSize: this.itemFontSize,
itemFontColor: this.itemFontColor,
today: this.today.getTime(),
selectDay: this.selectDay.getTime(),
itemFontWeight: this.itemFontWeight,
todayFontColor: this.todayFontColor,
todayLayout: this.todayLayout,
selectDayFontColor: this.selectDayFontColor,
selectDayLayout: this.selectDayLayout,
selectItem: $selectItem,
selectFontColor: this.selectFontColor,
selectItemBgColor: this.selectItemBgColor,
... ... @@ -123,12 +124,12 @@ export struct RMCalendar {
*/
initAttr() {
if (!this.selectItemBgColor) {
this.selectItemBgColor = this.todayFontColor
this.selectItemBgColor = this.selectDayFontColor
}
this.today = new Date(
this.today.getFullYear(),
this.today.getMonth(),
this.today.getDate(),
this.selectDay = new Date(
this.selectDay.getFullYear(),
this.selectDay.getMonth(),
this.selectDay.getDate(),
)
// 开始日期
... ... @@ -137,24 +138,24 @@ export struct RMCalendar {
}
// 截止日期
if (!this.endDate) {
this.endDate = new Date(this.today.getFullYear() + 10, 11, 31)
this.endDate = new Date(this.selectDay.getFullYear() + 10, 11, 31)
}
if (this.today.getTime() < this.startDate.getTime()) {
this.startDay.setTime(this.startDate.getTime())
} else if (this.today.getTime() > this.endDate.getTime()) {
this.startDay.setTime(this.endDate.getTime())
if (this.selectDay.getTime() < this.startDate.getTime()) {
this.selectDay.setTime(this.startDate.getTime())
} else if (this.selectDay.getTime() > this.endDate.getTime()) {
this.selectDay.setTime(this.endDate.getTime())
} else {
this.startDay.setTime(this.today.getTime())
this.selectDay.setTime(this.selectDay.getTime())
}
}
aboutToAppear() {
this.initAttr()
let temp = new RMCalendarBean()
temp.time = this.today.getTime()
temp.time = this.selectDay.getTime()
this.selectItem = temp
this.calcDatas()
this.calcData()
}
/**
... ... @@ -163,12 +164,12 @@ export struct RMCalendar {
private nextMonth() {
// this.dates.slice(0, this.dates.length)
this.dates = []
const beforDate = new Date(this.startDay.getFullYear(), this.startDay.getMonth())
this.startDay.setMonth(this.startDay.getMonth() + 1)
const beforDate = new Date(this.selectDay.getFullYear(), this.selectDay.getMonth())
this.selectDay.setMonth(this.selectDay.getMonth() + 1)
if (this.onMonthChange) {
this.onMonthChange(new Date(this.startDay.getFullYear(), this.startDay.getMonth()), beforDate)
this.onMonthChange(new Date(this.selectDay.getFullYear(), this.selectDay.getMonth()), beforDate)
}
this.calcDatas()
this.calcData()
}
/**
... ... @@ -177,60 +178,57 @@ export struct RMCalendar {
private preMonth() {
// this.dates.slice(0, this.dates.length)
this.dates = []
const beforDate = new Date(this.startDay.getFullYear(), this.startDay.getMonth())
this.startDay.setMonth(this.startDay.getMonth() - 1)
const beforDate = new Date(this.selectDay.getFullYear(), this.selectDay.getMonth())
this.selectDay.setMonth(this.selectDay.getMonth() - 1)
if (this.onMonthChange) {
this.onMonthChange(new Date(this.startDay.getFullYear(), this.startDay.getMonth()), beforDate)
this.onMonthChange(new Date(this.selectDay.getFullYear(), this.selectDay.getMonth()), beforDate)
}
this.calcDatas()
this.calcData()
}
/**
* 具体计算
*/
private calcDatas() {
const startDay = this.startDay
this.title = `${startDay.getFullYear()}年${startDay.getMonth() + 1}月`
startDay.setDate(1)
private calcData() {
if (startDay.getFullYear() < this.startDate.getFullYear()
|| (startDay.getFullYear() == this.startDate.getFullYear() && startDay.getMonth() <= this.startDate.getMonth())) {
this.title = `${this.selectDay.getFullYear()}年${this.selectDay.getMonth() + 1}月`
this.selectDay.setDate(1)
if (this.selectDay.getFullYear() < this.startDate.getFullYear()
|| (this.selectDay.getFullYear() == this.startDate.getFullYear() && this.selectDay.getMonth() <= this.startDate.getMonth())) {
this.hasPre = false
} else {
this.hasPre = true
}
if (startDay.getFullYear() > this.endDate.getFullYear()
|| (startDay.getFullYear() == this.endDate.getFullYear() && startDay.getMonth() >= this.endDate.getMonth())) {
if (this.selectDay.getFullYear() > this.endDate.getFullYear()
|| (this.selectDay.getFullYear() == this.endDate.getFullYear() && this.selectDay.getMonth() >= this.endDate.getMonth())) {
this.hasNext = false
} else {
this.hasNext = true
}
// 计算第一个月
// 获取第一个月总天数
let endDay: Date = new Date(
startDay.getFullYear(),
startDay.getMonth() + 1,
// 创建一个整月的日期,获取一个月总天数
let selectDate: Date = new Date(
this.selectDay.getFullYear(),
this.selectDay.getMonth() + 1,
0, 23, 59, 59)
let tempDate: Date = new Date(
startDay.getFullYear(),
startDay.getMonth(),
startDay.getDate()
this.selectDay.getFullYear(),
this.selectDay.getMonth(),
this.selectDay.getDate()
)
//获取当月的总天数
const count = selectDate.getDate()
//当前日期是周几
const preCount = this.selectDay.getDay()
const totalCount = count + preCount
const count = endDay.getDate()
const preCount = startDay.getDay()
// const nextCount = 6 - endDay.getDay()
const nextCount = 0
const finilCount = count + preCount + nextCount
// 补齐上一个月
tempDate.setDate(tempDate.getDate() - preCount)
// 补齐上一个月差的天数,需要在当月展示的部分,下面计算日期循环加1天
tempDate.setDate(this.selectDay.getDate() - preCount)
// 添加日期
for (let index = 0; index < finilCount; index++) {
// 添加当月需要展示的日期
for (let index = 0; index < totalCount; index++) {
let item = new RMCalendarBean(
tempDate.getFullYear(),
tempDate.getMonth(),
... ...
... ... @@ -7,12 +7,12 @@ export struct RMCalenderCell {
itemFontSize: Length = 0
itemFontColor: ResourceColor = {} as ResourceColor
itemFontWeight: FontWeight = FontWeight.Normal
todayFontColor: ResourceColor = {} as ResourceColor
selectDayFontColor: ResourceColor = {} as ResourceColor
selectFontColor: ResourceColor = {} as ResourceColor
selectItemBgColor: ResourceColor = {} as ResourceColor
disabledFontColor: ResourceColor = {} as ResourceColor
// 今日时间戳
today: number = 0
selectDay: number = 0
@Link selectItem: RMCalendarBean
@Link selectedDates: Array<RMCalendarBean>
@Prop hasPre: boolean
... ... @@ -20,7 +20,7 @@ export struct RMCalenderCell {
@ObjectLink item: RMCalendarBean
// 自定义每一项布局
cellLayout?: (item: RMCalendarBean) => void
todayLayout?: (item: RMCalendarBean) => void
selectDayLayout?: (item: RMCalendarBean) => void
cellClick?: (item: RMCalendarBean) => void
disableClick?: (item: RMCalendarBean) => void
... ... @@ -43,8 +43,6 @@ export struct RMCalenderCell {
return this.disabledFontColor
} else if (this.selectItem && this.selectItem.time == this.item.time) {
return this.selectFontColor
} else if (this.item.time == this.today) {
return this.todayFontColor
}
return this.itemFontColor
}
... ... @@ -140,4 +138,5 @@ export struct RMCalenderCell {
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -45,7 +45,11 @@ export default struct MinePagePersonFunctionUI {
break;
}
case "收藏":{
WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage)
WDRouterRule.jumpWithPage(WDRouterPage.myCollectionListPagePage)
break;
}
case "历史":{
WDRouterRule.jumpWithPage(WDRouterPage.browsingHistoryPage)
break;
}
}
... ...
import { Logger, StringUtils } from 'wdKit'
import { Logger } from 'wdKit'
import { WDRouterPage, WDRouterRule } from 'wdRouter'
@Component
... ... @@ -22,7 +22,7 @@ export default struct MinePageUserSimpleInfoUI {
.backgroundColor($r('app.color.main_red'))
.width('110lpx')
.height('110lpx')
Image($r('app.media.mine_head_icon'))
Image($r('app.media.default_head'))
.width('108lpx')
.height('108lpx')
.objectFit(ImageFit.Cover)
... ... @@ -33,6 +33,8 @@ export default struct MinePageUserSimpleInfoUI {
.onClick(()=>{
if(!this.isLogin){
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
}else {
WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage)
}
})
... ...
... ... @@ -43,7 +43,7 @@ export struct FollowListDetailUI{
ListHasNoMoreDataUI()
}
}
}.cachedCount(7)
}.cachedCount(10)
.padding({left:'31lpx',right:'31lpx'})
.layoutWeight(1)
.scrollBar(BarState.Off)
... ...
import { LazyDataSource, StringUtils } from 'wdKit';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { CommentListItem } from '../../../viewmodel/CommentListItem';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
const TAG = "HomePageBottomComponent"
@Component
export struct HomePageBottomComponent{
@State style:number = 0; //0 评论 ,1 关注
@State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource();
@State data_comment: LazyDataSource<CommentListItem> = new LazyDataSource();
@State isLoading:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
@State count:number = 0;
aboutToAppear(){
this.getNewPageData()
}
build(){
Column(){
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
if(this.count === 0){
ListHasNoMoreDataUI({style:2})
.height('100%')
}else{
if(this.style === 1){
List({ space: 3 }) {
ListItem() {
Row(){
Text("关注更多人民号")
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('38lpx')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.margin({right:'4lpx'})
Image($r('app.media.arrow_icon_right'))
.objectFit(ImageFit.Auto)
.width('27lpx')
.height('27lpx')
}.height('69lpx')
.width('659lpx')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'31lpx',bottom:'4lpx'})
}
LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
ChildFollowComponent({data: item})
}
.onClick(() => {
})
}, (item: FollowListDetailItem, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
ListHasNoMoreDataUI()
}
}
}.cachedCount(15)
.padding({left:'31lpx',right:'31lpx'})
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}else if(this.style === 0){
List({ space: 3 }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({data: item})
}
.onClick(() => {
})
}, (item: CommentListItem, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
ListHasNoMoreDataUI()
}
}
}.cachedCount(15)
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}
}
.width('100%')
}
@Styles
listStyle() {
.backgroundColor(Color.White)
.height(72)
.width("100%")
.borderRadius(12)
}
getNewPageData(){
this.isLoading = true
//我的关注列表
if (this.style === 1){
if(this.hasMore){
let object = new FollowListDetailRequestItem(20,this.curPageNum)
MinePageDatasModel.getMineFollowListData(object,getContext(this)).then((value)=>{
if (!this.data_follow || value.list.length == 0){
this.hasMore = false
}else{
value.list.forEach((value)=>{
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1"))
})
this.data_follow.notifyDataReload()
this.count = this.data_follow.totalCount()
if (this.data_follow.totalCount() < value.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
})
}
}else if(this.style === 0){
if(this.hasMore){
let object = new FollowListDetailRequestItem(20,this.curPageNum)
MinePageDatasModel.getMineCommentListData(object,getContext(this)).then((value)=>{
if (!this.data_comment || value.list.length == 0){
this.hasMore = false
}else{
value.list.forEach((value)=>{
this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,value.createTime,value.commentContent))
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
})
}
}
}
}
@Component
struct ChildFollowComponent {
@ObjectLink data: FollowListDetailItem
build() {
Column(){
Blank().height('27lpx')
Row() {
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({right:'15lpx'})
Column(){
Text(this.data.cnUserName)
.fontWeight('400lpx')
.fontSize('31lpx')
.lineHeight('38lpx')
.fontColor($r('app.color.color_222222'))
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(1)
Text(`${this.data.introduction}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
if(this.data.status == "1"){
Row(){
Text(`已关注`)
.fontColor($r('app.color.color_CCCCCC'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius('6lpx')
.borderColor($r('app.color.color_F5F5F5'))
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.data.status = "0"
})
}else{
Row(){
Image($r('app.media.follow_icon'))
.margin({right:'4lpx'})
.width('23lpx')
.height('23lpx')
Text(`关注`)
.fontColor($r('app.color.color_ED2800'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.borderColor($r('app.color.color_1AED2800'))
.borderRadius('6lpx')
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.data.status = "1"
})
}
}.alignItems(VerticalAlign.Top)
.width('100%')
.layoutWeight(1)
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}.height('146lpx')
.justifyContent(FlexAlign.Center)
}
}
@Component
struct ChildCommentComponent {
@ObjectLink data: CommentListItem
build() {
Column(){
Row() {
Image(StringUtils.isEmpty(this.data.fromUserHeader)?$r('app.media.default_head'):this.data.fromUserHeader)
.objectFit(ImageFit.Auto)
.width('69lpx')
.height('69lpx')
.margin({right:'15lpx'})
Column(){
Text(this.data.fromUserName)
.fontSize('25lpx')
.lineHeight('35lpx')
.fontWeight('600lpx')
.fontColor($r('app.color.color_222222'))
.margin({bottom:'6lpx'})
.maxLines(1)
Text(`${this.data.createTime}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.lineHeight('31lpx')
.fontWeight('400lpx')
.maxLines(1)
}.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}
.margin({bottom:'10lpx'})
.width('100%')
.height('108lpx')
.padding({left:'31lpx',right:'31lpx'})
Row(){
Text(this.data.commentContent)
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontWeight('400lpx')
.fontSize('31lpx')
.lineHeight('46lpx')
.fontColor($r('app.color.color_222222'))
.margin({bottom:'10lpx'})
}.padding({left:'31lpx',right:'31lpx'})
.width('100%')
Row(){
Text(this.data.targetTitle)
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('38lpx')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.margin({right:'4lpx'})
.maxLines(3)
.width('616lpx')
Image($r('app.media.arrow_icon_right'))
.objectFit(ImageFit.Auto)
.width('27lpx')
.height('27lpx')
}
.padding({top:'17lpx',bottom:'17lpx',left:'23lpx',right:'23lpx'})
.width('662lpx')
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'19lpx',bottom:'31lpx'})
Divider().width('100%')
.height('12lpx')
.strokeWidth('12lpx')
.backgroundColor($r('app.color.color_F5F5F5'))
}
.justifyContent(FlexAlign.Center)
}
}
\ No newline at end of file
... ...
import { ResourcesUtils } from 'wdKit'
import { ResponseDTO } from 'wdNetwork'
import { MyCollectionModel } from '../../model/MyCollectionModel'
import { CustomTitleUI } from '../reusable/CustomTitleUI'
import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel';
import PageModel from '../../viewmodel/PageModel';
import { CommonConstants, ViewType } from 'wdConstant'
import { EmptyComponent } from '../view/EmptyComponent'
import { ErrorComponent } from '../view/ErrorComponent'
import RefreshLayout from './RefreshLayout'
import { RefreshLayoutBean } from './RefreshLayoutBean';
import { CompDTO } from 'wdBean'
import LoadMoreLayout from './LoadMoreLayout'
import NoMoreLayout from './NoMoreLayout'
import { CompParser } from '../CompParser'
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { listTouchEvent } from '../../utils/PullDownRefresh';
@Entry
@Component
struct BrowsingHistoryPage {
private browsingHistoryList:MyCollectionModel[] = []
@State private browSingModel: PageModel = new PageModel()
aboutToAppear(){
ResourcesUtils.getResourcesJson<ResponseDTO<MyCollectionModel[]>>(getContext(this),'browsingHistory_list_data.json').then((success)=>{
success.data?.forEach(element => {
this.browsingHistoryList.push(element)
});
console.log("ycg",this.browsingHistoryList.length.toString());
})
// this.getData()
}
build() {
Column(){
CustomTitleUI({titleName:'浏览历史'})
List({}){
ForEach(
this.browsingHistoryList,
(item: MyCollectionModel) =>{
ListItem(){
this.HistoryItem(item)
}
}
)
if (this.browSingModel.viewType == ViewType.LOADING){
this.LoadingLayout()
}else if(this.browSingModel.viewType == ViewType.ERROR){
ErrorComponent()
}else if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent()
}else {
this.ListLayout()
}
}
.height('100%')
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
.onTouch((event: TouchEvent | undefined) => {
if (event) {
if (this.browSingModel.viewType === ViewType.LOADED) {
listTouchEvent(this.browSingModel, event);
}
}
})
}
@Builder
HistoryItem(item: MyCollectionModel){
Column(){
Row(){
Column(){
Text('就像是一场不断升级的权亡。')
.maxLines(3)
Text('2024-03-14')
.margin({top:10,bottom:0})
}
.width('60%')
.alignItems(HorizontalAlign.Start)
@Builder ListLayout() {
List() {
// 下拉刷新
ListItem() {
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullDown, this.browSingModel.pullDownRefreshImage,
this.browSingModel.pullDownRefreshText, this.browSingModel.pullDownRefreshHeight)
})
}
Blank()
LazyForEach(this.browSingModel.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
Column() {
CompParser({ compDTO: compDTO, compIndex: compIndex });
}
}
})
Image('')
.backgroundColor(Color.Orange)
.width('30%')
.height(80)
.margin({top:10})
// 加载更多
ListItem() {
if (this.browSingModel.hasMore) {
LoadMoreLayout({
refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullUpLoad, this.browSingModel.pullUpLoadImage,
this.browSingModel.pullUpLoadText, this.browSingModel.pullUpLoadHeight)
})
} else {
NoMoreLayout()
}
}
Blank()
Divider()
.width('90%')
}
.width('100%')
.height(100)
.height(CommonConstants.FULL_PARENT)
}
@Builder LoadingLayout() {
CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) })
}
async getData() {
this.browSingModel.currentPage = 1
MyCollectionViewModel.newFetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(pageDto => {
if (pageDto && pageDto.compList && pageDto.compList.length > 0) {
this.browSingModel.viewType = ViewType.LOADED;
this.browSingModel.compList.push(...pageDto.compList)
if (pageDto.compList.length === this.browSingModel.pageSize) {
this.browSingModel.currentPage++;
this.browSingModel.hasMore = true;
} else {
this.browSingModel.hasMore = false;
}
} else {
this.browSingModel.viewType = ViewType.EMPTY;
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -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
... ...
... ... @@ -19,7 +19,7 @@ const TAG = 'MinePageComponent';
export struct MinePageComponent {
//是否是创作者
@State isCreator:boolean = false
@State isLogin:boolean = false
@State isLogin:boolean = false //默认 false 测试放开
@State userName:string = "登陆注册"
@State personalData:MinePagePersonalFunctionsItem[] = []
@State creatorData:MinePageCreatorFunctionsItem[] = []
... ...
import { CustomTitleUI } from '../reusable/CustomTitleUI'
import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel';
import PageModel from '../../viewmodel/PageModel';
import { CommonConstants, ViewType } from 'wdConstant'
import { EmptyComponent } from '../view/EmptyComponent'
import { ErrorComponent } from '../view/ErrorComponent'
import RefreshLayout from './RefreshLayout'
import { RefreshLayoutBean } from './RefreshLayoutBean';
import { CompDTO } from 'wdBean'
import LoadMoreLayout from './LoadMoreLayout'
import NoMoreLayout from './NoMoreLayout'
import { CompParser } from '../CompParser'
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
@Entry
@Component
struct MyCollectionListPage {
@State private browSingModel: PageModel = new PageModel()
isloading : boolean = false
aboutToAppear(){
// this.getData()
}
build() {
Column(){
CustomTitleUI({titleName:'我的收藏'})
if (this.browSingModel.viewType == ViewType.LOADING){
this.LoadingLayout()
}else if(this.browSingModel.viewType == ViewType.ERROR){
ErrorComponent()
}else if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent()
}else {
this.ListLayout()
}
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
}
@Builder ListLayout() {
List() {
// 下拉刷新
ListItem() {
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullDown, this.browSingModel.pullDownRefreshImage,
this.browSingModel.pullDownRefreshText, this.browSingModel.pullDownRefreshHeight)
})
}
LazyForEach(this.browSingModel.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
Column() {
CompParser({ compDTO: compDTO, compIndex: compIndex });
}
}
})
// 加载更多
ListItem() {
if (this.browSingModel.hasMore) {
LoadMoreLayout({
refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullUpLoad, this.browSingModel.pullUpLoadImage,
this.browSingModel.pullUpLoadText, this.browSingModel.pullUpLoadHeight)
})
} else {
NoMoreLayout()
}
}
}
.height(CommonConstants.FULL_PARENT)
}
@Builder LoadingLayout() {
CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) })
}
async getData() {
this.browSingModel.currentPage = 1
MyCollectionViewModel.newFetchMyCollectList(1,'1',this.browSingModel.currentPage,getContext(this)).then(pageDto => {
if (pageDto && pageDto.compList && pageDto.compList.length > 0) {
this.browSingModel.viewType = ViewType.LOADED;
this.browSingModel.compList.push(...pageDto.compList)
if (pageDto.compList.length === this.browSingModel.pageSize) {
this.browSingModel.currentPage++;
this.browSingModel.hasMore = true;
} else {
this.browSingModel.hasMore = false;
}
} else {
this.browSingModel.viewType = ViewType.EMPTY;
}
})
}
}
\ No newline at end of file
... ...
import { CompDTO } from 'wdBean'
import { Action, CompDTO, Params } from 'wdBean';
import { DateTimeUtils, Logger } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
const TAG = 'AlbumCardComponent';
... ... @@ -97,6 +98,15 @@ export struct AlbumCardComponent {
}
.width(343)
.height(154)
.onClick((event: ClickEvent) => {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 9
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
})
Row() {
if (this.compDTO.operDataList[0].source) {
... ...
... ... @@ -6,11 +6,14 @@ export struct ENewspaperCalendarDialog {
calendarDialogController?: CustomDialogController
// 选择变化监听,
onDateChange?: (date: RMCalendarBean) => void
//当前选择的日期标记
@Prop selectDate: Date = new Date()
build() {
RMCalendar({
// 开始日期
startDate: new Date(2023, 8, 1),
startDate: new Date(2000, 1, 1),
selectDay: this.selectDate,
// 截止日期
endDate: new Date(),
// 日期选择变化监听
... ...
... ... @@ -7,7 +7,7 @@ import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'
*/
@CustomDialog
export struct ENewspaperListDialog {
@Link currentPageNum: string
@Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string
@State pageDialogShow: boolean = false
@State scrollIndex: number = 0
newspaperListBean: NewspaperListBean = {} as NewspaperListBean
... ... @@ -15,18 +15,8 @@ export struct ENewspaperListDialog {
//文字版选择弹框
pageListDialogController: CustomDialogController = new CustomDialogController({
builder: ENewspaperPageDialog({
currentPageNum: this.currentPageNum,
dialogType: 1,
newspaperListBean: this.newspaperListBean,
onDateChange: (date: string, dialogType: number) => {
if (dialogType == 1) {
console.log("ENewspaperListDialog-pageListDialogController", "date:", this.currentPageNum)
let _scrollIndex = Number.parseInt(this.currentPageNum)
console.log("ENewspaperListDialog-pageListDialogController", "_swiperIndex:", _scrollIndex)
this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
this.listScroller.scrollToIndex(this.scrollIndex)
}
}
}),
alignment: DialogAlignment.TopStart,
offset: { dx: 0, dy: 214 },
... ... @@ -37,14 +27,39 @@ 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)
let scrollIndexEnd = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
this.listScroller.scrollToIndex(scrollIndexEnd)
}
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()
.width(43)
.height(4)
.backgroundColor('#EDEDED')
.margin({ top: 10,
bottom: 10 })
.margin({
top: 10,
bottom: 10
})
Row() {
Text(this.currentPageNum)
.fontSize($r('app.float.font_size_36'))
... ... @@ -78,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)
}
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.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.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.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)
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)
}
}
.alignItems(HorizontalAlign.Start)
}
})
})
}
}
})
}
.width('100%')
... ... @@ -139,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%')
... ...
... ... @@ -7,10 +7,12 @@ import { NewspaperListBean, NewspaperListItemBean } from 'wdBean/Index'
export struct ENewspaperPageDialog {
dialogType: number = 0 //0:图片版,1:文字版
pageDialogController?: CustomDialogController
@Link currentPageNum: string
@Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string
@Prop newspaperListBean: NewspaperListBean = {} as NewspaperListBean
// 选择变化监听,
onDateChange?: (date: string, dialogType: number) => void
onCurrentPageNumUpdated(): void {
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
}
build() {
Column() {
... ... @@ -36,9 +38,6 @@ export struct ENewspaperPageDialog {
.backgroundColor(this.currentPageNum != item.pageNum ? Color.White : $r('app.color.color_ED2800'))
.onClick((event: ClickEvent) => {
this.currentPageNum = item.pageNum
if (this.onDateChange) {
this.onDateChange(item.pageNum, this.dialogType)
}
if (this.pageDialogController) {
this.pageDialogController.close()
}
... ...
... ... @@ -12,6 +12,7 @@ import { FollowListItem } from '../viewmodel/FollowListItem';
import { MineFollowListItem } from '../viewmodel/MineFollowListItem';
import { QueryListIsFollowedItem } from '../viewmodel/QueryListIsFollowedItem';
import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem';
import { MineCommentListDetailItem } from '../viewmodel/MineCommentListDetailItem';
const TAG = "MinePageDatasModel"
... ... @@ -295,6 +296,48 @@ class MinePageDatasModel{
}
/**
* 我的评论列表
* @param params
* @param context
* @returns
*/
getMineCommentListData(params:FollowListDetailRequestItem,context: Context): Promise<MineCommentListDetailItem> {
return new Promise<MineCommentListDetailItem>((success, error) => {
Logger.info(TAG, `getAppointmentList start`);
this.fetchMineCommentListData(params).then((navResDTO: ResponseDTO<MineCommentListDetailItem>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getMineCommentListDataLocal(context))
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
let navigationBean = navResDTO.data as MineCommentListDetailItem
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getMineCommentListDataLocal(context))
})
})
}
fetchMineCommentListData(object:FollowListDetailRequestItem) {
let url = HttpUrlUtils.getMineCommentListDataUrl()+`?pageSize=${object.pageSize}&pageNum=${object.pageNum}`
let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
return WDHttp.get<ResponseDTO<MineCommentListDetailItem>>(url, headers)
};
async getMineCommentListDataLocal(context: Context): Promise<MineCommentListDetailItem> {
Logger.info(TAG, `getMineFollowListDataLocal start`);
let compRes: ResponseDTO<MineCommentListDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineCommentListDetailItem>>(context,'mine_comment_list_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
return new MineCommentListDetailItem()
}
Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
}
const minePageDatasModel = MinePageDatasModel.getInstance()
... ...
import router from '@ohos.router'
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent';
@Entry
@Component
struct MineHomePage {
@State tileOpacity: number = 0;
firstPositionY:number = 0;
@State isHasIntroduction: boolean = true
@State desc:string = "点击添加简介,让大家认识你" //text 搞两个样式,如果三行,就显示 另外一个text 没有显示高度的
fontColor: string = '#999999'
selectedFontColor: string = '#000000'
@State currentIndex: number = 0
private controller: TabsController = new TabsController()
isChangeToUserEdit = false;
build() {
Stack({ alignContent: Alignment.Top }){
Image($r('app.media.title_bg'))
.width('100%')
.height('355lpx')
.objectFit(ImageFit.Cover)
Column(){
Stack({ alignContent: Alignment.Top }){
this.MineHomeTitleTransparent()
this.MineHomeTitleWhite()
}
Scroll() {
Column() {
//用户信息区域
Row() {
Image($r('app.media.default_head'))
.width('115lpx')
.height('115lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
Column() {
Row() {
Text("人民日报6G")
.fontColor($r('app.color.white'))
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize('38lpx')
.lineHeight('50lpx')
.fontWeight('500lpx')
Text("等级8")
.textAlign(TextAlign.Center)
.fontColor($r('app.color.color_ED2800'))
.backgroundColor($r('app.color.white'))
.fontSize('19lpx')
.width('96lpx')
.height('35lpx')
.margin({ left: '10lpx' })
Blank()
}.width('507lpx')
Row() {
Row() {
Text("3.6万")
.textStyle()
Text("阅读")
.textStyle2()
}
.margin({ right: '15lpx' })
Divider()
.height('19lpx')
.width('2lpx')
.color($r('app.color.white'))
.vertical(true)
.opacity(0.4)
Row() {
Text("6242")
.textStyle()
Text("评论")
.textStyle2()
}.margin({ right: '15lpx', left: '15lpx' })
Divider()
.height('19lpx')
.width('2lpx')
.color($r('app.color.white'))
.vertical(true)
.opacity(0.4)
Row() {
Text("86")
.textStyle()
Text("关注")
.textStyle2()
}.margin({ left: '15lpx' })
}.margin({ top: '23lpx' })
}.alignItems(HorizontalAlign.Start)
.margin({ left: '32lpx' })
}
.onAreaChange((oldValue: Area, newValue: Area) => {
if (this.firstPositionY === 0) {
this.firstPositionY = newValue.globalPosition.y as number
}else{
let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3)
if(persent > 1){
persent = 1
}
this.tileOpacity = persent
}
})
.backgroundColor($r('app.color.color_transparent'))
.height('184lpx')
.width('100%')
.padding({ left: '35lpx' })
//用户简介区域
Column() {
Row() {
Text(this.desc)
.fontSize('27lpx')
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.lineHeight('40lpx')
.fontWeight('400lpx')
.fontColor(this.isHasIntroduction?$r('app.color.color_222222'):$r('app.color.color_999999'))
.textAlign(TextAlign.Start)
if(!this.isHasIntroduction){
Image($r('app.media.user_info_edit_icon'))
.width('27lpx')
.height('27lpx')
.objectFit(ImageFit.Auto)
}
}
Text("来到人民日报365天")
.fontSize('23lpx')
.lineHeight('25lpx')
.fontWeight('400lpx')
.fontColor($r('app.color.color_999999'))
.textAlign(TextAlign.Start)
.margin({ top: '15lpx' })
}.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'})
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Center)
.width('100%')
.backgroundColor($r('app.color.white'))
//间隔符
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
//tab 页面
Tabs({controller: this.controller}) {
TabContent() {
HomePageBottomComponent({style:0})
}.tabBar(this.TabBuilder(0,"评论"))
TabContent() {
HomePageBottomComponent({style:1})
}.tabBar(this.TabBuilder(1,"关注"))
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
.onChange((index: number) => {
this.currentIndex = index
})
.vertical(false)
.height("100%")
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
}
}.width('100%')
.height('100%')
}
@Builder MineHomeTitleTransparent() {
RelativeContainer() {
//标题栏目
Image($r('app.media.icon_arrow_left_white') )
.width('46lpx')
.height('46lpx')
.objectFit(ImageFit.Auto)
.id("back_icon")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.margin({ left: '31lpx' })
.onClick(() => {
router.back()
})
Text("编辑资料")
.height('42lpx')
.maxLines(1)
.id("rightText")
.fontSize('35lpx')
.fontWeight('400lpx')
.fontColor($r('app.color.white') )
.lineHeight('42lpx')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
right: { anchor: "__container__", align: HorizontalAlign.End }
})
.margin({ right: '31lpx' })
.onClick(()=>{
this.editUserInfo()
})
}
.visibility(this.tileOpacity > 0 ? 1 : 0)
.height('84lpx')
.width('100%')
.backgroundColor($r('app.color.color_transparent'))
}
@Builder MineHomeTitleWhite() {
RelativeContainer() {
//标题栏目
Image($r('app.media.back_icon'))
.width('46lpx')
.height('46lpx')
.objectFit(ImageFit.Auto)
.id("back_icon")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.margin({ left: '31lpx' })
.onClick(() => {
router.back()
})
Image($r('app.media.default_head'))
.width('60lpx')
.height('60lpx')
.objectFit(ImageFit.Auto)
.id("head_icon")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "back_icon", align: HorizontalAlign.End }
})
.margin({ left: '31lpx' })
.onClick(() => {
router.back()
})
Text("我的昵称")
.height('42lpx')
.maxLines(1)
.id("title")
.fontSize('35lpx')
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "head_icon", align: HorizontalAlign.End }
})
.margin({ left: '12lpx' })
Text("编辑资料")
.height('42lpx')
.maxLines(1)
.id("rightText")
.fontSize('35lpx')
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
right: { anchor: "__container__", align: HorizontalAlign.End }
})
.margin({ right: '31lpx' })
.onClick(()=>{
this.editUserInfo()
})
}
.visibility(this.tileOpacity > 0 ? 0 : 1)
.height('84lpx')
.width('100%')
.backgroundColor($r('app.color.white'))
.opacity(this.tileOpacity )
}
@Builder TabBuilder(index: number, title: string) {
Stack(){
Text(title)
.height('38lpx')
.fontSize('33lpx')
.fontWeight(this.currentIndex === index ? 600 : 400)
.fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
.lineHeight('38lpx')
if(this.currentIndex === index){
Divider()
.width('31lpx')
.height('4lpx')
.color('#ED2800')
.strokeWidth('4lpx')
.margin({top:'50lpx'})
.id("divTag")
}
}.onClick(()=>{
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('100%')
.width('100%')
.margin({right:'9lpx'})
}
/**
* 跳转编辑资料(防止二次点击)
*/
editUserInfo(){
if(!this.isChangeToUserEdit){
this.isChangeToUserEdit = true;
let c = setInterval(() => {
this.isChangeToUserEdit = false
}, 1000);
//route 跳转写这里 TODO
WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage)
}
}
}
@Extend(Text) function textStyle() {
.fontColor($r('app.color.white'))
.textStyleDefault()
.margin({ right: '10lpx' })
}
@Extend(Text) function textStyle2() {
.textStyleDefault()
.fontColor($r('app.color.color_B2FFFFFF'))
}
@Extend(Text) function textStyleDefault() {
.textAlign(TextAlign.Start)
.fontSize('23lpx')
.fontWeight('400lpx')
.lineHeight('31lpx')
}
... ...
... ... @@ -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)
};
... ...
@Observed
export class CommentListItem{
fromUserHeader:string = ""
fromUserName:string = ""
commentContent:string = ""
targetTitle:string = ""
createTime:string = ""
constructor(fromUserHeader:string,fromUserName:string,targetTitle:string,createTime:string,commentContent:string ) {
this.fromUserHeader = fromUserHeader
this.fromUserName = fromUserName
this.commentContent = commentContent
this.targetTitle = targetTitle
this.createTime = createTime
}
}
... ...
... ... @@ -73,6 +73,7 @@ export class FollowListDetailItem{
attentionUserName:string = ""
fansNum :number = 0
constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:number,introduction:string,creatorId:string,status:string ) {
this.headPhotoUrl = headPhotoUrl
this.cnUserName = cnUserName
... ...
import { CommentListItem } from './CommentListItem'
export class MineCommentListDetailItem{
list:CommentListItem[] = []
pageNum: number = 0
pageSize: number = 20
totalCount: number = 0
constructor(list?:CommentListItem[],pageNum?: number,pageSize?: number,totalCount?: number) {
}
}
\ No newline at end of file
... ...
... ... @@ -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
... ...
import { MyCollectionListModel } from '../model/MyCollectionModel';
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { Logger } from 'wdKit';
import { Logger, ResourcesUtils } from 'wdKit';
import { PageDTO } from 'wdBean';
const TAG = "MyCollectionViewModel"
... ... @@ -28,22 +29,77 @@ class MyCollectionViewModel {
return WDHttp.get<ResponseDTO<MyCollectionListModel>>(url, headers)
}
async getAppointmentListDataLocal(context: Context): Promise<MyCollectionListModel> {
Logger.info(TAG, `getBottomNavDataMock start`);
let compRes: ResponseDTO<MyCollectionListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MyCollectionListModel>>(context,'browsingHistory_list_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`);
return new MyCollectionListModel()
}
Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
//Type 1 收藏 2 浏览历史
//tagId 收藏界面 标签筛选
fetchMyCollectList(type:number,tagId:string,pageNum:string):Promise<MyCollectionListModel>{
fetchMyCollectList(type:number,tagId:string,pageNum:string,context: Context):Promise<MyCollectionListModel>{
return new Promise<MyCollectionListModel>((success,error) => {
this.BaseGetRequest(type,tagId,pageNum).then((navResDTO: ResponseDTO<MyCollectionListModel>) => {
if (navResDTO) {
let listData = navResDTO.data as MyCollectionListModel
success(listData)
}else{
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
error("page data invalid");
if (!navResDTO || navResDTO.code != 0) {
success(this.getAppointmentListDataLocal(context))
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
let listData = navResDTO.data as MyCollectionListModel
success(listData)
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
error("page data invalid");
})
})
}
}
\ No newline at end of file
newBaseGetRequest(type:number,tagId:string,pageNum:number){
let url = HttpUrlUtils.getMyCollectionListDataUrl()+ `?type=${type}&operateTag=${1}&pageSize=${20}&pageNum=${pageNum.toString()}`
if (tagId.length > 0) {
url = url + `&tagId=${tagId}`
}
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders()
return WDHttp.get<ResponseDTO<PageDTO>>(url, headers)
}
newFetchMyCollectList(type:number,tagId:string,pageNum:number,context: Context):Promise<PageDTO>{
return new Promise<PageDTO>((success,error) => {
success(this.newGetAppointmentListDataLocal(type,context))
return
this.newBaseGetRequest(type,tagId,pageNum).then((navResDTO: ResponseDTO<PageDTO>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.newGetAppointmentListDataLocal(type,context))
return
}
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
let listData = navResDTO.data as PageDTO
success(listData)
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
error("page data invalid");
})
})
}
async newGetAppointmentListDataLocal(type:number, context: Context): Promise<PageDTO> {
Logger.info(TAG, `getBottomNavDataMock start`);
let compRes: ResponseDTO<PageDTO> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<PageDTO>>(context,type == 1?'MyCollection_list_data.json':'browsingHistory_list_data.json');
if (!compRes || !compRes.data) {
Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`);
return {} as PageDTO
}
Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
}
const collectionViewModel = MyCollectionViewModel.getInstance();
export default collectionViewModel as MyCollectionViewModel
\ No newline at end of file
... ...
... ... @@ -81,27 +81,44 @@
"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"
},
{
"name": "color_1AED2800",
"value": "#1AED2800"
},
{
"name": "color_B2FFFFFF",
"value": "#B2FFFFFF"
},
{
"name": "color_00304c",
"value": "#00304c"
},
{
"name": "color_transparent",
"value": "#00000000"
},
{
"name": "color_99636363",
"value": "#99636363"
}
]
}
\ No newline at end of file
... ...
... ... @@ -3,11 +3,14 @@
"components/MorningEveningPaper/MorningEveningPaperComponent",
"components/page/AppointmentListPage",
"components/page/FollowListPage",
"pages/MineHomePage",
"components/page/SettingPage",
"components/page/SettingAboutPage",
"components/page/PrivacySettingPage",
"components/page/EditUserInfoPage",
"components/page/EditUserNikeNamePage",
"components/page/EditUserIntroductionPage"
"components/page/EditUserIntroductionPage",
"components/page/BrowsingHistoryPage",
"components/page/MyCollectionListPage"
]
}
\ No newline at end of file
... ...
... ... @@ -39,15 +39,17 @@ struct ForgetPasswordPage {
isCodeSend: $isCodeSend
})
Row() {
Button("确认", { type: ButtonType.Normal })
Text("确认")
.layoutWeight(1)
.fontColor(this.isSubmit ?"#FFFFFFFF":"#66FFFFFF")
.borderRadius(4)
.fontSize(16)
.fontSize(18)
.textAlign(TextAlign.Center)
.fontWeight(FontWeight.Medium)
.margin({ top: 26 })
.height(44)
.backgroundColor("#ED2800")
.opacity(this.isSubmit ? 1 : 0.6)
.backgroundColor(this.isSubmit ?"#ED2800":"#99ED2800")
.enabled(this.isSubmit ? true : false)
.onClick(() => {
this.checkVerifyCode()
... ...
... ... @@ -21,6 +21,7 @@ export struct LoginInputComponent {
TextInput({ placeholder: "请输入手机号" })
.fontSize(16)
.height(48)
.maxLength(11)
.margin({ top: 36 })
.backgroundColor("#F5F5F5")
.borderRadius(4)
... ... @@ -44,22 +45,19 @@ export struct LoginInputComponent {
.fontColor("#222222")
.backgroundColor("#00000000")
.borderRadius({ topLeft: 4, bottomLeft: 4 })
.backgroundImage($r('app.media.login_code_bg_one'), ImageRepeat.NoRepeat)
.backgroundImageSize(ImageSize.Contain)
// .backgroundImage($r('app.media.login_code_bg_one'), ImageRepeat.NoRepeat)
// .backgroundImageSize(ImageSize.Contain)
.onChange((value) => {
this.codeContent = value
this.isSubmit = (this.phoneContent.length >= 11 && this.codeContent.length >= 6)
})
Text(this.isCodeSend ? this.timeCount + "s" : this.isFirst?"发送验证码":'重新发送')
.backgroundImage($r('app.media.login_code_bg'), ImageRepeat.NoRepeat)
.backgroundImageSize(ImageSize.Cover)
.fontColor('#ED2800')
.fontColor(this.codeBtnState?'#ED2800':'#80ED2800')
.width(110)
.fontSize(14)
.fontWeight(this.codeBtnState ? FontWeight.Bold : FontWeight.Normal)
.fontWeight( FontWeight.Bold)
.height(48)
.enabled(this.codeBtnState)// .align(Alignment.End)
.textAlign(TextAlign.Center)
.onClick(() => {
if (this.phoneContent.length < 11) {
... ... @@ -80,7 +78,12 @@ export struct LoginInputComponent {
})
}.margin({ top: 12 }).height(48).alignItems(VerticalAlign.Center).justifyContent(FlexAlign.Start)
}.margin({ top: 12 })
.height(48)
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Start)
.backgroundImage($r('app.media.code_login_bg'))
.backgroundImageSize({width:'100%',height:48})
}
}
\ No newline at end of file
... ...
... ... @@ -24,7 +24,6 @@ function isEmpty(obj: undefined | string | null): boolean {
const TAG = "LoginPage"
@Preview
@Entry
@Component
struct LoginPage {
... ... @@ -106,32 +105,32 @@ struct LoginPage {
Text() {
Span("我已阅读并同意").fontColor("#999999").fontSize(12)
Span("《用户协议》").fontColor("#ED2800").fontSize(12).onClick(() => {
//todo 协议
let bean={contentId:"1",pageID:""} as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)
})
Span("及").fontColor("#999999").fontSize(12)
Span("《隐私政策》").fontColor("#ED2800").fontSize(12).onClick(() => {
//todo 协议
let bean={contentId:"2",pageID:""} as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage,bean)
})
}
}.margin({ top: 28 }).alignItems(VerticalAlign.Center)
}.margin({ top: 48 }).alignItems(VerticalAlign.Center)
Row() {
Button("登录", { type: ButtonType.Normal })
Text("登录")
.borderRadius(4)
.fontSize(20)
.fontColor(this.isSubmit ?"#FFFFFFFF":"#66FFFFFF")
.fontSize(18)
.fontWeight(FontWeight.Medium)
.margin({ top: 20 })
.height(44)
.opacity(this.isSubmit ? 1 : 0.6)
.enabled(this.isSubmit ? true : false)
.textAlign(TextAlign.Center)
.width("100%")
.backgroundColor("#ED2800")
.backgroundColor(this.isSubmit?"#FFED2800":"#99ED2800")
.onClick(() => {
//todo 登录
if(!this.isSubmit){
return
}
this.loginSubmit()
})
... ... @@ -181,6 +180,7 @@ struct LoginPage {
Column() {
TextInput({ placeholder: "请输入账号", controller: this.phoneController })
.fontSize(16)
.maxLength(11)
.height(48)
.backgroundColor("#F5F5F5")
.borderRadius(4)
... ... @@ -327,7 +327,6 @@ struct LoginPage {
//登录
loginSubmit() {
Logger.debug(TAG, "loginSubmit " + this.checkCodePage)
//todo 判断是验证码登录还是密码登录
if (this.checkCodePage) {
if (isEmpty(this.phoneContent)) {
Logger.debug(TAG, "手机号为空")
... ...
@Entry
@Component
struct MultiPictureDetailPage {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
... ...
... ... @@ -4,6 +4,7 @@
"pages/web/DefaultWebPage",
"pages/ENewspaper",
"pages/ImageAndTextDetailPage",
"pages/MorningEveningPaperPage"
"pages/MorningEveningPaperPage",
"pages/detail/MultiPictureDetailPage"
]
}
\ No newline at end of file
... ...