|
@@ -127,7 +127,7 @@ function renderContentscale(list, contentWrapClassName, name) {
|
|
if (item.textType == 11) {
|
|
if (item.textType == 11) {
|
|
anchors = '<li><i></i><a href="#' + contentWrapClassName + i +
|
|
anchors = '<li><i></i><a href="#' + contentWrapClassName + i +
|
|
'">' + item.content + '</a></li><li class="anchor-line"></li>';
|
|
'">' + item.content + '</a></li><li class="anchor-line"></li>';
|
|
-
|
|
|
|
|
|
+
|
|
item.content = item.content && item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
|
|
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 +
|
|
str = '<div class="infoBox scaleBox" data-id="' + item.id + '"><div class="title"> <h2 class="titleH2" id="' + contentWrapClassName + i +
|
|
'">'
|
|
'">'
|
|
@@ -142,7 +142,6 @@ function renderContentscale(list, contentWrapClassName, name) {
|
|
var it = items.detailList[k];
|
|
var it = items.detailList[k];
|
|
it.content = it.content && it.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
|
|
it.content = it.content && it.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
|
|
str = '<div class="contentList" data-id="' + it.parentId + '"><div class="item-list">';
|
|
str = '<div class="contentList" data-id="' + it.parentId + '"><div class="item-list">';
|
|
- console.log(it)
|
|
|
|
if (it.selectType == 21) {
|
|
if (it.selectType == 21) {
|
|
str += '<p class="item-title">' + it.content + '</p>'
|
|
str += '<p class="item-title">' + it.content + '</p>'
|
|
} else if (it.selectType == 22) {
|
|
} else if (it.selectType == 22) {
|
|
@@ -156,13 +155,13 @@ function renderContentscale(list, contentWrapClassName, name) {
|
|
its.content = its.content && its.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
|
|
its.content = its.content && its.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
|
|
str = '<div class="radio" name="scale' + its.parentId + '" value="' + its.score + '">';
|
|
str = '<div class="radio" name="scale' + its.parentId + '" value="' + its.score + '">';
|
|
if (it.selectType == 21 && item.resultType == 1) {
|
|
if (it.selectType == 21 && item.resultType == 1) {
|
|
- str += '<label><input class="radio_type" type="radio" name="scale' + its.parentId + '" value="' + its.score + '"/>'
|
|
|
|
|
|
+ str += '<label><input class="radio_type" type="radio" name="scale' + it.parentId + '" value="' + its.score + '"/>'
|
|
} else if (it.selectType == 22 && 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 + '" />'
|
|
|
|
|
|
+ str += '<label><input class="radio_type" name="scale' + it.parentId + '" type="checkbox" value="' + its.score + '" />'
|
|
} else if (it.selectType == 21 && 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 + '"/>'
|
|
|
|
|
|
+ str += '<label><input class="radio_type" name="scale' + it.parentId + '" type="radio" value="' + its.result + '" data_obj="' + its.result + '"/>'
|
|
} else if (it.selectType == 22 && 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 += '<label><input class="radio_type" name="scale' + it.parentId + '" type="checkbox" value="' + its.result + '" data_obj="' + its.result + '"/>'
|
|
}
|
|
}
|
|
str += its.content
|
|
str += its.content
|
|
if (item.resultType == 1) {
|
|
if (item.resultType == 1) {
|
|
@@ -234,28 +233,28 @@ function getcheck() {
|
|
$('input:radio').click(function () {
|
|
$('input:radio').click(function () {
|
|
const domName = $(this).attr('name');
|
|
const domName = $(this).attr('name');
|
|
const $radio = $(this);
|
|
const $radio = $(this);
|
|
|
|
+ const id = $(this).parents('.contentList').data("id");
|
|
if ($radio.data('waschecked') == true) {
|
|
if ($radio.data('waschecked') == true) {
|
|
$radio.prop('checked', false);
|
|
$radio.prop('checked', false);
|
|
$("input:radio[name='" + domName + "']").data('waschecked', false);
|
|
$("input:radio[name='" + domName + "']").data('waschecked', false);
|
|
|
|
+ // $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", false);
|
|
} else {
|
|
} else {
|
|
$radio.prop('checked', true);
|
|
$radio.prop('checked', true);
|
|
$("input:radio[name='" + domName + "']").data('waschecked', false);
|
|
$("input:radio[name='" + domName + "']").data('waschecked', false);
|
|
$radio.data('waschecked', true);
|
|
$radio.data('waschecked', true);
|
|
|
|
+ // $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- $('input:checkbox').click(function () {
|
|
|
|
- const domName = $(this).attr('name');
|
|
|
|
- const $radio = $(this);
|
|
|
|
-
|
|
|
|
- if ($radio.data('waschecked') == true) {
|
|
|
|
- $radio.prop('checked', false);
|
|
|
|
- $("input:checkbox[name='" + domName + "']").data('waschecked', false);
|
|
|
|
- } else {
|
|
|
|
- $radio.prop('checked', true);
|
|
|
|
- $("input:checkbox[name='" + domName + "']").data('waschecked', false);
|
|
|
|
- $radio.data('waschecked', true);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ // $('input:checkbox').click(function () {
|
|
|
|
+ // const domName = $(this).attr('name');
|
|
|
|
+ // const $radio = $(this);
|
|
|
|
+ // const id = $(this).parents('.contentList').data("id");
|
|
|
|
+ // if ($radio.data('waschecked') == true) {
|
|
|
|
+ // $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", false);
|
|
|
|
+ // } else {
|
|
|
|
+ // $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
}
|
|
}
|
|
|
|
|
|
function copy(name) {
|
|
function copy(name) {
|
|
@@ -265,7 +264,7 @@ function copy(name) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
var inputs = document.getElementById("inputs");
|
|
var inputs = document.getElementById("inputs");
|
|
- inputs.value = name+'量表结果为:'+texts; // 修改文本框的内容(赋值内容)
|
|
|
|
|
|
+ inputs.value = name + '量表结果为:' + texts; // 修改文本框的内容(赋值内容)
|
|
console.log(inputs.value)
|
|
console.log(inputs.value)
|
|
inputs.select(); // 选中文本
|
|
inputs.select(); // 选中文本
|
|
document.execCommand("copy"); // 执行浏览器复制命令
|
|
document.execCommand("copy"); // 执行浏览器复制命令
|
|
@@ -285,19 +284,18 @@ function getResult(pushInfo, textType) {
|
|
let result
|
|
let result
|
|
let key = false
|
|
let key = false
|
|
$(".contentList").each(function (i) {
|
|
$(".contentList").each(function (i) {
|
|
- if ($(this).find('input[type="radio"]:checked').val() == undefined) {
|
|
|
|
|
|
+ if ($(this).find('input[type="radio"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
|
|
$(this).find(".item-title").addClass('chColor');
|
|
$(this).find(".item-title").addClass('chColor');
|
|
} else {
|
|
} else {
|
|
$(this).find(".item-title").removeClass('chColor');
|
|
$(this).find(".item-title").removeClass('chColor');
|
|
}
|
|
}
|
|
- if ($(this).find('input[type="checkbox"]:checked').val() == undefined) {
|
|
|
|
|
|
+ if ($(this).find('input[type="checkbox"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
|
|
$(this).find(".item-titles").addClass('chColor');
|
|
$(this).find(".item-titles").addClass('chColor');
|
|
} else {
|
|
} else {
|
|
$(this).find(".item-titles").removeClass('chColor');
|
|
$(this).find(".item-titles").removeClass('chColor');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- console.log(!$(".contentList").find(".item-title").hasClass('chColor'))
|
|
|
|
- if (!$(".contentList").find(".item-title").hasClass('chColor')) {
|
|
|
|
|
|
+ if (!$(".contentList").find(".item-title").hasClass('chColor') && !$(".contentList").find(".item-titles").hasClass('chColor')) {
|
|
$('input[type="radio"]:checked').each(function () {
|
|
$('input[type="radio"]:checked').each(function () {
|
|
if (Number($(this).val())) {
|
|
if (Number($(this).val())) {
|
|
num += parseFloat($(this).val())
|
|
num += parseFloat($(this).val())
|
|
@@ -317,9 +315,9 @@ function getResult(pushInfo, textType) {
|
|
for (var i = 0; i < pushInfo.length; i++) {
|
|
for (var i = 0; i < pushInfo.length; i++) {
|
|
if (pushInfo[i].content.max >= num >= pushInfo[i].content.min) {
|
|
if (pushInfo[i].content.max >= num >= pushInfo[i].content.min) {
|
|
if (tmp) {
|
|
if (tmp) {
|
|
- result = pushInfo[i].result + ';' + tmp
|
|
|
|
|
|
+ result = pushInfo[i].result + '(' + num + ')' + ';' + tmp
|
|
} else {
|
|
} else {
|
|
- result = pushInfo[i].result
|
|
|
|
|
|
+ result = pushInfo[i].result + '(' + num + ')'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -333,8 +331,8 @@ function getResult(pushInfo, textType) {
|
|
$(".hel").attr({
|
|
$(".hel").attr({
|
|
"title": result
|
|
"title": result
|
|
});
|
|
});
|
|
- $(".result_title").html(result +'('+ num +')');
|
|
|
|
- if ($.inArray(13, textType)>0){
|
|
|
|
|
|
+ $(".result_title").html(result);
|
|
|
|
+ if ($.inArray(13, textType) > 0) {
|
|
$(".score").html('总分:' + num + '分');
|
|
$(".score").html('总分:' + num + '分');
|
|
}
|
|
}
|
|
$(".score").css('display', 'block')
|
|
$(".score").css('display', 'block')
|