<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>修改问题</title>
<%@include file="/views/common.jsp"%>
<style>
.layui-input,.layui-input-inline{
	width:350px
}
</style>
</head>
<body>
	<div class="layui-input-block layui-form" lay-filter="addUser"
		style="margin-top: 30px">
		<form class="layui-form " action="">
			<input type="hidden" name="id" id="id">
			<div class="layui-form-item">
				<label class="layui-form-label">问题</label>
				<div class="layui-input-inline">
					<input type="text" name="question" lay-verify="question"
						placeholder="请输入问题" class="layui-input" id="question">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">选项A</label>
				<div class="layui-input-inline">
					<input type="text" name="answer1" placeholder="请输入选项A" class="layui-input" id="answer1">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">选项B</label>
				<div class="layui-input-inline">
					<input type="text" name="answer2" placeholder="请输入选项B" class="layui-input" id="answer2">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">选项C</label>
				<div class="layui-input-inline">
					<input type="text" name="answer3" placeholder="请输入选项C" class="layui-input" id="answer3">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">选项D</label>
				<div class="layui-input-inline">
					<input type="text" name="answer4" placeholder="请输入选项D" class="layui-input" id="answer4">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">题目类型</label>
				<div class="layui-input-inline">
					<input type="radio" name="type" value="0" title="单选" checked>
					<input type="radio" name="type" value="0" title="多选">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">正确答案</label>
				<div class="layui-input-inline">
					<input type="text" name="answer" placeholder="请输入正确答案" class="layui-input" id="answer">
				</div>
			</div>


			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit="" lay-filter="enadd">确认修改</button>
				</div>
			</div>
		</form>
	</div>
	<script type="text/javascript">
		layui.use([ 'table', 'laydate', 'form','layer' ], function() {
			var $ = layui.jquery;
			var table = layui.table;
			var laydate = layui.laydate;
			var form = layui.form;
			var layer = layui.layer;
			
			form.on('submit(enadd)',function(data){
				$.ajax({
					url:'${path}/updateQuestion',
					dataType : 'json',
					data:$(data.form).serialize(),
					type : 'post',
					success:function(data){
						if (data.code == 200) {
							layer.msg('修改成功！',{icon:6,offset:"auto",time:2000});//提示框
						}else  {
							layer.msg('修改失败！',{icon:5,offset:"auto",time:2000});//提示框
						}
						setTimeout(function(){
							var index = parent.layer.getFrameIndex(window.name);//获取窗口索引
							parent.layer.close(index);//关闭弹出层
							parent.layui.table.reload("questionTableAll"); //重新加载页面表格
						}, 2100);
					}
				})
				return false;
			});
			
		})
	</script>
</body>
</html>