Showing
19 changed files
with
450 additions
and
82 deletions
| @@ -135,6 +135,14 @@ export class HttpUrlUtils { | @@ -135,6 +135,14 @@ export class HttpUrlUtils { | ||
| 135 | */ | 135 | */ |
| 136 | static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord"; | 136 | static readonly APPOINTMENT_ExecuteCollcet_PATH: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord"; |
| 137 | /** | 137 | /** |
| 138 | + * 个人中心 - 消息 | ||
| 139 | + */ | ||
| 140 | + static readonly APPOINTMENT_MessageList_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private"; | ||
| 141 | + /** | ||
| 142 | + * 个人中心 - 消息 点赞数 | ||
| 143 | + */ | ||
| 144 | + static readonly APPOINTMENT_getMessageLikeCount_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/getLikeCount"; | ||
| 145 | + /** | ||
| 138 | * 个人中心 我的评论列表 | 146 | * 个人中心 我的评论列表 |
| 139 | */ | 147 | */ |
| 140 | static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList"; | 148 | static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList"; |
| @@ -316,6 +324,10 @@ export class HttpUrlUtils { | @@ -316,6 +324,10 @@ export class HttpUrlUtils { | ||
| 316 | */ | 324 | */ |
| 317 | static readonly FEEDBACK_TYPE_PATH: string = "/api/rmrb-interact/interact/c/user/optionClassify/list"; | 325 | static readonly FEEDBACK_TYPE_PATH: string = "/api/rmrb-interact/interact/c/user/optionClassify/list"; |
| 318 | 326 | ||
| 327 | + /** | ||
| 328 | + * 查询点赞、回复我的、系统消息的未读数量以及回复/评论人 | ||
| 329 | + */ | ||
| 330 | + static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime="; | ||
| 319 | 331 | ||
| 320 | static getHost(): string { | 332 | static getHost(): string { |
| 321 | return HostManager.getHost(); | 333 | return HostManager.getHost(); |
| @@ -478,6 +490,16 @@ export class HttpUrlUtils { | @@ -478,6 +490,16 @@ export class HttpUrlUtils { | ||
| 478 | return url | 490 | return url |
| 479 | } | 491 | } |
| 480 | 492 | ||
| 493 | + static getMessageListDataUrl() { | ||
| 494 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_MessageList_PATH | ||
| 495 | + return url | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + static getMessageLikeCount() { | ||
| 499 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_getMessageLikeCount_PATH | ||
| 500 | + return url | ||
| 501 | + } | ||
| 502 | + | ||
| 481 | static getExecuteCollcetUrl() { | 503 | static getExecuteCollcetUrl() { |
| 482 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH | 504 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.APPOINTMENT_ExecuteCollcet_PATH |
| 483 | return url | 505 | return url |
| @@ -714,4 +736,10 @@ export class HttpUrlUtils { | @@ -714,4 +736,10 @@ export class HttpUrlUtils { | ||
| 714 | return url; | 736 | return url; |
| 715 | } | 737 | } |
| 716 | 738 | ||
| 739 | + //获取消息未读接口 | ||
| 740 | + static getMessageUnReadDataUrl() { | ||
| 741 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MESSAGE_UN_READ_DATA_PATH | ||
| 742 | + return url | ||
| 743 | + } | ||
| 744 | + | ||
| 717 | } | 745 | } |
| 1 | +import { ContentDTO } from 'wdBean/Index'; | ||
| 2 | +import { ProcessUtils } from 'wdRouter/Index'; | ||
| 3 | +import { InteractMessageModel } from '../../model/InteractMessageModel' | ||
| 1 | 4 | ||
| 2 | @Component | 5 | @Component |
| 3 | export struct InteractMComponent { | 6 | export struct InteractMComponent { |
| 7 | + messageModel:InteractMessageModel = new InteractMessageModel; | ||
| 8 | +///"remark": "{"beReply":"乐事薯片,大家的最爱!!", | ||
| 9 | + // "headUrl":"https: //uatjdcdnphoto.aikan.pdnews.cn//zhbj/img/user/2023122211/2A59F725E69849A38CEE8823B0D9D141.jpg", | ||
| 10 | + // "contentId":"30035774121","contentRelObjectid":"2012","contentTitle":"乐事推出华夏风光限定罐七款城市地标包装让出游“有滋有味”", | ||
| 11 | + // "commentContent":"大家都爱吃!!","userName":"人民日报网友a8dKCV","userId":"504964178466309","contentRelId":"500002866426", | ||
| 12 | + // "shareUrl":"https: //pd-people-uat.pdnews.cn/column/30035774121-500002866426","userType":"1", | ||
| 13 | + // "contentRelType":"1","visitor":"0","contentType":"8"}", | ||
| 14 | + | ||
| 4 | build() { | 15 | build() { |
| 5 | Row(){ | 16 | Row(){ |
| 6 | - Image('') | ||
| 7 | - .backgroundColor(Color.Red) | 17 | + Image(this.messageModel.InteractMsubM.headUrl) |
| 8 | .width(36) | 18 | .width(36) |
| 9 | .height(36) | 19 | .height(36) |
| 10 | .borderRadius(18) | 20 | .borderRadius(18) |
| 11 | 21 | ||
| 12 | Column(){ | 22 | Column(){ |
| 13 | Row(){ | 23 | Row(){ |
| 14 | - Text('用户名') | 24 | + Text(this.messageModel.InteractMsubM.userName) |
| 15 | .fontSize('14fp').fontColor('#222222') | 25 | .fontSize('14fp').fontColor('#222222') |
| 16 | 26 | ||
| 17 | - Text('回复了你的评论') | 27 | + Text(this.buildContentString()) |
| 18 | .fontSize('14fp').fontColor('#999999') | 28 | .fontSize('14fp').fontColor('#999999') |
| 19 | .margin({left:5}) | 29 | .margin({left:5}) |
| 20 | }.width('100%') | 30 | }.width('100%') |
| 21 | 31 | ||
| 22 | - Text('两天前') | 32 | + Text(this.messageModel.time) |
| 23 | .margin({top:2}) | 33 | .margin({top:2}) |
| 24 | - .fontSize('12fp').fontColor('#B0B0B0') | 34 | + .fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10}) |
| 25 | 35 | ||
| 26 | - Text('评论内容') | ||
| 27 | - .margin({top:8,bottom:10}) | 36 | + if (this.messageModel.contentType === '208' || this.messageModel.contentType === '209'){ |
| 37 | + Text(this.messageModel.message) | ||
| 38 | + .margin({bottom:10}) | ||
| 28 | .fontSize('16fp').fontColor('#222222') | 39 | .fontSize('16fp').fontColor('#222222') |
| 29 | .width('100%') | 40 | .width('100%') |
| 30 | .constraintSize({maxHeight:500}) | 41 | .constraintSize({maxHeight:500}) |
| 42 | + } | ||
| 31 | 43 | ||
| 32 | Column(){ | 44 | Column(){ |
| 33 | - Text('[你的评论]乐事薯片,大家的最爱').fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500}) | ||
| 34 | - .margin({top:5,bottom:5}) | 45 | + if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){ |
| 46 | + Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500}) | ||
| 47 | + .margin({top:15,bottom:10}) | ||
| 35 | .width('100%') | 48 | .width('100%') |
| 36 | 49 | ||
| 37 | Divider() | 50 | Divider() |
| 38 | - .color('#f5f5f5') | ||
| 39 | - .backgroundColor('#f5f5f5') | 51 | + .color('#EDEDED') |
| 52 | + .backgroundColor('#EDEDED') | ||
| 40 | .width('100%') | 53 | .width('100%') |
| 41 | .height(1) | 54 | .height(1) |
| 42 | - | 55 | + } |
| 43 | Row(){ | 56 | Row(){ |
| 44 | - Text('乐事薯片,大家的最爱!!!!').fontSize('12fp').fontColor('#666666').constraintSize({maxHeight:500}) | 57 | + Image($r('app.media.MessageOriginTextIcon')) |
| 58 | + .width('12') | ||
| 59 | + .height('12') | ||
| 60 | + Text(this.messageModel.InteractMsubM.contentTitle) | ||
| 61 | + .fontSize('12fp') | ||
| 62 | + .fontColor('#666666') | ||
| 63 | + .maxLines(1) | ||
| 64 | + .width('90%') | ||
| 65 | + .textOverflow({overflow:TextOverflow.Ellipsis}) | ||
| 45 | 66 | ||
| 46 | Blank() | 67 | Blank() |
| 47 | 68 | ||
| 48 | Image($r('app.media.mine_user_edit')) | 69 | Image($r('app.media.mine_user_edit')) |
| 49 | .width('12') | 70 | .width('12') |
| 50 | .height('12') | 71 | .height('12') |
| 51 | - }.margin({top:5,bottom:5}).width('100%') | ||
| 52 | - }.alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5) | ||
| 53 | - }.padding({left:5}).alignItems(HorizontalAlign.Start) | ||
| 54 | - }.padding({top:5,left:16,right:16}).width('100%').height(160).alignItems(VerticalAlign.Top).backgroundColor(Color.Red) | 72 | + }.margin({top:10,bottom:15}) |
| 73 | + }.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5) | ||
| 74 | + .onClick(()=>{ | ||
| 75 | + let contentDTO :ContentDTO = new ContentDTO(); | ||
| 76 | + contentDTO.objectType = this.messageModel.InteractMsubM.contentType | ||
| 77 | + contentDTO.objectId = this.messageModel.InteractMsubM.contentId | ||
| 78 | + ProcessUtils.processPage(contentDTO) | ||
| 79 | + }) | ||
| 80 | + }.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%') | ||
| 81 | + }.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top) | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + buildContentString(): string { | ||
| 85 | + let contentString: string = '' | ||
| 86 | + if (this.messageModel.contentType === '206') { | ||
| 87 | + contentString = '赞了你的作品' | ||
| 88 | + }else if(this.messageModel.contentType === '207'){ | ||
| 89 | + contentString = '赞了你的评论' | ||
| 90 | + }else if(this.messageModel.contentType === '208'){ | ||
| 91 | + contentString = '评论了你的作品' | ||
| 92 | + }else if(this.messageModel.contentType === '209'){ | ||
| 93 | + contentString = '回复了你的评论' | ||
| 94 | + }else if(this.messageModel.contentType === '210'){ | ||
| 95 | + contentString = '转发了您的作品' | ||
| 96 | + }else if(this.messageModel.contentType === '211'){ | ||
| 97 | + contentString = '关注了你' | ||
| 98 | + } | ||
| 99 | + return contentString; | ||
| 100 | + } | ||
| 101 | + buildCommentContent(): string { | ||
| 102 | + let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply; | ||
| 103 | + return contentString; | ||
| 55 | } | 104 | } |
| 56 | } | 105 | } |
| @@ -102,6 +102,9 @@ struct createImg { | @@ -102,6 +102,9 @@ struct createImg { | ||
| 102 | CardMediaInfo({ contentDTO: this.contentDTO }) | 102 | CardMediaInfo({ contentDTO: this.contentDTO }) |
| 103 | } | 103 | } |
| 104 | .align(Alignment.BottomEnd) | 104 | .align(Alignment.BottomEnd) |
| 105 | + .onClick((event: ClickEvent) => { | ||
| 106 | + ProcessUtils.gotoVod(this.contentDTO) | ||
| 107 | + }) | ||
| 105 | } | 108 | } |
| 106 | } | 109 | } |
| 107 | } | 110 | } |
| 1 | import { WDRouterRule, WDRouterPage } from 'wdRouter' | 1 | import { WDRouterRule, WDRouterPage } from 'wdRouter' |
| 2 | import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem' | 2 | import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem' |
| 3 | +import { PagePersonFunction } from './PagePersonFunction' | ||
| 3 | 4 | ||
| 4 | @Component | 5 | @Component |
| 5 | export default struct MinePagePersonFunctionUI { | 6 | export default struct MinePagePersonFunctionUI { |
| @@ -10,30 +11,7 @@ export default struct MinePagePersonFunctionUI { | @@ -10,30 +11,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 10 | Grid(){ | 11 | Grid(){ |
| 11 | ForEach(this.personalData,(item:MinePagePersonalFunctionsItem,index:number)=>{ | 12 | ForEach(this.personalData,(item:MinePagePersonalFunctionsItem,index:number)=>{ |
| 12 | GridItem(){ | 13 | GridItem(){ |
| 13 | - Row(){ | ||
| 14 | - Column(){ | ||
| 15 | - Image(item.imgSrc) | ||
| 16 | - .width('46lpx') | ||
| 17 | - .height('46lpx') | ||
| 18 | - .objectFit(ImageFit.Auto) | ||
| 19 | - .interpolation(ImageInterpolation.High) | ||
| 20 | - Text(`${item.msg}`) | ||
| 21 | - .margin({top:'8lpx'}) | ||
| 22 | - .height('23lpx') | ||
| 23 | - .fontColor($r('app.color.color_222222')) | ||
| 24 | - .fontSize('23lpx') | ||
| 25 | - } | ||
| 26 | - .alignItems(HorizontalAlign.Center) | ||
| 27 | - .width('100%') | ||
| 28 | - Blank() | ||
| 29 | - .layoutWeight(1) | ||
| 30 | - if(index % 4 < 3 && index != this.personalData.length-1){ | ||
| 31 | - Text().backgroundColor($r('app.color.color_222222')) | ||
| 32 | - .opacity(0.1) | ||
| 33 | - .width('2lpx') | ||
| 34 | - .height('29lpx') | ||
| 35 | - } | ||
| 36 | - } | 14 | + PagePersonFunction({ item: item, noDivider : (index % 4 < 3 && index != this.personalData.length-1) ? false : true}) |
| 37 | }.onClick(()=>{ | 15 | }.onClick(()=>{ |
| 38 | console.log(index+"") | 16 | console.log(index+"") |
| 39 | switch (item.msg){ | 17 | switch (item.msg){ |
| @@ -98,3 +76,4 @@ export default struct MinePagePersonFunctionUI { | @@ -98,3 +76,4 @@ export default struct MinePagePersonFunctionUI { | ||
| 98 | .margin({top:'31lpx',left:'23lpx',right:'23lpx' }) | 76 | .margin({top:'31lpx',left:'23lpx',right:'23lpx' }) |
| 99 | } | 77 | } |
| 100 | } | 78 | } |
| 79 | + |
| 1 | +import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem' | ||
| 2 | + | ||
| 3 | +@Component | ||
| 4 | +export struct PagePersonFunction{ | ||
| 5 | + @ObjectLink item: MinePagePersonalFunctionsItem | ||
| 6 | + @State noDivider:boolean = false | ||
| 7 | + | ||
| 8 | + build() { | ||
| 9 | + Row(){ | ||
| 10 | + Column(){ | ||
| 11 | + Stack({ alignContent: Alignment.TopEnd }){ | ||
| 12 | + Image(this.item.imgSrc) | ||
| 13 | + .objectFit(ImageFit.Auto) | ||
| 14 | + .interpolation(ImageInterpolation.High) | ||
| 15 | + if (this.item.isShowRedPoint) { | ||
| 16 | + Button() | ||
| 17 | + .type(ButtonType.Circle) | ||
| 18 | + .width("12lpx") | ||
| 19 | + .height("12lpx") | ||
| 20 | + .backgroundColor($r('app.color.color_ED2800')) | ||
| 21 | + } | ||
| 22 | + }.width('46lpx') | ||
| 23 | + .height('46lpx') | ||
| 24 | + | ||
| 25 | + Text(`${this.item.msg}`) | ||
| 26 | + .margin({top:'8lpx'}) | ||
| 27 | + .height('23lpx') | ||
| 28 | + .fontColor($r('app.color.color_222222')) | ||
| 29 | + .fontSize('23lpx') | ||
| 30 | + } | ||
| 31 | + .alignItems(HorizontalAlign.Center) | ||
| 32 | + .width('100%') | ||
| 33 | + Blank() | ||
| 34 | + .layoutWeight(1) | ||
| 35 | + if(!this.noDivider){ | ||
| 36 | + Text().backgroundColor($r('app.color.color_222222')) | ||
| 37 | + .opacity(0.1) | ||
| 38 | + .width('2lpx') | ||
| 39 | + .height('29lpx') | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | +} |
| 1 | import { StringUtils, ToastUtils } from 'wdKit/Index' | 1 | import { StringUtils, ToastUtils } from 'wdKit/Index' |
| 2 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel' | 3 | import MinePageDatasModel from '../../../model/MinePageDatasModel' |
| 3 | import { MessageItem } from '../../../viewmodel/MessageItem' | 4 | import { MessageItem } from '../../../viewmodel/MessageItem' |
| 4 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' | 5 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' |
| @@ -86,6 +87,7 @@ export struct MessageListUI { | @@ -86,6 +87,7 @@ export struct MessageListUI { | ||
| 86 | ToastUtils.shortToast(index+"") | 87 | ToastUtils.shortToast(index+"") |
| 87 | switch (index) { | 88 | switch (index) { |
| 88 | case 0: //互动消息 | 89 | case 0: //互动消息 |
| 90 | + WDRouterRule.jumpWithPage(WDRouterPage.interactMessagePage) | ||
| 89 | break; | 91 | break; |
| 90 | case 1: //预约消息 | 92 | case 1: //预约消息 |
| 91 | break; | 93 | break; |
| 1 | 1 | ||
| 2 | -import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel'; | 2 | +import InteractMessageViewModel from '../../viewmodel/InteractMessageViewModel'; |
| 3 | import PageModel from '../../viewmodel/PageModel'; | 3 | import PageModel from '../../viewmodel/PageModel'; |
| 4 | import { CommonConstants, ViewType } from 'wdConstant' | 4 | import { CommonConstants, ViewType } from 'wdConstant' |
| 5 | import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' | 5 | import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' |
| 6 | import { ContentDTO } from 'wdBean' | 6 | import { ContentDTO } from 'wdBean' |
| 7 | import NoMoreLayout from './NoMoreLayout' | 7 | import NoMoreLayout from './NoMoreLayout' |
| 8 | -import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | ||
| 9 | -import { CustomSelectUI } from '../view/CustomSelectUI'; | ||
| 10 | -import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | ||
| 11 | -import { BigPicCardComponent } from '../view/BigPicCardComponent'; | ||
| 12 | - | ||
| 13 | import { CustomTitleUI } from '../reusable/CustomTitleUI'; | 8 | import { CustomTitleUI } from '../reusable/CustomTitleUI'; |
| 14 | -import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 15 | import { InteractMComponent } from '../InteractMessage/InteractMComponent'; | 9 | import { InteractMComponent } from '../InteractMessage/InteractMComponent'; |
| 10 | +import { InteractMessageModel, WDMessageCenterMessageType } from '../../model/InteractMessageModel'; | ||
| 11 | +import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 16 | 12 | ||
| 17 | @Entry | 13 | @Entry |
| 18 | @Component | 14 | @Component |
| @@ -20,39 +16,40 @@ struct InteractMessagePage { | @@ -20,39 +16,40 @@ struct InteractMessagePage { | ||
| 20 | @State private browSingModel: PageModel = new PageModel() | 16 | @State private browSingModel: PageModel = new PageModel() |
| 21 | isloading : boolean = false | 17 | isloading : boolean = false |
| 22 | @Provide isEditState:boolean = false | 18 | @Provide isEditState:boolean = false |
| 23 | - @State allDatas :ContentDTO[] = []; | 19 | + @State allDatas :InteractMessageModel[] = []; |
| 24 | private scroller: Scroller = new Scroller(); | 20 | private scroller: Scroller = new Scroller(); |
| 25 | - @State likeNum: number = 20 | 21 | + @State likeNum: number = 0 |
| 22 | + @State currentPage: number = 1; | ||
| 26 | 23 | ||
| 27 | aboutToAppear(){ | 24 | aboutToAppear(){ |
| 28 | this.getData() | 25 | this.getData() |
| 26 | + this.getMessageLikeCount() | ||
| 29 | } | 27 | } |
| 30 | 28 | ||
| 31 | build() { | 29 | build() { |
| 32 | Column(){ | 30 | Column(){ |
| 33 | CustomTitleUI({titleName:'互动消息'}) | 31 | CustomTitleUI({titleName:'互动消息'}) |
| 32 | + if(this.browSingModel.viewType == ViewType.ERROR){ | ||
| 33 | + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed}) | ||
| 34 | + }else if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 35 | + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory}) | ||
| 36 | + }else { | ||
| 37 | + CustomPullToRefresh({ | ||
| 38 | + alldata:this.allDatas, | ||
| 39 | + scroller:this.scroller, | ||
| 40 | + customList:()=>{ | ||
| 34 | this.ListLayout() | 41 | this.ListLayout() |
| 35 | - // if(this.browSingModel.viewType == ViewType.ERROR){ | ||
| 36 | - // EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed}) | ||
| 37 | - // }else if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 38 | - // EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory}) | ||
| 39 | - // }else { | ||
| 40 | - // CustomPullToRefresh({ | ||
| 41 | - // alldata:this.allDatas, | ||
| 42 | - // scroller:this.scroller, | ||
| 43 | - // customList:()=>{ | ||
| 44 | - // this.ListLayout() | ||
| 45 | - // }, | ||
| 46 | - // onRefresh:(resolve)=>{ | ||
| 47 | - // this.browSingModel.currentPage = 0 | ||
| 48 | - // this.getData(resolve) | ||
| 49 | - // }, | ||
| 50 | - // onLoadMore:(resolve)=> { | ||
| 51 | - // this.browSingModel.currentPage++ | ||
| 52 | - // this.getData() | ||
| 53 | - // } | ||
| 54 | - // }) | ||
| 55 | - // } | 42 | + }, |
| 43 | + onRefresh:(resolve)=>{ | ||
| 44 | + this.browSingModel.currentPage = 0 | ||
| 45 | + this.getData(resolve) | ||
| 46 | + }, | ||
| 47 | + onLoadMore:(resolve)=> { | ||
| 48 | + this.browSingModel.currentPage++ | ||
| 49 | + this.getData() | ||
| 50 | + } | ||
| 51 | + }) | ||
| 52 | + } | ||
| 56 | 53 | ||
| 57 | } | 54 | } |
| 58 | .width(CommonConstants.FULL_WIDTH) | 55 | .width(CommonConstants.FULL_WIDTH) |
| @@ -66,9 +63,9 @@ struct InteractMessagePage { | @@ -66,9 +63,9 @@ struct InteractMessagePage { | ||
| 66 | } | 63 | } |
| 67 | 64 | ||
| 68 | // 下拉刷新 | 65 | // 下拉刷新 |
| 69 | - ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { | 66 | + ForEach(this.allDatas, (InteractM: InteractMessageModel, compIndex: number) => { |
| 70 | ListItem() { | 67 | ListItem() { |
| 71 | - InteractMComponent() | 68 | + InteractMComponent({messageModel:InteractM}) |
| 72 | } | 69 | } |
| 73 | }) | 70 | }) |
| 74 | // 加载更多 | 71 | // 加载更多 |
| @@ -112,12 +109,22 @@ struct InteractMessagePage { | @@ -112,12 +109,22 @@ struct InteractMessagePage { | ||
| 112 | } | 109 | } |
| 113 | 110 | ||
| 114 | async getData(resolve?: (value: string | PromiseLike<string>) => void){ | 111 | async getData(resolve?: (value: string | PromiseLike<string>) => void){ |
| 115 | - MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => { | 112 | + InteractMessageViewModel.fetchMessageList(WDMessageCenterMessageType.WDMessageCenterMessageType_Interact,this.currentPage).then(InteractMessageMItem => { |
| 116 | if(resolve) resolve('刷新成功') | 113 | if(resolve) resolve('刷新成功') |
| 117 | - if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | 114 | + if (InteractMessageMItem && InteractMessageMItem.list && InteractMessageMItem.list.length > 0) { |
| 118 | this.browSingModel.viewType = ViewType.LOADED; | 115 | this.browSingModel.viewType = ViewType.LOADED; |
| 119 | - this.allDatas.push(...collectionItem.list) | ||
| 120 | - if (collectionItem.list.length === this.browSingModel.pageSize) { | 116 | + |
| 117 | + if (this.currentPage === 1) { | ||
| 118 | + this.allDatas = [] | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + for (let index = 0; index < InteractMessageMItem.list.length; index++) { | ||
| 122 | + const element = InteractMessageMItem.list[index]; | ||
| 123 | + element.InteractMsubM = JSON.parse(element.remark) | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + this.allDatas.push(...InteractMessageMItem.list) | ||
| 127 | + if (InteractMessageMItem.list.length === this.browSingModel.pageSize) { | ||
| 121 | this.browSingModel.currentPage++; | 128 | this.browSingModel.currentPage++; |
| 122 | this.browSingModel.hasMore = true; | 129 | this.browSingModel.hasMore = true; |
| 123 | } else { | 130 | } else { |
| @@ -129,4 +136,11 @@ struct InteractMessagePage { | @@ -129,4 +136,11 @@ struct InteractMessagePage { | ||
| 129 | }) | 136 | }) |
| 130 | } | 137 | } |
| 131 | 138 | ||
| 139 | + async getMessageLikeCount(){ | ||
| 140 | + InteractMessageViewModel.getMessageLikeCount().then(num => { | ||
| 141 | + this.likeNum = num | ||
| 142 | + }) | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + | ||
| 132 | } | 146 | } |
| @@ -53,8 +53,25 @@ export struct MinePageComponent { | @@ -53,8 +53,25 @@ export struct MinePageComponent { | ||
| 53 | this.getUserLogin() | 53 | this.getUserLogin() |
| 54 | this.getFunctionData() | 54 | this.getFunctionData() |
| 55 | this.addLoginStatusObserver() | 55 | this.addLoginStatusObserver() |
| 56 | + this.getMessageData() | ||
| 56 | } | 57 | } |
| 57 | 58 | ||
| 59 | + getMessageData(){ | ||
| 60 | + MinePageDatasModel.getMessageUnReadData().then((value) => { | ||
| 61 | + if(value !=null) { | ||
| 62 | + if(value.activeCount >0 ||value.subscribeCount > 0 || value.systemCount > 0){ | ||
| 63 | + this.personalData.forEach((value) => { | ||
| 64 | + if(value.msg == "消息") | ||
| 65 | + value.isShowRedPoint = true | ||
| 66 | + }) | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + }).catch((err: Error) => { | ||
| 70 | + console.log(TAG, JSON.stringify(err)) | ||
| 71 | + }) | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + | ||
| 58 | async addLoginStatusObserver(){ | 75 | async addLoginStatusObserver(){ |
| 59 | this.preferences = await SPHelper.default.getPreferences(); | 76 | this.preferences = await SPHelper.default.getPreferences(); |
| 60 | this.preferences.on('change', this.observer); | 77 | this.preferences.on('change', this.observer); |
| @@ -131,10 +131,8 @@ export struct SearchResultComponent { | @@ -131,10 +131,8 @@ export struct SearchResultComponent { | ||
| 131 | .barWidth('100%') | 131 | .barWidth('100%') |
| 132 | .barHeight('84lpx') | 132 | .barHeight('84lpx') |
| 133 | .animationDuration(0) | 133 | .animationDuration(0) |
| 134 | - .onChange((index: number) => { | ||
| 135 | - this.currentIndex = index | ||
| 136 | - }) | ||
| 137 | .width('100%') | 134 | .width('100%') |
| 135 | + .scrollable(false) | ||
| 138 | .layoutWeight(1) | 136 | .layoutWeight(1) |
| 139 | } | 137 | } |
| 140 | }.width('100%') | 138 | }.width('100%') |
| 1 | + | ||
| 2 | +/** | ||
| 3 | + * WDMessageCenterMessageType 拉取消息类型 | ||
| 4 | + */ | ||
| 5 | +export const enum WDMessageCenterMessageType { | ||
| 6 | + WDMessageCenterMessageType_Interact = 1, //互动通知 | ||
| 7 | + WDMessageCenterMessageType_Subscribe, //预约消息 | ||
| 8 | + WDMessageCenterMessageType_System, //系统消息 | ||
| 9 | +} | ||
| 10 | + | ||
| 11 | + | ||
| 12 | +export interface InteractMessageListModel{ | ||
| 13 | + data: InteractMessageMItem | ||
| 14 | + code: number | ||
| 15 | + message: string | ||
| 16 | + success: string | ||
| 17 | + timestamp: number | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | + | ||
| 21 | +export class InteractMessageMItem{ | ||
| 22 | + pageNum:number = 0 | ||
| 23 | + pageSize:number = 0 | ||
| 24 | + totalCount:number = 0 | ||
| 25 | + hasNext:number = 0 | ||
| 26 | + list:InteractMessageModel[] = [] | ||
| 27 | + | ||
| 28 | + constructor(list?:InteractMessageModel[],pageNum?: number,pageSize?: number,totalCount?: number,hasNext?:number) { | ||
| 29 | + } | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +export class InteractMessageModel { | ||
| 33 | + classify: string = ''; | ||
| 34 | + contentId: string = ''; | ||
| 35 | + contentType: string = ''; | ||
| 36 | + id: number = 0; | ||
| 37 | + message: string = ''; | ||
| 38 | + platform: string = ''; | ||
| 39 | + privateMailId: number = 0; | ||
| 40 | + privateMailIdList: number[] = []; | ||
| 41 | + privateMailIds: string = ''; | ||
| 42 | + privateMailNum: number = 0; | ||
| 43 | + read: boolean = true; | ||
| 44 | + source: string = ''; | ||
| 45 | + time: string = ''; | ||
| 46 | + title: string = ''; | ||
| 47 | + userId: string = ''; | ||
| 48 | + remark: string = ''; | ||
| 49 | + InteractMsubM:InteractMsubModel = new InteractMsubModel; | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +export class InteractMsubModel { | ||
| 53 | + beReply: string = ''; | ||
| 54 | + headUrl: string = ''; | ||
| 55 | + contentId: string = ''; | ||
| 56 | + contentRelObjectid: string = ''; | ||
| 57 | + contentTitle: string = ''; | ||
| 58 | + commentContent: string = ''; | ||
| 59 | + userName: string = ''; | ||
| 60 | + userId: string = ''; | ||
| 61 | + contentRelId: string = ''; | ||
| 62 | + shareUrl: string = ''; | ||
| 63 | + userType: string = ''; | ||
| 64 | + contentRelType: string = ''; | ||
| 65 | + visitor: string = ''; | ||
| 66 | + contentType: string = ''; | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +export interface InteractMParams { | ||
| 70 | + contentType?: string; | ||
| 71 | + pageNum?: string; | ||
| 72 | + pageSize?: string; | ||
| 73 | + userId?: string; | ||
| 74 | + createTime?: string; | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | +export interface InteractMDTO{ | ||
| 78 | + success: boolean; | ||
| 79 | + code: number; | ||
| 80 | + message: string; | ||
| 81 | + data: number; | ||
| 82 | + timestamp?: number; | ||
| 83 | +} |
| @@ -24,6 +24,7 @@ import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperati | @@ -24,6 +24,7 @@ import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperati | ||
| 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 | import { MessageItem } from '../viewmodel/MessageItem'; |
| 27 | +import { MessageUnReadItem } from '../viewmodel/MessageUnReadItem'; | ||
| 27 | 28 | ||
| 28 | const TAG = "MinePageDatasModel" | 29 | const TAG = "MinePageDatasModel" |
| 29 | 30 | ||
| @@ -597,6 +598,33 @@ class MinePageDatasModel{ | @@ -597,6 +598,33 @@ class MinePageDatasModel{ | ||
| 597 | }) | 598 | }) |
| 598 | }) | 599 | }) |
| 599 | } | 600 | } |
| 601 | + | ||
| 602 | + /** | ||
| 603 | + * 获取消息未读数据 | ||
| 604 | + * @param pageSize | ||
| 605 | + * @param pageNum | ||
| 606 | + * @returns | ||
| 607 | + */ | ||
| 608 | + getMessageUnReadData(): Promise<MessageUnReadItem> { | ||
| 609 | + return new Promise<MessageUnReadItem>((success, error) => { | ||
| 610 | + this.fetchMessageUnReadData().then((navResDTO: ResponseDTO<MessageUnReadItem>) => { | ||
| 611 | + if (!navResDTO || navResDTO.code != 0) { | ||
| 612 | + error(null) | ||
| 613 | + return | ||
| 614 | + } | ||
| 615 | + let navigationBean = navResDTO.data as MessageUnReadItem | ||
| 616 | + success(navigationBean); | ||
| 617 | + }).catch((err: Error) => { | ||
| 618 | + error(null) | ||
| 619 | + }) | ||
| 620 | + }) | ||
| 621 | + } | ||
| 622 | + | ||
| 623 | + fetchMessageUnReadData() { | ||
| 624 | + let url = HttpUrlUtils.getMessageUnReadDataUrl() | ||
| 625 | + return WDHttp.get<ResponseDTO<MessageUnReadItem>>(url) | ||
| 626 | + }; | ||
| 627 | + | ||
| 600 | } | 628 | } |
| 601 | 629 | ||
| 602 | const minePageDatasModel = MinePageDatasModel.getInstance() | 630 | const minePageDatasModel = MinePageDatasModel.getInstance() |
| @@ -43,7 +43,6 @@ export interface MyCollectionListModel{ | @@ -43,7 +43,6 @@ export interface MyCollectionListModel{ | ||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | - | ||
| 47 | export interface contentListItemParams{ | 46 | export interface contentListItemParams{ |
| 48 | contentId?:string; | 47 | contentId?:string; |
| 49 | contentType?:string; | 48 | contentType?:string; |
| 1 | +// import { collcetRecordParams, MyCollectionItem, MyCollectionListModel } from '../model/MyCollectionModel'; | ||
| 2 | +import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | ||
| 3 | +import { Logger } from 'wdKit'; | ||
| 4 | +import promptAction from '@ohos.promptAction'; | ||
| 5 | +import { | ||
| 6 | + InteractMDTO, | ||
| 7 | + InteractMessageListModel, InteractMessageMItem, InteractMParams } from '../model/InteractMessageModel'; | ||
| 8 | + | ||
| 9 | +const TAG = "MyCollectionViewModel" | ||
| 10 | + | ||
| 11 | +class InteractMessageViewModel { | ||
| 12 | + private static instance:InteractMessageViewModel | ||
| 13 | + /** | ||
| 14 | + * 单例模式 | ||
| 15 | + * @returns | ||
| 16 | + */ | ||
| 17 | + public static getInstance(): InteractMessageViewModel { | ||
| 18 | + if (!InteractMessageViewModel.instance) { | ||
| 19 | + InteractMessageViewModel.instance = new InteractMessageViewModel(); | ||
| 20 | + } | ||
| 21 | + return InteractMessageViewModel.instance; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + // ///互动通知 | ||
| 25 | + // WDMessageCenterMessageType_Interact = 1, | ||
| 26 | + // | ||
| 27 | + // ///预约消息 | ||
| 28 | + // WDMessageCenterMessageType_Subscribe = 2, | ||
| 29 | + // | ||
| 30 | + // ///系统消息 | ||
| 31 | + // WDMessageCenterMessageType_System = 3 | ||
| 32 | + | ||
| 33 | + BaseGetRequest(contentType:number,pageNum:number){ | ||
| 34 | + let userID = HttpUtils.getUserId(); | ||
| 35 | + let url = HttpUrlUtils.getMessageListDataUrl()+`?contentType=${contentType}&userId=${userID}&pageSize=${20}&pageNum=${pageNum}` | ||
| 36 | + return WDHttp.get<InteractMessageListModel>(url) | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + fetchMessageList(contentType:number,pageNum:number):Promise<InteractMessageMItem>{ | ||
| 41 | + return new Promise((success,error) => { | ||
| 42 | + this.BaseGetRequest(contentType,pageNum).then((navResDTO: InteractMessageListModel) => { | ||
| 43 | + if (!navResDTO || navResDTO.code != 0) { | ||
| 44 | + return | ||
| 45 | + } | ||
| 46 | + Logger.info(TAG, "fetchMessageList then,navResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 47 | + success(navResDTO.data) | ||
| 48 | + }).catch((err: Error) => { | ||
| 49 | + Logger.error(TAG, `fetchMessageList catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 50 | + error("page data invalid"); | ||
| 51 | + }) | ||
| 52 | + }) | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + getMessageLikeCount():Promise<number>{ | ||
| 56 | + return new Promise((success,error) => { | ||
| 57 | + WDHttp.get<InteractMDTO>(HttpUrlUtils.getMessageLikeCount()).then((navResDTO: InteractMDTO) => { | ||
| 58 | + if (navResDTO.code == 0) { | ||
| 59 | + success(navResDTO.data) | ||
| 60 | + } | ||
| 61 | + }) | ||
| 62 | + .catch((error: Error) => { | ||
| 63 | + Logger.info(TAG,'executeCollcet','ResponseDTO') | ||
| 64 | + }) | ||
| 65 | + }) | ||
| 66 | + } | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +const interactMViewModel = InteractMessageViewModel.getInstance(); | ||
| 70 | + | ||
| 71 | +export default interactMViewModel as InteractMessageViewModel |
| 1 | +export class MessageUnReadItem{ | ||
| 2 | + activeCount: number = 0 //互动通知未读数 | ||
| 3 | + subscribeCount: number = 0 //预约消息未读数 | ||
| 4 | + systemCount: number = 0 //系统通知未读数 | ||
| 5 | + | ||
| 6 | + subscribeInfo: SubscribeInfo = new SubscribeInfo() | ||
| 7 | + systemInfo: SystemInfo = new SystemInfo() | ||
| 8 | + activeInfo: ActiveInfo = new ActiveInfo | ||
| 9 | +} | ||
| 10 | + | ||
| 11 | +class SubscribeInfo{ | ||
| 12 | + classify: string = "" | ||
| 13 | + contentId: string = "" | ||
| 14 | + contentType: string = "" | ||
| 15 | + id: number = -1 | ||
| 16 | + message: string = "" | ||
| 17 | + platform: string = "" | ||
| 18 | + privateMailId: number = -1 | ||
| 19 | + privateMailIdList: Array< string > = [] | ||
| 20 | + privateMailIds: string = "" | ||
| 21 | + privateMailNum: number = -1 | ||
| 22 | + read: boolean = false | ||
| 23 | + source: string = "" | ||
| 24 | + time: string = "" | ||
| 25 | + title: string = "" | ||
| 26 | + userId: number = -1 | ||
| 27 | + remark: string = "" | ||
| 28 | +} | ||
| 29 | +class SystemInfo{ | ||
| 30 | + classify: string = "" | ||
| 31 | + contentType: string = "" | ||
| 32 | + id: number = -1 | ||
| 33 | + message: string = "" | ||
| 34 | + platform: string = "" | ||
| 35 | + privateMailId: number = -1 | ||
| 36 | + privateMailIdList: Array< string > = [] | ||
| 37 | + privateMailIds: string = "" | ||
| 38 | + privateMailNum: number = -1 | ||
| 39 | + read: boolean = false | ||
| 40 | + source: string = "" | ||
| 41 | + time: string = "" | ||
| 42 | + title: string = "" | ||
| 43 | + userId: number = -1 | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +class ActiveInfo{ | ||
| 47 | + id:string = "" | ||
| 48 | + message: string = "" | ||
| 49 | + time: string = "" | ||
| 50 | + title: string = "" | ||
| 51 | +} |
| 1 | 1 | ||
| 2 | import FunctionsItem from './FunctionsItem' | 2 | import FunctionsItem from './FunctionsItem' |
| 3 | 3 | ||
| 4 | +@Observed | ||
| 4 | export default class MinePagePersonalFunctionsItem extends FunctionsItem { | 5 | export default class MinePagePersonalFunctionsItem extends FunctionsItem { |
| 6 | + isShowRedPoint:boolean = false | ||
| 5 | } | 7 | } |
-
Please register or login to post a comment