useStartClass.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import { getCourseScheduleDetail_gyt } from "@/api/curriculum.api"
  2. import { getRecentCourseSchedule_gym } from "@/api/homePage.api"
  3. import { httpAjaxErrMsg } from "@/plugin/httpAjax"
  4. import useDialogConfirm from "@/hooks/useDialogConfirm"
  5. import { format } from "@/libs/tools"
  6. /* 管乐迷 开始上课 */
  7. export function handleStartClass_gym(id: string) {
  8. httpAjaxErrMsg(getRecentCourseSchedule_gym, id).then(res => {
  9. if (res.code === 200) {
  10. const { signInStatusEnum, isCallNames, coursewareDetailId, startClassTime, endClassTime } = res.data
  11. if (signInStatusEnum === 3) {
  12. useDialogConfirm({
  13. headImg: require("@/img/curriculum/ts2.png"),
  14. text: `您当前${format(startClassTime, "hh:ii")}-${format(endClassTime, "hh:ii")}的课程暂未签到,为避免考勤异常,请到APP进行签到。`,
  15. btnShow: [true]
  16. })
  17. return
  18. }
  19. if (!isCallNames) {
  20. useDialogConfirm({
  21. headImg: require("@/img/curriculum/ts1.png"),
  22. text: `您当前${format(startClassTime, "hh:ii")}-${format(endClassTime, "hh:ii")}的课程暂未点名,请到APP进行点名。`,
  23. btnShow: [true]
  24. })
  25. return
  26. }
  27. if (!coursewareDetailId) {
  28. useDialogConfirm({
  29. headImg: require("@/img/curriculum/ts3.png"),
  30. text: `该课程未配置课件,请配置课件。`,
  31. btnShow: [true]
  32. })
  33. return
  34. }
  35. alert("开始上课")
  36. }
  37. })
  38. }
  39. // 管乐迷是否为线上课
  40. export function isONLINE_gym(teachMode: string) {
  41. if (teachMode === "ONLINE") {
  42. useDialogConfirm({
  43. headImg: require("@/img/curriculum/ts4.png"),
  44. text: `线上课请在管乐迷老师端完成教学。`,
  45. btnShow: [true]
  46. })
  47. return true
  48. }
  49. return false
  50. }
  51. /* 管乐团 开始上课 */
  52. export function handleStartClass_gyt(id: string) {
  53. httpAjaxErrMsg(getCourseScheduleDetail_gyt, id).then(res => {
  54. if (res.code === 200) {
  55. const { signIn, rollCall, lessonCoursewareId, startTime, endTime } = res.data
  56. if (!signIn) {
  57. useDialogConfirm({
  58. headImg: require("@/img/curriculum/ts2.png"),
  59. text: `您当前${format(startTime, "hh:ii")}-${format(endTime, "hh:ii")}的课程暂未签到,为避免考勤异常,请到APP进行签到。`,
  60. btnShow: [true]
  61. })
  62. return
  63. }
  64. if (!rollCall) {
  65. useDialogConfirm({
  66. headImg: require("@/img/curriculum/ts1.png"),
  67. text: `您当前${format(startTime, "hh:ii")}-${format(endTime, "hh:ii")}的课程暂未点名,请到APP进行点名。`,
  68. btnShow: [true]
  69. })
  70. return
  71. }
  72. if (!lessonCoursewareId) {
  73. useDialogConfirm({
  74. headImg: require("@/img/curriculum/ts3.png"),
  75. text: `该课程未配置课件,请配置课件。`,
  76. btnShow: [true]
  77. })
  78. return
  79. }
  80. alert("开始上课")
  81. }
  82. })
  83. }