|
|
function primary_recommend() {
|
|
|
console.log("enter primary_recommend!!!");
|
|
|
let pfloor = document.getElementById('u285_input').value;
|
|
|
let pceiling = document.getElementById('u288_input').value;
|
|
|
let Q1 = Array(pfloor, pceiling);
|
|
|
let Q2 = $('input:radio[name=q2]:checked').val();
|
|
|
let Q3 = $('input:radio[name=q3]:checked').val();
|
|
|
let Q4 = $('input:radio[name=q4]:checked').val();
|
|
|
let Q5 = document.getElementById('u290_input').value;
|
|
|
if (!pceiling || !pfloor || !Q1 || !Q2 || !Q3 || !Q4 || !Q5){
|
|
|
alert("请先完成所有问题再提交!");
|
|
|
return false;
|
|
|
}
|
|
|
if (pfloor < 1500){
|
|
|
alert("预算不得低于1500!");
|
|
|
return false;
|
|
|
}
|
|
|
if (pceiling > 150000){
|
|
|
alert("预算不得高于150000!");
|
|
|
return false;
|
|
|
}
|
|
|
if (pfloor >= pceiling){
|
|
|
alert("价格下限(数字)只能低于上限(数字)!");
|
|
|
return false;
|
|
|
}
|
|
|
if (Q5%0.25 !== 0){
|
|
|
alert("您输入的硬盘容量总需求(数字)不是0.25倍数!");
|
|
|
return false;
|
|
|
}
|
|
|
let primary_data = {'version':'primary', 'Q1' : Q1, 'Q2' : Q2, 'Q3' : Q3, 'Q4' : Q4, 'Q5' : Q5};
|
|
|
if (confirm("已填写完成,是否确认提交?")===true){
|
|
|
$.ajax({
|
|
|
type : "post",
|
|
|
url : "controllers/recommendController.php",
|
|
|
data : primary_data,
|
|
|
dataType : 'json',
|
|
|
success : function (result){
|
|
|
window.sessionStorage.setItem("recommendResult", JSON.stringify(result));
|
|
|
if (result['flag'] === 1)
|
|
|
window.location.href = "qresult0.html";
|
|
|
else if (result['count'] === 1)
|
|
|
window.location.href = "qresult1.html";
|
|
|
else if (result['count'] === 2)
|
|
|
window.location.href = "qresult2.html";
|
|
|
else // count = 3
|
|
|
window.location.href = "qresult3.html";
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} |