Showing
2 changed files
with
8 additions
and
25 deletions
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | -import { DateTimeUtils, NetworkUtil, StringUtils, WindowModel } from 'wdKit'; | 2 | +import { DateTimeUtils, NetworkUtil, NumberFormatterUtils, StringUtils, WindowModel } 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'; |
| @@ -154,7 +154,7 @@ struct MineHomePage { | @@ -154,7 +154,7 @@ struct MineHomePage { | ||
| 154 | 154 | ||
| 155 | Row() { | 155 | Row() { |
| 156 | Row() { | 156 | Row() { |
| 157 | - Text(this.handlerNum(this.browseNum.toString())) | 157 | + Text(`${NumberFormatterUtils.formatNumberWithWan(this.browseNum)}`) |
| 158 | .textStyle() | 158 | .textStyle() |
| 159 | Text("阅读") | 159 | Text("阅读") |
| 160 | .textStyle2() | 160 | .textStyle2() |
| @@ -168,7 +168,7 @@ struct MineHomePage { | @@ -168,7 +168,7 @@ struct MineHomePage { | ||
| 168 | .vertical(true) | 168 | .vertical(true) |
| 169 | .opacity(0.4) | 169 | .opacity(0.4) |
| 170 | Row() { | 170 | Row() { |
| 171 | - Text(this.handlerNum(this.commentNum.toString())) | 171 | + Text(`${NumberFormatterUtils.formatNumberWithWan(this.commentNum)}`) |
| 172 | .textStyle() | 172 | .textStyle() |
| 173 | Text("评论") | 173 | Text("评论") |
| 174 | .textStyle2() | 174 | .textStyle2() |
| @@ -182,7 +182,7 @@ struct MineHomePage { | @@ -182,7 +182,7 @@ struct MineHomePage { | ||
| 182 | .vertical(true) | 182 | .vertical(true) |
| 183 | .opacity(0.4) | 183 | .opacity(0.4) |
| 184 | Row() { | 184 | Row() { |
| 185 | - Text(this.handlerNum(this.attentionNum.toString())) | 185 | + Text(`${NumberFormatterUtils.formatNumberWithWan(this.attentionNum)}`) |
| 186 | .textStyle() | 186 | .textStyle() |
| 187 | Text("关注") | 187 | Text("关注") |
| 188 | .textStyle2() | 188 | .textStyle2() |
| @@ -520,23 +520,6 @@ struct MineHomePage { | @@ -520,23 +520,6 @@ struct MineHomePage { | ||
| 520 | }) | 520 | }) |
| 521 | } | 521 | } |
| 522 | 522 | ||
| 523 | - handlerNum(number: string) { | ||
| 524 | - const num = number??'0'; | ||
| 525 | - if (Number.parseInt(num) <= 9999) { | ||
| 526 | - return Number.parseInt(num).toString() | ||
| 527 | - } else if (Number.parseInt(num) > 9999 && Number.parseInt(num) <= 99999999) { | ||
| 528 | - const num1: string = num.slice(0, -4); // 万 | ||
| 529 | - const num2: string = num.slice(-4, -3); // 千 | ||
| 530 | - return num2 === '0' ? num1 +'万' : num1 + '.' + num2 + '万' | ||
| 531 | - } else if (Number.parseInt(num) > 99999999) { | ||
| 532 | - const num1: string = num.slice(0, -8); // 亿 | ||
| 533 | - const num2: string = num.slice(-8, -7); | ||
| 534 | - return num2 === '0' ? num1 +'亿' : num1 + '.' + num2 + '亿' | ||
| 535 | - } | ||
| 536 | - return num | ||
| 537 | - } | ||
| 538 | - | ||
| 539 | - | ||
| 540 | getUserLevel(){ | 523 | getUserLevel(){ |
| 541 | MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{ | 524 | MinePageDatasModel.getUserLevelData(getContext(this)).then((value)=>{ |
| 542 | if(value!=null){ | 525 | if(value!=null){ |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | import { Params } from 'wdBean'; | 2 | import { Params } from 'wdBean'; |
| 3 | -import { DateTimeUtils, NetworkUtil, StringUtils } from 'wdKit'; | 3 | +import { DateTimeUtils, NetworkUtil, NumberFormatterUtils, StringUtils } from 'wdKit'; |
| 4 | import { TrackingPageBrowse, TrackConstants, ParamType, Tracking } from 'wdTracking/Index'; | 4 | import { TrackingPageBrowse, TrackConstants, ParamType, Tracking } from 'wdTracking/Index'; |
| 5 | import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent'; | 5 | import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent'; |
| 6 | import { OtherHomePageBottomFollowComponent } from '../components/mine/home/OtherHomePageBottomFollowComponent'; | 6 | import { OtherHomePageBottomFollowComponent } from '../components/mine/home/OtherHomePageBottomFollowComponent'; |
| @@ -129,7 +129,7 @@ struct OtherNormalUserHomePage { | @@ -129,7 +129,7 @@ struct OtherNormalUserHomePage { | ||
| 129 | 129 | ||
| 130 | Row() { | 130 | Row() { |
| 131 | Row() { | 131 | Row() { |
| 132 | - Text(`${this.browseNum}`) | 132 | + Text(`${NumberFormatterUtils.formatNumberWithWan(this.browseNum)}`) |
| 133 | .textStyle() | 133 | .textStyle() |
| 134 | Text("阅读") | 134 | Text("阅读") |
| 135 | .textStyle2() | 135 | .textStyle2() |
| @@ -143,7 +143,7 @@ struct OtherNormalUserHomePage { | @@ -143,7 +143,7 @@ struct OtherNormalUserHomePage { | ||
| 143 | .vertical(true) | 143 | .vertical(true) |
| 144 | .opacity(0.4) | 144 | .opacity(0.4) |
| 145 | Row() { | 145 | Row() { |
| 146 | - Text(`${this.commentNum}`) | 146 | + Text(`${NumberFormatterUtils.formatNumberWithWan(this.commentNum)}`) |
| 147 | .textStyle() | 147 | .textStyle() |
| 148 | Text("评论") | 148 | Text("评论") |
| 149 | .textStyle2() | 149 | .textStyle2() |
| @@ -156,7 +156,7 @@ struct OtherNormalUserHomePage { | @@ -156,7 +156,7 @@ struct OtherNormalUserHomePage { | ||
| 156 | .vertical(true) | 156 | .vertical(true) |
| 157 | .opacity(0.4) | 157 | .opacity(0.4) |
| 158 | Row() { | 158 | Row() { |
| 159 | - Text(`${this.attentionNum}`) | 159 | + Text(`${NumberFormatterUtils.formatNumberWithWan(this.attentionNum)}`) |
| 160 | .textStyle() | 160 | .textStyle() |
| 161 | Text("关注") | 161 | Text("关注") |
| 162 | .textStyle2() | 162 | .textStyle2() |
-
Please register or login to post a comment