form.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <xn-form-container
  3. :width="620"
  4. :get-container="false"
  5. :visible="visible"
  6. :destroy-on-close="true"
  7. @close="onClose"
  8. :mask="false"
  9. >
  10. <div v-if="itemObj.key == 2" style="height: 100%">
  11. <handouts :itemObj="itemObj" :hourId="idsObj.hourId"></handouts>
  12. </div>
  13. <note v-if="itemObj.type == 2" :idsObj="idsObj" ref="noteRef" @videoSpeed="videoSpeed" @videoStopTime="videoStopTime"></note>
  14. <div v-if="itemObj.key == 3" style="height: 100%">
  15. <subtitleBox :url="itemObj.url" @videoSpeed="videoSpeed"></subtitleBox>
  16. </div>
  17. <askDiv v-if="itemObj.type == 4" :idsObj="idsObj" ref="noteRef" @videoSpeed="videoSpeed" @videoStopTime="videoStopTime"></askDiv>
  18. </xn-form-container>
  19. </template>
  20. <script setup>
  21. import classCentre from '@/api/student/classCentre'
  22. import note from './note.vue'
  23. import askDiv from './ask.vue'
  24. import handouts from './handouts.vue'
  25. import subtitleBox from './subtitle.vue'
  26. const props = defineProps({
  27. rightItem: {
  28. type: [Array, Object],
  29. required: () => {}
  30. },
  31. idsObj: {
  32. type: [Array, Object],
  33. required: () => {}
  34. }
  35. })
  36. const itemObj = computed(() => {
  37. return props.rightItem
  38. })
  39. const noteRef = ref()
  40. //tabs
  41. const activeKey = ref('1')
  42. // 默认是关闭状态
  43. const visible = ref(false)
  44. const emit = defineEmits({ videoSpeed: null ,videoStopTime:null})
  45. // 打开抽屉
  46. const onOpen = (edit) => {
  47. visible.value = true
  48. if (edit) {
  49. if (itemObj.value.type == 2) {
  50. formData.value.noteId = edit.noteId
  51. formData.value.noteContent = edit.noteContent
  52. } else {
  53. formData.value.info = edit.info
  54. formData.value.id = edit.id
  55. }
  56. }
  57. }
  58. // 关闭抽屉
  59. const onClose = () => {
  60. visible.value = false
  61. }
  62. const videoSpeed = (e) => {
  63. emit('videoSpeed', e)
  64. }
  65. const videoStopTime = (e) => {
  66. emit('videoStopTime', e)
  67. }
  68. const showPdf = ref(true)
  69. function errorHandler() {
  70. showPdf.value = false
  71. }
  72. // 调用这个函数将子组件的一些数据和方法暴露出去
  73. defineExpose({
  74. onOpen,
  75. onClose
  76. })
  77. </script>
  78. <style scoped lang="less"></style>