Skip to content

Commit

Permalink
feat: auto paper submission function
Browse files Browse the repository at this point in the history
  • Loading branch information
webyang-male committed Nov 19, 2022
1 parent 7d44f25 commit f1b26cb
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 101 deletions.
40 changes: 20 additions & 20 deletions .nuxt/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ declare module 'vue' {
'PlayerAudio': typeof import("../components/Player/Audio.vue")['default'],
'PlayerLive': typeof import("../components/Player/Live.vue")['default'],
'PlayerVideo': typeof import("../components/Player/Video.vue")['default'],
'UserBuyList': typeof import("../components/User/BuyList.vue")['default'],
'UserCouponList': typeof import("../components/User/CouponList.vue")['default'],
'UserFavaList': typeof import("../components/User/FavaList.vue")['default'],
'UserHistoryList': typeof import("../components/User/HistoryList.vue")['default'],
'UserTestList': typeof import("../components/User/TestList.vue")['default'],
'UiImage': typeof import("../components/Ui/Image.vue")['default'],
'UiMenu': typeof import("../components/Ui/Menu.vue")['default'],
'UiMenuItem': typeof import("../components/Ui/MenuItem.vue")['default'],
'UiTab': typeof import("../components/Ui/Tab.vue")['default'],
'UiTabItem': typeof import("../components/Ui/TabItem.vue")['default'],
'UserBuyList': typeof import("../components/User/BuyList.vue")['default'],
'UserCouponList': typeof import("../components/User/CouponList.vue")['default'],
'UserFavaList': typeof import("../components/User/FavaList.vue")['default'],
'UserHistoryList': typeof import("../components/User/HistoryList.vue")['default'],
'UserTestList': typeof import("../components/User/TestList.vue")['default'],
'UiCardBody': typeof import("../components/Ui/Card/Body.vue")['default'],
'UiCardFooter': typeof import("../components/Ui/Card/Footer.vue")['default'],
'UiCardHeader': typeof import("../components/Ui/Card/Header.vue")['default'],
Expand Down Expand Up @@ -94,16 +94,16 @@ declare module 'vue' {
'LazyPlayerAudio': typeof import("../components/Player/Audio.vue")['default'],
'LazyPlayerLive': typeof import("../components/Player/Live.vue")['default'],
'LazyPlayerVideo': typeof import("../components/Player/Video.vue")['default'],
'LazyUserBuyList': typeof import("../components/User/BuyList.vue")['default'],
'LazyUserCouponList': typeof import("../components/User/CouponList.vue")['default'],
'LazyUserFavaList': typeof import("../components/User/FavaList.vue")['default'],
'LazyUserHistoryList': typeof import("../components/User/HistoryList.vue")['default'],
'LazyUserTestList': typeof import("../components/User/TestList.vue")['default'],
'LazyUiImage': typeof import("../components/Ui/Image.vue")['default'],
'LazyUiMenu': typeof import("../components/Ui/Menu.vue")['default'],
'LazyUiMenuItem': typeof import("../components/Ui/MenuItem.vue")['default'],
'LazyUiTab': typeof import("../components/Ui/Tab.vue")['default'],
'LazyUiTabItem': typeof import("../components/Ui/TabItem.vue")['default'],
'LazyUserBuyList': typeof import("../components/User/BuyList.vue")['default'],
'LazyUserCouponList': typeof import("../components/User/CouponList.vue")['default'],
'LazyUserFavaList': typeof import("../components/User/FavaList.vue")['default'],
'LazyUserHistoryList': typeof import("../components/User/HistoryList.vue")['default'],
'LazyUserTestList': typeof import("../components/User/TestList.vue")['default'],
'LazyUiCardBody': typeof import("../components/Ui/Card/Body.vue")['default'],
'LazyUiCardFooter': typeof import("../components/Ui/Card/Footer.vue")['default'],
'LazyUiCardHeader': typeof import("../components/Ui/Card/Header.vue")['default'],
Expand Down Expand Up @@ -153,16 +153,16 @@ export const LoadingSkeleton: typeof import("../components/Loading/Skeleton.vue"
export const PlayerAudio: typeof import("../components/Player/Audio.vue")['default']
export const PlayerLive: typeof import("../components/Player/Live.vue")['default']
export const PlayerVideo: typeof import("../components/Player/Video.vue")['default']
export const UserBuyList: typeof import("../components/User/BuyList.vue")['default']
export const UserCouponList: typeof import("../components/User/CouponList.vue")['default']
export const UserFavaList: typeof import("../components/User/FavaList.vue")['default']
export const UserHistoryList: typeof import("../components/User/HistoryList.vue")['default']
export const UserTestList: typeof import("../components/User/TestList.vue")['default']
export const UiImage: typeof import("../components/Ui/Image.vue")['default']
export const UiMenu: typeof import("../components/Ui/Menu.vue")['default']
export const UiMenuItem: typeof import("../components/Ui/MenuItem.vue")['default']
export const UiTab: typeof import("../components/Ui/Tab.vue")['default']
export const UiTabItem: typeof import("../components/Ui/TabItem.vue")['default']
export const UserBuyList: typeof import("../components/User/BuyList.vue")['default']
export const UserCouponList: typeof import("../components/User/CouponList.vue")['default']
export const UserFavaList: typeof import("../components/User/FavaList.vue")['default']
export const UserHistoryList: typeof import("../components/User/HistoryList.vue")['default']
export const UserTestList: typeof import("../components/User/TestList.vue")['default']
export const UiCardBody: typeof import("../components/Ui/Card/Body.vue")['default']
export const UiCardFooter: typeof import("../components/Ui/Card/Footer.vue")['default']
export const UiCardHeader: typeof import("../components/Ui/Card/Header.vue")['default']
Expand Down Expand Up @@ -210,16 +210,16 @@ export const LazyLoadingSkeleton: typeof import("../components/Loading/Skeleton.
export const LazyPlayerAudio: typeof import("../components/Player/Audio.vue")['default']
export const LazyPlayerLive: typeof import("../components/Player/Live.vue")['default']
export const LazyPlayerVideo: typeof import("../components/Player/Video.vue")['default']
export const LazyUserBuyList: typeof import("../components/User/BuyList.vue")['default']
export const LazyUserCouponList: typeof import("../components/User/CouponList.vue")['default']
export const LazyUserFavaList: typeof import("../components/User/FavaList.vue")['default']
export const LazyUserHistoryList: typeof import("../components/User/HistoryList.vue")['default']
export const LazyUserTestList: typeof import("../components/User/TestList.vue")['default']
export const LazyUiImage: typeof import("../components/Ui/Image.vue")['default']
export const LazyUiMenu: typeof import("../components/Ui/Menu.vue")['default']
export const LazyUiMenuItem: typeof import("../components/Ui/MenuItem.vue")['default']
export const LazyUiTab: typeof import("../components/Ui/Tab.vue")['default']
export const LazyUiTabItem: typeof import("../components/Ui/TabItem.vue")['default']
export const LazyUserBuyList: typeof import("../components/User/BuyList.vue")['default']
export const LazyUserCouponList: typeof import("../components/User/CouponList.vue")['default']
export const LazyUserFavaList: typeof import("../components/User/FavaList.vue")['default']
export const LazyUserHistoryList: typeof import("../components/User/HistoryList.vue")['default']
export const LazyUserTestList: typeof import("../components/User/TestList.vue")['default']
export const LazyUiCardBody: typeof import("../components/Ui/Card/Body.vue")['default']
export const LazyUiCardFooter: typeof import("../components/Ui/Card/Footer.vue")['default']
export const LazyUiCardHeader: typeof import("../components/Ui/Card/Header.vue")['default']
Expand Down
14 changes: 7 additions & 7 deletions .nuxt/imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ export { useHead, useMeta } from '#head';
export { isVue2, isVue3 } from 'vue-demi';
export { useAsyncData, useLazyAsyncData, refreshNuxtData, defineNuxtComponent, useNuxtApp, defineNuxtPlugin, useRuntimeConfig, useState, useFetch, useLazyFetch, useCookie, useRequestHeaders, useRequestEvent, useRouter, useRoute, useActiveRoute, defineNuxtRouteMiddleware, navigateTo, abortNavigation, addRouteMiddleware, throwError, clearError, useError, defineNuxtLink } from '#app';
export { withCtx, withDirectives, withKeys, withMemo, withModifiers, withScopeId, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onServerPrefetch, onUnmounted, onUpdated, computed, customRef, isProxy, isReactive, isReadonly, isRef, markRaw, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, watch, watchEffect, isShallow, effect, effectScope, getCurrentScope, onScopeDispose, defineComponent, defineAsyncComponent, resolveComponent, getCurrentInstance, h, inject, nextTick, provide, useAttrs, useCssModule, useCssVars, useSlots, useTransitionState } from 'vue';
export { usePostSupportApi, useDeletePostApi } from 'E:/WebProject/nuxt3-edu/apis/bbs';
export { fetchConfig, useHttp, useHttpGet, useHttpPost } from 'E:/WebProject/nuxt3-edu/composables/useHttp';
export { useUser, useRefreshUserInfo, useLogout, useHasAuth, useHandleSupportPost } from 'E:/WebProject/nuxt3-edu/composables/useAuth';
export { usePage } from 'E:/WebProject/nuxt3-edu/composables/usePage';
export { fetchConfig, useHttp, useHttpGet, useHttpPost } from 'E:/WebProject/nuxt3-edu/composables/useHttp';
export { useQueryToString, useEnterEvent, useTimeStatus } from 'E:/WebProject/nuxt3-edu/composables/useUtil';
export { useSearchListApi, useCouponListApi, useListApi, useReadDetailApi } from 'E:/WebProject/nuxt3-edu/apis/common';
export { usecourseListApi, useReadCourseApi, useHotCourseListApi, useLearnApi } from 'E:/WebProject/nuxt3-edu/apis/course';
export { usePage } from 'E:/WebProject/nuxt3-edu/composables/usePage';
export { usePostSupportApi, useDeletePostApi } from 'E:/WebProject/nuxt3-edu/apis/bbs';
export { useBookMenusApi, useBookDetailApi } from 'E:/WebProject/nuxt3-edu/apis/book';
export { useSubmitTestApi, useReadTestPaperApi } from 'E:/WebProject/nuxt3-edu/apis/test';
export { useGetGoodsInfoApi, useGetUseableUserCouponApi, useCreateOrderApi, useWxpayApi, useGetWxpayStatusApi, useGetGroupWorkListApi } from 'E:/WebProject/nuxt3-edu/apis/order';
export { useSearchListApi, useCouponListApi, useListApi, useReadDetailApi } from 'E:/WebProject/nuxt3-edu/apis/common';
export { useIndexDataApi, useGroupDataApi } from 'E:/WebProject/nuxt3-edu/apis/index';
export { useGetGoodsInfoApi, useGetUseableUserCouponApi, useCreateOrderApi, useWxpayApi, useGetWxpayStatusApi, useGetGroupWorkListApi } from 'E:/WebProject/nuxt3-edu/apis/order';
export { usecourseListApi, useReadCourseApi, useHotCourseListApi, useLearnApi } from 'E:/WebProject/nuxt3-edu/apis/course';
export { useSubmitTestApi, useReadTestpaperApi } from 'E:/WebProject/nuxt3-edu/apis/test';
export { useLoginApi, useGetinfoApi, useRegApi, useLogoutApi, useGetCaptchaApi, useBindPhoneApi, useForgetApi, useUserHistoryApi, useOrderListApi, useUserTestApi, useMypostListApi, useUserCouponApi, useMyFavaListApi, useUncollectApi, useUpdateUserInfoApi, useUploadConfig, useUpdatePasswordApi, useCollectApi, useReceiveUserCouponApi } from 'E:/WebProject/nuxt3-edu/apis/user';
export { definePageMeta } from 'E:/WebProject/nuxt3-edu/node_modules/nuxt/dist/pages/runtime/composables';
export { useLink } from 'vue-router';
4 changes: 2 additions & 2 deletions .nuxt/types/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ declare global {
const useQueryToString: typeof import('../../composables/useUtil')['useQueryToString']
const useReadCourseApi: typeof import('../../apis/course')['useReadCourseApi']
const useReadDetailApi: typeof import('../../apis/common')['useReadDetailApi']
const useReadTestPaperApi: typeof import('../../apis/test')['useReadTestPaperApi']
const useReadTestpaperApi: typeof import('../../apis/test')['useReadTestpaperApi']
const useReceiveUserCouponApi: typeof import('../../apis/user')['useReceiveUserCouponApi']
const useRefreshUserInfo: typeof import('../../composables/useAuth')['useRefreshUserInfo']
const useRegApi: typeof import('../../apis/user')['useRegApi']
Expand Down Expand Up @@ -255,7 +255,7 @@ declare module '@vue/runtime-core' {
readonly useQueryToString: UnwrapRef<typeof import('../../composables/useUtil')['useQueryToString']>
readonly useReadCourseApi: UnwrapRef<typeof import('../../apis/course')['useReadCourseApi']>
readonly useReadDetailApi: UnwrapRef<typeof import('../../apis/common')['useReadDetailApi']>
readonly useReadTestPaperApi: UnwrapRef<typeof import('../../apis/test')['useReadTestPaperApi']>
readonly useReadTestpaperApi: UnwrapRef<typeof import('../../apis/test')['useReadTestpaperApi']>
readonly useReceiveUserCouponApi: UnwrapRef<typeof import('../../apis/user')['useReceiveUserCouponApi']>
readonly useRefreshUserInfo: UnwrapRef<typeof import('../../composables/useAuth')['useRefreshUserInfo']>
readonly useRegApi: UnwrapRef<typeof import('../../apis/user')['useRegApi']>
Expand Down
19 changes: 10 additions & 9 deletions apis/test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//交卷 /pc/user_test/save
export function useSubmitTestApi(body) {
return useHttpPost("SubmitTest", "user_test/save", {
body,
});

// 交卷
export function useSubmitTestApi(body){
return useHttpPost("SubmitTest","/user_test/save",{
body
})
}

//开始考试 /pc/testpaper/read?id=12
export function useReadTestPaperApi(id) {
return useHttpPost("ReadTestPaper", "/testpaper/read?id="+id);
}
// 开始考试
export function useReadTestpaperApi(id){
return useHttpGet("ReadTestpaper","/testpaper/read?id="+id)
}
3 changes: 2 additions & 1 deletion components/PaperTestItems.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- 考试题目列组件 -->
<!-- 考试题目组件 -->
<!-- 注意:体验考试请自行注册新账号 -->
<template>
<div class="test-item">
<div class="title">
Expand Down
3 changes: 2 additions & 1 deletion components/TestPaperList.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- 考试列表组件 -->
<!-- 注意:体验考试请自行注册新账号 -->
<template>
<section class="bg-white shadow p-5 mb-5 rounded">
<div class="flex justify-between">
Expand All @@ -9,7 +10,7 @@
题目总数:{{ item.question_count }} 总分数:{{ item.total_score }} 及格分:{{ item.pass_score }}
</p>
<div class="flex justify-end">
<n-button type="primary" @click="test()">进入考试</n-button>
<n-button type="primary" @click="test()" :disabled="item.isTest">{{ item.isTest ? '考试结束' : '进入考试' }}</n-button>
</div>
</section>
</template>
Expand Down
5 changes: 3 additions & 2 deletions pages/paper/[page].vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<!-- 考试页面 -->
<!-- 注意:体验考试请自行注册新账号 -->
<template>
<n-grid :x-gap="20">
<n-grid-item :span="18">
<LoadingGroup :pending="pending" :error="error" :isEmpty="rows.length === 0">
<!-- 考试列表组件 -->
<TestPaperList v-for="(item,index) in rows" :key="index" :item="item"/>
<TestPaperList v-for="(item, index) in rows" :key="index" :item="item" />
<!-- 分页组件 -->
<div class="flex justify-center items-center mt-5 mb-10">
<n-pagination size="large" :item-count="total" :page="page" :page-size="limit"
Expand All @@ -20,7 +21,7 @@
</template>

<script setup>
import { NButton, NGrid, NGridItem, NPagination } from "naive-ui";
import { NGrid, NGridItem, NPagination } from "naive-ui";

const route = useRoute()
// console.log(route.params.page)
Expand Down
Loading

0 comments on commit f1b26cb

Please sign in to comment.