shawenguan 1 سال پیش
والد
کامیت
70ff78b4fc
1فایلهای تغییر یافته به همراه14 افزوده شده و 1 حذف شده
  1. 14 1
      Scripts/hbcpre/hbcpreHelper.js

+ 14 - 1
Scripts/hbcpre/hbcpreHelper.js

@@ -419,6 +419,19 @@ function handleSeriesInfo(){
     gRetBody = rspData;
 }
 
+function formatNumberWithKAndW(n) {
+    if (n < 1000) {
+        return n.toString();
+    }
+    if (n >= 1000 && n < 10000) {
+        return (n / 1000).toFixed(1) + 'k';
+    }
+    if (n >= 10000 && n < 100000) {
+        return (n / 10000).toFixed(1) + 'w';
+    }
+    return (n / 100000).toFixed(1) + 'w';
+}
+
 function handlerMySeriesList(){
     let rspData = getResponsePlainData();
     if (!rspData) {
@@ -441,7 +454,7 @@ function handlerMySeriesList(){
             item.total = cntDict[seriesName];
         }
         item.seriesName = `${seriesName}#¥${parseFloat(item.avgPrice).toFixed(2)}`;
-        item.authorName = `${item.authorName}\\n(${item.soldNum}/${item.issueNum})`
+        item.authorName = `${item.authorName}(${formatNumberWithKAndW(item.soldNum)}/${formatNumberWithKAndW(item.issueNum)})`;
     }
     gRetBody = rspData;
 }