yangchenggong1_wd

desc:增加 我的 消息 入口

@@ -114,6 +114,8 @@ export class WDRouterPage { @@ -114,6 +114,8 @@ export class WDRouterPage {
114 static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage"); 114 static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage");
115 //搜索主页 115 //搜索主页
116 static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage"); 116 static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage");
  117 + //消息主页
  118 + static mineMessagePage = new WDRouterPage("wdComponent", "ets/pages/MineMessagePage");
117 //搜索人民号主页 119 //搜索人民号主页
118 static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage"); 120 static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage");
119 //人民号主页 121 //人民号主页
@@ -78,6 +78,14 @@ export default struct MinePagePersonFunctionUI { @@ -78,6 +78,14 @@ export default struct MinePagePersonFunctionUI {
78 WDRouterRule.jumpWithPage(WDRouterPage.browsingHistoryPage) 78 WDRouterRule.jumpWithPage(WDRouterPage.browsingHistoryPage)
79 break; 79 break;
80 } 80 }
  81 + case "消息":{
  82 + if(!this.isLogin){
  83 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  84 + return
  85 + }
  86 + WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage)
  87 + break;
  88 + }
81 } 89 }
82 }).width('169lpx') 90 }).width('169lpx')
83 .height('117lpx') 91 .height('117lpx')
  1 +import { StringUtils, ToastUtils } from 'wdKit/Index'
  2 +import MinePageDatasModel from '../../../model/MinePageDatasModel'
  3 +import { MessageItem } from '../../../viewmodel/MessageItem'
  4 +import { CustomTitleUI } from '../../reusable/CustomTitleUI'
  5 +
  6 +const TAG = "MessageListUI"
  7 +
  8 +@Component
  9 +export struct MessageListUI {
  10 + @State msgData: MessageItem[] = []
  11 +
  12 + aboutToAppear() {
  13 + this.msgData = MinePageDatasModel.getMessageData()
  14 + }
  15 +
  16 + build() {
  17 + Column() {
  18 + //标题栏目
  19 + CustomTitleUI({ titleName: "消息" })
  20 +
  21 + List() {
  22 + ForEach(this.msgData, (item: MessageItem, index: number) => {
  23 + ListItem() {
  24 + Column(){
  25 + Column() {
  26 + Row() {
  27 + Row() {
  28 + Image(item.imgSrc)
  29 + .objectFit(ImageFit.Auto)
  30 + .width('92lpx')
  31 + .height('92lpx')
  32 + .margin({ right: '15lpx' })
  33 +
  34 + Column() {
  35 + Text(item.title)
  36 + .fontWeight(500)
  37 + .fontSize('31lpx')
  38 + .lineHeight('42lpx')
  39 + .fontColor($r('app.color.color_222222'))
  40 + .maxLines(1)
  41 + .margin({ bottom: StringUtils.isNotEmpty(item.desc)?'8lpx':0 })
  42 +
  43 + if(StringUtils.isNotEmpty(item.desc)){
  44 + Text(`${item.desc}`)
  45 + .fontColor($r('app.color.color_B0B0B0'))
  46 + .fontSize('23lpx')
  47 + .lineHeight('38lpx')
  48 + .fontWeight(400)
  49 + .maxLines(1)
  50 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  51 + }
  52 + }
  53 + .height('92lpx')
  54 + .layoutWeight(1)
  55 + .alignItems(HorizontalAlign.Start)
  56 + .justifyContent(StringUtils.isNotEmpty(item.desc)?FlexAlign.Start:FlexAlign.Center)
  57 + }.layoutWeight(1)
  58 +
  59 + Row() {
  60 + Text(`${item.time}`)
  61 + .fontColor($r('app.color.color_999999'))
  62 + .fontSize('23lpx')
  63 + .fontWeight(500)
  64 + .lineHeight('35lpx')
  65 + }
  66 + .justifyContent(FlexAlign.Start)
  67 + .alignItems(VerticalAlign.Top)
  68 + .height('92lpx')
  69 + }
  70 + .width('100%')
  71 + .height('92lpx')
  72 + .justifyContent(FlexAlign.SpaceBetween)
  73 +
  74 + }.height('154lpx')
  75 + .width("100%")
  76 + .justifyContent(FlexAlign.Center)
  77 +
  78 + Text().backgroundColor($r('app.color.color_EDEDED'))
  79 + .width('100%')
  80 + .height('1lpx')
  81 + .visibility(index != 3 ?Visibility.Visible:Visibility.None)
  82 + }
  83 + }
  84 + .padding({left:"31lpx",right:"31lpx"})
  85 + .onClick(() => {
  86 + ToastUtils.shortToast(index+"")
  87 + switch (index) {
  88 + case 0: //互动消息
  89 + break;
  90 + case 1: //预约消息
  91 + break;
  92 + case 2: //历史推送
  93 + break;
  94 + case 3: //系统消息
  95 + break;
  96 + }
  97 + })
  98 + .height('154lpx')
  99 + .width("100%")
  100 + })
  101 + }
  102 + }
  103 + .backgroundColor($r('app.color.white'))
  104 + .height('100%')
  105 + .width('100%')
  106 + }
  107 +}
