Showing
3 changed files
with
4 additions
and
11 deletions
| @@ -16,7 +16,8 @@ export class NumberFormatterUtils { | @@ -16,7 +16,8 @@ export class NumberFormatterUtils { | ||
| 16 | // 处理 1万到1亿之间的数字,使用万作为单位,小数点后为0则不显示 | 16 | // 处理 1万到1亿之间的数字,使用万作为单位,小数点后为0则不显示 |
| 17 | const wanUnit = num / 10000; | 17 | const wanUnit = num / 10000; |
| 18 | const formattedWan = wanUnit.toFixed(1); | 18 | const formattedWan = wanUnit.toFixed(1); |
| 19 | - return formattedWan.endsWith('.0') ? `${Math.floor(wanUnit)}万` : `${formattedWan}万`; | 19 | + const wanUnitW = wanUnit.toFixed(0) |
| 20 | + return formattedWan.endsWith('.0') ? `${wanUnitW}万` : `${formattedWan}万`; | ||
| 20 | } else { | 21 | } else { |
| 21 | // 数字达到1亿及以上时,转换为亿并处理小数点后为0的情况 | 22 | // 数字达到1亿及以上时,转换为亿并处理小数点后为0的情况 |
| 22 | const yiUnit = num / 100000000; | 23 | const yiUnit = num / 100000000; |
| @@ -1114,11 +1114,7 @@ struct createImg { | @@ -1114,11 +1114,7 @@ struct createImg { | ||
| 1114 | if (picWidth && picHeight) { | 1114 | if (picWidth && picHeight) { |
| 1115 | let imageH = 305 | 1115 | let imageH = 305 |
| 1116 | let sizeH = this.compWidth * picHeight / picWidth | 1116 | let sizeH = this.compWidth * picHeight / picWidth |
| 1117 | - if (sizeH > imageH) { | ||
| 1118 | - return sizeH | ||
| 1119 | - }else { | ||
| 1120 | - return imageH | ||
| 1121 | - } | 1117 | + return Math.max(sizeH,imageH) |
| 1122 | } else { | 1118 | } else { |
| 1123 | return 305; //普通图 | 1119 | return 305; //普通图 |
| 1124 | } | 1120 | } |
| @@ -207,11 +207,7 @@ struct createImg { | @@ -207,11 +207,7 @@ struct createImg { | ||
| 207 | if (picWidth && picHeight) { | 207 | if (picWidth && picHeight) { |
| 208 | let imageH = 305 | 208 | let imageH = 305 |
| 209 | let sizeH = this.compWidth * picHeight / picWidth | 209 | let sizeH = this.compWidth * picHeight / picWidth |
| 210 | - if (sizeH > imageH) { | ||
| 211 | - return sizeH | ||
| 212 | - }else { | ||
| 213 | - return imageH | ||
| 214 | - } | 210 | + return Math.max(sizeH,imageH) |
| 215 | } else { | 211 | } else { |
| 216 | return 305; //普通图 | 212 | return 305; //普通图 |
| 217 | } | 213 | } |
-
Please register or login to post a comment