123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <template>
- <custom-scroll-list :refreshFn="getExamList" :tabList="tabData" :defaultTab="1" ref="scrollRef">
- <template #default="{list}">
- <scroll-list-card v-for="(item,index) in list" :key="item.ksId" :data="item"
- @btnClick="handleClick"></scroll-list-card>
- </template>
- </custom-scroll-list>
- <!-- 考试须知 -->
- <kaoshixuzhi ref="ksxzRef" @confirm="handleConfirm"></kaoshixuzhi>
- </template>
- <script setup>
- import {
- getExamList,
- kaoShiApply,
- getClientKaoshiInfo
- } from "@/api/exam.js";
- import {
- onReady,
- } from "@dcloudio/uni-app"
- import {
- reactive,
- ref
- } from "vue";
- import kaoshixuzhi from "@/components/kaoshixuzhi/kaoshixuzhi.vue"
- const activeKs = ref(null);
- const scrollRef = ref(null);
- const examNoticeInfo = ref(null);
- const ksxzRef = ref(null);
- const tabData = [{
- label: "可以考试",
- value: 1,
- },
- {
- label: "已结束",
- value: 4,
- }
- ]
- function goKaoshiPage(data) {
- uni.redirectTo({
- url: `/pages/exam/exam?ksId=${data.ksId}&zhuapai=${data.zhuapai}`
- })
- }
-
- function handleConfirm() {
- goKaoshiPage(activeKs.value)
- }
- function showKaoshiXuzhi() {
- const option = {
- ksId: activeKs.value.ksId
- }
- getClientKaoshiInfo(option).then(res => {
- examNoticeInfo.value = res.data;
- // 校验抓拍
- doCheckZhuapai()
- })
- }
- function doCheckZhuapai() {
- if (examNoticeInfo.value.zhuapai) {
- // 存在抓拍
- } else {
- // 不存在抓拍
- ksxzRef.value.showDialog(examNoticeInfo.value)
- }
- }
- function handleClick(data) {
- activeKs.value = data;
- if (data.status == 0) {
- // 未开始
- // goKaoshiPage(data);
- showKaoshiXuzhi()
- }
- if (data.status == 1) {
- // 可以考试
- // goKaoshiPage(data);
- showKaoshiXuzhi()
- }
- if (data.status == 2) {
- // 再次考试
- // goKaoshiPage(data);
- showKaoshiXuzhi()
- }
- if (data.status == 3) {
- // 考试中
- // goKaoshiPage(data);
- showKaoshiXuzhi()
- }
- if (data.status == 4) {
- // 已结束
- uni.showToast({
- title: '考试已结束',
- icon: 'none'
- })
- }
- if (data.status == 5) {
- // 未报名
- kaoShiApply({
- ksId: data.ksId
- }).then(res => {
- uni.showToast({
- title: '报名成功',
- icon: 'none'
- })
- scrollRef.value.onRefresh()
- })
- }
- }
- </script>
- <style lang="scss">
- </style>
|