Blame view

WebRoot/WEB-INF/jsp/sunvote/teacher/paper_view.jsp 9.38 KB
c617106f   孙向锦   添加即时测功能
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
  <%
  	String path = request.getContextPath();
  	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  %>
  <!DOCTYPE html>
  <html lang="zh-CN">
    <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>中天电子-教育管理系统</title>
  
      <!-- Bootstrap -->
      <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  	<link href="../static/css/teach.css" rel="stylesheet">
757dfed6   孙向锦   样例报表
20
  	<link href="../static/css/paper_view.css?t=1" rel="stylesheet">
c617106f   孙向锦   添加即时测功能
21
22
23
24
25
26
27
28
29
30
  
      <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询(media queries)功能 -->
      <!-- 警告:通过 file:// 协议(就是直接将 html 页面拖拽到浏览器中)访问页面时 Respond.js 不起作用 -->
      <!--[if lt IE 9]>
        <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
      <![endif]-->
  	<style>
  		 .analysis table{display:inline-block;vertical-align:middle;}
  		 .resolve_box img{vertical-align:top;}
757dfed6   孙向锦   样例报表
31
32
33
34
35
  		 .up{width:20px;hiehgt:20px;}
  		 .down{width:20px;height:20px;margin-left:10px;}
  		 .save_box{width:100%;height:80px;background:#fff;text-align:center;position:fixed;bottom:0;left:0;}
  		 .container{height:100%;}
  		 .content_report{padding-bottom:80px;min-height:calc(100% - 126px);}
c617106f   孙向锦   添加即时测功能
36
37
38
39
40
41
  	</style>
    </head>
    <body>
    <div class="container">
      <div class="page-header">
  	  <h3 class="col-md-6" id="paper_title"></h3>
757dfed6   孙向锦   样例报表
42
  	   <h3 class="col-md-6">考试时间:<span id="time"></span>分钟</h3>
c617106f   孙向锦   添加即时测功能
43
44
45
  		<div class="clearfix"></div>
  	</div>
  	<div class="content_report">
757dfed6   孙向锦   样例报表
46
47
  
  		<div class="col-md-12 analysis">
c617106f   孙向锦   添加即时测功能
48
  			<ul>
757dfed6   孙向锦   样例报表
49
  				<!--<li>
c617106f   孙向锦   添加即时测功能
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  					<div class="stem">
  						<p>1.如图,检测4个足球,其中超过标准质量的克数记为正数,不足标准质量的克数记为负数.从轻重的角度看,最接近标准的是(  )</p>
  					</div>
  					<div class="option">
  						<ul>
  							<li><span>A.</span><img src="images/option_1.png" /></li>
  							<li><span>B.</span><img src="images/option_2.png" /></li>
  							<li><span>C.</span><img src="images/option_3.png" /></li>
  							<li><span>D.</span><img src="images/option_4.png" /></li>
  						</ul>
  						<div class="clearfix"></div>
  					</div>
  					<div class="resolve">
  					<div class="resolve_box">
  						<p>【答案】 A</p>
  						<p>【解析】由图数一数,可知总共有7位小同学,其中扎小辫的女孩有2人,男孩有5人。
  						故选A。</p>
  
  						<p>【考点】 10以内数的认识</p>
  					</div>
  					<div class="clearfix"></div>
c617106f   孙向锦   添加即时测功能
71
72
73
  					</div>
  
  					<div class="star_box">
757dfed6   孙向锦   样例报表
74
  						<div class="col-md-6"><img src="../static/images/up_ico.png"/><img src="../static/images/down_ico.png"/></div>
c617106f   孙向锦   添加即时测功能
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
  						<div class="col-md-6">
  							<div class="star">
  								<span style="float:left;">难度</span>
  								<ul>
  									<li class="on"></li>
  									<li class="on"></li>
  									<li class="off"></li>
  									<li class="off"></li>
  									<li class="off"></li>
  								</ul>
  							</div>
  							<div class="resolve_click">
  								<a  onclick="slide($(this))">查看解析</a>
  							</div>
  						</div>
  						<div class="clearfix"></div>
  					</div>
757dfed6   孙向锦   样例报表
92
  				</li> -->
c617106f   孙向锦   添加即时测功能
93
94
  			</ul>
  		</div>
757dfed6   孙向锦   样例报表
95
96
97
98
  		<div class="clearfix"></div>
  	</div>
  	<div class="save_box">
  		<input type="button" value="保存" class="btn btn-primary btn-lg topic save" disabled="disabled"/>
c617106f   孙向锦   添加即时测功能
99
  	</div>
c617106f   孙向锦   添加即时测功能
100
101
  	</div>
  	<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
757dfed6   孙向锦   样例报表
102
103
  	<script src="../static/js/echars.js"></script>
  	<script src="../static/js/loading.js"></script>
c617106f   孙向锦   添加即时测功能
104
  	<script>
757dfed6   孙向锦   样例报表
105
106
  	var url="http://127.0.0.1:8080/SunvoteEducation";
  	var question_box=[];
c617106f   孙向锦   添加即时测功能
107
108
109
110
111
112
113
114
  	function slide(obj){                      //查看解析
  		obj.closest(".star_box").siblings(".resolve").slideToggle(function(){
  			if($(".resolve").css("display") == "none")
  				obj.text("查看解析");
  			else
  				obj.text("收起解析");
  		});
  	}
757dfed6   孙向锦   样例报表
115
  			
c617106f   孙向锦   添加即时测功能
116
117
118
119
120
121
  function getQueryString(name) {
  	  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  	  var r = window.location.search.substr(1).match(reg);
  	  if (r != null) return unescape(r[2]); return null;
    	}
  	var PAPER_ID=getQueryString("PAPER_ID");
757dfed6   孙向锦   样例报表
122
123
124
  	var classId=getQueryString("classId");
  	var userid=getQueryString("userid");
  	
c617106f   孙向锦   添加即时测功能
125
126
  	var _html="";
  	$(document).ready(function(){
757dfed6   孙向锦   样例报表
127
  		window.top.loading.remove();
c617106f   孙向锦   添加即时测功能
128
129
130
131
132
133
134
135
136
137
138
  		$.ajax({
  			url:url+"/api/v1/paperinfo",
  			async:false,
  			type:"post",
  			data:{PAPER_ID:PAPER_ID},
  			success:function(data){
  				console.log(data);
  				$("#paper_title").html(data.data.title);
  				$("#time").html(data.data.exam_time);
  				if(data.data.questions.length>0){				
  					for(var i=0;i<data.data.questions.length;i++){
757dfed6   孙向锦   样例报表
139
  						_html += '<li class="question_li" data-id="'+data.data.questions[i].question_id+'"><div class="stem"></div><div class="option"><ul></ul><div class="clearfix"></div></div><div class="resolve"><div class="resolve_box"><p>【答案】 '+data.data.questions[i].answer+'</p><p><span>【解析】</span>'+data.data.questions[i].analysis+'</p></div><div class="clearfix"></div></div><div class="star_box"><div class="col-md-6 move"><img src="../static/images/up_ico.png" class="up"/><img src="../static/images/down_ico.png" class="down"/></div><div class="col-md-6"><div class="star"><span style="float:left;">难度</span></div><div class="resolve_click"><a  onclick="slide($(this))">查看解析</a></div></div><div class="clearfix"></div></div></li>';
c617106f   孙向锦   添加即时测功能
140
141
142
143
144
  					}
  					console.log(_html);
  					$(".analysis ul").html(_html);
  					for(var j=0;j<data.data.questions.length;j++){
  						var option_html="";
757dfed6   孙向锦   样例报表
145
146
147
148
149
150
151
  						var sum=0;
  						var right_num=0;
  						var data1=[];
  						var data2=[];
  						var answer="";
  						var color=[];
  						$(".analysis li .stem").eq(j).append('<span class="li_index">'+(j+1)+'</span>、'+data.data.questions[j].content);
c617106f   孙向锦   添加即时测功能
152
153
154
155
  						var arry_option=data.data.questions[j].option_content;
  						arry_option=arry_option.replace("[","");
  						arry_option=arry_option.replace("]","");
  						arry_option=arry_option.split(",");
757dfed6   孙向锦   样例报表
156
  
c617106f   孙向锦   添加即时测功能
157
158
159
  						for(var x=0;x<arry_option.length;x++){
  							option_html += '<li><span>'+String.fromCharCode(64 + parseInt(x+1))+'.</span>'+arry_option[x]+'</li>';
  						}
757dfed6   孙向锦   样例报表
160
  						$(".option").eq(j).html(option_html);
c617106f   孙向锦   添加即时测功能
161
  						star(j,parseInt(data.data.questions[j].difficulty));
c617106f   孙向锦   添加即时测功能
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
  					}
  				}
  			}
  		})
  	})
  	function star(index,num){                //难度星级
  			$(".star").eq(index).append('<ul></ul>');
  			var li_html="";
  			for(var i=1;i<=num;i++){
  				li_html +='<li class="on"></li>';
  			}
  			for(var j=num;j<5;j++){
  				li_html += '<li class="off"></li>';
  			}
  			
  			$(".star").eq(index).find("ul").html(li_html);
  		}
757dfed6   孙向锦   样例报表
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
  	$(document).on('click', '.move img', function(event) {
  		  event.preventDefault();
  		  $(".save").removeAttr('disabled');
  		  var parent=$(this).closest("li");
  		  var this_index=parent.children(".stem").find(".li_index").html();
  		  var up_index=parent.prev().children(".stem").find(".li_index").html()
  		  console.log(this_index);
  		  console.log(up_index);
  		  var parents=$(this).closest(".analysis").children("ul");
  		  var len=parents.children().length;
  		  if(($(this).is(".up") || $(this).is(".top")) && parent.index()==0){
  		   alert("已经置顶!");
  		   return false;
  		  }else if(($(this).is(".down") || $(this).is(".bottom")) && parent.index()==len-1){
  		   alert("已经置底!");
  		   return false;
  		  }
  		  switch (true) {
  		   case $(this).is(".up"):
  			var prev = parent.prev();
  			var this_index=parent.children(".stem").find(".li_index").html();
  			var up_index=prev.children(".stem").find(".li_index").html();
  			prev.children(".stem").find(".li_index").html(this_index);
  			parent.children(".stem").find(".li_index").html(up_index);
  			parent.insertBefore(prev);
  			break;
  		   case $(this).is(".down"):
  			var next = parent.next();
  			var this_index=parent.children(".stem").find(".li_index").html();
  			var up_index=next.children(".stem").find(".li_index").html();
  			next.children(".stem").find(".li_index").html(this_index);
  			parent.children(".stem").find(".li_index").html(up_index);
  			parent.insertAfter(next);
  			break;
  		   case $(this).is(".top"):
  			parents.prepend(parent);
  			break;
  		   case $(this).is(".bottom"):
  			parents.append(parent);
  			break;
  		  }
  		 // alert("操作完成!!");
  	});
  	 $(".save").click(function(){
  		 	var question_arry=[];
  			for(var i=0;i<$(".question_li").length;i++){
  				question_arry[i]={
  						score: "0",
  						part_score: "0",
  						question_id: $(".question_li").eq(i).attr("data-id"),
  						rank: i.toString(),
  						no_name: i.toString()
  					};
  				
  			}
  			var data={
  				title: $("#paper_title").html(),
  				exam_time: $("#time").html(),
  				paper_type: "101",
  				subject_id: "20",
  				grade_id: "",
  				class_id: classId,
  				user_id: userid,
  				score: "100",
  				questions: question_arry
  			};
  			//console.log(data);
  			$.ajax({
  			url:url+"/api/v1/publishpaper",
  			async:false,
  			type:"post",
  			dataType: "json",
  			headers: {'Content-Type': 'application/json'},
  			data:JSON.stringify(data),
  			success:function(data){
  				alert("上传成功");
  				window.history.go(-1);
  			}
  		})	
  	 })
c617106f   孙向锦   添加即时测功能
259
260
  	</script>
  	
c617106f   孙向锦   添加即时测功能
261
  </html>