Commit 8e724ba6 authored by 吴卿华's avatar 吴卿华

移动端考试

parent d098c8ed
......@@ -22,7 +22,7 @@ import com.zehong.common.core.page.TableDataInfo;
/**
* 承包商及访客培训题库Controller
*
*
* @author zehong
* @date 2022-12-27
*/
......
package com.zehong.web.controller.system;
import java.util.Date;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
......@@ -80,6 +77,16 @@ public class TContractorTrainResultController extends BaseController
return toAjax(tContractorTrainResultService.insertTContractorTrainResult(tContractorTrainResult));
}
@ApiOperation("用户课程考试交卷")
@GetMapping("/examination")
public AjaxResult examination( TContractorTrainResult tContractorTrainResult){
//结束时间
tContractorTrainResult.setTestEndTime(new Date());
Map<String, Object> examination = tContractorTrainResultService.examination(tContractorTrainResult);
return AjaxResult.success(examination);
}
/**
* 修改承包商及访客培训考试结果详情
*/
......
package com.zehong.web.controller.system;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TContractorTrainResultDetail;
import com.zehong.system.service.ITContractorTrainResultDetailService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 承包商及访客培训考试结果详情Controller
*
* @author wu
* @date 2022-12-30
*/
@RestController
@RequestMapping("/system/detail")
public class TContractorTrainResultDetailController extends BaseController
{
@Autowired
private ITContractorTrainResultDetailService tContractorTrainResultDetailService;
/**
* 查询承包商及访客培训考试结果详情列表
*/
//@PreAuthorize("@ss.hasPermi('system:detail:list')")
@GetMapping("/list")
public TableDataInfo list(TContractorTrainResultDetail tContractorTrainResultDetail)
{
startPage();
List<TContractorTrainResultDetail> list = tContractorTrainResultDetailService.selectTContractorTrainResultDetailList(tContractorTrainResultDetail);
return getDataTable(list);
}
/**
* 导出承包商及访客培训考试结果详情列表
*/
//@PreAuthorize("@ss.hasPermi('system:detail:export')")
@Log(title = "承包商及访客培训考试结果详情", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TContractorTrainResultDetail tContractorTrainResultDetail)
{
List<TContractorTrainResultDetail> list = tContractorTrainResultDetailService.selectTContractorTrainResultDetailList(tContractorTrainResultDetail);
ExcelUtil<TContractorTrainResultDetail> util = new ExcelUtil<TContractorTrainResultDetail>(TContractorTrainResultDetail.class);
return util.exportExcel(list, "承包商及访客培训考试结果详情数据");
}
/**
* 获取承包商及访客培训考试结果详情详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:detail:query')")
@GetMapping(value = "/{detailId}")
public AjaxResult getInfo(@PathVariable("detailId") Long detailId)
{
return AjaxResult.success(tContractorTrainResultDetailService.selectTContractorTrainResultDetailById(detailId));
}
/**
* 新增承包商及访客培训考试结果详情
*/
//@PreAuthorize("@ss.hasPermi('system:detail:add')")
@Log(title = "承包商及访客培训考试结果详情", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TContractorTrainResultDetail tContractorTrainResultDetail)
{
return toAjax(tContractorTrainResultDetailService.insertTContractorTrainResultDetail(tContractorTrainResultDetail));
}
/**
* 修改承包商及访客培训考试结果详情
*/
//@PreAuthorize("@ss.hasPermi('system:detail:edit')")
@Log(title = "承包商及访客培训考试结果详情", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TContractorTrainResultDetail tContractorTrainResultDetail)
{
return toAjax(tContractorTrainResultDetailService.updateTContractorTrainResultDetail(tContractorTrainResultDetail));
}
/**
* 删除承包商及访客培训考试结果详情
*/
//@PreAuthorize("@ss.hasPermi('system:detail:remove')")
@Log(title = "承包商及访客培训考试结果详情", businessType = BusinessType.DELETE)
@DeleteMapping("/{detailIds}")
public AjaxResult remove(@PathVariable Long[] detailIds)
{
return toAjax(tContractorTrainResultDetailService.deleteTContractorTrainResultDetailByIds(detailIds));
}
}
......@@ -107,11 +107,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
"/**/*.js",
"/contractTrain/getITContractorTrainCourse",
"/contractTrain/list",
"/system/result/list"
"/system/result/list",
"/contractTrainTopic/list",
"/system/result/**"
).permitAll()
.antMatchers(
HttpMethod.POST,
"/subscription/**"
"/subscription/**",
"/system/result/**"
).permitAll()
.antMatchers("/profile/**").anonymous()
.antMatchers("/common/download**").anonymous()
......
......@@ -2,14 +2,12 @@ package com.zehong.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 承包商及访客培训考试结果详情对象 t_contractor_train_result
*
*
* @author zehong
* @date 2022-12-27
*/
......@@ -57,112 +55,125 @@ public class TContractorTrainResult extends BaseEntity
/** 是否删除(0正常,1删除) */
private String isDel;
public void setResultId(Long resultId)
private String answers;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getAnswers() {
return answers;
}
public void setAnswers(String answers) {
this.answers = answers;
}
public void setResultId(Long resultId)
{
this.resultId = resultId;
}
public Long getResultId()
public Long getResultId()
{
return resultId;
}
public void setBeyondUnit(String beyondUnit)
public void setBeyondUnit(String beyondUnit)
{
this.beyondUnit = beyondUnit;
}
public String getBeyondUnit()
public String getBeyondUnit()
{
return beyondUnit;
}
public void setName(String name)
public void setName(String name)
{
this.name = name;
}
public String getName()
public String getName()
{
return name;
}
public void setSex(String sex)
public void setSex(String sex)
{
this.sex = sex;
}
public String getSex()
public String getSex()
{
return sex;
}
public void setPhoneNum(String phoneNum)
public void setPhoneNum(String phoneNum)
{
this.phoneNum = phoneNum;
}
public String getPhoneNum()
public String getPhoneNum()
{
return phoneNum;
}
public void setTestBeginTime(Date testBeginTime)
public void setTestBeginTime(Date testBeginTime)
{
this.testBeginTime = testBeginTime;
}
public Date getTestBeginTime()
public Date getTestBeginTime()
{
return testBeginTime;
}
public void setTestEndTime(Date testEndTime)
public void setTestEndTime(Date testEndTime)
{
this.testEndTime = testEndTime;
}
public Date getTestEndTime()
public Date getTestEndTime()
{
return testEndTime;
}
public void setScore(String score)
public void setScore(String score)
{
this.score = score;
}
public String getScore()
public String getScore()
{
return score;
}
public void setIsQualified(String isQualified)
public void setIsQualified(String isQualified)
{
this.isQualified = isQualified;
}
public String getIsQualified()
public String getIsQualified()
{
return isQualified;
}
public void setIsDel(String isDel)
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
public String getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("resultId", getResultId())
.append("beyondUnit", getBeyondUnit())
.append("name", getName())
.append("sex", getSex())
.append("phoneNum", getPhoneNum())
.append("testBeginTime", getTestBeginTime())
.append("testEndTime", getTestEndTime())
.append("score", getScore())
.append("isQualified", getIsQualified())
.append("createTime", getCreateTime())
.append("isDel", getIsDel())
.append("remark", getRemark())
.toString();
return "TContractorTrainResult{" +
"resultId=" + resultId +
", beyondUnit='" + beyondUnit + '\'' +
", name='" + name + '\'' +
", sex='" + sex + '\'' +
", phoneNum='" + phoneNum + '\'' +
", testBeginTime=" + testBeginTime +
", testEndTime=" + testEndTime +
", score='" + score + '\'' +
", isQualified='" + isQualified + '\'' +
", isDel='" + isDel + '\'' +
", answers='" + answers + '\'' +
'}';
}
}
package com.zehong.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 承包商及访客培训考试结果详情对象 t_contractor_train_result_detail
*
* @author wu
* @date 2022-12-30
*/
public class TContractorTrainResultDetail extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 结果详情id */
private Long detailId;
/** 结果关联id */
@Excel(name = "结果关联id")
private Long resultId;
/** 题目内容 */
@Excel(name = "题目内容")
private String topicTitle;
/** 题目选项(json) */
@Excel(name = "题目选项", readConverterExp = "j=son")
private String topicOption;
/** 答案 */
@Excel(name = "答案")
private Integer answer;
/** 所选答案 */
@Excel(name = "所选答案")
private Integer answerChoice;
/** 答题结果:0 对,1 错 */
@Excel(name = "答题结果:0 对,1 错")
private String result;
/** 是否删除(0正常,1删除) */
@Excel(name = "是否删除(0正常,1删除)")
private String isDel;
public void setDetailId(Long detailId)
{
this.detailId = detailId;
}
public Long getDetailId()
{
return detailId;
}
public void setResultId(Long resultId)
{
this.resultId = resultId;
}
public Long getResultId()
{
return resultId;
}
public void setTopicTitle(String topicTitle)
{
this.topicTitle = topicTitle;
}
public String getTopicTitle()
{
return topicTitle;
}
public void setTopicOption(String topicOption)
{
this.topicOption = topicOption;
}
public String getTopicOption()
{
return topicOption;
}
public void setAnswer(Integer answer)
{
this.answer = answer;
}
public Integer getAnswer()
{
return answer;
}
public void setAnswerChoice(Integer answerChoice)
{
this.answerChoice = answerChoice;
}
public Integer getAnswerChoice()
{
return answerChoice;
}
public void setResult(String result)
{
this.result = result;
}
public String getResult()
{
return result;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("detailId", getDetailId())
.append("resultId", getResultId())
.append("topicTitle", getTopicTitle())
.append("topicOption", getTopicOption())
.append("answer", getAnswer())
.append("answerChoice", getAnswerChoice())
.append("result", getResult())
.append("createTime", getCreateTime())
.append("isDel", getIsDel())
.append("remark", getRemark())
.toString();
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TContractorTrainResultDetail;
/**
* 承包商及访客培训考试结果详情Mapper接口
*
* @author wu
* @date 2022-12-30
*/
public interface TContractorTrainResultDetailMapper
{
/**
* 查询承包商及访客培训考试结果详情
*
* @param detailId 承包商及访客培训考试结果详情ID
* @return 承包商及访客培训考试结果详情
*/
public TContractorTrainResultDetail selectTContractorTrainResultDetailById(Long detailId);
/**
* 查询承包商及访客培训考试结果详情列表
*
* @param tContractorTrainResultDetail 承包商及访客培训考试结果详情
* @return 承包商及访客培训考试结果详情集合
*/
public List<TContractorTrainResultDetail> selectTContractorTrainResultDetailList(TContractorTrainResultDetail tContractorTrainResultDetail);
/**
* 新增承包商及访客培训考试结果详情
*
* @param tContractorTrainResultDetail 承包商及访客培训考试结果详情
* @return 结果
*/
public int insertTContractorTrainResultDetail(TContractorTrainResultDetail tContractorTrainResultDetail);
/**
* 修改承包商及访客培训考试结果详情
*
* @param tContractorTrainResultDetail 承包商及访客培训考试结果详情
* @return 结果
*/
public int updateTContractorTrainResultDetail(TContractorTrainResultDetail tContractorTrainResultDetail);
/**
* 删除承包商及访客培训考试结果详情
*
* @param detailId 承包商及访客培训考试结果详情ID
* @return 结果
*/
public int deleteTContractorTrainResultDetailById(Long detailId);
/**
* 批量删除承包商及访客培训考试结果详情
*
* @param detailIds 需要删除的数据ID
* @return 结果
*/
public int deleteTContractorTrainResultDetailByIds(Long[] detailIds);
}
......@@ -5,15 +5,15 @@ import com.zehong.system.domain.TContractorTrainResult;
/**
* 承包商及访客培训考试结果详情Mapper接口
*
*
* @author zehong
* @date 2022-12-27
*/
public interface TContractorTrainResultMapper
public interface TContractorTrainResultMapper
{
/**
* 查询承包商及访客培训考试结果详情
*
*
* @param resultId 承包商及访客培训考试结果详情ID
* @return 承包商及访客培训考试结果详情
*/
......@@ -21,7 +21,7 @@ public interface TContractorTrainResultMapper
/**
* 查询承包商及访客培训考试结果详情列表
*
*
* @param tContractorTrainResult 承包商及访客培训考试结果详情
* @return 承包商及访客培训考试结果详情集合
*/
......@@ -29,7 +29,7 @@ public interface TContractorTrainResultMapper
/**
* 新增承包商及访客培训考试结果详情
*
*
* @param tContractorTrainResult 承包商及访客培训考试结果详情
* @return 结果
*/
......@@ -37,7 +37,7 @@ public interface TContractorTrainResultMapper
/**
* 修改承包商及访客培训考试结果详情
*
*
* @param tContractorTrainResult 承包商及访客培训考试结果详情
* @return 结果
*/
......@@ -45,7 +45,7 @@ public interface TContractorTrainResultMapper
/**
* 删除承包商及访客培训考试结果详情
*
*
* @param resultId 承包商及访客培训考试结果详情ID
* @return 结果
*/
......@@ -53,9 +53,11 @@ public interface TContractorTrainResultMapper
/**
* 批量删除承包商及访客培训考试结果详情
*
*
* @param resultIds 需要删除的数据ID
* @return 结果
*/
public int deleteTContractorTrainResultByIds(Long[] resultIds);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TContractorTrainResultDetail;
/**
* 承包商及访客培训考试结果详情Service接口
*
* @author wu
* @date 2022-12-30
*/
public interface ITContractorTrainResultDetailService
{
/**
* 查询承包商及访客培训考试结果详情
*
* @param detailId 承包商及访客培训考试结果详情ID
* @return 承包商及访客培训考试结果详情
*/
public TContractorTrainResultDetail selectTContractorTrainResultDetailById(Long detailId);
/**
* 查询承包商及访客培训考试结果详情列表
*
* @param tContractorTrainResultDetail 承包商及访客培训考试结果详情
* @return 承包商及访客培训考试结果详情集合
*/
public List<TContractorTrainResultDetail> selectTContractorTrainResultDetailList(TContractorTrainResultDetail tContractorTrainResultDetail);
/**
* 新增承包商及访客培训考试结果详情
*
* @param tContractorTrainResultDetail 承包商及访客培训考试结果详情
* @return 结果
*/
public int insertTContractorTrainResultDetail(TContractorTrainResultDetail tContractorTrainResultDetail);
/**
* 修改承包商及访客培训考试结果详情
*
* @param tContractorTrainResultDetail 承包商及访客培训考试结果详情
* @return 结果
*/
public int updateTContractorTrainResultDetail(TContractorTrainResultDetail tContractorTrainResultDetail);
/**
* 批量删除承包商及访客培训考试结果详情
*
* @param detailIds 需要删除的承包商及访客培训考试结果详情ID
* @return 结果
*/
public int deleteTContractorTrainResultDetailByIds(Long[] detailIds);
/**
* 删除承包商及访客培训考试结果详情信息
*
* @param detailId 承包商及访客培训考试结果详情ID
* @return 结果
*/
public int deleteTContractorTrainResultDetailById(Long detailId);
}
package com.zehong.system.service;
import java.util.List;
import java.util.Map;
import com.zehong.system.domain.TContractorTrainResult;
/**
* 承包商及访客培训考试结果详情Service接口
*
*
* @author zehong
* @date 2022-12-27
*/
public interface ITContractorTrainResultService
public interface ITContractorTrainResultService
{
/**
* 查询承包商及访客培训考试结果详情
*
*
* @param resultId 承包商及访客培训考试结果详情ID
* @return 承包商及访客培训考试结果详情
*/
......@@ -21,7 +23,7 @@ public interface ITContractorTrainResultService
/**
* 查询承包商及访客培训考试结果详情列表
*
*
* @param tContractorTrainResult 承包商及访客培训考试结果详情
* @return 承包商及访客培训考试结果详情集合
*/
......@@ -29,7 +31,7 @@ public interface ITContractorTrainResultService
/**
* 新增承包商及访客培训考试结果详情
*
*
* @param tContractorTrainResult 承包商及访客培训考试结果详情
* @return 结果
*/
......@@ -37,7 +39,7 @@ public interface ITContractorTrainResultService
/**
* 修改承包商及访客培训考试结果详情
*
*
* @param tContractorTrainResult 承包商及访客培训考试结果详情
* @return 结果
*/
......@@ -45,7 +47,7 @@ public interface ITContractorTrainResultService
/**
* 批量删除承包商及访客培训考试结果详情
*
*
* @param resultIds 需要删除的承包商及访客培训考试结果详情ID
* @return 结果
*/
......@@ -53,9 +55,15 @@ public interface ITContractorTrainResultService
/**
* 删除承包商及访客培训考试结果详情信息
*
*
* @param resultId 承包商及访客培训考试结果详情ID
* @return 结果
*/
public int deleteTContractorTrainResultById(Long resultId);
/**
* 用户课程考试交卷
* @param tContractorTrainResult
*/
Map<String,Object> examination(TContractorTrainResult tContractorTrainResult);
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TContractorTrainResultDetailMapper;
import com.zehong.system.domain.TContractorTrainResultDetail;
import com.zehong.system.service.ITContractorTrainResultDetailService;
/**
* 承包商及访客培训考试结果详情Service业务层处理
*
* @author wu
* @date 2022-12-30
*/
@Service
public class TContractorTrainResultDetailServiceImpl implements ITContractorTrainResultDetailService
{
@Autowired
private TContractorTrainResultDetailMapper tContractorTrainResultDetailMapper;
/**
* 查询承包商及访客培训考试结果详情
*
* @param detailId 承包商及访客培训考试结果详情ID
* @return 承包商及访客培训考试结果详情
*/
@Override
public TContractorTrainResultDetail selectTContractorTrainResultDetailById(Long detailId)
{
return tContractorTrainResultDetailMapper.selectTContractorTrainResultDetailById(detailId);
}
/**
* 查询承包商及访客培训考试结果详情列表
*
* @param tContractorTrainResultDetail 承包商及访客培训考试结果详情
* @return 承包商及访客培训考试结果详情
*/
@Override
public List<TContractorTrainResultDetail> selectTContractorTrainResultDetailList(TContractorTrainResultDetail tContractorTrainResultDetail)
{
return tContractorTrainResultDetailMapper.selectTContractorTrainResultDetailList(tContractorTrainResultDetail);
}
/**
* 新增承包商及访客培训考试结果详情
*
* @param tContractorTrainResultDetail 承包商及访客培训考试结果详情
* @return 结果
*/
@Override
public int insertTContractorTrainResultDetail(TContractorTrainResultDetail tContractorTrainResultDetail)
{
tContractorTrainResultDetail.setCreateTime(DateUtils.getNowDate());
return tContractorTrainResultDetailMapper.insertTContractorTrainResultDetail(tContractorTrainResultDetail);
}
/**
* 修改承包商及访客培训考试结果详情
*
* @param tContractorTrainResultDetail 承包商及访客培训考试结果详情
* @return 结果
*/
@Override
public int updateTContractorTrainResultDetail(TContractorTrainResultDetail tContractorTrainResultDetail)
{
return tContractorTrainResultDetailMapper.updateTContractorTrainResultDetail(tContractorTrainResultDetail);
}
/**
* 批量删除承包商及访客培训考试结果详情
*
* @param detailIds 需要删除的承包商及访客培训考试结果详情ID
* @return 结果
*/
@Override
public int deleteTContractorTrainResultDetailByIds(Long[] detailIds)
{
return tContractorTrainResultDetailMapper.deleteTContractorTrainResultDetailByIds(detailIds);
}
/**
* 删除承包商及访客培训考试结果详情信息
*
* @param detailId 承包商及访客培训考试结果详情ID
* @return 结果
*/
@Override
public int deleteTContractorTrainResultDetailById(Long detailId)
{
return tContractorTrainResultDetailMapper.deleteTContractorTrainResultDetailById(detailId);
}
}
package com.zehong.system.service.impl;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.*;
import com.zehong.system.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TContractorTrainResultMapper;
import com.zehong.system.domain.TContractorTrainResult;
import com.zehong.system.service.ITContractorTrainResultService;
/**
* 承包商及访客培训考试结果详情Service业务层处理
*
*
* @author zehong
* @date 2022-12-27
*/
@Service
public class TContractorTrainResultServiceImpl implements ITContractorTrainResultService
public class TContractorTrainResultServiceImpl implements ITContractorTrainResultService
{
@Autowired
private TContractorTrainResultMapper tContractorTrainResultMapper;
@Autowired
private TBankSubjectMapper tBankSubjectMapper;
@Autowired
private TContractorTrainCourseTopicMapper tContractorTrainCourseTopicMapper;
@Autowired
private TContractorTrainCourseMapper tContractorTrainCourseMapper;
@Autowired
private TContractorTrainResultDetailMapper tContractorTrainResultDetailMapper;
/**
* 查询承包商及访客培训考试结果详情
*
*
* @param resultId 承包商及访客培训考试结果详情ID
* @return 承包商及访客培训考试结果详情
*/
......@@ -34,7 +46,7 @@ public class TContractorTrainResultServiceImpl implements ITContractorTrainResul
/**
* 查询承包商及访客培训考试结果详情列表
*
*
* @param tContractorTrainResult 承包商及访客培训考试结果详情
* @return 承包商及访客培训考试结果详情
*/
......@@ -46,7 +58,7 @@ public class TContractorTrainResultServiceImpl implements ITContractorTrainResul
/**
* 新增承包商及访客培训考试结果详情
*
*
* @param tContractorTrainResult 承包商及访客培训考试结果详情
* @return 结果
*/
......@@ -59,7 +71,7 @@ public class TContractorTrainResultServiceImpl implements ITContractorTrainResul
/**
* 修改承包商及访客培训考试结果详情
*
*
* @param tContractorTrainResult 承包商及访客培训考试结果详情
* @return 结果
*/
......@@ -71,7 +83,7 @@ public class TContractorTrainResultServiceImpl implements ITContractorTrainResul
/**
* 批量删除承包商及访客培训考试结果详情
*
*
* @param resultIds 需要删除的承包商及访客培训考试结果详情ID
* @return 结果
*/
......@@ -83,7 +95,7 @@ public class TContractorTrainResultServiceImpl implements ITContractorTrainResul
/**
* 删除承包商及访客培训考试结果详情信息
*
*
* @param resultId 承包商及访客培训考试结果详情ID
* @return 结果
*/
......@@ -92,4 +104,67 @@ public class TContractorTrainResultServiceImpl implements ITContractorTrainResul
{
return tContractorTrainResultMapper.deleteTContractorTrainResultById(resultId);
}
/**
* 用户课程考试交卷
* @param tContractorTrainResult
*/
@Override
public Map<String,Object> examination(TContractorTrainResult tContractorTrainResult) {
TContractorTrainCourseTopic tContractorTrainCourseTopic=new TContractorTrainCourseTopic();
String answers = tContractorTrainResult.getAnswers();
//交卷答题
String[] split = answers.split(",");
//查询考试题和答案
List<TContractorTrainCourseTopic> tContractorTrainCourseTopics = tContractorTrainCourseTopicMapper.selectTContractorTrainCourseTopicList(tContractorTrainCourseTopic);
//正确答案数量
int num = 0;
for(Integer i=0;i<split.length;i++){
if(Integer.parseInt(split[i])==tContractorTrainCourseTopics.get(i).getAnswer()){
num++;
}
}
TContractorTrainCourse tContractorTrainCourse=new TContractorTrainCourse();
//查询需要正确几道题算通过
TContractorTrainCourse itContractorTrainCourse = tContractorTrainCourseMapper.getITContractorTrainCourse(tContractorTrainCourse);
//判断答题是否合格
if(num>=itContractorTrainCourse.getQualifiedNum()){
tContractorTrainResult.setIsQualified("0");
}else {
tContractorTrainResult.setIsQualified("1");
}
//答对数量
tContractorTrainResult.setScore(String.valueOf(num));
tContractorTrainResult.setCreateTime(new Date());
//承包商及访客培训考试结果 添加方法
tContractorTrainResultMapper.insertTContractorTrainResult(tContractorTrainResult);
/**添加承包商及访客培训考试结果详情*/
for (int n=0;n<split.length;n++){
TContractorTrainResultDetail tContractorTrainResultDetail=new TContractorTrainResultDetail();
//设置结果管理id
tContractorTrainResultDetail.setResult(String.valueOf(tContractorTrainResult.getResultId()));
//设置题目内容
tContractorTrainResultDetail.setTopicTitle(tContractorTrainCourseTopics.get(n).getTopicTitle());
//设置题目选项
tContractorTrainResultDetail.setTopicOption(tContractorTrainCourseTopics.get(n).getTopicOption());
//答案
tContractorTrainResultDetail.setAnswer(tContractorTrainCourseTopics.get(n).getAnswer());
//所选答案
tContractorTrainResultDetail.setAnswerChoice(Integer.valueOf(split[n]));
//答案结果
if (Integer.valueOf(split[n])==tContractorTrainCourseTopics.get(n).getAnswer()){
tContractorTrainResultDetail.setResult("0");
}else {
tContractorTrainResultDetail.setResult("1");
}
tContractorTrainResultDetail.setCreateTime(new Date());
tContractorTrainResultDetail.setResultId(tContractorTrainResult.getResultId());
tContractorTrainResultDetailMapper.insertTContractorTrainResultDetail(tContractorTrainResultDetail);
}
Map<String,Object> map = new HashMap<>();
map.put("answer",num);
map.put("qualifiedNum",itContractorTrainCourse.getQualifiedNum());
map.put("topicNum",tContractorTrainCourseTopics.size());
return map;
}
}
<?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.zehong.system.mapper.TContractorTrainResultDetailMapper">
<resultMap type="TContractorTrainResultDetail" id="TContractorTrainResultDetailResult">
<result property="detailId" column="detail_id" />
<result property="resultId" column="result_id" />
<result property="topicTitle" column="topic_title" />
<result property="topicOption" column="topic_option" />
<result property="answer" column="answer" />
<result property="answerChoice" column="answer_choice" />
<result property="result" column="result" />
<result property="createTime" column="create_time" />
<result property="isDel" column="is_del" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectTContractorTrainResultDetailVo">
select detail_id, result_id, topic_title, topic_option, answer, answer_choice, result, create_time, is_del, remark from t_contractor_train_result_detail
</sql>
<select id="selectTContractorTrainResultDetailList" parameterType="TContractorTrainResultDetail" resultMap="TContractorTrainResultDetailResult">
<include refid="selectTContractorTrainResultDetailVo"/>
<where>
<if test="resultId != null "> and result_id = #{resultId}</if>
<if test="topicTitle != null and topicTitle != ''"> and topic_title = #{topicTitle}</if>
<if test="topicOption != null and topicOption != ''"> and topic_option = #{topicOption}</if>
<if test="answer != null "> and answer = #{answer}</if>
<if test="answerChoice != null "> and answer_choice = #{answerChoice}</if>
<if test="result != null and result != ''"> and result = #{result}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
</where>
</select>
<select id="selectTContractorTrainResultDetailById" parameterType="Long" resultMap="TContractorTrainResultDetailResult">
<include refid="selectTContractorTrainResultDetailVo"/>
where detail_id = #{detailId}
</select>
<insert id="insertTContractorTrainResultDetail" parameterType="TContractorTrainResultDetail" useGeneratedKeys="true" keyProperty="detailId">
insert into t_contractor_train_result_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="resultId != null">result_id,</if>
<if test="topicTitle != null">topic_title,</if>
<if test="topicOption != null">topic_option,</if>
<if test="answer != null">answer,</if>
<if test="answerChoice != null">answer_choice,</if>
<if test="result != null">result,</if>
<if test="createTime != null">create_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="resultId != null">#{resultId},</if>
<if test="topicTitle != null">#{topicTitle},</if>
<if test="topicOption != null">#{topicOption},</if>
<if test="answer != null">#{answer},</if>
<if test="answerChoice != null">#{answerChoice},</if>
<if test="result != null">#{result},</if>
<if test="createTime != null">#{createTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateTContractorTrainResultDetail" parameterType="TContractorTrainResultDetail">
update t_contractor_train_result_detail
<trim prefix="SET" suffixOverrides=",">
<if test="resultId != null">result_id = #{resultId},</if>
<if test="topicTitle != null">topic_title = #{topicTitle},</if>
<if test="topicOption != null">topic_option = #{topicOption},</if>
<if test="answer != null">answer = #{answer},</if>
<if test="answerChoice != null">answer_choice = #{answerChoice},</if>
<if test="result != null">result = #{result},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where detail_id = #{detailId}
</update>
<delete id="deleteTContractorTrainResultDetailById" parameterType="Long">
delete from t_contractor_train_result_detail where detail_id = #{detailId}
</delete>
<delete id="deleteTContractorTrainResultDetailByIds" parameterType="String">
delete from t_contractor_train_result_detail where detail_id in
<foreach item="detailId" collection="array" open="(" separator="," close=")">
#{detailId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -8,6 +8,14 @@ export function listTopic(query) {
params: query
})
}
// 新增承包商及访客培训考试结果
export function setEsult(query) {
return request({
url: '/system/result/examination',
method: 'get',
params: query
})
}
// 查询承包商及访客培训题库详细
export function getTopic(topicId) {
......
<template>
<el-form ref="form" :model="form" :label-position="right" label-width="80px">
<el-form ref="form" :rules="rules" :model="form" label-width="80px">
<h3>个人信息录入</h3>
<el-form-item label="单位">
<el-form-item label="单位" prop="beyondUnit">
<el-input
style="width: 70%;"
placeholder="请输入单位"
v-model="form.name"
v-model="form.beyondUnit"
maxlength="30"
clearable>
</el-input>
</el-form-item>
......@@ -16,14 +17,15 @@
style="width: 70%;"
placeholder="请输入姓名"
v-model="form.name"
maxlength="11"
clearable>
</el-input>
</el-form-item>
<el-form-item label="性别">
<el-radio-group v-model="form.resource">
<el-radio label="男"></el-radio>
<el-radio label="女"></el-radio>
<el-radio-group v-model="form.sex">
<el-radio label="0"></el-radio>
<el-radio label="1"></el-radio>
</el-radio-group>
</el-form-item>
......@@ -31,7 +33,9 @@
<el-input
style="width: 70%;"
placeholder="手机号"
v-model="form.name"
v-model="form.phoneNum"
type="number"
maxlength="11"
clearable>
</el-input>
</el-form-item>
......@@ -52,35 +56,78 @@
data() {
return {
form: {
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: '',
active: 0
},
sizeForm: {
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: ''
beyondUnit: null,
name: null,
sex: null,
phoneNum: null,
testBeginTime:null,
},
}
},
methods: {
/**
* 获取当前时间
*/
currentTime() {
var date = new Date();
var year = date.getFullYear(); //月份从0~11,所以加一
let month = date.getMonth();
var dateArr = [
date.getMonth() + 1,
date.getDate(),
date.getHours(),
date.getMinutes(),
date.getSeconds(),
];
//如果格式是MM则需要此步骤,如果是M格式则此循环注释掉
for (var i = 0; i < dateArr.length; i++) {
if (dateArr[i] >= 1 && dateArr[i] <= 9) {
dateArr[i] = "0" + dateArr[i];
}
}
var strDate =
year +
"/" +
dateArr[0] +
"/" +
dateArr[1] +
" " +
dateArr[2] +
":" +
dateArr[3] +
":" +
dateArr[4];
//此处可以拿外部的变量接收 strDate:2022-05-01 13:25:30
//this.date = strDate;
this.form.testBeginTime=strDate;
},
onSubmit() {
window.open("http://192.168.2.2/trainingMaterials", "_search");
console.log('submit!');
// 保留当前页,页面跳转至 /home 页
// this.$router.push("http://192.168.2.2/trainingMaterials");
// this.$router.push({name:'http://192.168.2.2/trainingMaterials',params: {id:'123456'}})
this.currentTime();
// let params = this.form;
let params = JSON.stringify(this.form);
console.log(this.form.beyondUnit)
if (!this.form.beyondUnit){
console.log(params.beyondUnit)
this.$message('请输入单位');
}else if (!this.form.name){
this.$message('请输入姓名');
}else if (!this.form.sex){
this.$message('请选择性别');
}else if (!this.form.phoneNum){
this.$message('请输入手机号');
}else if (this.form.phoneNum.size>11){
this.$message('长度超出11位');
} else {
const routeData = this.$router.resolve({
path: '/trainingMaterials', //跳转目标窗口的地址
query: {
params //括号内是要传递给新窗口的参数
}
})
window.open(routeData.href, "_search");
}
},
next() {
if (this.active++ > 2) this.active = 0;
......
......@@ -3,7 +3,7 @@
class="answerLesson"
title="开始答题"
:visible.sync="visible"
width="57.5%"
width="87.5%"
:close-on-click-modal="false"
:close-on-press-escape="false"
:before-close="dialogCancel"
......@@ -11,16 +11,17 @@
destroy-on-close
>
<div ref="myBody" class="body" v-loading="loading">
<div class="text">
<div class="float">炼铁车间炉前工安全生产规范课程</div>
</div>
<!-- <div class="text">-->
<!-- <div class="float">访客和供应商培训管理</div>-->
<!-- </div>-->
<transition name="fade" mode="out-in">
<div :key="goodJobShow">
<template v-if="!goodJobShow">
<transition name="fade" mode="out-in">
<transition name="fade" mode="out-in" >
<div class="question-wrapper" v-if="visible" :key="nowQuestion">
<div v-for="(item, index) in list" :key="item.id">
<Question
style="width: 89%;"
v-if="index === nowQuestion"
:questionObj="item"
:index="index"
......@@ -64,8 +65,11 @@
</div>
<div slot="footer" class="dialog-footer">
<!-- <el-button type="primary" @click="closeFinished" v-if="goodJobShow"-->
<!-- >重新考试</el-button-->
<!-- >-->
<el-button type="primary" @click="closeFinished" v-if="goodJobShow"
>重新考试</el-button
>确定</el-button
>
<el-button type="primary" @click="dialogSubmitForm" v-else
>交卷</el-button
......@@ -76,12 +80,16 @@
</template>
<script>
import Question from "@/views/educationPlanExam/myLessons/components/Question";
import GoodJob from "@/views/educationPlanExam/myLessons/components/GoodJob.vue";
import Question from "../Trainingmaterials/components/Question";
import GoodJob from "../Trainingmaterials/components/GoodJob.vue";
import {
userQuestionList,
setAnswer,
} from "@/api/educationPlanExam/lessonsProgram";
import {
listTopic,
setEsult
} from "@/api/contractTrain/contractTrainTopic";
export default {
name: "AnswerLesson",
props: {
......@@ -96,6 +104,9 @@
type: [Number, String],
},
},
from:{
answers:{}
},
components: {
Question,
GoodJob,
......@@ -107,6 +118,7 @@
goodJobShow: false,
goodJobData: {},
loading: false,
from:{},
list: [
{
id: 19,
......@@ -129,9 +141,9 @@
// },
// },
created() {
userQuestionList({ courseId: this.courseId }).then((res) => {
console.log(res.data);
this.list = res.data.map((item) => {
listTopic().then((res) => {
console.log(res);
this.list = res.rows.map((item) => {
return {
id: item.topicId,
text: item.topicTitle,
......@@ -145,20 +157,21 @@
this.startHeight = this.$refs.myBody.offsetHeight - 55 + "px";
},
dialogSubmitForm() {
console.log(JSON.parse(this.$route.query.params))
// this.answerClear();
// this.$emit("update:visible", false);
this.saveBody();
const answers = this.answerArr.map((item) => item.answer).join(",");
this.form=JSON.parse(this.$route.query.params);
this.loading = true;
setAnswer({
userCourseId: this.userCourseId,
answers,
})
console.log(this.form)
this.form.answers=answers
console.log(this.form)
setEsult(this.form)
.then((res) => {
if (res.code == 200) {
this.goodJobData = res.data;
this.goodJobShow = true;
}
})
.finally(() => {
......@@ -172,7 +185,13 @@
},
// 关闭之后
closeFinished() {
this.answerClear();
const routeData = this.$router.resolve({
path: '/enterInformation', //跳转目标窗口的地址
query: {
}
})
window.open(routeData.href, "_search");
// this.answerClear();
this.goodJobShow = false;
},
answerClear() {
......@@ -213,6 +232,7 @@
},
changeLetter(letter) {
console.log(letter);
console.log(this.$route.query) // 输出为:{params:"message"}
const obj = {};
obj.questionNum = this.nowQuestion + 1;
obj.answer = letter;
......@@ -236,22 +256,22 @@
</script>
<style lang="scss" scoped>
.body {
width: 100%;
width: 120%;
height: 100%;
padding-right: 50px;
padding-left: 60px;
padding-right: 40px;
padding-left: 20px;
.question-wrapper {
}
.text {
margin-bottom: 27px;
margin-bottom: 16px;
.float {
padding-right: 7px;
width: 411px;
padding-right: 70%;
width: 106%;
height: 28px;
background: #1d84ff;
line-height: 28px;
color: #ffffff;
font-size: 14px;
font-size: 10px;
text-align: right;
float: right;
}
......@@ -263,13 +283,13 @@
}
.select {
.select-item {
padding-top: 20px;
padding-top: 30px;
flex-wrap: wrap;
> div {
margin-bottom: 10px;
}
.item {
width: 28px;
width: 38px;
height: 28px;
border: 1px solid #bbbbbb;
line-height: 28px;
......
<template>
<el-dialog
class="answerLesson"
title="开始答题"
:visible.sync="visible"
width="57.5%"
:close-on-click-modal="false"
:close-on-press-escape="false"
:before-close="dialogCancel"
@closed="closeFinished"
destroy-on-close
>
<div ref="myBody" class="body" v-loading="loading">
<div class="text">
<div class="float">炼铁车间炉前工安全生产规范课程</div>
</div>
<transition name="fade" mode="out-in">
<div :key="goodJobShow">
<template v-if="!goodJobShow">
<transition name="fade" mode="out-in">
<div class="question-wrapper" v-if="visible" :key="nowQuestion">
<div v-for="(item, index) in list" :key="item.id">
<Question
v-if="index === nowQuestion"
:questionObj="item"
:index="index"
:nowQuestion="nowQuestion"
:selectLetter="selectLetter"
@changeLetter="changeLetter"
/>
</div>
</div>
</transition>
<div class="select flex">
<div class="select-item flex">
<div
class="item"
:class="{
active:
answerArr.findIndex(
(item) => item.questionNum === index + 1
) >= 0,
now: index === nowQuestion,
}"
v-for="(item, index) in list"
:key="item.id + 'a' + index"
@click="questionNumClick(index)"
>
{{ index + 1 }}
</div>
<div @click="nextBtnClick" class="btn">下一题</div>
</div>
</div>
</template>
<template v-else>
<div :style="{ height: startHeight }">
<GoodJob :goodJobData="goodJobData" />
</div>
</template>
</div>
</transition>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="closeFinished" v-if="goodJobShow"
>重新考试</el-button
>
<el-button type="primary" @click="dialogSubmitForm" v-else
>交卷</el-button
>
<el-button @click="dialogCancel">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import Question from "./Question";
import GoodJob from "./GoodJob.vue";
import {
userQuestionList,
setAnswer,
} from "@/api/educationPlanExam/lessonsProgram";
export default {
name: "AnswerLesson",
props: {
visible: {
type: Boolean,
default: false,
},
userCourseId: {
type: [Number, String],
},
courseId: {
type: [Number, String],
},
},
components: {
Question,
GoodJob,
},
data() {
return {
nowQuestion: 0,
startHeight: "0px",
goodJobShow: false,
goodJobData: {},
loading: false,
list: [
{
id: 19,
text: "j9",
question: ["adsf", "dfgsdfg", "adsfadsf", "dfasdfadsf"],
},
],
answerArr: [],
// 题目是否被答过,如果答过,就把值传回去,如果没有答过,就是空
selectLetter: 999,
};
},
// watch: {
// visible(newValue) {
// if (newValue) {
// this.$nextTick(() => {
// this.saveBody();
// });
// }
// },
// },
created() {
userQuestionList({ courseId: this.courseId }).then((res) => {
console.log(res.data);
this.list = res.data.map((item) => {
return {
id: item.topicId,
text: item.topicTitle,
question: JSON.parse(item.topicOption).map((item) => item.value),
};
});
});
},
methods: {
saveBody() {
this.startHeight = this.$refs.myBody.offsetHeight - 55 + "px";
},
dialogSubmitForm() {
// this.answerClear();
// this.$emit("update:visible", false);
this.saveBody();
const answers = this.answerArr.map((item) => item.answer).join(",");
this.loading = true;
setAnswer({
userCourseId: this.userCourseId,
answers,
})
.then((res) => {
if (res.code == 200) {
this.goodJobData = res.data;
this.goodJobShow = true;
}
})
.finally(() => {
this.loading = false;
// 是否作对
this.$emit('jj',this.goodJobData)
});
},
dialogCancel() {
this.$emit("update:visible", false);
},
// 关闭之后
closeFinished() {
this.answerClear();
this.goodJobShow = false;
},
answerClear() {
this.answerArr = [];
this.nowQuestion = 0;
},
// 点题目时
questionNumClick(index) {
// 是否是回答过的,数组中存在它,那它就是回答过的
const bool =
this.answerArr.findIndex((item) => item.questionNum === index + 1) >= 0;
// 或者下一题与当前题目是紧挨着的并且当前题目是答完的,相差为1就算是紧挨着的
const nowQuestionAnswerBool = this.nextQuestion(index);
if (bool || nowQuestionAnswerBool) {
this.nowQuestion = index;
}
// 赋值,如果答过的,就传回去,如果没答过,就是空 变成字符串是因为0位false
this.selectLetter =
this.answerArr[this.nowQuestion]?.answer + "" || 99999;
},
nextBtnClick() {
// 到头了,打完了
if (this.nowQuestion + 1 == this.list.length) return;
this.questionNumClick(this.nowQuestion + 1);
},
// 紧挨着且当前题目是打完的
nextQuestion(index) {
// 下一题相差1
// const nextIndexBool = index - this.nowQuestion == 1;
// 答案数组的长度,就是档当前达到了第几题,长度-1是因为题目是从0开始记录
const nextIndexBool = index - (this.answerArr.length - 1) == 1;
// 当前题已经回答过
const nowQuestionAnswerBool =
this.answerArr.findIndex(
(item) => item.questionNum === this.nowQuestion + 1
) >= 0;
return nextIndexBool && nowQuestionAnswerBool;
},
changeLetter(letter) {
console.log(letter);
const obj = {};
obj.questionNum = this.nowQuestion + 1;
obj.answer = letter;
// 数组中是否存在这个题目
const index = this.answerArr.findIndex(
(item) => item.questionNum === this.nowQuestion + 1
);
if (index < 0) {
// 如果不存在
// 推入
this.answerArr.push(obj);
} else {
// 如果存在
// 替换
this.answerArr.splice(index, 1, obj);
}
// console.log(this.answerArr);
},
},
};
</script>
<style lang="scss" scoped>
.body {
width: 100%;
height: 100%;
padding-right: 50px;
padding-left: 60px;
.question-wrapper {
}
.text {
margin-bottom: 27px;
.float {
padding-right: 7px;
width: 411px;
height: 28px;
background: #1d84ff;
line-height: 28px;
color: #ffffff;
font-size: 14px;
text-align: right;
float: right;
}
&:after {
content: "";
display: block;
clear: both;
}
}
.select {
.select-item {
padding-top: 20px;
flex-wrap: wrap;
> div {
margin-bottom: 10px;
}
.item {
width: 28px;
height: 28px;
border: 1px solid #bbbbbb;
line-height: 28px;
font-size: 14px;
text-align: center;
margin-right: 18px;
cursor: pointer;
&.active {
background: #e9e9e9;
}
&.now {
background: #a3d3ff;
border: none;
}
}
.btn {
width: 84px;
height: 28px;
background: #e8f4ff;
border: 1px solid #a3d3ff;
color: #1d84ff;
text-align: center;
line-height: 28px;
font-size: 14px;
cursor: pointer;
&:hover {
background: rgba(29, 132, 255, 0.5);
color: #ffffff;
}
}
}
}
}
</style>
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-21 17:20:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 11:56:49
* @FilePath: /danger-manage-web/src/views/myLessons/components/GoodJob.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="goodjob-wrapper flex">
<div class="text flex">
<div class="text flex">
<template v-if="goodJobData.answer >= goodJobData.qualifiedNum">
<div class="icon"><i class="iconfont icon-smiling" /></div>
<div>
恭喜你,做对{{ goodJobData.answer }}道题得分{{
Math.floor((goodJobData.answer / goodJobData.topicNum) * 100)
}},成绩合格!
</div>
</template>
<template v-else>
<div class="icon"><i class="iconfont icon-nanguo" /></div>
<div>
继续努力,做对{{ goodJobData.answer }}道题得分{{
Math.floor((goodJobData.answer / goodJobData.topicNum) * 100)
}},成绩不合格!
</div>
</template>
</div>
</div>
</div>
</template>
<script>
export default {
name: "",
props: {
goodJobData: {
type: Object,
},
},
data() {
return {};
},
methods: {},
};
</script>
<style lang="scss" scoped>
.goodjob-wrapper {
justify-content: center;
align-items: center;
width: 86%;
height: 100%;
border-bottom: 1px solid #bbbbbb;
.text {
width: 94%;
height: 174px;
color: #1d84ff;
background: #f9f9f9 100%;
border-radius: 15px;
line-height: 40px;
font-size: 28px;
justify-content: center;
align-items: center;
.icon {
margin-right: 10px;
.iconfont {
color: #e2852a;
font-size: 40px !important;
}
}
}
}
</style>
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-20 14:17:00
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 13:05:49
* @FilePath: /danger-manage-web/src/views/myLessions/components/learnAfter.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="learnbrfore flex">
<transition name="fade" mode="out-in">
<div class="top flex" :key="currentPage">
<div
v-show="index < 9 * currentPage && index >= 9 * (currentPage - 1)"
v-for="(item, index) in afterList"
:key="index + ''"
class="learn-item"
>
<LearnItem
:state="state"
:itemData="item"
@examination="examination"
/>
</div>
</div>
</transition>
<div class="bottom flex">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-size="9"
:layout="total > 9 ? layout : layout2"
:total="afterList.length"
>
</el-pagination>
</div>
</div>
</template>
<script>
import LearnItem from "./LearnItem";
export default {
name: "learnbrfore",
components: {
LearnItem,
},
props: {
state: {
type: Object,
},
list: {
type: Array,
default: () => {
return [];
},
},
},
data() {
return {
// list: [
// { state: 2},
// { state: 2},
// { state: 2},
// { state: 2},
// { state: 2},
// { state: 2},
// { state: 2},
// { state: 2},
// { state: 2},
// ],
currentPage: 1,
total: 19,
layout: "prev, pager, next, jumper",
layout2: "prev, pager, next",
};
},
computed: {
afterList() {
return this.list.filter((item) => item.state > 1);
},
},
created() {
console.log("after");
},
methods: {
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
},
examination(e) {
this.$emit("examination", e);
},
},
};
</script>
<style lang="scss" scoped>
.learnbrfore {
width: 100%;
height: 100%;
flex-direction: column;
.top {
width: 100%;
flex: 1;
padding: 2px;
box-sizing: border-box;
// justify-content: space-between;
flex-wrap: wrap;
.learn-item {
width: 32.5%;
height: 31.5%;
margin-right: 1.25%;
&:nth-child(3n) {
margin-right: 0px;
}
}
}
.bottom {
height: 12.7%;
max-height: 100px;
justify-content: center;
align-items: center;
}
}
</style>
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-20 14:17:00
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 09:37:40
* @FilePath: /danger-manage-web/src/views/myLessions/components/learnAfter.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="learnbrfore flex">
<transition name="fade" mode="out-in">
<div class="top flex" :key="currentPage">
<div
v-show="index < 9 * currentPage && index >= 9 * (currentPage - 1)"
v-for="(item, index) in beforeList"
:key="index + ''"
class="learn-item"
>
<LearnItem
:state="state"
:itemData="item"
@examination="examination"
/>
</div>
</div>
</transition>
<div class="bottom flex">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-size="9"
:layout="total > 9 ? layout : layout2"
:total="beforeList.length"
>
</el-pagination>
</div>
</div>
</template>
<script>
import LearnItem from "./LearnItem";
export default {
name: "learnbrfore",
components: {
LearnItem,
},
props: {
state: {
type: Object,
},
list: {
type: Array,
default: () => {
return [];
},
},
},
data() {
return {
// list: [
// { state: 0 },
// { state: 1 },
// { state: 0 },
// { state: 1 },
// { state: 0 },
// { state: 1 },
// { state: 1 },
// { state: 1 },
// { state: 0 },
// ],
currentPage: 1,
total: 19,
layout: "prev, pager, next, jumper",
layout2: "prev, pager, next",
};
},
computed: {
beforeList() {
return this.list.filter((item) => item.state < 2);
},
},
created() {
console.log("before");
},
methods: {
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
},
examination(e) {
this.$emit("examination", e);
},
},
};
</script>
<style lang="scss" scoped>
.learnbrfore {
width: 100%;
height: 100%;
flex-direction: column;
.top {
width: 100%;
flex: 1;
padding: 2px;
box-sizing: border-box;
// justify-content: space-between;
flex-wrap: wrap;
.learn-item {
width: 32.5%;
height: 31.5%;
margin-right: 1.25%;
&:nth-child(3n) {
margin-right: 0px;
}
}
}
.bottom {
height: 12.7%;
max-height: 100px;
justify-content: center;
align-items: center;
}
}
</style>
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-20 14:29:26
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 18:00:44
* @FilePath: /danger-manage-web/src/views/myLessons/components/LearnItem.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="item flex">
<div class="title" style="text-align: center">{{ itemData.courseType||'-' }}</div>
<div class="allone">
<img v-if="itemData.dataKind==0" style="height: 18px" src="@/assets/img/ykao.png"/>
<img v-if="itemData.dataKind==1" style="height: 18px" src="@/assets/img/skao.png"/>
<div class="lesson" style="width: 75%"> {{ itemData.courseName }}</div>
</div>
<div class="time">发布时间:{{ itemData.createTime }}</div>
<div class="bottom flex">
<div @click="click" class="btn" :class="{ again: yesOrNo }">
{{ yesOrNo ? "重新考试" : "开始学习" }}
</div>
</div>
<div
class="img"
:class="{
no: itemData.state === 1,
yes: itemData.state === 2,
}"
>
{{ state[itemData.state] }}
</div>
</div>
</template>
<script>
export default {
name: "",
props: {
itemData: {
type: Object,
default: () => {
return {
again: 2,
};
},
},
state: {
type: Object,
},
},
computed: {
yesOrNo() {
return this.itemData.state == 1 || this.itemData.state == 2;
},
},
data() {
return {};
},
methods: {
click() {
const { courseId, userCourseId, state, examinationResult, topicNum } =
this.itemData;
// if (!this.yesOrNo) {
// this.$router.push("myLessons/CheckLesson");
let fenshu;
if (examinationResult) {
fenshu = Math.floor((examinationResult / topicNum) * 100);
} else {
fenshu = 0;
}
this.$router.push({
path: "myLessons/CheckLesson",
query: { courseId, userCourseId, state, fenshu },
});
// } else {
// this.$emit("examination", { courseId, userCourseId });
// }
// $router.push("myLessons/CheckLesson");
},
},
};
</script>
<style lang="scss" scoped>
.item {
width: 100%;
height: 100%;
// background: red;
overflow: hidden;
padding-top: 15px;
padding-left: 18px;
box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.12);
border-radius: 5px;
flex-direction: column;
position: relative;
> div {
font-size: 14px;
}
.title {
color: #606266;
margin-bottom: 8%;
}
.lesson {
color: #1d84ff;
text-align: center;
margin-bottom: 3%;
}
.time {
text-align: center;
font-size: 12px;
color: #7b808a;
margin-bottom: 5%;
}
.bottom {
flex: 1;
justify-content: center;
.btn {
width: 110px;
height: 40px;
border-radius: 4px;
font-size: 14px;
text-align: center;
line-height: 40px;
color: #1d84ff;
border: 1px solid #a3d3ff;
background: #e8f4ff;
font-size: 14;
cursor: pointer;
&.again {
color: #ffffff;
border: 1px solid #a3d3ff;
background: #1d84ff 100%;
}
&:hover {
background: rgba(29, 132, 255, 0.5);
color: #ffffff;
}
}
}
.allone{
display:flex;
flex-direction:row;
justify-content:flex-start;
}
.img {
position: absolute;
width: 100px;
height: 20px;
background: #1d84ff;
// opacity: .2;
top: 3%;
right: -7%;
text-align: center;
line-height: 20px;
font-size: 10px;
color: #ffffff;
transform: rotateZ(40deg);
&.no {
background: #e2852a;
}
&.yes {
background: #3cc426 !important;
}
}
}
</style>
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-20 11:30:14
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 09:19:38
* @FilePath: /danger-manage-web/src/views/myLessons/components/Left.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="lession-left-wrapper flex">
<el-tabs class="top" v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="待学习" name="first"></el-tab-pane>
<el-tab-pane label="已学习" name="second"></el-tab-pane>
</el-tabs>
<div class="middle flex">
<transition name="fade-transform" mode="out-in">
<keep-alive>
<component :is="currentTabComponent" @examination="examination" :state="state" :list="list"></component>
</keep-alive>
</transition>
</div>
</div>
</template>
<script>
import LearnAfter from "./LearnAfter";
import LearnBefore from "./LearnBefore";
import {getUserLessons} from "@/api/educationPlanExam/lessonsProgram"
export default {
name: "lession-left",
components: {
// LearnAfter,
// LearnBefore,
},
data() {
return {
activeName: "first",
currentTabComponent: LearnBefore,
list:[],
state:{
"0":'未学习',
"1":'未通过',
"2":"通过"
},
};
},
created(){
this.getUserLessons();
},
methods: {
getUserLessons(){
getUserLessons().then(res=>{
console.log(res.rows);
this.list = res.rows;
})
},
handleClick(tab) {
if (tab.paneName == "first") {
this.currentTabComponent = LearnBefore;
} else {
this.currentTabComponent = LearnAfter;
}
},
examination(e){
this.$emit('examination',e)
}
},
};
</script>
<style lang="scss" scoped>
.lession-left-wrapper {
padding: 5px 26px 0;
height: 100%;
width: 100%;
flex-direction: column;
.top {
// margin-bottom: 47px;
}
.middle {
flex: 1;
height: 100%;
width: 100%;
justify-content: space-between;
overflow: hidden;
}
// .bottom{
// max-height: 105px;
// height: 11%;
// }
}
</style>
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-21 11:00:14
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 11:15:27
* @FilePath: /danger-manage-web/src/views/myLessons/components/Question.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="question flex">
<div
class="top"
:class="{ flex: alignItemsCenter }"
:style="{ alignItems: alignItemsCenter ? 'center' : '' }"
ref="top"
>
<div class="text" ref="text">
{{ questionObj.text }}
</div>
<div class="num">{{ nowQuestion + 1 }}</div>
</div>
<div class="middle">
<div
class="item flex"
v-for="(item, index) in questionObj.question"
:key="item+'aas'+index"
>
<div class="letter">
{{ letters[index] }}
</div>
<div class="">
{{ item }}
</div>
</div>
</div>
<div class="bottom flex">
<div class="change-wrapper flex">
<div
class="change"
:class="{ active: letterActive+'' === index+'' }"
@click="changeLetter(index)"
v-for="(item, index) in questionObj.question"
:key="item+'a'+index"
>
{{ letters[index] }}
</div>
</div>
</div>
</div>
</template>
<script>
const letters = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
];
export default {
name: "question",
props: {
questionObj: {
type: Object,
default: () => {
return {
text: "asdfasdf",
question: [
"沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师沙发斯蒂芬大师",
"沙发斯蒂芬大师",
"沙发斯蒂芬大师",
"沙发斯蒂芬大师",
"沙发斯蒂芬大师",
],
};
},
},
nowQuestion: {
type: Number,
},
index: {
type: Number,
},
// 从外面传进来的选项,选择过的才有,没选择过的没有
selectLetter: {
type: [String, Number],
default:999,
},
},
data() {
return {
alignItemsCenter: false,
// 如果传进来了,就是这个值,如果没有就是null,因为动画需要那个key的问题,会清空原始的盒子,所以要传一下值
letterActive: this.selectLetter,
letters,
};
},
mounted() {
// console.log('123')
// 每次都会更新,所以不需要watch 直接在这里面写 因为动画需要那个key的问题,会清空原始的盒子,所以要传一下值
this.textCenter();
},
watch: {
// 监听一下当前题目,调整一下位置
// nowQuestion(value) {
// console.log('nowQuestion变化',value)
// this.$nextTick(() => {
// this.textCenter();
// });
// },
},
methods: {
textCenter() {
let h1 = this.$refs.text?.offsetHeight;
let h2 = this.$refs.top?.offsetHeight;
// 如果text大于或者等于top,就出不居中,如果不小于top,就上下居中
if (h2 <= h1) {
this.alignItemsCenter = false;
} else {
this.alignItemsCenter = true;
}
},
changeLetter(index) {
this.letterActive = index;
this.$emit("changeLetter", index);
// this.$emit("changeLetter", this.letters[index]);
},
},
};
</script>
<style lang="scss" scoped>
.question {
// position: absolute;
// top: 0px;
// display: inline-block;
width: 100%;
height: 370px;
padding-bottom: 10px;
border-bottom: 1px solid #bbbbbb;
// background: red;
flex-direction: column;
.top {
background: #f9f9f9;
height: 54px;
padding: 0px 10px 0px 43px;
overflow-wrap: anywhere;
// align-items: center;
overflow-y: auto;
position: relative;
.text {
font-size: 14px;
text-indent: 2em;
}
.num {
position: absolute;
left: 0;
width: 48px;
height: 48px;
top: 4px;
background: #1d84ff;
border-radius: 50%;
text-align: center;
line-height: 48px;
font-size: 18px;
color: #ffffff;
}
}
.middle {
flex: 1;
// background: blue;
overflow-y: auto;
padding-left: 43px;
padding-right: 10px;
margin-bottom: 15px;
.item {
padding-top: 38px;
width: 100%;
overflow-wrap: anywhere;
font-size: 14px;
color: #101010;
.letter {
padding: 2px;
margin-right: 10px;
box-sizing: border-box;
}
}
}
.bottom {
max-height: 70px;
// background: black;
padding-left: 43px;
padding-right: 10px;
overflow-y: auto;
.change-wrapper {
width: 756px;
flex-wrap: wrap;
margin: 0 auto;
.change {
width: 90px;
height: 30px;
background: #e8f4ff;
color: #101010;
border: 1px solid #a3d3ff;
line-height: 30px;
text-align: center;
margin: 0 9px 5px;
border-radius: 4px;
cursor: pointer;
&.active {
background: #1d84ff;
color: #ffffff;
border: 1px solid #a3d3ff;
}
&:hover {
background: rgba(29, 132, 255, 0.5);
color: #ffffff;
}
}
}
}
}
</style>
<template>
<div class="lession-right-wrapper flex">
<div class="top flex">
<div class="title">通知</div>
<div class="content-wrapper flex">
<div v-for="item in []" :key="item + ''" class="content flex">
<div class="left zzz">
啥啊啥飒哈市罚款收到回复夹寒暑假电烤炉付货款静安荟SDK复活卡开始了东航飞机好看的发
</div>
<div class="right">2022-9-15</div>
</div>
</div>
</div>
<div class="bottom flex">
<div class="title">考试历史</div>
<div class="th flex">
<div class="left">学习课程</div>
<div class="middle">考试时间</div>
<div class="right">得分</div>
</div>
<div v-for="item in list" :key="item.courseId" class="td flex" style="">
<div class="left zzz">{{ item.courseName }}</div>
<div class="middle zzz" :title="item.examinationTime">
{{ item.examinationTime }}
</div>
<div class="right flex">
<div class="a">
<span
class="text"
:class="{ red: item.examinationResult < item.qualifiedNum }"
>{{
(item.examinationResult &&item.topicNum)? Math.floor((item.examinationResult / item.topicNum) * 100):0
}}</span
>/<span>100</span>
</div>
<div class="b flex">
<div style="width: 60px">
<el-progress
:percentage="
Math.floor((item.examinationResult / item.topicNum) * 100)
"
:show-text="false"
></el-progress>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "lession-right",
props: {
list: {
type: Array,
default: () => {
return [];
},
},
},
data() {
return {};
},
methods: {},
};
</script>
<style lang="scss" scoped>
.lession-right-wrapper {
width: 100%;
height: 100%;
flex-direction: column;
> div {
border: 1px solid#BBBBBB;
border-radius: 5px;
}
.top {
width: 100%;
height: 32.7%;
margin-bottom: 23px;
padding: 30px 19px 25px 21px;
flex-direction: column;
overflow: hidden;
.title {
font-size: 14px;
color: #606266;
margin-bottom: 20px;
}
.content-wrapper {
flex: 1;
width: 100%;
overflow-y: auto;
&::-webkit-scrollbar {
width: 0 !important;
}
flex-direction: column;
justify-content: space-between;
.content {
justify-content: space-between;
width: 100%;
font-size: 14px;
color: #7b808a;
.left {
flex: 1;
max-width: 304px;
margin-right: 19px;
}
.right {
min-width: 70px;
}
}
}
}
.bottom {
flex: 1;
width: 100%;
padding-top: 30px;
padding-bottom: 30px;
flex-direction: column;
.title {
margin-left: 21px;
font-size: 14px;
color: #606266;
margin-bottom: 20px;
}
.th {
width: 100%;
height: 50px;
background: #e8f4ff;
justify-content: space-between;
padding-left: 21px;
padding-right: 25px;
margin-bottom: 14px;
> div {
width: 33%;
line-height: 50px;
font-size: 14px;
color: #606266;
text-align: center;
&.left {
width: 40%;
}
&.middle {
width: 30%;
}
&.right {
width: 30%;
text-align: center;
}
}
}
.td {
width: 100%;
height: 40px;
justify-content: space-between;
padding-left: 21px;
padding-right: 25px;
> div {
line-height: 40px;
font-size: 14px;
color: #606266;
text-align: center;
&.left {
width: 40%;
}
&.middle {
width: 30%;
}
&.right {
width: 30%;
overflow: hidden;
justify-content: space-between;
.a {
// width: 20px;
// overflow: hidden;
margin-right: 5px;
text-align: right;
flex: 1;
.text {
color: #32be0f;
&.red {
color: #d11414;
}
}
}
.b {
align-items: center;
// flex: 1;
> div {
width: 100%;
}
}
}
}
}
}
}
</style>
......@@ -23,14 +23,14 @@
</el-button>
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="学习视频">
<el-tag >
<el-button style="padding: 0;" type="text">
<a @click="downLoad(data.video, lessonData.courseName)"
>下载</a>
</el-button>
</el-tag>
</el-descriptions-item>
<!-- <el-descriptions-item label="学习视频">-->
<!-- <el-tag >-->
<!-- <el-button style="padding: 0;" type="text">-->
<!-- <a @click="downLoad(data.video, lessonData.courseName)"-->
<!-- >下载</a>-->
<!-- </el-button>-->
<!-- </el-tag>-->
<!-- </el-descriptions-item>-->
</el-descriptions>
<div class="btn-wrapper flex">
......@@ -162,6 +162,8 @@
},
methods: {
getPlanList() {
//跳转页面的传值
console.log(JSON.parse(this.$route.query.params).beyondUnit)
ITContractorTrainCourse().then((res) => {
this.data=res.data;
this.changeVideo(this.data.video);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment