123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <template>
- <view class="ezy-exam-page">
- <view class="ezy-navBar-box">
- <view @click="handleBack" class="nav-bar-icon"></view>
- <text class="nav-bar-title">单元测试</text>
- <view class="nav-bar-other"><text class="key-note">{{count}}</text>/<text>{{total}}</text></view>
- </view>
- <view class="shiti-frame-box">
- <w-swiper :list="list" :current="current" class="ezy-exam-swiper" @change="onSwiperChange">
- <template v-slot:default="{item}">
- <view class="body" v-if="item.mta_show">
- <danxuan :question="item" v-if="item.type == '1'"></danxuan>
- <panduan :question="item" v-if="item.type == '2'"></panduan>
- <tiankong :question="item" v-if="item.type == '3'" :placeholders="item.placeholders"></tiankong>
- </view>
- </template>
- </w-swiper>
- <view class="exam-submit-btn" v-if="current === list.length-1"
- @click="handleSubmit(uniPointsRef)"></view>
- </view>
- <!-- 左右滑动 -->
- <view class="tip-mask-box" @click="handleCloseTishi" v-if="showTishi">
- <view class="exam-tip-box">左右滑动查看更多题目</view>
- </view>
-
- <!-- 答卷 -->
- <chengji ref="chengjiRef" :list="list" @back="handleBack"></chengji>
- <!-- 分数弹窗 -->
- <uniPointsVue ref="uniPointsRef" @checkAnswer="checkAnswer" @goStudy="goStudyContinue" :isLastZhang="!!haveFlag"></uniPointsVue>
- </view>
- </template>
- <script setup>
- import wSwiper from '@/components/wSwiper/wSwiper.vue';
- import danxuan from "@/components/question/danxuan.vue";
- import panduan from "@/components/question/panduan.vue";
- import tiankong from "@/components/question/tiankong.vue";
- import chengji from "@/components/chengji/chengji.vue";
- import uniPointsVue from '@/components/points/uni-points.vue';
- import * as httpUnit from "@/api/unitTest.js"
- import {
- catchError,
- } from "@/utils/common.js"
- import {
- useExam
- } from './useUnit';
- import {
- ref,
- } from "vue";
- import cacheManager from "@/utils/cacheManager";
-
- const {
- count,
- total,
- current,
- list,
- rightAnswer,
- wrongAnswer,
- jifen,
- zhangId,
- jieId,
- nianji,
- xueke,
- showTishi,
- haveFlag,
- handleSubmit,
- initPage,
- handleCloseTishi
- } = useExam();
- const uniPointsRef = ref(null);
- const chengjiRef = ref(null);
- const popupRef = ref(null);
- // 查看答案
- function checkAnswer() {
- chengjiRef.value.showPopup();
- }
- // 继续学习
- async function goStudyContinue() {
- // 设置 从单元测试 到 岛 的路由参数
-
- const [err, data] = await catchError(httpUnit.getnextZhangInfo({
- nianji: nianji.value,
- cardId: xueke.value,
- zhangId: zhangId.value
- }))
- cacheManager.updateObject('auth', {
- zhangId: data.zhangId,
- })
- uni.redirectTo({
- url: `/pages/study/index`
- })
- }
-
-
-
- function handleBack() {
- // 数学
- uni.redirectTo({
- url: `/pages/study/index`
- })
- }
-
- function onSwiperChange(index) {
- current.value = index;
- }
-
- </script>
- <style lang="scss" scoped>
- .swiper-box {
- height: 200px;
- }
- .swiper-item {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- height: 200px;
- }
- </style>
|