yangchenggong1_wd

desc:消息 圆点

@@ -316,6 +316,10 @@ export class HttpUrlUtils { @@ -316,6 +316,10 @@ export class HttpUrlUtils {
316 */ 316 */
317 static readonly FEEDBACK_TYPE_PATH: string = "/api/rmrb-interact/interact/c/user/optionClassify/list"; 317 static readonly FEEDBACK_TYPE_PATH: string = "/api/rmrb-interact/interact/c/user/optionClassify/list";
318 318
  319 + /**
  320 + * 查询点赞、回复我的、系统消息的未读数量以及回复/评论人
  321 + */
  322 + static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime=";
319 323
320 static getHost(): string { 324 static getHost(): string {
321 return HostManager.getHost(); 325 return HostManager.getHost();
@@ -714,4 +718,10 @@ export class HttpUrlUtils { @@ -714,4 +718,10 @@ export class HttpUrlUtils {
714 return url; 718 return url;
715 } 719 }
716 720
  721 + //获取消息未读接口
  722 + static getMessageUnReadDataUrl() {
  723 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MESSAGE_UN_READ_DATA_PATH
  724 + return url
  725 + }
  726 +
717 } 727 }
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 +}
@@ -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);
@@ -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()
  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 }