yangchenggong1_wd

主页(客态) 个人中心接口对接

Showing 24 changed files with 945 additions and 38 deletions
@@ -91,6 +91,25 @@ export class HttpUrlUtils { @@ -91,6 +91,25 @@ export class HttpUrlUtils {
91 * 个人中心 我的评论列表 91 * 个人中心 我的评论列表
92 */ 92 */
93 static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList"; 93 static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList";
  94 +
  95 + /**
  96 + * 个人中心 APP获取用户等级
  97 + */
  98 + static readonly MINE_USER_LEVEL_DATA_PATH: string = "/api/rmrb-user-point/auth/level/zh/c/queryUserLevel";
  99 +
  100 + /**
  101 + * 个人中心 APP获取其他用户等级
  102 + */
  103 + static readonly OTHER_USER_LEVEL_DATA_PATH: string = "/api/rmrb-user-point/auth/level/zh/c/batchUser";
  104 +
  105 + /**
  106 + * 个人中心 (号主/普通用户)我的基本信息
  107 + */
  108 + static readonly MINE_USER_DETAIL_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/my/detail";
  109 + /**
  110 + * 个人中心 (普通用户)其他用户 的基本信息
  111 + */
  112 + static readonly OTHER_USER_DETAIL_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/master/detail";
94 /** 113 /**
95 * 早晚报列表 114 * 早晚报列表
96 * 根据页面id获取页面楼层列表 115 * 根据页面id获取页面楼层列表
@@ -339,6 +358,27 @@ export class HttpUrlUtils { @@ -339,6 +358,27 @@ export class HttpUrlUtils {
339 return url 358 return url
340 } 359 }
341 360
  361 + static getMineUserLevelDataUrl() {
  362 + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.MINE_USER_LEVEL_DATA_PATH
  363 + return url
  364 + }
  365 +
  366 + static getOtherUserLevelDataUrl() {
  367 + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.OTHER_USER_LEVEL_DATA_PATH
  368 + return url
  369 + }
  370 +
  371 + static getMineUserDetailDataUrl() {
  372 + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.MINE_USER_DETAIL_DATA_PATH
  373 + return url
  374 + }
  375 +
  376 + static getOtherUserDetailDataUrl() {
  377 + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.OTHER_USER_DETAIL_DATA_PATH
  378 + return url
  379 + }
  380 +
  381 +
342 static getYcgCommonHeaders(): HashMap<string, string> { 382 static getYcgCommonHeaders(): HashMap<string, string> {
343 let headers: HashMap<string, string> = new HashMap<string, string>() 383 let headers: HashMap<string, string> = new HashMap<string, string>()
344 384
@@ -64,5 +64,8 @@ export class WDRouterPage { @@ -64,5 +64,8 @@ export class WDRouterPage {
64 // 设置密码页、设置手机号页等等 (需要传参) 64 // 设置密码页、设置手机号页等等 (需要传参)
65 static settingPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/SettingPasswordPage"); 65 static settingPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/SettingPasswordPage");
66 66
  67 + //其他普通用户 主页
  68 + static otherNormalUserHomePagePage = new WDRouterPage("wdComponent", "ets/pages/OtherNormalUserHomePage");
  69 +
67 // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); 70 // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview");
68 } 71 }
@@ -27,6 +27,7 @@ export default struct MinePageCreatorFunctionUI { @@ -27,6 +27,7 @@ export default struct MinePageCreatorFunctionUI {
27 .width('27lpx') 27 .width('27lpx')
28 .height('27lpx') 28 .height('27lpx')
29 .objectFit(ImageFit.Auto) 29 .objectFit(ImageFit.Auto)
  30 + .interpolation(ImageInterpolation.High)
30 } 31 }
31 32
32 }.setFullWidth() 33 }.setFullWidth()
@@ -42,6 +43,8 @@ export default struct MinePageCreatorFunctionUI { @@ -42,6 +43,8 @@ export default struct MinePageCreatorFunctionUI {
42 Image(item.imgSrc) 43 Image(item.imgSrc)
43 .width('50lpx') 44 .width('50lpx')
44 .height('50lpx') 45 .height('50lpx')
  46 + .objectFit(ImageFit.Auto)
  47 + .interpolation(ImageInterpolation.High)
45 Text(`${item.msg}`) 48 Text(`${item.msg}`)
46 .margin({top:'15lpx'}) 49 .margin({top:'15lpx'})
47 .width('96lpx') 50 .width('96lpx')
@@ -37,6 +37,8 @@ export default struct MinePageMoreFunctionUI { @@ -37,6 +37,8 @@ export default struct MinePageMoreFunctionUI {
37 .width('38lpx') 37 .width('38lpx')
38 .height('38lpx') 38 .height('38lpx')
39 .margin({ right: '15lpx' }) 39 .margin({ right: '15lpx' })
  40 + .objectFit(ImageFit.Auto)
  41 + .interpolation(ImageInterpolation.High)
40 } 42 }
41 Text(`${item.msg}`) 43 Text(`${item.msg}`)
42 .width('456lpx') 44 .width('456lpx')
@@ -50,6 +52,7 @@ export default struct MinePageMoreFunctionUI { @@ -50,6 +52,7 @@ export default struct MinePageMoreFunctionUI {
50 .width('27lpx') 52 .width('27lpx')
51 .height('27lpx') 53 .height('27lpx')
52 .objectFit(ImageFit.Auto) 54 .objectFit(ImageFit.Auto)
  55 + .interpolation(ImageInterpolation.High)
53 .margin({ left: '81lpx', right: '29lpx' }) 56 .margin({ left: '81lpx', right: '29lpx' })
54 }.alignItems(VerticalAlign.Center) 57 }.alignItems(VerticalAlign.Center)
55 .justifyContent(FlexAlign.Center) 58 .justifyContent(FlexAlign.Center)
@@ -5,6 +5,13 @@ import router from '@ohos.router' @@ -5,6 +5,13 @@ import router from '@ohos.router'
5 @Component 5 @Component
6 export default struct MinePagePersonFunctionUI { 6 export default struct MinePagePersonFunctionUI {
7 @Link personalData:MinePagePersonalFunctionsItem[] 7 @Link personalData:MinePagePersonalFunctionsItem[]
  8 + @Prop isLogin:boolean
  9 + @Consume('isLogin')@Watch('loginChange') loginState:Record<string,string>
  10 + loginChange(){
  11 + if(this.loginState){
  12 + this.isLogin=true
  13 + }
  14 + }
8 15
9 build() { 16 build() {
10 Grid(){ 17 Grid(){
@@ -15,6 +22,8 @@ export default struct MinePagePersonFunctionUI { @@ -15,6 +22,8 @@ export default struct MinePagePersonFunctionUI {
15 Image(item.imgSrc) 22 Image(item.imgSrc)
16 .width('46lpx') 23 .width('46lpx')
17 .height('46lpx') 24 .height('46lpx')
  25 + .objectFit(ImageFit.Auto)
  26 + .interpolation(ImageInterpolation.High)
18 Text(`${item.msg}`) 27 Text(`${item.msg}`)
19 .margin({top:'8lpx'}) 28 .margin({top:'8lpx'})
20 .width('50lpx') 29 .width('50lpx')
@@ -37,18 +46,34 @@ export default struct MinePagePersonFunctionUI { @@ -37,18 +46,34 @@ export default struct MinePagePersonFunctionUI {
37 console.log(index+"") 46 console.log(index+"")
38 switch (item.msg){ 47 switch (item.msg){
39 case "预约":{ 48 case "预约":{
  49 + if(!this.isLogin){
  50 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  51 + return
  52 + }
40 WDRouterRule.jumpWithPage(WDRouterPage.appointmentListPage) 53 WDRouterRule.jumpWithPage(WDRouterPage.appointmentListPage)
41 break; 54 break;
42 } 55 }
43 case "关注":{ 56 case "关注":{
  57 + if(!this.isLogin){
  58 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  59 + return
  60 + }
44 WDRouterRule.jumpWithPage(WDRouterPage.followListPage) 61 WDRouterRule.jumpWithPage(WDRouterPage.followListPage)
45 break; 62 break;
46 } 63 }
47 case "收藏":{ 64 case "收藏":{
  65 + if(!this.isLogin){
  66 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  67 + return
  68 + }
48 WDRouterRule.jumpWithPage(WDRouterPage.myCollectionListPagePage) 69 WDRouterRule.jumpWithPage(WDRouterPage.myCollectionListPagePage)
49 break; 70 break;
50 } 71 }
51 case "历史":{ 72 case "历史":{
  73 + if(!this.isLogin){
  74 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  75 + return
  76 + }
52 WDRouterRule.jumpWithPage(WDRouterPage.browsingHistoryPage) 77 WDRouterRule.jumpWithPage(WDRouterPage.browsingHistoryPage)
53 break; 78 break;
54 } 79 }
1 import { Logger } from 'wdKit' 1 import { Logger } from 'wdKit'
2 import { WDRouterPage, WDRouterRule } from 'wdRouter' 2 import { WDRouterPage, WDRouterRule } from 'wdRouter'
  3 +import MinePageDatasModel from '../../model/MinePageDatasModel'
  4 +const TAG = "MinePageUserSimpleInfoUI"
  5 +
3 6
4 @Component 7 @Component
5 export default struct MinePageUserSimpleInfoUI { 8 export default struct MinePageUserSimpleInfoUI {
6 - @Prop isLogin:boolean  
7 - @Prop userName:string  
8 - @Consume('isLogin')@Watch('loginChange') isLogin2:Record<string,string> 9 + @Watch('loginStateChange') @Prop isLogin :boolean
  10 + @State userName:string = "登陆注册"
  11 + @State headPhotoUrl:string = ""
  12 + @State levelHead:string = ""
  13 + @State levelId:number = 0
  14 +
  15 +
  16 + aboutToAppear(){
  17 + if(this.isLogin){
  18 + this.getUserInfo()
  19 + this.getUserLevel()
  20 + }
  21 + }
  22 +
  23 +
  24 + @Consume('isLogin')@Watch('loginChange') loginState:Record<string,string>
9 loginChange(){ 25 loginChange(){
10 Logger.debug("isLogin",'MinePageUserSimpleInfoUI') 26 Logger.debug("isLogin",'MinePageUserSimpleInfoUI')
11 - if(this.isLogin2){ 27 + if(this.loginState){
12 this.isLogin=true 28 this.isLogin=true
13 - this.userName=this.isLogin2['userName'] 29 + }
  30 + if(this.isLogin){
  31 + this.getUserInfo()
  32 + this.getUserLevel()
  33 + }
  34 + }
  35 + loginStateChange(){
  36 + if(this.isLogin){
  37 + this.getUserInfo()
  38 + this.getUserLevel()
14 } 39 }
15 } 40 }
16 41
@@ -18,24 +43,22 @@ export default struct MinePageUserSimpleInfoUI { @@ -18,24 +43,22 @@ export default struct MinePageUserSimpleInfoUI {
18 Row(){ 43 Row(){
19 //头像 44 //头像
20 Stack(){ 45 Stack(){
21 - Button({type:ButtonType.Circle})  
22 - .backgroundColor($r('app.color.main_red'))  
23 - .width('110lpx')  
24 - .height('110lpx')  
25 - Image($r('app.media.default_head')) 46 + Image(this.headPhotoUrl)
  47 + .alt($r('app.media.default_head'))
26 .width('108lpx') 48 .width('108lpx')
27 .height('108lpx') 49 .height('108lpx')
28 .objectFit(ImageFit.Cover) 50 .objectFit(ImageFit.Cover)
29 .borderRadius(50) 51 .borderRadius(50)
30 - }.width('110lpx')  
31 - .height('110lpx') 52 + Image(this.levelHead)
  53 + .width('120lpx')
  54 + .height('120lpx')
  55 + .objectFit(ImageFit.Cover)
  56 + .borderRadius(50)
  57 + }.width('120lpx')
  58 + .height('120lpx')
32 .alignContent(Alignment.Center) 59 .alignContent(Alignment.Center)
33 .onClick(()=>{ 60 .onClick(()=>{
34 - if(!this.isLogin){  
35 - WDRouterRule.jumpWithPage(WDRouterPage.loginPage)  
36 - }else {  
37 - WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage)  
38 - } 61 + this.jumpLogin()
39 }) 62 })
40 63
41 if(this.isLogin){ 64 if(this.isLogin){
@@ -55,13 +78,16 @@ export default struct MinePageUserSimpleInfoUI { @@ -55,13 +78,16 @@ export default struct MinePageUserSimpleInfoUI {
55 .objectFit(ImageFit.Cover) 78 .objectFit(ImageFit.Cover)
56 Blank() 79 Blank()
57 }.width('100%') 80 }.width('100%')
  81 + .onClick(()=>{
  82 + this.jumpLogin()
  83 + })
58 84
59 Stack(){ 85 Stack(){
60 Image($r('app.media.mine_grade_bg')) 86 Image($r('app.media.mine_grade_bg'))
61 .width('84lpx') 87 .width('84lpx')
62 .height('29lpx') 88 .height('29lpx')
63 .objectFit(ImageFit.Auto) 89 .objectFit(ImageFit.Auto)
64 - Text("等级8") 90 + Text(`等级${this.levelId}`)
65 .textAlign(TextAlign.Center) 91 .textAlign(TextAlign.Center)
66 .fontColor($r('app.color.white')) 92 .fontColor($r('app.color.white'))
67 .fontSize('19lpx') 93 .fontSize('19lpx')
@@ -84,7 +110,9 @@ export default struct MinePageUserSimpleInfoUI { @@ -84,7 +110,9 @@ export default struct MinePageUserSimpleInfoUI {
84 .margin({left:'15lpx'}) 110 .margin({left:'15lpx'})
85 .objectFit(ImageFit.Cover) 111 .objectFit(ImageFit.Cover)
86 Blank() 112 Blank()
87 - } 113 + }.onClick(()=>{
  114 + this.jumpLogin()
  115 + })
88 .margin({top:'11lpx',left:'17lpx'}) 116 .margin({top:'11lpx',left:'17lpx'})
89 .width('352lpx') 117 .width('352lpx')
90 } 118 }
@@ -122,4 +150,33 @@ export default struct MinePageUserSimpleInfoUI { @@ -122,4 +150,33 @@ export default struct MinePageUserSimpleInfoUI {
122 @Styles setFullHeight(){ 150 @Styles setFullHeight(){
123 .height('100%') 151 .height('100%')
124 } 152 }
  153 +
  154 + getUserInfo(){
  155 + MinePageDatasModel.getUserDetailData(getContext(this)).then((value)=>{
  156 + if(value!=null){
  157 + this.userName = value.userName
  158 + this.headPhotoUrl = value.headPhotoUrl
  159 + }
  160 + }).catch((err:Error)=>{
  161 + console.log(TAG,JSON.stringify(err))
  162 + })
  163 + }
  164 + getUserLevel(){
  165 + MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{
  166 + if(value!=null){
  167 + this.levelHead = value.levelHead
  168 + this.levelId = value.levelId
  169 + }
  170 + }).catch((err:Error)=>{
  171 + console.log(TAG,JSON.stringify(err))
  172 + })
  173 + }
  174 +
  175 + jumpLogin(){
  176 + if(!this.isLogin){
  177 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  178 + }else {
  179 + WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage)
  180 + }
  181 + }
125 } 182 }
@@ -9,6 +9,8 @@ export struct AppointmentListChildComponent{ @@ -9,6 +9,8 @@ export struct AppointmentListChildComponent{
9 Stack(){ 9 Stack(){
10 Image(this.item?.imageUrl[0]) 10 Image(this.item?.imageUrl[0])
11 .objectFit(ImageFit.Auto) 11 .objectFit(ImageFit.Auto)
  12 + .interpolation(ImageInterpolation.High)
  13 +
12 14
13 if(this.item.relType === 1){ 15 if(this.item.relType === 1){
14 Row(){ 16 Row(){
@@ -17,6 +19,8 @@ export struct AppointmentListChildComponent{ @@ -17,6 +19,8 @@ export struct AppointmentListChildComponent{
17 .width('42lpx') 19 .width('42lpx')
18 .height('35lpx') 20 .height('35lpx')
19 .objectFit(ImageFit.Auto) 21 .objectFit(ImageFit.Auto)
  22 + .interpolation(ImageInterpolation.High)
  23 +
20 Text("预约") 24 Text("预约")
21 .fontWeight(400) 25 .fontWeight(400)
22 .fontSize('21lpx') 26 .fontSize('21lpx')
@@ -51,6 +55,7 @@ export struct AppointmentListChildComponent{ @@ -51,6 +55,7 @@ export struct AppointmentListChildComponent{
51 if(this.item.relType === 2){ 55 if(this.item.relType === 2){
52 Image($r('app.media.play_status_history_icon')) 56 Image($r('app.media.play_status_history_icon'))
53 .objectFit(ImageFit.Auto) 57 .objectFit(ImageFit.Auto)
  58 + .interpolation(ImageInterpolation.High)
54 .width('38lpx') 59 .width('38lpx')
55 .height('38lpx') 60 .height('38lpx')
56 .margin({right:'12lpx'}) 61 .margin({right:'12lpx'})
@@ -60,6 +65,7 @@ export struct AppointmentListChildComponent{ @@ -60,6 +65,7 @@ export struct AppointmentListChildComponent{
60 }else { 65 }else {
61 Image($r('app.media.play_status_icon')) 66 Image($r('app.media.play_status_icon'))
62 .objectFit(ImageFit.Auto) 67 .objectFit(ImageFit.Auto)
  68 + .interpolation(ImageInterpolation.High)
63 .width('38lpx') 69 .width('38lpx')
64 .height('38lpx') 70 .height('38lpx')
65 .margin({right:'12lpx'}) 71 .margin({right:'12lpx'})
@@ -68,6 +74,7 @@ export struct AppointmentListChildComponent{ @@ -68,6 +74,7 @@ export struct AppointmentListChildComponent{
68 .fontSize('23lpx') 74 .fontSize('23lpx')
69 Image($r('app.media.point_icon')) 75 Image($r('app.media.point_icon'))
70 .objectFit(ImageFit.Auto) 76 .objectFit(ImageFit.Auto)
  77 + .interpolation(ImageInterpolation.High)
71 .width('12lpx') 78 .width('12lpx')
72 .height('31lpx') 79 .height('31lpx')
73 .margin({right:'4lpx'}) 80 .margin({right:'4lpx'})
@@ -6,6 +6,7 @@ const TAG = "FollowFirstTabsComponent" @@ -6,6 +6,7 @@ const TAG = "FollowFirstTabsComponent"
6 @Component 6 @Component
7 export struct FollowFirstTabsComponent{ 7 export struct FollowFirstTabsComponent{
8 @State currentIndex: number = 0 8 @State currentIndex: number = 0
  9 + @Prop changeIndex: number
9 private controller: TabsController = new TabsController() 10 private controller: TabsController = new TabsController()
10 @State data:FollowListItem[] = [] 11 @State data:FollowListItem[] = []
11 fontColor: string = '#999999' 12 fontColor: string = '#999999'
@@ -22,6 +23,14 @@ export struct FollowFirstTabsComponent{ @@ -22,6 +23,14 @@ export struct FollowFirstTabsComponent{
22 this.data.push(element) 23 this.data.push(element)
23 }) 24 })
24 console.log("ycg",this.data.length.toString()); 25 console.log("ycg",this.data.length.toString());
  26 + if(this.controller != null && this.data.length>1 && this.changeIndex === 1){
  27 + //个人主页 跳转 关注页 tab 2
  28 + let intervalID = setInterval(() => {
  29 + this.currentIndex = this.changeIndex
  30 + this.controller.changeIndex(this.currentIndex)
  31 + clearInterval(intervalID);
  32 + }, 500);
  33 + }
25 }).catch((err:Error)=>{ 34 }).catch((err:Error)=>{
26 console.log(TAG,JSON.stringify(err)) 35 console.log(TAG,JSON.stringify(err))
27 }) 36 })
  1 +import { Params } from 'wdBean';
1 import { LazyDataSource, StringUtils } from 'wdKit'; 2 import { LazyDataSource, StringUtils } from 'wdKit';
  3 +import { WDRouterPage, WDRouterRule } from 'wdRouter';
2 import MinePageDatasModel from '../../../model/MinePageDatasModel'; 4 import MinePageDatasModel from '../../../model/MinePageDatasModel';
3 import { CommentListItem } from '../../../viewmodel/CommentListItem'; 5 import { CommentListItem } from '../../../viewmodel/CommentListItem';
4 import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; 6 import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
@@ -15,6 +17,8 @@ export struct HomePageBottomComponent{ @@ -15,6 +17,8 @@ export struct HomePageBottomComponent{
15 @State hasMore:boolean = true 17 @State hasMore:boolean = true
16 curPageNum:number = 1; 18 curPageNum:number = 1;
17 @State count:number = 0; 19 @State count:number = 0;
  20 + @State isMineAccount:boolean = true;
  21 + @State userId:string = "";
18 22
19 aboutToAppear(){ 23 aboutToAppear(){
20 this.getNewPageData() 24 this.getNewPageData()
@@ -53,7 +57,12 @@ export struct HomePageBottomComponent{ @@ -53,7 +57,12 @@ export struct HomePageBottomComponent{
53 .justifyContent(FlexAlign.Center) 57 .justifyContent(FlexAlign.Center)
54 .backgroundColor($r('app.color.color_F5F5F5')) 58 .backgroundColor($r('app.color.color_F5F5F5'))
55 .margin({top:'31lpx',bottom:'4lpx'}) 59 .margin({top:'31lpx',bottom:'4lpx'})
  60 + }.onClick(()=>{
  61 + let params: Params = {
  62 + pageID: "1"
56 } 63 }
  64 + WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
  65 + })
57 66
58 LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { 67 LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
59 ListItem() { 68 ListItem() {
  1 +import { Params } from 'wdBean';
1 import { FollowFirstTabsComponent } from '../mine/follow/FollowFirstTabsComponent' 2 import { FollowFirstTabsComponent } from '../mine/follow/FollowFirstTabsComponent'
  3 +import router from '@ohos.router';
2 4
3 @Entry 5 @Entry
4 @Component 6 @Component
5 struct FollowListPage { 7 struct FollowListPage {
  8 + @State params:Params = router.getParams() as Params;
  9 + @State curIndex: string = '0';
  10 +
  11 + onPageShow() {
  12 + this.curIndex = this.params?.pageID;
  13 + }
6 14
7 build() { 15 build() {
8 Column() { 16 Column() {
9 //Tab 详情 17 //Tab 详情
10 - FollowFirstTabsComponent() 18 + FollowFirstTabsComponent({changeIndex:Number(this.curIndex)})
11 } 19 }
12 .backgroundColor($r('app.color.color_F9F9F9')) 20 .backgroundColor($r('app.color.color_F9F9F9'))
13 .height('100%') 21 .height('100%')
@@ -20,7 +20,6 @@ export struct MinePageComponent { @@ -20,7 +20,6 @@ export struct MinePageComponent {
20 //是否是创作者 20 //是否是创作者
21 @State isCreator:boolean = false 21 @State isCreator:boolean = false
22 @State isLogin:boolean = false //默认 false 测试放开 22 @State isLogin:boolean = false //默认 false 测试放开
23 - @State userName:string = "登陆注册"  
24 @State personalData:MinePagePersonalFunctionsItem[] = [] 23 @State personalData:MinePagePersonalFunctionsItem[] = []
25 @State creatorData:MinePageCreatorFunctionsItem[] = [] 24 @State creatorData:MinePageCreatorFunctionsItem[] = []
26 @State moreData:MinePageMoreFunctionModel[] = [] 25 @State moreData:MinePageMoreFunctionModel[] = []
@@ -61,9 +60,9 @@ export struct MinePageComponent { @@ -61,9 +60,9 @@ export struct MinePageComponent {
61 @Builder MinePageUI(){ 60 @Builder MinePageUI(){
62 Column(){ 61 Column(){
63 //头像层 62 //头像层
64 - MinePageUserSimpleInfoUI({isLogin:this.isLogin,userName:this.userName}) 63 + MinePageUserSimpleInfoUI({isLogin:this.isLogin})
65 //Grid 区域 64 //Grid 区域
66 - MinePagePersonFunctionUI({personalData:$personalData}) 65 + MinePagePersonFunctionUI({personalData:$personalData,isLogin:this.isLogin})
67 //Card 66 //Card
68 MinePageCardUI() 67 MinePageCardUI()
69 //创作者区域 68 //创作者区域
@@ -83,8 +82,6 @@ export struct MinePageComponent { @@ -83,8 +82,6 @@ export struct MinePageComponent {
83 let userid = await SPHelper.default.get(SpConstants.USER_ID,"") 82 let userid = await SPHelper.default.get(SpConstants.USER_ID,"")
84 if(StringUtils.isNotEmpty(userid)){ 83 if(StringUtils.isNotEmpty(userid)){
85 this.isLogin = true 84 this.isLogin = true
86 - let userName = await SPHelper.default.get(SpConstants.USER_NAME,"") as string  
87 - this.userName = userName  
88 }else{ 85 }else{
89 this.isLogin = false 86 this.isLogin = false
90 } 87 }
@@ -13,6 +13,7 @@ export struct CustomTitleUI { @@ -13,6 +13,7 @@ export struct CustomTitleUI {
13 .width('46lpx') 13 .width('46lpx')
14 .height('46lpx') 14 .height('46lpx')
15 .objectFit(ImageFit.Auto) 15 .objectFit(ImageFit.Auto)
  16 + .interpolation(ImageInterpolation.High)
16 .id("back_icon") 17 .id("back_icon")
17 .alignRules({ 18 .alignRules({
18 center: {anchor: "__container__", align: VerticalAlign.Center}, 19 center: {anchor: "__container__", align: VerticalAlign.Center},
@@ -18,6 +18,7 @@ export struct ListHasNoMoreDataUI{ @@ -18,6 +18,7 @@ export struct ListHasNoMoreDataUI{
18 .width('200lpx') 18 .width('200lpx')
19 .height('200lpx') 19 .height('200lpx')
20 .objectFit(ImageFit.Auto) 20 .objectFit(ImageFit.Auto)
  21 + .interpolation(ImageInterpolation.High)
21 Text("暂无内容") 22 Text("暂无内容")
22 .fontColor($r('app.color.color_999999')) 23 .fontColor($r('app.color.color_999999'))
23 .fontWeight('500lpx') 24 .fontWeight('500lpx')
@@ -5,7 +5,7 @@ import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; @@ -5,7 +5,7 @@ import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel';
5 import HashMap from '@ohos.util.HashMap'; 5 import HashMap from '@ohos.util.HashMap';
6 import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; 6 import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
7 import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; 7 import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem';
8 -import { Logger, ResourcesUtils } from 'wdKit'; 8 +import { Logger, ResourcesUtils, StringUtils } from 'wdKit';
9 import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; 9 import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem';
10 import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem'; 10 import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem';
11 import { FollowListItem } from '../viewmodel/FollowListItem'; 11 import { FollowListItem } from '../viewmodel/FollowListItem';
@@ -13,6 +13,9 @@ import { MineFollowListItem } from '../viewmodel/MineFollowListItem'; @@ -13,6 +13,9 @@ import { MineFollowListItem } from '../viewmodel/MineFollowListItem';
13 import { QueryListIsFollowedItem } from '../viewmodel/QueryListIsFollowedItem'; 13 import { QueryListIsFollowedItem } from '../viewmodel/QueryListIsFollowedItem';
14 import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem'; 14 import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem';
15 import { MineCommentListDetailItem } from '../viewmodel/MineCommentListDetailItem'; 15 import { MineCommentListDetailItem } from '../viewmodel/MineCommentListDetailItem';
  16 +import { MineUserLevelItem } from '../viewmodel/MineUserLevelItem';
  17 +import { MineUserDetailItem } from '../viewmodel/MineUserDetailItem';
  18 +import { OtherUserDetailRequestItem } from '../viewmodel/OtherUserDetailRequestItem';
16 19
17 const TAG = "MinePageDatasModel" 20 const TAG = "MinePageDatasModel"
18 21
@@ -337,6 +340,163 @@ class MinePageDatasModel{ @@ -337,6 +340,163 @@ class MinePageDatasModel{
337 return compRes.data 340 return compRes.data
338 } 341 }
339 342
  343 + /**
  344 + * 个人中心 获取用户等级
  345 + */
  346 + getUserLevelData(context: Context): Promise<MineUserLevelItem> {
  347 + return new Promise<MineUserLevelItem>((success, error) => {
  348 + Logger.info(TAG, `getAppointmentList start`);
  349 + this.fetchMineUserLevelData().then((navResDTO: ResponseDTO<MineUserLevelItem>) => {
  350 + if (!navResDTO || navResDTO.code != 0) {
  351 + success(this.getMineUserLevelDataLocal(context))
  352 + return
  353 + }
  354 + Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
  355 + let navigationBean = navResDTO.data as MineUserLevelItem
  356 + success(navigationBean);
  357 + }).catch((err: Error) => {
  358 + Logger.error(TAG, `fetchMineUserLevelData catch, error.name : ${err.name}, error.message:${err.message}`);
  359 + success(this.getMineUserLevelDataLocal(context))
  360 + })
  361 + })
  362 + }
  363 +
  364 + fetchMineUserLevelData() {
  365 + let url = HttpUrlUtils.getMineUserLevelDataUrl()
  366 + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
  367 + return WDHttp.get<ResponseDTO<MineUserLevelItem>>(url, headers)
  368 + };
  369 +
  370 + async getMineUserLevelDataLocal(context: Context): Promise<MineUserLevelItem> {
  371 + Logger.info(TAG, `getMineUserLevelDataLocal start`);
  372 + let compRes: ResponseDTO<MineUserLevelItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserLevelItem>>(context,'mine_user_level.json' );
  373 + if (!compRes || !compRes.data) {
  374 + Logger.info(TAG, `getMineUserLevelDataLocal compRes is empty`);
  375 + return new MineUserLevelItem()
  376 + }
  377 + Logger.info(TAG, `getMineUserLevelDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  378 + return compRes.data
  379 + }
  380 +
  381 + /**
  382 + * 个人中心 获取用户详细信息
  383 + */
  384 + getUserDetailData(context: Context): Promise<MineUserDetailItem> {
  385 + return new Promise<MineUserDetailItem>((success, error) => {
  386 + Logger.info(TAG, `getAppointmentList start`);
  387 + this.fetchMineUserDetailData().then((navResDTO: ResponseDTO<MineUserDetailItem>) => {
  388 + if (!navResDTO || navResDTO.code != 0) {
  389 + success(this.getMineUserDetailDataLocal(context))
  390 + return
  391 + }
  392 + Logger.info(TAG, "getUserDetailData then,timeStamp:" + navResDTO.timestamp);
  393 + let navigationBean = navResDTO.data as MineUserDetailItem
  394 + success(navigationBean);
  395 + }).catch((err: Error) => {
  396 + Logger.error(TAG, `fetchMineUserDetailData catch, error.name : ${err.name}, error.message:${err.message}`);
  397 + success(this.getMineUserDetailDataLocal(context))
  398 + })
  399 + })
  400 + }
  401 +
  402 + fetchMineUserDetailData() {
  403 + let url = HttpUrlUtils.getMineUserDetailDataUrl()
  404 + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
  405 + return WDHttp.get<ResponseDTO<MineUserDetailItem>>(url, headers)
  406 + };
  407 +
  408 + async getMineUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> {
  409 + Logger.info(TAG, `getMineUserLevelDataLocal start`);
  410 + let compRes: ResponseDTO<MineUserDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserDetailItem>>(context,'mine_user_detail.json' );
  411 + if (!compRes || !compRes.data) {
  412 + Logger.info(TAG, `getMineUserDetailDataLocal compRes is empty`);
  413 + return new MineUserDetailItem()
  414 + }
  415 + Logger.info(TAG, `getMineUserDetailDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  416 + return compRes.data
  417 + }
  418 + /**
  419 + * 个人中心 获取其他用户详细信息
  420 + */
  421 + getOtherUserDetailData(item:OtherUserDetailRequestItem,context: Context): Promise<MineUserDetailItem> {
  422 + return new Promise<MineUserDetailItem>((success, error) => {
  423 + Logger.info(TAG, `getAppointmentList start`);
  424 + this.fetchOtherUserDetailData(item).then((navResDTO: ResponseDTO<MineUserDetailItem>) => {
  425 + if (!navResDTO || navResDTO.code != 0) {
  426 + success(this.getOtherUserDetailDataLocal(context))
  427 + return
  428 + }
  429 + Logger.info(TAG, "getUserDetailData then,timeStamp:" + navResDTO.timestamp);
  430 + let navigationBean = navResDTO.data as MineUserDetailItem
  431 + success(navigationBean);
  432 + }).catch((err: Error) => {
  433 + Logger.error(TAG, `fetchMineUserDetailData catch, error.name : ${err.name}, error.message:${err.message}`);
  434 + success(this.getOtherUserDetailDataLocal(context))
  435 + })
  436 + })
  437 + }
  438 +
  439 + fetchOtherUserDetailData(item:OtherUserDetailRequestItem) {
  440 + let url = HttpUrlUtils.getOtherUserDetailDataUrl()
  441 + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
  442 + return WDHttp.post<ResponseDTO<MineUserDetailItem>>(url, item,headers)
  443 + };
  444 +
  445 + async getOtherUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> {
  446 + Logger.info(TAG, `getMineUserLevelDataLocal start`);
  447 + let compRes: ResponseDTO<MineUserDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserDetailItem>>(context,'other_user512157124138245_detail.json' );
  448 + if (!compRes || !compRes.data) {
  449 + Logger.info(TAG, `getMineUserDetailDataLocal compRes is empty`);
  450 + return new MineUserDetailItem()
  451 + }
  452 + Logger.info(TAG, `getMineUserDetailDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  453 + return compRes.data
  454 + }
  455 +
  456 + /**
  457 + * 个人中心 获取其他用户等级
  458 + */
  459 + getOtherUserLevelData(item:string[],context: Context): Promise<MineUserLevelItem[]> {
  460 + return new Promise<MineUserLevelItem[]>((success, error) => {
  461 + Logger.info(TAG, `getAppointmentList start`);
  462 + this.fetchOtherUserLevelData(item).then((navResDTO: ResponseDTO<MineUserLevelItem[]>) => {
  463 + if (!navResDTO || navResDTO.code != 0) {
  464 + success(this.getOtherUserLevelDataLocal(context))
  465 + return
  466 + }
  467 + Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
  468 + let navigationBean = navResDTO.data as MineUserLevelItem[]
  469 + if(navigationBean.length>0 && StringUtils.isNotEmpty(navigationBean[0].levelHead)){
  470 + success(navigationBean);
  471 + }else{
  472 + success(this.getOtherUserLevelDataLocal(context))
  473 + }
  474 + }).catch((err: Error) => {
  475 + Logger.error(TAG, `fetchMineUserLevelData catch, error.name : ${err.name}, error.message:${err.message}`);
  476 + success(this.getOtherUserLevelDataLocal(context))
  477 + })
  478 + })
  479 + }
  480 +
  481 + fetchOtherUserLevelData(item:string[]) {
  482 + let url = HttpUrlUtils.getOtherUserLevelDataUrl()
  483 + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
  484 + return WDHttp.post<ResponseDTO<MineUserLevelItem[]>>(url,item, headers)
  485 + };
  486 +
  487 + async getOtherUserLevelDataLocal(context: Context): Promise<MineUserLevelItem[]> {
  488 + Logger.info(TAG, `getMineUserLevelDataLocal start`);
  489 + let compRes: ResponseDTO<MineUserLevelItem[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineUserLevelItem[]>>(context,'other_user512157124138245_level.json' );
  490 + if (!compRes || !compRes.data) {
  491 + Logger.info(TAG, `getMineUserLevelDataLocal compRes is empty`);
  492 + return []
  493 + }
  494 + Logger.info(TAG, `getMineUserLevelDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  495 + return compRes.data
  496 + }
  497 +
  498 +
  499 +
340 500
341 } 501 }
342 502
1 import router from '@ohos.router' 1 import router from '@ohos.router'
  2 +import { Params } from 'wdBean';
  3 +import { StringUtils } from 'wdKit';
2 import { WDRouterPage, WDRouterRule } from 'wdRouter'; 4 import { WDRouterPage, WDRouterRule } from 'wdRouter';
3 import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent'; 5 import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent';
  6 +import MinePageDatasModel from '../model/MinePageDatasModel';
  7 +
  8 +const TAG = "MineHomePage"
4 9
5 @Entry 10 @Entry
6 @Component 11 @Component
7 struct MineHomePage { 12 struct MineHomePage {
8 @State tileOpacity: number = 0; 13 @State tileOpacity: number = 0;
9 firstPositionY:number = 0; 14 firstPositionY:number = 0;
10 - @State isHasIntroduction: boolean = true  
11 - @State desc:string = "点击添加简介,让大家认识你" //text 搞两个样式,如果三行,就显示 另外一个text 没有显示高度的  
12 fontColor: string = '#999999' 15 fontColor: string = '#999999'
13 selectedFontColor: string = '#000000' 16 selectedFontColor: string = '#000000'
14 @State currentIndex: number = 0 17 @State currentIndex: number = 0
15 private controller: TabsController = new TabsController() 18 private controller: TabsController = new TabsController()
16 isChangeToUserEdit = false; 19 isChangeToUserEdit = false;
  20 + @State userName:string = ""
  21 + @State headPhotoUrl:string = ""
  22 + @State levelHead:string = ""
  23 + @State levelId:number = 0
  24 + @State desc:string = "点击添加简介,让大家认识你" //text 搞两个样式,如果三行,就显示 另外一个text 没有显示高度的
  25 + @State isHasIntroduction: boolean = false
  26 + @State browseNum:number = 0//阅读数
  27 + @State commentNum:number = 0//评论数
  28 + @State attentionNum:number = 0//关注数
  29 + registTime:number = 0//账号注册时间
  30 + @State registerTimeForDay:number = 0
  31 +
  32 + aboutToAppear(){
  33 + this.getUserInfo()
  34 + this.getUserLevel()
  35 + }
  36 +
17 37
18 38
19 build() { 39 build() {
@@ -33,15 +53,28 @@ struct MineHomePage { @@ -33,15 +53,28 @@ struct MineHomePage {
33 Column() { 53 Column() {
34 //用户信息区域 54 //用户信息区域
35 Row() { 55 Row() {
36 - Image($r('app.media.default_head')) 56 + Stack(){
  57 + Image(this.headPhotoUrl)
  58 + .alt($r('app.media.default_head'))
37 .width('115lpx') 59 .width('115lpx')
38 .height('115lpx') 60 .height('115lpx')
39 .objectFit(ImageFit.Cover) 61 .objectFit(ImageFit.Cover)
40 .borderRadius(50) 62 .borderRadius(50)
  63 + Image(this.levelHead)
  64 + .width('130lpx')
  65 + .height('130lpx')
  66 + .objectFit(ImageFit.Cover)
  67 + .borderRadius(50)
  68 + }.onClick(()=>{
  69 + let params: Params = {
  70 + pageID: "-1"
  71 + }
  72 + WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
  73 + })
41 74
42 Column() { 75 Column() {
43 Row() { 76 Row() {
44 - Text("人民日报6G") 77 + Text(`${this.userName}`)
45 .fontColor($r('app.color.white')) 78 .fontColor($r('app.color.white'))
46 .maxLines(1) 79 .maxLines(1)
47 .textOverflow({ overflow: TextOverflow.Ellipsis }) 80 .textOverflow({ overflow: TextOverflow.Ellipsis })
@@ -49,7 +82,7 @@ struct MineHomePage { @@ -49,7 +82,7 @@ struct MineHomePage {
49 .lineHeight('50lpx') 82 .lineHeight('50lpx')
50 .fontWeight('500lpx') 83 .fontWeight('500lpx')
51 84
52 - Text("等级8") 85 + Text(`等级${this.levelId}`)
53 .textAlign(TextAlign.Center) 86 .textAlign(TextAlign.Center)
54 .fontColor($r('app.color.color_ED2800')) 87 .fontColor($r('app.color.color_ED2800'))
55 .backgroundColor($r('app.color.white')) 88 .backgroundColor($r('app.color.white'))
@@ -62,7 +95,7 @@ struct MineHomePage { @@ -62,7 +95,7 @@ struct MineHomePage {
62 95
63 Row() { 96 Row() {
64 Row() { 97 Row() {
65 - Text("3.6万") 98 + Text(`${this.browseNum}`)
66 .textStyle() 99 .textStyle()
67 Text("阅读") 100 Text("阅读")
68 .textStyle2() 101 .textStyle2()
@@ -76,7 +109,7 @@ struct MineHomePage { @@ -76,7 +109,7 @@ struct MineHomePage {
76 .vertical(true) 109 .vertical(true)
77 .opacity(0.4) 110 .opacity(0.4)
78 Row() { 111 Row() {
79 - Text("6242") 112 + Text(`${this.commentNum}`)
80 .textStyle() 113 .textStyle()
81 Text("评论") 114 Text("评论")
82 .textStyle2() 115 .textStyle2()
@@ -89,7 +122,7 @@ struct MineHomePage { @@ -89,7 +122,7 @@ struct MineHomePage {
89 .vertical(true) 122 .vertical(true)
90 .opacity(0.4) 123 .opacity(0.4)
91 Row() { 124 Row() {
92 - Text("86") 125 + Text(`${this.attentionNum}`)
93 .textStyle() 126 .textStyle()
94 Text("关注") 127 Text("关注")
95 .textStyle2() 128 .textStyle2()
@@ -132,7 +165,7 @@ struct MineHomePage { @@ -132,7 +165,7 @@ struct MineHomePage {
132 .objectFit(ImageFit.Auto) 165 .objectFit(ImageFit.Auto)
133 } 166 }
134 } 167 }
135 - Text("来到人民日报365天") 168 + Text(`来到人民日报${this.registerTimeForDay}天`)
136 .fontSize('23lpx') 169 .fontSize('23lpx')
137 .lineHeight('25lpx') 170 .lineHeight('25lpx')
138 .fontWeight('400lpx') 171 .fontWeight('400lpx')
@@ -233,11 +266,13 @@ struct MineHomePage { @@ -233,11 +266,13 @@ struct MineHomePage {
233 .onClick(() => { 266 .onClick(() => {
234 router.back() 267 router.back()
235 }) 268 })
236 - Image($r('app.media.default_head')) 269 + Image(`${this.headPhotoUrl}`)
  270 + .alt($r('app.media.default_head'))
237 .width('60lpx') 271 .width('60lpx')
238 .height('60lpx') 272 .height('60lpx')
239 .objectFit(ImageFit.Auto) 273 .objectFit(ImageFit.Auto)
240 .id("head_icon") 274 .id("head_icon")
  275 + .borderRadius(50)
241 .alignRules({ 276 .alignRules({
242 center: { anchor: "__container__", align: VerticalAlign.Center }, 277 center: { anchor: "__container__", align: VerticalAlign.Center },
243 left: { anchor: "back_icon", align: HorizontalAlign.End } 278 left: { anchor: "back_icon", align: HorizontalAlign.End }
@@ -247,7 +282,7 @@ struct MineHomePage { @@ -247,7 +282,7 @@ struct MineHomePage {
247 router.back() 282 router.back()
248 }) 283 })
249 284
250 - Text("我的昵称") 285 + Text(`${this.userName}`)
251 .height('42lpx') 286 .height('42lpx')
252 .maxLines(1) 287 .maxLines(1)
253 .id("title") 288 .id("title")
@@ -326,6 +361,41 @@ struct MineHomePage { @@ -326,6 +361,41 @@ struct MineHomePage {
326 WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage) 361 WDRouterRule.jumpWithPage(WDRouterPage.editUserInfoPage)
327 } 362 }
328 } 363 }
  364 + getUserInfo(){
  365 + MinePageDatasModel.getUserDetailData(getContext(this)).then((value)=>{
  366 + if(value!=null){
  367 + this.userName = value.userName
  368 + this.headPhotoUrl = value.headPhotoUrl
  369 + if(StringUtils.isNotEmpty(value.introduction)){
  370 + this.desc = value.introduction
  371 + this.isHasIntroduction = true
  372 + }
  373 + this.browseNum = value.browseNum
  374 + this.commentNum = value.commentNum
  375 + this.attentionNum = value.attentionNum
  376 + this.registTime = value.registTime
  377 + this.getRegisterDays()
  378 + }
  379 + }).catch((err:Error)=>{
  380 + console.log(TAG,JSON.stringify(err))
  381 + })
  382 + }
  383 + getUserLevel(){
  384 + MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{
  385 + if(value!=null){
  386 + this.levelHead = value.levelHead
  387 + this.levelId = value.levelId
  388 + }
  389 + }).catch((err:Error)=>{
  390 + console.log(TAG,JSON.stringify(err))
  391 + })
  392 + }
  393 + getRegisterDays(){
  394 + if(this.registTime!=null){
  395 + let curDate = new Date()
  396 + this.registerTimeForDay = Math.ceil((curDate.getTime()-this.registTime)/(1000*60*60*24))
  397 + }
  398 + }
329 399
330 } 400 }
331 401
  1 +import router from '@ohos.router'
  2 +import { Params } from 'wdBean';
  3 +import { StringUtils } from 'wdKit';
  4 +import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent';
  5 +import MinePageDatasModel from '../model/MinePageDatasModel';
  6 +import { OtherUserDetailRequestItem } from '../viewmodel/OtherUserDetailRequestItem';
  7 +
  8 +const TAG = "OtherNormalUserHomePage"
  9 +
  10 +@Entry
  11 +@Component
  12 +struct OtherNormalUserHomePage {
  13 + @State params:Params = router.getParams() as Params;
  14 + @State curUserId: string = '-1';
  15 +
  16 + onPageShow() {
  17 + this.curUserId = this.params?.pageID;
  18 + }
  19 +
  20 + @State tileOpacity: number = 0;
  21 + firstPositionY:number = 0;
  22 + fontColor: string = '#999999'
  23 + selectedFontColor: string = '#000000'
  24 + @State currentIndex: number = 0
  25 + private controller: TabsController = new TabsController()
  26 + isChangeToUserEdit = false;
  27 + @State userName:string = ""
  28 + @State headPhotoUrl:string = ""
  29 + @State levelHead:string = ""
  30 + @State levelId:number = 0
  31 + @State browseNum:number = 0//阅读数
  32 + @State commentNum:number = 0//评论数
  33 + @State attentionNum:number = 0//关注数
  34 +
  35 + aboutToAppear(){
  36 + this.getUserInfo()
  37 + this.getUserLevel()
  38 + }
  39 +
  40 +
  41 +
  42 + build() {
  43 + Stack({ alignContent: Alignment.Top }){
  44 + Image($r('app.media.title_bg'))
  45 + .width('100%')
  46 + .height('355lpx')
  47 + .objectFit(ImageFit.Cover)
  48 +
  49 + Column(){
  50 + Stack({ alignContent: Alignment.Top }){
  51 + this.MineHomeTitleTransparent()
  52 + this.MineHomeTitleWhite()
  53 + }
  54 +
  55 + Scroll() {
  56 + Column() {
  57 + //用户信息区域
  58 + Row() {
  59 + Stack(){
  60 + Image(this.headPhotoUrl)
  61 + .alt($r('app.media.default_head'))
  62 + .width('115lpx')
  63 + .height('115lpx')
  64 + .objectFit(ImageFit.Cover)
  65 + .borderRadius(50)
  66 + Image(this.levelHead)
  67 + .width('130lpx')
  68 + .height('130lpx')
  69 + .objectFit(ImageFit.Cover)
  70 + .borderRadius(50)
  71 + }
  72 +
  73 + Column() {
  74 + Row() {
  75 + Text(`${this.userName}`)
  76 + .fontColor($r('app.color.white'))
  77 + .maxLines(1)
  78 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  79 + .fontSize('38lpx')
  80 + .lineHeight('50lpx')
  81 + .fontWeight('500lpx')
  82 +
  83 + Text(`等级${this.levelId}`)
  84 + .textAlign(TextAlign.Center)
  85 + .fontColor($r('app.color.color_ED2800'))
  86 + .backgroundColor($r('app.color.white'))
  87 + .fontSize('19lpx')
  88 + .width('96lpx')
  89 + .height('35lpx')
  90 + .margin({ left: '10lpx' })
  91 + Blank()
  92 + }.width('507lpx')
  93 +
  94 + Row() {
  95 + Row() {
  96 + Text(`${this.browseNum}`)
  97 + .textStyle()
  98 + Text("阅读")
  99 + .textStyle2()
  100 + }
  101 + .margin({ right: '15lpx' })
  102 +
  103 + Divider()
  104 + .height('19lpx')
  105 + .width('2lpx')
  106 + .color($r('app.color.white'))
  107 + .vertical(true)
  108 + .opacity(0.4)
  109 + Row() {
  110 + Text(`${this.commentNum}`)
  111 + .textStyle()
  112 + Text("评论")
  113 + .textStyle2()
  114 + }.margin({ right: '15lpx', left: '15lpx' })
  115 +
  116 + Divider()
  117 + .height('19lpx')
  118 + .width('2lpx')
  119 + .color($r('app.color.white'))
  120 + .vertical(true)
  121 + .opacity(0.4)
  122 + Row() {
  123 + Text(`${this.attentionNum}`)
  124 + .textStyle()
  125 + Text("关注")
  126 + .textStyle2()
  127 + }.margin({ left: '15lpx' })
  128 + }.margin({ top: '23lpx' })
  129 + }.alignItems(HorizontalAlign.Start)
  130 + .margin({ left: '32lpx' })
  131 + }
  132 + .onAreaChange((oldValue: Area, newValue: Area) => {
  133 + if (this.firstPositionY === 0) {
  134 + this.firstPositionY = newValue.globalPosition.y as number
  135 + }else{
  136 + let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3)
  137 + if(persent > 1){
  138 + persent = 1
  139 + }
  140 + this.tileOpacity = persent
  141 + }
  142 + })
  143 + .backgroundColor($r('app.color.color_transparent'))
  144 + .height('184lpx')
  145 + .width('100%')
  146 + .padding({ left: '35lpx' })
  147 +
  148 + //间隔符
  149 +
  150 + Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
  151 +
  152 + //tab 页面
  153 + Tabs({controller: this.controller}) {
  154 + TabContent() {
  155 + HomePageBottomComponent({style:0})
  156 + }.tabBar(this.TabBuilder(0,"评论"))
  157 + TabContent() {
  158 + HomePageBottomComponent({style:1})
  159 + }.tabBar(this.TabBuilder(1,"关注"))
  160 + }
  161 + .backgroundColor($r('app.color.white'))
  162 + .animationDuration(0)
  163 + .onChange((index: number) => {
  164 + this.currentIndex = index
  165 + })
  166 + .vertical(false)
  167 + .height("100%")
  168 + }.width("100%")
  169 + }
  170 + .edgeEffect(EdgeEffect.None)
  171 + .scrollBar(BarState.Off)
  172 + .width('100%')
  173 + .height('100%')
  174 + }
  175 + }.width('100%')
  176 + .height('100%')
  177 +
  178 + }
  179 + @Builder MineHomeTitleTransparent() {
  180 + RelativeContainer() {
  181 + //标题栏目
  182 + Image($r('app.media.icon_arrow_left_white') )
  183 + .width('46lpx')
  184 + .height('46lpx')
  185 + .objectFit(ImageFit.Auto)
  186 + .id("back_icon")
  187 + .alignRules({
  188 + center: { anchor: "__container__", align: VerticalAlign.Center },
  189 + left: { anchor: "__container__", align: HorizontalAlign.Start }
  190 + })
  191 + .margin({ left: '31lpx' })
  192 + .onClick(() => {
  193 + router.back()
  194 + })
  195 + }
  196 + .visibility(this.tileOpacity > 0 ? 1 : 0)
  197 + .height('84lpx')
  198 + .width('100%')
  199 + .backgroundColor($r('app.color.color_transparent'))
  200 + }
  201 +
  202 + @Builder MineHomeTitleWhite() {
  203 + RelativeContainer() {
  204 + //标题栏目
  205 + Image($r('app.media.back_icon'))
  206 + .width('46lpx')
  207 + .height('46lpx')
  208 + .objectFit(ImageFit.Auto)
  209 + .id("back_icon")
  210 + .alignRules({
  211 + center: { anchor: "__container__", align: VerticalAlign.Center },
  212 + left: { anchor: "__container__", align: HorizontalAlign.Start }
  213 + })
  214 + .margin({ left: '31lpx' })
  215 + .onClick(() => {
  216 + router.back()
  217 + })
  218 + Image(this.headPhotoUrl)
  219 + .alt($r('app.media.default_head'))
  220 + .width('60lpx')
  221 + .height('60lpx')
  222 + .borderRadius(50)
  223 + .objectFit(ImageFit.Auto)
  224 + .id("head_icon")
  225 + .alignRules({
  226 + center: { anchor: "__container__", align: VerticalAlign.Center },
  227 + left: { anchor: "back_icon", align: HorizontalAlign.End }
  228 + })
  229 + .margin({ left: '31lpx' })
  230 + .onClick(() => {
  231 + router.back()
  232 + })
  233 +
  234 + Text(`${this.userName}`)
  235 + .height('42lpx')
  236 + .maxLines(1)
  237 + .id("title")
  238 + .fontSize('35lpx')
  239 + .fontWeight('400lpx')
  240 + .fontColor($r('app.color.color_222222'))
  241 + .lineHeight('42lpx')
  242 + .alignRules({
  243 + center: { anchor: "__container__", align: VerticalAlign.Center },
  244 + left: { anchor: "head_icon", align: HorizontalAlign.End }
  245 + })
  246 + .margin({ left: '12lpx' })
  247 + }
  248 + .visibility(this.tileOpacity > 0 ? 0 : 1)
  249 + .height('84lpx')
  250 + .width('100%')
  251 + .backgroundColor($r('app.color.white'))
  252 + .opacity(this.tileOpacity )
  253 +
  254 + }
  255 +
  256 + @Builder TabBuilder(index: number, title: string) {
  257 + Stack(){
  258 + Text(title)
  259 + .height('38lpx')
  260 + .fontSize('33lpx')
  261 + .fontWeight(this.currentIndex === index ? 600 : 400)
  262 + .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor)
  263 + .lineHeight('38lpx')
  264 +
  265 + if(this.currentIndex === index){
  266 + Divider()
  267 + .width('31lpx')
  268 + .height('4lpx')
  269 + .color('#ED2800')
  270 + .strokeWidth('4lpx')
  271 + .margin({top:'50lpx'})
  272 + .id("divTag")
  273 + }
  274 + }.onClick(()=>{
  275 + this.currentIndex = index
  276 + this.controller.changeIndex(this.currentIndex)
  277 + })
  278 + .height('100%')
  279 + .width('100%')
  280 + .margin({right:'9lpx'})
  281 + }
  282 +
  283 +
  284 + getUserInfo(){
  285 + let item = new OtherUserDetailRequestItem("","1",this.curUserId)
  286 + MinePageDatasModel.getOtherUserDetailData(item,getContext(this)).then((value)=>{
  287 + if(value!=null){
  288 + this.userName = value.userName
  289 + this.headPhotoUrl = value.headPhotoUrl
  290 +
  291 + this.browseNum = StringUtils.isEmpty(value.browseNum)?0:value.browseNum
  292 + this.commentNum = StringUtils.isEmpty(value.commentNum)?0:value.commentNum
  293 + this.attentionNum = StringUtils.isEmpty(value.attentionNum)?0:value.attentionNum
  294 + }
  295 + }).catch((err:Error)=>{
  296 + console.log(TAG,JSON.stringify(err))
  297 + })
  298 + }
  299 + getUserLevel(){
  300 + MinePageDatasModel.getOtherUserLevelData([this.curUserId],getContext(this)).then((value)=>{
  301 + if(value!=null){
  302 + this.levelHead = value[0].levelHead
  303 + this.levelId = value[0].level
  304 + }
  305 + }).catch((err:Error)=>{
  306 + console.log(TAG,JSON.stringify(err))
  307 + })
  308 + }
  309 +
  310 +}
  311 +
  312 +@Extend(Text) function textStyle() {
  313 + .fontColor($r('app.color.white'))
  314 + .textStyleDefault()
  315 + .margin({ right: '10lpx' })
  316 +}
  317 +
  318 +@Extend(Text) function textStyle2() {
  319 + .textStyleDefault()
  320 + .fontColor($r('app.color.color_B2FFFFFF'))
  321 +}
  322 +
  323 +@Extend(Text) function textStyleDefault() {
  324 + .textAlign(TextAlign.Start)
  325 + .fontSize('23lpx')
  326 + .fontWeight('400lpx')
  327 + .lineHeight('31lpx')
  328 +}
  329 +
  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 +}
  1 +
  2 +export class MineUserLevelItem{
  3 + levelHead:string = ""
  4 + levelId:number = 0
  5 + level:number = 0
  6 + levelName:string = ""
  7 +
  8 +}
  1 +export class OtherUserDetailRequestItem {
  2 + creatorId: string = ""
  3 + userType: string = "1"
  4 + userId: string = "-1"
  5 +
  6 + constructor(creatorId: string ,
  7 + userType: string,
  8 + userId: string ) {
  9 + this.creatorId = creatorId
  10 + this.userType = userType
  11 + this.userId = userId
  12 + }
  13 +
  14 +}
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 "components/page/EditUserNikeNamePage", 11 "components/page/EditUserNikeNamePage",
12 "components/page/EditUserIntroductionPage", 12 "components/page/EditUserIntroductionPage",
13 "components/page/BrowsingHistoryPage", 13 "components/page/BrowsingHistoryPage",
14 - "components/page/MyCollectionListPage" 14 + "components/page/MyCollectionListPage",
  15 + "pages/OtherNormalUserHomePage"
15 ] 16 ]
16 } 17 }
  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 +}
  1 +{
  2 + "code": "0",
  3 + "data": {
  4 + "articleCreation": 0,
  5 + "attentionNum": 1,
  6 + "authIcon": "",
  7 + "authId": 0,
  8 + "authPersonal": "",
  9 + "authTitle": "",
  10 + "avatarFrame": "",
  11 + "banControl": 0,
  12 + "browseNum": 76,
  13 + "categoryAuth": "",
  14 + "city": "",
  15 + "cnContentPublish": 0,
  16 + "cnIsComment": 0,
  17 + "cnIsLike": 0,
  18 + "cnLiveCommentControl": 0,
  19 + "cnLiveGiftControl": 0,
  20 + "cnLiveLikeControl": 0,
  21 + "cnLivePublish": 0,
  22 + "cnLiveShareControl": 0,
  23 + "cnShareControl": 0,
  24 + "contentPublish": 0,
  25 + "creatorId": "",
  26 + "district": "",
  27 + "dynamicControl": 0,
  28 + "dynamicCreation": 0,
  29 + "fansNum": 0,
  30 + "headPhotoUrl": "https://sitcontentjdcdn.aikan.pdnews.cn/null20240127/1630371072/1706336907262.jpg",
  31 + "honoraryIcon": "",
  32 + "honoraryTitle": "",
  33 + "introduction": "",
  34 + "isAttention": 0,
  35 + "isComment": 0,
  36 + "isLike": 0,
  37 + "liveCommentControl": 0,
  38 + "liveGiftControl": 0,
  39 + "liveLikeControl": 0,
  40 + "livePublish": 0,
  41 + "liveShareControl": 0,
  42 + "liveSwitch": 0,
  43 + "mainControl": 1,
  44 + "originUserId": "",
  45 + "pictureCollectionCreation": 0,
  46 + "posterShareControl": 1,
  47 + "province": "",
  48 + "region": "安徽省",
  49 + "registTime": 1703485580000,
  50 + "shareControl": 0,
  51 + "shareUrl": "",
  52 + "subjectType": 0,
  53 + "userId": "512157124138245",
  54 + "userName": "树下🍑 1122334",
  55 + "userType": "1",
  56 + "videoCollectionCreation": 0,
  57 + "videoCreation": 0
  58 + },
  59 + "message": "Success",
  60 + "meta": null,
  61 + "requestId": "",
  62 + "success": true,
  63 + "timestamp": 1711440875633
  64 +}
  1 +{
  2 + "code": "0",
  3 + "data": [
  4 + {
  5 + "level": 2,
  6 + "levelHead": "http://rmrb-video-content-sit.oss-cn-beijing.aliyuncs.com/sjbj-20240125/image/display/88c45bf56ac941b883c69bd8ed373164.png",
  7 + "userId": 512157124138245
  8 + }
  9 + ],
  10 + "message": "Success",
  11 + "success": true,
  12 + "timestamp": 1711440876088
  13 +}