yangchenggong1_wd

个人中心 接口获取用户信息

1 1
2 import { FollowFirstTabsComponent } from 'wdComponent' 2 import { FollowFirstTabsComponent } from 'wdComponent'
  3 +import router from '@ohos.router';
  4 +import { Params } from 'wdComponent/src/main/ets/repository/bean/Params';
3 5
4 @Entry 6 @Entry
5 @Component 7 @Component
6 struct FollowListPage { 8 struct FollowListPage {
7 9
  10 + @State params:Params = router.getParams() as Params;
  11 + @State curIndex: string = '0';
  12 +
  13 + onPageShow() {
  14 + this.curIndex = "1";
  15 + }
  16 +
8 build() { 17 build() {
9 Column() { 18 Column() {
10 //Tab 详情 19 //Tab 详情
11 - FollowFirstTabsComponent() 20 + FollowFirstTabsComponent({changeIndex:Number(this.curIndex)})
12 } 21 }
13 .backgroundColor($r('app.color.color_F9F9F9')) 22 .backgroundColor($r('app.color.color_F9F9F9'))
14 .height('100%') 23 .height('100%')
  1 +{
  2 + "code": "0",
  3 + "data": {
  4 + "articleCreation": 0,
  5 + "attentionNum": 22,
  6 + "authIcon": "",
  7 + "authId": 0,
  8 + "authPersonal": "",
  9 + "authTitle": "",
  10 + "avatarFrame": "",
  11 + "browseNum": 22,
  12 + "categoryAuth": "",
  13 + "city": "",
  14 + "cnContentPublish": 0,
  15 + "cnLivePublish": 0,
  16 + "cnShareControl": 0,
  17 + "collectNum": 4,
  18 + "commentNum": 0,
  19 + "contentPublish": 0,
  20 + "creatorId": "",
  21 + "district": "",
  22 + "dynamicControl": 0,
  23 + "dynamicCreation": 0,
  24 + "fansNum": 0,
  25 + "headPhotoUrl": "https://sitcontentjdcdn.aikan.pdnews.cn//img/user/2024031215/48d5bd53227d436b9faa937b3ac14600.png",
  26 + "honoraryIcon": "",
  27 + "honoraryTitle": "",
  28 + "introduction": "",
  29 + "isComment": 0,
  30 + "isLike": 0,
  31 + "livePublish": 0,
  32 + "liveSwitch": 1,
  33 + "mainControl": 1,
  34 + "originUserId": "",
  35 + "pictureCollectionCreation": 0,
  36 + "posterShareControl": 1,
  37 + "province": "",
  38 + "region": "安徽省",
  39 + "registTime": 1710227567000,
  40 + "reserveNum": 6,
  41 + "shareControl": 0,
  42 + "shareUrl": "",
  43 + "speakControl": 0,
  44 + "subjectType": 0,
  45 + "userId": "567387477063621",
  46 + "userName": "人民日报网友aPrtq5",
  47 + "userType": "1",
  48 + "videoCollectionCreation": 0,
  49 + "videoCreation": 0
  50 + },
  51 + "message": "Success",
  52 + "meta": null,
  53 + "requestId": "",
  54 + "success": true,
  55 + "timestamp": 1711357314033
  56 +}
  1 +{
  2 + "code": "0",
  3 + "data": {
  4 + "createTime": "2024-03-12 15:12:47",
  5 + "id": 132386,
  6 + "levelHead": "http://rmrb-video-content-sit.oss-cn-beijing.aliyuncs.com/sjbj-20240125/image/display/88c45bf56ac941b883c69bd8ed373164.png",
  7 + "levelId": 2,
  8 + "levelName": "初入武林",
  9 + "levelNum": 155,
  10 + "modifyTime": "2024-03-25 16:35:57",
  11 + "status": 1,
  12 + "userId": 567387477063621
  13 + },
  14 + "message": "Success",
  15 + "success": true,
  16 + "timestamp": 1711357314136
  17 +}
@@ -18,7 +18,6 @@ export struct MinePageComponent { @@ -18,7 +18,6 @@ export struct MinePageComponent {
18 //是否是创作者 18 //是否是创作者
19 @State isCreator:boolean = false 19 @State isCreator:boolean = false
20 @State isLogin:boolean = true //默认 false 测试放开 20 @State isLogin:boolean = true //默认 false 测试放开
21 - @State userName:string = "登陆注册"  
22 @State personalData:MinePagePersonalFunctionsItem[] = [] 21 @State personalData:MinePagePersonalFunctionsItem[] = []
23 @State creatorData:MinePageCreatorFunctionsItem[] = [] 22 @State creatorData:MinePageCreatorFunctionsItem[] = []
24 @State moreData:MinePageMoreFunctionModel[] = [] 23 @State moreData:MinePageMoreFunctionModel[] = []
@@ -59,7 +58,7 @@ export struct MinePageComponent { @@ -59,7 +58,7 @@ export struct MinePageComponent {
59 @Builder MinePageUI(){ 58 @Builder MinePageUI(){
60 Column(){ 59 Column(){
61 //头像层 60 //头像层
62 - MinePageUserSimpleInfoUI({isLogin:this.isLogin,userName:this.userName}) 61 + MinePageUserSimpleInfoUI({isLogin:this.isLogin})
63 //Grid 区域 62 //Grid 区域
64 MinePagePersonFunctionUI({personalData:$personalData}) 63 MinePagePersonFunctionUI({personalData:$personalData})
65 //Card 64 //Card
  1 +import MinePageDatasModel from '../../../model/MinePageDatasModel'
1 import RouteManager from '../../../utils/RouteManager' 2 import RouteManager from '../../../utils/RouteManager'
  3 +const TAG = "MinePageUserSimpleInfoUI"
2 4
3 @Component 5 @Component
4 export default struct MinePageUserSimpleInfoUI { 6 export default struct MinePageUserSimpleInfoUI {
5 @Prop isLogin:boolean 7 @Prop isLogin:boolean
6 - @Prop userName:string 8 + @State userName:string = "登陆注册"
  9 + @State headPhotoUrl:string = ""
  10 + @State levelHead:string = ""
  11 + @State levelId:number = 0
  12 +
  13 +
  14 + aboutToAppear(){
  15 + if(this.isLogin){
  16 + this.getUserInfo()
  17 + this.getUserLevel()
  18 + }
  19 + }
7 20
8 build(){ 21 build(){
9 Row(){ 22 Row(){
10 //头像 23 //头像
11 Stack(){ 24 Stack(){
12 - Button({type:ButtonType.Circle})  
13 - .backgroundColor($r('app.color.main_red'))  
14 - .width('110lpx')  
15 - .height('110lpx')  
16 - Image($r('app.media.default_head')) 25 + Image(this.headPhotoUrl)
  26 + .alt($r('app.media.default_head'))
17 .width('108lpx') 27 .width('108lpx')
18 .height('108lpx') 28 .height('108lpx')
19 .objectFit(ImageFit.Cover) 29 .objectFit(ImageFit.Cover)
20 .borderRadius(50) 30 .borderRadius(50)
21 - }.width('110lpx')  
22 - .height('110lpx') 31 +
  32 + Image(this.levelHead)
  33 + .width('120lpx')
  34 + .height('120lpx')
  35 + .objectFit(ImageFit.Cover)
  36 + .borderRadius(50)
  37 + }.width('120lpx')
  38 + .height('120lpx')
23 .alignContent(Alignment.Center) 39 .alignContent(Alignment.Center)
24 .onClick(()=>{ 40 .onClick(()=>{
25 if(!this.isLogin){ 41 if(!this.isLogin){
@@ -52,7 +68,7 @@ export default struct MinePageUserSimpleInfoUI { @@ -52,7 +68,7 @@ export default struct MinePageUserSimpleInfoUI {
52 .width('84lpx') 68 .width('84lpx')
53 .height('29lpx') 69 .height('29lpx')
54 .objectFit(ImageFit.Auto) 70 .objectFit(ImageFit.Auto)
55 - Text("等级8") 71 + Text(`等级${this.levelId}`)
56 .textAlign(TextAlign.Center) 72 .textAlign(TextAlign.Center)
57 .fontColor($r('app.color.white')) 73 .fontColor($r('app.color.white'))
58 .fontSize('19lpx') 74 .fontSize('19lpx')
@@ -113,4 +129,25 @@ export default struct MinePageUserSimpleInfoUI { @@ -113,4 +129,25 @@ export default struct MinePageUserSimpleInfoUI {
113 @Styles setFullHeight(){ 129 @Styles setFullHeight(){
114 .height('100%') 130 .height('100%')
115 } 131 }
  132 +
  133 + getUserInfo(){
  134 + MinePageDatasModel.getUserDetailData(getContext(this)).then((value)=>{
  135 + if(value!=null){
  136 + this.userName = value.userName
  137 + this.headPhotoUrl = value.headPhotoUrl
  138 + }
  139 + }).catch((err:Error)=>{
  140 + console.log(TAG,JSON.stringify(err))
  141 + })
  142 + }
  143 + getUserLevel(){
  144 + MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{
  145 + if(value!=null){
  146 + this.levelHead = value.levelHead
  147 + this.levelId = value.levelId
  148 + }
  149 + }).catch((err:Error)=>{
  150 + console.log(TAG,JSON.stringify(err))
  151 + })
  152 + }
116 } 153 }
1 import router from '@ohos.router'; 1 import router from '@ohos.router';
  2 +import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
  3 +import MinePageDatasModel from '../../../model/MinePageDatasModel';
2 import { HomePageBottomComponent } from './home/HomePageBottomComponent'; 4 import { HomePageBottomComponent } from './home/HomePageBottomComponent';
3 5
  6 +const TAG = "MyHomeComponent"
  7 +
4 @Component 8 @Component
5 export struct MyHomeComponent { 9 export struct MyHomeComponent {
6 @State tileOpacity: number = 0; 10 @State tileOpacity: number = 0;
7 firstPositionY:number = 0; 11 firstPositionY:number = 0;
8 - @State isHasIntroduction: boolean = true  
9 - @State desc:string = "点击添加简介,让大家认识你" //text 搞两个样式,如果三行,就显示 另外一个text 没有显示高度的  
10 fontColor: string = '#999999' 12 fontColor: string = '#999999'
11 selectedFontColor: string = '#000000' 13 selectedFontColor: string = '#000000'
12 @State currentIndex: number = 0 14 @State currentIndex: number = 0
13 private controller: TabsController = new TabsController() 15 private controller: TabsController = new TabsController()
14 isChangeToUserEdit = false; 16 isChangeToUserEdit = false;
15 17
  18 + @State userName:string = ""
  19 + @State headPhotoUrl:string = ""
  20 + @State levelHead:string = ""
  21 + @State levelId:number = 0
  22 + @State desc:string = "点击添加简介,让大家认识你" //text 搞两个样式,如果三行,就显示 另外一个text 没有显示高度的
  23 + @State isHasIntroduction: boolean = false
  24 + @State browseNum:number = 0//阅读数
  25 + @State commentNum:number = 0//评论数
  26 + @State attentionNum:number = 0//关注数
  27 + registTime:number = 0//账号注册时间
  28 + @State registerTimeForDay:number = 0
  29 +
  30 + aboutToAppear(){
  31 + this.getUserInfo()
  32 + this.getUserLevel()
  33 + }
16 34
17 build() { 35 build() {
18 Stack({ alignContent: Alignment.Top }){ 36 Stack({ alignContent: Alignment.Top }){
@@ -31,15 +49,22 @@ export struct MyHomeComponent { @@ -31,15 +49,22 @@ export struct MyHomeComponent {
31 Column() { 49 Column() {
32 //用户信息区域 50 //用户信息区域
33 Row() { 51 Row() {
34 - Image($r('app.media.default_head'))  
35 - .width('115lpx')  
36 - .height('115lpx')  
37 - .objectFit(ImageFit.Cover)  
38 - .borderRadius(50)  
39 - 52 + Stack(){
  53 + Image(this.headPhotoUrl)
  54 + .alt($r('app.media.default_head'))
  55 + .width('115lpx')
  56 + .height('115lpx')
  57 + .objectFit(ImageFit.Cover)
  58 + .borderRadius(50)
  59 + Image(this.levelHead)
  60 + .width('130lpx')
  61 + .height('130lpx')
  62 + .objectFit(ImageFit.Cover)
  63 + .borderRadius(50)
  64 + }
40 Column() { 65 Column() {
41 Row() { 66 Row() {
42 - Text("人民日报6G") 67 + Text(`${this.userName}`)
43 .fontColor($r('app.color.white')) 68 .fontColor($r('app.color.white'))
44 .maxLines(1) 69 .maxLines(1)
45 .textOverflow({ overflow: TextOverflow.Ellipsis }) 70 .textOverflow({ overflow: TextOverflow.Ellipsis })
@@ -47,7 +72,7 @@ export struct MyHomeComponent { @@ -47,7 +72,7 @@ export struct MyHomeComponent {
47 .lineHeight('50lpx') 72 .lineHeight('50lpx')
48 .fontWeight('500lpx') 73 .fontWeight('500lpx')
49 74
50 - Text("等级8") 75 + Text(`等级${this.levelId}`)
51 .textAlign(TextAlign.Center) 76 .textAlign(TextAlign.Center)
52 .fontColor($r('app.color.color_ED2800')) 77 .fontColor($r('app.color.color_ED2800'))
53 .backgroundColor($r('app.color.white')) 78 .backgroundColor($r('app.color.white'))
@@ -60,7 +85,7 @@ export struct MyHomeComponent { @@ -60,7 +85,7 @@ export struct MyHomeComponent {
60 85
61 Row() { 86 Row() {
62 Row() { 87 Row() {
63 - Text("3.6万") 88 + Text(`${this.browseNum}`)
64 .textStyle() 89 .textStyle()
65 Text("阅读") 90 Text("阅读")
66 .textStyle2() 91 .textStyle2()
@@ -74,7 +99,7 @@ export struct MyHomeComponent { @@ -74,7 +99,7 @@ export struct MyHomeComponent {
74 .vertical(true) 99 .vertical(true)
75 .opacity(0.4) 100 .opacity(0.4)
76 Row() { 101 Row() {
77 - Text("6242") 102 + Text(`${this.commentNum}`)
78 .textStyle() 103 .textStyle()
79 Text("评论") 104 Text("评论")
80 .textStyle2() 105 .textStyle2()
@@ -87,7 +112,7 @@ export struct MyHomeComponent { @@ -87,7 +112,7 @@ export struct MyHomeComponent {
87 .vertical(true) 112 .vertical(true)
88 .opacity(0.4) 113 .opacity(0.4)
89 Row() { 114 Row() {
90 - Text("86") 115 + Text(`${this.attentionNum}`)
91 .textStyle() 116 .textStyle()
92 Text("关注") 117 Text("关注")
93 .textStyle2() 118 .textStyle2()
@@ -130,7 +155,7 @@ export struct MyHomeComponent { @@ -130,7 +155,7 @@ export struct MyHomeComponent {
130 .objectFit(ImageFit.Auto) 155 .objectFit(ImageFit.Auto)
131 } 156 }
132 } 157 }
133 - Text("来到人民日报365天") 158 + Text(`来到人民日报${this.registerTimeForDay}天`)
134 .fontSize('23lpx') 159 .fontSize('23lpx')
135 .lineHeight('25lpx') 160 .lineHeight('25lpx')
136 .fontWeight('400lpx') 161 .fontWeight('400lpx')
@@ -324,6 +349,41 @@ export struct MyHomeComponent { @@ -324,6 +349,41 @@ export struct MyHomeComponent {
324 } 349 }
325 } 350 }
326 351
  352 + getUserInfo(){
  353 + MinePageDatasModel.getUserDetailData(getContext(this)).then((value)=>{
  354 + if(value!=null){
  355 + this.userName = value.userName
  356 + this.headPhotoUrl = value.headPhotoUrl
  357 + if(StringUtils.isNotEmpty(value.introduction)){
  358 + this.desc = value.introduction
  359 + this.isHasIntroduction = true
  360 + }
  361 + this.browseNum = value.browseNum
  362 + this.commentNum = value.commentNum
  363 + this.attentionNum = value.attentionNum
  364 + this.registTime = value.registTime
  365 + this.getRegisterDays()
  366 + }
  367 + }).catch((err:Error)=>{
  368 + console.log(TAG,JSON.stringify(err))
  369 + })
  370 + }
  371 + getUserLevel(){
  372 + MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{
  373 + if(value!=null){
  374 + this.levelHead = value.levelHead
  375 + this.levelId = value.levelId
  376 + }
  377 + }).catch((err:Error)=>{
  378 + console.log(TAG,JSON.stringify(err))
  379 + })
  380 + }
  381 + getRegisterDays(){
  382 + if(this.registTime!=null){
  383 + let curDate = new Date()
  384 + this.registerTimeForDay = Math.ceil((curDate.getTime()-this.registTime)/(1000*60*60*24))
  385 + }
  386 + }
327 } 387 }
328 388
329 @Extend(Text) function textStyle() { 389 @Extend(Text) function textStyle() {
@@ -9,6 +9,7 @@ export struct FollowFirstTabsComponent{ @@ -9,6 +9,7 @@ export struct FollowFirstTabsComponent{
9 @State currentIndex: number = 0 9 @State currentIndex: number = 0
10 private controller: TabsController = new TabsController() 10 private controller: TabsController = new TabsController()
11 @State data:FollowListItem[] = [] 11 @State data:FollowListItem[] = []
  12 + @Prop changeIndex: number
12 fontColor: string = '#999999' 13 fontColor: string = '#999999'
13 selectedFontColor: string = '#000000' 14 selectedFontColor: string = '#000000'
14 15
@@ -23,6 +24,14 @@ export struct FollowFirstTabsComponent{ @@ -23,6 +24,14 @@ export struct FollowFirstTabsComponent{
23 this.data.push(element) 24 this.data.push(element)
24 }) 25 })
25 console.log("ycg",this.data.length.toString()); 26 console.log("ycg",this.data.length.toString());
  27 + if(this.controller != null && this.data.length>1 && this.changeIndex === 1){
  28 + //个人主页 跳转 关注页 tab 2
  29 + let intervalID = setInterval(() => {
  30 + this.currentIndex = this.changeIndex
  31 + this.controller.changeIndex(this.currentIndex)
  32 + clearInterval(intervalID);
  33 + }, 500);
  34 + }
26 }).catch((err:Error)=>{ 35 }).catch((err:Error)=>{
27 console.log(TAG,JSON.stringify(err)) 36 console.log(TAG,JSON.stringify(err))
28 }) 37 })
1 import { LazyDataSource, StringUtils } from 'wdKit'; 1 import { LazyDataSource, StringUtils } from 'wdKit';
2 import MinePageDatasModel from '../../../../model/MinePageDatasModel'; 2 import MinePageDatasModel from '../../../../model/MinePageDatasModel';
  3 +import { Params } from '../../../../repository/bean/Params';
  4 +import RouteManager from '../../../../utils/RouteManager';
3 import { CommentListItem } from '../../../../viewmodel/CommentListItem'; 5 import { CommentListItem } from '../../../../viewmodel/CommentListItem';
4 import { FollowListDetailItem } from '../../../../viewmodel/FollowListDetailItem'; 6 import { FollowListDetailItem } from '../../../../viewmodel/FollowListDetailItem';
5 import { FollowListDetailRequestItem } from '../../../../viewmodel/FollowListDetailRequestItem'; 7 import { FollowListDetailRequestItem } from '../../../../viewmodel/FollowListDetailRequestItem';
@@ -53,7 +55,12 @@ export struct HomePageBottomComponent{ @@ -53,7 +55,12 @@ export struct HomePageBottomComponent{
53 .justifyContent(FlexAlign.Center) 55 .justifyContent(FlexAlign.Center)
54 .backgroundColor($r('app.color.color_F5F5F5')) 56 .backgroundColor($r('app.color.color_F5F5F5'))
55 .margin({top:'31lpx',bottom:'4lpx'}) 57 .margin({top:'31lpx',bottom:'4lpx'})
56 - } 58 + }.onClick(()=>{
  59 + let params: Params = {
  60 + pageID: "1"
  61 + }
  62 + RouteManager.jumpNewPage("pages/FollowListPage",params)
  63 + })
57 64
58 LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { 65 LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
59 ListItem() { 66 ListItem() {
@@ -14,6 +14,8 @@ import { MineFollowListItem } from '../viewmodel/MineFollowListItem'; @@ -14,6 +14,8 @@ import { MineFollowListItem } from '../viewmodel/MineFollowListItem';
14 import { QueryListIsFollowedItem } from '../viewmodel/QueryListIsFollowedItem'; 14 import { QueryListIsFollowedItem } from '../viewmodel/QueryListIsFollowedItem';
15 import { MineCommentListDetailItem } from '../viewmodel/MineCommentListDetailItem'; 15 import { MineCommentListDetailItem } from '../viewmodel/MineCommentListDetailItem';
16 import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem'; 16 import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem';
  17 +import { MineUserLevelItem } from '../viewmodel/MineUserLevelItem';
  18 +import { MineUserDetailItem } from '../viewmodel/MineUserDetailItem';
17 const TAG = "MinePageDatasModel" 19 const TAG = "MinePageDatasModel"
18 20
19 /** 21 /**
@@ -349,6 +351,82 @@ class MinePageDatasModel{ @@ -349,6 +351,82 @@ class MinePageDatasModel{
349 return compRes.data 351 return compRes.data
350 } 352 }
351 353
  354 + /**
  355 + * 个人中心 获取用户等级
  356 + */
  357 + getUserLevelData(context: Context): Promise<MineUserLevelItem> {
  358 + return new Promise<MineUserLevelItem>((success, error) => {
  359 + Logger.info(TAG, `getAppointmentList start`);
  360 + this.fetchMineUserLevelData().then((navResDTO: ResponseDTO<MineUserLevelItem>) => {
  361 + if (!navResDTO || navResDTO.code != 0) {
  362 + success(this.getMineUserLevelDataLocal(context))
  363 + return
  364 + }
  365 + Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
  366 + let navigationBean = navResDTO.data as MineUserLevelItem
  367 + success(navigationBean);
  368 + }).catch((err: Error) => {
  369 + Logger.error(TAG, `fetchMineUserLevelData catch, error.name : ${err.name}, error.message:${err.message}`);
  370 + success(this.getMineUserLevelDataLocal(context))
  371 + })
  372 + })
  373 + }
  374 +
  375 + fetchMineUserLevelData() {
  376 + let url = HttpUrlUtils.getMineUserLevelDataUrl()
  377 + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
  378 + return WDHttp.get<ResponseDTO<MineUserLevelItem>>(url, headers)
  379 + };
  380 +
  381 + async getMineUserLevelDataLocal(context: Context): Promise<MineUserLevelItem> {
  382 + Logger.info(TAG, `getMineUserLevelDataLocal start`);
  383 + let compRes: ResponseDTO<MineUserLevelItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserLevelItem>>('mine_user_level.json' ,context);
  384 + if (!compRes || !compRes.data) {
  385 + Logger.info(TAG, `getMineUserLevelDataLocal compRes is empty`);
  386 + return new MineUserLevelItem()
  387 + }
  388 + Logger.info(TAG, `getMineUserLevelDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  389 + return compRes.data
  390 + }
  391 +
  392 + /**
  393 + * 个人中心 获取用户详细信息
  394 + */
  395 + getUserDetailData(context: Context): Promise<MineUserDetailItem> {
  396 + return new Promise<MineUserDetailItem>((success, error) => {
  397 + Logger.info(TAG, `getAppointmentList start`);
  398 + this.fetchMineUserDetailData().then((navResDTO: ResponseDTO<MineUserDetailItem>) => {
  399 + if (!navResDTO || navResDTO.code != 0) {
  400 + success(this.getMineUserDetailDataLocal(context))
  401 + return
  402 + }
  403 + Logger.info(TAG, "getUserDetailData then,timeStamp:" + navResDTO.timestamp);
  404 + let navigationBean = navResDTO.data as MineUserDetailItem
  405 + success(navigationBean);
  406 + }).catch((err: Error) => {
  407 + Logger.error(TAG, `fetchMineUserDetailData catch, error.name : ${err.name}, error.message:${err.message}`);
  408 + success(this.getMineUserDetailDataLocal(context))
  409 + })
  410 + })
  411 + }
  412 +
  413 + fetchMineUserDetailData() {
  414 + let url = HttpUrlUtils.getMineUserDetailDataUrl()
  415 + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
  416 + return WDHttp.get<ResponseDTO<MineUserDetailItem>>(url, headers)
  417 + };
  418 +
  419 + async getMineUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> {
  420 + Logger.info(TAG, `getMineUserLevelDataLocal start`);
  421 + let compRes: ResponseDTO<MineUserDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserDetailItem>>('mine_user_detail.json',context );
  422 + if (!compRes || !compRes.data) {
  423 + Logger.info(TAG, `getMineUserDetailDataLocal compRes is empty`);
  424 + return new MineUserDetailItem()
  425 + }
  426 + Logger.info(TAG, `getMineUserDetailDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  427 + return compRes.data
  428 + }
  429 +
352 } 430 }
353 431
354 const minePageDatasModel = MinePageDatasModel.getInstance() 432 const minePageDatasModel = MinePageDatasModel.getInstance()
@@ -70,6 +70,16 @@ export class HttpUrlUtils { @@ -70,6 +70,16 @@ export class HttpUrlUtils {
70 */ 70 */
71 static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList"; 71 static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList";
72 72
  73 + /**
  74 + * 个人中心 APP获取用户等级
  75 + */
  76 + static readonly MINE_USER_LEVEL_DATA_PATH: string = "/api/rmrb-user-point/auth/level/zh/c/queryUserLevel";
  77 +
  78 + /**
  79 + * 个人中心 (号主/普通用户)我的基本信息
  80 + */
  81 + static readonly MINE_USER_DETAIL_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/my/detail";
  82 +
73 private static hostUrl: string = HttpUrlUtils.HOST_UAT; 83 private static hostUrl: string = HttpUrlUtils.HOST_UAT;
74 84
75 static getCommonHeaders(): HashMap<string, string> { 85 static getCommonHeaders(): HashMap<string, string> {
@@ -109,44 +119,6 @@ export class HttpUrlUtils { @@ -109,44 +119,6 @@ export class HttpUrlUtils {
109 return headers; 119 return headers;
110 } 120 }
111 121
112 - static getYcgCommonHeaders(): HashMap<string, string> {  
113 - let headers: HashMap<string, string> = new HashMap<string, string>()  
114 -  
115 - headers.set('mpassid', 'XGt6jfGUx8ADAKruTyAMdhHj')  
116 - headers.set('city', "%E5%90%88%E8%82%A5%E5%B8%82")  
117 - headers.set('User-Agent', 'Dalvik/2.1.0 (Linux; U; Android 10; PCT-AL10 Build/HUAWEIPCT-AL10)')  
118 - headers.set('channel', "rmrb_china_0000")  
119 - headers.set('appCode', "0af1f9085e484c97b2a44704bae72c07")  
120 - headers.set('Authorization', "APPCODE 0af1f9085e484c97b2a44704bae72c07")  
121 - headers.set('X-Ca-Stage', "TEST")  
122 - headers.set('plat', "Phone")  
123 - headers.set('Content-Type', 'application/json; charset=utf-8')  
124 - headers.set('timestamp', "649773304")  
125 - headers.set('RMRB-X-TOKEN', "eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDU4Mzk0MywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ._LTKrUxQozpCj1XMhx1TWOIxn5gjDveoPuMFGpI0g_8")  
126 - headers.set('device_id', "5156098c-6c44-3514-af70-04a0139a9327")  
127 - headers.set('cookie', 'RMRB-X-TOKEN=eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDU4Mzk0MywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ._LTKrUxQozpCj1XMhx1TWOIxn5gjDveoPuMFGpI0g_8')  
128 - headers.set('build_version', "202403112023")  
129 - headers.set('adcode', "340000")  
130 - headers.set('os_version', "10")  
131 - headers.set('city_dode', "340100")  
132 - headers.set('userId', "567387477063621")  
133 - headers.set('versionCode', "7302")  
134 - headers.set('system', "Android")  
135 - headers.set('version_name', "7.3.0.2")  
136 - headers.set('EagleEye-TraceID', '5C3D0800CF2C4440A43E5B131187629B')  
137 - headers.set('imei', "5156098c-6c44-3514-af70-04a0139a9327")  
138 - headers.set('userType', "1")  
139 - headers.set('Accept-Language', 'zh')  
140 -  
141 - // HttpUrlUtils.addSpecialHeaders(headers);  
142 - // Logger.debug("TAG", '******************* commonHeaders headers start ******************************** ');  
143 - // headers.forEach((v,k)=>{  
144 - // Logger.debug("TAG", 'getCommonHeaders header: ' + k + ': ' + v);  
145 - // })  
146 - // Logger.debug("TAG", '******************* commonHeaders headers end ******************************** ');  
147 - return headers;  
148 - }  
149 -  
150 static getHost() { 122 static getHost() {
151 return this.hostUrl; 123 return this.hostUrl;
152 } 124 }
@@ -218,6 +190,55 @@ export class HttpUrlUtils { @@ -218,6 +190,55 @@ export class HttpUrlUtils {
218 return url 190 return url
219 } 191 }
220 192
  193 + static getMineUserLevelDataUrl() {
  194 + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.MINE_USER_LEVEL_DATA_PATH
  195 + return url
  196 + }
  197 +
  198 + static getMineUserDetailDataUrl() {
  199 + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.MINE_USER_DETAIL_DATA_PATH
  200 + return url
  201 + }
  202 +
  203 +
  204 + static getYcgCommonHeaders(): HashMap<string, string> {
  205 + let headers: HashMap<string, string> = new HashMap<string, string>()
  206 +
  207 + headers.set('mpassid', 'XGt6jfGUx8ADAKruTyAMdhHj')
  208 + headers.set('city', "%E5%90%88%E8%82%A5%E5%B8%82")
  209 + headers.set('User-Agent', 'Dalvik/2.1.0 (Linux; U; Android 10; PCT-AL10 Build/HUAWEIPCT-AL10)')
  210 + headers.set('channel', "rmrb_china_0000")
  211 + headers.set('appCode', "0af1f9085e484c97b2a44704bae72c07")
  212 + headers.set('Authorization', "APPCODE 0af1f9085e484c97b2a44704bae72c07")
  213 + headers.set('X-Ca-Stage', "TEST")
  214 + headers.set('plat', "Phone")
  215 + headers.set('Content-Type', 'application/json; charset=utf-8')
  216 + headers.set('timestamp', "740977741")
  217 + headers.set('RMRB-X-TOKEN', "eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDc1NjM3NywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ.KBkF0Yki-JWlq0ZIOCzgKwQc1ycBnFHa6CF-rMPRgHU")
  218 + headers.set('device_id', "5156098c-6c44-3514-af70-04a0139a9327")
  219 + // headers.set('cookie', 'RMRB-X-TOKEN=eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDU4Mzk0MywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ._LTKrUxQozpCj1XMhx1TWOIxn5gjDveoPuMFGpI0g_8')
  220 + headers.set('build_version', "202403112023")
  221 + headers.set('adcode', "340000")
  222 + headers.set('os_version', "10")
  223 + headers.set('city_dode', "340100")
  224 + headers.set('userId', "567387477063621")
  225 + headers.set('versionCode', "7302")
  226 + headers.set('system', "Android")
  227 + headers.set('version_name', "7.3.0.2")
  228 + headers.set('EagleEye-TraceID', '101118E4D006453DA549A82AA8CAFBFE')
  229 + headers.set('imei', "5156098c-6c44-3514-af70-04a0139a9327")
  230 + headers.set('userType', "1")
  231 + headers.set('Accept-Language', 'zh')
  232 +
  233 + // HttpUrlUtils.addSpecialHeaders(headers);
  234 + // Logger.debug("TAG", '******************* commonHeaders headers start ******************************** ');
  235 + // headers.forEach((v,k)=>{
  236 + // Logger.debug("TAG", 'getCommonHeaders header: ' + k + ': ' + v);
  237 + // })
  238 + // Logger.debug("TAG", '******************* commonHeaders headers end ******************************** ');
  239 + return headers;
  240 + }
  241 +
221 static addSpecialHeaders(headers: HashMap<string, string>) { 242 static addSpecialHeaders(headers: HashMap<string, string>) {
222 switch (this.hostUrl) { 243 switch (this.hostUrl) {
223 case this.HOST_UAT: 244 case this.HOST_UAT:
  1 +
  2 +export class MineUserDetailItem{
  3 + userName:string = ""
  4 + headPhotoUrl:"" = ""
  5 + introduction:string = ""
  6 + userType:string = "1"
  7 + creatorId:string = ""
  8 + browseNum:number = 0//阅读数
  9 + commentNum:number = 0//评论数
  10 + attentionNum:number = 0//关注数
  11 + registTime:number = 0//账号注册时间
  12 +
  13 + levelHead:string = ""
  14 + levelId:number = 0
  15 +}
  1 +
  2 +export class MineUserLevelItem{
  3 + levelHead:string = ""
  4 + levelId:number = 0
  5 + levelName:string = ""
  6 +
  7 +}