ly 1 жил өмнө
parent
commit
266e1cd009
26 өөрчлөгдсөн 523 нэмэгдсэн , 148 устгасан
  1. 0 6
      master/src/main/java/com/ruoyi/project/training/elearn/controller/TElExamController.java
  2. 0 6
      master/src/main/java/com/ruoyi/project/training/elearn/controller/TElPaperController.java
  3. 27 15
      master/src/main/java/com/ruoyi/project/training/elearn/controller/TElQuController.java
  4. 0 6
      master/src/main/java/com/ruoyi/project/training/elearn/controller/TElRepoController.java
  5. 34 7
      master/src/main/java/com/ruoyi/project/training/elearn/controller/TElUserBookController.java
  6. 0 7
      master/src/main/java/com/ruoyi/project/training/elearn/controller/TElUserExamController.java
  7. 1 7
      master/src/main/java/com/ruoyi/project/training/elearn/controller/TElUserQuController.java
  8. 8 9
      master/src/main/java/com/ruoyi/project/training/elearn/mapper/TElExamMapper.java
  9. 9 9
      master/src/main/java/com/ruoyi/project/training/elearn/mapper/TElPaperMapper.java
  10. 1 1
      master/src/main/java/com/ruoyi/project/training/elearn/mapper/TElQuRepoMapper.java
  11. 9 9
      master/src/main/java/com/ruoyi/project/training/elearn/mapper/TElRepoMapper.java
  12. 4 0
      master/src/main/java/com/ruoyi/project/training/elearn/mapper/TElUserBookMapper.java
  13. 41 34
      master/src/main/java/com/ruoyi/project/training/elearn/service/impl/TElPaperServiceImpl.java
  14. 9 2
      master/src/main/resources/mybatis/training/elearn/TElQuMapper.xml
  15. 1 1
      master/src/main/resources/mybatis/training/elearn/TElRepoMapper.xml
  16. 16 0
      master/src/main/resources/mybatis/training/elearn/TElUserBookMapper.xml
  17. 20 0
      ui/src/api/training/elearn/userBook.js
  18. 2 0
      ui/src/api/training/elearn/userQu.js
  19. 1 0
      ui/src/components/RepoSelect/index.vue
  20. 7 0
      ui/src/router/index.js
  21. 0 5
      ui/src/views/training/elearn/answer/index.vue
  22. 5 2
      ui/src/views/training/elearn/paper/exam.vue
  23. 112 14
      ui/src/views/training/elearn/qu/index.vue
  24. 3 7
      ui/src/views/training/elearn/userBook/index.vue
  25. 209 0
      ui/src/views/training/elearn/userBook/train.vue
  26. 4 1
      ui/src/views/training/elearn/userQu/train.vue

+ 0 - 6
master/src/main/java/com/ruoyi/project/training/elearn/controller/TElExamController.java

@@ -36,7 +36,6 @@ public class TElExamController extends BaseController
     /**
      * 查询考试列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:exam:list')")
     @GetMapping("/list")
     public TableDataInfo list(TElExam tElExam)
     {
@@ -48,7 +47,6 @@ public class TElExamController extends BaseController
     /**
      * 导出考试列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:exam:export')")
     @Log(title = "考试", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TElExam tElExam)
@@ -61,7 +59,6 @@ public class TElExamController extends BaseController
     /**
      * 获取考试详细信息
      */
