|
|
|
@ -1,11 +1,20 @@
|
|
|
|
|
layui.define([ 'form', 'laydate', 'table','element','handsOnSimulationTasksApi', 'upload', 'layedit'], function(exports) {
|
|
|
|
|
layui.define([ 'form', 'laydate', 'table','element','handsOnSimulationTasksApi', 'upload', 'layedit','layer','table'], function(exports) {
|
|
|
|
|
var form = layui.form;
|
|
|
|
|
var handsOnSimulationTasksApi = layui.handsOnSimulationTasksApi;
|
|
|
|
|
var index = layui.index;
|
|
|
|
|
var element = layui.element, upload = layui.upload, layedit = layui.layedit
|
|
|
|
|
element.render();
|
|
|
|
|
var layer = layui.layer;
|
|
|
|
|
var table = layui.table;
|
|
|
|
|
var one = layedit.build('test-editor1'); //建立编辑器
|
|
|
|
|
var editor = null;
|
|
|
|
|
var resourcesQuestionTable =null;
|
|
|
|
|
var resourcesQuestionTable1 = null;
|
|
|
|
|
var selectResourcesQuestion = [];
|
|
|
|
|
var resourcesQuestionIds = ""; //选中题目id
|
|
|
|
|
|
|
|
|
|
var courseInfoIds = $("input[name=courseInfoId_1]").val();
|
|
|
|
|
|
|
|
|
|
// setTimeout(function (){
|
|
|
|
|
// editor.init();
|
|
|
|
|
// // $("#test-editor .editormd-preview").width("50%");
|
|
|
|
@ -119,6 +128,142 @@ layui.define([ 'form', 'laydate', 'table','element','handsOnSimulationTasksApi',
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#manualProblemSetting1').click(function () {//手动出题
|
|
|
|
|
layer.open({
|
|
|
|
|
type: 1
|
|
|
|
|
, title: '选择题库'
|
|
|
|
|
,fixed:false//固定页面后,弹出框随着滚动
|
|
|
|
|
, shadeClose: true
|
|
|
|
|
, scrollbar: true//滚动条
|
|
|
|
|
, content: $("#resourcesQuestionTable_demo")
|
|
|
|
|
, btn: ['保存','关闭']
|
|
|
|
|
,success:function () {
|
|
|
|
|
resourcesQuestionTable();
|
|
|
|
|
Lib.getCourseInfo($("select[name='courseInfoId_1']"), courseInfoIds);
|
|
|
|
|
}
|
|
|
|
|
, yes: function (index, layero) {
|
|
|
|
|
layer.close(index);
|
|
|
|
|
$('#resourcesQuestionTable_demo').hide();
|
|
|
|
|
}
|
|
|
|
|
, btn2: function (index, layero) {
|
|
|
|
|
layer.close(index);
|
|
|
|
|
$('#resourcesQuestionTable_demo').hide();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
///jlw/teacherOpenCourseHandsOnSimulationTasks/getObjectiveProblem.do?problemIds=
|
|
|
|
|
var btn = $("#searchFormQuestion");
|
|
|
|
|
btn.on('click', function () {
|
|
|
|
|
resourcesQuestionTable1.reload({
|
|
|
|
|
where: {
|
|
|
|
|
'courseInfoParentId':courseInfoIds,
|
|
|
|
|
'courseInfoId':$("#resourcesQuestionTable_demo select[name='courseInfoId_1']").find("option:selected").val(),
|
|
|
|
|
"questionStem":$("#resourcesQuestionTable_demo input[name='generalQuestionSettingName']").val(),
|
|
|
|
|
'questionType':$("#resourcesQuestionTable_demo select[name='questionType']").find("option:selected").val()
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
table.on('checkbox(resourcesQuestionTable)', function(obj){ //test 是 table 标签对应的 lay-filter 属性
|
|
|
|
|
if (obj.checked) { //选中
|
|
|
|
|
if (obj.type == "all") {//全选
|
|
|
|
|
var checkStatus = table.checkStatus('resourcesQuestionTable').data;
|
|
|
|
|
for (var i = 0; i < checkStatus.length; i++) {
|
|
|
|
|
if (("," + resourcesQuestionIds + ",").indexOf(checkStatus[i].resourcesQuestionId) < 0) {
|
|
|
|
|
if (!$.isEmpty(resourcesQuestionIds)) {
|
|
|
|
|
resourcesQuestionIds += "," + checkStatus[i].resourcesQuestionId;
|
|
|
|
|
} else {
|
|
|
|
|
resourcesQuestionIds = checkStatus[i].resourcesQuestionId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (!$.isEmpty(resourcesQuestionIds)) {
|
|
|
|
|
resourcesQuestionIds += "," + obj.data.resourcesQuestionId;
|
|
|
|
|
} else {
|
|
|
|
|
resourcesQuestionIds = obj.data.resourcesQuestionId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {//取消全选
|
|
|
|
|
if (obj.type == "all") {//全选
|
|
|
|
|
var checkStatus = table.cache["resourcesQuestionTable"];
|
|
|
|
|
for (var i = 0; i < checkStatus.length; i++) {
|
|
|
|
|
resourcesQuestionIds = Lib.stringRemove(resourcesQuestionIds, checkStatus[i].resourcesQuestionId);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
resourcesQuestionIds = Lib.stringRemove(resourcesQuestionIds, obj.data.resourcesQuestionId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$("#countQ").html(resourcesQuestionIds.split(',').length)
|
|
|
|
|
});
|
|
|
|
|
$("#del").click(function () {//清除已选
|
|
|
|
|
resourcesQuestionIds = [];
|
|
|
|
|
$("#countQ").html(0);
|
|
|
|
|
var param = {
|
|
|
|
|
'courseInfoParentId':courseInfoIds,
|
|
|
|
|
'courseInfoId':$("#resourcesQuestionTable_demo select[name='courseInfoId_1']").find("option:selected").val(),
|
|
|
|
|
"questionStem":$("#resourcesQuestionTable_demo input[name='generalQuestionSettingName']").val(),
|
|
|
|
|
'questionType':$("#resourcesQuestionTable_demo select[name='questionType']").find("option:selected").val()
|
|
|
|
|
};
|
|
|
|
|
resourcesQuestionTable1.reload({
|
|
|
|
|
where: param,
|
|
|
|
|
page: {
|
|
|
|
|
curr: 1
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
resourcesQuestionTable= function(){
|
|
|
|
|
resourcesQuestionTable1=table.render({
|
|
|
|
|
elem: '#resourcesQuestionTable',
|
|
|
|
|
cellMinWidth: 100,
|
|
|
|
|
method: 'post',
|
|
|
|
|
even: true,
|
|
|
|
|
size: "sms",
|
|
|
|
|
url: Common.ctxPath + '/jlw/resourcesQuestion/list.json' // 数据接口
|
|
|
|
|
, page: Lib.tablePage // 开启分页
|
|
|
|
|
, limit: 4
|
|
|
|
|
, where: {"courseInfoParentId": courseInfoIds}
|
|
|
|
|
,cols: [[ // 表头
|
|
|
|
|
{
|
|
|
|
|
type: 'checkbox', align: "center"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'questionStem', width: 320,
|
|
|
|
|
title: '题干', align: "center"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'questionType', align: "center", width: 80,
|
|
|
|
|
title: '题型', templet: function (d) {//(1单选 2多选 3判断 4填空 5分析)
|
|
|
|
|
return d.questionType == 1 ? '单选' : d.questionType == 2 ? '多选' : d.questionType == 3 ? '判断' : '-';
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'courseInfoParentName',
|
|
|
|
|
title: '归属课程', align: "center"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'courseInfoName',
|
|
|
|
|
title: '归属章节', align: "center"
|
|
|
|
|
}
|
|
|
|
|
]],done: function(res, curr, count){
|
|
|
|
|
//循环所有数据,找出对应关系,设置checkbox选中状态
|
|
|
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
|
|
|
for (var j = 0; j < resourcesQuestionIds.split(',').length; j++) {
|
|
|
|
|
if (res.data[i].resourcesQuestionId == resourcesQuestionIds.split(',')[j]) {
|
|
|
|
|
//这里才是真正的有效勾选
|
|
|
|
|
res.data[i]["LAY_CHECKED"] = 'true';
|
|
|
|
|
//找到对应数据改变勾选样式,呈现出选中效果
|
|
|
|
|
var index = res.data[i]['LAY_TABLE_INDEX'];
|
|
|
|
|
$('.layui-table tr[data-index=' + index + '] input[type="checkbox"]').prop('checked', true);
|
|
|
|
|
$('.layui-table tr[data-index=' + index + '] input[type="checkbox"]').next().addClass('layui-form-checked');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
var view = {
|
|
|
|
|
init:function(){
|
|
|
|
|
Lib.initGenrealForm($("#addForm"),form);
|
|
|
|
|