duhang 2024-01-10 10:05:36 +08:00
commit 43298dfa07
4 changed files with 71 additions and 14 deletions

View File

@ -13,7 +13,14 @@ defineOptions({
const props = defineProps({ const props = defineProps({
source: { source: {
type: [String, Array], type: [String, Array],
required: true, default: "",
},
vid: {
type: String,
default: "",
},
playAuth: {
type: String,
default: "", default: "",
}, },
cover: { cover: {
@ -32,9 +39,9 @@ const props = defineProps({
const visibility = useDocumentVisibility(); const visibility = useDocumentVisibility();
onMounted(() => { onMounted(() => {
watch( watch(
() => props.source, [() => props.source, () => props.vid, () => props.playAuth],
() => { () => {
if (props.source) fnCreateAliPlayer(); if (props.source || (props.vid && props.playAuth)) fnCreateAliPlayer();
}, },
{ {
immediate: true, immediate: true,
@ -61,6 +68,8 @@ const fnCreateAliPlayer = async () => {
{ {
id: "J_prismPlayer", id: "J_prismPlayer",
source: props.source, source: props.source,
vid: props.vid,
playauth: props.playAuth,
cover: props.cover, cover: props.cover,
width: props.width, width: props.width,
height: props.height, height: props.height,

View File

@ -1,6 +1,11 @@
<template> <template>
<el-dialog title="视频" v-model="visible"> <el-dialog title="视频" v-model="visible">
<ali-player :source="fnSrc(src)" ref="playerRef" /> <ali-player
:source="fnSrc(src)"
:vid="vid"
:play-auth="playAuth"
ref="playerRef"
/>
</el-dialog> </el-dialog>
</template> </template>
@ -16,12 +21,20 @@ defineOptions({
const props = defineProps({ const props = defineProps({
src: { src: {
type: String, type: String,
required: true, default: "",
},
vid: {
type: String,
default: "",
},
playAuth: {
type: String,
default: "",
}, },
visible: { visible: {
type: Boolean, type: Boolean,
default: false,
required: true, required: true,
default: false,
}, },
}); });
const emits = defineEmits(["update:visible"]); const emits = defineEmits(["update:visible"]);

View File

@ -93,8 +93,15 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" width="200"> <el-table-column label="操作" width="200">
<template v-slot="{ row }"> <template v-slot="{ row }">
<el-button type="primary" text link>课件文件</el-button> <el-button
<!-- todo 查看课件 --> type="primary"
text
link
v-if="interceptTheSuffix(row.COURSEWAREFILES, '.pdf')"
@click="fnPreviewPdf(row.COURSEWAREFILES)"
>
预览
</el-button>
<el-button <el-button
type="primary" type="primary"
text text
@ -124,6 +131,14 @@
</el-table-column> </el-table-column>
</layout-table> </layout-table>
</layout-card> </layout-card>
<layout-pdf
:src="data.pdfDialog.src"
v-model:visible="data.pdfDialog.visible"
/>
<layout-txt
:src="data.txtDialog.src"
v-model:visible="data.txtDialog.visible"
/>
</div> </div>
</template> </template>
@ -136,12 +151,14 @@ import {
} from "@/request/platform_resource_library.js"; } from "@/request/platform_resource_library.js";
import useListData from "@/assets/js/useListData.js"; import useListData from "@/assets/js/useListData.js";
import { reactive } from "vue"; import { reactive } from "vue";
import { serialNumber } from "@/assets/js/utils.js"; import { interceptTheSuffix, serialNumber } from "@/assets/js/utils.js";
import LayoutTable from "@/components/table/index.vue"; import LayoutTable from "@/components/table/index.vue";
// import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js"; // import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js";
import { debounce } from "throttle-debounce"; import { debounce } from "throttle-debounce";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import LayoutPdf from "@/components/pdf/index.vue";
import LayoutTxt from "@/components/txt/index.vue";
const router = useRouter(); const router = useRouter();
const { list, pagination, searchForm, fnGetData, fnResetPagination } = const { list, pagination, searchForm, fnGetData, fnResetPagination } =
@ -152,6 +169,14 @@ const data = reactive({
{ value: "0", label: "启用" }, { value: "0", label: "启用" },
{ value: "1", label: "禁用" }, { value: "1", label: "禁用" },
], ],
pdfDialog: {
src: "",
visible: false,
},
txtDialog: {
src: "",
visible: false,
},
}); });
// const buttonJurisdiction = await useButtonJurisdiction("courseware"); // const buttonJurisdiction = await useButtonJurisdiction("courseware");
@ -162,6 +187,11 @@ const fnAdd = debounce(1000, async (DATACOURSEWARE_ID) => {
ElMessage.success("添加成功"); ElMessage.success("添加成功");
fnResetPagination(); fnResetPagination();
}); });
const fnPreviewPdf = (FILEPATH) => {
data.pdfDialog.visible = true;
data.pdfDialog.src = FILEPATH;
};
</script> </script>
<style scoped lang="scss"></style> <style scoped lang="scss"></style>

View File

@ -104,8 +104,9 @@
<el-table-column prop="NUMEXAMPLE" label="习题数" /> <el-table-column prop="NUMEXAMPLE" label="习题数" />
<el-table-column label="操作" width="200"> <el-table-column label="操作" width="200">
<template v-slot="{ row }"> <template v-slot="{ row }">
<el-button type="primary" text link>课件文件</el-button> <el-button type="primary" text link @click="fnOpenVideo(row)">
<!-- todo 查看课件 --> 预览
</el-button>
<el-button <el-button
type="primary" type="primary"
text text
@ -150,7 +151,6 @@ import { reactive } from "vue";
import { serialNumber } from "@/assets/js/utils.js"; import { serialNumber } from "@/assets/js/utils.js";
import LayoutTable from "@/components/table/index.vue"; import LayoutTable from "@/components/table/index.vue";
import { debounce } from "throttle-debounce"; import { debounce } from "throttle-debounce";
// import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
@ -163,16 +163,21 @@ const data = reactive({
{ value: "0", label: "启用" }, { value: "0", label: "启用" },
{ value: "1", label: "禁用" }, { value: "1", label: "禁用" },
], ],
videoVisible: false,
videoSource: "",
}); });
// const buttonJurisdiction = await useButtonJurisdiction("courseware");
const fnAdd = debounce(1000, async (VIDEOCOURSEWARE_ID) => { const fnAdd = debounce(1000, async (VIDEOCOURSEWARE_ID) => {
await ElMessageBox.confirm("确定要添加吗?", { type: "warning" }); await ElMessageBox.confirm("确定要添加吗?", { type: "warning" });
await joinMyVideoCourseware({ COURSEWARE_ID: VIDEOCOURSEWARE_ID }); await joinMyVideoCourseware({ COURSEWARE_ID: VIDEOCOURSEWARE_ID });
ElMessage.success("添加成功"); ElMessage.success("添加成功");
fnResetPagination(); fnResetPagination();
}); });
const fnOpenVideo = async () => {
// todo
ElMessage.info("功能开发中");
};
</script> </script>
<style scoped lang="scss"></style> <style scoped lang="scss"></style>