mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-24 02:02:55 +08:00
refactor(course): 重构课程创建组件以支持文件选择和预览功能
- 将 AddVideo.vue 重命名为 chooseFileList.vue 并优化其内部逻辑 - 引入 watch API 并调整组件结构以提升响应性 - 更新事件发射器 saveContent 为 chooseItem 以匹配新流程 - 移除视频对话框相关代码并将其功能迁移至独立组件 - 在 createCourse.vue 中新增设置和预览弹窗逻辑 - 调整 dragTable.vue 的编辑和删除方法以传递完整的记录对象 - 统一使用响应式数据处理代替部分 refs 用法以简化状态管理 - 清理无关注释及调试语句提高代码可读性和维护性
This commit is contained in:
177
src/components/CreatedCourse/chooseFileList.vue
Normal file
177
src/components/CreatedCourse/chooseFileList.vue
Normal file
@@ -0,0 +1,177 @@
|
||||
<script setup>
|
||||
import { reactive, onMounted, ref, h, watch } from "vue";
|
||||
import {
|
||||
ElButton,
|
||||
ElInput,
|
||||
ElDialog,
|
||||
ElForm,
|
||||
ElFormItem,
|
||||
ElRadioGroup,
|
||||
ElRadio,
|
||||
ElInputNumber,
|
||||
} from "element-plus";
|
||||
import BasicTable from "@/components/BasicElTable/BasicTable.vue";
|
||||
import { getPageListByType } from "@/hooks/useCreateCourseMaps";
|
||||
|
||||
const props = defineProps({});
|
||||
|
||||
const tableData = ref([]);
|
||||
const form = reactive({
|
||||
name: "",
|
||||
resType: 10,
|
||||
});
|
||||
let pagination = reactive({
|
||||
pageSize: 10,
|
||||
current: 1,
|
||||
total: 0,
|
||||
});
|
||||
const dialogVideoForm = reactive({
|
||||
name: "",
|
||||
isDrag: false,
|
||||
completeSetup: 0,
|
||||
setupTage: "",
|
||||
});
|
||||
const loading = ref(false);
|
||||
const showDialog = ref(false);
|
||||
const emit = defineEmits(["chooseItem"]);
|
||||
const columns = [
|
||||
{
|
||||
title: "序号",
|
||||
render: (params) => {
|
||||
return h("span", {}, params.index + 1);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "名称",
|
||||
key: "name",
|
||||
dataIndex: "name",
|
||||
},
|
||||
{
|
||||
title: "创建人",
|
||||
key: "sysCreateBy",
|
||||
dataIndex: "sysCreateBy",
|
||||
},
|
||||
{
|
||||
title: "创建时间",
|
||||
key: "sysCreateTime",
|
||||
dataIndex: "sysCreateTime",
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
key: "action",
|
||||
dataIndex: "action",
|
||||
width: 150,
|
||||
render: (params) => {
|
||||
return h("div", [
|
||||
h(
|
||||
ElButton,
|
||||
{
|
||||
type: "primary",
|
||||
size: "small",
|
||||
onClick: () => {
|
||||
emit("chooseItem", {
|
||||
...params.row,
|
||||
isDrag: false,
|
||||
completeSetup: 0,
|
||||
setupTage: "",
|
||||
resType: 10,
|
||||
});
|
||||
},
|
||||
},
|
||||
"选择"
|
||||
),
|
||||
]);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const changePagination = (PAGINATION) => {
|
||||
pagination = PAGINATION;
|
||||
getVideoList();
|
||||
};
|
||||
const getVideoList = () => {
|
||||
loading.value = true;
|
||||
let paramsData = {
|
||||
...form,
|
||||
pageSize: pagination.pageSize,
|
||||
pageIndex: pagination.current,
|
||||
self: true,
|
||||
};
|
||||
getPageListByType(paramsData).then((res) => {
|
||||
loading.value = false;
|
||||
tableData.value = res.result.list;
|
||||
pagination.total = res.result.count;
|
||||
});
|
||||
};
|
||||
|
||||
const chooseItem = (type) => {
|
||||
showDialog.value = false;
|
||||
emit("chooseItem", {
|
||||
...dialogVideoForm,
|
||||
type: 10,
|
||||
});
|
||||
// postData.content=this.cware.content;
|
||||
// this.cwareChange.content = deepClone(this.cware.content)
|
||||
// if(this.cware.content.contentType==52){
|
||||
// if(this.cware.linkInfo.url==''){
|
||||
// this.$message.error("请填写外连URL地址");
|
||||
// return;
|
||||
// }
|
||||
// postData.content.content=JSON.stringify(this.cware.linkInfo);
|
||||
// this.cwareChange.linkInfo = deepClone(this.cware.linkInfo)
|
||||
// }else if(this.cware.content.contentType==10 || this.cware.content.contentType==20){
|
||||
// if(this.cware.curriculumData.url==''){
|
||||
// this.$message.error("请选择课件");
|
||||
// return;
|
||||
// }
|
||||
// postData.content.content=JSON.stringify(this.cware.curriculumData);
|
||||
// this.cwareChange.curriculumData = deepClone(this.cware.curriculumData)
|
||||
// }
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getVideoList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="add-video" v-if="!isPreview && !isSetting">
|
||||
<div class="add-vide-header">
|
||||
<div>
|
||||
<el-button>上传新视频</el-button>
|
||||
<span class="desc ml10">文件大小限制:1G,支持的文件类型:mp4 </span>
|
||||
</div>
|
||||
<div>
|
||||
<el-input
|
||||
style="width: 150px"
|
||||
placeholder="请输入视频名称"
|
||||
v-model="form.name"
|
||||
clearable
|
||||
></el-input>
|
||||
<el-button class="ml10" @click="getVideoList">查询</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt10">
|
||||
<BasicTable
|
||||
:columns="columns"
|
||||
:data="tableData"
|
||||
:pagination="pagination"
|
||||
@changePage="changePagination"
|
||||
:loading="loading"
|
||||
></BasicTable>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.add-video {
|
||||
.add-vide-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.desc {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user