فهرست منبع

结果保留两位小数

wyq 3 سال پیش
والد
کامیت
ccf9b60313
2فایلهای تغییر یافته به همراه4 افزوده شده و 10 حذف شده
  1. 3 1
      src/js/informationOut.js
  2. 1 9
      src/js/staticInfo.js

+ 3 - 1
src/js/informationOut.js

@@ -477,6 +477,8 @@ function getResult(pushInfo, textType, constant) {
           proposals.push($(this).attr("proposal"))
         }
       });
+      num = num + constant
+      num = parseFloat(num).toFixed(2)
       tmp = arr.join(";");
       if (pushInfo.length > 0) {
         for (var i = 0; i < pushInfo.length; i++) {
@@ -505,7 +507,7 @@ function getResult(pushInfo, textType, constant) {
         result = tmp
         proposal = proposals.join(";");
       }
-      num = num+constant
+      
       if (result) {
         $(".hel").attr({
           "title": proposal

+ 1 - 9
src/js/staticInfo.js

@@ -409,14 +409,7 @@ function getResult(pushInfo, textType, constant) {
         }
       });
       num = num + constant
-      var dot = JSON.stringify(num).indexOf(".");
-      if (dot != -1) {
-        var dotCnt = JSON.stringify(num).substring(dot + 1, num.length);
-        if (dotCnt.length > 1) {
-          num = parseFloat(num).toFixed(1)
-        }
-      }
-
+      num = parseFloat(num).toFixed(2)
       tmp = arr.join(";");
       if (pushInfo.length > 0) {
         for (var i = 0; i < pushInfo.length; i++) {
@@ -445,7 +438,6 @@ function getResult(pushInfo, textType, constant) {
         result = tmp
         proposal = proposals.join(";");
       }
-      
       if (result) {
         $(".hel").attr({
           "title": proposal