<!-- 年级学科模板 -->
<script type="text/html" id="gradesubjecttemplet">
{{# layui.each(d, function(index, item){ }}
<span>{{index}}</span>:<span style="color:#3E8AF4">{{item}} 、</span>
{{# }); }}
</script>
//获取所有年级
function adminquestionteacherGradelists() {
adminquestionteacherGradelist().then(function(res) {
if(res.code == 1) {
gradelist = {
'type': 'grade',
'data': res.data
};
renderDate('#grade', gradelist);
renderDate('#add_grade', gradelist);
} else {
layer.msg(res.msg, {
time: 2000,
icon: 5
});
}
})
};
//下拉框页面渲染
function renderDate(selector, data) {
var htmls = $("#selecttpl").html();
laytpl(htmls).render(data, function(html) {
$(selector).html(html);
form.on('select(subject)', function(data) {
subject = data.value;
});
form.on('select(grade)', function(data) {
grade = data.value;
});
form.on('select(teacherid)', function(data) {
teacherid = data.value;
console.log(data.value);
});
form.render('select');
});
};
adminquestionteacherGradelists(); //获取所有年级