course-action-bar.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import {toast} from "../../utils/utils";
  2. import {
  3. checkStatus,
  4. courseProcess,
  5. courseStatus,
  6. courseTypes,
  7. liveSources,
  8. liveStatus,
  9. logicStatus,
  10. verifyTypes
  11. } from "../../model/enum";
  12. import Route from "../../model/route";
  13. Component({
  14. properties: {
  15. item: {
  16. type: Object,
  17. value: {}
  18. },
  19. obj: {
  20. type: Object,
  21. value: {}
  22. },
  23. showBottom: {
  24. type: Boolean,
  25. value: false
  26. },
  27. type: Number,
  28. isPre: Number,
  29. },
  30. data: {
  31. logicStatusEnum: logicStatus,
  32. },
  33. methods: {
  34. async check(e) {
  35. let item = this.data.item;
  36. let obj = this.data.obj;
  37. let signStatus = item.signStatus;
  38. if (signStatus == checkStatus.DEFAULT) {
  39. Route.toChekIn(verifyTypes.CHECK_IN, "签到", item.courseName || item.ceremonyName, item.id, obj.teamId, obj.eduStuId, {
  40. check: () => {
  41. this.triggerEvent("refresh")
  42. }
  43. })
  44. }
  45. },
  46. question(e) {
  47. let item = this.data.item;
  48. let obj = this.data.obj;
  49. let qid = "";
  50. if (obj.isOnline) {
  51. qid = item.suitangUpper;
  52. } else {
  53. qid = item.suitangLower;
  54. }
  55. if (!qid) {
  56. toast("没有配置问卷")
  57. return;
  58. }
  59. if (!item.questionDone) {
  60. if (item.courseStatus == courseStatus.NO_START) {
  61. toast("课程还未开始")
  62. return;
  63. }
  64. if (item.courseType == courseTypes.RECORD && item.courseProcess == courseProcess.NO_BEGIGN) {
  65. toast("学完视频后才可以答卷")
  66. return;
  67. }
  68. Route.toQuestionDetail(qid, obj.teamId, item.courseId, item.id, obj.eduStuId, {
  69. answer: () => {
  70. this.triggerEvent("refresh")
  71. }
  72. });
  73. } else {
  74. // toast("已完成问卷")
  75. Route.toQuestionResult(qid, obj.eduStuId, item.courseId);
  76. }
  77. },
  78. exam(e) {
  79. let item = this.data.item;
  80. let obj = this.data.obj;
  81. if (!item.examDone) {
  82. if (item.courseStatus == courseStatus.NO_START) {
  83. toast("课程还未开始")
  84. return;
  85. }
  86. if (item.courseType == courseTypes.RECORD && item.courseProcess == courseProcess.NO_BEGIGN) {
  87. toast("学完视频后才可以答卷")
  88. return;
  89. }
  90. Route.toExamDetail(item.paperId, item.examId, obj.eduStuId, {
  91. answer: () => {
  92. this.triggerEvent("refresh")
  93. }
  94. })
  95. } else {
  96. // toast("已完成试卷")
  97. // 已完成试卷 跳转到问卷详情页
  98. Route.toExamResult(item.examId, obj.eduStuId);
  99. }
  100. },
  101. live(e) {
  102. // let item = this.data.item;
  103. // if (item.liveStatus == liveStatus.LIVING) {
  104. // Route.toLive(liveSources.DEFAULT, this.data.item.courseName || this.data.item.ceremonyName,
  105. // this.data.item.id, this.data.obj.eduStuId, this.data.obj.eduStuName,this.data.item.courseThumbnailUrl);
  106. // } else {
  107. // this.triggerEvent("refresh")
  108. // }
  109. this.triggerEvent('toLive');
  110. }
  111. }
  112. });