123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>答题</title>
- <!-- Bootstrap -->
- <link href="answerpage/demo/css/bootstrap.min.css" rel="stylesheet">
- <style type="text/css">
- #reviewqu {
- font-weight: bold;
- color: rgb(69, 189, 245);
- text-align: center;
- margin: 0 auto;
- }
- #reviename {
- font-weight: bold;
- }
- .starCon {
- margin-bottom: 5em;
- clear: both;
- }
- body {
- /* background-color:azure */
- background-image: url(img/zzpic12840.jpg);
- }
- .starCon {
- position: relative;
- margin: 0 auto;
- }
- .starTitle {
- margin-top: 0.8em;
- }
- .starCon ul {
- float: left;
- display: inline;
- height: 20px;
- line-height: 300px;
- margin-top: 0.8em;
- margin-left: -5%;
- }
- #reviewqu {
- margin-top: 1%;
- font-size: 1.5em;
- }
- #reviename {
- margin-top: 1%;
- }
- #reviedescribed {
- margin-top: 1%;
- }
- /* .starCon ul {
- margin:0 0 0em;
- } */
- .starCon li {
- float: left;
- width: 1.5em;
- height: 3.3em;
- cursor: pointer;
- text-indent: -9999px;
- display: inline-block;
- background: url(/static/answerpage/img/star-off.png) no-repeat;
- background-size: 60%;
- }
- .starCon li.on {
- width: 1.5em;
- height: 3.3em;
- background: url(star_choies.png) no-repeat;
- background-size: 60%
- }
- @media screen and (min-width:400px) {
- .modal-dialog {
- width: 250px;
- margin: auto;
- padding-top: 50%;
- }
- .modal-content {
- -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
- box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
- }
- }
- </style>
- </head>
- <body>
- <!--弹窗提示-->
- <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- <h4 class="modal-title" id="myModalLabel">提示</h4>
- </div>
- <div class="modal-body" id="modal-body">
- <p></p>
- </div>
- <div class="modal-footer">
- <button type="button" data-dismiss="modal" class="btn" var="1">确定</button>
- </div>
- </div>
- </div>
- </div>
- <div id="isShow">
- <div id="isrenf">
- <div class="row" style="margin-left:1%">
- <!--问卷名称-->
- <div id="reviewqu" class="col-xs-12 col-md-12"></div>
- <!--被调查者-->
- <div id="reviename" class="col-xs-12 col-md-12">
- 你这次评价的对象是:
- </div>
- <!--问卷说明-->
- <div id="reviedescribed" class="col-xs-12 col-md-12">
- </div>
- </div>
- <hr/>
- <div class="row">
- <!--问题框-->
- <div id="titleDescription" class="col-xs-9 col-md-9">
- <!--问题详情-->
- <div id="problemVo" class="row" style="margin-left:2%">
- </div>
- <!--是否可以重复提交-->
- <input type="hidden" id="isrepeat">
- <button id="onsumit" style='margin-top:2%;margin-left:8%' type="button" class="btn btn-primary" data-toggle="button" aria-pressed="false"
- autocomplete="off">
- 提交
- </button>
- </div>
- </div>
- <div id="isrenf2"></div>
- </div>
- <script src="answerpage/js/jquery-2.1.4.min.js"></script>
- <script src="answerpage/js/bootstrap.min.js"></script>
- <script>
- $(document).ready(function () {
- var domain = location.hostname;
- var backDomain = domain + ":";//后端域名
- if (domain === 'localhost') { //开发
- backDomain = "http://localhost:9090/";
- } else if (domain === 'duptest.bgyfw.com') { //测试
- backDomain = "http://duptest.bgyfw.com:8002/DPshow_depart/";
- } else if (domain === 'duprc.bgyfw.com') { //预生产
- backDomain = "http://duprc.bgyfw.com:8012/DPshow_depart/";
- } else if (domain === 'dup.bgyfw.com') { //正式
- backDomain = "https://dup.bgyfw.com:8443/DPshow_depart/";
- }
- var url = location.search; //获取url中"?"符后的字串
- var theRequest = new Object();
- if (url.indexOf("?") != -1) {
- var str = url.substr(1);
- strs = str.split("&");
- for (var i = 0; i < strs.length; i++) {
- theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
- }
- }
- var iid = theRequest.id;//被调查人id
- var jid = theRequest.jd;//参与评选人id
- var qid = theRequest.qd;//问卷id
- var dataObj = "";
- var investigatedName = "";
- var questionnaireId = "";
- var questionnaireName = "";
- var questionnaireDescribed = "";
- var problemVo = "";
- var answerArray = [];
- var answerJson = "";
- var investigatedIsRepeatVo ="";
- var problemjianweVo="";
- var answerwenArray=[];
- $("#onsumit").click(function () {
- var isrepeat = $("#isrepeat").val();
- if (isrepeat == 1) {
- $.ajax({
- type: "post",
- url: backDomain + "api/reviewScore/updataflag",
- async: true,
- data: { id: iid, questionnaireId: qid, judgeId: jid },
- dataType: 'json',
- success: function (result) { }
- })
- }
- for (var i = 0; i < problemVo.length; i++) {
- var answer = { judgeId: "", problemId: "", potionId: "", score: "", type: "" };
- answer.judgeId = jid;
- answer.type = problemVo[i].type;
- answer.problemId = problemVo[i].id;
- //type==1为量表题,得到星星数
- if (problemVo[i].type == 1) {
- answer.score = $("#startProble" + i).val()
- if (answer.score == 0) {
- $('#buthiden').hide();
- $("#modal-body p").html("问题" + (i + 1) + "不能为空,请选择")
- $('#myModal').modal('show')
- answerArray = []
- break;
- }
- }else if (problemVo[i].type == 3) {//type==3为单选,得到选中的id
- var potionId = $("input[name='field_name" + i + "']:checked").val();
- if (potionId == undefined) {
- $('#buthiden').hide();
- $("#modal-body p").html("问题" + (i + 1) + "不能为空,请选择")
- $('#myModal').modal('show')
- answerArray = []
- break;
- } else {
- var optionStr = problemVo[i].option;
- for (var j = 0; j < optionStr.length; j++) {
- if (optionStr[j].optionId == potionId) {
- answer.score = optionStr[j].optionScore;
- answer.potionId = potionId;
- }
- }
- }
- }
- answerArray.push(answer)
- }
- for (var i = 0; i < problemjianweVo.length; i++) {
- var answer = { judgeId: "", problemId: "", potionId: "", score: "", type: "" };
- answer.judgeId = jid;
- answer.type = problemjianweVo[i].type;
- answer.problemId = problemjianweVo[i].id;
- //type==2为问答题,得到输入框值
- if (problemjianweVo[i].type == 2) {
- answer.score = $("#text" + i).val();
- if (answer.score == "" || answer.score == null) {
- $('#buthiden').hide();
- $("#modal-body p").html("问答题不能为空,请选择")
- $('#myModal').modal('show')
- answerwenArray = []
- break;
- }
- }
- answerwenArray.push(answer);
- }
- if (answerArray.length != 0||answerwenArray.length!=0) {
- $.ajax({
- type: "post",
- url: backDomain + "api/reviewScore/add",
- async: true,
- data: { answer: JSON.stringify(answerArray),answenwer: JSON.stringify(answerwenArray) },
- dataType: 'json',
- success: function (result) {
- answerwenArray=[];
- answerArray=[];
- $(" input[ type='text' ] ").val("");
- $("input[ type='radio' ]").attr("checked",false);
- $('#buthiden').hide();
- $("#modal-body p").html("提交成功")
- $('#myModal').modal('show')
- $(".btn").click(function () {
- window.opener=null;
- window.open('','_self');
- window.close();
- })
- }, error: function (XmlHttpRequest, textStatus, errorThrown) {
- $('#buthiden').hide();
- $("#modal-body p").html("提交失败")
- $('#myModal').modal('show')
- }
- })
- }
- })
- $.ajax({
- type: "get",
- url:
- backDomain + "api/reviewQuestionnaire/getreviewquestionnaireanswer",
- async: true,
- data: { investigatedId: iid, reviewJudgeId: jid, questionnaireId:qid},
- dataType: 'json',
- success: function (result) {
- // var dataol = JSON.stringify(result.data.flag);
- var is_show = true;
- dataObj = eval(result).data;
- // alert(JSON.stringify(dataObj))
- investigatedIsRepeatVo = eval(dataObj).investigatedIsRepeatVo;
- if (investigatedIsRepeatVo.flag == 1) {
- $("#modal-body p").html("该问卷调查已结束,谢谢你的参与")
- $('#myModal').modal('show')
- $('#isShow').hide();
- $(".btn").click(function () {
- window.opener=null;
- window.open('','_self');
- window.close();
- })
- }
- if(investigatedIsRepeatVo.flag == 0 && investigatedIsRepeatVo.isRepeat==1){
- $('#isrepeat').val(1);
- }
- if (investigatedIsRepeatVo.flag ==0 && investigatedIsRepeatVo.isSubmission == 1 && investigatedIsRepeatVo.isRepeat == 0) {
- $("#modal-body p").html("该问卷你已提交,谢谢你的参与")
- $('#myModal').modal('show')
- $('#isShow').hide();
- $(".btn").click(function () {
- window.opener=null;
- window.open('','_self');
- window.close();
- })
- }
- if (investigatedIsRepeatVo.flag == 0 && investigatedIsRepeatVo.isSubmission == 1 && investigatedIsRepeatVo.isRepeat == 1) {
- $(".modal-footer").append(
- "<button id='buthiden' type='button' data-dismiss='modal' class='btn' var='2'/ >取消</button>"
- );
- $("#modal-body p").html("该问卷你已提交,再次提交以此份为准,是否继续")
- $('#myModal').modal('show')
- $(".btn").on("click", function () {
- if ($(this).attr("var") == 2) {
- $('#isShow').hide();
- window.opener=null;
- window.open('','_self');
- window.close();
- }
- });
- }
- investigatedName = eval(dataObj).investigatedName;
- questionnaireId = eval(dataObj).questionnaireId;
- questionnaireName = eval(dataObj).questionnaireName;
- questionnaireDescribed = eval(dataObj).questionnaireDescribed;
- problemVo = eval(dataObj).problemVo;
- problemjianweVo=eval(dataObj).problemjianweVo;
- $("#reviewqu").html(questionnaireName);
- $("#reviename").append(investigatedName);
- $("#reviedescribed").html(questionnaireDescribed);
- $("#problemVo").html("");
- if(problemVo.length!=0){
- for (var i = 0; i < problemVo.length; i++) {
- //type==1为量表题
- if (problemVo[i].type == 1) {
- var ulStr = "";
- for (var j = 0; j < problemVo[i].score; j++) {
- ulStr += "<li><a href='javascript:;'>" + (j + 1) + "</li>";
- }
- $("#problemVo").append(
- "<div> </div>"+
- "<div style='margin-left:0px' id='starproqc"+(i + 1) + "'>" +"<h4>"+problemVo[i].name +":"+"</h4></div>"+
- "<div class='starCon' id='star" + (i + 1) + "'>" +
- "<div class='starTitle'>" + (i + 1) + "、" + problemVo[i].title + "</div>" +
- "<ul>" + ulStr + "</ul>" + "<input type='hidden' value='0' id='startProble" + i + "' /></div>"+"<div> </div>"
- );
- starComm('star' + (i + 1));
- function starComm(starId) {
- var oStar = document.getElementById(starId);
- var aLi = oStar.getElementsByTagName("li");
- var oUl = oStar.getElementsByTagName("ul")[0];
- var oP = oStar.getElementsByTagName("input")[0];
- var i = iScore = iStar = 0;
- for (i = 1; i <= aLi.length; i++) {
- aLi[i - 1].index = i;
- //点击后进行评分处理
- aLi[i - 1].onclick = function () {
- iStar = this.index;
- fnPoint(iStar);
- oP.value = iStar;
- }
- }
- //评分处理
- var fnPoint = function (iArg) {
- //分数赋值
- iScore = iArg || iStar;
- for (i = 0; i < aLi.length; i++) aLi[i].className = i < iScore ? "on" : "";
- }
- }
- }
- if (problemVo[i].type == 3) {
- var optionStr = "";
- for (var j = 0; j < problemVo[i].option.length; j++) {
- optionStr += "<input type='radio' style='margin-top:1.5%;margin-left:5%' name='field_name" + i + "'" + "value='" + problemVo[i].option[j].optionId + "'/>" + problemVo[i].option[j].name + "<br>";
- }
- $("#problemVo").append(
- "<div> </div>"+
- "<div style='margin-left:0px' id='starproqc"+(i + 1) + "'>" +"<h4>"+problemVo[i].name +":"+"</h4></div>"+
- "<div class='starCon' id='star'>" +
- "<div class='starTitle'>" + (i + 1) + "、" + problemVo[i].title + "</div>" +
- optionStr + "</div>"+"<div> </div>"
- );
- }
- }
- }
- if(problemjianweVo.length!=0){
- for(var i=0;i<problemjianweVo.length;i++){
- if (problemjianweVo[i].type == 2) {
- $("#problemVo").append(
- "<div> </div>"+
- "<div class='starCon' id='star'>" +
- "<div class='starTitle'>" + problemjianweVo[i].title + "</div>" +
- "<textarea type='text' style='margin-top:2%;margin-left:5%;width:280px;height:100px' id='text" + i + "' placeholder='" + problemjianweVo[i].answerDescription + "'></textarea></div>"+"<div> </div>"
- );
- }
- }
- }
- }
- })
- })
- </script>
- </body>
- </html>
|