-    @PreAuthorize("@ss.hasPermi('elearn:exam:query')")
     @GetMapping(value = "/{examId}")
     public AjaxResult getInfo(@PathVariable("examId") Long examId)
     {
@@ -71,7 +68,6 @@ public class TElExamController extends BaseController
     /**
      * 新增考试
      */
-    @PreAuthorize("@ss.hasPermi('elearn:exam:add')")
     @Log(title = "考试", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TElExam tElExam)
@@ -82,7 +78,6 @@ public class TElExamController extends BaseController
     /**
      * 修改考试
      */
-    @PreAuthorize("@ss.hasPermi('elearn:exam:edit')")
     @Log(title = "考试", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody TElExam tElExam)
@@ -93,7 +88,6 @@ public class TElExamController extends BaseController
     /**
      * 删除考试
      */
-    @PreAuthorize("@ss.hasPermi('elearn:exam:remove')")
     @Log(title = "考试", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{examIds}")
     public AjaxResult remove(@PathVariable Long[] examIds)

+ 0 - 6
master/src/main/java/com/ruoyi/project/training/elearn/controller/TElPaperController.java

@@ -60,7 +60,6 @@ public class TElPaperController extends BaseController
     /**
      * 查询在线考试列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:paper:list')")
     @GetMapping("/list")
     public TableDataInfo list(TElPaper tElPaper)
     {
@@ -72,7 +71,6 @@ public class TElPaperController extends BaseController
     /**
      * 导出在线考试列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:paper:export')")
     @Log(title = "在线考试", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TElPaper tElPaper)
@@ -85,7 +83,6 @@ public class TElPaperController extends BaseController
     /**
      * 获取在线考试详细信息
      */
-    @PreAuthorize("@ss.hasPermi('elearn:paper:query')")
     @GetMapping(value = "/{paperId}")
     public AjaxResult getInfo(@PathVariable("paperId") Long paperId)
     {
@@ -95,7 +92,6 @@ public class TElPaperController extends BaseController
     /**
      * 新增在线考试
      */
-    @PreAuthorize("@ss.hasPermi('elearn:paper:add')")
     @Log(title = "在线考试", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TElPaper tElPaper)
@@ -212,7 +208,6 @@ public class TElPaperController extends BaseController
     /**
      * 修改在线考试
      */
-    @PreAuthorize("@ss.hasPermi('elearn:paper:edit')")
     @Log(title = "在线考试", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody TElPaper tElPaper)
@@ -223,7 +218,6 @@ public class TElPaperController extends BaseController
     /**
      * 删除在线考试
      */
-    @PreAuthorize("@ss.hasPermi('elearn:paper:remove')")
     @Log(title = "在线考试", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{paperIds}")
     public AjaxResult remove(@PathVariable Long[] paperIds)

+ 27 - 15
master/src/main/java/com/ruoyi/project/training/elearn/controller/TElQuController.java

@@ -2,6 +2,7 @@ package com.ruoyi.project.training.elearn.controller;
 
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -11,6 +12,8 @@ import java.util.regex.Pattern;
 import com.alibaba.fastjson.JSON;
 import com.ruoyi.common.utils.ServletUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.FileUploadUtils;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.project.system.domain.SysUser;
 import com.ruoyi.project.training.elearn.domain.TElQuAnswer;
 import com.ruoyi.project.training.spec.domain.vo.TStPlanImportVO;
@@ -20,14 +23,7 @@ import org.apache.poi.xwpf.usermodel.XWPFDocument;
 import org.apache.poi.xwpf.usermodel.XWPFParagraph;
 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.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
 import com.ruoyi.project.training.elearn.domain.TElQu;
@@ -53,7 +49,6 @@ public class TElQuController extends BaseController {
     /**
      * 查询试题列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:qu:list')")
     @PostMapping ("/list")
     public TableDataInfo list(@RequestBody TElQu tElQu) {
         startPage();
@@ -64,7 +59,6 @@ public class TElQuController extends BaseController {
     /**
      * 导出试题列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:qu:export')")
     @Log(title = "试题", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TElQu tElQu) {
@@ -76,16 +70,36 @@ public class TElQuController extends BaseController {
     /**
      * 获取试题详细信息
      */
-    @PreAuthorize("@ss.hasPermi('elearn:qu:query')")
     @GetMapping(value = "/{quId}")
     public AjaxResult getInfo(@PathVariable("quId") Long quId) {
         return AjaxResult.success(tElQuService.selectTElQuById(quId));
     }
 
+    /**
+     * 试题图片上传
+     */
+    @Log(title = "试题图片上传", businessType = BusinessType.UPDATE)
+    @PostMapping("/uploadFile")
+    public AjaxResult uploadFile(@RequestParam("file") MultipartFile file) throws IOException
+    {
+        if (!file.isEmpty())
+        {
+            // 获取当前日期
+            LocalDate currentDate = LocalDate.now();
+            // 获取年份
+            int year = currentDate.getYear();
+            // 获取月份
+            int month = currentDate.getMonthValue();
+            String dir = "/elearn/" + year ;
+            String avatar = FileUploadUtils.upload(RuoYiConfig.getFilePath(dir), file);
+            return AjaxResult.success(avatar);
+        }
+        return AjaxResult.error("上传图片异常,请联系管理员");
+    }
+
     /**
      * 新增试题
      */
-    @PreAuthorize("@ss.hasPermi('elearn:qu:add')")
     @Log(title = "试题", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TElQu tElQu) {
@@ -95,7 +109,6 @@ public class TElQuController extends BaseController {
     /**
      * 修改试题
      */
-    @PreAuthorize("@ss.hasPermi('elearn:qu:edit')")
     @Log(title = "试题", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody TElQu tElQu) {
@@ -105,7 +118,6 @@ public class TElQuController extends BaseController {
     /**
      * 删除试题
      */
-    @PreAuthorize("@ss.hasPermi('elearn:qu:remove')")
     @Log(title = "试题", businessType = BusinessType.DELETE)
     @DeleteMapping("/{quIds}")
     public AjaxResult remove(@PathVariable Long[] quIds) {
@@ -158,7 +170,7 @@ public class TElQuController extends BaseController {
                 } else {
                     qu.setQuType(-1l);
                 }
-                quStr = text + "     ";
+                quStr = "[T]";
 
             } else if (text.endsWith("[D/]")) {
                 quStr = quStr + text;

+ 0 - 6
master/src/main/java/com/ruoyi/project/training/elearn/controller/TElRepoController.java

@@ -38,7 +38,6 @@ public class TElRepoController extends BaseController
     /**
      * 查询题库列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:repo:list')")
     @GetMapping("/list")
     public TableDataInfo list(TElRepo tElRepo)
     {
@@ -50,7 +49,6 @@ public class TElRepoController extends BaseController
     /**
      * 导出题库列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:repo:export')")
     @Log(title = "题库", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TElRepo tElRepo)
@@ -63,7 +61,6 @@ public class TElRepoController extends BaseController
     /**
      * 获取题库详细信息
      */
-    @PreAuthorize("@ss.hasPermi('elearn:repo:query')")
     @GetMapping(value = "/{repoId}")
     public AjaxResult getInfo(@PathVariable("repoId") Long repoId)
     {
@@ -73,7 +70,6 @@ public class TElRepoController extends BaseController
     /**
      * 新增题库
      */
-    @PreAuthorize("@ss.hasPermi('elearn:repo:add')")
     @Log(title = "题库", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TElRepo tElRepo)
@@ -84,7 +80,6 @@ public class TElRepoController extends BaseController
     /**
      * 修改题库
      */
-    @PreAuthorize("@ss.hasPermi('elearn:repo:edit')")
     @Log(title = "题库", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody TElRepo tElRepo)
@@ -95,7 +90,6 @@ public class TElRepoController extends BaseController
     /**
      * 删除题库
      */
-    @PreAuthorize("@ss.hasPermi('elearn:repo:remove')")
     @Log(title = "题库", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{repoIds}")
     public AjaxResult remove(@PathVariable Long[] repoIds)

+ 34 - 7
master/src/main/java/com/ruoyi/project/training/elearn/controller/TElUserBookController.java

@@ -1,6 +1,7 @@
 package com.ruoyi.project.training.elearn.controller;
 
 import java.util.List;
+import com.ruoyi.project.training.elearn.mapper.TElUserBookMapper;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -20,6 +21,8 @@ import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.web.page.TableDataInfo;
 
+import javax.annotation.Resource;
+
 /**
  * 错题本Controller
  *
@@ -32,11 +35,11 @@ public class TElUserBookController extends BaseController
 {
     @Autowired
     private ITElUserBookService tElUserBookService;
-
+    @Resource
+    private TElUserBookMapper tElUserBookMapper;
     /**
      * 查询错题本列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userBook:list')")
     @GetMapping("/list")
     public TableDataInfo list(TElUserBook tElUserBook)
     {
@@ -48,7 +51,6 @@ public class TElUserBookController extends BaseController
     /**
      * 导出错题本列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userBook:export')")
     @Log(title = "错题本", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TElUserBook tElUserBook)
@@ -61,17 +63,44 @@ public class TElUserBookController extends BaseController
     /**
      * 获取错题本详细信息
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userBook:query')")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
         return AjaxResult.success(tElUserBookService.selectTElUserBookById(id));
     }
 
+    /**
+     * 下一题
+     */
+    @PostMapping(value = "/nextBookQu")
+    public AjaxResult nextQu(@RequestBody TElUserBook book)
+    {
+        book.setUserId(getUserId());
+
+        if (book.getQuId() == null) { //答题第一题
+
+        }
+        //继续答题
+        TElUserBook userbook =  tElUserBookMapper.selectTElUserBookByLast(book);
+
+        return AjaxResult.success(userbook.getQuId());
+    }
+
+    /**
+     * 移除错题集
+     */
+    @PostMapping(value = "/removBookQu")
+    public AjaxResult removBookQu(@RequestBody TElUserBook book)
+    {
+        book.setUserId(getUserId());
+        //移除错题集
+        return AjaxResult.success(tElUserBookMapper.deleteTElUserBookByQuId(book));
+    }
+
+
     /**
      * 新增错题本
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userBook:add')")
     @Log(title = "错题本", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TElUserBook tElUserBook)
@@ -82,7 +111,6 @@ public class TElUserBookController extends BaseController
     /**
      * 修改错题本
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userBook:edit')")
     @Log(title = "错题本", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody TElUserBook tElUserBook)
@@ -93,7 +121,6 @@ public class TElUserBookController extends BaseController
     /**
      * 删除错题本
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userBook:remove')")
     @Log(title = "错题本", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)

+ 0 - 7
master/src/main/java/com/ruoyi/project/training/elearn/controller/TElUserExamController.java

@@ -36,7 +36,6 @@ public class TElUserExamController extends BaseController
     /**
      * 查询我的成绩列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userExam:list')")
     @GetMapping("/myList")
     public TableDataInfo mylist(TElUserExam tElUserExam)
     {
@@ -49,7 +48,6 @@ public class TElUserExamController extends BaseController
     /**
      * 查询我的成绩列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userExam:list')")
     @GetMapping("/list")
     public TableDataInfo list(TElUserExam tElUserExam)
     {
@@ -61,7 +59,6 @@ public class TElUserExamController extends BaseController
     /**
      * 导出我的成绩列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userExam:export')")
     @Log(title = "我的成绩", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TElUserExam tElUserExam)
@@ -74,7 +71,6 @@ public class TElUserExamController extends BaseController
     /**
      * 获取我的成绩详细信息
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userExam:query')")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
@@ -84,7 +80,6 @@ public class TElUserExamController extends BaseController
     /**
      * 新增我的成绩
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userExam:add')")
     @Log(title = "我的成绩", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TElUserExam tElUserExam)
@@ -95,7 +90,6 @@ public class TElUserExamController extends BaseController
     /**
      * 修改我的成绩
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userExam:edit')")
     @Log(title = "我的成绩", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody TElUserExam tElUserExam)
@@ -106,7 +100,6 @@ public class TElUserExamController extends BaseController
     /**
      * 删除我的成绩
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userExam:remove')")
     @Log(title = "我的成绩", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)

+ 1 - 7
master/src/main/java/com/ruoyi/project/training/elearn/controller/TElUserQuController.java

@@ -54,7 +54,6 @@ public class TElUserQuController extends BaseController
     /**
      * 查询答题记录列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userQu:list')")
     @GetMapping("/list")
     public TableDataInfo list(TElUserQu tElUserQu)
     {
@@ -66,7 +65,6 @@ public class TElUserQuController extends BaseController
     /**
      * 导出答题记录列表
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userQu:export')")
     @Log(title = "答题记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TElUserQu tElUserQu)
@@ -79,7 +77,6 @@ public class TElUserQuController extends BaseController
     /**
      * 获取答题记录详细信息
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userQu:query')")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
@@ -87,7 +84,7 @@ public class TElUserQuController extends BaseController
     }
 
     /**
-     * 修改题库
+     * 下一题
      */
     @PostMapping(value = "/nextQu")
     public AjaxResult nextQu(@RequestBody TElUserQu tElUserQu)
@@ -115,7 +112,6 @@ public class TElUserQuController extends BaseController
     /**
      * 新增答题记录
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userQu:add')")
     @Log(title = "答题记录", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TElUserQu tElUserQu)
@@ -150,7 +146,6 @@ public class TElUserQuController extends BaseController
     /**
      * 修改答题记录
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userQu:edit')")
     @Log(title = "答题记录", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody TElUserQu tElUserQu)
@@ -161,7 +156,6 @@ public class TElUserQuController extends BaseController
     /**
      * 删除答题记录
      */
-    @PreAuthorize("@ss.hasPermi('elearn:userQu:remove')")
     @Log(title = "答题记录", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)

+ 8 - 9
master/src/main/java/com/ruoyi/project/training/elearn/mapper/TElExamMapper.java

@@ -6,15 +6,15 @@ import com.ruoyi.project.training.elearn.domain.TElExam;
 
 /**
  * 考试Mapper接口
- * 
+ *
  * @author ssy
  * @date 2024-05-29
  */
-public interface TElExamMapper 
+public interface TElExamMapper
 {
     /**
      * 查询考试
-     * 
+     *
      * @param examId 考试ID
      * @return 考试
      */
@@ -22,16 +22,15 @@ public interface TElExamMapper
 
     /**
      * 查询考试列表
-     * 
+     *
      * @param tElExam 考试
      * @return 考试集合
      */
-    @DataScope(deptAlias = "d")
     public List<TElExam> selectTElExamList(TElExam tElExam);
 
     /**
      * 新增考试
-     * 
+     *
      * @param tElExam 考试
      * @return 结果
      */
@@ -39,7 +38,7 @@ public interface TElExamMapper
 
     /**
      * 修改考试
-     * 
+     *
      * @param tElExam 考试
      * @return 结果
      */
@@ -47,7 +46,7 @@ public interface TElExamMapper
 
     /**
      * 删除考试
-     * 
+     *
      * @param examId 考试ID
      * @return 结果
      */
@@ -55,7 +54,7 @@ public interface TElExamMapper
 
     /**
      * 批量删除考试
-     * 
+     *
      * @param examIds 需要删除的数据ID
      * @return 结果
      */

+ 9 - 9
master/src/main/java/com/ruoyi/project/training/elearn/mapper/TElPaperMapper.java

@@ -6,15 +6,15 @@ import com.ruoyi.project.training.elearn.domain.TElPaper;
 
 /**
  * 在线考试Mapper接口
- * 
+ *
  * @author ssy
  * @date 2024-05-29
  */
-public interface TElPaperMapper 
+public interface TElPaperMapper
 {
     /**
      * 查询在线考试
-     * 
+     *
      * @param paperId 在线考试ID
      * @return 在线考试
      */
@@ -22,16 +22,16 @@ public interface TElPaperMapper
 
     /**
      * 查询在线考试列表
-     * 
+     *
      * @param tElPaper 在线考试
      * @return 在线考试集合
      */
-    @DataScope(deptAlias = "d")
+
     public List<TElPaper> selectTElPaperList(TElPaper tElPaper);
 
     /**
      * 新增在线考试
-     * 
+     *
      * @param tElPaper 在线考试
      * @return 结果
      */
@@ -39,7 +39,7 @@ public interface TElPaperMapper
 
     /**
      * 修改在线考试
-     * 
+     *
      * @param tElPaper 在线考试
      * @return 结果
      */
@@ -47,7 +47,7 @@ public interface TElPaperMapper
 
     /**
      * 删除在线考试
-     * 
+     *
      * @param paperId 在线考试ID
      * @return 结果
      */
@@ -55,7 +55,7 @@ public interface TElPaperMapper
 
     /**
      * 批量删除在线考试
-     * 
+     *
      * @param paperIds 需要删除的数据ID
      * @return 结果
      */

+ 1 - 1
master/src/main/java/com/ruoyi/project/training/elearn/mapper/TElQuRepoMapper.java

@@ -27,7 +27,7 @@ public interface TElQuRepoMapper
      * @param tElQuRepo 题目题库关联
      * @return 题目题库关联集合
      */
-    @DataScope(deptAlias = "d")
+
     public List<TElQuRepo> selectTElQuRepoList(TElQuRepo tElQuRepo);
 
     /**

+ 9 - 9
master/src/main/java/com/ruoyi/project/training/elearn/mapper/TElRepoMapper.java

@@ -6,15 +6,15 @@ import com.ruoyi.project.training.elearn.domain.TElRepo;
 
 /**
  * 题库Mapper接口
- * 
+ *
  * @author ssy
  * @date 2024-05-27
  */
-public interface TElRepoMapper 
+public interface TElRepoMapper
 {
     /**
      * 查询题库
-     * 
+     *
      * @param repoId 题库ID
      * @return 题库
      */
@@ -22,16 +22,16 @@ public interface TElRepoMapper
 
     /**
      * 查询题库列表
-     * 
+     *
      * @param tElRepo 题库
      * @return 题库集合
      */
-    @DataScope(deptAlias = "d")
+
     public List<TElRepo> selectTElRepoList(TElRepo tElRepo);
 
     /**
      * 新增题库
-     * 
+     *
      * @param tElRepo 题库
      * @return 结果
      */
@@ -39,7 +39,7 @@ public interface TElRepoMapper
 
     /**
      * 修改题库
-     * 
+     *
      * @param tElRepo 题库
      * @return 结果
      */
@@ -47,7 +47,7 @@ public interface TElRepoMapper
 
     /**
      * 删除题库
-     * 
+     *
      * @param repoId 题库ID
      * @return 结果
      */
@@ -55,7 +55,7 @@ public interface TElRepoMapper
 
     /**
      * 批量删除题库
-     * 
+     *
      * @param repoIds 需要删除的数据ID
      * @return 结果
      */

+ 4 - 0
master/src/main/java/com/ruoyi/project/training/elearn/mapper/TElUserBookMapper.java

@@ -59,4 +59,8 @@ public interface TElUserBookMapper
      * @return 结果
      */
     public int deleteTElUserBookByIds(Long[] ids);
+
+    TElUserBook selectTElUserBookByLast(TElUserBook book);
+
+    public int deleteTElUserBookByQuId(TElUserBook book);
 }

+ 41 - 34
master/src/main/java/com/ruoyi/project/training/elearn/service/impl/TElPaperServiceImpl.java

@@ -139,46 +139,53 @@ public class TElPaperServiceImpl implements ITElPaperService
         TElExamRepo tElExamRepo = new TElExamRepo();
         tElExamRepo.setExamId(tElPaper.getExamId());
         List<TElExamRepo> examRepoList = tElExamRepoMapper.selectTElExamRepoList(tElExamRepo);
-        for (TElExamRepo item: examRepoList
-             ) {
-            // 单选题
-            if(item.getRadioCount() > 0){
-                item.setQuType(1);
-                List<TElQu> radioListAll = tElQuMapper.selectTElQuListByRepo(item);
-                Collections.shuffle(radioListAll);
-                List<TElQu> radioList = radioListAll.subList(0,Integer.parseInt(String.valueOf(item.getRadioCount())) );
-                for (TElQu qu: radioList
-                     ) {
-                    TElPaperQu paperQu = this.processPaperQu(item,qu);
-                    paperQuList.add(paperQu);
+        try {
+            for (TElExamRepo item: examRepoList
+            ) {
+                // 单选题
+                if(item.getRadioCount() > 0){
+                    item.setQuType(1);
+                    List<TElQu> radioListAll = tElQuMapper.selectTElQuListByRepo(item);
+                    Collections.shuffle(radioListAll);
+                    List<TElQu> radioList = radioListAll.subList(0,Integer.parseInt(String.valueOf(item.getRadioCount())) );
+                    for (TElQu qu: radioList
+                    ) {
+                        TElPaperQu paperQu = this.processPaperQu(item,qu);
+                        paperQuList.add(paperQu);
+                    }
                 }
-            }
-            // 多选题
-            if(item.getMultiCount() > 0){
-                item.setQuType(2);
-                List<TElQu> multiListAll = tElQuMapper.selectTElQuListByRepo(item);
-                Collections.shuffle(multiListAll);
-                List<TElQu> multiList = multiListAll.subList(0,Integer.parseInt(String.valueOf(item.getMultiCount())) );
-                for (TElQu qu: multiList
-                ) {
-                    TElPaperQu paperQu = this.processPaperQu(item,qu);
-                    paperQuList.add(paperQu);
+                // 多选题
+                if(item.getMultiCount() > 0){
+                    item.setQuType(2);
+                    List<TElQu> multiListAll = tElQuMapper.selectTElQuListByRepo(item);
+                    Collections.shuffle(multiListAll);
+                    List<TElQu> multiList = multiListAll.subList(0,Integer.parseInt(String.valueOf(item.getMultiCount())) );
+                    for (TElQu qu: multiList
+                    ) {
+                        TElPaperQu paperQu = this.processPaperQu(item,qu);
+                        paperQuList.add(paperQu);
+                    }
                 }
-            }
-            // 判断题
-            if(item.getJudgeCount() > 0){
-                item.setQuType(3);
-                List<TElQu> judgeListAll = tElQuMapper.selectTElQuListByRepo(item);
-                Collections.shuffle(judgeListAll);
-                List<TElQu> judgeLis = judgeListAll.subList(0,Integer.parseInt(String.valueOf(item.getJudgeCount())) );
-                for (TElQu qu: judgeLis
-                ) {
-                    TElPaperQu paperQu = this.processPaperQu(item,qu);
-                    paperQuList.add(paperQu);
+                // 判断题
+                if(item.getJudgeCount() > 0){
+                    item.setQuType(3);
+                    List<TElQu> judgeListAll = tElQuMapper.selectTElQuListByRepo(item);
+                    Collections.shuffle(judgeListAll);
+                    List<TElQu> judgeLis = judgeListAll.subList(0,Integer.parseInt(String.valueOf(item.getJudgeCount())) );
+                    for (TElQu qu: judgeLis
+                    ) {
+                        TElPaperQu paperQu = this.processPaperQu(item,qu);
+                        paperQuList.add(paperQu);
+                    }
                 }
             }
+        }catch (IndexOutOfBoundsException e) {
+                throw new IndexOutOfBoundsException("题库无法匹配");
         }
 
+
+
+
         //保存试卷基本信息
         TElPaper paper = new TElPaper();
         paper.setExamId(exam.getExamId());

+ 9 - 2
master/src/main/resources/mybatis/training/elearn/TElQuMapper.xml

@@ -23,11 +23,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <sql id="selectTElQuVo">
         select d.qu_id, d.qu_type, d.qlevel, d.content, d.image, d.analysis, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks from t_el_qu d
+    </sql>
+
+    <sql id="selectTElQuVoRepo">
+        select d.qu_id, d.qu_type, d.qlevel, d.content, d.image, d.analysis, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks from t_el_qu d
         LEFT JOIN t_el_qu_repo po ON d.qu_id=po.qu_id
     </sql>
 
     <select id="selectTElQuList" parameterType="TElQu" resultMap="TElQuResult">
-        <include refid="selectTElQuVo"/>
+        select d.qu_id, d.qu_type, d.qlevel, d.content, d.image, d.analysis, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks from t_el_qu d
+        <if test="repoIds!=null and repoIds.size()>0">
+            LEFT JOIN t_el_qu_repo po ON d.qu_id=po.qu_id
+        </if>
         <where>
             <if test="repoIds!=null and repoIds.size()>0">
                 AND po.repo_id IN
@@ -57,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectTElQuById" parameterType="Long" resultMap="TElQuResult">
-        <include refid="selectTElQuVo"/>
+        select d.qu_id, d.qu_type, d.qlevel, d.content, d.image, d.analysis, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks from t_el_qu d
         where d.qu_id = #{quId}
     </select>
 

+ 1 - 1
master/src/main/resources/mybatis/training/elearn/TElRepoMapper.xml

@@ -35,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectTElRepoVo"/>
         <where>
             <if test="code != null  and code != ''"> and code = #{code}</if>
-            <if test="title != null  and title != ''"> and title = #{title}</if>
+            <if test="title != null  and title != ''"> and title like concat(concat('%', #{title}), '%')</if>
             <if test="createrCode != null  and createrCode != ''"> and creater_code = #{createrCode}</if>
             <if test="createdate != null "> and createdate = #{createdate}</if>
             <if test="updaterCode != null  and updaterCode != ''"> and updater_code = #{updaterCode}</if>

+ 16 - 0
master/src/main/resources/mybatis/training/elearn/TElUserBookMapper.xml

@@ -48,6 +48,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </select>
 
+    <select id="selectTElUserBookByLast" parameterType="TElUserBook" resultMap="TElUserBookResult">
+        select * from ( select d.id, d.user_id, d.exam_id, d.qu_id, d.wrong_count, d.title, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.sort  from t_el_user_book d
+        <where>
+            <if test="quId != null ">and #{quId} > qu_id</if>
+            <if test="userId != null "> and user_id = #{userId}</if>
+            and d.del_flag = 0
+        </where>
+        order by d.qu_id desc)
+        where rownum = 1
+    </select>
+
     <insert id="insertTElUserBook" parameterType="TElUserBook">
         <selectKey keyProperty="id" resultType="long" order="BEFORE">
             SELECT seq_t_el_user_book.NEXTVAL as id FROM DUAL
@@ -101,6 +112,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </update>
 
+
+    <update id="deleteTElUserBookByQuId" parameterType="TElUserBook">
+        update t_el_user_book set del_flag = 2 where qu_id = #{quId} and user_id = #{userId}
+    </update>
+
     <update id="deleteTElUserBookById" parameterType="Long">
         update t_el_user_book set del_flag = 2 where id = #{id}
     </update>

+ 20 - 0
ui/src/api/training/elearn/userBook.js

@@ -17,6 +17,26 @@ export function getUserBook(id) {
   })
 }
 
+// 题库练习
+export function nextBookQu(data) {
+  return request({
+    url: '/elearn/userBook/nextBookQu',
+    method: 'post',
+    data: data
+  })
+}
+
+// 题库练习
+export function removBookQu(data) {
+  return request({
+    url: '/elearn/userBook/removBookQu',
+    method: 'post',
+    data: data
+  })
+}
+
+
+
 // 新增错题本
 export function addUserBook(data) {
   return request({

+ 2 - 0
ui/src/api/training/elearn/userQu.js

@@ -18,6 +18,8 @@ export function nextQu(data) {
   })
 }
 
+
+
 // 查询答题记录详细
 export function getUserQu(id) {
   return request({

+ 1 - 0
ui/src/components/RepoSelect/index.vue

@@ -3,6 +3,7 @@
   <el-select
     v-model="currentValue"
     :multiple="multi"
+    :multiple-limit="1"
     :remote-method="fetchData"
     filterable
     remote

+ 7 - 0
ui/src/router/index.js

@@ -611,6 +611,13 @@ export const constantRoutes = [
         meta: { title: '考试结果', noCache: true },
         hidden: true
       },
+      {
+        path: 'userBook/training',
+        component: () => import('@/views/training/elearn/userBook/train'),
+        name: 'BookTraining',
+        meta: { title: '错题训练', noCache: true },
+        hidden: true
+      },
       {
         path: 'repo/training/:repoId',
         component: () => import('@/views/training/elearn/userQu/train'),

+ 0 - 5
ui/src/views/training/elearn/answer/index.vue

@@ -50,7 +50,6 @@
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
-          v-hasPermi="['elearn:answer:add']"
         >新增</el-button>
       </el-col>
       <el-col :span="1.5">
@@ -60,7 +59,6 @@
           size="mini"
           :disabled="single"
           @click="handleUpdate"
-          v-hasPermi="['elearn:answer:edit']"
         >修改</el-button>
       </el-col>
       <el-col :span="1.5">
@@ -70,7 +68,6 @@
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-          v-hasPermi="['elearn:answer:remove']"
         >删除</el-button>
       </el-col>
         <el-col :span="1.5">
@@ -79,7 +76,6 @@
                     icon="el-icon-upload2"
                     size="mini"
                     @click="handleImport"
-                    v-hasPermi="['elearn:answer:edit']"
             >导入</el-button>
         </el-col>
       <el-col :span="1.5">
@@ -88,7 +84,6 @@
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-          v-hasPermi="['elearn:answer:export']"
         >导出</el-button>
       </el-col>
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>

+ 5 - 2
ui/src/views/training/elearn/paper/exam.vue

@@ -57,7 +57,7 @@
         <el-card class="qu-content content-h">
           <p style="margin-bottom: 10px" v-if="quData.content">{{ quData.sort + 1 }}.{{ quData.content }}</p>
           <p v-if="quData.image!=null && quData.image!=''">
-            <el-image :src="quData.image" style="max-width:100%;" />
+            <el-image :src="getUrl(quData.image)" style="max-width:100%;" />
           </p>
           <div v-if="quData.quType === 1 || quData.quType===3">
             <el-radio-group v-model="radioValue">
@@ -74,7 +74,7 @@
             <el-checkbox-group v-model="multiValue">
               <el-checkbox v-for="item in quData.answerList" :key="item.id" :label="item.id">{{ item.abc }}.{{ item.content }}
                 <div v-if="item.image!=null && item.image!=''" style="clear: both">
-                  <el-image :src="item.image" style="max-width:100%;" />
+                  <el-image :src="getUrl(quData.image)" style="max-width:100%;" />
                 </div>
               </el-checkbox>
             </el-checkbox-group>
@@ -363,6 +363,9 @@ export default {
         // 当前选定
         this.fetchQuData(this.cardItem)
       })
+    },
+    getUrl(image){
+      return  process.env.VUE_APP_BASE_API + image;
     }
 
   }

+ 112 - 14
ui/src/views/training/elearn/qu/index.vue

@@ -146,7 +146,19 @@
           </el-form-item>
 
           <el-form-item label="试题图片">
-            <file-upload v-model="form.image" accept=".jpg,.jepg,.png" />
+            <el-upload
+              ref="photo"
+              :headers="photo.headers"
+              :action="photo.url"
+              :show-file-list="false"
+              :on-success="handleAvatarSuccess"
+              list-type="picture-card">
+              <img v-if="image" :src="image" class="avatar">
+              <i v-else class="el-icon-plus "></i>
+            </el-upload>
+            <el-dialog  :close-on-click-modal="false" v-dialogDrag :visible.sync="dialogVisible" append-to-body>
+              <img width="100%" :src="dialogImageUrl" alt="">
+            </el-dialog>
           </el-form-item>
 
           <el-form-item label="整题解析" prop="oriPrice">
@@ -178,21 +190,21 @@
 
             </el-table-column>
 
-            <el-table-column
-              v-if="itemImage"
-              label="选项图片"
-              width="120px"
-              align="center"
-            >
-              <template v-slot="scope">
+<!--            <el-table-column-->
+<!--              v-if="itemImage"-->
+<!--              label="选项图片"-->
+<!--              width="120px"-->
+<!--              align="center"-->
+<!--            >-->
+<!--              <template v-slot="scope">-->
 
-                <file-upload
-                  v-model="scope.row.image"
-                  accept=".jpg,.jepg,.png"
-                />
+<!--                <file-upload-->
+<!--                  v-model="scope.row.image"-->
+<!--                  accept=".jpg,.jepg,.png"-->
+<!--                />-->
 
-              </template>
-            </el-table-column>
+<!--              </template>-->
+<!--            </el-table-column>-->
 
             <el-table-column
               label="答案内容"
@@ -332,6 +344,17 @@ export default {
             // 上传的地址
             url: process.env.VUE_APP_BASE_API + "/elearn/qu/importData"
         },
+      photo: {
+        imageUrl: '',
+        fileList: [],
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/elearn/qu/uploadFile",
+      },
+      image: '',
+      dialogImageUrl: '',
+      dialogVisible: false,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -397,6 +420,7 @@ export default {
     },
     // 表单重置
     reset() {
+      this.image= null,
       this.form = {
         quId: null,
         quType: null,
@@ -425,6 +449,7 @@ export default {
     /** 重置按钮操作 */
     resetQuery() {
       this.resetForm("queryForm");
+      this.queryParams.repoIds = []
       this.handleQuery();
     },
     // 多选框选中数据
@@ -445,6 +470,9 @@ export default {
       const quId = row.quId || this.ids
       getQu(quId).then(response => {
         this.form = response.data;
+        if (response.data.image) {
+          this.image = process.env.VUE_APP_BASE_API + response.data.image;
+        }
         this.form.repoIds = this.form.repoIds.map(Number)
         this.open = true;
         this.title = "修改试题";
@@ -454,6 +482,7 @@ export default {
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
+
           if (this.form.quId != null) {
             updateQu(this.form).then(response => {
               this.msgSuccess("修改成功");
@@ -545,6 +574,75 @@ export default {
     removeItem(index) {
       this.form.answerList.splice(index, 1)
     },
+    handleAvatarProgress(event, file, fileList) {
+      this.photo.file = file;
+      this.image = file;
+    },
+    handleAvatarSuccess (res, file, fileList) {
+      this.image =  URL.createObjectURL(file.raw);
+      this.form.image = fileList.map((obj)=>{return obj.response.msg}).join(",");
+      this.$alert(res.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
+    },
+    handlePictureCardPreview(file) {
+      console.info("111" + file.url)
+      this.dialogImageUrl = file.url;
+      this.dialogVisible = true;
+    },
   }
 };
 </script>
+<style>
+.text {
+  font-size: 14px;
+}
+.item {
+  margin-bottom: 18px;
+}
+.clearfix {
+  color: #1e1e1e;
+}
+.clearfix:before,
+.clearfix:after {
+  display: table;
+  content: "";
+}
+.clearfix:after {
+  clear: both
+}
+
+.box-card {
+  width: 100%;
+}
+.el-drawer__body {
+  overflow: auto;
+}
+.el-drawer__container ::-webkit-scrollbar {
+  display: none;
+}
+
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409EFF;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 178px;
+  height: 178px;
+  line-height: 178px;
+  text-align: center;
+}
+.avatar {
+  width: 120px;
+  height: 140px;
+}
+.el-tag.el-tag--info {
+  color: #606266;
+}
+</style>

+ 3 - 7
ui/src/views/training/elearn/userBook/index.vue

@@ -21,14 +21,12 @@
       <el-col :span="1.5">
         <el-button
           type="primary"
-          icon="el-icon-plus"
+          icon="el-icon-edit"
           size="mini"
           @click="handleAdd"
-        >练习</el-button>
+        >错题练习</el-button>
       </el-col>
 
-
-
 	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -300,9 +298,7 @@ export default {
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加错题本";
+      this.$router.push({ name: 'BookTraining'})
     },
     /** 修改按钮操作 */
     handleUpdate(row) {

+ 209 - 0
ui/src/views/training/elearn/userBook/train.vue

@@ -0,0 +1,209 @@
+<template>
+  <div class="app-container">
+
+    <el-card style="margin-top: 20px">
+
+      <div class="qu-content">
+
+        <p>【{{ getQuType(quData.quType)  }}】{{ quData.content }}</p>
+        <p v-if="quData.image!=null && quData.image!=''">
+          <el-image :src="getUrl(quData.image)" style="max-width:100%;" />
+        </p>
+
+        <div v-if="quData.quType === 1 || quData.quType===3 ">
+          <el-radio-group v-model="answerValues[0]" readonly>
+            <el-radio v-for="an in quData.answerList" :key="an.answerId" :label="an.answerId" readonly>
+              {{ an.abc }}.{{ an.content }}
+              <div v-if="an.image!=null && an.image!=''" style="clear: both">
+                <el-image :src="an.image" style="max-width:100%;" />
+              </div>
+            </el-radio>
+          </el-radio-group>
+        </div>
+
+        <!-- 多选题 -->
+        <div v-if="quData.quType === 2">
+          <el-checkbox-group v-model="answerValues" readonly>
+            <el-checkbox v-for="an in quData.answerList" :key="an.answerId" :label="an.answerId">
+              {{ an.abc }}.{{ an.content }}
+              <div v-if="an.image!=null && an.image!=''" style="clear: both">
+                <el-image :src="an.image" style="max-width:100%;" />
+              </div>
+            </el-checkbox>
+          </el-checkbox-group>
+        </div>
+
+        <div v-if="analysisShow" style="margin-top: 20px; color: #1890ff; font-weight: bold">
+          正确答案:{{ rightTags.join(' ') }}
+        </div>
+
+      </div>
+
+    </el-card>
+
+    <el-card v-if="analysisShow" class="qu-analysis" style="margin-top: 20px">
+      整题解析:
+      <p>{{ quData.analysis }}</p>
+      <p v-if="!quData.analysis">暂无解析内容!</p>
+    </el-card>
+
+    <el-card v-if="analysisShow" class="qu-analysis" style="margin-top: 20px;">
+      选项解析:
+      <div v-for="an in quData.answerList" v-if="an.analysis" class="qu-analysis-line">
+        <p style="color: #555;">{{ an.content }}:</p>
+        <p style="color: #1890ff;">{{ an.analysis }}</p>
+      </div>
+      <p v-if="analysisCount === 0">暂无选项解析</p>
+
+    </el-card>
+
+    <div style="padding-top: 30px">
+      <el-button type="primary" @click="handNext">继续下一题</el-button>
+<!--      <el-button type="info" @click="onCancel">返回</el-button>-->
+    </div>
+
+  </div>
+</template>
+
+<script>
+import { getQu , } from '@/api/training/elearn/qu'
+import { nextBookQu, removBookQu} from '@/api/training/elearn/userBook'
+import { addUserQu } from '@/api/training/elearn/userQu'
+
+export default {
+  name: 'BookTrain',
+  data() {
+    return {
+      repoId: null,
+      examId: null,
+      quId: null,
+      tags: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'],
+      analysisShow: false,
+      quData: {
+
+      },
+      answerValues: [],
+      rightValues: [],
+      rightTags: []
+
+    }
+  },
+  created() {
+    this.repoId = this.$route.params.repoId
+
+    this.fetchNextQu()
+  },
+  methods: {
+    getQuType(data){
+      if (data == 1) {
+        return "单选题"
+      }else if (data == 2){
+        return "多选题"
+      }else if (data == 3){
+        return "判断题"
+      }
+    },
+    // 清理值
+    clearValues() {
+      this.answerValues = []
+      this.rightValues = []
+      this.analysisShow = false
+      this.rightTags = []
+    },
+
+    // 查找试卷详情
+    fetchQuDetail(id) {
+      // 当前赋值
+      this.quId = id
+      this.clearValues()
+
+      getQu(id).then(response => {
+        // 题目信息
+        this.quData = response.data
+
+        // 保存正确答案
+        this.quData.answerList.forEach((an, index) => {
+          an.abc = this.tags[index]
+
+          // 用户选定的
+          if (an.isRight) {
+            this.rightValues.push(an.answerId)
+            this.rightTags.push(an.abc)
+          }
+        })
+      })
+    },
+
+    fetchNextQu() {
+      // 查找下一个
+      nextBookQu({quId: this.quId}).then(response => {
+        this.fetchQuDetail(response.data)
+      })
+    },
+
+    onCancel() {
+      // this.$router.push({ name: 'ListTran' })
+      this.$router.push({ name: 'BookList' })
+    },
+    getUrl(image){
+      return  process.env.VUE_APP_BASE_API + image;
+    },
+    addUserQu(isRight){
+      addUserQu({quId: this.quId,isRight:isRight}).then(response => {
+      })
+    },
+    handNext() {
+      // 直接显示下一个
+      if (this.analysisShow) {
+        // 正确显示下一个
+        this.fetchNextQu()
+      } else {
+        // 直接判断正确性
+        if (this.rightValues.join(',') === this.answerValues.join(',')) {
+          this.$message({
+            message: '回答正确,你好棒哦!',
+            type: 'success'
+          })
+          // 添加正确历史记录
+          this.addUserQu(1)
+          removBookQu({quId: this.quId}).then(response => {
+
+          })
+          // 正确显示下一个
+          this.fetchNextQu()
+        } else {
+          // 错误显示解析
+          this.analysisShow = true
+          // 添加错误历史记录
+          this.addUserQu(0)
+          this.$message({
+            message: '很遗憾,做错了呢,请参考答案解析!',
+            type: 'error'
+          })
+
+        }
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+  .qu-content div{
+    line-height: 30px;
+  }
+
+  .qu-analysis p{
+    color: #555; font-size: 14px
+  }
+  .qu-analysis-line{
+    margin-top: 20px; border-bottom: #eee 1px solid
+  }
+
+  .el-checkbox-group label,.el-radio-group label{
+    width: 100%;
+  }
+
+</style>
+

+ 4 - 1
ui/src/views/training/elearn/userQu/train.vue

@@ -7,7 +7,7 @@
 
         <p>【{{ getQuType(quData.quType)  }}】{{ quData.content }}</p>
         <p v-if="quData.image!=null && quData.image!=''">
-          <el-image :src="quData.image" style="max-width:100%;" />
+          <el-image :src="getUrl(quData.image)" style="max-width:100%;" />
         </p>
 
         <div v-if="quData.quType === 1 || quData.quType===3 ">
@@ -144,6 +144,9 @@ export default {
       // this.$router.push({ name: 'ListTran' })
       this.$router.push({ name: 'BookList' })
     },
+    getUrl(image){
+      return  process.env.VUE_APP_BASE_API + image;
+    },
     addUserQu(isRight){
       //
       addUserQu({quId: this.quId,isRight:isRight}).then(response => {