fuliqi
2024-07-10 afdb091a3e4994250d8228fd1238658b45a4e35e
教学资源增加分类
5个文件已修改
55 ■■■■■ 已修改文件
components.d.ts 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/modules/file.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/modules/subject.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Header/index.vue 补丁 | 查看 | 原始文档 | blame | 历史
src/views/folder/index.vue 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
components.d.ts
@@ -19,10 +19,12 @@
    ElIcon: typeof import('element-plus/es')['ElIcon']
    ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
    ElInput: typeof import('element-plus/es')['ElInput']
    ElOption: typeof import('element-plus/es')['ElOption']
    ElPagination: typeof import('element-plus/es')['ElPagination']
    ElProgress: typeof import('element-plus/es')['ElProgress']
    ElRow: typeof import('element-plus/es')['ElRow']
    ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
    ElSelect: typeof import('element-plus/es')['ElSelect']
    ElSlider: typeof import('element-plus/es')['ElSlider']
    ElTable: typeof import('element-plus/es')['ElTable']
    ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
src/api/modules/file.js
@@ -1,5 +1,5 @@
import service from "@/api";
export const getFileList = () => {
  return service.get('/api/student/education/resource/page');
export const getFileList = (getData = {introduction: '', subjectId: '', contentType: ''}) => {
  return service.get('/api/student/education/resource/page', {params: getData});
};
src/api/modules/subject.js
@@ -0,0 +1,6 @@
import service from "@/api";
export const getSubjectList = () => {
    return service.post('/api/student/subject/list');
};
src/layout/components/Header/index.vue
src/views/folder/index.vue
@@ -9,7 +9,18 @@
            <div class="card-wrapper w-full h-full flex flex-col px-8 box-border">
              <div class="card-header flex justify-between items-center shrink-0">
                <div class="header-search flex items-center">
                  <el-input v-model="searchText" placeholder="请输入搜索内容" :prefix-icon="Search" maxlength="20" />
                  <el-input v-model="searchText" placeholder="请输入搜索内容" class="long-input" :prefix-icon="Search"/>
                  <el-select v-model="searchSubject" placeholder="请选择科目" class="ml-4 long-select" clearable>
                    <el-option v-for="item in subjectList" :key="item.id" :label="item.name" :value="item.id"/>
                  </el-select>
                  <el-select v-model="searchContentType" placeholder="请选择文件类型" class="ml-4 long-select" clearable>
                    <el-option
                        v-for="item in contentTypeList"
                        :key="item.value"
                        :label="item.name"
                        :value="item.value">
                    </el-option>
                  </el-select>
                  <el-button type="primary" class="ml-4" @click="searchFile">搜索</el-button>
                </div>
              </div>
@@ -97,6 +108,7 @@
import NormalHeader from '@/components/NormalHeader/index.vue';
import { Search } from '@element-plus/icons-vue';
import { getFileList } from '@/api/modules/file.js';
import {getSubjectList} from '@/api/modules/subject.js';
import PDFViewer from '@/components/PDFViewer/index.vue';
import VideoViewer from '@/components/VideoViewer/index.vue';
@@ -144,6 +156,8 @@
  },
};
const searchText = ref('');
const searchSubject = ref('')
const searchContentType = ref('')
const loading = ref(false);
@@ -156,7 +170,14 @@
const videoUrl = ref('');
const fileList = ref([]);
const subjectList = ref([]);
const contentTypeList = ref([{ name: '视频', value: 'video' },
  { name: '图片', value: 'img' },
  { name: '音频', value: 'audio' },
  { name: 'PDF', value: 'pdf' },
  { name: 'EXCEL', value: 'excel' },
  { name: 'WORD', value: 'word' },
  { name: 'PPT', value: 'ppt' }]);
const currentIndex = ref(1);
@@ -173,7 +194,7 @@
const getData = () => {
  loading.value = true;
  getFileList().then(res => {
  getFileList({introduction: searchText.value, subjectId: searchSubject.value, contentType:searchContentType.value}).then(res => {
    loading.value = false;
    fileList.value = res.data;
  }).catch(() => {
@@ -182,6 +203,16 @@
};
getData();
const getSubject = () => {
  loading.value = true;
  getSubjectList().then(res => {
    loading.value = false;
    subjectList.value = res.data;
  }).catch(() => {
    loading.value = false;
  });
};
getSubject();
const resendMessage = () => {
  if (time.value) {
    clearInterval(time.value);
@@ -232,7 +263,13 @@
    margin-right: 20px;
  }
}
.long-input {
  width: 200px;
}
.long-select {
  width: 200px;
}
.pdf-container {
  width: 100%;
  height: 100%;