|
@@ -174,15 +174,15 @@ function renderContent(list, contentWrapClassName){
|
|
|
|
|
|
function renderContentscale(list, contentWrapClassName, name) {
|
|
|
var pushInfo = []
|
|
|
- anchors = '<li><i></i><a href="#' + contentWrapClassName +
|
|
|
- '">' + name + '</a></li><li class="anchor-line"></li>';
|
|
|
- str = '<p class="scaletitle">' + name + '</p>'
|
|
|
- $(`.${contentWrapClassName} .infos .infos-box`).append(str);
|
|
|
- $(`.${contentWrapClassName} .anchors ul`).append(anchors);
|
|
|
+ var textType = []
|
|
|
for (var i = 0; i < list[0].detailList.length; i++) {
|
|
|
var item = list[0].detailList[i];
|
|
|
- console.log(item)
|
|
|
+ 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>';
|
|
|
+
|
|
|
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 +
|
|
|
'">'
|
|
@@ -190,18 +190,18 @@ function renderContentscale(list, contentWrapClassName, name) {
|
|
|
str += '</h2></div>'
|
|
|
str = `<div class="infoWrapper">${str}</div>`
|
|
|
$(`.${contentWrapClassName} .infos .infos-box`).append(str);
|
|
|
+ $(`.${contentWrapClassName} .anchors ul`).append(anchors);
|
|
|
for (var j = 0; j < item.subList.length; j++) {
|
|
|
var items = item.subList[j];
|
|
|
for (var k = 0; k < items.detailList.length; k++) {
|
|
|
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 == 1) {
|
|
|
+ str = '<div class="contentList" data-id="' + it.parentId + '-' + it.groupNum + '"><div class="item-list">';
|
|
|
+ if (it.selectType == 21) {
|
|
|
str += '<p class="item-title">' + it.content + '</p>'
|
|
|
- } else if (it.selectType == 2) {
|
|
|
+ } 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);
|
|
@@ -209,21 +209,21 @@ function renderContentscale(list, contentWrapClassName, name) {
|
|
|
var its = it.subList[0].detailList[l];
|
|
|
its.content = its.content && its.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix);
|
|
|
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="checkbox" name="scale' + its.parentId + '" value="' + its.score + '"/>'
|
|
|
- } else if (it.selectType == 2 && item.resultType == 1) {
|
|
|
- str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="radio" value="' + its.score + '" />'
|
|
|
- } else if (it.selectType == 1 && item.resultType == 2) {
|
|
|
+ if (it.selectType == 21 && item.resultType == 1) {
|
|
|
+ str += '<label><input class="radio_type" type="radio" name="scale' + its.parentId + '" value="' + its.score + '"/>'
|
|
|
+ } 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 == 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 + '"/>'
|
|
|
+ } 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 + '"/>'
|
|
|
- } else if (it.selectType == 2 && item.resultType == 2) {
|
|
|
- str += '<label><input class="radio_type" name="scale' + its.parentId + '" type="radio" value="' + its.result + '" data_obj="' + its.result + '"/>'
|
|
|
}
|
|
|
str += its.content
|
|
|
if (item.resultType == 1) {
|
|
|
str += '<span class="num">' + '(' + its.score + ')' + '</span>'
|
|
|
}
|
|
|
str += '</label>'
|
|
|
- str += `${item.match ? `<img class="recommend" src=${recommend} />` : ``}</div>`
|
|
|
+ str += `${its.match == 1 ? `<img class="recommend" src=${recommend} />` : ``}</div>`
|
|
|
$(".scale .infos .infos-box .infoWrapper .infoBox[data-id=" + it.parentId + "] .contentList .item-content[data-id=" + its.parentId + "]").append(str);
|
|
|
}
|
|
|
}
|
|
@@ -245,7 +245,7 @@ function renderContentscale(list, contentWrapClassName, name) {
|
|
|
str = '<div class="scalebot">'
|
|
|
str += '<p class="score"></p>'
|
|
|
str += '<button class="but">结果</button></div>'
|
|
|
- str += '<div class="result"><div class="result_box"><p class="hel">?</p><span>结果:</span><p id="result_title" class="result_title"></p><textarea id="inputs"></textarea></div></div>'
|
|
|
+ str += `<div class="result"><div class="result_box"><img src=${hel} class="hel"/><span>结果:</span><p id="result_title" class="result_title"></p><textarea id="inputs"></textarea></div></div>`
|
|
|
str += `<div class="foot"><div class="foot_box"><div class="printing"><img src=${printing} class="slideImg"/>打印</div><div class="copy">确认并复制结果</div></div></div>`
|
|
|
$(`.${contentWrapClassName} .infos .infos-box`).append(str);
|
|
|
// str = `<div class="foot"><div class="foot_box"><div class="printing"><img src=${printing} class="slideImg"/>打印</div><div class="copy">确认并复制结果</div></div></div>`
|
|
@@ -267,50 +267,92 @@ function renderContentscale(list, contentWrapClassName, name) {
|
|
|
adjustHeight();
|
|
|
adjustWidth()
|
|
|
getcheck()
|
|
|
- getResult(pushInfo)
|
|
|
- copy()
|
|
|
+ getResult(pushInfo, textType)
|
|
|
+ copy(name)
|
|
|
getprinting()
|
|
|
}
|
|
|
|
|
|
function getprinting() {
|
|
|
$('.printing').click(function () {
|
|
|
$('.foot').hide()
|
|
|
- $('.hel').hide()
|
|
|
+ // $('.hel').hide()
|
|
|
$('#Print').css({
|
|
|
'height': 'auto', //高度自动
|
|
|
}).jqprint();
|
|
|
$('.foot').show()
|
|
|
- $('.hel').show()
|
|
|
-
|
|
|
+ // $('.hel').show()
|
|
|
})
|
|
|
-
|
|
|
}
|
|
|
|
|
|
function getcheck() {
|
|
|
$('input:radio').click(function () {
|
|
|
- var domName = $(this).attr('name');
|
|
|
- var $radio = $(this);
|
|
|
+ const domName = $(this).attr('name');
|
|
|
+ const $radio = $(this);
|
|
|
+ const id = $(this).parents('.contentList').data("id");
|
|
|
if ($radio.data('waschecked') == true) {
|
|
|
$radio.prop('checked', false);
|
|
|
$("input:radio[name='" + domName + "']").data('waschecked', false);
|
|
|
+ $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", false);
|
|
|
+ if (isclick) {
|
|
|
+ getchecks()
|
|
|
+ $(".score").html('');
|
|
|
+ $(".result_title").html('');
|
|
|
+ $(".result").css('display', 'none')
|
|
|
+ $(".foot").css('display', 'none')
|
|
|
+ }
|
|
|
} else {
|
|
|
$radio.prop('checked', true);
|
|
|
$("input:radio[name='" + domName + "']").data('waschecked', false);
|
|
|
$radio.data('waschecked', true);
|
|
|
+ $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
|
|
|
+ if (isclick) {
|
|
|
+ getchecks()
|
|
|
+ console.log(11)
|
|
|
+ $(".score").html('');
|
|
|
+ $(".result_title").html('');
|
|
|
+ $(".result").css('display', 'none')
|
|
|
+ $(".foot").css('display', 'none')
|
|
|
+ }
|
|
|
}
|
|
|
- console.log("选中状态:", $(this).prop("checked"));
|
|
|
- console.log($("input:radio[name='" + domName + "']:checked").val());
|
|
|
+ });
|
|
|
+ $('input:checkbox').click(function () {
|
|
|
+ const domName = $(this).attr('name');
|
|
|
+ const $radio = $(this);
|
|
|
+ const id = $(this).parents('.contentList').data("id");
|
|
|
+ $radio.parents('.contentList').each(function (i) {
|
|
|
+ if ($(this).find('input[type="checkbox"]:checked').val() == undefined) {
|
|
|
+ $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", false);
|
|
|
+ if (isclick) {
|
|
|
+ getchecks()
|
|
|
+ $(".score").html('');
|
|
|
+ $(".result_title").html('');
|
|
|
+ $(".result").css('display', 'none')
|
|
|
+ $(".foot").css('display', 'none')
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $radio.parents('.contentList').siblings(".contentList[data-id='" + id + "']").find('.radio_type').attr("disabled", true);
|
|
|
+ if (isclick) {
|
|
|
+ getchecks()
|
|
|
+ $(".score").html('');
|
|
|
+ $(".result_title").html('');
|
|
|
+ $(".result").css('display', 'none')
|
|
|
+ $(".foot").css('display', 'none')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function copy() {
|
|
|
+function copy(name) {
|
|
|
$(".copy").click(function () {
|
|
|
var texts = document.getElementById("result_title").innerText;
|
|
|
if (texts == '') {
|
|
|
+ Toast('结果为空,无法复制', 500)
|
|
|
return
|
|
|
}
|
|
|
var inputs = document.getElementById("inputs");
|
|
|
- inputs.value = texts; // 修改文本框的内容(赋值内容)
|
|
|
+ inputs.value = name + '结果为:' + texts; // 修改文本框的内容(赋值内容)
|
|
|
+ console.log(inputs.value)
|
|
|
inputs.select(); // 选中文本
|
|
|
document.execCommand("copy"); // 执行浏览器复制命令
|
|
|
Toast('复制成功', 500)
|
|
@@ -321,48 +363,80 @@ function copy() {
|
|
|
})
|
|
|
|
|
|
}
|
|
|
+function getchecks() {
|
|
|
+ $(".contentList").each(function (i) {
|
|
|
+ if ($(this).find('input[type="radio"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
|
|
|
+ $(this).find(".item-title").addClass('chColor');
|
|
|
+ } else {
|
|
|
+ $(this).find(".item-title").removeClass('chColor');
|
|
|
+ }
|
|
|
+ if ($(this).find('input[type="checkbox"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
|
|
|
+ $(this).find(".item-titles").addClass('chColor');
|
|
|
+ } else {
|
|
|
+ $(this).find(".item-titles").removeClass('chColor');
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
-function getResult(pushInfo) {
|
|
|
+function getResult(pushInfo, textType) {
|
|
|
$(".but").click(function () {
|
|
|
let arr = [];
|
|
|
+ let multarr = []
|
|
|
+ let multname
|
|
|
let num = 0
|
|
|
let result
|
|
|
let key = false
|
|
|
+ let proposal = ''
|
|
|
$(".contentList").each(function (i) {
|
|
|
- if ($(this).find('input[type="radio"]:checked').val() == undefined) {
|
|
|
- $(this).find(".item-titles").addClass('chColor');
|
|
|
- } else {
|
|
|
- $(this).find(".item-titles").removeClass('chColor');
|
|
|
- }
|
|
|
- if ($(this).find('input[type="checkbox"]: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');
|
|
|
} else {
|
|
|
$(this).find(".item-title").removeClass('chColor');
|
|
|
}
|
|
|
+ if ($(this).find('input[type="checkbox"]:checked').val() == undefined && $(this).find('.radio_type').attr('disabled') == undefined) {
|
|
|
+ $(this).find(".item-titles").addClass('chColor');
|
|
|
+ } else {
|
|
|
+ $(this).find(".item-titles").removeClass('chColor');
|
|
|
+ }
|
|
|
});
|
|
|
- if (!$(".contentList").find(".item-title").hasClass('chColor')) {
|
|
|
+ if (!$(".contentList").find(".item-title").hasClass('chColor') && !$(".contentList").find(".item-titles").hasClass('chColor')) {
|
|
|
+ isclick = true
|
|
|
$('input[type="radio"]:checked').each(function () {
|
|
|
- if (Number($(this).val())) {
|
|
|
+ if (!isNaN($(this).val())) {
|
|
|
num += parseFloat($(this).val())
|
|
|
} else {
|
|
|
arr.push($(this).attr("data_obj"))
|
|
|
}
|
|
|
});
|
|
|
$('input[type="checkbox"]:checkbox:checked').each(function () {
|
|
|
- if (Number($(this).val())) {
|
|
|
+ if (!isNaN($(this).val())) {
|
|
|
num += parseFloat($(this).val())
|
|
|
} else {
|
|
|
- arr.push($(this).attr("data_obj"))
|
|
|
+ multname = $(this).parents('.item-content').siblings('.item-titles').html()
|
|
|
+ multarr.push($(this).attr("data_obj"))
|
|
|
}
|
|
|
});
|
|
|
- tmp = arr.join(",");
|
|
|
+
|
|
|
+ if (multarr.join("、")) {
|
|
|
+ console.log(1)
|
|
|
+ arr.push(multname + multarr.join("、"))
|
|
|
+ }
|
|
|
+ console.log(arr)
|
|
|
+ tmp = arr.join(";");
|
|
|
if (pushInfo.length > 0) {
|
|
|
for (var i = 0; i < pushInfo.length; i++) {
|
|
|
- if (pushInfo[i].content.max >= num >= pushInfo[i].content.min) {
|
|
|
+ if (pushInfo[i].content.max >= num && num >= pushInfo[i].content.min) {
|
|
|
if (tmp) {
|
|
|
- result = pushInfo[i].result + ';' + tmp
|
|
|
+ result = pushInfo[i].result + '(' + num + '分' + ')' + ';' + tmp
|
|
|
+ proposal = pushInfo[i].pushInfo
|
|
|
+
|
|
|
} else {
|
|
|
- result = pushInfo[i].result
|
|
|
+ result = pushInfo[i].result + '(' + num + '分' + ')'
|
|
|
+ proposal = pushInfo[i].pushInfo
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (tmp) {
|
|
|
+ result = tmp
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -370,22 +444,30 @@ function getResult(pushInfo) {
|
|
|
result = tmp
|
|
|
}
|
|
|
|
|
|
- $(".result_title").attr({
|
|
|
- "title": result
|
|
|
- });
|
|
|
- $(".hel").attr({
|
|
|
- "title": result
|
|
|
- });
|
|
|
- $(".result_title").html(result);
|
|
|
- $(".score").html('总分:' + num + '分');
|
|
|
- $(".score").css('display', 'block')
|
|
|
- $(".result").css('display', 'block')
|
|
|
- $(".foot").css('display', 'block')
|
|
|
+ if (result == undefined) {
|
|
|
+ if ($.inArray(13, textType) > 0) {
|
|
|
+ $(".score").html('总分:' + num + '分');
|
|
|
+ }
|
|
|
+ $(".score").css('display', 'block')
|
|
|
+ $(".copy").css('display', 'none')
|
|
|
+ $(".foot").css('display', 'block')
|
|
|
+ } else {
|
|
|
+ $(".hel").attr({
|
|
|
+ "title": proposal
|
|
|
+ });
|
|
|
+ $(".result_title").html(result);
|
|
|
+ if ($.inArray(13, textType) > 0) {
|
|
|
+ $(".score").html('总分:' + num + '分');
|
|
|
+ }
|
|
|
+ $(".result").css('display', 'block')
|
|
|
+ $(".score").css('display', 'block')
|
|
|
+ $(".copy").css('display', 'block')
|
|
|
+ $(".foot").css('display', 'block')
|
|
|
+ }
|
|
|
} else {
|
|
|
- Toast('温馨提示:必填选项不能为空~', 500)
|
|
|
+ Toasts('温馨提示:必填选项不能为空~')
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
$(".printing").hover(
|
|
|
function () {
|
|
|
$(".slideImg").attr("src", printing2);
|
|
@@ -427,8 +509,13 @@ function renderTab(detailList, scale){
|
|
|
$(".tabList").append(`<span class="tab" data-module="scale" data-title="` + showName + `">评估内容</span>`)
|
|
|
//$(".tabBox .title").html(noticeName);
|
|
|
}
|
|
|
- $(".tabList .tab").eq(selectedTab).addClass("activeTab")
|
|
|
- let defaultModuleName = $(".tabList .tab").eq(selectedTab).attr("data-module")
|
|
|
+ if ((getUrlArgObject('page') && getUrlArgObject('page') == 1 && scale) || !detailList['静态知识']) {
|
|
|
+ $(".tabList .tab").eq(1).addClass("activeTab")
|
|
|
+ defaultModuleName = $(".tabList .tab").eq(1).attr("data-module")
|
|
|
+ } else {
|
|
|
+ $(".tabList .tab").eq(0).addClass("activeTab")
|
|
|
+ defaultModuleName = $(".tabList .tab").eq(0).attr("data-module")
|
|
|
+ }
|
|
|
$(`.${defaultModuleName}`).css("display","block")
|
|
|
bindTabClick()
|
|
|
}
|