yangchenggong1_wd

desc:增加 我的 消息 入口

... ... @@ -114,6 +114,8 @@ export class WDRouterPage {
static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage");
//搜索主页
static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage");
//消息主页
static mineMessagePage = new WDRouterPage("wdComponent", "ets/pages/MineMessagePage");
//搜索人民号主页
static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage");
//人民号主页
... ...
... ... @@ -78,6 +78,14 @@ export default struct MinePagePersonFunctionUI {
WDRouterRule.jumpWithPage(WDRouterPage.browsingHistoryPage)
break;
}
case "消息":{
if(!this.isLogin){
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage)
break;
}
}
}).width('169lpx')
.height('117lpx')
... ...
import { StringUtils, ToastUtils } from 'wdKit/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { MessageItem } from '../../../viewmodel/MessageItem'
import { CustomTitleUI } from '../../reusable/CustomTitleUI'
const TAG = "MessageListUI"
@Component
export struct MessageListUI {
@State msgData: MessageItem[] = []
aboutToAppear() {
this.msgData = MinePageDatasModel.getMessageData()
}
build() {
Column() {
//标题栏目
CustomTitleUI({ titleName: "消息" })
List() {
ForEach(this.msgData, (item: MessageItem, index: number) => {
ListItem() {
Column(){
Column() {
Row() {
Row() {
Image(item.imgSrc)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({ right: '15lpx' })
Column() {
Text(item.title)
.fontWeight(500)
.fontSize('31lpx')
.lineHeight('42lpx')
.fontColor($r('app.color.color_222222'))
.maxLines(1)
.margin({ bottom: StringUtils.isNotEmpty(item.desc)?'8lpx':0 })
if(StringUtils.isNotEmpty(item.desc)){
Text(`${item.desc}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.lineHeight('38lpx')
.fontWeight(400)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
}
.height('92lpx')
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
.justifyContent(StringUtils.isNotEmpty(item.desc)?FlexAlign.Start:FlexAlign.Center)
}.layoutWeight(1)
Row() {
Text(`${item.time}`)
.fontColor($r('app.color.color_999999'))
.fontSize('23lpx')
.fontWeight(500)
.lineHeight('35lpx')
}
.justifyContent(FlexAlign.Start)
.alignItems(VerticalAlign.Top)
.height('92lpx')
}
.width('100%')
.height('92lpx')
.justifyContent(FlexAlign.SpaceBetween)
}.height('154lpx')
.width("100%")
.justifyContent(FlexAlign.Center)
Text().backgroundColor($r('app.color.color_EDEDED'))
.width('100%')
.height('1lpx')
.visibility(index != 3 ?Visibility.Visible:Visibility.None)
}
}
.padding({left:"31lpx",right:"31lpx"})
.onClick(() => {
ToastUtils.shortToast(index+"")
switch (index) {
case 0: //互动消息
break;
case 1: //预约消息
break;
case 2: //历史推送
break;
case 3: //系统消息
break;
}
})
.height('154lpx')
.width("100%")
})
}
}
.backgroundColor($r('app.color.white'))
.height('100%')
.width('100%')
}
}
\ No newline at end of file
... ...
... ... @@ -23,6 +23,7 @@ import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperati
import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperationRequestItem';
import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem';
import { SpConstants } from 'wdConstant/Index';
import { MessageItem } from '../viewmodel/MessageItem';
const TAG = "MinePageDatasModel"
... ... @@ -34,6 +35,7 @@ class MinePageDatasModel{
personalData:MinePagePersonalFunctionsItem[] = []
creatorData:MinePageCreatorFunctionsItem[] = []
moreData:MinePageMoreFunctionModel[] = []
messageData:MessageItem[] = []
private constructor() { }
... ... @@ -63,7 +65,7 @@ class MinePageDatasModel{
this.personalData.push(new MinePagePersonalFunctionsItem("关注",$r('app.media.mine_follow_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("收藏",$r('app.media.mine_collect_icon')))
// this.personalData.push(new MinePagePersonalFunctionsItem("历史",$r('app.media.mine_history_icon')))
// this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon')))
// this.personalData.push(new MinePagePersonalFunctionsItem("留言板",$r('app.media.mine_msgboard_icon')))
// this.personalData.push(new MinePagePersonalFunctionsItem("预约",$r('app.media.mine_order_icon')))
return this.personalData
... ... @@ -102,6 +104,21 @@ class MinePageDatasModel{
}
/**
* 消息 5 个数据
* 包含名字和图标
*/
getMessageData():MessageItem[]{
if(this.messageData.length === 4){
return this.messageData
}
this.messageData.push(new MessageItem($r('app.media.msg_interact'),"互动消息","",""))
this.messageData.push(new MessageItem($r('app.media.msg_reserve'),"预约消息","",""))
this.messageData.push(new MessageItem($r('app.media.msg_history'),"历史推送","",""))
this.messageData.push(new MessageItem($r('app.media.msg_system'),"系统消息","",""))
return this.messageData
}
/**
* 预约
* @param pageSize
* @param pageNum
... ...
import { MessageListUI } from '../components/mine/message/MessageListUI';
@Entry
@Component
struct MineMessagePage {
build() {
Column(){
MessageListUI()
}
}
}
\ No newline at end of file
... ...
export class MessageItem{
imgSrc:Resource = $r("app.media.xxhdpi_pic_wb")
title:string = ""
desc:string = ""
time:string = ""
constructor(imgSrc:Resource,title:string,desc:string,time:string){
this.imgSrc = imgSrc
this.title = title
this.desc = desc
this.time = time
}
}
\ No newline at end of file
... ...
... ... @@ -22,6 +22,7 @@
"components/page/ReserveMorePage",
"pages/VideoPlayPage",
"components/page/ThemeListPage",
"pages/ShowUserHeaderPage"
"pages/ShowUserHeaderPage",
"pages/MineMessagePage"
]
}
\ No newline at end of file
... ...