Kaynağa Gözat

模拟考试接口修改

zhangyujun 2 yıl önce
ebeveyn
işleme
45c95c88de

+ 1 - 1
src/api/modules/exam.js

@@ -54,7 +54,7 @@ const exam={
 	//查询模拟考试题库
 	studentQuestionInfoSelectTestQuestionInfo(params){
 		return request({
-			url:"student/question/info/selectTestQuestionInfo",
+			url:"student/question/info/selectTestK14QuestionInfoList",
 			method:'get',
 			params
 		})

+ 3 - 2
src/api/modules/open.js

@@ -1,5 +1,6 @@
 import request from '../request'
 //金牌车教的open api
+const openApi = process.env.NODE_ENV === 'development' ? 'https://jpcj-admin1.zzxcx.net/stage-api' : 'https://jpcj-admin.zzxcx.net/prod-api'
 const open = {
     //open-api/teachingVideo/info/treeList
     //获取视频列表
@@ -10,9 +11,9 @@ const open = {
         })
 
     },
-    questionInfoSelectTestQuestionInfo(params) {
+    questionInfoSelectTestK14QuestionInfoList(params) {
         return request({
-            url: "/open-api/question/info/selectTestQuestionInfo",
+            url: `${openApi}/open-api/question/info/selectTestK14QuestionInfoList`,
             method: "GET",
             params
         })

+ 23 - 0
src/otherPages/exercise/components/checkbox.vue

@@ -0,0 +1,23 @@
+<template>
+  <view>
+    <slot v-if="useIconSlot" name="icon" />
+    <icon  v-else></icon>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {};
+  },
+  props: {
+    useIconSlot: {
+      type: Boolean,
+      default: false,
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 42 - 0
src/otherPages/exercise/components/m-checkbox-group.vue

@@ -0,0 +1,42 @@
+<template>
+  <view class="checkboxGroup">
+    <view @tap.native="changeCheckboxGroup">
+      <slot></slot>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {};
+  },
+  methods: {
+    changeCheckboxGroup(e) {
+      console.log(e);
+      e.detail = e.target.dataset.item;
+      this.$emit("update:value", e.target.dataset.value);
+      this.$emit("change", e);
+    },
+  },
+  props: {
+    useIconSlot: {
+      type: Boolean,
+      default: false,
+    },
+    name: {
+      type: String,
+      default: "",
+    },
+    value: {
+      type: String,
+      default: "",
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.checkboxGroup {
+}
+</style>

+ 62 - 0
src/otherPages/exercise/components/m-checkbox.vue

@@ -0,0 +1,62 @@
+<template>
+  <view @tap.native="clickCheckbox" :data-item="item" class="checkbox">
+    <view :data-item="item" class="custom-icon" v-if="useIconSlot">{{
+      name
+    }}</view>
+    <view :data-item="item" style="width: 8px"></view>
+    <text :data-item="item">{{ item.value }}</text>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {};
+  },
+  methods: {
+    stopClick(e) {
+      e.stopPropagation();
+    },
+    clickCheckbox(e) {
+      console.log(e);
+      this.$emit("clickcheckbox", e);
+      e.stopPropagation();
+    },
+  },
+  props: {
+    useIconSlot: {
+      type: Boolean,
+      default: false,
+    },
+    name: {
+      type: String,
+      default: "",
+    },
+    item: {
+      type: Object,
+      default: () => {
+        return {};
+      },
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.checkbox {
+  display: flex;
+  align-content: center;
+  align-items: center;
+  padding: 8px 0;
+}
+.custom-icon {
+  width: 75rpx;
+  height: 75rpx;
+  line-height: 75rpx;
+  border-radius: 50%;
+  text-align: center;
+  overflow: hidden;
+  background: #fff;
+  box-shadow: 0px 4rpx 12rpx rgba(0, 0, 0, 0.16);
+}
+</style>

+ 42 - 0
src/otherPages/exercise/components/m-radio-group.vue

@@ -0,0 +1,42 @@
+<template>
+  <view class="radioGroup">
+    <view @tap.native="changeRadioGroup">
+      <slot></slot>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {};
+  },
+  methods: {
+    changeRadioGroup(e) {
+      console.log(e);
+      e.detail = e.target.dataset.item;
+      this.$emit("update:value", e.target.dataset.value);
+      this.$emit("change", e);
+    },
+  },
+  props: {
+    useIconSlot: {
+      type: Boolean,
+      default: false,
+    },
+    name: {
+      type: String,
+      default: "",
+    },
+    value: {
+      type: String,
+      default: "",
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.radioGroup {
+}
+</style>

+ 62 - 0
src/otherPages/exercise/components/m-radio.vue

@@ -0,0 +1,62 @@
+<template>
+  <view @tap.native="clickRadio" :data-item="item" class="radio">
+    <view :data-item="item" class="custom-icon" v-if="useIconSlot">{{
+      name
+    }}</view>
+    <view :data-item="item" style="width: 8px"></view>
+    <text :data-item="item">{{ item.value }}</text>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {};
+  },
+  methods: {
+    stopClick(e) {
+      e.stopPropagation();
+    },
+    clickRadio(e) {
+      console.log(e);
+      this.$emit("clickRadio", e);
+      e.stopPropagation();
+    },
+  },
+  props: {
+    useIconSlot: {
+      type: Boolean,
+      default: false,
+    },
+    name: {
+      type: String,
+      default: "",
+    },
+    item: {
+      type: Object,
+      default: () => {
+        return {};
+      },
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.radio {
+  display: flex;
+  align-content: center;
+  align-items: center;
+  padding: 8px 0;
+}
+.custom-icon {
+  width: 75rpx;
+  height: 75rpx;
+  line-height: 75rpx;
+  border-radius: 50%;
+  text-align: center;
+  overflow: hidden;
+  background: #fff;
+  box-shadow: 0px 4rpx 12rpx rgba(0, 0, 0, 0.16);
+}
+</style>

+ 1 - 0
src/otherPages/exercise/components/tabbar.vue

@@ -36,6 +36,7 @@ export default {
     position: fixed;
     bottom: 0;
     font-size: 14px;
+    background: #fff;
 
 
 }

+ 156 - 6
src/otherPages/exercise/index.vue

@@ -22,6 +22,7 @@
         ></image>
       </view>
       <!-- 单选 -->
+      <!-- #ifdef MP-WEIXIN -->
       <view
         v-if="
           problemList[problemListIndex].questionType < 3 &&
@@ -89,7 +90,9 @@
           <text class="problem-opAnswer">{{ item.value }}</text>
         </view>
       </view>
+      <!-- #endif -->
       <!-- 多选 -->
+      <!-- #ifdef MP-WEIXIN -->
       <view
         v-if="
           problemList[problemListIndex].questionType == 3 &&
@@ -170,6 +173,144 @@
           <text class="problem-opAnswer">{{ item.value }}</text>
         </view>
       </view>
+      <!-- #endif -->
+
+      <!-- 单选 -->
+      <!-- #ifdef MP-TOUTIAO -->
+      <view
+        v-if="
+          problemList[problemListIndex].questionType < 3 &&
+          !problemList[problemListIndex].isCompleted
+        "
+        class="problem-ops"
+      >
+        <m-radio-group
+          @change="changeRadioGroup"
+          :value.sync="problemList[problemListIndex].userAnswer"
+        >
+          <m-radio
+            :value="item.value"
+            :item="item"
+            :useIconSlot="true"
+            :key="index"
+            :name="numberToLetter(index)"
+            v-for="(item, index) in problemList[problemListIndex].optsArr"
+          >
+          </m-radio>
+        </m-radio-group>
+      </view>
+      <view
+        v-if="
+          problemList[problemListIndex].questionType < 3 &&
+          problemList[problemListIndex].isCompleted
+        "
+      >
+        <view
+          v-for="(item, index) in problemList[problemListIndex].optsArr"
+          :key="index"
+          class="problem-select"
+        >
+          <icon
+            v-if="item.isAnswer && item.selected"
+            class="icon-box-img"
+            type="success"
+            color="#06c05f"
+            size="37"
+          ></icon>
+          <icon
+            v-if="!item.isAnswer && item.selected"
+            class="icon-box-img"
+            type="clear"
+            size="37"
+          ></icon>
+          <text v-if="!item.isAnswer && !item.selected" class="problem-op">{{
+            numberToLetter(index)
+          }}</text>
+          <text
+            v-if="item.isAnswer && !item.selected"
+            class="problem-op_green"
+            >{{ numberToLetter(index) }}</text
+          >
+          <text class="problem-opAnswer">{{ item.value }}</text>
+        </view>
+      </view>
+
+      <!-- #endif -->
+
+      <!-- 多选 -->
+      <!-- #ifdef MP-TOUTIAO -->
+      <view
+        v-if="
+          problemList[problemListIndex].questionType == 3 &&
+          !problemList[problemListIndex].isCompleted
+        "
+        class="problem-ops"
+      >
+        <van-checkbox-group
+          @change="changeCheckGroup"
+          :value="problemList[problemListIndex].userAnswer"
+          :max="4"
+        >
+          <m-checkbox
+            @change="changeCheckbox"
+            :item="item"
+            :value="item.value"
+            class="problem-checkbox"
+            use-icon-slot
+            v-for="(item, index) in problemList[problemListIndex].optsArr"
+            :key="index"
+            :name="numberToLetter(index)"
+          >
+     
+          </m-checkbox>
+        </van-checkbox-group>
+        <view class="flex-center">
+          <van-button
+            @click="confirmMult"
+            color="#498ef5"
+            round
+            custom-style="width:600rpx"
+            type="primary"
+            >确定</van-button
+          >
+        </view>
+      </view>
+      <view
+        v-if="
+          problemList[problemListIndex].questionType == 3 &&
+          problemList[problemListIndex].isCompleted
+        "
+      >
+        <view
+          v-for="(item, index) in problemList[problemListIndex].optsArr"
+          :key="index"
+          class="problem-select"
+        >
+          <icon
+            v-if="item.isAnswer && item.selected"
+            class="icon-box-img"
+            type="success"
+            size="75rpx"
+          ></icon>
+          <icon
+            v-if="!item.isAnswer && item.selected"
+            class="icon-box-img"
+            type="cancel"
+            size="75rpx"
+          ></icon>
+          <text v-if="!item.isAnswer && !item.selected" class="problem-op">{{
+            numberToLetter(index)
+          }}</text>
+          <text
+            v-if="item.isAnswer && !item.selected"
+            class="problem-op_green"
+            >{{ numberToLetter(index) }}</text
+          >
+          <text class="problem-opAnswer">{{ item.value }}</text>
+        </view>
+      </view>
+
+      <!-- #endif -->
       <view class="function-list">
         <div class="function-item">
           <van-icon name="star-o" size="25px" />
@@ -326,6 +467,10 @@ import api from "@/api/index";
 import utils from "@/utils/index";
 import explainJs from "./components/explainJs.vue";
 import tabbar from "./components/tabbar.vue";
+import mRadio from "./components/m-radio.vue";
+import mRadioGroup from "./components/m-radio-group.vue";
+import mCheckbox from "./components/m-radio.vue";
+import mCheckboxGroup from './components/m-checkbox-group.vue'
 export default {
   data() {
     return {
@@ -613,17 +758,18 @@ export default {
       this.$set(
         this.problemList[this.problemListIndex],
         "userAnswer",
-        e.value
+        e.detail.value
       );
-      e.selected = true;
+      e.detail.selected = true;
       this.$set(
         this.problemList[this.problemListIndex].optsArr,
-        e.index,
-        e
+        e.detail.index,
+        e.detail
       );
-      e.value === this.problemList[this.problemListIndex].answer
+      e.detail.value === this.problemList[this.problemListIndex].answer
         ? (this.trueNum = this.trueNum + 1)
         : (this.falseNum = this.falseNum + 1);
+
       //#endif
     },
     changeCheckbox(e) {
@@ -691,6 +837,10 @@ export default {
     navBar,
     explainJs,
     tabbar,
+    mRadio,
+    mRadioGroup,
+    mCheckbox,
+    mCheckboxGroup
   },
 };
 </script>
@@ -761,7 +911,7 @@ export default {
   }
   .problem-box {
     padding: 15rpx;
-    padding-bottom: 50rpx;
+    padding-bottom: 70rpx;
     background: #fff;
     /deep/ .van-checkbox {
       padding-bottom: 15rpx;

+ 3 - 3
src/otherPages/mockExam/index.vue

@@ -386,8 +386,8 @@ export default {
   onLoad(query) {
     let that = this;
     this.query = query;
-    api.exam
-      .studentQuestionInfoSelectTestQuestionInfo({
+    api.open
+      .questionInfoSelectTestK14QuestionInfoList({
         ...this.query,
       })
       .then((res) => {
@@ -413,7 +413,7 @@ export default {
       return `(${this.query.cert})/${subjectName}/${this.query.title}`;
     },
   },
-  destroyed() {
+  onUnload() {
     clearInterval(this.examTimer);
   },
 

+ 7 - 0
src/pages/carVideo/index.vue

@@ -174,6 +174,8 @@
         @click="
           () => {
             active = index;
+            tabQuery.name = item;
+            tabQuery.subject = index + 1;
           }
         "
         v-for="(item, index) in subjectMap"
@@ -297,6 +299,7 @@ export default {
       liceBus: "",
       liceMoto: "",
       name: "科目一",
+      gs: "xc",
       cert: "C1/C2/C3",
       vehicle: "轿车",
       subject: 1,
@@ -527,24 +530,28 @@ export default {
           this.tabQuery.liceTruck = "";
           this.tabQuery.liceBus = "";
           this.tabQuery.liceMoto = "";
+          this.tabQuery.gs = "xc";
           break;
         case "货车":
           this.tabQuery.liceCar = "";
           this.tabQuery.liceTruck = "";
           this.tabQuery.liceBus = 1;
           this.tabQuery.liceMoto = "";
+          this.tabQuery.gs = "hc";
           break;
         case "客车":
           this.tabQuery.liceCar = "";
           this.tabQuery.liceTruck = "";
           this.tabQuery.liceBus = 1;
           this.tabQuery.liceMoto = "";
+          this.tabQuery.gs = "kc";
           break;
         case "摩托车":
           this.tabQuery.liceCar = "";
           this.tabQuery.liceTruck = "";
           this.tabQuery.liceBus = "";
           this.tabQuery.liceMoto = 1;
+          this.tabQuery.gs = "mtc";
           break;
         default:
           break;

+ 2 - 1
src/pages/mockExam/test.vue

@@ -936,8 +936,9 @@ export default {
     this.carType = this.carTypeMap[option.type];
     this.vehicle = option.vehicle;
     api.open
-      .questionInfoSelectTestQuestionInfo({
+      .questionInfoSelectTestK14QuestionInfoList({
         subject: Number(option.subject),
+        gs:option.gs,
         liceBus: option.liceBus,
         liceCar: option.liceCar,
         liceTruck: option.liceTruck,