@@ -23,6 +23,7 @@ import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperati @@ -23,6 +23,7 @@ import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperati
23 import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperationRequestItem'; 23 import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperationRequestItem';
24 import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem'; 24 import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem';
25 import { SpConstants } from 'wdConstant/Index'; 25 import { SpConstants } from 'wdConstant/Index';
  26 +import { MessageItem } from '../viewmodel/MessageItem';
26 27
27 const TAG = "MinePageDatasModel" 28 const TAG = "MinePageDatasModel"
28 29
@@ -34,6 +35,7 @@ class MinePageDatasModel{ @@ -34,6 +35,7 @@ class MinePageDatasModel{
34 personalData:MinePagePersonalFunctionsItem[] = [] 35 personalData:MinePagePersonalFunctionsItem[] = []
35 creatorData:MinePageCreatorFunctionsItem[] = [] 36 creatorData:MinePageCreatorFunctionsItem[] = []
36 moreData:MinePageMoreFunctionModel[] = [] 37 moreData:MinePageMoreFunctionModel[] = []
  38 + messageData:MessageItem[] = []
37 39
38 private constructor() { } 40 private constructor() { }
39 41
@@ -63,7 +65,7 @@ class MinePageDatasModel{ @@ -63,7 +65,7 @@ class MinePageDatasModel{
63 this.personalData.push(new MinePagePersonalFunctionsItem("关注",$r('app.media.mine_follow_icon'))) 65 this.personalData.push(new MinePagePersonalFunctionsItem("关注",$r('app.media.mine_follow_icon')))
64 this.personalData.push(new MinePagePersonalFunctionsItem("收藏",$r('app.media.mine_collect_icon'))) 66 this.personalData.push(new MinePagePersonalFunctionsItem("收藏",$r('app.media.mine_collect_icon')))
65 // this.personalData.push(new MinePagePersonalFunctionsItem("历史",$r('app.media.mine_history_icon'))) 67 // this.personalData.push(new MinePagePersonalFunctionsItem("历史",$r('app.media.mine_history_icon')))
66 - // this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon'))) 68 + this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon')))
67 // this.personalData.push(new MinePagePersonalFunctionsItem("留言板",$r('app.media.mine_msgboard_icon'))) 69 // this.personalData.push(new MinePagePersonalFunctionsItem("留言板",$r('app.media.mine_msgboard_icon')))
68 // this.personalData.push(new MinePagePersonalFunctionsItem("预约",$r('app.media.mine_order_icon'))) 70 // this.personalData.push(new MinePagePersonalFunctionsItem("预约",$r('app.media.mine_order_icon')))
69 return this.personalData 71 return this.personalData
@@ -102,6 +104,21 @@ class MinePageDatasModel{ @@ -102,6 +104,21 @@ class MinePageDatasModel{
102 } 104 }
103 105
104 /** 106 /**
  107 + * 消息 5 个数据
  108 + * 包含名字和图标
  109 + */
  110 + getMessageData():MessageItem[]{
  111 + if(this.messageData.length === 4){
  112 + return this.messageData
  113 + }
  114 + this.messageData.push(new MessageItem($r('app.media.msg_interact'),"互动消息","",""))
  115 + this.messageData.push(new MessageItem($r('app.media.msg_reserve'),"预约消息","",""))
  116 + this.messageData.push(new MessageItem($r('app.media.msg_history'),"历史推送","",""))
  117 + this.messageData.push(new MessageItem($r('app.media.msg_system'),"系统消息","",""))
  118 + return this.messageData
  119 + }
  120 +
  121 + /**
105 * 预约 122 * 预约
106 * @param pageSize 123 * @param pageSize
107 * @param pageNum 124 * @param pageNum
  1 +import { MessageListUI } from '../components/mine/message/MessageListUI';
  2 +
  3 +@Entry
  4 +@Component
  5 +struct MineMessagePage {
  6 +
  7 + build() {
  8 + Column(){
  9 + MessageListUI()
  10 + }
  11 + }
  12 +}
  1 +export class MessageItem{
  2 + imgSrc:Resource = $r("app.media.xxhdpi_pic_wb")
  3 + title:string = ""
  4 + desc:string = ""
  5 + time:string = ""
  6 +
  7 + constructor(imgSrc:Resource,title:string,desc:string,time:string){
  8 + this.imgSrc = imgSrc
  9 + this.title = title
  10 + this.desc = desc
  11 + this.time = time
  12 + }
  13 +
  14 +
  15 +}
@@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
22 "components/page/ReserveMorePage", 22 "components/page/ReserveMorePage",
23 "pages/VideoPlayPage", 23 "pages/VideoPlayPage",
24 "components/page/ThemeListPage", 24 "components/page/ThemeListPage",
25 - "pages/ShowUserHeaderPage" 25 + "pages/ShowUserHeaderPage",
  26 + "pages/MineMessagePage"
26 ] 27 ]
27 } 28 }