Merge remote-tracking branch 'origin/main'
# Conflicts: # sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/CardSourceInfo.ets
Showing
14 changed files
with
494 additions
and
422 deletions
| @@ -133,10 +133,15 @@ export class NetworkManager { | @@ -133,10 +133,15 @@ export class NetworkManager { | ||
| 133 | * 同步获取网络类型,耗时 | 133 | * 同步获取网络类型,耗时 |
| 134 | */ | 134 | */ |
| 135 | public getNetTypeSync(): NetworkType { | 135 | public getNetTypeSync(): NetworkType { |
| 136 | - let netHandle = connection.getDefaultNetSync(); | ||
| 137 | - let netCapabilities = connection.getNetCapabilitiesSync(netHandle) | ||
| 138 | - this.reset(netCapabilities.bearerTypes) | ||
| 139 | - return this.networkType; | 136 | + try { |
| 137 | + let netHandle = connection.getDefaultNetSync(); | ||
| 138 | + let netCapabilities = connection.getNetCapabilitiesSync(netHandle) | ||
| 139 | + this.reset(netCapabilities.bearerTypes) | ||
| 140 | + return this.networkType; | ||
| 141 | + } catch (e) { | ||
| 142 | + Logger.error(TAG, 'getNetTypeSync e: ' + JSON.stringify(e)) | ||
| 143 | + } | ||
| 144 | + return NetworkType.TYPE_UNKNOWN | ||
| 140 | } | 145 | } |
| 141 | 146 | ||
| 142 | private parseData(data: connection.NetCapabilityInfo) { | 147 | private parseData(data: connection.NetCapabilityInfo) { |
| @@ -43,7 +43,7 @@ export class NetworkUtil { | @@ -43,7 +43,7 @@ export class NetworkUtil { | ||
| 43 | */ | 43 | */ |
| 44 | static isNetConnected(): boolean { | 44 | static isNetConnected(): boolean { |
| 45 | let type = NetworkManager.getInstance().getNetType() | 45 | let type = NetworkManager.getInstance().getNetType() |
| 46 | - if (type == NetworkType.TYPE_NONE) { | 46 | + if (type == NetworkType.TYPE_UNKNOWN || type == NetworkType.TYPE_NONE) { |
| 47 | return false | 47 | return false |
| 48 | } | 48 | } |
| 49 | return true | 49 | return true |
| @@ -28,13 +28,19 @@ export struct CardSourceInfo { | @@ -28,13 +28,19 @@ export struct CardSourceInfo { | ||
| 28 | .maxLines(1) | 28 | .maxLines(1) |
| 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 30 | } | 30 | } |
| 31 | - if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName && | ||
| 32 | - this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) && | ||
| 33 | - (this.getContentDtoBean()?.interactData?.commentNum || | ||
| 34 | - DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != '')) { | 31 | + if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName && this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) && (this.getContentDtoBean()?.interactData?.commentNum |
| 32 | + // || DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)) != '' | ||
| 33 | + || (this.contentDTO.isSearch || this.contentDTO.isCollection || | ||
| 34 | + !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | ||
| 35 | + (Number | ||
| 36 | + .parseFloat(this | ||
| 37 | + .contentDTO.publishTime)) | ||
| 38 | + .indexOf | ||
| 39 | + ('-') === -1) | ||
| 40 | + )) { | ||
| 35 | Image($r("app.media.point")) | 41 | Image($r("app.media.point")) |
| 36 | - .width(16) | ||
| 37 | - .height(16) | 42 | + .width(11) |
| 43 | + .height(11) | ||
| 38 | } | 44 | } |
| 39 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | 45 | // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 |
| 40 | // if (this.contentDTO.isSearch || this.contentDTO.isCollection || | 46 | // if (this.contentDTO.isSearch || this.contentDTO.isCollection || |
| @@ -54,6 +54,7 @@ export struct Card9Component { | @@ -54,6 +54,7 @@ export struct Card9Component { | ||
| 54 | .maxLines(2) | 54 | .maxLines(2) |
| 55 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 55 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 56 | .margin({ top: 10, bottom: 10 }) | 56 | .margin({ top: 10, bottom: 10 }) |
| 57 | + .fontWeight(400) | ||
| 57 | } | 58 | } |
| 58 | // 大图 | 59 | // 大图 |
| 59 | Stack() { | 60 | Stack() { |
| @@ -17,10 +17,10 @@ export struct ZhSingleRow04 { | @@ -17,10 +17,10 @@ export struct ZhSingleRow04 { | ||
| 17 | //顶部 | 17 | //顶部 |
| 18 | Row() { | 18 | Row() { |
| 19 | Row() { | 19 | Row() { |
| 20 | - Image($r("app.media.local_selection")) | ||
| 21 | - .width(24) | ||
| 22 | - .height(24) | ||
| 23 | - .margin({ right: 4 }) | 20 | + // Image($r("app.media.local_selection")) |
| 21 | + // .width(24) | ||
| 22 | + // .height(24) | ||
| 23 | + // .margin({ right: 4 }) | ||
| 24 | Text(this.compDTO.objectTitle) | 24 | Text(this.compDTO.objectTitle) |
| 25 | .fontSize($r("app.float.font_size_17")) | 25 | .fontSize($r("app.float.font_size_17")) |
| 26 | .fontColor($r("app.color.color_222222")) | 26 | .fontColor($r("app.color.color_222222")) |
| @@ -44,7 +44,7 @@ export struct ZhSingleRow06 { | @@ -44,7 +44,7 @@ export struct ZhSingleRow06 { | ||
| 44 | 44 | ||
| 45 | const commentInfo = this.compDTO.operDataList[0]?.commentInfo as commentInfo; | 45 | const commentInfo = this.compDTO.operDataList[0]?.commentInfo as commentInfo; |
| 46 | // commentLikeChange(this.item) | 46 | // commentLikeChange(this.item) |
| 47 | - this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; | 47 | + // this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; |
| 48 | const commentLikeParam = { | 48 | const commentLikeParam = { |
| 49 | targetId: commentInfo.newsId || '', | 49 | targetId: commentInfo.newsId || '', |
| 50 | id: commentInfo.commentId, | 50 | id: commentInfo.commentId, |
| @@ -52,8 +52,9 @@ export struct ZhSingleRow06 { | @@ -52,8 +52,9 @@ export struct ZhSingleRow06 { | ||
| 52 | api_status: this.newsStatusOfUser?.likeStatus == '1' ? false : true | 52 | api_status: this.newsStatusOfUser?.likeStatus == '1' ? false : true |
| 53 | } as commentItemModel; | 53 | } as commentItemModel; |
| 54 | commentViewModel.commentLike(commentLikeParam).then(() => { | 54 | commentViewModel.commentLike(commentLikeParam).then(() => { |
| 55 | - }).catch(() => { | ||
| 56 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; | 55 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser.likeStatus === '1' ? '0' : '1'; |
| 56 | + }).catch((err: Error) => { | ||
| 57 | + console.log('06-err', JSON.stringify(err)) | ||
| 57 | }) | 58 | }) |
| 58 | } | 59 | } |
| 59 | 60 |
| @@ -34,7 +34,7 @@ export struct ChildCommentComponent { | @@ -34,7 +34,7 @@ export struct ChildCommentComponent { | ||
| 34 | .borderRadius(50) | 34 | .borderRadius(50) |
| 35 | }.width('89lpx') | 35 | }.width('89lpx') |
| 36 | .height('89lpx') | 36 | .height('89lpx') |
| 37 | - .margin({ right: '15lpx' }) | 37 | + .margin({ right: '3lpx' }) |
| 38 | 38 | ||
| 39 | Column() { | 39 | Column() { |
| 40 | Text(this.data.fromUserName) | 40 | Text(this.data.fromUserName) |
| @@ -255,7 +255,7 @@ export struct PageComponent { | @@ -255,7 +255,7 @@ export struct PageComponent { | ||
| 255 | this.pageModel.channelId = this.channelId; | 255 | this.pageModel.channelId = this.channelId; |
| 256 | this.pageModel.currentPage = 1; | 256 | this.pageModel.currentPage = 1; |
| 257 | this.pageModel.pageTotalCompSize = 0; | 257 | this.pageModel.pageTotalCompSize = 0; |
| 258 | - // TODO PageHelper.getInitCacheData(this.pageModel, this.pageAdvModel) | 258 | + PageHelper.getInitCacheData(this.pageModel, this.pageAdvModel) |
| 259 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) | 259 | PageHelper.getInitData(this.pageModel, this.pageAdvModel) |
| 260 | }, 100) | 260 | }, 100) |
| 261 | } | 261 | } |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | -import { StringUtils } from 'wdKit'; | 2 | +import { NetworkUtil, StringUtils } from 'wdKit'; |
| 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 4 | import { editModelParams } from '../model/EditInfoModel'; | 4 | import { editModelParams } from '../model/EditInfoModel'; |
| 5 | import { HomePageBottomCommentComponent } from '../components/mine/home/HomePageBottomCommentComponent'; | 5 | import { HomePageBottomCommentComponent } from '../components/mine/home/HomePageBottomCommentComponent'; |
| 6 | import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageBottomFollowComponent'; | 6 | import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageBottomFollowComponent'; |
| 7 | import MinePageDatasModel from '../model/MinePageDatasModel'; | 7 | import MinePageDatasModel from '../model/MinePageDatasModel'; |
| 8 | +import { EmptyComponent } from '../components/view/EmptyComponent'; | ||
| 9 | +import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; | ||
| 8 | 10 | ||
| 9 | const TAG = "MineHomePage" | 11 | const TAG = "MineHomePage" |
| 10 | 12 | ||
| @@ -33,6 +35,7 @@ struct MineHomePage { | @@ -33,6 +35,7 @@ struct MineHomePage { | ||
| 33 | scroller: Scroller = new Scroller(); | 35 | scroller: Scroller = new Scroller(); |
| 34 | @State params:Record<string, string> = router.getParams() as Record<string, string>; | 36 | @State params:Record<string, string> = router.getParams() as Record<string, string>; |
| 35 | @State isCommentEnter:string = ""; | 37 | @State isCommentEnter:string = ""; |
| 38 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 36 | 39 | ||
| 37 | onPageShow(): void { | 40 | onPageShow(): void { |
| 38 | this.getUserInfo() | 41 | this.getUserInfo() |
| @@ -47,216 +50,235 @@ struct MineHomePage { | @@ -47,216 +50,235 @@ struct MineHomePage { | ||
| 47 | } | 50 | } |
| 48 | 51 | ||
| 49 | build() { | 52 | build() { |
| 50 | - Stack({ alignContent: Alignment.Top }){ | ||
| 51 | - Image($r('app.media.title_bg')) | ||
| 52 | - .width('100%') | ||
| 53 | - .height('355lpx') | ||
| 54 | - .objectFit(ImageFit.Cover) | 53 | + if(this.isConnectNetwork){ |
| 54 | + Stack({ alignContent: Alignment.Top }){ | ||
| 55 | + Image($r('app.media.title_bg')) | ||
| 56 | + .width('100%') | ||
| 57 | + .height('355lpx') | ||
| 58 | + .objectFit(ImageFit.Cover) | ||
| 59 | + | ||
| 60 | + Column(){ | ||
| 61 | + Stack({ alignContent: Alignment.Top }){ | ||
| 62 | + this.MineHomeTitleTransparent() | ||
| 63 | + this.MineHomeTitleWhite() | ||
| 64 | + } | ||
| 55 | 65 | ||
| 56 | - Column(){ | ||
| 57 | - Stack({ alignContent: Alignment.Top }){ | ||
| 58 | - this.MineHomeTitleTransparent() | ||
| 59 | - this.MineHomeTitleWhite() | ||
| 60 | - } | 66 | + Scroll(this.scroller) { |
| 67 | + Column() { | ||
| 68 | + //用户信息区域 | ||
| 69 | + Row() { | ||
| 70 | + Stack(){ | ||
| 71 | + Image(this.headPhotoUrl) | ||
| 72 | + .alt($r('app.media.default_head')) | ||
| 73 | + .width('115lpx') | ||
| 74 | + .height('115lpx') | ||
| 75 | + .objectFit(ImageFit.Auto) | ||
| 76 | + .clip(new Circle({ width: '115lpx', height: '115lpx' })) | ||
| 77 | + Image(this.levelHead) | ||
| 78 | + .width('165lpx') | ||
| 79 | + .height('165lpx') | ||
| 80 | + .objectFit(ImageFit.Auto) | ||
| 81 | + }.onClick(()=>{ | ||
| 82 | + let params = {'headPhotoUrl': this.headPhotoUrl} as Record<string, string>; | ||
| 83 | + WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params) | ||
| 84 | + }).width('165lpx') | ||
| 85 | + .height('165lpx') | ||
| 61 | 86 | ||
| 62 | - Scroll(this.scroller) { | ||
| 63 | - Column() { | ||
| 64 | - //用户信息区域 | ||
| 65 | - Row() { | ||
| 66 | - Stack(){ | ||
| 67 | - Image(this.headPhotoUrl) | ||
| 68 | - .alt($r('app.media.default_head')) | ||
| 69 | - .width('100lpx') | ||
| 70 | - .height('100lpx') | ||
| 71 | - .objectFit(ImageFit.Auto) | ||
| 72 | - .borderRadius(50) | ||
| 73 | - Image(this.levelHead) | ||
| 74 | - .width('130lpx') | ||
| 75 | - .height('130lpx') | ||
| 76 | - .objectFit(ImageFit.Cover) | ||
| 77 | - }.onClick(()=>{ | ||
| 78 | - let params = {'headPhotoUrl': this.headPhotoUrl} as Record<string, string>; | ||
| 79 | - WDRouterRule.jumpWithPage(WDRouterPage.showUserHeaderPage,params) | ||
| 80 | - }).width('135lpx') | ||
| 81 | - .height('135lpx') | 87 | + Column() { |
| 88 | + Row() { | ||
| 89 | + Text(`${this.userName}`) | ||
| 90 | + .fontColor($r('app.color.white')) | ||
| 91 | + .maxLines(1) | ||
| 92 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 93 | + .fontSize('38lpx') | ||
| 94 | + .lineHeight('50lpx') | ||
| 95 | + .fontWeight('500lpx') | ||
| 96 | + .onClick(()=>{ | ||
| 97 | + let params: editModelParams = { | ||
| 98 | + editContent: this.userName | ||
| 99 | + } | ||
| 100 | + WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage,params) | ||
| 101 | + }) | ||
| 102 | + | ||
| 103 | + if(this.levelId>0){ | ||
| 104 | + Text(`等级${this.levelId}`) | ||
| 105 | + .fontColor($r('app.color.color_ED2800')) | ||
| 106 | + .fontSize('23lpx') | ||
| 107 | + .fontWeight(500) | ||
| 108 | + .margin({ left: '10lpx' }) | ||
| 109 | + .backgroundImage($r("app.media.my_grade_bg")) | ||
| 110 | + .backgroundImageSize(ImageSize.Cover) | ||
| 111 | + .padding({left:"17lpx",right:"8lpx"}) | ||
| 112 | + .height('35lpx') | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + Blank() | ||
| 116 | + }.width('507lpx') | ||
| 82 | 117 | ||
| 118 | + Row() { | ||
| 119 | + Row() { | ||
| 120 | + Text(`${this.browseNum}`) | ||
| 121 | + .textStyle() | ||
| 122 | + Text("阅读") | ||
| 123 | + .textStyle2() | ||
| 124 | + } | ||
| 125 | + .margin({ right: '15lpx' }) | ||
| 126 | + | ||
| 127 | + Divider() | ||
| 128 | + .height('19lpx') | ||
| 129 | + .width('2lpx') | ||
| 130 | + .color($r('app.color.white')) | ||
| 131 | + .vertical(true) | ||
| 132 | + .opacity(0.4) | ||
| 133 | + Row() { | ||
| 134 | + Text(`${this.commentNum}`) | ||
| 135 | + .textStyle() | ||
| 136 | + Text("评论") | ||
| 137 | + .textStyle2() | ||
| 138 | + }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 139 | + | ||
| 140 | + Divider() | ||
| 141 | + .height('19lpx') | ||
| 142 | + .width('2lpx') | ||
| 143 | + .color($r('app.color.white')) | ||
| 144 | + .vertical(true) | ||
| 145 | + .opacity(0.4) | ||
| 146 | + Row() { | ||
| 147 | + Text(`${this.attentionNum}`) | ||
| 148 | + .textStyle() | ||
| 149 | + Text("关注") | ||
| 150 | + .textStyle2() | ||
| 151 | + }.margin({ left: '15lpx' }) | ||
| 152 | + }.margin({ top: '23lpx' }) | ||
| 153 | + }.alignItems(HorizontalAlign.Start) | ||
| 154 | + .margin({ left: StringUtils.isEmpty(this.levelHead)?'32lpx':"3lpx" }) | ||
| 155 | + } | ||
| 156 | + .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 157 | + if (this.firstPositionY === 0) { | ||
| 158 | + this.firstPositionY = newValue.globalPosition.y as number | ||
| 159 | + }else{ | ||
| 160 | + let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 161 | + if(persent > 1){ | ||
| 162 | + persent = 1 | ||
| 163 | + } | ||
| 164 | + this.tileOpacity = persent | ||
| 165 | + } | ||
| 166 | + }) | ||
| 167 | + .backgroundColor($r('app.color.color_transparent')) | ||
| 168 | + .height('184lpx') | ||
| 169 | + .width('100%') | ||
| 170 | + .padding({ left: '6lpx' }) | ||
| 171 | + | ||
| 172 | + | ||
| 173 | + //用户简介区域 | ||
| 83 | Column() { | 174 | Column() { |
| 84 | Row() { | 175 | Row() { |
| 85 | - Text(`${this.userName}`) | ||
| 86 | - .fontColor($r('app.color.white')) | ||
| 87 | - .maxLines(1) | 176 | + Text(this.isHasIntroduction?"简介:"+this.desc:this.desc) |
| 177 | + .fontSize('27lpx') | ||
| 178 | + .maxLines(3) | ||
| 88 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 179 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 89 | - .fontSize('38lpx') | ||
| 90 | - .lineHeight('50lpx') | ||
| 91 | - .fontWeight('500lpx') | 180 | + .lineHeight('40lpx') |
| 181 | + .fontWeight('400lpx') | ||
| 182 | + .fontColor(this.isHasIntroduction?$r('app.color.color_222222'):$r('app.color.color_999999')) | ||
| 183 | + .textAlign(TextAlign.Start) | ||
| 92 | .onClick(()=>{ | 184 | .onClick(()=>{ |
| 93 | let params: editModelParams = { | 185 | let params: editModelParams = { |
| 94 | - editContent: this.userName | 186 | + editContent: this.isHasIntroduction?this.desc:'' |
| 95 | } | 187 | } |
| 96 | - WDRouterRule.jumpWithPage(WDRouterPage.editUserNikeNamePage,params) | 188 | + WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage,params) |
| 97 | }) | 189 | }) |
| 98 | - if(this.levelId>0){ | ||
| 99 | - Text(`等级${this.levelId}`) | ||
| 100 | - .textAlign(TextAlign.Center) | ||
| 101 | - .fontColor($r('app.color.color_ED2800')) | ||
| 102 | - .backgroundColor($r('app.color.white')) | ||
| 103 | - .fontSize('19lpx') | ||
| 104 | - .width('96lpx') | ||
| 105 | - .height('35lpx') | ||
| 106 | - .margin({ left: '10lpx' }) | 190 | + if(!this.isHasIntroduction){ |
| 191 | + Image($r('app.media.user_info_edit_icon')) | ||
| 192 | + .width('27lpx') | ||
| 193 | + .height('27lpx') | ||
| 194 | + .interpolation(ImageInterpolation.High) | ||
| 195 | + .objectFit(ImageFit.Auto) | ||
| 107 | } | 196 | } |
| 197 | + } | ||
| 108 | 198 | ||
| 109 | - Blank() | ||
| 110 | - }.width('507lpx') | ||
| 111 | 199 | ||
| 112 | - Row() { | ||
| 113 | - Row() { | ||
| 114 | - Text(`${this.browseNum}`) | ||
| 115 | - .textStyle() | ||
| 116 | - Text("阅读") | ||
| 117 | - .textStyle2() | ||
| 118 | - } | ||
| 119 | - .margin({ right: '15lpx' }) | ||
| 120 | - | ||
| 121 | - Divider() | ||
| 122 | - .height('19lpx') | ||
| 123 | - .width('2lpx') | ||
| 124 | - .color($r('app.color.white')) | ||
| 125 | - .vertical(true) | ||
| 126 | - .opacity(0.4) | ||
| 127 | - Row() { | ||
| 128 | - Text(`${this.commentNum}`) | ||
| 129 | - .textStyle() | ||
| 130 | - Text("评论") | ||
| 131 | - .textStyle2() | ||
| 132 | - }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 133 | - | ||
| 134 | - Divider() | ||
| 135 | - .height('19lpx') | ||
| 136 | - .width('2lpx') | ||
| 137 | - .color($r('app.color.white')) | ||
| 138 | - .vertical(true) | ||
| 139 | - .opacity(0.4) | ||
| 140 | - Row() { | ||
| 141 | - Text(`${this.attentionNum}`) | ||
| 142 | - .textStyle() | ||
| 143 | - Text("关注") | ||
| 144 | - .textStyle2() | ||
| 145 | - }.margin({ left: '15lpx' }) | ||
| 146 | - }.margin({ top: '23lpx' }) | ||
| 147 | - }.alignItems(HorizontalAlign.Start) | ||
| 148 | - .margin({ left: '32lpx' }) | ||
| 149 | - } | ||
| 150 | - .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 151 | - if (this.firstPositionY === 0) { | ||
| 152 | - this.firstPositionY = newValue.globalPosition.y as number | ||
| 153 | - }else{ | ||
| 154 | - let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 155 | - if(persent > 1){ | ||
| 156 | - persent = 1 | ||
| 157 | - } | ||
| 158 | - this.tileOpacity = persent | ||
| 159 | - } | ||
| 160 | - }) | ||
| 161 | - .backgroundColor($r('app.color.color_transparent')) | ||
| 162 | - .height('184lpx') | ||
| 163 | - .width('100%') | ||
| 164 | - .padding({ left: '35lpx' }) | ||
| 165 | - //用户简介区域 | ||
| 166 | - Column() { | ||
| 167 | - Row() { | ||
| 168 | - Text(this.isHasIntroduction?"简介:"+this.desc:this.desc) | ||
| 169 | - .fontSize('27lpx') | ||
| 170 | - .maxLines(3) | ||
| 171 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 172 | - .lineHeight('40lpx') | 200 | + Text(`来到人民日报${this.registerTimeForDay}天`) |
| 201 | + .fontSize('23lpx') | ||
| 202 | + .lineHeight('25lpx') | ||
| 173 | .fontWeight('400lpx') | 203 | .fontWeight('400lpx') |
| 174 | - .fontColor(this.isHasIntroduction?$r('app.color.color_222222'):$r('app.color.color_999999')) | 204 | + .fontColor($r('app.color.color_999999')) |
| 175 | .textAlign(TextAlign.Start) | 205 | .textAlign(TextAlign.Start) |
| 176 | - .onClick(()=>{ | ||
| 177 | - let params: editModelParams = { | ||
| 178 | - editContent: this.isHasIntroduction?this.desc:'' | ||
| 179 | - } | ||
| 180 | - WDRouterRule.jumpWithPage(WDRouterPage.editUserIntroductionPage,params) | ||
| 181 | - }) | ||
| 182 | - if(!this.isHasIntroduction){ | ||
| 183 | - Image($r('app.media.user_info_edit_icon')) | ||
| 184 | - .width('27lpx') | ||
| 185 | - .height('27lpx') | ||
| 186 | - .interpolation(ImageInterpolation.High) | ||
| 187 | - .objectFit(ImageFit.Auto) | ||
| 188 | - } | ||
| 189 | - } | ||
| 190 | - | 206 | + .margin({ top: '15lpx' }) |
| 191 | 207 | ||
| 192 | - Text(`来到人民日报${this.registerTimeForDay}天`) | ||
| 193 | - .fontSize('23lpx') | ||
| 194 | - .lineHeight('25lpx') | ||
| 195 | - .fontWeight('400lpx') | ||
| 196 | - .fontColor($r('app.color.color_999999')) | ||
| 197 | - .textAlign(TextAlign.Start) | ||
| 198 | - .margin({ top: '15lpx' }) | ||
| 199 | - | ||
| 200 | - }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) | ||
| 201 | - .alignItems(HorizontalAlign.Start) | ||
| 202 | - .justifyContent(FlexAlign.Center) | ||
| 203 | - .width('100%') | ||
| 204 | - .backgroundColor($r('app.color.white')) | ||
| 205 | - //间隔符 | ||
| 206 | - | ||
| 207 | - Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | ||
| 208 | - | ||
| 209 | - //tab 页面 | ||
| 210 | - Stack({ alignContent: Alignment.Top }){ | ||
| 211 | - Tabs({controller: this.controller}) { | ||
| 212 | - TabContent() { | ||
| 213 | - HomePageBottomCommentComponent({commentNum:$commentNum}) | ||
| 214 | - } | ||
| 215 | - TabContent() { | ||
| 216 | - HomePageBottomFollowComponent() | ||
| 217 | - } | ||
| 218 | - } | 208 | + }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) |
| 209 | + .alignItems(HorizontalAlign.Start) | ||
| 210 | + .justifyContent(FlexAlign.Center) | ||
| 211 | + .width('100%') | ||
| 219 | .backgroundColor($r('app.color.white')) | 212 | .backgroundColor($r('app.color.white')) |
| 220 | - .animationDuration(0) | ||
| 221 | - .onChange((index: number) => { | ||
| 222 | - this.currentIndex = index | ||
| 223 | - }) | ||
| 224 | - .vertical(false) | ||
| 225 | - .barHeight("77lpx") | 213 | + //间隔符 |
| 226 | 214 | ||
| 227 | - Column() { | ||
| 228 | - // 页签 | ||
| 229 | - Row({ space: 7 }) { | ||
| 230 | - Scroll() { | ||
| 231 | - Row() { | ||
| 232 | - this.TabBuilder(0,"评论") | ||
| 233 | - this.TabBuilder(1,"关注") | 215 | + Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') |
| 216 | + | ||
| 217 | + //tab 页面 | ||
| 218 | + Stack({ alignContent: Alignment.Top }){ | ||
| 219 | + Tabs({controller: this.controller}) { | ||
| 220 | + TabContent() { | ||
| 221 | + HomePageBottomCommentComponent({commentNum:$commentNum}) | ||
| 222 | + } | ||
| 223 | + TabContent() { | ||
| 224 | + HomePageBottomFollowComponent() | ||
| 225 | + } | ||
| 226 | + } | ||
| 227 | + .backgroundColor($r('app.color.white')) | ||
| 228 | + .animationDuration(0) | ||
| 229 | + .onChange((index: number) => { | ||
| 230 | + this.currentIndex = index | ||
| 231 | + }) | ||
| 232 | + .vertical(false) | ||
| 233 | + .barHeight("77lpx") | ||
| 234 | + | ||
| 235 | + Column() { | ||
| 236 | + // 页签 | ||
| 237 | + Row({ space: 7 }) { | ||
| 238 | + Scroll() { | ||
| 239 | + Row() { | ||
| 240 | + this.TabBuilder(0,"评论") | ||
| 241 | + this.TabBuilder(1,"关注") | ||
| 242 | + } | ||
| 243 | + .justifyContent(FlexAlign.Start) | ||
| 234 | } | 244 | } |
| 235 | - .justifyContent(FlexAlign.Start) | 245 | + .align(Alignment.Start) |
| 246 | + .scrollable(ScrollDirection.Horizontal) | ||
| 247 | + .scrollBar(BarState.Off) | ||
| 248 | + .width('100%') | ||
| 249 | + .padding({left:'31lpx'}) | ||
| 236 | } | 250 | } |
| 237 | - .align(Alignment.Start) | ||
| 238 | - .scrollable(ScrollDirection.Horizontal) | ||
| 239 | - .scrollBar(BarState.Off) | 251 | + .alignItems(VerticalAlign.Bottom) |
| 240 | .width('100%') | 252 | .width('100%') |
| 241 | - .padding({left:'31lpx'}) | ||
| 242 | } | 253 | } |
| 243 | - .alignItems(VerticalAlign.Bottom) | 254 | + .backgroundColor($r('app.color.white')) |
| 255 | + .alignItems(HorizontalAlign.Start) | ||
| 244 | .width('100%') | 256 | .width('100%') |
| 257 | + .height('77lpx') | ||
| 245 | } | 258 | } |
| 246 | - .backgroundColor($r('app.color.white')) | ||
| 247 | - .alignItems(HorizontalAlign.Start) | ||
| 248 | - .width('100%') | ||
| 249 | - .height('77lpx') | ||
| 250 | - } | ||
| 251 | - }.width("100%") | 259 | + }.width("100%") |
| 260 | + } | ||
| 261 | + .edgeEffect(EdgeEffect.None) | ||
| 262 | + .scrollBar(BarState.Off) | ||
| 263 | + .width('100%') | ||
| 264 | + .layoutWeight(1) | ||
| 252 | } | 265 | } |
| 253 | - .edgeEffect(EdgeEffect.None) | ||
| 254 | - .scrollBar(BarState.Off) | ||
| 255 | - .width('100%') | ||
| 256 | - .layoutWeight(1) | 266 | + }.width('100%') |
| 267 | + .layoutWeight(1) | ||
| 268 | + }else{ | ||
| 269 | + Column(){ | ||
| 270 | + CustomTitleUI({ titleName: "" }) | ||
| 271 | + | ||
| 272 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 273 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 274 | + if(this.isConnectNetwork){ | ||
| 275 | + this.getUserInfo() | ||
| 276 | + } | ||
| 277 | + },}) | ||
| 278 | + .layoutWeight(1) | ||
| 279 | + .width('100%') | ||
| 257 | } | 280 | } |
| 258 | - }.width('100%') | ||
| 259 | - .layoutWeight(1) | 281 | + } |
| 260 | 282 | ||
| 261 | } | 283 | } |
| 262 | @Builder MineHomeTitleTransparent() { | 284 | @Builder MineHomeTitleTransparent() { |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | import { Params } from 'wdBean'; | 2 | import { Params } from 'wdBean'; |
| 3 | -import { StringUtils } from 'wdKit'; | 3 | +import { NetworkUtil, StringUtils } from 'wdKit'; |
| 4 | import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent'; | 4 | import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent'; |
| 5 | import { OtherHomePageBottomFollowComponent } from '../components/mine/home/OtherHomePageBottomFollowComponent'; | 5 | import { OtherHomePageBottomFollowComponent } from '../components/mine/home/OtherHomePageBottomFollowComponent'; |
| 6 | +import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; | ||
| 7 | +import { EmptyComponent } from '../components/view/EmptyComponent'; | ||
| 6 | import MinePageDatasModel from '../model/MinePageDatasModel'; | 8 | import MinePageDatasModel from '../model/MinePageDatasModel'; |
| 7 | import { OtherUserDetailRequestItem } from '../viewmodel/OtherUserDetailRequestItem'; | 9 | import { OtherUserDetailRequestItem } from '../viewmodel/OtherUserDetailRequestItem'; |
| 8 | 10 | ||
| @@ -39,6 +41,7 @@ struct OtherNormalUserHomePage { | @@ -39,6 +41,7 @@ struct OtherNormalUserHomePage { | ||
| 39 | @State attentionNum:number = 0//关注数 | 41 | @State attentionNum:number = 0//关注数 |
| 40 | @State desc:string = "" | 42 | @State desc:string = "" |
| 41 | userType:string = "1" | 43 | userType:string = "1" |
| 44 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 42 | 45 | ||
| 43 | aboutToAppear(){ | 46 | aboutToAppear(){ |
| 44 | this.getUserInfo() | 47 | this.getUserInfo() |
| @@ -47,185 +50,202 @@ struct OtherNormalUserHomePage { | @@ -47,185 +50,202 @@ struct OtherNormalUserHomePage { | ||
| 47 | 50 | ||
| 48 | 51 | ||
| 49 | build() { | 52 | build() { |
| 50 | - Stack({ alignContent: Alignment.Top }){ | ||
| 51 | - Image($r('app.media.title_bg')) | ||
| 52 | - .width('100%') | ||
| 53 | - .height('355lpx') | ||
| 54 | - .objectFit(ImageFit.Cover) | ||
| 55 | - | ||
| 56 | - Column(){ | ||
| 57 | - Stack({ alignContent: Alignment.Top }){ | ||
| 58 | - this.MineHomeTitleTransparent() | ||
| 59 | - this.MineHomeTitleWhite() | ||
| 60 | - } | 53 | + if(this.isConnectNetwork){ |
| 54 | + Stack({ alignContent: Alignment.Top }){ | ||
| 55 | + Image($r('app.media.title_bg')) | ||
| 56 | + .width('100%') | ||
| 57 | + .height('355lpx') | ||
| 58 | + .objectFit(ImageFit.Cover) | ||
| 59 | + | ||
| 60 | + Column(){ | ||
| 61 | + Stack({ alignContent: Alignment.Top }){ | ||
| 62 | + this.MineHomeTitleTransparent() | ||
| 63 | + this.MineHomeTitleWhite() | ||
| 64 | + } | ||
| 61 | 65 | ||
| 62 | - Scroll() { | ||
| 63 | - Column() { | ||
| 64 | - //用户信息区域 | ||
| 65 | - Row() { | ||
| 66 | - Stack(){ | ||
| 67 | - Image(this.headPhotoUrl) | ||
| 68 | - .alt($r('app.media.default_head')) | ||
| 69 | - .width('100lpx') | ||
| 70 | - .height('100lpx') | ||
| 71 | - .objectFit(ImageFit.Cover) | ||
| 72 | - .borderRadius(50) | ||
| 73 | - Image(this.levelHead) | ||
| 74 | - .width('130lpx') | ||
| 75 | - .height('130lpx') | ||
| 76 | - .objectFit(ImageFit.Cover) | ||
| 77 | - .borderRadius(50) | ||
| 78 | - } | 66 | + Scroll() { |
| 67 | + Column() { | ||
| 68 | + //用户信息区域 | ||
| 69 | + Row() { | ||
| 70 | + Stack(){ | ||
| 71 | + Image(this.headPhotoUrl) | ||
| 72 | + .alt($r('app.media.default_head')) | ||
| 73 | + .width('115lpx') | ||
| 74 | + .height('115lpx') | ||
| 75 | + .objectFit(ImageFit.Cover) | ||
| 76 | + .clip(new Circle({ width: '115lpx', height: '115lpx' })) | ||
| 77 | + Image(this.levelHead) | ||
| 78 | + .width('165lpx') | ||
| 79 | + .height('165lpx') | ||
| 80 | + .objectFit(ImageFit.Cover) | ||
| 81 | + } | ||
| 79 | 82 | ||
| 80 | - Column() { | ||
| 81 | - Row() { | ||
| 82 | - Text(`${this.userName}`) | ||
| 83 | - .fontColor($r('app.color.white')) | ||
| 84 | - .maxLines(1) | ||
| 85 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 86 | - .fontSize('38lpx') | ||
| 87 | - .lineHeight('50lpx') | ||
| 88 | - .fontWeight('500lpx') | ||
| 89 | - | ||
| 90 | - Text(`等级${this.levelId}`) | ||
| 91 | - .textAlign(TextAlign.Center) | ||
| 92 | - .fontColor($r('app.color.color_ED2800')) | ||
| 93 | - .backgroundColor($r('app.color.white')) | ||
| 94 | - .fontSize('19lpx') | ||
| 95 | - .width('96lpx') | ||
| 96 | - .height('35lpx') | ||
| 97 | - .margin({ left: '10lpx' }) | ||
| 98 | - Blank() | ||
| 99 | - }.width('507lpx') | ||
| 100 | - | ||
| 101 | - Row() { | ||
| 102 | - Row() { | ||
| 103 | - Text(`${this.browseNum}`) | ||
| 104 | - .textStyle() | ||
| 105 | - Text("阅读") | ||
| 106 | - .textStyle2() | ||
| 107 | - } | ||
| 108 | - .margin({ right: '15lpx' }) | ||
| 109 | - | ||
| 110 | - Divider() | ||
| 111 | - .height('19lpx') | ||
| 112 | - .width('2lpx') | ||
| 113 | - .color($r('app.color.white')) | ||
| 114 | - .vertical(true) | ||
| 115 | - .opacity(0.4) | 83 | + Column() { |
| 116 | Row() { | 84 | Row() { |
| 117 | - Text(`${this.commentNum}`) | ||
| 118 | - .textStyle() | ||
| 119 | - Text("评论") | ||
| 120 | - .textStyle2() | ||
| 121 | - }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 122 | - | ||
| 123 | - Divider() | ||
| 124 | - .height('19lpx') | ||
| 125 | - .width('2lpx') | ||
| 126 | - .color($r('app.color.white')) | ||
| 127 | - .vertical(true) | ||
| 128 | - .opacity(0.4) | 85 | + Text(`${this.userName}`) |
| 86 | + .fontColor($r('app.color.white')) | ||
| 87 | + .maxLines(1) | ||
| 88 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 89 | + .fontSize('38lpx') | ||
| 90 | + .lineHeight('50lpx') | ||
| 91 | + .fontWeight('500lpx') | ||
| 92 | + | ||
| 93 | + if(this.levelId>0){ | ||
| 94 | + Text(`等级${this.levelId}`) | ||
| 95 | + .fontColor($r('app.color.color_ED2800')) | ||
| 96 | + .fontSize('23lpx') | ||
| 97 | + .fontWeight(500) | ||
| 98 | + .margin({ left: '10lpx' }) | ||
| 99 | + .backgroundImage($r("app.media.my_grade_bg")) | ||
| 100 | + .backgroundImageSize(ImageSize.Cover) | ||
| 101 | + .padding({left:"17lpx",right:"8lpx"}) | ||
| 102 | + .height('35lpx') | ||
| 103 | + } | ||
| 104 | + Blank() | ||
| 105 | + }.width('507lpx') | ||
| 106 | + | ||
| 129 | Row() { | 107 | Row() { |
| 130 | - Text(`${this.attentionNum}`) | ||
| 131 | - .textStyle() | ||
| 132 | - Text("关注") | ||
| 133 | - .textStyle2() | ||
| 134 | - }.margin({ left: '15lpx' }) | ||
| 135 | - }.margin({ top: '23lpx' }) | ||
| 136 | - }.alignItems(HorizontalAlign.Start) | ||
| 137 | - .margin({ left: '32lpx' }) | ||
| 138 | - } | ||
| 139 | - .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 140 | - if (this.firstPositionY === 0) { | ||
| 141 | - this.firstPositionY = newValue.globalPosition.y as number | ||
| 142 | - }else{ | ||
| 143 | - let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 144 | - if(persent > 1){ | ||
| 145 | - persent = 1 | ||
| 146 | - } | ||
| 147 | - this.tileOpacity = persent | 108 | + Row() { |
| 109 | + Text(`${this.browseNum}`) | ||
| 110 | + .textStyle() | ||
| 111 | + Text("阅读") | ||
| 112 | + .textStyle2() | ||
| 113 | + } | ||
| 114 | + .margin({ right: '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.commentNum}`) | ||
| 124 | + .textStyle() | ||
| 125 | + Text("评论") | ||
| 126 | + .textStyle2() | ||
| 127 | + }.margin({ right: '15lpx', left: '15lpx' }) | ||
| 128 | + | ||
| 129 | + Divider() | ||
| 130 | + .height('19lpx') | ||
| 131 | + .width('2lpx') | ||
| 132 | + .color($r('app.color.white')) | ||
| 133 | + .vertical(true) | ||
| 134 | + .opacity(0.4) | ||
| 135 | + Row() { | ||
| 136 | + Text(`${this.attentionNum}`) | ||
| 137 | + .textStyle() | ||
| 138 | + Text("关注") | ||
| 139 | + .textStyle2() | ||
| 140 | + }.margin({ left: '15lpx' }) | ||
| 141 | + }.margin({ top: '23lpx' }) | ||
| 142 | + }.alignItems(HorizontalAlign.Start) | ||
| 143 | + .margin({ left: StringUtils.isEmpty(this.levelHead)?'32lpx':"3lpx" }) | ||
| 148 | } | 144 | } |
| 149 | - }) | ||
| 150 | - .backgroundColor($r('app.color.color_transparent')) | ||
| 151 | - .height('184lpx') | ||
| 152 | - .width('100%') | ||
| 153 | - .padding({ left: '35lpx' }) | ||
| 154 | - | ||
| 155 | - //用户简介区域 | ||
| 156 | - if(StringUtils.isNotEmpty(this.desc)){ | ||
| 157 | - Column() { | ||
| 158 | - Row() { | ||
| 159 | - Text(this.desc) | ||
| 160 | - .fontSize('27lpx') | ||
| 161 | - .maxLines(3) | ||
| 162 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 163 | - .lineHeight('40lpx') | ||
| 164 | - .fontWeight('400lpx') | ||
| 165 | - .fontColor($r('app.color.color_222222')) | ||
| 166 | - .textAlign(TextAlign.Start) | ||
| 167 | - | ||
| 168 | - } | ||
| 169 | - }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) | ||
| 170 | - .alignItems(HorizontalAlign.Start) | ||
| 171 | - .justifyContent(FlexAlign.Center) | ||
| 172 | - .width('100%') | ||
| 173 | - .backgroundColor($r('app.color.white')) | ||
| 174 | - } | ||
| 175 | - //间隔符 | ||
| 176 | - Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | ||
| 177 | - | ||
| 178 | - //tab 页面 | ||
| 179 | - Stack({ alignContent: Alignment.Top }){ | ||
| 180 | - Tabs({controller: this.controller}) { | ||
| 181 | - TabContent() { | ||
| 182 | - OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) | ||
| 183 | - } | ||
| 184 | - TabContent() { | ||
| 185 | - OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) | 145 | + .onAreaChange((oldValue: Area, newValue: Area) => { |
| 146 | + if (this.firstPositionY === 0) { | ||
| 147 | + this.firstPositionY = newValue.globalPosition.y as number | ||
| 148 | + }else{ | ||
| 149 | + let persent = (this.firstPositionY - Number(newValue.globalPosition.y)) / (this.firstPositionY * 0.3) | ||
| 150 | + if(persent > 1){ | ||
| 151 | + persent = 1 | ||
| 152 | + } | ||
| 153 | + this.tileOpacity = persent | ||
| 186 | } | 154 | } |
| 187 | - } | ||
| 188 | - .backgroundColor($r('app.color.white')) | ||
| 189 | - .animationDuration(0) | ||
| 190 | - .onChange((index: number) => { | ||
| 191 | - this.currentIndex = index | ||
| 192 | }) | 155 | }) |
| 193 | - .vertical(false) | ||
| 194 | - .barHeight('77lpx') | 156 | + .backgroundColor($r('app.color.color_transparent')) |
| 157 | + .height('184lpx') | ||
| 158 | + .width('100%') | ||
| 159 | + .padding({ left: '6lpx' }) | ||
| 195 | 160 | ||
| 196 | - Column() { | ||
| 197 | - // 页签 | ||
| 198 | - Row({ space: 7 }) { | ||
| 199 | - Scroll() { | ||
| 200 | - Row() { | ||
| 201 | - this.TabBuilder(0,"评论") | ||
| 202 | - this.TabBuilder(1,"关注") | 161 | + //用户简介区域 |
| 162 | + if(StringUtils.isNotEmpty(this.desc)){ | ||
| 163 | + Column() { | ||
| 164 | + Row() { | ||
| 165 | + Text(this.desc) | ||
| 166 | + .fontSize('27lpx') | ||
| 167 | + .maxLines(3) | ||
| 168 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 169 | + .lineHeight('40lpx') | ||
| 170 | + .fontWeight('400lpx') | ||
| 171 | + .fontColor($r('app.color.color_222222')) | ||
| 172 | + .textAlign(TextAlign.Start) | ||
| 173 | + | ||
| 174 | + } | ||
| 175 | + }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'}) | ||
| 176 | + .alignItems(HorizontalAlign.Start) | ||
| 177 | + .justifyContent(FlexAlign.Center) | ||
| 178 | + .width('100%') | ||
| 179 | + .backgroundColor($r('app.color.white')) | ||
| 180 | + } | ||
| 181 | + //间隔符 | ||
| 182 | + Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') | ||
| 183 | + | ||
| 184 | + //tab 页面 | ||
| 185 | + Stack({ alignContent: Alignment.Top }){ | ||
| 186 | + Tabs({controller: this.controller}) { | ||
| 187 | + TabContent() { | ||
| 188 | + OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum}) | ||
| 189 | + } | ||
| 190 | + TabContent() { | ||
| 191 | + OtherHomePageBottomFollowComponent({curUserId:this.curUserId}) | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + .backgroundColor($r('app.color.white')) | ||
| 195 | + .animationDuration(0) | ||
| 196 | + .onChange((index: number) => { | ||
| 197 | + this.currentIndex = index | ||
| 198 | + }) | ||
| 199 | + .vertical(false) | ||
| 200 | + .barHeight('77lpx') | ||
| 201 | + | ||
| 202 | + Column() { | ||
| 203 | + // 页签 | ||
| 204 | + Row({ space: 7 }) { | ||
| 205 | + Scroll() { | ||
| 206 | + Row() { | ||
| 207 | + this.TabBuilder(0,"评论") | ||
| 208 | + this.TabBuilder(1,"关注") | ||
| 209 | + } | ||
| 210 | + .justifyContent(FlexAlign.Start) | ||
| 203 | } | 211 | } |
| 204 | - .justifyContent(FlexAlign.Start) | 212 | + .align(Alignment.Start) |
| 213 | + .scrollable(ScrollDirection.Horizontal) | ||
| 214 | + .scrollBar(BarState.Off) | ||
| 215 | + .width('90%') | ||
| 216 | + .padding({left:'31lpx'}) | ||
| 205 | } | 217 | } |
| 206 | - .align(Alignment.Start) | ||
| 207 | - .scrollable(ScrollDirection.Horizontal) | ||
| 208 | - .scrollBar(BarState.Off) | ||
| 209 | - .width('90%') | ||
| 210 | - .padding({left:'31lpx'}) | 218 | + .alignItems(VerticalAlign.Bottom) |
| 219 | + .width('100%') | ||
| 211 | } | 220 | } |
| 212 | - .alignItems(VerticalAlign.Bottom) | 221 | + .backgroundColor($r('app.color.white')) |
| 222 | + .alignItems(HorizontalAlign.Start) | ||
| 213 | .width('100%') | 223 | .width('100%') |
| 224 | + .height('77lpx') | ||
| 214 | } | 225 | } |
| 215 | - .backgroundColor($r('app.color.white')) | ||
| 216 | - .alignItems(HorizontalAlign.Start) | ||
| 217 | - .width('100%') | ||
| 218 | - .height('77lpx') | ||
| 219 | - } | ||
| 220 | - }.width("100%") | 226 | + }.width("100%") |
| 227 | + } | ||
| 228 | + .edgeEffect(EdgeEffect.None) | ||
| 229 | + .scrollBar(BarState.Off) | ||
| 230 | + .width('100%') | ||
| 231 | + .layoutWeight(1) | ||
| 221 | } | 232 | } |
| 222 | - .edgeEffect(EdgeEffect.None) | ||
| 223 | - .scrollBar(BarState.Off) | ||
| 224 | - .width('100%') | ||
| 225 | - .layoutWeight(1) | 233 | + }.width('100%') |
| 234 | + .layoutWeight(1) | ||
| 235 | + }else{ | ||
| 236 | + Column(){ | ||
| 237 | + CustomTitleUI({ titleName: "" }) | ||
| 238 | + | ||
| 239 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 240 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 241 | + if(this.isChangeToUserEdit){ | ||
| 242 | + this.getUserInfo() | ||
| 243 | + } | ||
| 244 | + },}) | ||
| 245 | + .layoutWeight(1) | ||
| 246 | + .width('100%') | ||
| 226 | } | 247 | } |
| 227 | - }.width('100%') | ||
| 228 | - .layoutWeight(1) | 248 | + } |
| 229 | 249 | ||
| 230 | } | 250 | } |
| 231 | @Builder MineHomeTitleTransparent() { | 251 | @Builder MineHomeTitleTransparent() { |
| 1 | import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, LiveRoomDataBean, PageDTO, PageInfoDTO } from 'wdBean'; | 1 | import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, LiveRoomDataBean, PageDTO, PageInfoDTO } from 'wdBean'; |
| 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; | 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; |
| 3 | -import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils } from 'wdKit'; | 3 | +import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils, ToastUtils } from 'wdKit'; |
| 4 | import { closeRefresh } from '../utils/PullDownRefresh'; | 4 | import { closeRefresh } from '../utils/PullDownRefresh'; |
| 5 | import PageModel from './PageModel'; | 5 | import PageModel from './PageModel'; |
| 6 | import PageViewModel from './PageViewModel'; | 6 | import PageViewModel from './PageViewModel'; |
| @@ -33,9 +33,16 @@ export class PageHelper { | @@ -33,9 +33,16 @@ export class PageHelper { | ||
| 33 | * 刷新数据 | 33 | * 刷新数据 |
| 34 | */ | 34 | */ |
| 35 | async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) { | 35 | async refreshUI(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 36 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 37 | + if (!netStatus) { | ||
| 38 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 39 | + setTimeout(() => { | ||
| 40 | + closeRefresh(pageModel, false) | ||
| 41 | + }, 500) | ||
| 42 | + return | ||
| 43 | + } | ||
| 36 | pageModel.loadStrategy = 2 | 44 | pageModel.loadStrategy = 2 |
| 37 | pageModel.pageTotalCompSize = 0; | 45 | pageModel.pageTotalCompSize = 0; |
| 38 | - // TODO 下拉刷新,是否加载缓存 | ||
| 39 | this.getPageInfo(pageModel, pageAdvModel) | 46 | this.getPageInfo(pageModel, pageAdvModel) |
| 40 | } | 47 | } |
| 41 | 48 | ||
| @@ -43,6 +50,11 @@ export class PageHelper { | @@ -43,6 +50,11 @@ export class PageHelper { | ||
| 43 | * 分页加载 | 50 | * 分页加载 |
| 44 | */ | 51 | */ |
| 45 | async loadMore(pageModel: PageModel) { | 52 | async loadMore(pageModel: PageModel) { |
| 53 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 54 | + if (!netStatus) { | ||
| 55 | + ToastUtils.showToast('网络出小差了,请检查网络后重试', 1000) | ||
| 56 | + return | ||
| 57 | + } | ||
| 46 | pageModel.loadStrategy = 3 | 58 | pageModel.loadStrategy = 3 |
| 47 | // 暂只支持comp分页加载,节目分页加载的得完善框架(如直播回看节目数据分页) | 59 | // 暂只支持comp分页加载,节目分页加载的得完善框架(如直播回看节目数据分页) |
| 48 | this.compLoadMore(pageModel) | 60 | this.compLoadMore(pageModel) |
| @@ -52,55 +64,20 @@ export class PageHelper { | @@ -52,55 +64,20 @@ export class PageHelper { | ||
| 52 | * 进页面请求数据 | 64 | * 进页面请求数据 |
| 53 | */ | 65 | */ |
| 54 | async getInitCacheData(pageModel: PageModel, pageAdvModel: PageAdModel) { | 66 | async getInitCacheData(pageModel: PageModel, pageAdvModel: PageAdModel) { |
| 55 | - Logger.error('zzzz', 'getInitCacheData') | 67 | + Logger.debug(TAG, 'getInitCacheData') |
| 56 | PageViewModel.getPageInfoCache(pageModel.pageId).then(pageInfo => { | 68 | PageViewModel.getPageInfoCache(pageModel.pageId).then(pageInfo => { |
| 69 | + Logger.debug(TAG, 'getInitCacheData back: ' + pageInfo) | ||
| 57 | if (pageInfo == null) { | 70 | if (pageInfo == null) { |
| 58 | return; | 71 | return; |
| 59 | } | 72 | } |
| 60 | pageModel.pageInfo = pageInfo; | 73 | pageModel.pageInfo = pageInfo; |
| 74 | + pageModel.cachePageInfoMd5 = pageInfo.md5 | ||
| 61 | //解析页面挂角广告资源 | 75 | //解析页面挂角广告资源 |
| 62 | pageAdvModel.analysisAdvSource(pageInfo); | 76 | pageAdvModel.analysisAdvSource(pageInfo); |
| 63 | - this.parseCacheGroup(pageModel) | 77 | + this.parseGroup(pageModel, true) |
| 64 | }) | 78 | }) |
| 65 | } | 79 | } |
| 66 | 80 | ||
| 67 | - async parseCacheGroup(pageModel: PageModel) { | ||
| 68 | - Logger.error('zzzz', 'parseCacheGroup') | ||
| 69 | - let pageInfo: PageInfoDTO = pageModel.pageInfo | ||
| 70 | - pageModel.groupList = [] | ||
| 71 | - pageInfo.pageAdList = [] | ||
| 72 | - pageInfo.oneRequestPageGroupCompList = new ArrayList() | ||
| 73 | - pageModel.groupList.push(...pageInfo.groups) | ||
| 74 | - for (const group of pageInfo.groups) { | ||
| 75 | - pageModel.groupId = group.id; | ||
| 76 | - pageModel.groupData = group | ||
| 77 | - // await,确保groups接口顺序执行 | ||
| 78 | - let pageDto = await PageViewModel.getPageGroupCacheData(pageModel.bizCopy()) as PageDTO | ||
| 79 | - let index = pageInfo.groups.indexOf(group) | ||
| 80 | - if (index == 0) { | ||
| 81 | - // 清空comp列表 | ||
| 82 | - pageModel.compList.clear() | ||
| 83 | - } | ||
| 84 | - this.analysisPageGroupCompData(pageDto, pageInfo) | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - // 收集页面所有楼层的组件信息,同步完成广告投放计算,异步完成稿件批查, | ||
| 88 | - | ||
| 89 | - pageModel.pageTotalCompSize = pageInfo.oneRequestPageGroupCompList.length + pageModel.pageTotalCompSize | ||
| 90 | - // 处理页面广告数据,投放到页面的位置 | ||
| 91 | - // TODO 缓存数据不加载广告 | ||
| 92 | - // this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList); | ||
| 93 | - | ||
| 94 | - //遍历所有组件和稿件数据 push到页面 | ||
| 95 | - for (let element of pageInfo.oneRequestPageGroupCompList) { | ||
| 96 | - pageModel.compList.push(CompDTO.createNewsBean(element)) | ||
| 97 | - } | ||
| 98 | - pageModel.currentPage++ | ||
| 99 | - pageModel.viewType = ViewType.LOADED | ||
| 100 | - closeRefresh(pageModel, true) | ||
| 101 | - | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | /** | 81 | /** |
| 105 | * 进页面请求数据 | 82 | * 进页面请求数据 |
| 106 | */ | 83 | */ |
| @@ -134,33 +111,51 @@ export class PageHelper { | @@ -134,33 +111,51 @@ export class PageHelper { | ||
| 134 | promptAction.showToast({ message: err }); | 111 | promptAction.showToast({ message: err }); |
| 135 | }) | 112 | }) |
| 136 | } else { | 113 | } else { |
| 114 | + Logger.debug(TAG, 'getPageInfo') | ||
| 137 | PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => { | 115 | PageViewModel.getPageInfo(pageModel.pageId).then(pageInfo => { |
| 116 | + Logger.debug(TAG, 'getPageInfo back: ' + JSON.stringify(pageInfo)) | ||
| 138 | if (pageInfo == null) { | 117 | if (pageInfo == null) { |
| 139 | pageModel.viewType = ViewType.EMPTY; | 118 | pageModel.viewType = ViewType.EMPTY; |
| 140 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1; | 119 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_NoContent1; |
| 141 | return; | 120 | return; |
| 142 | } | 121 | } |
| 143 | pageModel.pageInfo = pageInfo; | 122 | pageModel.pageInfo = pageInfo; |
| 144 | - //解析页面挂角广告资源 | ||
| 145 | - pageAdvModel.analysisAdvSource(pageInfo); | ||
| 146 | - this.parseGroup(pageModel) | ||
| 147 | - // if (pageModel.currentPage == 1) { | ||
| 148 | - // // 保存缓存 | ||
| 149 | - // CacheData.saveCacheData(CacheData.comPageInfoCacheKey + pageModel.pageId, pageInfo, pageInfo.md5) | ||
| 150 | - // } | 123 | + if (pageInfo.md5 == pageModel.cachePageInfoMd5) { |
| 124 | + // 缓存一致,不解析 | ||
| 125 | + Logger.debug(TAG, 'getPageInfo 与缓存一致,不解析广告。。。') | ||
| 126 | + } else { | ||
| 127 | + Logger.debug(TAG, 'getPageInfo 要解析广告') | ||
| 128 | + if (pageModel.currentPage == 1) { | ||
| 129 | + // 保存缓存 | ||
| 130 | + CacheData.saveCacheData(CacheData.comPageInfoCacheKey + pageModel.pageId, pageInfo, pageInfo.md5) | ||
| 131 | + } | ||
| 132 | + //解析页面挂角广告资源 | ||
| 133 | + pageAdvModel.analysisAdvSource(pageInfo); | ||
| 134 | + } | ||
| 135 | + Logger.debug(TAG, 'getPageInfo go on') | ||
| 136 | + this.parseGroup(pageModel, false) | ||
| 151 | }).catch(() => { | 137 | }).catch(() => { |
| 138 | + if (this.isPageLoaded(pageModel)) { | ||
| 139 | + return | ||
| 140 | + } | ||
| 152 | pageModel.viewType = ViewType.EMPTY; | 141 | pageModel.viewType = ViewType.EMPTY; |
| 153 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed; | 142 | pageModel.emptyType = WDViewDefaultType.WDViewDefaultType_ContentFailed; |
| 154 | }) | 143 | }) |
| 155 | } | 144 | } |
| 156 | } | 145 | } |
| 157 | 146 | ||
| 147 | + private isPageLoaded(pageModel: PageModel) { | ||
| 148 | + if (pageModel.compList.size() > 0) { | ||
| 149 | + return true | ||
| 150 | + } | ||
| 151 | + return false | ||
| 152 | + } | ||
| 158 | 153 | ||
| 159 | /** | 154 | /** |
| 160 | * 解析信息流页面楼层数据 | 155 | * 解析信息流页面楼层数据 |
| 161 | * @param pageModel | 156 | * @param pageModel |
| 162 | */ | 157 | */ |
| 163 | - async parseGroup(pageModel: PageModel) { | 158 | + async parseGroup(pageModel: PageModel, isCache: boolean) { |
| 164 | let pageInfo: PageInfoDTO = pageModel.pageInfo | 159 | let pageInfo: PageInfoDTO = pageModel.pageInfo |
| 165 | pageModel.groupList = [] | 160 | pageModel.groupList = [] |
| 166 | pageInfo.pageAdList = [] | 161 | pageInfo.pageAdList = [] |
| @@ -177,8 +172,26 @@ export class PageHelper { | @@ -177,8 +172,26 @@ export class PageHelper { | ||
| 177 | pageModel.groupData = group | 172 | pageModel.groupData = group |
| 178 | 173 | ||
| 179 | //Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId); | 174 | //Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId); |
| 175 | + let pageDto: PageDTO | ||
| 176 | + Logger.debug(TAG, 'parseGroup isCache: ' + isCache) | ||
| 177 | + if (isCache) { | ||
| 178 | + pageDto = await PageViewModel.getPageGroupCacheData(pageModel.bizCopy()) as PageDTO | ||
| 179 | + pageModel.cacheGroupInfoMd5 = pageDto.md5 | ||
| 180 | + } else { | ||
| 181 | + pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO | ||
| 182 | + if (pageDto.md5 == pageModel.cacheGroupInfoMd5) { | ||
| 183 | + Logger.debug(TAG, 'parseGroup cache load, return: ' + pageDto.md5) | ||
| 184 | + // 缓存数据一致,不再刷新 | ||
| 185 | + return | ||
| 186 | + } | ||
| 187 | + Logger.debug(TAG, 'parseGroup cache load, save: ') | ||
| 188 | + // 保存缓存 | ||
| 189 | + CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto, | ||
| 190 | + pageDto.md5) | ||
| 191 | + } | ||
| 192 | + Logger.debug(TAG, 'parseGroup go on') | ||
| 180 | // await,确保groups接口顺序执行 | 193 | // await,确保groups接口顺序执行 |
| 181 | - let pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO | 194 | + // let pageDto = page |
| 182 | let index = pageInfo.groups.indexOf(group) | 195 | let index = pageInfo.groups.indexOf(group) |
| 183 | 196 | ||
| 184 | // 解析楼层组件 | 197 | // 解析楼层组件 |
| @@ -197,9 +210,6 @@ export class PageHelper { | @@ -197,9 +210,6 @@ export class PageHelper { | ||
| 197 | } else { | 210 | } else { |
| 198 | pageInfo.lastCompSourceType = 0 | 211 | pageInfo.lastCompSourceType = 0 |
| 199 | } | 212 | } |
| 200 | - // // 保存缓存 | ||
| 201 | - // CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto, | ||
| 202 | - // pageDto.md5) | ||
| 203 | } | 213 | } |
| 204 | } | 214 | } |
| 205 | 215 |
| @@ -63,6 +63,10 @@ export default class PageModel { | @@ -63,6 +63,10 @@ export default class PageModel { | ||
| 63 | pageType: number = 0; | 63 | pageType: number = 0; |
| 64 | 64 | ||
| 65 | extra: string = '' | 65 | extra: string = '' |
| 66 | + // 缓存数据相关 | ||
| 67 | + cachePageInfoMd5: string = '' | ||
| 68 | + cacheGroupInfoMd5: string = '' | ||
| 69 | + | ||
| 66 | /** | 70 | /** |
| 67 | * 简单复制业务数据 | 71 | * 简单复制业务数据 |
| 68 | */ | 72 | */ |
569 Bytes
| @@ -16,6 +16,7 @@ import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index' | @@ -16,6 +16,7 @@ import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index' | ||
| 16 | import { registerRouter } from 'wdRouter/Index' | 16 | import { registerRouter } from 'wdRouter/Index' |
| 17 | import { TrackingModule } from 'wdTracking/Index' | 17 | import { TrackingModule } from 'wdTracking/Index' |
| 18 | import { JSON } from '@kit.ArkTS' | 18 | import { JSON } from '@kit.ArkTS' |
| 19 | +import app from '@system.app' | ||
| 19 | 20 | ||
| 20 | const TAG = "[StartupManager]" | 21 | const TAG = "[StartupManager]" |
| 21 | 22 | ||
| @@ -36,6 +37,8 @@ export class StartupManager { | @@ -36,6 +37,8 @@ export class StartupManager { | ||
| 36 | appOnCreate(want: Want, launchParam: AbilityConstant.LaunchParam, context: common.UIAbilityContext) { | 37 | appOnCreate(want: Want, launchParam: AbilityConstant.LaunchParam, context: common.UIAbilityContext) { |
| 37 | Logger.debug(TAG, "App onCreate: " + `\nwant: ${want}\nlaunchParam: ${launchParam}`) | 38 | Logger.debug(TAG, "App onCreate: " + `\nwant: ${want}\nlaunchParam: ${launchParam}`) |
| 38 | this.context = context | 39 | this.context = context |
| 40 | + // 设置图片文件数据缓存上限为200MB (200MB=200*1024*1024B=209715200B) | ||
| 41 | + app.setImageFileCacheSize(209715200) | ||
| 39 | 42 | ||
| 40 | // KV存储 | 43 | // KV存储 |
| 41 | SPHelper.init(context); | 44 | SPHelper.init(context); |
-
Please register or login to post a comment