Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
test3.html 10.81 KB
Copy Edit Web IDE Raw Blame History
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" charset="utf-8"/>
<title>添加晨检</title>
<link rel="stylesheet" href="css/common.css " />
<link rel="stylesheet" href="css/jquery-weui.min.css" />
<link rel="stylesheet" href="css/swiper.min.css" />
<link rel="stylesheet" href="css/weui.min.css" />
</head>
<body>
<div class="containar">
<div class="weui-panel weui-panel_access">
<div class="weui-panel__ft">
<a href="#" onClick="javascript:history.back(-1);" class="weui-cell weui-cell_access weui-cell_link">
<div class="weui-cell__bd h-tittle" style="color: #999"><span style="margin:0 5px;"><</span>返回
</div>
</a>
</div>
</div>
<div class="weui-cells weui-cells_form">
<div class="weui-cell weui-cell_select weui-cell_select-after">
<div class="weui-cell__hd">
<label class="weui-label">班级</label>
</div>
<div class="weui-cell__bd">
<select id="sel1" class="weui-select">
<option value=""></option>
</select>
</div>
</div>
<table id="ltable" class="gridtable">
<tr>
<th class="firstth">姓名</th>
<th class="firstth">发烧</th>
<th class="firstth">咳嗽</th>
<th class="firstth">手足口病</th>
<th class="firstth">红眼病</th>
<th class="firstth">外伤</th>
<th class="firstth">指甲过长</th>
<th class="firstth"></th>
</tr>
<tr>
</tr>
</table>
</div>
<div class="weui-btn-area" >
<button id="btn_health" onclick="submit()" class="weui-btn weui-btn_primary">提交</button>
</div>
<!--底部导航-->
<div class="weui-tabbar footer">
<a href="home.html" class="weui-tabbar__item weui-bar__item--on">
<div class="weui-tabbar__icon">
<img src="img/icon_bg_bj_active.png" alt="">
</div>
<p class="weui-tabbar__label">校园</p>
</a>
<a href="activities.html" class="weui-tabbar__item">
<div class="weui-tabbar__icon">
<img src="img/icon_bg_hd.png" alt="">
</div>
<p class="weui-tabbar__label">动态</p>
</a>
<a href="contact.html" class="weui-tabbar__item">
<div class="weui-tabbar__icon">
<img src="img/icon_bg_bm.png" alt="">
</div>
<p class="weui-tabbar__label">消息</p>
</a>
<a href="my.html" class="weui-tabbar__item">
<div class="weui-tabbar__icon">
<img src="img/icon_bg_wd.png" alt="">
</div>
<p class="weui-tabbar__label">我的</p>
</a>
</div>
<!--底部导航-->
</div>
<script type="text/javascript" src="js/jquery-2.1.4.js"></script>
<script type="text/javascript" src="js/jquery-weui.js"></script>
<script type="text/javascript" src="js/swiper.js"></script>
<script>
var swiper = new Swiper('.swiper-container', {
pagination: '.swiper-pagination',
paginationClickable: true,
autoplay: 2500
});
</script>
<script type="text/javascript" src="js/jquery-2.1.4.js" ></script>
<script type="text/javascript" src="js/jquery-weui.js" ></script>
<script type="text/javascript" src="js/swiper.js" ></script>
<script src="js/jquery-min.js"></script>
<script src="./js/check_state.js"></script>
<script>
var claid,stunum;
$(function(){
var check = checkState();
$.ajax({
url: "../back/getstate.php",
dataType: "json",
async: false,
success: function (data) {
// alert(JSON.stringify(data));
$rst = data.data;
if ($rst){
claid = Object.keys($rst.state.claid);
console.log(claid);
for (var i=0;i<claid.length;i++){
$.ajax({
url: "../back/cla/qry.php",
dataType: "json",
data: {id: claid[i]},
success: function (data) {
// alert(JSON.stringify(data));
$rst = data.data;
if ($rst){
// console.log($rst.name);
$("<option value='"+$rst[0].id+"'>"+$rst[0].name+"</option>").appendTo("#sel1");
}
},
error:function(xhr,textStatus){
console.log('错误');
console.log(xhr);
console.log(textStatus);
},
});
}
}
},
error:function(xhr,textStatus){
console.log('错误');
console.log(xhr);
console.log(textStatus);
},
});
$("#sel1").change(function () {
$("#ltable tr:not(:first)").empty("");
if ($("#sel1 option:selected").val()!=''){
$.ajax({
url: "../back/stu/qry.php",<!--地址要改-->
data: {
"classID": $("#sel1 option:selected").val(),
},
async: false,
dataType: "json",
type: "get",
success: function (data) {
// alert(JSON.stringify(data));
rst = data.data;
if ($rst){
// console.log($rst.name);
stunum = rst.length;
var table = document.getElementById("ltable");
for (var i=0; i<rst.length; i++){
var newTR = document.createElement("tr");
var newTD1 = document.createElement("td");
var newTD2 = document.createElement("td");
newTD2.id = rst[i].id;
var newTD3 = document.createElement("td");
newTD3.id = rst[i].id;
var newTD4 = document.createElement("td");
newTD4.id = rst[i].id;
var newTD5 = document.createElement("td");
newTD5.id = rst[i].id;
var newTD6 = document.createElement("td");
newTD6.id = rst[i].id;
var newTD7 = document.createElement("td");
newTD7.id = rst[i].id;
//var newTD8 = document.createElement("td");
// newTD8.id = rst[i].id;
var newTD9 = document.createElement("td");
newTD9.id = rst[i].id;
var newText1 = document.createTextNode(rst[i].name);
newTD1.appendChild(newText1);
newTD2.innerHTML='<input value = "发烧" type="checkbox">';
newTD3.innerHTML='<input value= "咳嗽" type="checkbox">';
newTD4.innerHTML='<input value= "手足口病" type="checkbox">';
newTD5.innerHTML='<input value = "红眼病" type="checkbox">';
newTD6.innerHTML='<input value = "外伤" type="checkbox">';
newTD7.innerHTML='<input value = "指甲过长" type="checkbox">';
// newTD8.innerHTML='<input value = "发烧" type="checkbox">';
newTD9.innerHTML='<input value = "" type="checkbox">';
newTR.appendChild(newTD1);
newTR.appendChild(newTD2);
newTR.appendChild(newTD3);
newTR.appendChild(newTD4);
newTR.appendChild(newTD5);
newTR.appendChild(newTD6);
newTR.appendChild(newTD7);
//newTR.appendChild(newTD8);
newTR.appendChild(newTD9);
table.appendChild(newTR);
}
}
},
error:function(xhr,textStatus){
console.log('错误');
console.log(xhr);
console.log(textStatus);
},
});
}
});
})
function submit() {
var content = new Array();
var fname = new Array();
$(":checkbox:checked").each(function(){
// var tablerow = $(this).parent("tr");
// var i=$(this).parentNode.rowIndex;
// var id = document .getElementById ("ltable").rows [i].id;
// var id = tablerow.attr("id");
var noo = 1;
var id = $(this).parent().attr('id');
// console.log(id);
var name = $(this).parents("tr").text();
// console.log(name);
fname[id] = name;
var value = $(this).val();
// console.log(value);
if (content[id]==undefined){
content[id]=value;
} else {
content[id]=content[id]+","+value;
}
if(value=="无"){
noo = 0;
content[id]="";
}
});
for (var key in content) {
console.log(key + ":" + content[key]);
}
for (var key in content){
$.ajax({
url: "../back/health/add.php",
dataType: "json",
data: {
stuid: key,
content: content[key],
stuname: fname[key],
claid: $("#sel1 option:selected").val(),
stunum: stunum,
},
success: function (data) {
alert(JSON.stringify(data));
},
error: function (xhr, textStatus) {
console.log('错误');
console.log(xhr);
console.log(textStatus);
},
})
}
}
</script>
</body>
</html>

Comment ( 0 )

Sign in for post a comment