video-history.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <view class="flex-1 min-h-1 bg-white relative">
  3. <view class="absolute inset-0">
  4. <video-history-student v-if="isStudent" />
  5. <teacher-class-view v-else>
  6. <template #default="{ teachClass }">
  7. <view class="w-fit mx-auto">
  8. <ie-tab :options="tabList" v-model="currentSort" />
  9. </view>
  10. <video-history-teacher :teach-class="teachClass" :current-sort="currentSort" />
  11. </template>
  12. </teacher-class-view>
  13. </view>
  14. </view>
  15. </template>
  16. <script lang="ts" setup>
  17. import videoHistoryStudent from './video-history-student.vue';
  18. import videoHistoryTeacher from './video-history-teacher.vue';
  19. import teacherClassView from '@/pagesStudy/components/teacher-class-view.vue';
  20. import { OPEN_VIDEO_DETAIL } from '@/types/injectionSymbols';
  21. import { useTransferPage } from '@/hooks/useTransferPage';
  22. import { useUserStore } from '@/store/userStore';
  23. const { transferTo } = useTransferPage();
  24. const { isStudent } = storeToRefs(useUserStore());
  25. const currentSort = ref('asc');
  26. const tabList = ref([
  27. {
  28. label: '升序',
  29. value: 'asc'
  30. },
  31. {
  32. label: '降序',
  33. value: 'desc'
  34. }
  35. ])
  36. const openVideoDetail = (recordId: number, name: string) => {
  37. transferTo('/pagesStudy/pages/study-video-detail/study-video-detail', {
  38. data: {
  39. recordId,
  40. name
  41. }
  42. });
  43. }
  44. provide(OPEN_VIDEO_DETAIL, openVideoDetail);
  45. </script>
  46. <style lang="scss" scoped></style>