Browse Source

[edit][小数位数&打开标签页]

zhangwei 2 years ago
parent
commit
cb8516817a

+ 3 - 1
src/view/iframe/treasure-hunt/components/invite-friends.vue

@@ -60,7 +60,9 @@ const clickShare = (item) => {
         }, 2000)
         }, 2000)
         e.clearSelection();
         e.clearSelection();
     })
     })
-    window.open(item.redirectPath)
+    chrome.tabs.create({
+        url: item.redirectPath
+    })
 }
 }
 
 
 
 

+ 10 - 2
src/view/iframe/treasure-hunt/cover.vue

@@ -16,14 +16,14 @@
             <div class="treasure">
             <div class="treasure">
                 <component-zoom width="335" fontSize="34" style="margin:0 auto;">
                 <component-zoom width="335" fontSize="34" style="margin:0 auto;">
                     <span>Treasure</span>
                     <span>Treasure</span>
-                    <span>{{ state.detail.amountValue }}</span>
+                    <span>{{ toLast(state.detail.amountValue, 2) }}</span>
                 </component-zoom>
                 </component-zoom>
             </div>
             </div>
             <div class="gain">
             <div class="gain">
                 <component-zoom width="335" fontSize="34" style="margin:0 auto;">
                 <component-zoom width="335" fontSize="34" style="margin:0 auto;">
                     <span>Your Gain Up to</span>
                     <span>Your Gain Up to</span>
                     <span>$</span>
                     <span>$</span>
-                    <span>{{ state.detail.upGainAmountValue }}</span>
+                    <span>{{ toLast(state.detail.upGainAmountValue, 3) }}</span>
                 </component-zoom>
                 </component-zoom>
             </div>
             </div>
             <div class="coin">
             <div class="coin">
@@ -118,6 +118,14 @@ chrome.runtime.onMessage.addListener((req, sender, sendResponse) => {
     }
     }
 })
 })
 
 
+const toLast = (num, bit) => {
+    let str = 1
+    for (let i = 0; i < bit; i++) {
+        str = str + '0'
+    }
+    let _num = Number(str)
+    return Math.floor(Number(num) * _num) / _num
+}
 
 
 
 
 const clickBtn = () => {
 const clickBtn = () => {