index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <!--模拟练习-->
  2. <template>
  3. <div class="app-container myExercise">
  4. <div class="check-max-box" v-if="pageType == 1">
  5. <div class="check-title-box">
  6. <p>请选择本次模拟练习的题目类型</p>
  7. <p>(可多选)</p>
  8. </div>
  9. <el-checkbox-group v-model="clickCheckList">
  10. <el-checkbox :label="item.id" v-for="(item,index) in checkList" :key="index">{{item.title}}</el-checkbox>
  11. </el-checkbox-group>
  12. <p class="center-text">模拟练习答题可获得奖励分,可使用奖励分兑换物品。</p>
  13. <p class="check-button-p" @click="clickExercise">开始练习</p>
  14. </div>
  15. <play-exercise v-if="pageType == 2" :transferData="transferData"></play-exercise>
  16. </div>
  17. </template>
  18. <script>
  19. import { examElClassifyQueryOption,examElPractiseStart } from "@/api/safetyEducationExam/index";
  20. import playExercise from "./playExercise.vue";
  21. export default {
  22. name: "index",
  23. components: {
  24. playExercise,
  25. },
  26. data() {
  27. return {
  28. pageType:1,
  29. clickCheckList:[],
  30. checkList:[],
  31. transferData:{},
  32. }
  33. },
  34. created() {
  35. this.getQueryOption();
  36. },
  37. mounted(){
  38. },
  39. methods:{
  40. goPage(type){
  41. if(this.pageType != type){
  42. if(type == 1){
  43. this.pageType = type;
  44. }else if(type == 2){
  45. this.pageType = type;
  46. }
  47. }
  48. },
  49. //点击开始练习
  50. clickExercise(){
  51. let self = this;
  52. if(!this.clickCheckList[0]){
  53. this.msgError('请先选择题目类型');
  54. return
  55. }
  56. let text = "";
  57. for(let i=0;i<self.clickCheckList.length;i++){
  58. text = text + self.clickCheckList[i] + ',';
  59. }
  60. examElPractiseStart({classifyIds:text}).then( res => {
  61. this.transferData = res.data;
  62. this.pageType = 2;
  63. });
  64. },
  65. //获取选项列表
  66. getQueryOption(){
  67. examElClassifyQueryOption({pageSize:-1}).then( res => {
  68. this.checkList = res.data.records;
  69. });
  70. },
  71. }
  72. }
  73. </script>
  74. <style scoped lang="scss">
  75. .myExercise {
  76. display: flex!important;
  77. flex-direction: column;
  78. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  79. overflow: hidden;
  80. *{
  81. margin:0;
  82. }
  83. .check-max-box{
  84. flex:1;
  85. display: flex!important;
  86. flex-direction: column;
  87. position: relative;
  88. .check-title-box{
  89. margin:60px auto 60px;
  90. display: flex;
  91. p{
  92. color:#333;
  93. font-size:18px;
  94. line-height:30px;
  95. }
  96. p:nth-child(2){
  97. color:#999;
  98. font-size:14px;
  99. margin-left:20px;
  100. font-weight:500;
  101. }
  102. }
  103. .el-checkbox-group{
  104. width: 400px;
  105. margin:0 auto;
  106. .el-checkbox{
  107. min-width:200px;
  108. margin-bottom:20px;
  109. }
  110. }
  111. .center-text{
  112. width:350px;
  113. position: absolute;
  114. bottom:30px;
  115. right:50%;
  116. margin-right:-175px;
  117. text-align: center;
  118. color:#999;
  119. font-size:14px;
  120. font-weight:500;
  121. }
  122. .check-button-p{
  123. position: absolute;
  124. bottom:20px;
  125. right:20px;
  126. width:160px;
  127. line-height:40px;
  128. text-align: center;
  129. border-radius:4px;
  130. color:#fff;
  131. background:#0045af;
  132. cursor:pointer;
  133. }
  134. }
  135. }
  136. </style>