<script setup lang="ts">
import ConfigViewTemplate from '../../ConfigViewTemplate.vue'
import { useConnection } from '../../../composables/useAllData'

const role = inject('role') as string

defineProps<{ node: any }>()

const operateList = [{ label: '关注中', value: '0' }]

const { connectionList } = useConnection()

const getConnectionLabel = function (id: string) {
  return connectionList.value.find(item => item.id === id)?.name || ''
}
</script>

<template>
  <ConfigViewTemplate :node="node">
    <el-form-item :label="role === 'student' ? '我的答案' : '学生答案'">
      {{ operateList.find(item => item.value === node.data.student?.operate)?.label || '' }}
      {{ getConnectionLabel(node.data.student?.connection_id) }}
    </el-form-item>
    <el-form-item label="正确答案">
      {{ operateList.find(item => item.value === node.data.teacher?.operate)?.label || '' }}
      {{ getConnectionLabel(node.data.teacher?.connection_id) }}
    </el-form-item>
  </ConfigViewTemplate>
</template>
