Showing
1 changed file
with
13 additions
and
3 deletions
| @@ -121,7 +121,11 @@ export struct RmhTitle { | @@ -121,7 +121,11 @@ export struct RmhTitle { | ||
| 121 | const time1 = new Date().getTime(); // 今天日期的时间戳 | 121 | const time1 = new Date().getTime(); // 今天日期的时间戳 |
| 122 | const time2 = new Date(date).getTime(); // 要比较日期的时间戳 | 122 | const time2 = new Date(date).getTime(); // 要比较日期的时间戳 |
| 123 | const diffDays = Math.round(Math.abs((time1 - time2) / oneDay)); // 两个日期时间戳差值除以一天的毫秒数得到天数,取绝对值并四舍五入 | 123 | const diffDays = Math.round(Math.abs((time1 - time2) / oneDay)); // 两个日期时间戳差值除以一天的毫秒数得到天数,取绝对值并四舍五入 |
| 124 | - return Math.ceil(diffDays); | 124 | + return diffDays; |
| 125 | + } | ||
| 126 | + | ||
| 127 | + showTime() { | ||
| 128 | + return !(this.hideTime && this.getDaysBetweenDates(Number(this.publishTime)) > 2) | ||
| 125 | } | 129 | } |
| 126 | 130 | ||
| 127 | build() { | 131 | build() { |
| @@ -158,7 +162,7 @@ export struct RmhTitle { | @@ -158,7 +162,7 @@ export struct RmhTitle { | ||
| 158 | 162 | ||
| 159 | // Flex({alignContent: FlexAlign.Start, wrap: FlexWrap.NoWrap}) { | 163 | // Flex({alignContent: FlexAlign.Start, wrap: FlexWrap.NoWrap}) { |
| 160 | Row() { | 164 | Row() { |
| 161 | - if (!(this.hideTime && this.getDaysBetweenDates(Number(this.publishTime)) > 2)) { | 165 | + if (this.showTime()) { |
| 162 | if (this.publishTime) { | 166 | if (this.publishTime) { |
| 163 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime))) | 167 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime))) |
| 164 | .fontSize($r("app.float.font_size_12")) | 168 | .fontSize($r("app.float.font_size_12")) |
| @@ -182,16 +186,19 @@ export struct RmhTitle { | @@ -182,16 +186,19 @@ export struct RmhTitle { | ||
| 182 | .textAlign(TextAlign.Start) | 186 | .textAlign(TextAlign.Start) |
| 183 | .height(14) | 187 | .height(14) |
| 184 | .lineHeight(14) | 188 | .lineHeight(14) |
| 185 | - .constraintSize({maxWidth:(DisplayUtils.getDeviceWidth() - 32 - 36 - 18 - this.getTextWidth(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime))))}) | 189 | + .width('calc(100% - 54vp)') |
| 190 | + // .constraintSize({maxWidth:(DisplayUtils.getDeviceWidth() - 32 - 36 - 18 - this.getTextWidth(DateTimeUtils.getCommentTime(Number.parseFloat(this.publishTime))))}) | ||
| 186 | } | 191 | } |
| 187 | 192 | ||
| 188 | } | 193 | } |
| 189 | .height(14) | 194 | .height(14) |
| 190 | .align(Alignment.Start) | 195 | .align(Alignment.Start) |
| 196 | + .width('100%') | ||
| 191 | // } | 197 | // } |
| 192 | // .width('calc(100% - 36vp - 8vp)') | 198 | // .width('calc(100% - 36vp - 8vp)') |
| 193 | } | 199 | } |
| 194 | .justifyContent(FlexAlign.SpaceBetween) | 200 | .justifyContent(FlexAlign.SpaceBetween) |
| 201 | + .width('100%') | ||
| 195 | 202 | ||
| 196 | Blank() | 203 | Blank() |
| 197 | if (this.rmhInfo?.cnIsAttention) { | 204 | if (this.rmhInfo?.cnIsAttention) { |
| @@ -207,14 +214,17 @@ export struct RmhTitle { | @@ -207,14 +214,17 @@ export struct RmhTitle { | ||
| 207 | .fontSize($r('app.float.font_size_13')) | 214 | .fontSize($r('app.float.font_size_13')) |
| 208 | .fontColor(Number(this.followStatus) === 0 ? $r('app.color.color_ED2800') : 0xc6c6c6) | 215 | .fontColor(Number(this.followStatus) === 0 ? $r('app.color.color_ED2800') : 0xc6c6c6) |
| 209 | }.margin({top:4}) | 216 | }.margin({top:4}) |
| 217 | + .height(36) | ||
| 210 | } | 218 | } |
| 211 | .flexShrink(0) | 219 | .flexShrink(0) |
| 212 | .onClick(() => { | 220 | .onClick(() => { |
| 213 | this.handleAccention(); | 221 | this.handleAccention(); |
| 214 | }) | 222 | }) |
| 223 | + .height(36) | ||
| 215 | } | 224 | } |
| 216 | } | 225 | } |
| 217 | .width(CommonConstants.FULL_WIDTH) | 226 | .width(CommonConstants.FULL_WIDTH) |
| 227 | + .height(36) | ||
| 218 | .margin({ bottom: 10 }) | 228 | .margin({ bottom: 10 }) |
| 219 | .onClick(()=>{ | 229 | .onClick(()=>{ |
| 220 | ///个人主页 动态头像不能跳转 | 230 | ///个人主页 动态头像不能跳转 |
-
Please register or login to post a comment