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

View File

@ -1,6 +1,11 @@
<template>
<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>
</template>
@ -16,12 +21,20 @@ defineOptions({
const props = defineProps({
src: {
type: String,
required: true,
default: "",
},
vid: {
type: String,
default: "",
},
playAuth: {
type: String,
default: "",
},
visible: {
type: Boolean,
default: false,
required: true,
default: false,
},
});
const emits = defineEmits(["update:visible"]);

View File

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

View File

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