lsc 2 months ago
parent
commit
d8c3e81927
2 changed files with 10 additions and 4 deletions
  1. 6 3
      src/views/Student/components/answerTheResult.vue
  2. 4 1
      src/views/Student/index.vue

+ 6 - 3
src/views/Student/components/answerTheResult.vue

@@ -1,7 +1,7 @@
 <template>
 	<div class="answerTheResult">
 		<div class="atr_detail">
-			<div class="atr_d_btn" @click="lookDetail()">查看详情</div>
+			<div class="atr_d_btn" @click="lookDetail()">{{isShowDialog ? '查看题目' : '查看结果'}}</div>
 			<div class="atr_d_msg">
 				<div>参与人数</div>
 				<span
@@ -140,7 +140,7 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, computed, watch } from 'vue'
+import { ref, computed, watch, inject, type Ref } from 'vue'
 import previewImageTool from '../../components/tool/previewImageTool.vue'
 import api from '../../../services/course'
 interface Props {
@@ -164,7 +164,10 @@ const emit = defineEmits<{
   (e: 'openWorkModal', v:any):void
 }>()
 
-
+const choiceQuestionDetailDialogOpenList = inject<Ref<number[]>>('choiceQuestionDetailDialogOpenList', ref<number[]>([]))
+const isShowDialog = computed(() => {
+  return choiceQuestionDetailDialogOpenList.value.includes(props.slideIndex)
+})
 
 
 // 已提交的作业数量

+ 4 - 1
src/views/Student/index.vue

@@ -355,7 +355,7 @@
 </template>
 
 <script lang="ts" setup>
-import { computed, ref, onMounted, onUnmounted, nextTick, inject, watch } from 'vue'
+import { computed, ref, onMounted, onUnmounted, nextTick, inject, watch, provide } from 'vue'
 import { storeToRefs } from 'pinia'
 import { useSlidesStore } from '@/store'
 import { ElementTypes } from '@/types/slides'
@@ -510,6 +510,9 @@ const visibleChoice = ref(false)
 const visibleAI = ref(false)
 const choiceQuestionDetailDialogOpenList = ref<number[]>([])
 
+// 提供给子组件使用
+provide('choiceQuestionDetailDialogOpenList', choiceQuestionDetailDialogOpenList)
+
 // 当前作业选择/问答题的ID
 const workId = ref<string>('')
 // 当前作业的type