examCamera.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <view>
  3. <zhuapaiConfirm ref="zhuapaiConfirmRef" @success="zpConfirmSuccess" @error="zpConfirmError"
  4. @cancel="zpConfirmCancel" key="1"></zhuapaiConfirm>
  5. </view>
  6. </template>
  7. <script setup>
  8. import {
  9. onLoad,
  10. onShow,
  11. onHide
  12. } from "@dcloudio/uni-app";
  13. import {
  14. ref,nextTick
  15. } from "vue";
  16. import zhuapaiConfirm from "@/components/zhuapaiConfirm/index.vue";
  17. const opt = ref(null);
  18. const zhuapaiConfirmRef = ref(null);
  19. onLoad((options) => {
  20. opt.value = options;
  21. zhuapaiConfirmRef.value.showDialog()
  22. })
  23. function zpConfirmSuccess() {
  24. uni.redirectTo({
  25. url: `/pages/client/Kaoshi/exam?ksId=${opt.value.ksId}&zhuapai=${opt.value.zhuapai}&userKaozhengId=${opt.value.userKaozhengId}&from=${opt.value.from}`
  26. })
  27. }
  28. function zpConfirmError(e) {
  29. uni.showToast({
  30. icon: 'none',
  31. title: '考试环境异常请检测摄像头是否正常',
  32. duration: 3000,
  33. mask: true // 防止触摸穿透
  34. })
  35. setTimeout(() => {
  36. handleBack();
  37. }, 3000)
  38. }
  39. function zpConfirmCancel() {
  40. handleBack();
  41. }
  42. function handleBack() {
  43. const pages = getCurrentPages();
  44. if (pages.length > 1) {
  45. uni.navigateBack()
  46. } else {
  47. history.back();
  48. }
  49. }
  50. </script>
  51. <style>
  52. </style>