张善主

Merge remote-tracking branch 'origin/main'

Showing 100 changed files with 1603 additions and 551 deletions

Too many changes to show.

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

... ... @@ -47,4 +47,5 @@ export class SpConstants{
//游客状态下首次评论时间
static FIRSTCOMMENTTIME = 'firstCommentTime'
static TOURIST_NICK_NAME = 'touristNickName'
}
\ No newline at end of file
... ...
... ... @@ -135,6 +135,14 @@ export class HttpUrlUtils {
*/
static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord";
/**
* 个人中心 - 消息
*/
static readonly APPOINTMENT_MessageList_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private";
/**
* 个人中心 - 消息 点赞数
*/
static readonly APPOINTMENT_getMessageLikeCount_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/getLikeCount";
/**
* 个人中心 我的评论列表
*/
static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList";
... ... @@ -316,6 +324,10 @@ export class HttpUrlUtils {
*/
static readonly FEEDBACK_TYPE_PATH: string = "/api/rmrb-interact/interact/c/user/optionClassify/list";
/**
* 查询点赞、回复我的、系统消息的未读数量以及回复/评论人
*/
static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime=";
static getHost(): string {
return HostManager.getHost();
... ... @@ -478,6 +490,16 @@ export class HttpUrlUtils {
return url
}
static getMessageListDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_MessageList_PATH
return url
}
static getMessageLikeCount() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_getMessageLikeCount_PATH
return url
}
static getExecuteCollcetUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH
return url
... ... @@ -714,4 +736,14 @@ export class HttpUrlUtils {
return url;
}
//获取消息未读接口
static getMessageUnReadDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MESSAGE_UN_READ_DATA_PATH
return url
}
static reportDeviceInfo() {
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push";
return url;
}
}
... ...
... ... @@ -136,4 +136,9 @@ export class WDRouterPage {
//意见反馈
static feedBackActivity = new WDRouterPage("wdComponent", "ets/components/FeedBackActivity");
// 人民号主页头像显示
static showHomePageHeaderPage = new WDRouterPage("wdComponent", "ets/pages/ShowHomePageHeaderPage");
}
... ...
... ... @@ -108,7 +108,11 @@ export class ProcessUtils {
break;
case ContentConstants.TYPE_TELETEXT:
// 图文详情,跳转h5
if(content?.linkUrl){ //有 linkUrl 走专题页展示逻辑
ProcessUtils.gotoSpecialTopic(content)
}else{
ProcessUtils.gotoWeb(content);
}
break;
case ContentConstants.TYPE_LINK:
ProcessUtils.gotoDefaultWeb(content);
... ... @@ -452,7 +456,15 @@ export class ProcessUtils {
pageID: 'FeedBackActivity'
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
/**
* 跳转到登录页
*/
public static gotoLoginPage() {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
}
}
... ...
... ... @@ -55,7 +55,7 @@ export struct WdWebLocalComponent {
.mixedMode(MixedMode.All)
.onlineImageAccess(true)
.enableNativeEmbedMode(true)
.layoutMode(WebLayoutMode.FIT_CONTENT)
// .layoutMode(WebLayoutMode.FIT_CONTENT)
// .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST })
.height(this.webHeight)
.onPageBegin((event) => {
... ...
... ... @@ -84,7 +84,7 @@ export class ContentDTO implements BaseDTO {
openType: string = '';
extra: string = ''
static clone(old:ContentDTO): ContentDTO {
static clone(old: ContentDTO): ContentDTO {
let content = new ContentDTO();
content.appStyle = old.appStyle;
content.cityCode = old.cityCode;
... ...
export interface commentInfo {
commentTitle: string,
newsTitle: string,
userName: string,
userHeaderUrl: string,
userId?: string,
userName?: string,
userHeaderUrl?: string,
publishTime: number,
commentId: string,
newsId: string,
relId: string;
relType: string;
userId: string;
newsType?: string
newsType?: string,
objectType?: string,
}
\ No newline at end of file
... ...
... ... @@ -67,7 +67,7 @@ export { FirstTabTopSearchComponent } from "./src/main/ets/components/search/Fir
export { ListHasNoMoreDataUI } from "./src/main/ets/components/reusable/ListHasNoMoreDataUI"
export { LottieView } from './src/main/ets/lottie/LottieView'
export { LottieView } from './src/main/ets/components/lottie/LottieView'
export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopicPageComponent'
... ...
import { CommonConstants, CompStyle } from 'wdConstant';
import { ContentDTO } from 'wdBean';
import { CompStyle } from 'wdConstant';
import { CompDTO, ContentDTO } from 'wdBean';
import { Card2Component } from './cardview/Card2Component';
import { Card3Component } from './cardview/Card3Component';
import { Card4Component } from './cardview/Card4Component';
... ... @@ -24,13 +24,14 @@ import { Card21Component } from './cardview/Card21Component';
@Component
export struct CardParser {
@State contentDTO: ContentDTO = new ContentDTO();
@State compDTO: CompDTO = {} as CompDTO
build() {
this.contentBuilder(this.contentDTO);
this.contentBuilder(this.contentDTO, this.compDTO);
}
@Builder
contentBuilder(contentDTO: ContentDTO) {
contentBuilder(contentDTO: ContentDTO, compDTO: CompDTO) {
if (contentDTO.appStyle === CompStyle.Card_02) {
Card2Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_03) {
... ... @@ -38,7 +39,7 @@ export struct CardParser {
} else if (contentDTO.appStyle === CompStyle.Card_04) {
Card4Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_05) {
Card5Component({ contentDTO })
Card5Component({ contentDTO, titleShowPolicy: compDTO.titleShowPolicy })
} else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle
.Card_13) {
Card6Component({ contentDTO })
... ... @@ -64,8 +65,7 @@ export struct CardParser {
Card20Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_21) {
Card21Component({ contentDTO })
}
else {
} else {
// todo:组件未实现 / Component Not Implemented
// Text(contentDTO.appStyle)
// .width(CommonConstants.FULL_PARENT)
... ...
... ... @@ -32,12 +32,12 @@ import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'
@Component
export struct CompParser {
@State compDTO: CompDTO = {} as CompDTO
@State private pageModel: PageModel = new PageModel();
@State compIndex: number = 0;
@State private pageModel: PageModel = new PageModel();
build() {
Column() {
if (this.compDTO.name !="月度排行卡") {
if (this.compDTO.name != "月度排行卡") {
this.componentBuilder(this.compDTO, this.compIndex);
}
... ... @@ -53,7 +53,8 @@ export struct CompParser {
} else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
ZhCarouselLayout01({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 && compDTO.imageScale === 2) {// && compDTO.name ==="横划卡"
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_01 &&
compDTO.imageScale === 2) { // && compDTO.name ==="横划卡"
LiveHorizontalCardComponent({ compDTO: compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
... ... @@ -87,7 +88,7 @@ export struct CompParser {
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
//头图卡 和comStyle 2相同,
Card5Component({ contentDTO: compDTO.operDataList[0] })
Card5Component({ contentDTO: compDTO.operDataList[0], titleShowPolicy: compDTO.titleShowPolicy })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
// 大图卡
... ... @@ -107,10 +108,9 @@ export struct CompParser {
//Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
} else if (!Number.isNaN(Number(compDTO.compStyle))) {
CardParser({ contentDTO: compDTO.operDataList[0] });
CardParser({ contentDTO: compDTO.operDataList[0], compDTO });
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
else {
} else {
Text(compDTO.compStyle)
.width(CommonConstants.FULL_PARENT)
.padding(10)
... ...
... ... @@ -69,6 +69,7 @@ export struct DynamicDetailComponent {
@State isNetConnected: boolean = true
@State isPageEnd: boolean = false
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State reachEndIncreament: number = 0
async aboutToAppear() {
await this.getContentDetailData()
... ...
... ... @@ -148,7 +148,7 @@ export struct ENewspaperPageComponent {
this.calendarDialogController.close()
}
})
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
Image($r('app.media.icon_share'))
.height($r('app.float.top_arrow_size'))
.width($r('app.float.top_arrow_size'))
... ... @@ -161,6 +161,7 @@ export struct ENewspaperPageComponent {
ToastUtils.showToast('分享为公共方法,待开发', 1000);
})
}
}
.margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
.height($r('app.float.top_bar_height'))
.alignRules({
... ... @@ -311,6 +312,7 @@ export struct ENewspaperPageComponent {
.width('100%')
.height('100%')
.backgroundColor($r('app.color.color_80000000'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.id('e_newspaper_container')
if (this.isOpenListDialog) {
... ...
... ... @@ -52,6 +52,7 @@ export struct ImageAndTextPageComponent {
@State isNetConnected: boolean = true
@State info: Area | null = null
@State likeNum: number = 0
@State reachEndIncreament : number = 0
build() {
Column() {
... ... @@ -141,7 +142,12 @@ export struct ImageAndTextPageComponent {
if (this.contentDetailData?.openComment) {
Divider().strokeWidth(6).color('#f5f5f5')
CommentComponent({
publishCommentModel: this.publishCommentModel
publishCommentModel: this.publishCommentModel,
fixedHeightMode: false,
reachEndIncreament: this.reachEndIncreament,
reachEndLoadMoreFinish: () => {
}
}).onAreaChange((oldValue: Area, newValue: Area) => {
this.info = newValue
})
... ... @@ -157,6 +163,9 @@ export struct ImageAndTextPageComponent {
.padding({ bottom: 76 })
.scrollBar(BarState.Off)
.align(Alignment.Top)
.onReachEnd(() => {
this.reachEndIncreament += 1
})
if (!this.isNetConnected) {
EmptyComponent({
... ... @@ -228,6 +237,7 @@ export struct ImageAndTextPageComponent {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
}
if (this.contentDetailData?.openAudio && this.contentDetailData?.audioList?.length &&
this.contentDetailData?.audioList[0].audioUrl) {
... ...
import { ContentDTO } from 'wdBean/Index';
import { ProcessUtils } from 'wdRouter/Index';
import { InteractMessageModel } from '../../model/InteractMessageModel'
@Component
export struct InteractMComponent {
messageModel:InteractMessageModel = new InteractMessageModel;
///"remark": "{"beReply":"乐事薯片,大家的最爱!!",
// "headUrl":"https: //uatjdcdnphoto.aikan.pdnews.cn//zhbj/img/user/2023122211/2A59F725E69849A38CEE8823B0D9D141.jpg",
// "contentId":"30035774121","contentRelObjectid":"2012","contentTitle":"乐事推出华夏风光限定罐七款城市地标包装让出游“有滋有味”",
// "commentContent":"大家都爱吃!!","userName":"人民日报网友a8dKCV","userId":"504964178466309","contentRelId":"500002866426",
// "shareUrl":"https: //pd-people-uat.pdnews.cn/column/30035774121-500002866426","userType":"1",
// "contentRelType":"1","visitor":"0","contentType":"8"}",
build() {
Row(){
Image('')
.backgroundColor(Color.Red)
Image(this.messageModel.InteractMsubM.headUrl)
.width(36)
.height(36)
.borderRadius(18)
Column(){
Row(){
Text('用户名')
Text(this.messageModel.InteractMsubM.userName)
.fontSize('14fp').fontColor('#222222')
Text('回复了你的评论')
Text(this.buildContentString())
.fontSize('14fp').fontColor('#999999')
.margin({left:5})
}.width('100%')
Text('两天前')
Text(this.messageModel.time)
.margin({top:2})
.fontSize('12fp').fontColor('#B0B0B0')
.fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10})
Text('评论内容')
.margin({top:8,bottom:10})
if (this.messageModel.contentType === '208' || this.messageModel.contentType === '209'){
Text(this.messageModel.message)
.margin({bottom:10})
.fontSize('16fp').fontColor('#222222')
.width('100%')
.constraintSize({maxHeight:500})
}
Column(){
Text('[你的评论]乐事薯片,大家的最爱').fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500})
.margin({top:5,bottom:5})
if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){
Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500})
.margin({top:15,bottom:10})
.width('100%')
Divider()
.color('#f5f5f5')
.backgroundColor('#f5f5f5')
.color('#EDEDED')
.backgroundColor('#EDEDED')
.width('100%')
.height(1)
}
Row(){
Text('乐事薯片,大家的最爱!!!!').fontSize('12fp').fontColor('#666666').constraintSize({maxHeight:500})
Image($r('app.media.MessageOriginTextIcon'))
.width('12')
.height('12')
Text(this.messageModel.InteractMsubM.contentTitle)
.fontSize('12fp')
.fontColor('#666666')
.maxLines(1)
.width('90%')
.textOverflow({overflow:TextOverflow.Ellipsis})
Blank()
Image($r('app.media.mine_user_edit'))
.width('12')
.height('12')
}.margin({top:5,bottom:5}).width('100%')
}.alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5)
}.padding({left:5}).alignItems(HorizontalAlign.Start)
}.padding({top:5,left:16,right:16}).width('100%').height(160).alignItems(VerticalAlign.Top).backgroundColor(Color.Red)
}.margin({top:10,bottom:15})
}.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5)
.onClick(()=>{
let contentDTO :ContentDTO = new ContentDTO();
contentDTO.objectType = this.messageModel.InteractMsubM.contentType
contentDTO.objectId = this.messageModel.InteractMsubM.contentId
ProcessUtils.processPage(contentDTO)
})
}.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%')
}.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top)
}
buildContentString(): string {
let contentString: string = ''
if (this.messageModel.contentType === '206') {
contentString = '赞了你的作品'
}else if(this.messageModel.contentType === '207'){
contentString = '赞了你的评论'
}else if(this.messageModel.contentType === '208'){
contentString = '评论了你的作品'
}else if(this.messageModel.contentType === '209'){
contentString = '回复了你的评论'
}else if(this.messageModel.contentType === '210'){
contentString = '转发了您的作品'
}else if(this.messageModel.contentType === '211'){
contentString = '关注了你'
}
return contentString;
}
buildCommentContent(): string {
let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply;
return contentString;
}
}
\ No newline at end of file
... ...
... ... @@ -61,6 +61,8 @@ export struct MorningEveningPaperComponent {
@State mixedBgColor: string = ''
// 顶部安全高度赋值
@State topSafeHeight: number = 0;
@State bottomSafeHeight: number = 0;
private audioDataList: AudioDataList[] = []
private playerController: WDPlayerController = new WDPlayerController();
simpleAudioDialog: CustomDialogController = new CustomDialogController({
... ... @@ -112,6 +114,7 @@ export struct MorningEveningPaperComponent {
// await windowHight.setWindowLayoutFullScreen(true);
// WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
this.topSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
this.bottomSafeHeight = px2vp(windowHight.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height)
const dailyPaperTopicPageId = await SPHelper.default.getSync('dailyPaperTopicPageId', "") as String
console.info(TAG, `aboutToAppear = ` + dailyPaperTopicPageId)
... ... @@ -248,14 +251,15 @@ export struct MorningEveningPaperComponent {
})
}
}
.height('100%')
.height(`calc(100% - ${this.bottomSafeHeight + this.topSafeHeight + 'vp'})`)
PaperTitleComponent()
}
.width('100%')
.height('100%')
.padding({
top: this.topSafeHeight
top: this.topSafeHeight,
bottom: this.bottomSafeHeight
})
// .backgroundColor(Color.Black)
// .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black)
... ...
... ... @@ -449,6 +449,7 @@ export struct MultiPictureDetailPageComponent {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
}
// this.contentDetailData.photoList = []
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
... ...
... ... @@ -72,6 +72,7 @@ export struct SpacialTopicPageComponent {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
// }
this.trySendData2H5()
}
... ...
... ... @@ -25,7 +25,7 @@ export struct RmhTitle {
/**
* 默认未关注 点击去关注
*/
@State followStatus: String = '0';
@State followStatus: string = '0';
/**
* 关注号主
... ... @@ -45,7 +45,7 @@ export struct RmhTitle {
status: this.followStatus == '0' ? 1 : 0,
}
ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
console.log('关注号主==', JSON.stringify(res.data))
console.log('rmhTitle-data', JSON.stringify(res.data))
if (this.followStatus == '1') {
this.followStatus = '0'
} else {
... ... @@ -63,7 +63,7 @@ export struct RmhTitle {
/**
* 查询当前登录用户是否关注作品号主
* */
private async getBatchAttentionStatus() {
async getBatchAttentionStatus() {
try {
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.rmhInfo?.rmhId ?? '' }]
... ... @@ -72,17 +72,17 @@ export struct RmhTitle {
this.followStatus = data[0]?.status;
Logger.info(`rmhTitle-followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
Logger.info(`rmhTitle-followStatus:${JSON.stringify(exception)}`)
}
}
aboutToAppear(): void {
this.getBatchAttentionStatus()
let page = router.getState();
if (page.path.includes('/page/PeopleShipHomePage') || page.path.includes('/pages/MainPage')) {
this.hideTime = true;
}
this.getBatchAttentionStatus()
}
getDaysBetweenDates(date: number) {
... ... @@ -143,13 +143,13 @@ export struct RmhTitle {
Blank()
if (this.rmhInfo.cnIsAttention) {
Row() {
if (this.followStatus === '0') {
if (Number(this.followStatus) === 0) {
Image($r('app.media.rmh_follow'))
.width(16)
.height(16)
}
Text(this.followStatus === '0' ? '关注' : '已关注')
Text(Number(this.followStatus) === 0 ? '关注' : '已关注')
.fontSize($r('app.float.font_size_13'))
.fontColor($r('app.color.color_ED2800'))
}
... ...
import { CompDTO } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import { DateTimeUtils, Logger } from 'wdKit/Index';
import PageModel from '../../viewmodel/PageModel';
/**
... ... @@ -59,9 +59,9 @@ export struct CardAdvBottom {
break;
}
}
Logger.error("ZZZXXXXX","currentIndex====>"+currentIndex);
if (currentIndex >= 0) {
this.pageModel.compList.deleteItem(currentIndex)
this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
}
}
}
... ...
import { CompDTO } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import { DateTimeUtils, Logger } from 'wdKit/Index';
import PageModel from '../../viewmodel/PageModel';
/**
... ... @@ -71,10 +71,9 @@ export struct CardAdvTop {
break;
}
}
Logger.error("ZZZXXXXX","currentIndex====>"+currentIndex);
if (currentIndex >= 0) {
this.pageModel.compList.deleteItem(currentIndex)
this.pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
}
}
}
... ...
... ... @@ -48,8 +48,9 @@ export struct Card10Component {
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
if (this.contentDTO.objectType == '5') {
Notes({ objectType: 5 }).margin({ left: 5, bottom: 5 })
}
}.alignContent(Alignment.BottomStart)
// 专题列表--后端返回三个,
... ... @@ -106,7 +107,7 @@ export struct Card10Component {
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(item.objectType == '5' ? 40 : 0)
.textIndent(item.objectType == '5' ? 38 : 0)
}.alignContent(Alignment.TopStart)
CardSourceInfo(
... ...
... ... @@ -102,6 +102,9 @@ struct createImg {
CardMediaInfo({ contentDTO: this.contentDTO })
}
.align(Alignment.BottomEnd)
.onClick((event: ClickEvent) => {
ProcessUtils.gotoVod(this.contentDTO)
})
}
}
}
... ...
... ... @@ -40,7 +40,7 @@ export struct Card2Component {
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.align(Alignment.Start)
.textIndent(this.contentDTO.objectType == '5' ? 40 : 0)
.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
}
.alignContent(Alignment.TopStart)
... ...
... ... @@ -12,7 +12,7 @@ const TAG: string = 'Card5Component';
@Component
export struct Card5Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State titleShowPolicy: number | string = 1
@Prop titleShowPolicy: number | string
@State loadImg: boolean = false;
@State clicked: boolean = false;
... ... @@ -22,12 +22,13 @@ export struct Card5Component {
build() {
Stack() {
Image(this.loadImg ? this.contentDTO.coverUrl : '')
.backgroundColor(0xf5f5f5)
.width(CommonConstants.FULL_WIDTH)
.autoResize(true)
.borderRadius($r('app.float.image_border_radius'))
// if ((this.titleShowPolicy === 1 || this.contentDTO.titleShow === 1) && this.contentDTO.newsTitle) {
if (this.titleShowPolicy === 1) {
Row()
.width(CommonConstants.FULL_WIDTH)
.height(59)
... ... @@ -41,20 +42,21 @@ export struct Card5Component {
if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text(this.contentDTO.newsTitle)
.width(CommonConstants.FULL_WIDTH)// .height(CommonConstants.FULL_HEIGHT)
.width(CommonConstants.FULL_WIDTH)
.fontColor(Color.White)
.fontSize($r('app.float.normal_text_size'))
.fontWeight(FontWeight.Bold)
.maxLines(2)
.align(Alignment.TopStart)
.textIndent(this.contentDTO.objectType == '5' ? 40 : 0)
.textIndent(this.contentDTO.objectType == '5' ? 35 : 0)
}.alignContent(Alignment.TopStart)
}
.justifyContent(FlexAlign.Start)
// .height(40)
.margin({ left: 12, bottom: 10, right: 12 })
// }
}
}
.alignContent(Alignment.Bottom)
.width(CommonConstants.FULL_WIDTH)
... ...
... ... @@ -49,7 +49,7 @@ export struct Card6Component {
.maxLines(3)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 60 :
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
(this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) ||
this.contentDTO.objectType == '5' ? 30 : 0)
}.alignContent(Alignment.TopStart)
... ...
... ... @@ -43,8 +43,11 @@ export struct Card9Component {
topRight: $r('app.float.image_border_radius')
})
if (this.contentDTO.objectType == '5') {
Notes({ objectType: 5 })
.margin({ left: 5, bottom: 5 })
}
}.alignContent(Alignment.BottomStart)
// 时间线--后端返回三个,
... ...
... ... @@ -13,10 +13,10 @@ export struct Notes {
build() {
if (this.returnTypeTitleFn()) {
Text(this.returnTypeTitleFn())
.fontSize($r('app.float.font_size_12'))
.fontSize($r('app.float.font_size_11'))
.padding({
left: 5,
right: 5,
left: 4,
right: 4,
top: 3,
bottom: 3
})
... ...
... ... @@ -20,6 +20,8 @@ export class publishCommentModel {
targetType: string = ''
/*评论总数*/
totalCommentNumer: string = '0'
/// 游客评论开关:visitorComment 1:打开;0:关闭
visitorComment: string = "0"
//评论传参
/*评论图片url,多个逗号隔开*/
... ...
... ... @@ -8,9 +8,11 @@ import { HttpUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import NoMoreLayout from '../../page/NoMoreLayout';
import { EmptyComponent } from '../../view/EmptyComponent';
import { ContentDetailDTO, Params } from 'wdBean/Index';
const TAG = 'CommentComponent';
const testString = '因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸'
// @Entry
... ... @@ -22,14 +24,20 @@ export struct CommentComponent {
@State isComments: boolean = true
/*必传*/
@ObjectLink publishCommentModel: publishCommentModel
@Consume contentDetailData: ContentDetailDTO
listScroller: ListScroller = new ListScroller(); // scroller控制器
historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset
isloading: boolean = false
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State dialogController: CustomDialogController | null = null;
// @State private browSingModel: commentListModel = new commentListModel()
// 是否为固定高度模式。true时,里面上拉加载更多生效,外层不能包Scroll。
// false时,外层实现加载更多,并通过reachEndIncreament通知开发加载更多,reachEndLoadMoreFinish 通知上层加载更多完成
fixedHeightMode: boolean = false
@Prop @Watch("parentOnReachEnd") reachEndIncreament : number = 0
reachEndLoadMoreFinish?: () => void
// 在自定义组件即将析构销毁时将dialogControlle置空
aboutToDisappear() {
this.dialogController = null // 将dialogController置空
... ... @@ -183,28 +191,49 @@ export struct CommentComponent {
// 加载更多
ListItem() {
if (this.hasMore === false) {
if (this.hasMore == false) {
NoMoreLayout()
}
}
}
}
.margin({bottom: 10})
.onReachEnd(() => {
if (!this.fixedHeightMode) {
return
}
if (this.hasMore) {
this.getData()
}
})
.enableScrollInteraction(false)
.enableScrollInteraction(this.fixedHeightMode ? true: false)
// .nestedScroll({
// scrollForward: NestedScrollMode.PARENT_FIRST,
// scrollBackward: NestedScrollMode.SELF_FIRST
// })
}
}
parentOnReachEnd() {
if (this.fixedHeightMode) {
return
}
if (this.hasMore) {
this.getData()
} else {
if (this.reachEndLoadMoreFinish) {
this.reachEndLoadMoreFinish()
}
}
}
//获取数据
async getData() {
commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId,
this.publishCommentModel.targetType)
.then(commentListModel => {
console.log('评论:', JSON.stringify(commentListModel.list))
this.currentPage++
if (Number.parseInt(commentListModel.totalCommentNum) >
... ... @@ -237,6 +266,9 @@ export struct CommentComponent {
} else {
this.hasMore = false
}
if (!this.fixedHeightMode && this.reachEndLoadMoreFinish) {
this.reachEndLoadMoreFinish()
}
})
}
}
... ... @@ -247,6 +279,7 @@ struct ChildCommentItem {
@Link publishCommentModel: publishCommentModel
@Link dialogController: CustomDialogController | null
@ObjectLink item: commentItemModel
@Consume contentDetailData: ContentDetailDTO
build() {
Column() {
... ... @@ -271,6 +304,14 @@ struct ChildCommentItem {
.alignContent(Alignment.Center)
.onClick(() => {
// TODO 跳转个人详情
// 跳转到号主页
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
})
//昵称
... ... @@ -455,7 +496,7 @@ struct commentHeaderView {
.margin({ left: 8 })
.alignContent(Alignment.Center)
.onClick(() => {
// TODO 跳转个人详情
commentViewModel.jumpToAccountPage(this.item)
})
//昵称
... ...
import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index'
import { publishCommentModel } from '../model/PublishCommentModel'
@CustomDialog
export struct CommentListDialog {
/// 内部使用
private publishCommentModel: publishCommentModel = new publishCommentModel()
controller?: CustomDialogController
/// 外部初始化
contentDetail?: ContentDetailDTO
pageInfo?: PageInfoDTO
build() {
}
}
\ No newline at end of file
... ...
... ... @@ -11,11 +11,12 @@ export struct CommentTabComponent {
}
@ObjectLink publishCommentModel: publishCommentModel
@Prop contentDetail: ContentDetailDTO
@Prop pageComponentType: number = -1 //1:视频详情页
/*展示类型*/
@State type: number = 1
@State placeHolder: string = '说两句...'
@State dialogController: CustomDialogController | null = null;
styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
/*回调方法*/
dialogControllerConfirm: () => void = () => {
}
... ... @@ -46,9 +47,36 @@ export struct CommentTabComponent {
Row() {
Stack({ alignContent: Alignment.Start }) {
RelativeContainer() {
if (this.pageComponentType === 1) {
Row() {
}
.width('100%')
.height(30)
.borderRadius(2)
.backgroundColor(this.pageComponentType === 1 ? '#1a1a1a' : Color.Transparent)
.margin({
right: 16,
})
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start },
right: { anchor: "__container__", align: HorizontalAlign.End },
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
.id("RowBg")
} else {
Image($r('app.media.comment_img_input_hui'))
.objectFit(ImageFit.Fill)
.resizable({ slice: { top: 1, left: 1, right: 20, bottom: 1 } })
.resizable({
slice: {
top: 1,
left: 1,
right: 20,
bottom: 1
}
})
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start },
... ... @@ -56,6 +84,7 @@ export struct CommentTabComponent {
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
})
.id("Image")
}
Text(this.placeHolder)
.fontSize(12)
.fontColor('#999999')
... ... @@ -91,7 +120,7 @@ export struct CommentIconComponent {
@ObjectLink publishCommentModel: publishCommentModel
/*展示类型*/
@State type: number = 1
styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
// aboutToAppear(): void {
// setTimeout(() => {
// this.publishCommentModel.totalCommentNumer = '444'
... ...
... ... @@ -412,33 +412,7 @@ struct QualityCommentItem {
jumpToAccountOwner() {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let item : Record<string, string >= {
"creatorId": this.item.fromCreatorId || "",
"userType": `${this.item.fromUserType}`,
"userId": this.item.fromUserId || "-1",
}
HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => {
if (!result.data || result.data.mainControl != 1) {
ToastUtils.longToast("暂时无法查看该创作者主页")
return
}
if (result.data.banControl == 1) {
ToastUtils.longToast("该账号已封禁,不予访问")
return
}
if (result.data.userType === "1") { // 普通用户
let params: Record<string, string> = {'userId': result.data.userId};
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
} else { // 非普通用户
ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId)
}
}).catch(() => {
ToastUtils.longToast("暂时无法查看该创作者主页")
})
commentViewModel.jumpToAccountPage(this.item)
}
jumpToDetail() {
... ...
import { MasterDetailRes } from 'wdBean/Index';
import { SpConstants } from 'wdConstant/Index';
import { DateTimeUtils, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index';
import {
AccountManagerUtils,
DateTimeUtils, DeviceUtil, Logger, SPHelper, ToastUtils, UserDataLocal } from 'wdKit/Index';
import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import {
commentItemModel,
commentListModel,
... ... @@ -160,7 +164,9 @@ class CommentViewModel {
publishComment(model: publishCommentModel) {
return new Promise<commentItemModel>((success, fail) => {
let url = HttpUrlUtils.getPublishCommentUrl()
const visitorMode = model.visitorComment == "1" && AccountManagerUtils.isLoginSync() == false
let url = visitorMode ? HttpUrlUtils.getNoUserPublishCommentUrl() : HttpUrlUtils.getPublishCommentUrl()
let bean: Record<string, string> = {};
bean['targetId'] = model.targetId;
... ... @@ -176,6 +182,11 @@ class CommentViewModel {
bean['targetType'] = model.targetType
bean['parentId'] = model.parentId
if (visitorMode) {
bean['deviceId'] = DeviceUtil.clientId()
bean['userName'] = SPHelper.default.getSync(SpConstants.TOURIST_NICK_NAME, "") as string
}
HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => {
if (data.code != 0) {
ToastUtils.showToast(data.message, 1000);
... ... @@ -185,10 +196,9 @@ class CommentViewModel {
ToastUtils.showToast(data.message, 1000);
let model = data.data as commentItemModel
let userId = HttpUtils.getUserId()
let FIRSTCOMMENTTIME = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '')
let firstCommentTime = SPHelper.default.getSync(SpConstants.FIRSTCOMMENTTIME, '') as string
if (!userId && !FIRSTCOMMENTTIME) {
if (visitorMode && firstCommentTime.length == 0) {
//保存首次评论时间
SPHelper.default.saveSync(SpConstants.FIRSTCOMMENTTIME, DateTimeUtils.formatDate(data.timestamp, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
}
... ... @@ -472,6 +482,36 @@ class CommentViewModel {
}
return false
}
jumpToAccountPage(commentItem: commentItemModel) {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let item : Record<string, string >= {
"creatorId": commentItem.fromCreatorId || "",
"userType": `${commentItem.fromUserType}`,
"userId": commentItem.fromUserId || "-1",
}
HttpBizUtil.post<ResponseDTO<MasterDetailRes>>(url, item).then((result) => {
if (!result.data || result.data.mainControl != 1) {
ToastUtils.longToast("暂时无法查看该创作者主页")
return
}
if (result.data.banControl == 1) {
ToastUtils.longToast("该账号已封禁,不予访问")
return
}
if (result.data.userType === "1") { // 普通用户
let params: Record<string, string> = {'userId': result.data.userId};
WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
} else { // 非普通用户
ProcessUtils.gotoPeopleShipHomePage(result.data.creatorId)
}
}).catch(() => {
ToastUtils.longToast("暂时无法查看该创作者主页")
})
}
}
... ...
... ... @@ -214,7 +214,7 @@ struct CarouselLayout01CardView {
.align(Alignment.Bottom)
.maxLines(CompUtils.MAX_LINES_2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(this.item.objectType == '5' ? 40 : 0)
.textIndent(this.item.objectType == '5' ? 35 : 0)
}
// .height(39)
.padding({
... ...
... ... @@ -40,6 +40,7 @@ export struct ZhSingleRow03 {
// 请求所有预约状态
async getReserveState() {
this.reservedIds = []
const reserveBean: reserveReqItem[] = this.compDTO.operDataList.map((item: ContentDTO) => {
const reqItem: reserveReqItem = {
liveId: item.objectId.toString(),
... ...
... ... @@ -5,13 +5,10 @@ import { ProcessUtils } from 'wdRouter';
import { SpConstants } from 'wdConstant/Index'
import {
batchLikeAndCollectParams,
ContentDetailRequest,
contentListParams,
postExecuteCollectRecordParams,
postExecuteLikeParams,
postInteractAccentionOperateParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailViewModel';
import commentViewModel from '../../components/comment/viewmodel/CommentViewModel';
import { commentItemModel } from '../../components/comment/model/CommentModel'
/**
* 精选评论卡
... ... @@ -22,7 +19,9 @@ const TAG = 'Zh_Single_Row-06'
@Component
export struct ZhSingleRow06 {
@State compDTO: CompDTO = {} as CompDTO
@State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult // 点赞、收藏状态
@State newsStatusOfUser: batchLikeAndCollectResult = {
likeStatus: '0'
} as batchLikeAndCollectResult // 点赞、收藏状态
aboutToAppear(): void {
this.getInteractDataStatus()
... ... @@ -38,18 +37,24 @@ export struct ZhSingleRow06 {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
const params: postExecuteLikeParams = {
status: this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1',
contentId: this.compDTO.operDataList[0]?.commentInfo?.newsId + '',
contentType: this.compDTO.operDataList[0]?.commentInfo?.newsType + '',
}
ContentDetailRequest.postExecuteLike(params).then(res => {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
const commentInfo = this.compDTO.operDataList[0]?.commentInfo as commentInfo;
// commentLikeChange(this.item)
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1';
const commentLikeParam = {
targetId: commentInfo.newsId || '',
id: commentInfo.commentId,
targetType: commentInfo?.objectType || '',
api_status: this.newsStatusOfUser?.likeStatus == '1' ? false : true
} as commentItemModel;
commentViewModel.commentLike(commentLikeParam).then(() => {
}).catch(() => {
this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1';
})
}
// 已登录->查询用户对作品点赞、收藏状态
private async getInteractDataStatus() {
async getInteractDataStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
... ... @@ -65,7 +70,7 @@ export struct ZhSingleRow06 {
]
}
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.error(TAG, 'ZhSingleRow06-data', JSON.stringify(data))
Logger.info(TAG, 'ZhSingleRow06-data', JSON.stringify(data))
this.newsStatusOfUser = data[0];
Logger.info(TAG, `ZhSingleRow06-newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
... ... @@ -124,7 +129,7 @@ export struct ZhSingleRow06 {
.fontColor(0x999999)
Row(){
Image(this.newsStatusOfUser?.likeStatus == '1' ? $r('app.media.icon_like_select') : $r('app.media.icon_like'))
Image(Number(this.newsStatusOfUser?.likeStatus) == 1 ? $r('app.media.icon_like_select') : $r('app.media.icon_like'))
.width(16)
.height(16)
.margin({right: 3})
... ...
/**
* 直播页面点赞动画
*/
interface animationItem {
x: string | number;
y: string | number;
opacity: number;
name: string;
key: string;
url: Resource
}
@Component
export struct LikeAnimationView {
@State @Watch('countChange') count: number = 0
@State imgList: Resource[] =
[$r('app.media.like_animation_1'), $r('app.media.like_animation_2'), $r('app.media.like_animation_3')]
@State animationList: animationItem[] = []
countChange() {
this.animationList.push({
name: 'xxxx',
x: 0,
y: 0,
opacity: 1,
key: Math.random() + '',
url: this.getRandomUrl()
})
}
getRandomUrl(): Resource {
if (Math.random() >= 0 && Math.random() >= 0.33) {
return this.imgList[0]
} else if (Math.random() >= 0.33 && Math.random() >= 0.66) {
return this.imgList[1]
} else {
return this.imgList[2]
}
}
startAnimation() {
}
stopAnimation() {
}
aboutToAppear(): void {
}
aboutToDisappear(): void {
}
build() {
Stack() {
ForEach(this.animationList, (item: animationItem) => {
Image(item.url)
.width(48)
.height(48)
}, (item: animationItem) => item.key)
}
}
}
\ No newline at end of file
... ...
import lottie, { AnimationSegment } from '@ohos/lottie';
import lottie, { AnimationItem, AnimationSegment } from '@ohos/lottie';
@Component
export struct LottieView {
@Prop name: string = ''
@Prop path: string = ''
@Prop lottieWidth?: number = 30
@Prop lottieHeight?: number = 30
@Prop autoplay?: boolean = false
@Prop loop?: boolean = false
@Prop name: string
@Prop path: string
@Prop lottieWidth: number = 30
@Prop lottieHeight: number = 30
@Prop autoplay: boolean = false
@Prop loop: boolean = false
@Prop initialSegment?: AnimationSegment = [0, 120] // 动画起始帧
@Prop onReady: (animateItem: ESObject) => void // 动画初始化完成事件
@Prop onReady: (animateItem: AnimationItem | null) => void // 动画初始化完成事件
@Prop onComplete?: () => void // 动画完成事件
private politeChickyController: CanvasRenderingContext2D = new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象
private animateItem: ESObject = null; // 初始化loadAnimation接口的返回对象
private politeChickyController: CanvasRenderingContext2D =
new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象
private animateItem: AnimationItem | null = null; // 初始化loadAnimation接口的返回对象
// 页面隐藏销毁动画
onPageHide(): void {
this.animateItem.destroy()
this.animateItem?.destroy()
if (this.onComplete) {
this.animateItem.removeEventListener('complete', this.onComplete)
this.animateItem?.removeEventListener('complete', this.onComplete)
}
}
... ... @@ -44,7 +45,7 @@ export struct LottieView {
// initialSegment: this.initialSegment
})
if (this.initialSegment) {
this.animateItem.initialSegment = this.initialSegment
this.animateItem.segments = this.initialSegment
}
if (this.onComplete) {
... ... @@ -57,7 +58,7 @@ export struct LottieView {
Stack({ alignContent: Alignment.TopStart }) {
Canvas(this.politeChickyController)
.width(this.lottieWidth)
.height(this.lottieHeight)
.height(this.lottieHeight)// .backgroundColor(Color.Black)
.onReady(() => {
this.loadAnimation();
if (this.onReady) {
... ... @@ -65,7 +66,7 @@ export struct LottieView {
}
})
.onClick(() => {
this.animateItem.play()
this.animateItem?.play()
})
}
}
... ...
import { WDRouterRule, WDRouterPage } from 'wdRouter'
import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem'
import { PagePersonFunction } from './PagePersonFunction'
@Component
export default struct MinePagePersonFunctionUI {
... ... @@ -10,30 +11,7 @@ export default struct MinePagePersonFunctionUI {
Grid(){
ForEach(this.personalData,(item:MinePagePersonalFunctionsItem,index:number)=>{
GridItem(){
Row(){
Column(){
Image(item.imgSrc)
.width('46lpx')
.height('46lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
Text(`${item.msg}`)
.margin({top:'8lpx'})
.height('23lpx')
.fontColor($r('app.color.color_222222'))
.fontSize('23lpx')
}
.alignItems(HorizontalAlign.Center)
.width('100%')
Blank()
.layoutWeight(1)
if(index % 4 < 3 && index != this.personalData.length-1){
Text().backgroundColor($r('app.color.color_222222'))
.opacity(0.1)
.width('2lpx')
.height('29lpx')
}
}
PagePersonFunction({ item: item, noDivider : (index % 4 < 3 && index != this.personalData.length-1) ? false : true})
}.onClick(()=>{
console.log(index+"")
switch (item.msg){
... ... @@ -98,3 +76,4 @@ export default struct MinePagePersonFunctionUI {
.margin({top:'31lpx',left:'23lpx',right:'23lpx' })
}
}
... ...
import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem'
@Component
export struct PagePersonFunction{
@ObjectLink item: MinePagePersonalFunctionsItem
@State noDivider:boolean = false
build() {
Row(){
Column(){
Stack({ alignContent: Alignment.TopEnd }){
Image(this.item.imgSrc)
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
if (this.item.isShowRedPoint) {
Button()
.type(ButtonType.Circle)
.width("12lpx")
.height("12lpx")
.backgroundColor($r('app.color.color_ED2800'))
}
}.width('46lpx')
.height('46lpx')
Text(`${this.item.msg}`)
.margin({top:'8lpx'})
.height('23lpx')
.fontColor($r('app.color.color_222222'))
.fontSize('23lpx')
}
.alignItems(HorizontalAlign.Center)
.width('100%')
Blank()
.layoutWeight(1)
if(!this.noDivider){
Text().backgroundColor($r('app.color.color_222222'))
.opacity(0.1)
.width('2lpx')
.height('29lpx')
}
}
}
}
\ No newline at end of file
... ...
import { SpConstants } from 'wdConstant/Index'
import { DateTimeUtils, SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'
import { SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'
import { HttpUtils } from 'wdNetwork/Index'
import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
... ... @@ -116,9 +116,14 @@ export struct FollowChildComponent{
}.height('202lpx')
.justifyContent(FlexAlign.Start)
Text().backgroundColor($r('app.color.color_EDEDED'))
// Text().backgroundColor($r('app.color.color_EDEDED'))
// .width('100%')
// .height('2lpx')
Divider()
.width('100%')
.height('2lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}.width('100%')
}else {
... ... @@ -230,9 +235,15 @@ export struct FollowChildComponent{
}.height('146lpx')
.justifyContent(FlexAlign.Center)
Text().backgroundColor($r('app.color.color_EDEDED'))
// Text().backgroundColor($r('app.color.color_EDEDED'))
// .width('100%')
// .height('2lpx')
Divider()
.width('100%')
.height('2lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}.width('100%')
}
... ... @@ -255,12 +266,6 @@ export struct FollowChildComponent{
this.data.status = this.data.status ==="0"?"1":"0"
UserDataLocal.setUserFollowOperation(this.data.creatorId+","+this.data.status)
// if(this.data.status === "1"){
// UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")
// }else{
// UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)
// }
}
}
})
... ...
import { StringUtils, ToastUtils } from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { MessageItem } from '../../../viewmodel/MessageItem'
import { CustomTitleUI } from '../../reusable/CustomTitleUI'
... ... @@ -86,6 +87,7 @@ export struct MessageListUI {
ToastUtils.shortToast(index+"")
switch (index) {
case 0: //互动消息
WDRouterRule.jumpWithPage(WDRouterPage.interactMessagePage)
break;
case 1: //预约消息
break;
... ...
... ... @@ -85,6 +85,7 @@ export struct BottomNavigationComponent {
VideoChannelPage({
topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
_currentNavIndex: $currentNavIndex,
autoRefresh: this.autoRefresh
})
} else {
TopNavigationComponent({
... ...
import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel';
import InteractMessageViewModel from '../../viewmodel/InteractMessageViewModel';
import PageModel from '../../viewmodel/PageModel';
import { CommonConstants, ViewType } from 'wdConstant'
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
import { ContentDTO } from 'wdBean'
import NoMoreLayout from './NoMoreLayout'
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { CustomSelectUI } from '../view/CustomSelectUI';
import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
import { BigPicCardComponent } from '../view/BigPicCardComponent';
import { CustomTitleUI } from '../reusable/CustomTitleUI';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { InteractMComponent } from '../InteractMessage/InteractMComponent';
import { InteractMessageModel, WDMessageCenterMessageType } from '../../model/InteractMessageModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
@Entry
@Component
... ... @@ -20,39 +16,40 @@ struct InteractMessagePage {
@State private browSingModel: PageModel = new PageModel()
isloading : boolean = false
@Provide isEditState:boolean = false
@State allDatas :ContentDTO[] = [];
@State allDatas :InteractMessageModel[] = [];
private scroller: Scroller = new Scroller();
@State likeNum: number = 20
@State likeNum: number = 0
@State currentPage: number = 1;
aboutToAppear(){
this.getData()
this.getMessageLikeCount()
}
build() {
Column(){
CustomTitleUI({titleName:'互动消息'})
if(this.browSingModel.viewType == ViewType.ERROR){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed})
}else if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory})
}else {
CustomPullToRefresh({
alldata:this.allDatas,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
// if(this.browSingModel.viewType == ViewType.ERROR){
// EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed})
// }else if(this.browSingModel.viewType == ViewType.EMPTY){
// EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory})
// }else {
// CustomPullToRefresh({
// alldata:this.allDatas,
// scroller:this.scroller,
// customList:()=>{
// this.ListLayout()
// },
// onRefresh:(resolve)=>{
// this.browSingModel.currentPage = 0
// this.getData(resolve)
// },
// onLoadMore:(resolve)=> {
// this.browSingModel.currentPage++
// this.getData()
// }
// })
// }
},
onRefresh:(resolve)=>{
this.browSingModel.currentPage = 0
this.getData(resolve)
},
onLoadMore:(resolve)=> {
this.browSingModel.currentPage++
this.getData()
}
})
}
}
.width(CommonConstants.FULL_WIDTH)
... ... @@ -66,9 +63,9 @@ struct InteractMessagePage {
}
// 下拉刷新
ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => {
ForEach(this.allDatas, (InteractM: InteractMessageModel, compIndex: number) => {
ListItem() {
InteractMComponent()
InteractMComponent({messageModel:InteractM})
}
})
// 加载更多
... ... @@ -112,12 +109,22 @@ struct InteractMessagePage {
}
async getData(resolve?: (value: string | PromiseLike<string>) => void){
MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => {
InteractMessageViewModel.fetchMessageList(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact,this.currentPage).then(InteractMessageMItem => {
if(resolve) resolve('刷新成功')
if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
if (InteractMessageMItem && InteractMessageMItem.list && InteractMessageMItem.list.length > 0) {
this.browSingModel.viewType = ViewType.LOADED;
this.allDatas.push(...collectionItem.list)
if (collectionItem.list.length === this.browSingModel.pageSize) {
if (this.currentPage === 1) {
this.allDatas = []
}
for (let index = 0; index < InteractMessageMItem.list.length; index++) {
const element = InteractMessageMItem.list[index];
element.InteractMsubM = JSON.parse(element.remark)
}
this.allDatas.push(...InteractMessageMItem.list)
if (InteractMessageMItem.list.length === this.browSingModel.pageSize) {
this.browSingModel.currentPage++;
this.browSingModel.hasMore = true;
} else {
... ... @@ -129,4 +136,11 @@ struct InteractMessagePage {
})
}
async getMessageLikeCount(){
InteractMessageViewModel.getMessageLikeCount().then(num => {
this.likeNum = num
})
}
}
... ...
... ... @@ -53,8 +53,25 @@ export struct MinePageComponent {
this.getUserLogin()
this.getFunctionData()
this.addLoginStatusObserver()
this.getMessageData()
}
getMessageData(){
MinePageDatasModel.getMessageUnReadData().then((value) => {
if(value !=null) {
if(value.activeCount >0 ||value.subscribeCount > 0 || value.systemCount > 0){
this.personalData.forEach((value) => {
if(value.msg == "消息")
value.isShowRedPoint = true
})
}
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
}
async addLoginStatusObserver(){
this.preferences = await SPHelper.default.getPreferences();
this.preferences.on('change', this.observer);
... ...
... ... @@ -21,6 +21,7 @@ const TAG = 'PageComponent';
export struct PageComponent {
@State private pageModel: PageModel = new PageModel();
@State private pageAdvModel: PageAdModel = new PageAdModel();
@State timer: number = -1
navIndex: number = 0;
pageId: string = "";
channelId: string = "";
... ... @@ -29,6 +30,7 @@ export struct PageComponent {
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
private listScroller: Scroller = new Scroller();
needload: boolean = true;
build() {
Column() {
if (this.pageModel.viewType == ViewType.LOADING) {
... ... @@ -222,9 +224,10 @@ export struct PageComponent {
}
onChange() {
Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`);
Logger.info(TAG,
`onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`);
if (this.navIndex === this.currentTopNavSelectedIndex) {
if(this.needload){
if (this.needload) {
this.getData();
}
this.needload = false;
... ... @@ -242,6 +245,10 @@ export struct PageComponent {
}
async getData() {
if (this.timer) {
clearTimeout(this.timer)
}
this.timer = setTimeout(() => {
Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
this.pageModel.pageId = this.pageId;
this.pageModel.groupId = this.pageId;
... ... @@ -249,6 +256,8 @@ export struct PageComponent {
this.pageModel.currentPage = 1;
this.pageModel.pageTotalCompSize = 0;
PageHelper.getInitData(this.pageModel, this.pageAdvModel)
}, 100)
}
}
... ...
... ... @@ -13,6 +13,7 @@ import {
PeopleShipUserDetailData,
ArticleCountData
} from 'wdBean'
import { EmptyComponent } from '../view/EmptyComponent'
@Entry
@Component
... ... @@ -35,11 +36,20 @@ struct PeopleShipHomePage {
@Provide @Watch('handleChangeAttentionStata') isLoadingAttention: boolean = false
//关注显示
@State attentionOpacity: boolean = false
@Provide topHeight: number = 400
@Provide topHeight: number = 286
@State isLoading: boolean = true
build() {
Stack({ alignContent: Alignment.TopStart }) {
// 顶部图片
Image($r('app.media.home_page_bg'))
.width('100%')
.height('120vp')
.objectFit(ImageFit.Fill)
.backgroundColor(Color.White)
.visibility(this.isLoading ? Visibility.None : Visibility.Visible)
Column(){
// 头部返回
PeopleShipHomePageNavComponent({
attentionOpacity: this.attentionOpacity,
... ... @@ -47,9 +57,7 @@ struct PeopleShipHomePage {
detailModel: this.detailModel
})
.height($r('app.float.top_bar_height'))
.zIndex(100)
.backgroundColor(Color.Transparent)
if (this.detailModel && this.detailModel.userName) {
Scroll(this.scroller) {
Column() {
... ... @@ -62,24 +70,32 @@ struct PeopleShipHomePage {
})
.width("100%")
.height(this.topHeight)
// 列表
Column(){
PeopleShipHomeListComponent({
publishCount: this.publishCount,
creatorId: this.creatorId
})
}.height('100%')
}
.width("100%")
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
// .height('100%')
// .height(this.publishCount == 0 ? '100%' : '')
}
.scrollable(ScrollDirection.Vertical)
// .alignSelf(ItemAlign.Start)
// .align(Alignment.Start)
.edgeEffect(EdgeEffect.None)
.friction(0.6)
.friction(0.7)
.backgroundColor(Color.White)
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
.height('calc(100% - 44vp)')
// .layoutWeight(1)
.onDidScroll(() => {
// this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2)
this.topOpacity = this.scroller.currentOffset().yOffset / 100
... ... @@ -94,6 +110,13 @@ struct PeopleShipHomePage {
}
}
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.Start)
.width('100%')
// .height('100%')
}
// .height('100%')
.width('100%')
}
... ... @@ -104,9 +127,11 @@ struct PeopleShipHomePage {
private async getData() {
try {
this.isLoading = true
// 获取页面信息
this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '')
Logger.debug('PeopleShipHomePage', '获取页面信息' + `${JSON.stringify(this.detailModel)}`)
this.isLoading = false
// 获取关注
// 登录后获取,是否关注
... ... @@ -117,7 +142,7 @@ struct PeopleShipHomePage {
}
} catch (exception) {
this.isLoading = false
}
}
... ...
import { insightIntent } from '@kit.IntentsKit';
import { BottomNavDTO, CompDTO, TopNavDTO } from 'wdBean';
import { SpConstants } from 'wdConstant';
import { DisplayUtils, LazyDataSource, Logger, SPHelper, NetworkUtil, ToastUtils } from 'wdKit';
import { DisplayUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit';
import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter';
import { PageComponent } from './PageComponent';
import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
... ... @@ -8,6 +9,7 @@ import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent
import { AssignChannelParam } from 'wdRouter/src/main/ets/utils/HomeChannelUtils';
import { PeopleShipMainComponent } from '../peopleShip/PeopleShipMainComponent';
import { channelSkeleton } from '../skeleton/channelSkeleton';
import { common } from '@kit.AbilityKit';
const TAG = 'TopNavigationComponent';
... ... @@ -37,6 +39,7 @@ export struct TopNavigationComponent {
// 顶导当前选中/焦点下标
@State currentTopNavSelectedIndex: number = 0;
@State currentTopNavName: string = '';
@State currentTopNavItem: TopNavDTO = {} as TopNavDTO
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@State compList: LazyDataSource<CompDTO> = new LazyDataSource();
... ... @@ -58,6 +61,8 @@ export struct TopNavigationComponent {
@Prop @Watch('onAutoRefresh') autoRefresh: number = 0
// 传递给page的自动刷新通知
@State autoRefresh2Page: number = 0
//保存当前导航选中时的时间戳 意图开始时间
@State executedStartTime: number = new Date().getTime()
// 当前底导index
@State navIndex: number = 0
@State animationDuration: number = 0
... ... @@ -167,6 +172,7 @@ export struct TopNavigationComponent {
this.currentTopNavSelectedIndex = index
this.currentTopNavName = this.myChannelList[index].name
}
this.currentTopNavItem = this.myChannelList[this.currentTopNavSelectedIndex]
}
isBroadcast(item: TopNavDTO) {
... ... @@ -184,6 +190,49 @@ export struct TopNavigationComponent {
return item.channelType === 3
}
//意图共享
topNavInsightIntentShare(item: TopNavDTO){
let tapNavIntent: insightIntent.InsightIntent = {
intentName: 'ViewColumn',
intentVersion: '1.0.1',
identifier: '52dac3b0-6520-4974-81e5-25f0879449b5',
intentActionInfo: {
actionMode: 'EXPECTED',
currentPercentage: 50,
executedTimeSlots: {
executedEndTime: new Date().getTime(),
executedStartTime: this.executedStartTime
}
},
intentEntityInfo: {
entityName: 'ViewColumn',
entityId: String(item.pageId) || '',
displayName: item.name,
logoURL: 'https://www-file.huawei.com/-/media/corporate/images/home/logo/huawei_logo.png',
rankingHint: 99,
isPublicData: true
}
}
try {
let context = getContext(this) as common.UIAbilityContext;
// 共享数据
insightIntent.shareIntent(context, [tapNavIntent], (error) => {
if (error?.code) {
// 处理业务逻辑错误
console.error(`shareIntent failed, error.code: ${error?.code}, error.message: ${error?.message}`);
return;
}
// 执行正常业务
console.log('shareIntent succeed');
});
} catch (error) {
// 处理异常
console.error(`error.code: ${error?.code}, error.message: ${error?.message}`);
}
}
build() {
Column() {
// 顶部搜索、日报logo、早晚报
... ... @@ -278,7 +327,11 @@ export struct TopNavigationComponent {
if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
!this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
) {
//在 tab 切换之前意图共享
// this.topNavInsightIntentShare(this.currentTopNavItem)
this.currentTopNavSelectedIndex = index;
this.currentTopNavItem = this.myChannelList[index]
}
if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
// 跳转到播报页面
... ... @@ -416,9 +469,11 @@ export struct TopNavigationComponent {
this.changeByClick = true
this.tabsController.changeIndex(index)
}
})
}
aboutToAppear() {
//处理新闻tab顶导频道数据
this.topNavListHandle()
... ...
... ... @@ -13,6 +13,8 @@ export struct VideoChannelPage {
readonly MAX_LINE: number = 1;
private groupId: number = 0
private swiperController: SwiperController = new SwiperController()
// 自动刷新触发(双击tab自动刷新)
@Prop autoRefresh: number = 0
@Prop topNavList: TopNavDTO[]
@Link _currentNavIndex?: number;
@Consume barBackgroundColor: Color
... ... @@ -91,8 +93,12 @@ export struct VideoChannelPage {
right: $r('app.float.top_tab_item_padding_horizontal'),
})
.onClick(() => {
if (this.currentTopNavSelectedIndex === index) {
this.autoRefresh++
}
this.currentTopNavSelectedIndex = index
this.swiperController.changeIndex(index, true)
})
}, (item: TopNavDTO) => item.channelId + '')
}
... ... @@ -113,6 +119,7 @@ export struct VideoChannelPage {
groupId: this.groupId + '',
pageId: item.pageId + '',
channelId: item.channelId + '',
autoRefresh: this.autoRefresh,
})
} else {
// 直播
... ... @@ -121,7 +128,7 @@ export struct VideoChannelPage {
navIndex: index,
pageId: item.pageId + '',
channelId: item.channelId + '',
autoRefresh: this.autoRefresh2Page
autoRefresh: this.autoRefresh
}).margin({ top: 40 })
}
}, (item: TopNavDTO) => item.channelId + '')
... ...
import { Logger, DisplayUtils} from 'wdKit'
import { Logger} from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import {
ContentDTO,
... ... @@ -16,11 +16,11 @@ import {
} from 'wdBean'
import { CardParser } from '../CardParser'
import { PageRepository } from '../../repository/PageRepository'
import { RefreshLayoutBean } from '../page/RefreshLayoutBean'
import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout'
import { ErrorComponent } from '../view/ErrorComponent'
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'
import LoadMoreLayout from '../page/LoadMoreLayout'
const TAG = 'PeopleShipHomeArticleListComponent';
... ... @@ -47,45 +47,29 @@ export struct PeopleShipHomeArticleListComponent {
} else if (this.viewType == 2) {
ErrorComponent()
} else {
CustomPullToRefresh({
alldata:this.arr,
scroller:this.scroller,
hasMore: this.hasMore,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.currentPage = 1
this.getPeopleShipPageArticleList(resolve)
},
onLoadMore:(resolve)=> {
if (this.hasMore === false) {
if(resolve) {
resolve('')
}
return
}
if(!this.isLoading && this.hasMore){
//加载分页数据
this.currentPage++;
this.getPeopleShipPageArticleList(resolve)
}else {
if(resolve) {
resolve('')
}
}
},
})
// CustomPullToRefresh({
// alldata:this.arr,
// scroller:this.scroller,
// hasMore: false,
// customList:()=>{
// this.ListLayout()
// },
// onRefresh:(resolve)=>{
// this.currentPage = 1
// this.getPeopleShipPageArticleList(resolve)
// },
// })
}
}
@Builder
LoadingLayout() {
CustomRefreshLoadLayout({
refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), 20)
}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
// CustomRefreshLoadLayout({
// refreshBean: new RefreshLayoutBean(true,
// $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), 20)
// }).height(DisplayUtils.getDeviceHeight() - this.topHeight)
}
@Builder
... ... @@ -93,7 +77,6 @@ export struct PeopleShipHomeArticleListComponent {
List({scroller: this.scroller}) {
// 下拉刷新
ForEach(this.arr, (item: ContentDTO) => {
ListItem() {
CardParser({ contentDTO: item })
... ... @@ -103,11 +86,14 @@ export struct PeopleShipHomeArticleListComponent {
// 加载更多
ListItem() {
if (!this.hasMore && !this.isLoading) {
if (this.hasMore && this.arr && this.arr.length > 0) {
LoadMoreLayout({ isVisible: this.hasMore })
} else if (!this.hasMore && !this.isLoading) {
PeopleShipNoMoreData()
}
}
}
.backgroundColor(Color.Transparent)
.width("100%")
.height("100%")
.edgeEffect(EdgeEffect.None)
... ... @@ -115,13 +101,13 @@ export struct PeopleShipHomeArticleListComponent {
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
// .onReachEnd(() => {
// if(!this.isLoading && this.hasMore){
// //加载分页数据
// this.getPeopleShipPageArticleList()
// }
// })
.onReachEnd(() => {
if(!this.isLoading && this.hasMore){
//加载分页数据
this.currentPage++;
this.getPeopleShipPageArticleList()
}
})
}
aboutToAppear() {
... ... @@ -313,7 +299,6 @@ export struct PeopleShipHomeArticleListComponent {
}
}
// this.arr = listData.list
}
... ...
... ... @@ -24,10 +24,10 @@ export struct PeopleShipHomeListComponent {
// 列表
else if (this.publishCount == 0) {
// 无数据展示
EmptyComponent({emptyType: 12}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
EmptyComponent({emptyType: 12}).height('100%')
} else {
Column() {
Column() {
Stack({ alignContent: Alignment.Top }){
// 页签
Row() {
Scroll() {
... ... @@ -44,13 +44,10 @@ export struct PeopleShipHomeListComponent {
.scrollBar(BarState.Off)
.width('100%')
}
.zIndex(10)
.backgroundColor(Color.White)
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.justifyContent(FlexAlign.Start)
.height('44vp')
.alignItems(HorizontalAlign.Start)
.alignItems(VerticalAlign.Bottom)
.width('100%')
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
... ... @@ -63,15 +60,15 @@ export struct PeopleShipHomeListComponent {
currentIndex: index
})
}
// }.tabBar(this.tabBuilder(index, item.name ?? ''))
// .tabBar(this.Tab(index, item.name ?? ''))
})
}
.backgroundColor(Color.White)
.barWidth('100%')
.barHeight(0)
.vertical(false)
.height(DisplayUtils.getDeviceHeight() - 144)
.barHeight('44vp')
.height('100% ')
.animationDuration(0)
.divider({
strokeWidth: '0.5vp',
... ... @@ -82,16 +79,19 @@ export struct PeopleShipHomeListComponent {
.onChange((index: number) => {
this.currentIndex = index
})
}
}
}
}
@Builder
LoadingLayout() {
CustomRefreshLoadLayout({
refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), DisplayUtils.getDeviceHeight() - this.topHeight)
}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
// CustomRefreshLoadLayout({
// refreshBean: new RefreshLayoutBean(true,
// $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), DisplayUtils.getDeviceHeight() - this.topHeight)
// }).height('100%')
}
// 单独的页签
... ...
... ... @@ -43,9 +43,8 @@ export struct PeopleShipHomePageNavComponent {
}).onClick(()=>{
let params = {
'headPhotoUrl': this.detailModel.headPhotoUrl,
'headType': '1'
} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params)
WDRouterRule.jumpWithPage(WDRouterPage.showHomePageHeaderPage,params)
}).margin({
left: '10vp',
})
... ...
... ... @@ -56,9 +56,8 @@ export struct PeopleShipHomePageTopComponent {
}).onClick(() => {
let params = {
'headPhotoUrl': this.detailModel.headPhotoUrl,
'headType': '1'
} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage, params)
WDRouterRule.jumpWithPage(WDRouterPage.showHomePageHeaderPage, params)
})
... ... @@ -369,7 +368,11 @@ export struct PeopleShipHomePageTopComponent {
private computeShowNum(count: number) {
if (count >= 10000) {
return `${(count / 10000).toFixed(1)}万`
let num = ( count / 10000).toFixed(1)
if (Number(num.substring(num.length-1)) == 0) {
num = num.substring(0, num.length-2)
}
return num + '万'
}
return `${count}`
}
... ...
... ... @@ -12,6 +12,7 @@ import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
import { HttpUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter'
import { LazyDataSource } from 'wdKit/Index';
import LoadMoreLayout from '../page/LoadMoreLayout'
const TAG: string = 'ReserveMorePage';
... ... @@ -95,7 +96,9 @@ struct ReserveMorePage {
)
// 加载更多
ListItem() {
if (!this.hasMore && !this.isLoading) {
if (this.hasMore && this.data && this.data.totalCount() > 0) {
LoadMoreLayout({ isVisible: this.hasMore })
} else if (!this.hasMore && !this.isLoading) {
PeopleShipNoMoreData()
}
}
... ... @@ -124,7 +127,7 @@ struct ReserveMorePage {
buildItem(item: ContentDTO, index: number) {
Column() {
Stack() {
Image(item.fullColumnImgUrls[0].url)
Image(item.fullColumnImgUrls[0]?.url)
.width('100%')
.height(196)
.borderRadius(4)
... ... @@ -136,8 +139,9 @@ struct ReserveMorePage {
Text(item.newsTitle)
.fontSize(17)
.maxLines(2)
.lineHeight(25)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: 16, left: 12, right: 12 })
.margin({ top: 4, left: 12, right: 12 })
.alignSelf(ItemAlign.Start)
Row() {
Row() {
... ... @@ -145,6 +149,7 @@ struct ReserveMorePage {
.width(20)
.height(20)
.margin({ left: 10, top: 2, bottom: 2, right: 6 })
// Text(DateTimeUtils.formatDate(item.liveInfo.liveStartTime, "MM月dd日 HH:mm"))
Text(this.getReserveDate(item.liveInfo.liveStartTime, 1))
.fontSize(12)
... ... @@ -201,7 +206,7 @@ struct ReserveMorePage {
.color(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC'))
.visibility((this.isLoadingAttention && this.liveId == item.objectId) ? Visibility.Visible : Visibility.None)
Text(!this.isReserved(item) ? '关注' : '已关注')
Text(!this.isReserved(item) ? '预约' : '已预约')
.fontSize($r('app.float.vp_12'))
.fontWeight(500)
.fontColor(!this.isReserved(item) ? $r('app.color.color_fff') : $r('app.color.color_CCCCCC'))
... ... @@ -253,6 +258,9 @@ struct ReserveMorePage {
.height(24)
.objectFit(ImageFit.Auto)
.id("back_icon")
.margin({
left: '16vp'
})
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "__container__", align: HorizontalAlign.Start }
... ... @@ -264,10 +272,10 @@ struct ReserveMorePage {
Text(this.title)// .height('42lpx')
.maxLines(1)
.id("title")
.fontSize('35lpx')
.fontSize('18vp')
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
.lineHeight('22vp')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
... ... @@ -281,11 +289,14 @@ struct ReserveMorePage {
@Builder
LiveImage() {
Row() {
Image($r('app.media.reserve_icon'))
.width(22)
.height(18)
Image($r('app.media.reserve_new_icon'))
.width(14)
.height(14)
.margin({
right: 3
})
Text('预约')
.fontSize('11fp')
.fontSize('12vp')
.fontWeight(400)
.fontColor(Color.White)
}
... ...
... ... @@ -131,10 +131,8 @@ export struct SearchResultComponent {
.barWidth('100%')
.barHeight('84lpx')
.animationDuration(0)
.onChange((index: number) => {
this.currentIndex = index
})
.width('100%')
.scrollable(false)
.layoutWeight(1)
}
}.width('100%')
... ...
import { ContentDTO,
import {
ContentDTO,
contentListParams,
FullColumnImgUrlDTO, InteractDataDTO,
FullColumnImgUrlDTO,
InteractDataDTO,
Params,
RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
RmhInfoDTO,
VideoInfoDTO
} from 'wdBean/Index'
import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
import { LazyDataSource, Logger, StringUtils, ToastUtils } from 'wdKit/Index'
import { LazyDataSource, Logger, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import MinePageDatasModel from '../../model/MinePageDatasModel'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem'
import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'
import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem'
import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem'
import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
import { SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { CardParser } from '../CardParser'
import { FollowChildComponent } from '../mine/follow/FollowChildComponent'
import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
import { ActivityItemComponent } from './ActivityItemComponent'
import { SearchCreatorComponent } from './SearchCreatorComponent'
... ... @@ -19,27 +28,28 @@ import { SearchCreatorComponent } from './SearchCreatorComponent'
const TAG = "SearchResultContentComponent"
@Component
export struct SearchResultContentComponent{
@State keywords:string = ""
@State searchType:string = ""
export struct SearchResultContentComponent {
@State keywords: string = ""
@State searchType: string = ""
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
@State data_rmh: SearchRmhDescription[] = []
@State count:number = -1;
@State isLoading:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
@State count: number = -1;
@State isLoading: boolean = false
@State hasMore: boolean = true
curPageNum: number = 1;
@State bean: FollowListDetailItem = new FollowListDetailItem("", "", "", "", "", "", "", "", "", -1, -1, "")
scroller: Scroller = new Scroller()
aboutToAppear(): void {
if(this.searchType == "全部"){
if (this.searchType == "全部") {
this.searchType = "all"
}else if(this.searchType == "精选"){
} else if (this.searchType == "精选") {
this.searchType = "cms"
}else if(this.searchType == "人民号"){
} else if (this.searchType == "人民号") {
this.searchType = "rmh"
}else if(this.searchType == "视频"){
} else if (this.searchType == "视频") {
this.searchType = "video"
}else if(this.searchType == "活动"){
} else if (this.searchType == "活动") {
this.searchType = "activity"
}
... ... @@ -47,93 +57,135 @@ export struct SearchResultContentComponent{
this.getNewSearchResultData()
}
getNewSearchResultData(){
getNewSearchResultData() {
this.isLoading = true
if(this.hasMore){
SearcherAboutDataModel.getSearchResultListData("10",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{
if (!this.data || value.list.length == 0){
if (this.hasMore) {
SearcherAboutDataModel.getSearchResultListData("15", `${this.curPageNum}`, this.searchType, this.keywords,
getContext(this)).then((value) => {
if (!this.data || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
this.count = this.count===-1?0:this.count
}else{
if(value.list[0].dataList!=null){
this.count = this.count === -1 ? 0 : this.count
} else {
if (value.list[0].dataList != null) {
let data_temp: SearchRmhDescription[] = []
data_temp = value.list[0].dataList
//TODO 查询创作者详情接口
let request = new CreatorDetailRequestItem()
data_temp.forEach((data)=>{
data_temp.forEach((data) => {
request.creatorIdList.push(data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{
if(value!=null && value.length>0){
data_temp.forEach((data)=>{
value.forEach((item)=>{
if(data.creatorId == item.creatorId){
SearcherAboutDataModel.getCreatorDetailListData(request).then((value) => {
if (value != null && value.length > 0) {
data_temp.forEach((data) => {
value.forEach((item) => {
if (data.creatorId == item.creatorId) {
data.headerPhotoUrl = item.headPhotoUrl.split("?")[0]
data.mainControl = item.mainControl+""
data.mainControl = item.mainControl + ""
if(data_temp.length === 1){
this.bean.headPhotoUrl = item.headPhotoUrl.split("?")[0]
this.bean.cnUserName = item.userName
this.bean.creatorId = item.creatorId
this.bean.authIcon = item.authIcon
if (value[0].fansNum > 10000) {
let temp = (value[0].fansNum / 10000) + ""
let index = temp.indexOf('.')
if (index != -1) {
temp = temp.substring(0, index + 2)
} else {
temp = temp
}
this.bean.cnFansNum = temp + "万"
} else {
this.bean.cnFansNum = item.fansNum + ""
}
this.bean.introduction = item.introduction
this.bean.mainControl = item.mainControl
this.bean.banControl = item.banControl
this.bean.cnUserType = item.userType
this.bean.cnUserId = item.userId
}
}
})
})
}
data_temp.forEach((data)=>{
data_temp.forEach((data) => {
this.data_rmh.push(data)
})
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
//只有一条创作者,获取 创作者信息
if (this.data_rmh.length === 1) {
if(StringUtils.isNotEmpty(UserDataLocal.getUserId())){
//查询是否被关注
let status = new FollowListStatusRequestItem()
status.creatorIds.push(new QueryListIsFollowedItem(this.data_rmh[0].creatorId))
MinePageDatasModel.getFollowListStatusData(status, getContext(this)).then((newValue) => {
this.bean.status = newValue[0].status
}).catch((err: Error) => {
console.log(TAG, "请求失败")
})
}else{
this.bean.status = ""
}
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
}
this.getInteractData(value)
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isLoading = false
this.count = this.count===-1?0:this.count
this.count = this.count === -1 ? 0 : this.count
})
}
}
getInteractData(resultData:SearchResultContentData){
if(resultData.list[0].dataList!=null){
resultData.list.splice(0,1)
getInteractData(resultData: SearchResultContentData) {
if (resultData.list[0].dataList != null) {
resultData.list.splice(0, 1)
}
let data : contentListParams = {
let data: contentListParams = {
contentList: []
}
resultData.list.forEach((item)=>{
resultData.list.forEach((item) => {
data.contentList.push({
contentId: item.data.id + '',
contentType: Number.parseInt(item.data.type)
})
})
SearcherAboutDataModel.getInteractListData(data,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
resultData.list.forEach((data)=>{
SearcherAboutDataModel.getInteractListData(data, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
resultData.list.forEach((data) => {
if (item.contentId == data.data.id) {
data.data.collectNum = item.collectNum+""
data.data.commentNum = item.commentNum+""
data.data.likeNum = item.likeNum+""
data.data.readNum = item.readNum+""
data.data.shareNum = item.shareNum+""
data.data.collectNum = item.collectNum + ""
data.data.commentNum = item.commentNum + ""
data.data.likeNum = item.likeNum + ""
data.data.readNum = item.readNum + ""
data.data.shareNum = item.shareNum + ""
}
})
})
resultData.list.forEach((value)=>{
let photos:FullColumnImgUrlDTO[] = []
if(value.data.appStyle === 4){
value.data.appStyleImages.split("&&").forEach((value)=>{
photos.push({url:value} as FullColumnImgUrlDTO)
resultData.list.forEach((value) => {
let photos: FullColumnImgUrlDTO[] = []
if (value.data.appStyle === 4) {
value.data.appStyleImages.split("&&").forEach((value) => {
photos.push({ url: value } as FullColumnImgUrlDTO)
})
}
let contentDTO = this.dataTransform(value,photos);
if(contentDTO.appStyle != "13"){
let contentDTO = this.dataTransform(value, photos);
if (contentDTO.appStyle != "13") {
this.data.push(contentDTO)
}
... ... @@ -142,74 +194,128 @@ export struct SearchResultContentComponent{
this.count = this.data.totalCount()
if (this.data.totalCount() < resultData.totalCount) {
this.curPageNum++
}else {
} else {
this.hasMore = false
}
this.isLoading = false
if(this.count === 0 && resultData.list.length > 0){
if (this.count === 0 && resultData.list.length > 0) {
this.count = -1
if(!this.isLoading){
if (!this.isLoading) {
//加载分页数据
this.getNewSearchResultData()
}
}else if(this.count <= 20 && resultData.list.length > 0){
if(!this.isLoading){
} else if (this.count <= 10 && resultData.list.length > 0) {
if (!this.isLoading) {
//加载分页数据
this.getNewSearchResultData()
}
}
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.count = this.count===-1?0:this.count
this.count = this.count === -1 ? 0 : this.count
})
}
build() {
Column() {
if(this.count == 0){
ListHasNoMoreDataUI({style:2})
if (this.count == 0) {
ListHasNoMoreDataUI({ style: 2 })
} else {
List() {
if (this.data_rmh != null && this.data_rmh.length > 0){
if (this.data_rmh.length === 1){
ListItem(){
FollowChildComponent({ data: this.bean, type: 1 })
}.padding({left:"31lpx",right:"31lpx"})
}else{
ListItem(){
Column(){
if (this.data_rmh!=null && this.data_rmh.length > 0) {
//List
List({space:'8lpx'}) {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
this.SearchListUI()
}
}
}
}
LazyForEach(this.data, (item: ContentDTO, index: number) => {
ListItem() {
SearchCreatorComponent({item:item})
}.onClick(()=>{
//TODO 跳转
Column() {
if (this.searchType == "activity") {
ActivityItemComponent({ contentDTO: item })
} else {
CardParser({ contentDTO: item })
}
if (index != this.data.totalCount() - 1) {
Divider()
.width('100%')
.height('1lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}
}
}
}, (item: ContentDTO, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore && this.data.totalCount() > 0) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}.cachedCount(10)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
//加载分页数据
this.getNewSearchResultData()
}
})
}
}
.backgroundColor($r('app.color.white'))
.width('100%')
}
@Builder
multiCreatorUI() {
Column() {
List() {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
SearchCreatorComponent({ item: item })
}
.width('150lpx')
.height('100%')
})
ListItem(){
Column(){
ListItem() {
Column() {
Text("查看更多")
.width('19lpx')
.fontSize('19lpx')
.fontWeight('400lpx')
.lineHeight('27lpx')
.fontColor($r('app.color.color_9E9E9E'))
}.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'})
}
.borderRadius({ topLeft: '4lpx', bottomLeft: '4lpx' })
.height('180lpx')
.width('77lpx')
.backgroundColor($r('app.color.color_EDEDED'))
.justifyContent(FlexAlign.Center)
}.height('100%')
.margin({left:'23lpx'})
.onClick(()=>{
.margin({ left: '23lpx' })
.onClick(() => {
let params: Params = {
pageID: this.keywords
}
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage, params)
})
}
.cachedCount(6)
.edgeEffect(EdgeEffect.Spring)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.listDirection(Axis.Horizontal)
.width('100%')
... ... @@ -221,50 +327,54 @@ export struct SearchResultContentComponent{
.color($r('app.color.color_F5F5F5'))
.strokeWidth('12lpx')
}
//List
List({ space: '6lpx' }) {
LazyForEach(this.data, (item: ContentDTO, index: number) => {
ListItem() {
Column(){
if(this.searchType == "activity"){
ActivityItemComponent({contentDTO:item})
}else{
CardParser({contentDTO:item})
}
if(index != this.data.totalCount()-1 ){
Divider()
.width('100%')
.height('1lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}
}
@Builder
SearchListUI() {
List({space:'8lpx'}) {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
SearchCreatorComponent({item:item})
}
}, (item: ContentDTO, index: number) => index.toString())
.width('150lpx')
.height('100%')
})
//没有更多数据 显示提示
if(!this.hasMore && this.data.totalCount() > 0){
ListItem(){
ListHasNoMoreDataUI()
Column(){
Text("查看更多")
.width('19lpx')
.fontSize('19lpx')
.fontWeight('400lpx')
.lineHeight('27lpx')
.fontColor($r('app.color.color_9E9E9E'))
}.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'})
.height('180lpx')
.width('77lpx')
.backgroundColor($r('app.color.color_EDEDED'))
.justifyContent(FlexAlign.Center)
}.height('100%')
.margin({left:'23lpx'})
.onClick(()=>{
let params: Params = {
pageID: this.keywords
}
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)
})
}
}.cachedCount(6)
.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.layoutWeight(1)
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
//加载分页数据
this.getNewSearchResultData()
}
})
}.layoutWeight(1)
}
}
.backgroundColor($r('app.color.white'))
.layoutWeight(1)
.listDirection(Axis.Horizontal)
.width('100%')
.height('219lpx')
Divider()
.width('100%')
.height('12lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('12lpx')
}
private dataTransform(value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO {
... ...
import { Logger } from 'wdKit/Index'
import { Logger, NumberFormatterUtils } from 'wdKit/Index'
import { LikeViewModel } from '../../viewmodel/LikeViewModel'
import { SPHelper } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
... ... @@ -22,7 +22,7 @@ export struct LikeComponent {
@Prop data: Record<string, string>
enableBtn = true
componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景
@State likeCount: number = 0 //点赞数
//上层传值 样例
... ... @@ -50,7 +50,11 @@ export struct LikeComponent {
//2: 新闻页中间位置样式
this.likeCompStyle2()
} else if (this.componentType == 3) {
//卡片底部互动样式
this.likeCompStyle3()
} else if (this.componentType == 4) {
// 直播,点赞按钮底测有灰色圆角背景+右上点赞数量
this.likeCompStyle4()
} else {
//1: 底部栏目样式 默认样式
this.likeCompStyle1()
... ... @@ -63,7 +67,8 @@ export struct LikeComponent {
transLikeStyle(): ILikeStyleResp {
if (this.likesStyle === 1) {
return {
url: this.likeStatus ? $r(`app.media.ic_like_check`) : $r(`app.media.ic_like_uncheck`),
url: this.likeStatus ? $r(`app.media.ic_like_check`) :
this.styleType == 1 ? this.componentType == 3?$r(`app.media.CarderInteraction_like`):$r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`),
name: '赞'
}
} else if (this.likesStyle === 2) {
... ... @@ -79,7 +84,9 @@ export struct LikeComponent {
}
}
return {
url: $r(`app.media.icon_like_ckeck`), name: '点赞'
url: this.likeStatus ? $r(`app.media.ic_like_check`) :
this.styleType == 1 ? $r('app.media.icon_like_default') : $r(`app.media.ic_like_uncheck`),
name: '点赞'
}
}
... ... @@ -88,9 +95,8 @@ export struct LikeComponent {
//2: 新闻页中间位置样式
Column() {
Button() {
Row() {
Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
Image(this.transLikeStyle().url)
.width(20)
.height(20)
Text(this.likeCount.toString())
... ... @@ -125,13 +131,11 @@ export struct LikeComponent {
@Builder
likeCompStyle3() {
Row() {
Image(this.likeStatus ? $r('app.media.icon_like_select') :
this.styleType == 1 ? $r('app.media.CarderInteraction_like') :
$r('app.media.icon_like_default_white'))
Image(this.transLikeStyle().url)
.width(18)
.height(18)
// Text(this.likeStatus ? '已赞' : '点赞')
Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞')
Text(this.likeStatus ? '已赞' : '点赞')
// Text(this.likeCount > 0 ? this.likeCount.toString() : '点赞')
.margin({ left: 4 })
.fontSize(14)
.fontColor(this.likeStatus ? '#ED2800' : '#666666')
... ... @@ -147,9 +151,7 @@ export struct LikeComponent {
//1: 底部栏目样式 默认样式
Column() {
// Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
Image(this.likeStatus ? $r('app.media.icon_like_select') :
this.styleType == 1 ? $r('app.media.icon_like_default') :
$r('app.media.icon_like_default_white'))
Image(this.transLikeStyle().url)
.width(24)
.height(24)
.onClick(() => {
... ... @@ -158,6 +160,43 @@ export struct LikeComponent {
}.width(24).height(24)
}
@Builder
likeCompStyle4() {
Stack({ alignContent: Alignment.Bottom }) {
Column() {
Image(this.transLikeStyle().url)
.width(24)
.height(24)
.onClick(() => {
this.clickButtonEvent()
})
}
.justifyContent(FlexAlign.Center)
.width(36)
.height(36)
.borderRadius(18)
.backgroundColor('#FFF5F5F5')
Row() {
Text(NumberFormatterUtils.formatNumberWithWan(this.likeCount || ''))
.fontSize(8)
.fontColor(Color.White)
.padding({ left: 4, right: 2 })
}
.height(12)
.alignItems(VerticalAlign.Center)
.position({ x: '100%', })
.markAnchor({ x: '100%' })
.backgroundImage($r('app.media.ic_like_back'))
.backgroundImageSize(ImageSize.Auto)
.visibility(this.likeCount > 0 ? Visibility.Visible : Visibility.Hidden)
}
.width(36)
.height(42)
}
async clickButtonEvent() {
console.log(TAG, '点赞点击')
// 未登录,跳转登录
... ... @@ -184,6 +223,12 @@ export struct LikeComponent {
this.viewModel.executeLike2(this.data).then(() => {
console.log(TAG, '点赞接口调用成功')
// 直播点赞一直增加
if (this.contentDetailData.liveInfo) {
this.likeStatus = true
this.likeCount++
} else {
this.likeStatus = !this.likeStatus
//点赞和取消点赞成功后更新点赞数
if (this.likeStatus) {
... ... @@ -191,6 +236,7 @@ export struct LikeComponent {
} else {
this.likeCount--
}
}
if (this.likeCount <= 0) {
this.likeCount = 0
... ...
... ... @@ -48,6 +48,18 @@ export struct OperRowListView {
private onCommentFocus: () => void = () => {
}
@Prop @Watch('onDetailUpdated') contentDetailData: ContentDetailDTO // 稿件详情
/**
* 组件样式类型,根据详情页类型传值,组件内部根据样式展现类型做判断
* 1:底部栏目样式
* 2:新闻页中间位置样式
* 3:动态Tab内容下的互动入口
* 4:视频详情页
* 5:横屏直播详情页
* 6:竖屏直播详情页
* 7:图集详情页
*/
@Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口
@Prop pageComponentType: number = -1 //1:视频详情页
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件
@State needLike: boolean = true
... ... @@ -65,6 +77,7 @@ export struct OperRowListView {
console.info(TAG, '22222----', this.styleType)
console.info(TAG, '3333----', this.needLike)
this.handleStyle()
this.onDetailUpdated()
}
async onDetailUpdated() {
... ... @@ -103,6 +116,8 @@ export struct OperRowListView {
}
build() {
// 视频详情页
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
// AudioDialog()
Row() {
... ... @@ -147,9 +162,10 @@ export struct OperRowListView {
.backgroundColor(this.bgColor)
.padding({
top: 10,
// bottom: `${this.bottomSafeHeight}px`
bottom: 50
bottom: `${this.bottomSafeHeight}px`
// bottom: 50
})
}
/**
... ... @@ -162,11 +178,15 @@ export struct OperRowListView {
CommentTabComponent({
publishCommentModel: this.publishCommentModel,
contentDetail: this.contentDetailData,
onCommentFocus: this.onCommentFocus
onCommentFocus: this.onCommentFocus,
pageComponentType: this.pageComponentType
})
}
}
.flexShrink(1)
.layoutWeight(1)
.margin({
right: this.pageComponentType === 1 ? 16 : 0,
})
if (this.showCommentIcon) {
Column() {
... ... @@ -189,7 +209,8 @@ export struct OperRowListView {
// if (this.likeBean?.contentId) {
LikeComponent({
data: this.likeBean,
styleType: this.styleType
styleType: this.styleType,
componentType: this.componentType
})
// }
}
... ...
... ... @@ -2,6 +2,8 @@ import { Action, NewspaperListBean, NewspaperListItemBean, NewspaperPositionItem
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { WDRouterRule } from 'wdRouter/Index'
import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'
import { Logger } from 'wdKit';
import { window } from '@kit.ArkUI';
/**
* 读报纸半屏弹窗
... ... @@ -35,6 +37,12 @@ export struct ENewspaperListDialog {
// listDialogController: CustomDialogController
public closeDialog?: () => void
// 手势滑动相关
private panOption: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Up | PanDirection.Down })
private topFixedHeight = 124
@State topHeight: number = 124
private deviceHeight: number = 0
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
... ... @@ -46,7 +54,13 @@ export struct ENewspaperListDialog {
}
}
aboutToAppear(): void {
async aboutToAppear() {
// 屏幕高度 - 滑动高度计算
let windowClass: window.Window = await window.getLastWindow(getContext(this));
let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
changeHeight += px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height)
this.deviceHeight = px2vp(windowClass.getWindowProperties().windowRect.height) - changeHeight
this.isCurrentViewOpen = true
console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum)
let _scrollIndex = Number.parseInt(this.currentPageNum)
... ... @@ -56,15 +70,13 @@ export struct ENewspaperListDialog {
}
aboutToDisappear() {
// if (this.pageListDialogController) {
// this.pageListDialogController = null
// }
this.isCurrentViewOpen = false
}
build() {
Stack() {
Column() {
Column() {
Row()
.width(43)
.height(4)
... ... @@ -110,6 +122,24 @@ export struct ENewspaperListDialog {
.height(6)
.margin({ top: 20, left: 16, right: 16 })
.objectFit(ImageFit.Contain)
}
.width('100%')
.gesture(
PanGesture(this.panOption)
.onActionStart((event: GestureEvent) => {
Logger.debug('ENewspaperListDialog','Pan start')
})
.onActionUpdate((event: GestureEvent) => {
if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) {
this.topHeight = this.topFixedHeight + event.offsetY
}
Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight)
})
.onActionEnd(() => {
this.onCloseGestureDialog()
})
)
List({ scroller: this.listScroller, initialIndex: this.scrollIndex }) {
ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {
... ... @@ -137,7 +167,7 @@ export struct ENewspaperListDialog {
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.maxLines(2)
// .maxLines(2)
.margin({
bottom: 8
})
... ... @@ -151,7 +181,7 @@ export struct ENewspaperListDialog {
.margin({
bottom: 8
})
.maxLines(2)
// .maxLines(2)
}
if (positionItem.downTitle) {
... ... @@ -162,7 +192,7 @@ export struct ENewspaperListDialog {
.margin({
bottom: 8
})
.maxLines(2)
// .maxLines(2)
}
if (positionItem.newsTxt) {
Text(positionItem.newsTxt)
... ... @@ -251,16 +281,13 @@ export struct ENewspaperListDialog {
this.currentPageNum = `${firstIndex < 9 ? '0' + (firstIndex + 1) : firstIndex + 1}`
// }
})
.onScroll((scrollOffset: number, scrollState: ScrollState) => {
// console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset)
// if (this.scrollOffset == 0) {
// this.scrollOffset = 0
// }
})
}
.margin({ top: 124 })
// .margin({ top: 124 })
.margin({ top: this.topHeight })
.width('100%')
.backgroundColor(Color.White)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.onClick(() => {
})
... ... @@ -272,6 +299,33 @@ export struct ENewspaperListDialog {
this.closeDialog()
}
})
.gesture(
PanGesture(this.panOption)
.onActionStart((event: GestureEvent) => {
Logger.debug('ENewspaperListDialog','Pan start')
})
.onActionUpdate((event: GestureEvent) => {
if (event) {
if (this.topFixedHeight + event.offsetY >= this.topFixedHeight) {
this.topHeight = this.topFixedHeight + event.offsetY
}
Logger.debug('ENewspaperListDialog', 'topHeight:' + this.topHeight)
}
})
.onActionEnd(() => {
this.onCloseGestureDialog()
})
)
}
onCloseGestureDialog() {
if (this.topHeight >= this.deviceHeight ) {
if (this.closeDialog) {
this.closeDialog()
}
} else {
this.topHeight = this.topFixedHeight
}
}
updateRecordsData() {
... ...
import lottie, { AnimationItem, AnimationSegment } from '@ohos/lottie';
@Component
export struct LottieView {
@Prop name: string
@Prop path: string
@Prop lottieWidth: number = 30
@Prop lottieHeight: number = 30
@Prop autoplay: boolean = false
@Prop loop: boolean = false
@Prop initialSegment?: AnimationSegment = [0, 120] // 动画起始帧
@Prop onReady: (animateItem: AnimationItem | null) => void // 动画初始化完成事件
@Prop onComplete: () => void = () => {
} // 动画完成事件
private politeChickyController: CanvasRenderingContext2D = new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象
private animateItem: AnimationItem | null = null; // 初始化loadAnimation接口的返回对象
// 页面隐藏销毁动画
onPageHide(): void {
this.animateItem?.destroy()
if (this.onComplete) {
this.animateItem?.removeEventListener('complete', this.onComplete)
}
}
/**
* 加载动画
* @param autoplay 控制动画是否自动播放参数
*/
loadAnimation() {
// 销毁动画,减少缓存
if (this.animateItem !== null) {
this.animateItem.destroy();
this.animateItem = null;
}
this.animateItem = lottie.loadAnimation({
container: this.politeChickyController,
renderer: 'canvas',
loop: this.loop,
autoplay: this.autoplay,
name: this.name, // 动画名称
path: this.path, // hap包内动画资源文件路径,仅支持json格式
// initialSegment: this.initialSegment
})
if (this.initialSegment) {
this.animateItem.segments = this.initialSegment
}
if (this.onComplete) {
this.animateItem.addEventListener('complete', this.onComplete)
}
}
build() {
Stack({ alignContent: Alignment.TopStart }) {
Canvas(this.politeChickyController)
.width(this.lottieWidth)
.height(this.lottieHeight)
.backgroundColor(Color.Black)
.onReady(() => {
this.loadAnimation();
if (this.onReady) {
this.onReady(this.animateItem)
}
})
.onClick(() => {
this.animateItem?.play()
})
}
}
}
/**
* WDMessageCenterMessageType 拉取消息类型
*/
export const enum WDMessageCenterMessageType {
WDMessageCenterMessageType_Interact = 1, //互动通知
WDMessageCenterMessageType_Subscribe, //预约消息
WDMessageCenterMessageType_System, //系统消息
}
export interface InteractMessageListModel{
data: InteractMessageMItem
code: number
message: string
success: string
timestamp: number
}
export class InteractMessageMItem{
pageNum:number = 0
pageSize:number = 0
totalCount:number = 0
hasNext:number = 0
list:InteractMessageModel[] = []
constructor(list?:InteractMessageModel[],pageNum?: number,pageSize?: number,totalCount?: number,hasNext?:number) {
}
}
export class InteractMessageModel {
classify: string = '';
contentId: string = '';
contentType: string = '';
id: number = 0;
message: string = '';
platform: string = '';
privateMailId: number = 0;
privateMailIdList: number[] = [];
privateMailIds: string = '';
privateMailNum: number = 0;
read: boolean = true;
source: string = '';
time: string = '';
title: string = '';
userId: string = '';
remark: string = '';
InteractMsubM:InteractMsubModel = new InteractMsubModel;
}
export class InteractMsubModel {
beReply: string = '';
headUrl: string = '';
contentId: string = '';
contentRelObjectid: string = '';
contentTitle: string = '';
commentContent: string = '';
userName: string = '';
userId: string = '';
contentRelId: string = '';
shareUrl: string = '';
userType: string = '';
contentRelType: string = '';
visitor: string = '';
contentType: string = '';
}
export interface InteractMParams {
contentType?: string;
pageNum?: string;
pageSize?: string;
userId?: string;
createTime?: string;
}
export interface InteractMDTO{
success: boolean;
code: number;
message: string;
data: number;
timestamp?: number;
}
\ No newline at end of file
... ...
... ... @@ -24,6 +24,7 @@ import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperati
import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem';
import { SpConstants } from 'wdConstant/Index';
import { MessageItem } from '../viewmodel/MessageItem';
import { MessageUnReadItem } from '../viewmodel/MessageUnReadItem';
const TAG = "MinePageDatasModel"
... ... @@ -597,6 +598,33 @@ class MinePageDatasModel{
})
})
}
/**
* 获取消息未读数据
* @param pageSize
* @param pageNum
* @returns
*/
getMessageUnReadData(): Promise<MessageUnReadItem> {
return new Promise<MessageUnReadItem>((success, error) => {
this.fetchMessageUnReadData().then((navResDTO: ResponseDTO<MessageUnReadItem>) => {
if (!navResDTO || navResDTO.code != 0) {
error(null)
return
}
let navigationBean = navResDTO.data as MessageUnReadItem
success(navigationBean);
}).catch((err: Error) => {
error(null)
})
})
}
fetchMessageUnReadData() {
let url = HttpUrlUtils.getMessageUnReadDataUrl()
return WDHttp.get<ResponseDTO<MessageUnReadItem>>(url)
};
}
const minePageDatasModel = MinePageDatasModel.getInstance()
... ...
... ... @@ -43,7 +43,6 @@ export interface MyCollectionListModel{
}
export interface contentListItemParams{
contentId?:string;
contentType?:string;
... ...
... ... @@ -8,5 +8,6 @@ struct SearchPage {
SearchComponent()
}.height('100%')
.width('100%')
.backgroundColor($r('app.color.white'))
}
}
\ No newline at end of file
... ...
import { router } from '@kit.ArkUI';
@Entry
@Component
struct ShowHomePageHeaderPage {
@State headPhotoUrl: string = '';
@State params:Record<string, string> = router.getParams() as Record<string, string>;
onPageShow() {
this.headPhotoUrl = this.params?.['headPhotoUrl'];
}
build() {
Row() {
Image(this.headPhotoUrl)
.alt( $r('app.media.WDAccountOwnerHedaerDefaultIcon') )
.width('100%')
.objectFit(ImageFit.Contain)
}
.width('100%')
.height('100%')
.alignItems(VerticalAlign.Center)
.backgroundColor($r('app.color.color_000000'))
.onClick(()=>{
router.back()
})
}
}
\ No newline at end of file
... ...
... ... @@ -4,18 +4,16 @@ import { router } from '@kit.ArkUI';
@Component
struct ShowUserHeaderPage {
@State headPhotoUrl: string = '';
@State headType: string = ''
@State params:Record<string, string> = router.getParams() as Record<string, string>;
onPageShow() {
this.headPhotoUrl = this.params?.['headPhotoUrl'];
this.headType = this.params?.['headType'] ?? '';
}
build() {
Row() {
Image(this.headPhotoUrl)
.alt(this.headType.length > 0 ? $r('app.media.WDAccountOwnerHedaerDefaultIcon') : $r('app.media.default_head'))
.alt($r('app.media.default_head'))
.width('720lpx')
.height('720lpx')
.objectFit(ImageFit.Auto)
... ...
// import { collcetRecordParams, MyCollectionItem, MyCollectionListModel } from '../model/MyCollectionModel';
import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { Logger } from 'wdKit';
import promptAction from '@ohos.promptAction';
import {
InteractMDTO,
InteractMessageListModel, InteractMessageMItem, InteractMParams } from '../model/InteractMessageModel';
const TAG = "MyCollectionViewModel"
class InteractMessageViewModel {
private static instance:InteractMessageViewModel
/**
* 单例模式
* @returns
*/
public static getInstance(): InteractMessageViewModel {
if (!InteractMessageViewModel.instance) {
InteractMessageViewModel.instance = new InteractMessageViewModel();
}
return InteractMessageViewModel.instance;
}
// ///互动通知
// WDMessageCenterMessageType_Interact = 1,
//
// ///预约消息
// WDMessageCenterMessageType_Subscribe = 2,
//
// ///系统消息
// WDMessageCenterMessageType_System = 3
BaseGetRequest(contentType:number,pageNum:number){
let userID = HttpUtils.getUserId();
let url = HttpUrlUtils.getMessageListDataUrl()+`?contentType=${contentType}&userId=${userID}&pageSize=${20}&pageNum=${pageNum}`
return WDHttp.get<InteractMessageListModel>(url)
}
fetchMessageList(contentType:number,pageNum:number):Promise<InteractMessageMItem>{
return new Promise((success,error) => {
this.BaseGetRequest(contentType,pageNum).then((navResDTO: InteractMessageListModel) => {
if (!navResDTO || navResDTO.code != 0) {
return
}
Logger.info(TAG, "fetchMessageList then,navResDTO.timeStamp:" + navResDTO.timestamp);
success(navResDTO.data)
}).catch((err: Error) => {
Logger.error(TAG, `fetchMessageList catch, error.name : ${err.name}, error.message:${err.message}`);
error("page data invalid");
})
})
}
getMessageLikeCount():Promise<number>{
return new Promise((success,error) => {
WDHttp.get<InteractMDTO>(HttpUrlUtils.getMessageLikeCount()).then((navResDTO: InteractMDTO) => {
if (navResDTO.code == 0) {
success(navResDTO.data)
}
})
.catch((error: Error) => {
Logger.info(TAG,'executeCollcet','ResponseDTO')
})
})
}
}
const interactMViewModel = InteractMessageViewModel.getInstance();
export default interactMViewModel as InteractMessageViewModel
\ No newline at end of file
... ...
... ... @@ -49,9 +49,6 @@ export class LiveModel {
params['relationId'] = relationId
params['liveId'] = liveId
params['isSubscribe'] = `${isSubscribe}`
Logger.info('relationId', relationId)
Logger.info('liveId', liveId)
Logger.info('isSubscribe', typeof isSubscribe)
return new Promise<ResponseDTO<string>>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(
HttpUrlUtils.getLiveAppointmentUrl(),
... ...
export class MessageUnReadItem{
activeCount: number = 0 //互动通知未读数
subscribeCount: number = 0 //预约消息未读数
systemCount: number = 0 //系统通知未读数
subscribeInfo: SubscribeInfo = new SubscribeInfo()
systemInfo: SystemInfo = new SystemInfo()
activeInfo: ActiveInfo = new ActiveInfo
}
class SubscribeInfo{
classify: string = ""
contentId: string = ""
contentType: string = ""
id: number = -1
message: string = ""
platform: string = ""
privateMailId: number = -1
privateMailIdList: Array< string > = []
privateMailIds: string = ""
privateMailNum: number = -1
read: boolean = false
source: string = ""
time: string = ""
title: string = ""
userId: number = -1
remark: string = ""
}
class SystemInfo{
classify: string = ""
contentType: string = ""
id: number = -1
message: string = ""
platform: string = ""
privateMailId: number = -1
privateMailIdList: Array< string > = []
privateMailIds: string = ""
privateMailNum: number = -1
read: boolean = false
source: string = ""
time: string = ""
title: string = ""
userId: number = -1
}
class ActiveInfo{
id:string = ""
message: string = ""
time: string = ""
title: string = ""
}
\ No newline at end of file
... ...
import FunctionsItem from './FunctionsItem'
@Observed
export default class MinePagePersonalFunctionsItem extends FunctionsItem {
isShowRedPoint:boolean = false
}
\ No newline at end of file
... ...
... ... @@ -24,6 +24,7 @@
"components/page/ThemeListPage",
"pages/ShowUserHeaderPage",
"pages/MineMessagePage",
"components/page/InteractMessagePage"
"components/page/InteractMessagePage",
"pages/ShowHomePageHeaderPage"
]
}
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@
"main": "Index.ets",
"version": "1.0.0",
"dependencies": {
"@ohos/lottie": "2.0.10",
"wdComponent": "file:../../features/wdComponent",
"wdPlayer": "file:../../features/wdPlayer",
"wdNetwork": "file:../../commons/wdNetwork",
... ...
... ... @@ -70,6 +70,7 @@ export struct DetailPlayLiveCommon {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment)
this.publishCommentModel.commentContent = ''
// }
}
... ...
... ... @@ -61,8 +61,8 @@ export struct DetailPlayLivePage {
.layoutWeight(503)
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
if (this.contentDetailData?.newsId) {
OperRowListView({
componentType: 4,
operationButtonList: ['comment', 'collect', 'share', 'like'],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
... ... @@ -73,7 +73,7 @@ export struct DetailPlayLivePage {
}
})
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
}
// LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum })
// .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
}
... ...
import { window } from '@kit.ArkUI'
import lottie from '@ohos/lottie';
import { NumberFormatterUtils, StringUtils, WindowModel } from 'wdKit/Index'
import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index'
import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'
import { DisplayDirection } from 'wdConstant/Index'
import { LiveFollowComponent } from 'wdComponent/Index'
import { LiveFollowComponent, LottieView } from 'wdComponent/Index'
@Component
export struct PlayUIComponent {
... ... @@ -44,6 +46,12 @@ export struct PlayUIComponent {
}
}
aboutToDisappear(): void {
if (this.liveDetailsBean.liveInfo?.liveState == 'running') {
lottie.destroy('live_status_wait')
}
}
build() {
Column() {
if (this.liveDetailsBean && this.liveDetailsBean.liveInfo) {
... ... @@ -113,11 +121,12 @@ export struct PlayUIComponent {
}
}
.width('100%')
// .width(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? 'calc(100% - 80vp)' : 'calc(100% - 32vp)')
.padding({
top: 15,
bottom: 6,
left: 10,
right: 10
left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp',
right: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp'
})
.alignItems(HorizontalAlign.Start)
.visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None)
... ... @@ -130,6 +139,7 @@ export struct PlayUIComponent {
// 预约
if (this.liveDetailsBean.liveInfo?.liveState == 'wait') {
Row() {
Image($r('app.media.icon_live_status_wait'))
.width(22)
.height(18)
... ... @@ -148,9 +158,21 @@ export struct PlayUIComponent {
// 直播中
else if (this.liveDetailsBean.liveInfo?.liveState == 'running') {
Row() {
Image($r('app.media.icon_live_status_running'))
Stack() {
Image($r('app.media.icon_live_status_running_back'))
.width(22)
.height(18)
LottieView({
name: 'live_status_wait',
path: "lottie/live_detail_living.json",
lottieWidth: 9,
lottieHeight: 9,
autoplay: true,
loop: true,
})
.margin({ right: 2 })
}
Text('直播中')
.fontSize('11fp')
.fontWeight(400)
... ... @@ -271,8 +293,8 @@ export struct PlayUIComponent {
.linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] })
.width('100%')
.padding({
left: 10,
right: 10,
left: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp',
right: this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? '40vp' : '16vp',
top: 15,
bottom: 15
})
... ...
... ... @@ -28,11 +28,11 @@ export struct TopPlayComponent {
updateData() {
//直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl && this.liveDetailsBean.liveInfo.previewUrl.length > 0) {
if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl &&
this.liveDetailsBean.liveInfo.previewUrl.length > 0) {
this.imgUrl = this.liveDetailsBean.liveInfo.previewUrl
Logger.debug(TAG, 'ok+' + `${this.imgUrl}`)
}
else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
} else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
Logger.debug(TAG, 'ok-' + `${this.imgUrl}`)
}
... ... @@ -81,6 +81,7 @@ export struct TopPlayComponent {
.alignSelf(ItemAlign.Center)
}
aboutToDisappear(): void {
async aboutToDisappear(): Promise<void> {
await this.playerController?.release()
}
}
\ No newline at end of file
... ...
... ... @@ -115,6 +115,7 @@ export struct PlayerCommentComponent {
// 收藏、分享、点赞是否需要根据字段显隐
OperRowListView({
styleType: 3,
componentType: 4,
operationButtonList: ['comment', 'collect', 'share', 'like'],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
... ...
... ... @@ -37,11 +37,10 @@ export struct PlayerComponent {
}
}
aboutToDisappear(): void {
async aboutToDisappear(): Promise<void> {
this.playerController?.pause()
this.playerController?.stop()
this.playerController?.release()
await this.playerController?.release()
}
updateData() {
... ...
import lottie from '@ohos/lottie'
import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'
import { LiveFollowComponent } from 'wdComponent/Index'
import { LiveFollowComponent, LottieView } from 'wdComponent/Index'
import { NumberFormatterUtils } from 'wdKit/Index'
@Preview
... ... @@ -9,6 +10,12 @@ export struct PlayerTitleComponent {
@Consume liveRoomDataBean: LiveRoomDataBean
@Consume liveState: string
aboutToDisappear(): void {
if (this.liveDetailsBean.liveInfo?.liveState == 'running') {
lottie.destroy('live_status_wait')
}
}
build() {
Column() {
Row() {
... ... @@ -47,10 +54,25 @@ export struct PlayerTitleComponent {
if (this.liveRoomDataBean.liveId) {
Row() {
if (this.liveState == 'running') {
Image($r('app.media.icon_live_status_running'))
Stack() {
Image($r('app.media.icon_live_status_running_back'))
.width(22)
.height(18)
.margin({ right: 1 })
LottieView({
name: 'live_status_wait',
path: "lottie/live_detail_living.json",
lottieWidth: 9,
lottieHeight: 9,
autoplay: true,
loop: true,
})
.margin({ right: 2 })
}.margin({ right: 1 })
// Image($r('app.media.icon_live_status_running'))
// .width(22)
// .height(18)
// .margin({ right: 1 })
}
Text(this.liveState == 'running' ? '直播中' : '回看')
... ...
import { ContentDetailDTO } from 'wdBean/Index'
import {
publishCommentModel
} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { CommentComponent } from '../../../../../wdComponent/src/main/ets/components/comment/view/CommentComponent'
@Component
export struct CommentComponentPage {
scroller: Scroller = new Scroller()
@Consume contentDetailData: ContentDetailDTO
@Consume showCommentList: boolean
@State publishCommentModel: publishCommentModel = new publishCommentModel()
aboutToAppear(): void {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
}
build() {
Scroll(this.scroller) {
Stack() {
CommentComponent({
publishCommentModel: this.publishCommentModel
})
Image($r("app.media.ic_close_black"))
.width(20)
.height(20)
.onClick(() => {
this.showCommentList = false
})
.margin({ top: 10, right: 20 })
.position({ x: '100%' })
.markAnchor({ x: '100%' })
}
}
.zIndex(1000)
.backgroundColor(Color.White)
}
}
\ No newline at end of file
... ...
import { ContentDetailDTO, InteractDataDTO } from 'wdBean';
import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer';
import { WDPlayerController, WDPlayerRenderView } from 'wdPlayer';
import { ContentDetailRequest } from 'wdDetailPlayApi';
import {
batchLikeAndCollectParams,
... ... @@ -11,6 +11,7 @@ import { HttpUtils } from 'wdNetwork/Index';
import { DateTimeUtils } from 'wdKit/Index';
import { PlayerBottomView } from '../view/PlayerBottomView';
import { PlayerRightView } from '../view/PlayerRightView';
import { CommentComponentPage } from './CommentComponentPage';
const TAG = 'DetailPlayShortVideoPage';
... ... @@ -32,6 +33,7 @@ export struct DetailPlayShortVideoPage {
@Provide followStatus: string = '0' // 关注状态
@Provide isOpenDetail: boolean = false // 查看详情按钮点击
@Provide isDragging: boolean = false // 拖动时间进度条
@Provide showCommentList: boolean = false
@Consume @Watch('videoStatusChange') switchVideoStatus: boolean
@Consume @Watch('pageShowChange') pageShow: number
@Consume topSafeHeight: number
... ... @@ -148,6 +150,7 @@ export struct DetailPlayShortVideoPage {
this.progressVal = Math.floor(position * 100 / duration);
}
this.queryNewsInfoOfUser()
}
async aboutToDisappear(): Promise<void> {
... ... @@ -163,10 +166,14 @@ export struct DetailPlayShortVideoPage {
PlayerBottomView({
playerController: this.playerController
})
PlayerRightView({
playerController: this.playerController
})
CommentComponentPage({}).visibility(this.showCommentList ? Visibility.Visible : Visibility.None)
.position({ y: '100%' })
.markAnchor({ y: '100%' })
}
.height('100%')
.width('100%')
... ... @@ -192,6 +199,7 @@ export struct DetailPlayShortVideoPage {
@Builder
playerViewBuilder() {
WDPlayerRenderView({
playerController: this.playerController,
onLoad: async () => {
... ... @@ -205,10 +213,13 @@ export struct DetailPlayShortVideoPage {
.padding({
bottom: this.videoLandScape === 1 ? 115 : 0,
})
.layoutWeight(1)
.align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center)
.onClick(() => {
console.error('WDPlayerRenderView=== onClick')
this.playerController?.switchPlayOrPause();
})
}
}
\ No newline at end of file
... ...
... ... @@ -39,6 +39,7 @@ export struct VideoChannelDetail {
// private recommend?: string = '' // 0.非推荐,1.推荐;
@Link @Watch('navIndexChange') bottomNavIndex: number
@Link @Watch('navIndexChange') topNavIndex: number
@Prop @Watch('autoRefreshChange') autoRefresh: number = 0
@Consume barBackgroundColor: Color
private swiperController: SwiperController = new SwiperController()
@Provide showComment: boolean = false
... ... @@ -54,6 +55,18 @@ export struct VideoChannelDetail {
@State isMouted: boolean = false
@State isRequestError: boolean = false
autoRefreshChange() {
if (this.topNavIndex === 0) {
this.data = []
this.interactDataList = []
this.totalCount = 0
this.isMouted = false
this.getRecCompInfo()
this.getRecCompInfo()
}
}
pageShowChange() {
if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
this.barBackgroundColor = Color.Black
... ...
... ... @@ -43,7 +43,7 @@ export struct DetailDialog {
.height(200)
Row() {
Image($r('app.media.ic_close'))
Image($r("app.media.ic_close_white"))
.height(24).margin({ top: 20 }).onClick(() => {
this.controller.close()
if (this.isOpenDetail) {
... ...
... ... @@ -3,20 +3,56 @@ import { PlayerTitleView } from './PlayerTitleView'
import { PlayerProgressView } from './PlayerProgressView'
import { PlayerCommentView } from './PlayerCommentView'
import { PlayerTimeSeekView } from './PlayerTimeSeekView'
import { OperRowListView } from '../../../../../wdComponent/src/main/ets/components/view/OperRowListView'
import {
publishCommentModel
} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { ContentDetailDTO } from 'wdBean/Index';
import { WindowModel } from 'wdKit/Index';
@Component
export struct PlayerBottomView {
private playerController?: WDPlayerController;
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@Consume showComment?: boolean
@Consume isOpenDetail?: boolean
@Consume isDragging?: boolean
@Consume contentDetailData: ContentDetailDTO
@State publishCommentModel: publishCommentModel = new publishCommentModel()
aboutToAppear(): void {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.commentContent = ''
}
build() {
Column() {
PlayerTitleView()
PlayerProgressView({ playerController: this.playerController })
if (this.showComment) {
PlayerCommentView()
// PlayerCommentView()
OperRowListView({
pageComponentType: 1,
styleType: 3,
componentType: 4,
operationButtonList: ['comment',],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: false,
onBack: () => {
WindowModel.shared.setWindowLayoutFullScreen(false)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
})
.padding({
bottom: -this.bottomSafeHeight + 'px'
})
}
}
.alignItems(HorizontalAlign.Start)
... ...
... ... @@ -32,6 +32,7 @@ export struct PlayerRightView {
@Consume isOpenDetail: boolean
@Consume isDragging: boolean
@Consume showComment?: boolean
@Consume showCommentList: boolean
@State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
aboutToAppear() {
... ... @@ -343,7 +344,8 @@ export struct PlayerRightView {
}
.margin({ bottom: 20 })
.onClick((event: ClickEvent) => {
ToastUtils.showToast('评论为公共方法,待开发', 1000);
// ToastUtils.showToast('评论为公共方法,待开发', 1000);
this.showCommentList = true
})
}
... ...
... ... @@ -5,6 +5,14 @@
"value": "#FFFFFF"
},
{
"name": "color_transparent",
"value": "#00000000"
},
{
"name": "color_222222",
"value": "#222222"
},
{
"name": "play_track_color",
"value": "#1AFFFFFF"
},
... ... @@ -29,6 +37,18 @@
"value": "#4DFFFFFF"
},
{
"name": "color_666666",
"value": "#666666"
},
{
"name": "color_B0B0B0",
"value": "#B0B0B0"
},
{
"name": "color_EDEDED",
"value": "#EDEDED"
},
{
"name": "divider_color",
"value": "#D3D3D3"
},
... ...