123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="user-scalable=no">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
- <title></title>
- <link href="answerpage/demo/css/bootstrap.min.css" rel="stylesheet">
- <link type="text/css" rel="stylesheet" href="answerpage/demo/css/common.css">
- <style type="text/css">
- body {
- font-size: 16px;
- font-family: "microsoft yahei";
- background: #fff;
- padding: 0 10px;
- margin: 0 auto;
- }
- html {
- height: 100%;
- width: 100%;
- }
- * {
- margin: 0;
- padding: 0;
- }
- h1 {
- font-size: 20px;
- color: #1ea0fa;
- font-weight: bold;
- }
- h2 {
- font-size: 16px;
- margin-bottom: 10px
- }
- .input {
- width: 100%;
- color: #323232
- }
- .mar-t {
- margin-top: 16px
- }
- .mar-b {
- margin-bottom: 6px
- }
- /*
- li {
- float: left;
- width: 1.5em;
- height: 3.3em;
- cursor: pointer;
- text-indent: -9999px;
- display: inline-block;
- background: url(answerpage/img/star-off.png) no-repeat;
- background-size: 60%;
- } */
- /* li.on {
- width: 1.5em;
- height: 3.3em;
- background: url(star_choies.png) no-repeat;
- background-size: 60%
- } */
- /* .starCon */
- .modal-dialog {
- width: 250px;
- margin: auto;
- /* padding-top: 50%; */
- top: 35%;
- height: 100%;
- }
- .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);
- }
- fieldset {
- border: 0px;
- margin: 0;
- padding: 0;
- }
- .topic__type-title {
- font-size: 16px;
- font-weight: bold;
- line-height: 26px;
- margin-bottom: 10px;
- }
- .topic__type-dry .topic__type-items {
- /* line-height: 1.4; */
- margin-bottom: 6px;
- }
- .mar fieldset{
- margin-top: 20px;
- }
- </style>
- </head>
- <body style=" font-family:microsoft yahei;background-image: url(img/zzpic12840.jpg);background-attachment: fixed;background-repeat: no-repeat;width:100%;height:100%;background-size:cover">
- <!--弹窗提示-->
- <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 class="row" style=" margin:0 auto;margin-top:150px;margin-left:30px;" id="csnrow">
- <div class="col-xs-6 col-sm-4">
- <form class="form-horizontal">
- <div class="form-group">
- <!-- <label for="inputEmail3" class="col-sm-2 control-label">身份证:</label> -->
- <h4 style="margin-left:20px;">身份证:</h4>
- <div class="col-sm-10">
- <input type="text" style="width: 200px" class="form-control" id="inputidl3" placeholder="请输入身份证"><span id="yanz"></span>
- </div>
- </div>
- <div class="form-group">
- <div class="col-sm-offset-2 col-sm-10" style="margin-left:20px;">
- <button type="button" class="btn btn-primary" id="fromque" style="width: 150px">确定</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- <div id="isShow" style="display:none">
- <div style="text-align: center;border-bottom:1px dashed #666;padding-top:26px;padding-bottom:16px">
- <h1 id="reviewqu"></h1>
- <h2 id="reviedescribed">问卷说明:</h2>
- </div>
- <div>
- <div class="margu">
- <h2>请输入所属公司、部门(例如:物业-环境管理部):</h2>
- <input class="input" id="depbuname" type="text" maxlength='20' />
- </div>
- <div class="mar" id="problemVo">
- <!-- <h2>1.第三方第三个</h2>
- <input /> -->
- </div>
- <div style="margin-top:16px;text-align: center">
- <button id="onsumit" style="align-items: center;width:200px;height:45px;border-radius: 15px;background-color:#1ea0fa;color:#fff">提交</button>
- </div>
- </div>
- <div id="xinput" style="display:none"></div>
- </div>
- <script src="answerpage/js/jquery-2.1.4.min.js"></script>
- <script src="answerpage/js/jquery.min.js"></script>
- <script src="answerpage/js/bootstrap.min.js"></script>
- <script src="answerpage/js/jquery.raty.min.js"></script>
- <script>
- $(function () {
- var domain = location.hostname;
- var backDomain = domain + ":";//后端域名
- if (domain === 'localhost') { //开发
- backDomain = "http://localhost:9090/";
- }
- else if (domain === '192.168.124.7') { //开发
- backDomain = "http://192.168.124.7:6062/DPshow_depart/";
- }
- 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 pjid = theRequest.pjd;//项目id
- var qid = theRequest.qd;//问卷id
- var cid = theRequest.cd;//调查id
- var dataObj = "";
- var investigatedName = "";
- var questionnaireId = "";
- var questionnaireName = "";
- var questionnaireDescribed = "";
- var problemVo = "";
- var answerArray = [];
- var answerJson = "";
- var investigatedIsRepeatVo = "";
- var proqc = "";
- var problemjianweVo = "";
- var answerwenArray = [];
- var name = "";
- var reg = /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/;
- var idshen;
- function closeCurPage() {
- var userAgent = navigator.userAgent.toLowerCase();
- if (userAgent.match(/MicroMessenger/i) == "micromessenger") {
- WeixinJSBridge.invoke('closeWindow', {}, function (res) { });
- } else if (userAgent.indexOf("ucbrowser") != -1) {
- alert("感谢您的回答,请点击右上角关闭!");
- window.close();
- window.history.go(-1);
- } else if (userAgent.indexOf("firefox") != -1 || userAgent.indexOf("chrome") != -1) {
- window.location.href = "about:blank";
- window.close();
- } else if (userAgent.match(/QQ/i) == "qq") {
- alert("感谢您的回答,请点击右上角关闭!");
- } else {
- window.opener = null;
- window.open("about:blank", "_self");
- window.close();
- }
- }
- $.fn.raty.defaults.path = 'static/img';
- $.ajax({
- type: "get",
- url: backDomain + "api/canteenInvestigate/getcantequestionnaireaca",
- async: true,
- data: { questionnaireId: qid, projectid: pjid, canteeninsdid: cid, investigatagementid: 2 },
- dataType: 'json',
- success: function (result) {
- // $("#ceshi").append(JSON.stringify(result));
- dataObj = eval(result).data;
- investigatedIsRepeatVo = eval(dataObj).canteenInvestigationliebiaodto;
- questionnaireDescribed = eval(investigatedIsRepeatVo).described;
- $("title").html(investigatedIsRepeatVo.title);
- if (investigatedIsRepeatVo.ispartake == 0) {
- $("#csnrow").css("display", "none")
- window.location.href = 'end.html?title=' + investigatedIsRepeatVo.title + '&rqname=' + investigatedIsRepeatVo.questionnaireName + '&described=' + questionnaireDescribed;
- return;
- }
- problemVo = eval(dataObj).problemVo;
- // problemjianweVo = eval(dataObj).problemjianweVo;
- $("#reviewqu").html(investigatedIsRepeatVo.questionnaireName);
- $("#reviedescribed").append(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>" +
- // class='starTitle' "<div style='margin-left:0px' id='starproqc" + (i + 1) + "'>" + "<h4>" + problemVo[i].name + ":" + "</h4></div>" +
- // "<div class='starCon' id='star" + (i + 1) + "'>" +
- "<fieldset>" +
- "<legend class='topic__type-title' style='border-bottom:0px'>" + (i + 1) + "、" + problemVo[i].title + "</legend>" +
- // "<h2>" + (i + 1) + "、" + problemVo[i].title + "</h2>" +
- // "<ul>" + ulStr + "</ul>" + "<input type='hidden' display: inline; value='0' id='startProble" + i + "'/></div>" + "<div> </div>"
- "<div id='function-demo11" + i + "'class='target-demo'></div>" +
- "<input type='hidden' id='startProble" + i + "'>" + "<div></div>"
- + "</fieldset>"
- );
- for (var j = 0; j < problemVo[i].score; j++) {
- $('#function-demo11' + i).raty({
- number: j+1,//多少个星星设置
- score: 0,//初始值是设置
- targetType: 'number',//类型选择,number是数字值,hint,是设置的数组值
- path: 'img',
- cancelOff: 'cancel-off-big.png',
- cancelOn: 'cancel-on-big.png',
- size: 24,
- starHalf: 'star-half.png',
- starOff: 'star-off.png',
- starOn: 'star-on.png',
- target: '#startProble' + i,
- cancel: false,
- targetKeep: true,
- precision: false,//是否包含小数
- click: function (score, evt) {
- //alert('ID: ' + $(this).attr('id') + "\nscore: " + score + "\nevent: " + evt.type);
- }
- });
- }
- // 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 += "<span class='topic__type-items'><input type='radio' style='margin-top:0.5%;' name='field_name" + i + "'" + "value='" + problemVo[i].option[j].optionId + "'/>" + problemVo[i].option[j].name + "(" + problemVo[i].option[j].optionScore + "分" + ")" + "</span><br>";
- }
- $("#problemVo").append(
- // "<div'> </div>" +
- // "<div id='starproqc" + (i + 1) + "'>" + "<h4>" + problemVo[i].name + ":" + "</h4></div>" margin-left:5%' +
- // "<div class='starCon' id='star'>" +
- "<fieldset>" +
- "<legend class='topic__type-title' style='border-bottom:0px'>" + (i + 1) + "、" + problemVo[i].title + "</legend>" +
- "<div class='topic__type-dry'>"
- +optionStr+
- "</div>"
- +
- "</fieldset>"
- );
- }
- if (problemVo[i].type == 4) {
- $("#problemVo").append(
- // "<div'> </div>" +
- // "<div id='starproqc" + (i + 1) + "'>" + "<h4>" + problemVo[i].name + ":" + "</h4></div>" +
- // "<div class='starCon' id='star'>" +
- "<fieldset>" +
- "<legend class='topic__type-title' style='border-bottom:0px'>" + (i + 1) + "、" + problemVo[i].title + "</legend>" +
- // "<h2>" + (i + 1) + "、" + problemVo[i].title + "</h2>" +
- "<input type='text' class='input' placeholder='请输入答案' maxlength='200' style='margin-top:0.5%' id='textjianda" + i + "' ></input> "
- + "</fieldset>"
- );
- }
- if (problemVo[i].type == 2) {
- if (problemVo[i].answerDescription != null) {
- $("#problemVo").append(
- // "<div> </div>" +
- // "<div id='starproqc" + (i + 1) + "'>" + "<h4>" + problemVo[i].name + ":" + "</h4></div>" +
- // "<div class='starCon' id='star'>" +
- "<fieldset>" +
- "<legend class='topic__type-title' style='border-bottom:0px'>" + (i + 1) + "、" + problemVo[i].title + "</legend>" +
- // "<h2>" + (i + 1) + "、" + problemVo[i].title + "</h2>" +
- "<textarea type='text' placeholder='请输入答案' maxlength='200' style='margin-top:0.5%;width:100%;height:100px' id='text" + i + "' placeholder='" + problemVo[i].answerDescription + "'></textarea>"
- + "</fieldset>"
- )
- } else {
- $("#problemVo").append(
- // "<div> </div>" +
- // "<div class='starCon'>" +
- // "<div id='starproqc" + (i + 1) + "'>" + "<h4>" + problemVo[i].name + ":" + "</h4></div>" +
- "<fieldset>" +
- "<legend class='topic__type-title' style='border-bottom:0px'>" + (i + 1) + "、" + problemVo[i].title + "</legend>" +
- // "<h2>" + (i + 1) + "、" + problemVo[i].title + "</h2>" +
- "<textarea type='text' placeholder='请输入答案' maxlength='200' style='margin-top:0.5%;width:100%;height:100px' id='text" + i + "'></textarea>" + "</fieldset>"
- );
- }
- }
- }
- }
- }
- })
- $("#fromque").click(function () {
- $.ajax({
- type: "get",
- url: backDomain + "api/canteenInvestigate/getcantequestionnaireaca",
- async: true,
- data: { questionnaireId: qid, projectid: pjid, canteeninsdid: cid, investigatagementid: 2 },
- dataType: 'json',
- success: function (result) {
- dataObj = eval(result).data;
- investigatedIsRepeatVo = eval(dataObj).canteenInvestigationliebiaodto;
- $("title").html(investigatedIsRepeatVo.title);
- if (investigatedIsRepeatVo.ispartake == 0) {
- $("#csnrow").css("display", "none")
- window.location.href = 'end.html?title=' + investigatedIsRepeatVo.title + '&rqname=' + investigatedIsRepeatVo.questionnaireName + '&described=' + questionnaireDescribed;
- return;
- }
- }
- })
- idshen = $("#inputidl3").val();
- $.ajax({
- type: "get",
- url: backDomain + "api/canteenScore/bdpsndoccadati",
- async: true,
- data: { bdid: idshen, canteeninsdid: cid },
- dataType: 'json',
- success: function (result) {
- if (eval(result).data == "") {
- } else {
- $(".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();
- closeCurPage();
- return;
- }
- });
- }
- }
- })
- if (reg.test(idshen) == false) {
- $("#yanz").html('');
- $("#inputidl3").css("border-color", "#FF0000")
- $("#yanz").append("<img src='img/li_err.gif'></img><span style='color:#FF0000'>身份证号码不符合规范</span>")
- return;
- } else {
- $("#yanz").html('');
- $("#yanz").append("<img src='img/li_ok.gif'></img>")
- //46002219790309231X
- $.ajax({
- type: "get",
- url: backDomain + "api/canteenInvestigate/bdpsndoc",
- async: true,
- data: { bdid: idshen },
- dataType: 'json',
- success: function (result) {
- if (eval(result).data == null || eval(result).data == "") {
- $('#buthiden').hide();
- $("#modal-body p").html("没有此用户")
- $('#myModal').modal('show')
- return;
- }
- var data = eval(result).data;
- for (let index = 0; index < data.length; index++) {
- name = data[index].creator
- }
- if (data != null || data != "") {
- $("#isShow").css("display", "block")
- // name=
- $("#csnrow").css("display", "none")
- }
- }
- })
- }
- })
- $("#onsumit").click(function () {
- for (var i = 0; i < problemVo.length; i++) {
- var answer = { bdid: "", name: "", depname: "", canteeninsdid: "", problemId: "", potionId: "", score: "", anwen: "", type: "" };
- answer.bdid = idshen;
- answer.name = name;
- answer.depname = $("#depbuname").val();
- answer.type = problemVo[i].type;
- answer.problemId = problemVo[i].id;
- answer.canteeninsdid = cid;
- if ($("#depbuname").val() == '' || $("#depbuname").val() == null) {
- $('#buthiden').hide();
- $("#modal-body p").html("部门不能为空,请填写")
- $('#myModal').modal('show')
- answerArray = []
- break;
- }
- //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;
- }
- //type==3为单选,得到选中的id
- } else if (problemVo[i].type == 3) {
- 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;
- }
- }
- }
- } else if (problemVo[i].type == 4) {//简答题
- answer.anwen = $("#textjianda" + i).val();
- if (answer.anwen == "" || answer.anwen == null) {
- $('#buthiden').hide();
- $("#modal-body p").html("简答题不能为空,请选择")
- $('#myModal').modal('show')
- answerArray = []
- break;
- }
- } else if (problemVo[i].type == 2) {
- answer.anwen = $("#text" + i).val();
- if (answer.anwen == "" || answer.anwen == null) {
- $('#buthiden').hide();
- $("#modal-body p").html("问答题不能为空,请选择")
- $('#myModal').modal('show')
- answerArray = []
- break;
- }
- }
- answerArray.push(answer)
- }
- if (answerArray.length != 0) {
- $.ajax({
- type: "post",
- url: backDomain + "api/canteenScore/updatescore",
- async: true,
- data: { bdid: idshen, canteeninsdid: cid },
- dataType: 'json',
- success: function (result) { }
- });
- $.ajax({
- type: "post",
- url: backDomain + "api/canteenScore/add",
- async: true,
- data: { answer: JSON.stringify(answerArray) },
- dataType: 'json',
- success: function (result) {
- answerArray = [];
- // answerwenArray = [];
- $("input[ type='text' ] ").val("");
- $("textarea[ type='text' ] ").val("");
- $("input[ type='radio' ]").attr("checked", false);
- $(".starCon li").css("background", "url(answerpage/img/star-off.png) no-repeat")
- $('#buthiden').hide();
- $("#modal-body p").html("提交成功")
- $('#myModal').modal('show')
- $(".btn").click(function () {
- // window.opener = null;
- // window.open(' ', '_self');
- // window.close();
- closeCurPage();
- })
- }, error: function (XmlHttpRequest, textStatus, errorThrown) {
- $('#buthiden').hide();
- $("#modal-body p").html("提交失败")
- $('#myModal').modal('show')
- }
- })
- }
- })
- })
- </script>
- </body>
- </html>
|