浏览代码

Merge branch 'dynamicScale0609' into testNew

wyq 4 年之前
父节点
当前提交
6e952ffb8b
共有 2 个文件被更改,包括 20 次插入16 次删除
  1. 19 15
      src/js/staticInfo.js
  2. 1 1
      webpack.config.js

+ 19 - 15
src/js/staticInfo.js

@@ -114,6 +114,7 @@ function renderContent(list, contentWrapClassName) {
 
 function renderContentscale(list, contentWrapClassName, name) {
   var pushInfo = []
+  var textType = []
   // anchors = '<li><i></i><a href="#' + contentWrapClassName +
   //   '">' + name + '</a></li><li class="anchor-line"></li>';
   str = '<p class="scaletitle">' + name + '</p>'
@@ -121,7 +122,8 @@ function renderContentscale(list, contentWrapClassName, name) {
   // $(`.${contentWrapClassName} .anchors ul`).append(anchors);
   for (var i = 0; i < list[0].detailList.length; i++) {
     var item = list[0].detailList[i];
-    
+    console.log(item.resultType)
+    textType.push(item.textType)
     if (item.textType == 11) {
       anchors = '<li><i></i><a href="#' + contentWrapClassName + i +
         '">' + item.content + '</a></li><li class="anchor-line"></li>';
@@ -140,12 +142,11 @@ function renderContentscale(list, contentWrapClassName, name) {
           var it = items.detailList[k];
           it.content = it.content && it.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
           str = '<div class="contentList" data-id="' + it.parentId + '"><div class="item-list">';
-          if (it.selectType == 2) {
+          if (it.selectType == 21) {
             str += '<p class="item-title">' + it.content + '</p>'
-          } else if (it.selectType == 1) {
+          } else if (it.selectType == 22) {
             str += '<p class="item-titles">' + it.content + '</p>'
           }
-
           str += '<div class="item-content" data-id="' + it.id + '">'
           str += '</div></div></div>'
           $(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "]").append(str);
@@ -155,11 +156,11 @@ function renderContentscale(list, contentWrapClassName, name) {
             str = '<div class="radio" name="scale' + its.parentId + '" value="' + its.score + '">';
             if (it.selectType == 1 && item.resultType == 1) {
               str += '<label><input class="radio_type" type="radio" name="scale' + its.parentId + '" value="' + its.score + '"/>'
-            } else if (it.selectType == 2 && item.resultType == 1) {
+            } else if (it.selectType == 22 && item.resultType == 1) {
               str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + its.score + '" />'
-            } else if (it.selectType == 1 && item.resultType == 2) {
+            } 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="' + its.result + '"/>'
-            } else if (it.selectType == 2 && item.resultType == 2) {
+            } else if (it.selectType == 22 && item.resultType == 2) {
               str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="checkbox" value="' + its.result + '" data_obj="' + its.result + '"/>'
             }
             str += its.content
@@ -211,7 +212,7 @@ function renderContentscale(list, contentWrapClassName, name) {
   adjustHeight();
   adjustWidth()
   getcheck()
-  getResult(pushInfo)
+  getResult(pushInfo, textType)
   copy(name)
   getprinting()
 }
@@ -276,7 +277,7 @@ function copy(name) {
 
 }
 
-function getResult(pushInfo) {
+function getResult(pushInfo, textType) {
   $(".but").click(function () {
     let arr = [];
     let num = 0
@@ -284,16 +285,17 @@ function getResult(pushInfo) {
     let key = false
     $(".contentList").each(function (i) {
       if ($(this).find('input[type="radio"]:checked').val() == undefined) {
-        $(this).find(".item-titles").addClass('chColor');
+        $(this).find(".item-title").addClass('chColor');
       } else {
-        $(this).find(".item-titles").removeClass('chColor');
+        $(this).find(".item-title").removeClass('chColor');
       }
       if ($(this).find('input[type="checkbox"]:checked').val() == undefined) {
-        $(this).find(".item-title").addClass('chColor');
+        $(this).find(".item-titles").addClass('chColor');
       } else {
-        $(this).find(".item-title").removeClass('chColor');
+        $(this).find(".item-titles").removeClass('chColor');
       }
     });
+    console.log(!$(".contentList").find(".item-title").hasClass('chColor'))
     if (!$(".contentList").find(".item-title").hasClass('chColor')) {
       $('input[type="radio"]:checked').each(function () {
         if (Number($(this).val())) {
@@ -331,12 +333,14 @@ function getResult(pushInfo) {
         "title": result
       });
       $(".result_title").html(result);
-      $(".score").html('总分:' + num + '分');
+      if ($.inArray(13, textType)>0){
+        $(".score").html('总分:' + num + '分');
+      }
       $(".score").css('display', 'block')
       $(".result").css('display', 'block')
       $(".foot").css('display', 'block')
     } else {
-      Toast('温馨提示:必填选项不能为空~', 500000)
+      Toast('温馨提示:必填选项不能为空~', 500)
     }
   })
 

+ 1 - 1
webpack.config.js

@@ -4,7 +4,7 @@ const CleanWebpackPlugin = require('clean-webpack-plugin') // 清空打包目录
 const MiniCssExtractPlugin = require('mini-css-extract-plugin');
 const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
 const webpack = require('webpack');
-const proxyHost = "http://192.168.2.241:6060";
+const proxyHost = "http://192.168.2.236:6060";
 module.exports = {
   entry: {
     index: path.resolve(__dirname, 'src/js', 'index.js'),