|
|
@@ -107,7 +107,7 @@
|
|
|
import Vue, { PropType } from 'vue'
|
|
|
import { ExamSerializer, ExamStateText, LocalDateTime } from '@/api/types'
|
|
|
import { computeExamStateText, timeLength } from '@/utils/common'
|
|
|
-import { joinExamByInviteCode } from '@/api/exam'
|
|
|
+import { joinExamByInviteCode, joinPublicExam } from '@/api/exam'
|
|
|
|
|
|
export default Vue.extend({
|
|
|
name: 'StudentExamInfoCard',
|
|
|
@@ -157,7 +157,16 @@ export default Vue.extend({
|
|
|
|
|
|
onJoinExam() {
|
|
|
if (this.examInfo.isPublic) {
|
|
|
- //TODO
|
|
|
+ const examId = this.examInfo.examId ?? 0
|
|
|
+ joinPublicExam(examId).then(({ data }) => {
|
|
|
+ const joinSuccess = data.result
|
|
|
+ if (joinSuccess) {
|
|
|
+ this.joinSuccess = true
|
|
|
+ this.$emit('joinExam')
|
|
|
+ } else {
|
|
|
+ this.joinFailed = true
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
this.inputInviteCode = true
|
|
|
}
|