wyq 3 роки тому
батько
коміт
6d0343681e
1 змінених файлів з 9 додано та 10 видалено
  1. 9 10
      src/js/staticInfo.js

+ 9 - 10
src/js/staticInfo.js

@@ -124,11 +124,14 @@ function renderContent(list, contentWrapClassName) {
 function renderContentscale(list, contentWrapClassName, name) {
   var pushInfo = []
   var textType = []
-  var factor, constant
+  var constant
   $('.scaletitle').html(name);
   for (var i = 0; i < list[0].detailList.length; i++) {
     var item = list[0].detailList[i];
     textType.push(item.textType)
+    if (item.resultType == 1) {
+      constant = item.constant
+    }
     if (item.textType == 11) { 
       item.content = item.content && item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
       str = '<div class="infoBox scaleBox" data-id="' + item.id + '"><div class="title"> <h2 class="titleH2" id="' + contentWrapClassName + i +
@@ -156,11 +159,9 @@ function renderContentscale(list, contentWrapClassName, name) {
             its.content = its.content && its.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
             str = '<div class="radio" name="scale' + its.parentId + '" value="' + its.score + '">';
             if (it.selectType == 21 && item.resultType == 1) {
-              console.log(item.factor)
-              console.log(item.constant)
-              str += '<label><input class="radio_type" type="radio" name="scale' + its.parentId + '" value="' + parseFloat(((its.score * it.factor + it.constant) )) + '" resultType="' + item.resultType + '"/>'
+              str += '<label><input class="radio_type" type="radio" name="scale' + its.parentId + '" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor)) + '" resultType="' + item.resultType + '"/>'
             } else if (it.selectType == 22 && item.resultType == 1) {
-              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + parseFloat(((its.score * it.factor + it.constant) )) + '" resultType="' + item.resultType + '"/>'
+              str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + parseFloat(((its.score * it.factor + it.constant) * item.factor)) + '" resultType="' + item.resultType + '"/>'
             } else if (it.selectType == 21 && item.resultType == 2) {
               str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="radio" value="' + its.result + '" data_obj="' + it.content + '' + its.result + '" proposal="' + its.pushInfo + '" resultType="' + item.resultType + '"/>'
             } else if (it.selectType == 22 && item.resultType == 2) {
@@ -233,7 +234,7 @@ function renderContentscale(list, contentWrapClassName, name) {
   adjustHeight();
   adjustWidth()
   getcheck()
-  getResult(pushInfo, textType, factor, constant)
+  getResult(pushInfo, textType, constant)
   copy(name)
   getprinting()
 
@@ -357,7 +358,7 @@ function getchecks() {
     }
   });
 }
-function getResult(pushInfo, textType, factor, constant) {
+function getResult(pushInfo, textType, constant) {
   $(".but").click(function () {
     let arr = [];
     let multarr = []
@@ -445,9 +446,7 @@ function getResult(pushInfo, textType, factor, constant) {
         result = tmp
         proposal = proposals.join(";");
       }
-      console.log(factor+2)
-      console.log(num)
-      // num = num*factor + constant
+      num = num+constant
       if (result) {
         $(".hel").attr({
           "title": proposal