考试管理
This commit is contained in:
parent
596bf815a1
commit
7993230f06
|
|
@ -0,0 +1,254 @@
|
|||
package com.ruoyi.exam.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.ruoyi.exam.domain.*;
|
||||
import com.ruoyi.exam.service.IExamPracticeQuestionService;
|
||||
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.exam.service.IExamPracticeService;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.utils.ExcelUtil;
|
||||
|
||||
/**
|
||||
* 练习 信息操作处理
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-28
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/exam/examPractice")
|
||||
public class ExamPracticeController extends BaseController
|
||||
{
|
||||
private String prefix = "exam/examPractice";
|
||||
|
||||
@Autowired
|
||||
private IExamPracticeService examPracticeService;
|
||||
|
||||
@Autowired
|
||||
private IExamPracticeQuestionService examPracticeQuestionService;
|
||||
|
||||
@RequiresPermissions("exam:examPractice:view")
|
||||
@GetMapping()
|
||||
public String examPractice()
|
||||
{
|
||||
return prefix + "/examPractice";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询练习列表
|
||||
*/
|
||||
@RequiresPermissions("exam:examPractice:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(ExamPractice examPractice)
|
||||
{
|
||||
List<ExamPractice> list = examPracticeService.selectExamPracticePage(examPractice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出练习列表
|
||||
*/
|
||||
@RequiresPermissions("exam:examPractice:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(ExamPractice examPractice)
|
||||
{
|
||||
List<ExamPractice> list = examPracticeService.selectExamPracticeList(examPractice);
|
||||
ExcelUtil<ExamPractice> util = new ExcelUtil<ExamPractice>(ExamPractice.class);
|
||||
return util.exportExcel(list, "examPractice");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增练习
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存练习
|
||||
*/
|
||||
@RequiresPermissions("exam:examPractice:add")
|
||||
@Log(title = "练习", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(ExamPractice examPractice)
|
||||
{
|
||||
examPractice.setDelFlag("0");
|
||||
examPractice.setCreateBy(ShiroUtils.getLoginName());
|
||||
examPractice.setCreateDate(new Date());
|
||||
return toAjax(examPracticeService.insert(examPractice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改练习
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||
{
|
||||
ExamPractice examPractice = examPracticeService.selectById(id);
|
||||
mmap.put("examPractice", examPractice);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存练习
|
||||
*/
|
||||
@RequiresPermissions("exam:examPractice:edit")
|
||||
@Log(title = "练习", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(ExamPractice examPractice)
|
||||
{
|
||||
examPractice.setDelFlag("0");
|
||||
examPractice.setUpdateBy(ShiroUtils.getLoginName());
|
||||
examPractice.setUpdateDate(new Date());
|
||||
return toAjax(examPracticeService.updateSelectiveById(examPractice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除练习
|
||||
*/
|
||||
@RequiresPermissions("exam:examPractice:remove")
|
||||
@Log(title = "练习", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(examPracticeService.deleteByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/toManagerPracticeQuestion/{id}")
|
||||
public String toManagerPaperQuestion(@PathVariable("id") Integer id, ModelMap mmap)
|
||||
{
|
||||
mmap.put("examPractice", examPracticeService.selectById(id));
|
||||
JSONObject json = new JSONObject();
|
||||
List<ExamPracticeQuestionVO> examPracticeQuestions = examPracticeQuestionService.selectQuestionForPracticeId(id);
|
||||
for (ExamPracticeQuestionVO examPracticeQuestion : examPracticeQuestions) {
|
||||
//排序用
|
||||
json.append(examPracticeQuestion.getOrderNum().toString()+examPracticeQuestion.getExamQuestionId().toString(),new JSONObject(examPracticeQuestion).toString());
|
||||
}
|
||||
mmap.put("examPracticeQuestion",json.toString());
|
||||
return prefix + "/managerPracticeQuestion";
|
||||
}
|
||||
|
||||
@GetMapping("/addQuestion/{id}")
|
||||
public String addQuestion(@PathVariable("id") String ids, ModelMap mmap)
|
||||
{
|
||||
String[] split = ids.split(",");
|
||||
List<String> strings = Arrays.asList(split);
|
||||
mmap.put("examPracticeId", strings.get(0));
|
||||
mmap.put("examPracticeQuestionIds",strings.subList(1,strings.size()));
|
||||
return prefix + "/examQuestion";
|
||||
}
|
||||
|
||||
// @RequiresPermissions("exam:examPaper:add")
|
||||
// @Log(title = "试卷", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/saveQuestion")
|
||||
@ResponseBody
|
||||
public AjaxResult saveQuestion(@RequestBody List<ExamPracticeQuestion> practiceQuestionList)
|
||||
{
|
||||
ExamPracticeQuestion examPracticeQuestion = practiceQuestionList.get(0);
|
||||
ExamPracticeQuestion delete = new ExamPracticeQuestion();
|
||||
delete.setExamPracticeId(examPracticeQuestion.getExamPracticeId());
|
||||
ExamPractice examPractice = new ExamPractice();
|
||||
examPractice.setId(examPracticeQuestion.getExamPracticeId());
|
||||
examPracticeQuestionService.delete(delete);
|
||||
int num =0;
|
||||
int score = 0;
|
||||
for (int i = 1; i < practiceQuestionList.size(); i++) {
|
||||
ExamPracticeQuestion item = practiceQuestionList.get(i);
|
||||
item.setDelFlag("0");
|
||||
examPracticeQuestionService.insert(item);
|
||||
num++;
|
||||
score+=item.getScore();
|
||||
}
|
||||
examPracticeService.updateSelectiveById(examPractice);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@RequiresPermissions("exam:examPractice:add")
|
||||
@Log(title = "试卷", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/addQuestionForModel")
|
||||
@ResponseBody
|
||||
public AjaxResult addQuestionForModel(@RequestParam(value = "questionId[]" ,required = false) String[] questionId,@RequestParam("practiceId")String practiceId)
|
||||
{
|
||||
//题目数量和总分数
|
||||
int questionNum = 0;
|
||||
int score = 0;
|
||||
ExamPracticeQuestion examPracticeQuestion = new ExamPracticeQuestion();
|
||||
examPracticeQuestion.setExamPracticeId(Integer.parseInt(practiceId));
|
||||
ExamPractice practice = new ExamPractice();
|
||||
if(questionId==null){
|
||||
examPracticeQuestionService.delete(examPracticeQuestion);
|
||||
practice.setId(Integer.parseInt(practiceId));
|
||||
// practice.setQuestionNumber(0);
|
||||
// practice.setScore(0);
|
||||
examPracticeService.updateSelectiveById(practice);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
List<ExamPracticeQuestionVO> dbDatas = examPracticeQuestionService.selectExamPracticeQuestionList(examPracticeQuestion);
|
||||
questionNum +=dbDatas.size();
|
||||
HashSet<Integer> dbSet = new HashSet<>();
|
||||
for (ExamPracticeQuestionVO dbData : dbDatas) {
|
||||
dbSet.add(dbData.getExamQuestionId());
|
||||
score+=dbData.getScore();
|
||||
}
|
||||
|
||||
HashSet<Integer> htmlSet = new HashSet<>();
|
||||
//新增的
|
||||
for (String s : questionId) {
|
||||
Integer i = Integer.parseInt(s);
|
||||
if(!dbSet.contains(i)){
|
||||
ExamPracticeQuestion insert = new ExamPracticeQuestion();
|
||||
insert.setExamPracticeId(Integer.parseInt(practiceId));
|
||||
insert.setDelFlag("0");
|
||||
insert.setCreateDate(new Date());
|
||||
insert.setCreateBy(ShiroUtils.getLoginName());
|
||||
insert.setExamQuestionId(i);
|
||||
insert.setOrderNum(9999);
|
||||
insert.setScore(0);
|
||||
examPracticeQuestionService.insert(insert);
|
||||
questionNum++;
|
||||
}
|
||||
htmlSet.add(i);
|
||||
}
|
||||
|
||||
for (ExamPracticeQuestionVO dbData : dbDatas) {
|
||||
if(!htmlSet.contains(dbData.getExamQuestionId())){
|
||||
examPracticeQuestionService.delete(dbData);
|
||||
questionNum--;
|
||||
score-=dbData.getScore();
|
||||
}
|
||||
}
|
||||
|
||||
practice.setId(Integer.parseInt(practiceId));
|
||||
// practice.setQuestionNumber(questionNum);
|
||||
// practice.setScore(score);
|
||||
examPracticeService.updateSelectiveById(practice);
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,212 @@
|
|||
package com.ruoyi.exam.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.base.BaseEntity;
|
||||
import javax.persistence.Id;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 练习表 exam_practice
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-28
|
||||
*/
|
||||
public class ExamPractice
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 练习ID */
|
||||
@Id
|
||||
private Integer id;
|
||||
/** 部门ID */
|
||||
private Integer deptId;
|
||||
/** 练习名称 */
|
||||
private String name;
|
||||
/** 是否控制开始结束时间(0-不控制,1-控制) */
|
||||
|
||||
/** 是否控制开始结束时间(0-不控制,1-控制) */
|
||||
private String enableControlTime;
|
||||
/** 开始时间 */
|
||||
private Date startTime;
|
||||
/** 结束时间 */
|
||||
private Date endTime;
|
||||
/** 练习对象(1-所有人,2-限定对象) */
|
||||
private String practiceUserLimit;
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
private Date createDate;
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
private Date updateDate;
|
||||
/** 考试说明 */
|
||||
private String remarks;
|
||||
/** 删除标记 */
|
||||
private String delFlag;
|
||||
|
||||
/** 设置练习ID */
|
||||
public void setId(Integer id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/** 获取练习ID */
|
||||
public Integer getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
/** 设置部门ID */
|
||||
public void setDeptId(Integer deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
/** 获取部门ID */
|
||||
public Integer getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
/** 设置练习名称 */
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/** 获取练习名称 */
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
/** 设置是否控制开始结束时间(0-不控制,1-控制) */
|
||||
public void setEnableControlTime(String enableControlTime)
|
||||
{
|
||||
this.enableControlTime = enableControlTime;
|
||||
}
|
||||
|
||||
/** 获取是否控制开始结束时间(0-不控制,1-控制) */
|
||||
public String getEnableControlTime()
|
||||
{
|
||||
return enableControlTime;
|
||||
}
|
||||
/** 设置开始时间 */
|
||||
public void setStartTime(Date startTime)
|
||||
{
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
/** 获取开始时间 */
|
||||
public Date getStartTime()
|
||||
{
|
||||
return startTime;
|
||||
}
|
||||
/** 设置结束时间 */
|
||||
public void setEndTime(Date endTime)
|
||||
{
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
/** 获取结束时间 */
|
||||
public Date getEndTime()
|
||||
{
|
||||
return endTime;
|
||||
}
|
||||
/** 设置练习对象(1-所有人,2-限定对象) */
|
||||
public void setPracticeUserLimit(String practiceUserLimit)
|
||||
{
|
||||
this.practiceUserLimit = practiceUserLimit;
|
||||
}
|
||||
|
||||
/** 获取练习对象(1-所有人,2-限定对象) */
|
||||
public String getPracticeUserLimit()
|
||||
{
|
||||
return practiceUserLimit;
|
||||
}
|
||||
/** 设置创建者 */
|
||||
public void setCreateBy(String createBy)
|
||||
{
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
/** 获取创建者 */
|
||||
public String getCreateBy()
|
||||
{
|
||||
return createBy;
|
||||
}
|
||||
/** 设置创建时间 */
|
||||
public void setCreateDate(Date createDate)
|
||||
{
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
/** 获取创建时间 */
|
||||
public Date getCreateDate()
|
||||
{
|
||||
return createDate;
|
||||
}
|
||||
/** 设置更新者 */
|
||||
public void setUpdateBy(String updateBy)
|
||||
{
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
/** 获取更新者 */
|
||||
public String getUpdateBy()
|
||||
{
|
||||
return updateBy;
|
||||
}
|
||||
/** 设置更新时间 */
|
||||
public void setUpdateDate(Date updateDate)
|
||||
{
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
/** 获取更新时间 */
|
||||
public Date getUpdateDate()
|
||||
{
|
||||
return updateDate;
|
||||
}
|
||||
/** 设置考试说明 */
|
||||
public void setRemarks(String remarks)
|
||||
{
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
/** 获取考试说明 */
|
||||
public String getRemarks()
|
||||
{
|
||||
return remarks;
|
||||
}
|
||||
/** 设置删除标记 */
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
/** 获取删除标记 */
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("name", getName())
|
||||
.append("enableControlTime", getEnableControlTime())
|
||||
.append("startTime", getStartTime())
|
||||
.append("endTime", getEndTime())
|
||||
.append("practiceUserLimit", getPracticeUserLimit())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createDate", getCreateDate())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateDate", getUpdateDate())
|
||||
.append("remarks", getRemarks())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,180 @@
|
|||
package com.ruoyi.exam.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 试卷题目表 exam_practice_question
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2019-01-01
|
||||
*/
|
||||
public class ExamPracticeQuestion
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 试卷题目ID */
|
||||
@Id
|
||||
private Integer id;
|
||||
/** 试卷代码 */
|
||||
private Integer examPracticeId;
|
||||
/** */
|
||||
private Integer examQuestionId;
|
||||
/** 分数 */
|
||||
private Integer score;
|
||||
/** 排序号 */
|
||||
private Integer orderNum;
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
private Date createDate;
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
private Date updateDate;
|
||||
/** 备注信息 */
|
||||
private String remarks;
|
||||
/** 删除标记 */
|
||||
private String delFlag;
|
||||
|
||||
/** 设置试卷题目ID */
|
||||
public void setId(Integer id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/** 获取试卷题目ID */
|
||||
public Integer getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
/** 设置试卷代码 */
|
||||
public void setExamPracticeId(Integer examPracticeId)
|
||||
{
|
||||
this.examPracticeId = examPracticeId;
|
||||
}
|
||||
|
||||
/** 获取试卷代码 */
|
||||
public Integer getExamPracticeId()
|
||||
{
|
||||
return examPracticeId;
|
||||
}
|
||||
/** 设置 */
|
||||
public void setExamQuestionId(Integer examQuestionId)
|
||||
{
|
||||
this.examQuestionId = examQuestionId;
|
||||
}
|
||||
|
||||
/** 获取 */
|
||||
public Integer getExamQuestionId()
|
||||
{
|
||||
return examQuestionId;
|
||||
}
|
||||
/** 设置分数 */
|
||||
public void setScore(Integer score)
|
||||
{
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
/** 获取分数 */
|
||||
public Integer getScore()
|
||||
{
|
||||
return score;
|
||||
}
|
||||
/** 设置排序号 */
|
||||
public void setOrderNum(Integer orderNum)
|
||||
{
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
/** 获取排序号 */
|
||||
public Integer getOrderNum()
|
||||
{
|
||||
return orderNum;
|
||||
}
|
||||
/** 设置创建者 */
|
||||
public void setCreateBy(String createBy)
|
||||
{
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
/** 获取创建者 */
|
||||
public String getCreateBy()
|
||||
{
|
||||
return createBy;
|
||||
}
|
||||
/** 设置创建时间 */
|
||||
public void setCreateDate(Date createDate)
|
||||
{
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
/** 获取创建时间 */
|
||||
public Date getCreateDate()
|
||||
{
|
||||
return createDate;
|
||||
}
|
||||
/** 设置更新者 */
|
||||
public void setUpdateBy(String updateBy)
|
||||
{
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
/** 获取更新者 */
|
||||
public String getUpdateBy()
|
||||
{
|
||||
return updateBy;
|
||||
}
|
||||
/** 设置更新时间 */
|
||||
public void setUpdateDate(Date updateDate)
|
||||
{
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
/** 获取更新时间 */
|
||||
public Date getUpdateDate()
|
||||
{
|
||||
return updateDate;
|
||||
}
|
||||
/** 设置备注信息 */
|
||||
public void setRemarks(String remarks)
|
||||
{
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
/** 获取备注信息 */
|
||||
public String getRemarks()
|
||||
{
|
||||
return remarks;
|
||||
}
|
||||
/** 设置删除标记 */
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
/** 获取删除标记 */
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("examPracticeId", getExamPracticeId())
|
||||
.append("examQuestionId", getExamQuestionId())
|
||||
.append("score", getScore())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createDate", getCreateDate())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateDate", getUpdateDate())
|
||||
.append("remarks", getRemarks())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.ruoyi.exam.domain;
|
||||
|
||||
/**
|
||||
* Created by flower on 2018/12/23.
|
||||
*/
|
||||
public class ExamPracticeQuestionVO extends ExamPracticeQuestion {
|
||||
|
||||
private Integer questionType;
|
||||
|
||||
private String questionName;
|
||||
|
||||
public Integer getQuestionType() {
|
||||
return questionType;
|
||||
}
|
||||
|
||||
public void setQuestionType(Integer questionType) {
|
||||
this.questionType = questionType;
|
||||
}
|
||||
|
||||
public String getQuestionName() {
|
||||
return questionName;
|
||||
}
|
||||
|
||||
public void setQuestionName(String questionName) {
|
||||
this.questionName = questionName;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.ruoyi.exam.mapper;
|
||||
|
||||
import com.ruoyi.exam.domain.ExamPractice;
|
||||
import java.util.List;
|
||||
import com.ruoyi.framework.web.base.MyMapper;
|
||||
|
||||
/**
|
||||
* 练习 数据层
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-28
|
||||
*/
|
||||
public interface ExamPracticeMapper extends MyMapper<ExamPractice>
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询练习列表
|
||||
*
|
||||
* @param examPractice 练习信息
|
||||
* @return 练习集合
|
||||
*/
|
||||
public List<ExamPractice> selectExamPracticeList(ExamPractice examPractice);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.ruoyi.exam.mapper;
|
||||
|
||||
import com.ruoyi.exam.domain.ExamPracticeQuestion;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.exam.domain.ExamPracticeQuestionVO;
|
||||
import com.ruoyi.framework.web.base.MyMapper;
|
||||
|
||||
/**
|
||||
* 试卷题目 数据层
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2019-01-01
|
||||
*/
|
||||
public interface ExamPracticeQuestionMapper extends MyMapper<ExamPracticeQuestion>
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询试卷题目列表
|
||||
*
|
||||
* @param examPracticeQuestion 试卷题目信息
|
||||
* @return 试卷题目集合
|
||||
*/
|
||||
public List<ExamPracticeQuestionVO> selectExamPracticeQuestionList(ExamPracticeQuestion examPracticeQuestion);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.ruoyi.exam.service;
|
||||
|
||||
import com.ruoyi.exam.domain.ExamPracticeQuestion;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.exam.domain.ExamPracticeQuestionVO;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||
/**
|
||||
* 试卷题目 服务层
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2019-01-01
|
||||
*/
|
||||
public interface IExamPracticeQuestionService extends AbstractBaseService<ExamPracticeQuestion>
|
||||
{
|
||||
/**
|
||||
* 查询试卷题目分页列表
|
||||
*
|
||||
* @param examPracticeQuestion 试卷题目信息
|
||||
* @return 试卷题目集合
|
||||
*/
|
||||
public List<ExamPracticeQuestionVO> selectExamPracticeQuestionPage(ExamPracticeQuestion examPracticeQuestion);
|
||||
/**
|
||||
* 查询试卷题目列表
|
||||
*
|
||||
* @param examPracticeQuestion 试卷题目信息
|
||||
* @return 试卷题目集合
|
||||
*/
|
||||
public List<ExamPracticeQuestionVO> selectExamPracticeQuestionList(ExamPracticeQuestion examPracticeQuestion);
|
||||
|
||||
|
||||
List<ExamPracticeQuestionVO> selectQuestionForPracticeId(Integer id);
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.ruoyi.exam.service;
|
||||
|
||||
import com.ruoyi.exam.domain.ExamPractice;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.exam.domain.ExamPracticeQuestionVO;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||
/**
|
||||
* 练习 服务层
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-28
|
||||
*/
|
||||
public interface IExamPracticeService extends AbstractBaseService<ExamPractice>
|
||||
{
|
||||
/**
|
||||
* 查询练习分页列表
|
||||
*
|
||||
* @param examPractice 练习信息
|
||||
* @return 练习集合
|
||||
*/
|
||||
public List<ExamPractice> selectExamPracticePage(ExamPractice examPractice);
|
||||
/**
|
||||
* 查询练习列表
|
||||
*
|
||||
* @param examPractice 练习信息
|
||||
* @return 练习集合
|
||||
*/
|
||||
public List<ExamPractice> selectExamPracticeList(ExamPractice examPractice);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.ruoyi.exam.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.exam.domain.ExamPracticeQuestionVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.exam.mapper.ExamPracticeQuestionMapper;
|
||||
import com.ruoyi.exam.domain.ExamPracticeQuestion;
|
||||
import com.ruoyi.exam.service.IExamPracticeQuestionService;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||
/**
|
||||
* 试卷题目 服务层实现
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2019-01-01
|
||||
*/
|
||||
@Service
|
||||
public class ExamPracticeQuestionServiceImpl extends AbstractBaseServiceImpl<ExamPracticeQuestionMapper,ExamPracticeQuestion> implements IExamPracticeQuestionService
|
||||
{
|
||||
@Autowired
|
||||
private ExamPracticeQuestionMapper examPracticeQuestionMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询试卷题目列表
|
||||
*
|
||||
* @param examPracticeQuestion 试卷题目信息
|
||||
* @return 试卷题目集合
|
||||
*/
|
||||
@Override
|
||||
public List<ExamPracticeQuestionVO> selectExamPracticeQuestionList(ExamPracticeQuestion examPracticeQuestion)
|
||||
{
|
||||
return examPracticeQuestionMapper.selectExamPracticeQuestionList(examPracticeQuestion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamPracticeQuestionVO> selectQuestionForPracticeId(Integer id) {
|
||||
ExamPracticeQuestion examPracticeQuestion = new ExamPracticeQuestion();
|
||||
examPracticeQuestion.setExamPracticeId(id);
|
||||
List<ExamPracticeQuestionVO> result = examPracticeQuestionMapper.selectExamPracticeQuestionList(examPracticeQuestion);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询试卷题目分页列表
|
||||
*
|
||||
* @param examPracticeQuestion 试卷题目信息
|
||||
* @return 试卷题目集合
|
||||
*/
|
||||
@Override
|
||||
public List<ExamPracticeQuestionVO> selectExamPracticeQuestionPage(ExamPracticeQuestion examPracticeQuestion)
|
||||
{
|
||||
startPage();
|
||||
return examPracticeQuestionMapper.selectExamPracticeQuestionList(examPracticeQuestion);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.ruoyi.exam.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.exam.domain.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.exam.mapper.ExamPracticeMapper;
|
||||
import com.ruoyi.exam.service.IExamPracticeService;
|
||||
import com.ruoyi.common.support.Convert;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||
/**
|
||||
* 练习 服务层实现
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-28
|
||||
*/
|
||||
@Service
|
||||
public class ExamPracticeServiceImpl extends AbstractBaseServiceImpl<ExamPracticeMapper,ExamPractice> implements IExamPracticeService
|
||||
{
|
||||
@Autowired
|
||||
private ExamPracticeMapper examPracticeMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询练习列表
|
||||
*
|
||||
* @param examPractice 练习信息
|
||||
* @return 练习集合
|
||||
*/
|
||||
@Override
|
||||
public List<ExamPractice> selectExamPracticeList(ExamPractice examPractice)
|
||||
{
|
||||
return examPracticeMapper.selectExamPracticeList(examPractice);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询练习分页列表
|
||||
*
|
||||
* @param examPractice 练习信息
|
||||
* @return 练习集合
|
||||
*/
|
||||
@Override
|
||||
public List<ExamPractice> selectExamPracticePage(ExamPractice examPractice)
|
||||
{
|
||||
startPage();
|
||||
return examPracticeMapper.selectExamPracticeList(examPractice);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.exam.mapper.ExamPracticeMapper">
|
||||
|
||||
<resultMap type="ExamPractice" id="ExamPracticeResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="enableControlTime" column="enable_control_time" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="practiceUserLimit" column="practice_user_limit" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createDate" column="create_date" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateDate" column="update_date" />
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectExamPracticeVo">
|
||||
id, dept_id, name, enable_control_time, start_time, end_time, practice_user_limit, create_by, create_date, update_by, update_date, remarks, del_flag </sql>
|
||||
|
||||
<select id="selectExamPracticeList" parameterType="ExamPractice" resultMap="ExamPracticeResult">
|
||||
select
|
||||
<include refid="selectExamPracticeVo"/>
|
||||
from exam_practice
|
||||
<where>
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
<if test="name != null and name != '' "> and name = #{name}</if>
|
||||
<if test="enableControlTime != null and enableControlTime != '' "> and enable_control_time = #{enableControlTime}</if>
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="practiceUserLimit != null and practiceUserLimit != '' "> and practice_user_limit = #{practiceUserLimit}</if>
|
||||
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
|
||||
<if test="createDate != null "> and create_date = #{createDate}</if>
|
||||
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
|
||||
<if test="updateDate != null "> and update_date = #{updateDate}</if>
|
||||
<if test="remarks != null and remarks != '' "> and remarks = #{remarks}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.exam.mapper.ExamPracticeQuestionMapper">
|
||||
|
||||
<resultMap type="ExamPracticeQuestionVO" id="ExamPracticeQuestionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="examPracticeId" column="exam_practice_id" />
|
||||
<result property="examQuestionId" column="exam_question_id" />
|
||||
<result property="score" column="score" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createDate" column="create_date" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateDate" column="update_date" />
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="questionName" column="name"/>
|
||||
<result property="questionType" column="type"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectExamPracticeQuestionVo">
|
||||
epq.id, epq.exam_practice_id, epq.exam_question_id, epq.score, epq.order_num, epq.create_by, epq.create_date, epq.update_by, epq.update_date, epq.remarks, epq.del_flag </sql>
|
||||
|
||||
<select id="selectExamPracticeQuestionList" parameterType="ExamPracticeQuestion" resultMap="ExamPracticeQuestionResult">
|
||||
select
|
||||
<include refid="selectExamPracticeQuestionVo"/>,eq.title as name,eq.type as type
|
||||
from exam_practice_question epq
|
||||
INNER JOIN exam_question eq on epq.exam_question_id = eq.id
|
||||
<where>
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="examPracticeId != null "> and exam_practice_id = #{examPracticeId}</if>
|
||||
<if test="examQuestionId != null "> and exam_question_id = #{examQuestionId}</if>
|
||||
<if test="score != null "> and score = #{score}</if>
|
||||
<if test="orderNum != null "> and order_num = #{orderNum}</if>
|
||||
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
|
||||
<if test="createDate != null "> and create_date = #{createDate}</if>
|
||||
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
|
||||
<if test="updateDate != null "> and update_date = #{updateDate}</if>
|
||||
<if test="remarks != null and remarks != '' "> and remarks = #{remarks}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||
</where>
|
||||
order by order_num
|
||||
</select>
|
||||
|
||||
<select id="selectquestionByIds" resultMap="ExamPracticeQuestionResult">
|
||||
select
|
||||
<include refid="selectExamPracticeQuestionVo"/>,eq.title as name,eq.type as type
|
||||
from exam_practice_question epq
|
||||
INNER JOIN exam_question eq on epq.exam_question_id = eq.id
|
||||
where epq.exam_question_id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-examPractice-add">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">练习名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="name" name="name" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否控制开始结束时间:</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<select id="enableControlTime" name="enableControlTime" class="form-control m-b" th:with="type=${@dict.getType('exam_ination_enableControlTime')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">开始时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="startTime" name="startTime" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">结束时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="endTime" name="endTime" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">练习对象:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="practiceUserLimit" name="practiceUserLimit" class="form-control m-b" th:with="type=${@dict.getType('exam_ination_examinationUserLimit')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">考试说明:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="remarks" name="remarks" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "exam/examPractice"
|
||||
$("#form-examPractice-add").validate({
|
||||
rules:{
|
||||
xxxx:{
|
||||
required:true,
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-examPractice-add').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-examPractice-edit" th:object="${examPractice}">
|
||||
<input id="id" name="id" th:field="*{id}" type="hidden">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">练习名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="name" name="name" th:field="*{name}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否控制开始结束时间:</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<select id="enableControlTime" name="enableControlTime" th:field="*{enableControlTime}" class="form-control m-b" th:with="type=${@dict.getType('exam_ination_enableControlTime')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">开始时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="startTime" name="startTime" th:field="*{startTime}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">结束时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="endTime" name="endTime" th:field="*{endTime}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">练习对象:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="practiceUserLimit" name="practiceUserLimit" th:field="*{practiceUserLimit}" class="form-control m-b" th:with="type=${@dict.getType('exam_ination_examinationUserLimit')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">练习说明:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="remarks" name="remarks" th:field="*{remarks}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "exam/examPractice"
|
||||
$("#form-examPractice-edit").validate({
|
||||
rules:{
|
||||
xxxx:{
|
||||
required:true,
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-examPractice-edit').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="gray-bg">
|
||||
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="formId">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
练习名称:<input type="text" name="name"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="exam:examPractice:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="exam:examPractice:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="exam:examPractice:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="exam:examPractice:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table" data-mobile-responsive="true"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include :: footer"></div>
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('exam:examPractice:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('exam:examPractice:remove')}]];
|
||||
var prefix = ctx + "exam/examPractice";
|
||||
var practiceUserLimit = [[${@dict.getType('exam_ination_examinationUserLimit')}]];
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "练习",
|
||||
search: false,
|
||||
showExport: true,
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field : 'id',
|
||||
title : '练习ID',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field : 'name',
|
||||
title : '练习名称',
|
||||
sortable: true
|
||||
},
|
||||
|
||||
{
|
||||
field : 'startTime',
|
||||
title : '开始时间',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'endTime',
|
||||
title : '结束时间',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'practiceUserLimit',
|
||||
title : '练习对象',
|
||||
sortable: true,
|
||||
formatter: function(value, item, index) {
|
||||
return $.table.selectDictLabel(practiceUserLimit, item.practiceUserLimit);
|
||||
}
|
||||
},
|
||||
{
|
||||
field : 'createBy',
|
||||
title : '创建者',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'createDate',
|
||||
title : '创建时间',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="toPracticequestion(\'' + row.id + '\')"><i class="fa fa-edit"></i>管理试题</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
function toPracticequestion(id) {
|
||||
var url = ctx + "exam/examPractice/toManagerPracticeQuestion/"+id;
|
||||
createMenuItem(url, "试卷题目管理");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,225 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
<body class="gray-bg">
|
||||
<div class="ui-layout-west">
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-grid"></i> 题库
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
|
||||
<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i
|
||||
class="fa fa-chevron-up"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i
|
||||
class="fa fa-chevron-down"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新题库"><i
|
||||
class="fa fa-refresh"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-layout-content">
|
||||
<div id="tree" class="ztree"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container-div ui-layout-center">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="formId">
|
||||
<input type="hidden" id="categoryId" name="categoryId">
|
||||
<input type="hidden" id="examPracticeId" name="examPracticeId" th:value="${examPracticeId}">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
问题标题:<input type="text" name="title"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
问题类型:<select name="type" th:with="type=${@dict.getType('exam_question_type')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
|
||||
th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
|
||||
class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
|
||||
class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
|
||||
<!--<a class="btn btn-success" onclick="addChoiceQuestion()" shiro:hasPermission="exam:examQuestion:add">-->
|
||||
<!--<i class="fa fa-plus"></i> 添加单选题-->
|
||||
<!--</a>-->
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table" data-mobile-responsive="true"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include :: footer"></div>
|
||||
<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
|
||||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('exam:examQuestion:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('exam:examQuestion:remove')}]];
|
||||
var type = [[${@dict.getType('exam_question_type')}]];
|
||||
var prefix = ctx + "exam/examQuestion";
|
||||
var overAllIds = new Array();
|
||||
$(function () {
|
||||
$('body').layout({west__size: 150});
|
||||
queryExamQuestionList();
|
||||
$("#categoryId").val(1);
|
||||
$.table.search();
|
||||
queryExamQuestionCategoryTree();
|
||||
debugger;
|
||||
overAllIds = [[${examPracticeQuestionIds}]];
|
||||
});
|
||||
|
||||
function queryExamQuestionList() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "问题",
|
||||
search: false,
|
||||
showExport: true,
|
||||
columns: [{
|
||||
checkbox: true,
|
||||
formatter: function (i, row) { // 每次加载 checkbox 时判断当前 row 的 id 是否已经存在全局 Set() 里
|
||||
if ($.inArray(row.id,
|
||||
overAllIds) != -1) {// 因为 判断数组里有没有这个 id
|
||||
return {
|
||||
checked: true
|
||||
// 存在则选中
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: 'ID',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
title: '问题标题',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'type',
|
||||
title: '问题类型',
|
||||
formatter: function(value, item, index) {
|
||||
debugger
|
||||
return $.table.selectDictLabel(type, item.type);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createBy',
|
||||
title: '创建者',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
// {
|
||||
// title: '操作',
|
||||
// align: 'center',
|
||||
// formatter: function (value, row, index) {
|
||||
// var actions = [];
|
||||
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
// return actions.join('');
|
||||
// }
|
||||
// }]
|
||||
};
|
||||
$.table.init(options);
|
||||
};
|
||||
|
||||
function queryExamQuestionCategoryTree() {
|
||||
var url = ctx + "exam/examQuestionCategory/treeData";
|
||||
var options = {
|
||||
url: url,
|
||||
expandLevel: 2,
|
||||
onClick: zOnClick
|
||||
};
|
||||
$.tree.init(options);
|
||||
|
||||
function zOnClick(event, treeId, treeNode) {
|
||||
|
||||
$("#categoryId").val(treeNode.id);
|
||||
$.table.search();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#btnExpand').click(function () {
|
||||
$._tree.expandAll(true);
|
||||
$(this).hide();
|
||||
$('#btnCollapse').show();
|
||||
});
|
||||
|
||||
$('#btnCollapse').click(function () {
|
||||
$._tree.expandAll(false);
|
||||
$(this).hide();
|
||||
$('#btnExpand').show();
|
||||
});
|
||||
|
||||
$('#btnRefresh').click(function () {
|
||||
queryExamQuestionCategoryTree();
|
||||
});
|
||||
|
||||
/*用户管理-部门*/
|
||||
function examQuestionCategory() {
|
||||
var url = ctx + "exam/examQuestionCategory";
|
||||
createMenuItem(url, "题库管理");
|
||||
}
|
||||
|
||||
|
||||
|
||||
var overAllIds = new Array(); //全局数组
|
||||
function getSelectCheck() {
|
||||
return overAllIds;
|
||||
}
|
||||
function examine(type, datas) {
|
||||
if (type.indexOf('uncheck') == -1) {
|
||||
$.each(datas,
|
||||
function (i, v) {
|
||||
// 添加时,判断一行或多行的 id 是否已经在数组里 不存则添加
|
||||
overAllIds.indexOf(v.id) == -1 ? overAllIds
|
||||
.push(v.id) : -1;
|
||||
});
|
||||
} else {
|
||||
$.each(datas, function (i, v) {
|
||||
overAllIds.splice(overAllIds.indexOf(v.id), 1); //删除取消选中行
|
||||
});
|
||||
}
|
||||
}
|
||||
$('#bootstrap-table').on(
|
||||
'uncheck.bs.table check.bs.table check-all.bs.table uncheck-all.bs.table',
|
||||
function (e, rows) {
|
||||
debugger
|
||||
var datas = $.isArray(rows) ? rows : [rows]; // 点击时获取选中的行或取消选中的行
|
||||
examine(e.type, datas); // 保存到全局 Array() 里
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
debugger
|
||||
$.operate.save(ctx + "exam/examPractice"+ "/addQuestionForModel",$.param({questionId:overAllIds,practiceId:$("#examPracticeId").val()}));
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,239 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link th:href="@{/ruoyi/css/ry-ui.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/ajax/libs/datapicker/datepicker3.css}" rel="stylesheet"/>
|
||||
<style>
|
||||
.droppable-active {
|
||||
background-color: #ffe !important
|
||||
}
|
||||
|
||||
.tools a {
|
||||
cursor: pointer;
|
||||
font-size: 80%
|
||||
}
|
||||
|
||||
.form-body .col-md-6, .form-body .col-md-12 {
|
||||
min-height: 400px
|
||||
}
|
||||
|
||||
.draggable {
|
||||
cursor: move
|
||||
}
|
||||
</style>
|
||||
<body class="gray-bg">
|
||||
<div class="wrapper wrapper-content">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<input type="hidden" id="practiceId" th:value="${examPractice.id}">
|
||||
<!--<input type="hidden" id="practiceScore" th:value="${examPractice.score}">-->
|
||||
<input type="hidden" id="practiceName" th:value="${examPractice.name}">
|
||||
<input type="hidden" id="practiceQuestion" th:value="${examPracticeQuestion}">
|
||||
<!--<input type="hidden" id="practiceQuestionNumber" th:value="${examPractice.questionNumber}">-->
|
||||
<div class="form-group draggable">
|
||||
<button onclick="addQuestion()" class="btn btn-warning" >添加试题</button>
|
||||
<button onclick="saveQuestion(true)" class="btn btn-success" >保存</button>
|
||||
</div>
|
||||
<!--<div class="form-group draggable">-->
|
||||
<!--设置默认单选题分数:-->
|
||||
<!--<input onkeyup="defaultScore(1,$(this))" type="text" size="4">-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group draggable">-->
|
||||
<!--设置默认多选题分数:-->
|
||||
<!--<input onkeyup="defaultScore(2,$(this))" type="text" size="4">-->
|
||||
<!--</div>-->
|
||||
<!--<div class="form-group draggable">-->
|
||||
<!--设置默认选择题分数:-->
|
||||
<!--<input onkeyup="defaultScore(3,$(this))" type="text" size="4">-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="form-group draggable">
|
||||
练习名称:<label id="name"></label>
|
||||
</div>
|
||||
|
||||
<!--<div class="form-group draggable">-->
|
||||
<!--题目数量:<label id="number"></label>-->
|
||||
<!--</div>-->
|
||||
|
||||
<!--<div class="form-group draggable">-->
|
||||
<!--总分数:<label id="score"></label>-->
|
||||
<!--</div>-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-9">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-content">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 50%">题目</th>
|
||||
<th>题型</th>
|
||||
<th>分数</th>
|
||||
<th>向上移动</th>
|
||||
<th>向上移动</th>
|
||||
<th>删除</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include :: footer"></div>
|
||||
<script th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
|
||||
<script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
|
||||
<script th:src="@{/ajax/libs//datapicker/bootstrap-datepicker.js}"></script>
|
||||
<script th:src="@{/ajax/libs/beautifyhtml/beautifyhtml.js}"></script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){setup_draggable();$("#n-columns").on("change",function(){var v=$(this).val();if(v==="1"){var $col=$(".form-body .col-md-12").toggle(true);$(".form-body .col-md-6 .draggable").each(function(i,el){$(this).remove().appendTo($col)});$(".form-body .col-md-6").toggle(false)}else{var $col=$(".form-body .col-md-6").toggle(true);$(".form-body .col-md-12 .draggable").each(function(i,el){$(this).remove().appendTo(i%2?$col[1]:$col[0])});$(".form-body .col-md-12").toggle(false)}});$("#copy-to-clipboard").on("click",function(){var $copy=$(".form-body").clone().appendTo(document.body);$copy.find(".tools, :hidden").remove();$.each(["draggable","droppable","sortable","dropped","ui-sortable","ui-draggable","ui-droppable","form-body"],function(i,c){$copy.find("."+c).removeClass(c).removeAttr("style")});var html=html_beautify($copy.html());$copy.remove();$modal=get_modal(html).modal("show");$modal.find(".btn").remove();$modal.find(".modal-title").html("复制HTML代码");$modal.find(":input:first").select().focus();return false})});var setup_draggable=function(){$(".draggable").draggable({appendTo:"body",helper:"clone"});$(".droppable").droppable({accept:".draggable",helper:"clone",hoverClass:"droppable-active",drop:function(event,ui){$(".empty-form").remove();var $orig=$(ui.draggable);if(!$(ui.draggable).hasClass("dropped")){var $el=$orig.clone().addClass("dropped").css({"position":"static","left":null,"right":null}).appendTo(this);var id=$orig.find(":input").attr("id");if(id){id=id.split("-").slice(0,-1).join("-")+"-"+(parseInt(id.split("-").slice(-1)[0])+1);$orig.find(":input").attr("id",id);$orig.find("label").attr("for",id)}$('<p class="tools col-sm-12 col-sm-offset-3"> <a class="edit-link">编辑HTML<a> | <a class="remove-link">移除</a></p>').appendTo($el)}else{if($(this)[0]!=$orig.parent()[0]){var $el=$orig.clone().css({"position":"static","left":null,"right":null}).appendTo(this);$orig.remove()}}}}).sortable()};var get_modal=function(content){var modal=$('<div class="modal" style="overflow: auto;" tabindex="-1"> <div class="modal-dialog"><div class="modal-content"><div class="modal-header"><a type="button" class="close" data-dismiss="modal" aria-hidden="true">×</a><h4 class="modal-title">编辑HTML</h4></div><div class="modal-body ui-front"> <textarea class="form-control" style="min-height: 200px; margin-bottom: 10px;font-family: Monaco, Fixed">'+content+'</textarea><button class="btn btn-success">更新HTML</button></div> </div></div></div>').appendTo(document.body);return modal};$(document).on("click",".edit-link",function(ev){var $el=$(this).parent().parent();var $el_copy=$el.clone();var $edit_btn=$el_copy.find(".edit-link").parent().remove();var $modal=get_modal(html_beautify($el_copy.html())).modal("show");$modal.find(":input:first").focus();$modal.find(".btn-success").click(function(ev2){var html=$modal.find("textarea").val();if(!html){$el.remove()}else{$el.html(html);$edit_btn.appendTo($el)}$modal.modal("hide");return false})});$(document).on("click",".remove-link",function(ev){$(this).parent().parent().remove()});
|
||||
$(".input-group.date").datepicker({todayBtn: "linked",keyboardNavigation: !1,forceParse: !1,calendarWeeks: !0,autoclose: !0});
|
||||
var prefix = ctx + "exam/examPractice";
|
||||
var questionArr = new Array();
|
||||
$(function () {
|
||||
$("#name").html($("#practiceName").val())
|
||||
$("#number").html($("#practiceQuestionNumber").val())
|
||||
$("#score").html($("#practiceScore").val())
|
||||
debugger
|
||||
questionArr = $.parseJSON($("#practiceQuestion").val())
|
||||
var questionOfTable = '';
|
||||
|
||||
|
||||
debugger
|
||||
for (var i in questionArr) {
|
||||
var item = $.parseJSON(questionArr[i][0])
|
||||
questionOfTable+="<tr class = 'questionItem'><th>"+item.questionName+"</th>"
|
||||
questionOfTable+="<input class = 'itemId' type='hidden' value='"+item.examQuestionId+"'>"
|
||||
questionOfTable+="<input class = 'itemType' type='hidden' value='"+item.questionType+"'>"
|
||||
questionOfTable+="<th>"+formatType(item.questionType)+"</th>"
|
||||
questionOfTable+="<th><input onkeyup='changeScore($(this))'class = 'itemScore' type='text' size='3' value='"+item.score+"'></th>"
|
||||
questionOfTable+="<th><button onclick='moveUp($(this))' class='badge badge-primary'>" + "上移" + "</button></th>"
|
||||
questionOfTable+="<th><button onclick='moveDown($(this))' class='badge badge-primary'>" + "下移" + "</button></th>"
|
||||
questionOfTable+="<th><button onclick='deleteObj($(this))' class='badge badge-delete'>" + "删除" + "</button></th></tr>"
|
||||
}
|
||||
$("tbody").html(questionOfTable)
|
||||
})
|
||||
|
||||
function formatType(questionType) {
|
||||
switch (questionType+""){
|
||||
case "1" : return "<span class='badge badge-primary'>" + "单选题" + "</span>"
|
||||
case "2" : return "<span class='badge badge-important'>" + "多选题" + "</span>"
|
||||
case "3" : return "<span class='badge badge-success'>" + "选择题" + "</span>"
|
||||
}
|
||||
}
|
||||
|
||||
function moveUp(obj) {
|
||||
var me = obj.parent("th").parent(".questionItem");
|
||||
var meHtml = obj.parent("th").parent(".questionItem").html();
|
||||
var up = obj.parent("th").parent(".questionItem").prev(".questionItem");
|
||||
var upHtml = obj.parent("th").parent(".questionItem").prev(".questionItem").html();
|
||||
me.html(upHtml);
|
||||
up.html(meHtml);
|
||||
|
||||
}
|
||||
|
||||
function moveDown(obj) {
|
||||
var me = obj.parent("th").parent(".questionItem");
|
||||
var meHtml = obj.parent("th").parent(".questionItem").html();
|
||||
var up = obj.parent("th").parent(".questionItem").next(".questionItem");
|
||||
var upHtml = obj.parent("th").parent(".questionItem").next(".questionItem").html();
|
||||
me.html(upHtml);
|
||||
up.html(meHtml);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function changeScore(obj) {
|
||||
obj.parent("th").html("<input onkeyup='changeScore($(this))'class = 'itemScore' type='text' size='3' value='"+obj.val()+"'>")
|
||||
var scorc = 0
|
||||
$(".questionItem").each(function(){
|
||||
scorc += parseInt($(this).find(".itemScore").eq(0).val());
|
||||
})
|
||||
$("#score").html(scorc)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function defaultScore(type,obj) {
|
||||
|
||||
$(".questionItem").each(function(){
|
||||
debugger
|
||||
var t = $(this).find(".itemType").eq(0).val()
|
||||
if(type == t){
|
||||
$(this).find(".itemScore").eq(0).parent("th").html("<input onkeyup='changeScore($(this))'class = 'itemScore' type='text' size='3' value='"+obj.val()+"'>")
|
||||
}
|
||||
})
|
||||
var scorc = 0
|
||||
$(".questionItem").each(function(){
|
||||
scorc += parseInt($(this).find(".itemScore").eq(0).val());
|
||||
})
|
||||
$("#score").html(scorc)
|
||||
|
||||
}
|
||||
|
||||
function deleteObj(obj) {
|
||||
var me = obj.parent("th").parent(".questionItem");
|
||||
me.remove()
|
||||
var scorc = 0
|
||||
$(".questionItem").each(function(){
|
||||
scorc += parseInt($(this).find(".itemScore").eq(0).val());
|
||||
})
|
||||
$("#score").html(scorc)
|
||||
$("#number").html(parseInt($("#number").html())-1)
|
||||
}
|
||||
|
||||
function addQuestion() {
|
||||
saveQuestion(false)
|
||||
|
||||
var ids = $("#practiceId").val();
|
||||
$(".questionItem").each(function(){
|
||||
ids+=","+$(this).find("input").eq(0).val()
|
||||
})
|
||||
var url = prefix + "/addQuestion/"+ids;
|
||||
$.operate.jumpModeltoUrl("管理试题",url,1000,600);
|
||||
}
|
||||
|
||||
function saveQuestion(value){
|
||||
var index = 1;
|
||||
var data = new Array();
|
||||
data.push({examQuestionId:0,score:0,orderNum:0,examPracticeId:$("#practiceId").val()})
|
||||
$(".questionItem").each(function(){
|
||||
var examQuestionId = $(this).find(".itemId").eq(0).val();
|
||||
var score = $(this).find(".itemScore").eq(0).val();
|
||||
var order = index++;
|
||||
var json = {examQuestionId:examQuestionId,score:score,orderNum:order,examPracticeId:$("#practiceId").val()}
|
||||
data.push(json);
|
||||
})
|
||||
debugger
|
||||
|
||||
var config = {
|
||||
url: ctx + "exam/examPractice"+ "/saveQuestion",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: JSON.stringify(data),
|
||||
contentType:"application/json",
|
||||
success: function(result) {
|
||||
// $.operate.successCallback(result);
|
||||
}
|
||||
};
|
||||
$.ajax(config)
|
||||
if(value){
|
||||
$.modal.alert("保存成功", modal_status.SUCCESS);
|
||||
}
|
||||
// $.operate.save(ctx + "exam/examPaper"+ "/saveQuestion",$.param({paperQuestionList:data}));
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue