提交 ef69fe8c authored 作者: matian's avatar matian

updates

上级 31edd649
import httpRequest from '@/utils/axios' import httpRequest from '@/utils/axios'
// 讲师搜索 // 讲师搜索
export function searchLecturer(params: { name: string; 'per-page'?: string; }) { export function searchLecturer(params: { name: string; 'per-page'?: string }) {
return httpRequest.get('/api/resource/v1/course/course/search-lecturer', { params }) return httpRequest.get('/api/resource/v1/course/course/search-lecturer', { params })
} }
// 直播搜索 // 直播搜索
export function searchLive(params: { name: string; 'per-page'?: string; }) { export function searchLive(params: { name: string; 'per-page'?: string }) {
return httpRequest.get('/api/resource/v1/course/course/search-live', { params }) return httpRequest.get('/api/resource/v1/course/course/search-live', { params })
} }
// 试卷搜索 // 试卷搜索
export function searchExam(data: { nonce: string; timestamp: string; signature: string, paper_title: string; limit: string; is_all: number; project_prefix: string; }) { export function searchExam(data: {
nonce: string
timestamp: string
signature: string
paper_title: string
limit: string
is_all: number
project_prefix: string
}) {
return httpRequest.post('/api/qbs/api/v1/question-papers/search', data) return httpRequest.post('/api/qbs/api/v1/question-papers/search', data)
} }
...@@ -41,7 +49,13 @@ export function setStatus(data: { id: string }) { ...@@ -41,7 +49,13 @@ export function setStatus(data: { id: string }) {
} }
// 更新视频 // 更新视频
export function updateVideo(data: { id: string; name: string; classification: string; knowledge_points?: string; cover?: string }) { export function updateVideo(data: {
id: string
name: string
classification: string
knowledge_points?: string
cover?: string
}) {
return httpRequest.post('/api/resource/v1/resource/video/update', data) return httpRequest.post('/api/resource/v1/resource/video/update', data)
} }
...@@ -71,7 +85,7 @@ export function createPpt(data: { id: string; ppts: string }) { ...@@ -71,7 +85,7 @@ export function createPpt(data: { id: string; ppts: string }) {
} }
// 编辑课件 // 编辑课件
export function updatePpt(data: { id: string; ppt_id: string, name: string, point: string, url: string }) { export function updatePpt(data: { id: string; ppt_id: string; name: string; point: string; url: string }) {
return httpRequest.post('/api/resource/v1/resource/video/update-ppt', data) return httpRequest.post('/api/resource/v1/resource/video/update-ppt', data)
} }
...@@ -79,3 +93,123 @@ export function updatePpt(data: { id: string; ppt_id: string, name: string, poin ...@@ -79,3 +93,123 @@ export function updatePpt(data: { id: string; ppt_id: string, name: string, poin
export function deletePpt(data: { id: string; ppt_id: string }) { export function deletePpt(data: { id: string; ppt_id: string }) {
return httpRequest.post('/api/resource/v1/resource/video/delete-ppt', data) return httpRequest.post('/api/resource/v1/resource/video/delete-ppt', data)
} }
// 获取视频列表
export function getVideoList(params: {
course_id: string
tab: string
status?: string
authorized?: string
classification?: string
page?: number
page_size?: number
}) {
return httpRequest.get('/api/resource/v1/course/course/search-video', { params })
}
// 获取视频列表
export function getCourseList(params: {
tab: string
name?: string
authorized?: string
page?: number
page_size?: number
}) {
return httpRequest.get('/api/resource/v1/course/course/list', { params })
}
// 获取课件列表
export function getCourseListSearch(params: {
tab: string
name?: string
authorized?: string
page?: number
page_size?: number
}) {
return httpRequest.get('/api/resource/v1/course/course/search-courseware', { params })
}
// 获取课程统计
export function getCourseStatistics() {
return httpRequest.get('/api/resource/v1/course/course/statistics')
}
// 获取教案列表
export function getLessonList(params?: {
tab: string
status?: string
authorized?: string
classification?: string
page?: number
['per-page']?: number
}) {
return httpRequest.get('/api/resource/v1/course/course/search-lesson-plan', { params })
}
// 获取其他资料列表
export function getOtherList(params?: {
tab: string
status?: string
authorized?: string
classification?: string
page?: number
['per-page']?: number
}) {
return httpRequest.get('/api/resource/v1/course/course/search-other-information', { params })
}
// 试卷搜索
export function gatExamList(data: {
nonce: string
timestamp: string
signature: string
paper_title: string
limit: string
is_all: number
project_prefix: string
}) {
return httpRequest.post('/api/qbs/api/v1/question-papers/search', data)
}
// 获取视频详情
export function getVideoDetails(params: { id: string }) {
return httpRequest.get('/api/resource/v1/resource/video/view', { params })
}
// 获取课件详情
export function getCourseWareDetails(params: { id: string }) {
return httpRequest.get('/api/resource/v1/resource/courseware/view', { params })
}
// 获取教案详情
export function getLessonDetails(params: { id: string }) {
return httpRequest.get('/api/resource/v1/resource/lesson-plan/view', { params })
}
// 获取其他资料详情
export function getOtherDetails(params: { id: string }) {
return httpRequest.get('/api/resource/v1/resource/other-information/view', { params })
}
// 章节结构调整
export function dragChapterList(data: { course_id: string; id: string; brother_id: string; type: string }) {
return httpRequest.post('/api/resource/v1/course/course/drag', data)
}
// 获取章节
export function getCharacter(params: { course_id: string; type: string }) {
return httpRequest.get('/api/resource/v1/course/course/chapters', { params })
}
// 新建章节
export function createCharacter(data: {
course_id: string
resource_type: string
name: string
parent_id?: string
resource_id?: string
}) {
return httpRequest.post('/api/resource/v1/course/course/create-chapter', data)
}
// 章节修改
export function editCharacter(data: { id: string; course_id: string; name: string; resource_id: string }) {
return httpRequest.post('/api/resource/v1/course/course/update-chapter', data)
}
// 章节删除
export function delCharacter(data: { id: string; course_id: string }) {
return httpRequest.post('/api/resource/v1/course/course/delete-chapter', data)
}
// 直播列表
export function getLiveList(params: { name: string; page?: number; ['page_size']?: number }) {
return httpRequest.get('/api/resource/v1/course/course/search-live', { params })
}
<script lang="ts" setup> <script lang="ts" setup>
import { createCharacter, editCharacter } from '../api' import { createCharacter, editCharacter } from '../../api'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
const store = useMapStore() const store = useMapStore()
......
<script setup lang="ts"> <script setup lang="ts">
import { gatExamList, createCharacter } from '../api' import { gatExamList, createCharacter } from '../../api'
import { useMapStore } from '@/stores/map'
import { useGetCategoryList } from '@/composables/useGetCategoryList' import { useGetCategoryList } from '@/composables/useGetCategoryList'
const store = useMapStore()
const appList = ref() const appList = ref()
let { list: selectTree } = useGetCategoryList() let { list: selectTree } = useGetCategoryList()
const tabValue = ref('1') const tabValue = ref('1')
...@@ -26,6 +24,10 @@ const props = defineProps({ ...@@ -26,6 +24,10 @@ const props = defineProps({
chapterID: { chapterID: {
type: String, type: String,
required: true required: true
},
btnInfo: {
type: Object,
required: true
} }
}) })
interface Emits { interface Emits {
...@@ -88,16 +90,12 @@ const handleCancel = () => { ...@@ -88,16 +90,12 @@ const handleCancel = () => {
} }
// 保存 // 保存
const handleSave = () => { const handleSave = () => {
const type = store.mapList
.filter(item => item.key === 'system_chapter_resource_type')[0]
?.values.filter(it => it.label === '视频')[0]?.value
console.log(multipleSelection)
const name = multipleSelection.value.map((item: any) => item.paper_category.name)[0] const name = multipleSelection.value.map((item: any) => item.paper_category.name)[0]
const resource_id = multipleSelection.value.map((item: any) => item.id)[0] const resource_id = multipleSelection.value.map((item: any) => item.id)[0]
const params: any = { const params: any = {
name: name, name: name,
course_id: props.course_id, course_id: props.course_id,
resource_type: type, resource_type: props.btnInfo.resource_type,
parent_id: props.chapterID, parent_id: props.chapterID,
resource_id: resource_id resource_id: resource_id
} }
...@@ -120,10 +118,13 @@ const typeFilter = () => { ...@@ -120,10 +118,13 @@ const typeFilter = () => {
const handleSelectionChange = (val: any) => { const handleSelectionChange = (val: any) => {
multipleSelection.value = val multipleSelection.value = val
} }
const title = computed(() => {
return `添加${props.btnInfo.btn_name}`
})
</script> </script>
<template> <template>
<el-drawer :model-value="isShowExamDialog" draggable :before-close="handleCancel" size="60%" title="添加考试/作业"> <el-drawer :model-value="isShowExamDialog" draggable :before-close="handleCancel" size="60%" :title="title">
<div class="video-head"> <div class="video-head">
<el-tabs @tab-change="tabChange" v-model="tabValue"> <el-tabs @tab-change="tabChange" v-model="tabValue">
<el-tab-pane label="我的资源" name="1"></el-tab-pane> <el-tab-pane label="我的资源" name="1"></el-tab-pane>
......
<script lang="ts" setup> <script lang="ts" setup>
import { createCharacter, getLiveList } from '../api' import { createCharacter, getLiveList } from '../../api'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import { useMapStore } from '@/stores/map'
const store = useMapStore()
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
const ruleFormRef = ref<FormInstance>() const ruleFormRef = ref<FormInstance>()
...@@ -41,6 +39,10 @@ const props = defineProps({ ...@@ -41,6 +39,10 @@ const props = defineProps({
chapterID: { chapterID: {
type: String, type: String,
required: true required: true
},
btnInfo: {
type: Object,
required: true
} }
}) })
interface Emits { interface Emits {
...@@ -54,13 +56,10 @@ const handleCancel = () => { ...@@ -54,13 +56,10 @@ const handleCancel = () => {
} }
// 确定 // 确定
const handleConfirm = () => { const handleConfirm = () => {
const type = store.mapList
.filter(item => item.key === 'system_chapter_resource_type')[0]
?.values.filter(it => it.label === '腾讯会议')[0]?.value
const params: any = Object.assign( const params: any = Object.assign(
{ {
course_id: props.course_id, course_id: props.course_id,
resource_type: type, resource_type: props.btnInfo.resource_type,
parent_id: props.chapterID, parent_id: props.chapterID,
resource_id: lecturerValue.value[0] resource_id: lecturerValue.value[0]
}, },
......
<script lang="ts" setup> <script lang="ts" setup>
import { createCharacter, editCharacter } from '../api' import { createCharacter, editCharacter } from '../../api'
import type { FormInstance, FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
const store = useMapStore() const store = useMapStore()
......
<script setup lang="ts"> <script setup lang="ts">
import { getVideoList, createCharacter } from '../api' import { getVideoList, createCharacter, getCourseListSearch, getLessonList, getOtherList } from '../../api'
import CardListItem from './CardListItem.vue' import CardListItem from './CardListItem.vue'
import { useMapStore } from '@/stores/map'
import { useGetCategoryList } from '@/composables/useGetCategoryList' import { useGetCategoryList } from '@/composables/useGetCategoryList'
const store = useMapStore()
const appList = ref() const appList = ref()
// const page = reactive({ total: 0, size: 10, currentPage: 1 }) // 资源出处 tab触发
const tabValue = ref('1')
let tableData: any = reactive({
list: [],
title: '',
total: ''
})
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
const props = defineProps({ const props = defineProps({
isShowVideoDialog: { isShowAddDialog: {
type: Boolean, type: Boolean,
required: true required: true
}, },
...@@ -26,78 +29,88 @@ const props = defineProps({ ...@@ -26,78 +29,88 @@ const props = defineProps({
chapterID: { chapterID: {
type: String, type: String,
required: true required: true
},
btnInfo: {
type: Object,
required: true
} }
}) })
interface Emits { interface Emits {
(e: 'update:isShowVideoDialog', isShowVideoDialog: boolean): void (e: 'update:isShowAddDialog', isShowVideoDialog: boolean): void
(e: 'create'): void (e: 'create'): void
} }
// 筛选下拉选择tree 视频分类
let { list: selectTree } = useGetCategoryList()
const defaultProps = {
children: 'children',
label: 'category_name',
value: 'id'
}
const typeFilter = () => {
appList.value.refetch()
}
const title = computed(() => {
return `添加${props.btnInfo.btn_name}`
})
// 资源出处 tab触发 const listOptions = computed(() => {
const tabValue = ref('1') console.log(props.btnInfo.resource_type)
let getHttpRequest = null
if (props.btnInfo.resource_type === '2') {
getHttpRequest = getVideoList
} else if (props.btnInfo.resource_type === '10') {
getHttpRequest = getCourseListSearch
} else if (props.btnInfo.resource_type === '11') {
getHttpRequest = getLessonList
} else if (props.btnInfo.resource_type === '4') {
getHttpRequest = getOtherList
}
return {
remote: {
httpRequest: getHttpRequest,
callback(data: any) {
tableData = data
return data
},
params: { tab: tabValue, status: '', authorized: '', name: '', course_id: props.course_id }
},
filters: [
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' }
],
columns: [],
data: tableData
}
})
// tab切换
const tabChange = () => { const tabChange = () => {
appList.value?.refetch() appList.value?.refetch()
} }
// 取消
const handleCancel = () => { const handleCancel = () => {
emit('update:isShowVideoDialog', false) emit('update:isShowAddDialog', false)
} }
// 保存 添加
const handleSave = () => { const handleSave = () => {
const type = store.mapList const name = tableData.list.filter((item: any) => item.check_status === true)[0].name
.filter(item => item.key === 'system_chapter_resource_type')[0] const resource_id = tableData.list.filter((item: any) => item.check_status === true)[0].id
?.values.filter(it => it.label === '视频')[0]?.value
console.log(tableData.list)
const name = tableData.list.filter((item: any) => item.auth_department === true)[0].name
const resource_id = tableData.list.filter((item: any) => item.auth_department === true)[0].id
// console.log(resource_id, '1111', name)
const params: any = { const params: any = {
name: name, name: name,
course_id: props.course_id, course_id: props.course_id,
resource_type: type, resource_type: props.btnInfo.resource_type,
parent_id: props.chapterID, parent_id: props.chapterID,
resource_id: resource_id resource_id: resource_id
} }
createCharacter(params).then(() => { createCharacter(params).then(() => {
emit('update:isShowVideoDialog', false) emit('update:isShowAddDialog', false)
emit('create') emit('create')
}) })
} }
let tableData: any = reactive({
list: [],
title: '',
total: ''
})
const listOptions = {
remote: {
httpRequest: getVideoList,
callback(data: any) {
tableData = data
return data
},
params: { tab: tabValue, status: '', authorized: '', name: '' }
},
filters: [
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' }
],
columns: [],
data: tableData
}
// 筛选下拉选择tree 视频分类
let { list: selectTree } = useGetCategoryList()
const defaultProps = {
children: 'children',
label: 'category_name',
value: 'id'
}
const typeFilter = () => {
appList.value.refetch()
}
</script> </script>
<template> <template>
<el-drawer :model-value="isShowVideoDialog" draggable :before-close="handleCancel" size="60%" title="添加视频"> <el-drawer :model-value="isShowAddDialog" draggable :before-close="handleCancel" size="60%" :title="title">
<div class="video-head"> <div class="video-head">
<el-tabs @tab-change="tabChange" v-model="tabValue"> <el-tabs @tab-change="tabChange" v-model="tabValue">
<el-tab-pane label="我的资源" name="1"></el-tab-pane> <el-tab-pane label="我的资源" name="1"></el-tab-pane>
...@@ -120,7 +133,7 @@ const typeFilter = () => { ...@@ -120,7 +133,7 @@ const typeFilter = () => {
<div class="card-list-con"> <div class="card-list-con">
<div style="position: relative" v-for="(item, index) in data" :key="index"> <div style="position: relative" v-for="(item, index) in data" :key="index">
<el-checkbox <el-checkbox
v-model="item.auth_department" v-model="item.check_status"
style="position: absolute; right: 40px; bottom: 22px" style="position: absolute; right: 40px; bottom: 22px"
></el-checkbox> ></el-checkbox>
<CardListItem :tabIndex="tabValue" :data="item"> </CardListItem> <CardListItem :tabIndex="tabValue" :data="item"> </CardListItem>
......
<script setup lang="ts">
const props: any = defineProps<{ data: object; tabIndex: string }>()
</script>
<template>
<!-- <div>{{ props.data }}</div> -->
<div class="card-item">
<div class="card-item-top">
<div class="title">{{ props.data.name }}</div>
<!-- <img :src="props.data.cover" /> -->
<div class="cover-img" :style="`background-image:url(${props.data.cover})`"></div>
<div class="tool-pop-btn">
<div style="min-width: 100%">
<router-link v-if="props.data.auth_edit" :to="`/resource/video/update?id=${props.data.id}`">
<div class="edit-btn">编辑</div>
</router-link>
</div>
<div style="min-width: 100%">
<router-link v-if="props.data.auth_view" :to="`/resource/video/view?id=${props.data.id}`">
<div class="view-btn">查看</div>
</router-link>
</div>
</div>
</div>
<div class="card-item-bottom">
<div class="item-t">
<div class="text">{{ props.data.created_operator_name }}/{{ props.data.organ_id_name }}</div>
<div :class="props.data.status == 1 ? 'tag green' : 'tag'">{{ props.data.status_name }}</div>
</div>
<div class="item-b">
<div class="time">{{ props.data.updated_time }}</div>
<div class="tag" v-if="tabIndex === '2'">{{ props.data.department_public === '0' ? '未共享' : '已共享' }}</div>
<div class="tag" v-if="tabIndex === '3'">{{ props.data.platform_public === '0' ? '未共享' : '已共享' }}</div>
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.card-item {
width: 265px;
border-radius: 6px;
overflow: hidden;
margin-right: 20px;
margin-bottom: 20px;
.card-item-top {
height: 170px;
position: relative;
&:hover {
.tool-pop-btn {
opacity: 1;
}
}
.cover-img {
width: 100%;
height: 100%;
background-size: cover;
}
.title {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
line-height: 37px;
background: rgba(0, 0, 0, 0.4);
font-size: 18px;
color: #ffffff;
padding-left: 16px;
box-sizing: border-box;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.tool-pop-btn {
transition: all 0.5s;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
opacity: 0;
padding-top: 52px;
box-sizing: border-box;
.edit-btn {
width: 113px;
line-height: 32px;
border: 1px solid #d3d3d3;
border-radius: 18px;
text-align: center;
font-size: 14px;
color: #ffffff;
margin: 0 auto 12px;
cursor: pointer;
}
.view-btn {
width: 113px;
line-height: 32px;
background: #aa1941;
border-radius: 18px;
text-align: center;
font-size: 14px;
color: #ffffff;
margin: 0 auto;
cursor: pointer;
}
}
}
}
.card-item-bottom {
background: #fff;
padding: 20px 16px 30px;
.item-t {
display: flex;
align-items: center;
justify-content: space-between;
.text {
width: 150px;
font-size: 16px;
line-height: 100%;
color: #666666;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.tag {
width: 48px;
line-height: 22px;
background: #aa1941;
border-radius: 11px;
font-size: 14px;
color: #fff;
text-align: center;
&.green {
background: #1ab226;
}
}
}
.item-b {
margin-top: 18px;
display: flex;
align-items: center;
justify-content: space-between;
.time {
font-size: 14px;
line-height: 100%;
color: #999999;
}
.tag {
font-size: 16px;
line-height: 100%;
color: #999999;
}
}
}
</style>
...@@ -6,7 +6,8 @@ export const routes: Array<RouteRecordRaw> = [ ...@@ -6,7 +6,8 @@ export const routes: Array<RouteRecordRaw> = [
path: '/course/update-course', path: '/course/update-course',
component: AppLayout, component: AppLayout,
children: [ children: [
{ path: '', component: () => import('./views/StepOne.vue') } { path: '', component: () => import('./views/StepOne.vue') },
{ path: '/course/update-course/stepTwo', component: () => import('./views/StepTwo.vue') }
] ]
} }
] ]
...@@ -16,6 +16,7 @@ import AddLive from '../components/stepOneComponents/AddLive.vue' ...@@ -16,6 +16,7 @@ import AddLive from '../components/stepOneComponents/AddLive.vue'
const store = useMapStore() const store = useMapStore()
const route = useRoute() const route = useRoute()
const router = useRouter()
// const router = useRouter() // const router = useRouter()
...@@ -127,6 +128,13 @@ const createCourseForm = () => { ...@@ -127,6 +128,13 @@ const createCourseForm = () => {
if (res.code === 0) { if (res.code === 0) {
// 操作第二部 // 操作第二部
stepOneId.value = res.data.id stepOneId.value = res.data.id
router.push({
path: '/course/update-course/stepTwo',
query: {
id: stepOneId.value,
isEditCourse: '1'
}
})
} }
}) })
} else { } else {
...@@ -134,6 +142,13 @@ const createCourseForm = () => { ...@@ -134,6 +142,13 @@ const createCourseForm = () => {
if (res.code === 0) { if (res.code === 0) {
// 操作第二部 // 操作第二部
stepOneId.value = res.data.id stepOneId.value = res.data.id
router.push({
path: '/course/update-course/stepTwo',
query: {
id: stepOneId.value,
isEditCourse: '0'
}
})
} }
}) })
} }
......
<script lang="ts" setup> <script lang="ts" setup>
// import type Node from 'element-plus/es/components/tree/src/model/node'
import AddChapterDialog from '../components/AddChapterDialog.vue'
import AddSectionDialog from '../components/AddSectionDialog.vue'
import AddLiveDialog from '../components/AddLiveDialog.vue'
import AddVideoDialog from '../components/AddVideoDialog.vue'
import AddCoursewareDialog from '../components/AddCoursewareDialog.vue'
import AddLessonPlanDialog from '../components/AddLessonPlanDialog.vue'
import AddOtherDialog from '../components/AddOtherDialog.vue'
import AddExamDialog from '../components/AddExamDialog.vue'
import VideoPlayDialog from '../components/VideoPlayDialog.vue'
import { Plus } from '@element-plus/icons-vue' import { Plus } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import AddSectionDialog from '../components/stepTwoComponents/AddSectionDialog.vue'
import AddLiveDialog from '../components/stepTwoComponents/AddLiveDialog.vue'
import AddVideoDialog from '../components/stepTwoComponents/AddVideoDialog.vue'
import AddExamDialog from '../components/stepTwoComponents/AddExamDialog.vue'
import VideoPlayDialog from '../components/stepTwoComponents/VideoPlayDialog.vue'
import { import {
getCharacter, getCharacter,
delCharacter, delCharacter,
getVideoDetails, getVideoDetails,
getCourseDetails, getCourseWareDetails,
getLessonDetails, getLessonDetails,
dragChapterList dragChapterList,
getOtherDetails
} from '../api' } from '../api'
const route = useRoute()
const isEditCourse = route.query.isEditCourse as string
const id = route.query.id as string
const dataSource = ref([]) const dataSource = ref([])
const isShowDialog = ref(false) const isShowDialog = ref(false)
const isShowSectionDialog = ref(false) const isShowSectionDialog = ref(false)
const isShowLiveDialog = ref(false) const isShowLiveDialog = ref(false)
const isShowVideoDialog = ref(false) const isShowAddDialog = ref(false)
const isShowCourseDialog = ref(false)
const isShowLessonDialog = ref(false)
const isShowOtherDialog = ref(false)
const isShowExamDialog = ref(false) const isShowExamDialog = ref(false)
const isShowVideoPlayDialog = ref(false) const isShowVideoPlayDialog = ref(false)
const chapterName = ref('') const chapterName = ref('')
const chapterID = ref('') const chapterID = ref('')
const btnInfo = ref({}) // 按钮信息
const isEdit = ref(false) const isEdit = ref(false)
const videoUrl = ref('')
// const courseUrl = ref('')
// const lessonPlanUrl = ref('')
const otherUrl = ref('')
const btnList = [
{
btn_name: '视频',
resource_type: '2'
},
{
btn_name: '课件',
resource_type: '10'
},
{
btn_name: '教案',
resource_type: '11'
},
{
btn_name: '资料',
resource_type: '4'
},
{
btn_name: '作业',
resource_type: '3'
},
{
btn_name: '考试',
resource_type: '9'
},
{
btn_name: '直播',
resource_type: '6'
}
]
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'name' label: 'name'
...@@ -43,7 +73,7 @@ onMounted(() => { ...@@ -43,7 +73,7 @@ onMounted(() => {
handleChapterList() handleChapterList()
}) })
const handleChapterList = () => { const handleChapterList = () => {
getCharacter({ course_id: '6947482745467568128', type: 'tree' }).then((res: any) => { getCharacter({ course_id: id, type: 'tree' }).then((res: any) => {
dataSource.value = res.data[0].children dataSource.value = res.data[0].children
}) })
} }
...@@ -80,84 +110,63 @@ const handleEdit = (node: any) => { ...@@ -80,84 +110,63 @@ const handleEdit = (node: any) => {
} }
// 删除章节 // 删除章节
const handleDel = (node: any) => { const handleDel = (node: any) => {
const params = { id: node.key, course_id: '6947482745467568128' } const params = { id: node.key, course_id: id }
delCharacter(params).then(() => { delCharacter(params).then(() => {
ElMessage.success('删除成功') ElMessage.success('删除成功')
handleFresh() handleFresh()
}) })
} }
// 添加直播
const handleAddLive = (node: any) => { // 添加
chapterID.value = node.key const handleAddDialog = (node: any, item: any) => {
chapterName.value = node.label console.log(node, '----', item)
chapterID.value = node.key
isShowLiveDialog.value = true
}
// 添加视频
const handleAddVideo = (node: any) => {
chapterID.value = node.key
chapterName.value = node.label
chapterID.value = node.key
isShowVideoDialog.value = true
}
// 添加课件
const handleAddCourse = (node: any) => {
chapterID.value = node.key
chapterName.value = node.label
chapterID.value = node.key
isShowCourseDialog.value = true
}
// 添加教案
const handleAddLessonPlan = (node: any) => {
chapterID.value = node.key
chapterName.value = node.label
chapterID.value = node.key
isShowLessonDialog.value = true
}
// 添加其他资料
const handleAddOther = (node: any) => {
chapterID.value = node.key
chapterName.value = node.label
chapterID.value = node.key
isShowOtherDialog.value = true
}
// 添加考试
const handleAddExam = (node: any) => {
chapterID.value = node.key chapterID.value = node.key
chapterName.value = node.label chapterName.value = node.label
chapterID.value = node.key btnInfo.value = item
isShowExamDialog.value = true if (item.resource_type === '6') {
isShowLiveDialog.value = true
} else if (
item.resource_type === '2' ||
item.resource_type === '10' ||
item.resource_type === '11' ||
item.resource_type === '4'
) {
isShowAddDialog.value = true
} else if (item.resource_type === '3' || item.resource_type === '9') {
isShowExamDialog.value = true
}
} }
//查阅 //查阅
const videoUrl = ref('')
const courseUrl = ref('')
const lessonPlanUrl = ref('')
const handleConsult = (node: any) => { const handleConsult = (node: any) => {
console.log(node.data.resource_type, '000') console.log(node.data.resource_type, '000')
// 视频 // 视频
if (node.data.resource_type === '2') { if (node.data.resource_type === '2') {
getVideoDetails({ id: node.data.resource_id }).then(res => { getVideoDetails({ id: node.data.resource_id }).then(res => {
videoUrl.value = res.data.play_auth.play_info_list.filter((item: any) => item.Definition === 'SD')[0].PlayURL videoUrl.value = res.data.play_auth.play_info_list.filter((item: any) => item.Definition === 'SD')[0].PlayURL
console.log(videoUrl, '000111')
isShowVideoPlayDialog.value = true isShowVideoPlayDialog.value = true
}) })
} else if (node.data.resource_type === '4') {
// 其他资源
} }
} }
// 下载 // 下载
const handleDownload = (node: any) => { const handleDownload = (node: any) => {
if (node.data.resource_type === '10') { if (node.data.resource_type === '10') {
// 课件 // 课件
getCourseDetails({ id: node.data.resource_id }).then(res => { getCourseWareDetails({ id: node.data.resource_id }).then((res: any) => {
courseUrl.value = res.data.url otherUrl.value = res.data.url
window.open(courseUrl.value) window.open(otherUrl.value)
}) })
} else if (node.data.resource_type === '11') { } else if (node.data.resource_type === '11') {
//教案 //教案
getLessonDetails({ id: node.data.resource_id }).then(res => { getLessonDetails({ id: node.data.resource_id }).then(res => {
lessonPlanUrl.value = res.data.url otherUrl.value = res.data.url
window.open(lessonPlanUrl.value) window.open(otherUrl.value)
})
} else if (node.data.resource_type === '4') {
getOtherDetails({ id: node.data.resource_id }).then(res => {
otherUrl.value = res.data.url
window.open(otherUrl.value)
}) })
} }
} }
...@@ -177,7 +186,7 @@ const allowDrop = (draggingNode: any, dropNode: any, type: any) => { ...@@ -177,7 +186,7 @@ const allowDrop = (draggingNode: any, dropNode: any, type: any) => {
const handleDrop = (startNode: any, endNode: any, position: any, event: any) => { const handleDrop = (startNode: any, endNode: any, position: any, event: any) => {
console.log(startNode, endNode, position, event) console.log(startNode, endNode, position, event)
const params = { const params = {
course_id: '6947482745467568128', course_id: id,
id: startNode.data.id, id: startNode.data.id,
brother_id: endNode.data.id, brother_id: endNode.data.id,
type: startNode.data.id < endNode.data.id ? 'before' : 'after' type: startNode.data.id < endNode.data.id ? 'before' : 'after'
...@@ -188,7 +197,7 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) => ...@@ -188,7 +197,7 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) =>
} }
</script> </script>
<template> <template>
<AppCard title="新建课程"> <AppCard :title="isEditCourse === '1' ? '编辑课程' : '新建课程'">
<el-row> <el-row>
<el-button type="primary" round style="margin-bottom: 20px" @click="handleAddChapter">添加章</el-button> <el-button type="primary" round style="margin-bottom: 20px" @click="handleAddChapter">添加章</el-button>
<div class="course_tip"> <div class="course_tip">
...@@ -222,35 +231,23 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) => ...@@ -222,35 +231,23 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) =>
@click="handleDownload(node)" @click="handleDownload(node)"
>下载</el-link >下载</el-link
> >
<el-link type="info" @click="handleDel(node)">删除</el-link> <el-link type="info" @click="handleDel(node)">删除</el-link>
<el-button class="btn_operate" v-if="data.depth === '1'" @click="handleAddSection(node)"> <el-button class="btn_operate" v-if="data.depth === '1'" @click="handleAddSection(node)">
<el-icon><Plus /></el-icon> <el-icon><Plus /></el-icon>
&nbsp; 添加小节 &nbsp; 添加小节
</el-button> </el-button>
<el-button class="btn_operate" v-if="data.depth === '2'" @click="handleAddVideo(node)"> <template v-if="data.depth === '2'">
<el-icon><Plus /></el-icon> <el-button
视频 class="btn_operate"
</el-button> v-for="(item, index) in btnList"
<el-button class="btn_operate" v-if="data.depth === '2'" @click="handleAddCourse(node)"> :key="index"
<el-icon><Plus /></el-icon> @click="handleAddDialog(node, item)"
课件 >
</el-button> <el-icon><Plus /></el-icon>
<el-button class="btn_operate" v-if="data.depth === '2'" @click="handleAddLessonPlan(node)"> {{ item.btn_name }}
<el-icon><Plus /></el-icon> </el-button>
教案 </template>
</el-button>
<el-button class="btn_operate" v-if="data.depth === '2'" @click="handleAddOther(node)">
<el-icon><Plus /></el-icon>
资料
</el-button>
<el-button class="btn_operate" v-if="data.depth === '2'" @click="handleAddExam(node)">
<el-icon><Plus /></el-icon>
考试/作业
</el-button>
<el-button class="btn_operate" v-if="data.depth === '2'" @click="handleAddLive(node)">
<el-icon><Plus /></el-icon>
直播
</el-button>
</span> </span>
</span> </span>
</template> </template>
...@@ -261,7 +258,7 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) => ...@@ -261,7 +258,7 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) =>
v-if="isShowDialog === true" v-if="isShowDialog === true"
v-model:isShowDialog="isShowDialog" v-model:isShowDialog="isShowDialog"
@create="handleFresh" @create="handleFresh"
:course_id="'6947482745467568128'" :course_id="id"
:isEdit="isEdit" :isEdit="isEdit"
:chapterID="chapterID" :chapterID="chapterID"
:chapterName="chapterName" :chapterName="chapterName"
...@@ -273,7 +270,7 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) => ...@@ -273,7 +270,7 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) =>
@create="handleFresh" @create="handleFresh"
:chapterName="chapterName" :chapterName="chapterName"
:chapterID="chapterID" :chapterID="chapterID"
:course_id="'6947482745467568128'" :course_id="id"
:isEdit="isEdit" :isEdit="isEdit"
/> />
<!-- 添加直播 --> <!-- 添加直播 -->
...@@ -283,44 +280,20 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) => ...@@ -283,44 +280,20 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) =>
@create="handleFresh" @create="handleFresh"
:chapterName="chapterName" :chapterName="chapterName"
:chapterID="chapterID" :chapterID="chapterID"
:course_id="'6947482745467568128'" :course_id="id"
:btnInfo="btnInfo"
/> />
<!-- 添加视频 --> <!-- 添加资源 -->
<AddVideoDialog <AddVideoDialog
v-if="isShowVideoDialog === true" v-if="isShowAddDialog === true"
v-model:isShowVideoDialog="isShowVideoDialog" v-model:isShowAddDialog="isShowAddDialog"
@create="handleFresh"
:chapterName="chapterName"
:chapterID="chapterID"
:course_id="'6947482745467568128'"
/>
<!-- 添加课件 -->
<AddCoursewareDialog
v-if="isShowCourseDialog === true"
v-model:isShowCourseDialog="isShowCourseDialog"
@create="handleFresh" @create="handleFresh"
:chapterName="chapterName" :chapterName="chapterName"
:chapterID="chapterID" :chapterID="chapterID"
:course_id="'6947482745467568128'" :course_id="id"
/> :btnInfo="btnInfo"
<!-- 添加教案 -->
<AddLessonPlanDialog
v-if="isShowLessonDialog === true"
v-model:isShowLessonDialog="isShowLessonDialog"
@create="handleFresh"
:chapterName="chapterName"
:chapterID="chapterID"
:course_id="'6947482745467568128'"
/>
<!-- 添加其他资源 -->
<AddOtherDialog
v-if="isShowOtherDialog === true"
v-model:isShowOtherDialog="isShowOtherDialog"
@create="handleFresh"
:chapterName="chapterName"
:chapterID="chapterID"
:course_id="'6947482745467568128'"
/> />
<!-- 添加考试 --> <!-- 添加考试 -->
<AddExamDialog <AddExamDialog
v-if="isShowExamDialog === true" v-if="isShowExamDialog === true"
...@@ -328,7 +301,8 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) => ...@@ -328,7 +301,8 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) =>
@create="handleFresh" @create="handleFresh"
:chapterName="chapterName" :chapterName="chapterName"
:chapterID="chapterID" :chapterID="chapterID"
:course_id="'6947482745467568128'" :course_id="id"
:btnInfo="btnInfo"
/> />
<!-- 视频查阅弹框 --> <!-- 视频查阅弹框 -->
<VideoPlayDialog <VideoPlayDialog
...@@ -336,7 +310,6 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) => ...@@ -336,7 +310,6 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) =>
v-model:isShowVideoPlayDialog="isShowVideoPlayDialog" v-model:isShowVideoPlayDialog="isShowVideoPlayDialog"
:videoOptions="videoUrl" :videoOptions="videoUrl"
/> />
<!-- 课件下载 -->
</template> </template>
<style> <style>
......
...@@ -2,6 +2,7 @@ import httpRequest from '@/utils/axios' ...@@ -2,6 +2,7 @@ import httpRequest from '@/utils/axios'
// 获取视频列表 // 获取视频列表
export function getVideoList(params: { export function getVideoList(params: {
course_id: string
tab: string tab: string
status?: string status?: string
authorized?: string authorized?: string
...@@ -9,7 +10,7 @@ export function getVideoList(params: { ...@@ -9,7 +10,7 @@ export function getVideoList(params: {
page?: number page?: number
page_size?: number page_size?: number
}) { }) {
return httpRequest.get('/api/resource/v1/resource/video/list', { params }) return httpRequest.get('/api/resource/v1/course/course/search-video', { params })
} }
// 获取视频列表 // 获取视频列表
export function getCourseList(params: { export function getCourseList(params: {
...@@ -21,6 +22,16 @@ export function getCourseList(params: { ...@@ -21,6 +22,16 @@ export function getCourseList(params: {
}) { }) {
return httpRequest.get('/api/resource/v1/course/course/list', { params }) return httpRequest.get('/api/resource/v1/course/course/list', { params })
} }
// 获取课件列表
export function getCourseListSearch(params: {
tab: string
name?: string
authorized?: string
page?: number
page_size?: number
}) {
return httpRequest.get('/api/resource/v1/course/course/search-courseware', { params })
}
// 获取课程统计 // 获取课程统计
export function getCourseStatistics() { export function getCourseStatistics() {
...@@ -36,7 +47,7 @@ export function getLessonList(params?: { ...@@ -36,7 +47,7 @@ export function getLessonList(params?: {
page?: number page?: number
['per-page']?: number ['per-page']?: number
}) { }) {
return httpRequest.get('/api/resource/v1/resource/lesson-plan/list', { params }) return httpRequest.get('/api/resource/v1/course/course/search-lesson-plan', { params })
} }
// 获取其他资料列表 // 获取其他资料列表
export function getOtherList(params?: { export function getOtherList(params?: {
...@@ -47,7 +58,7 @@ export function getOtherList(params?: { ...@@ -47,7 +58,7 @@ export function getOtherList(params?: {
page?: number page?: number
['per-page']?: number ['per-page']?: number
}) { }) {
return httpRequest.get('/api/resource/v1/resource/other-information/list', { params }) return httpRequest.get('/api/resource/v1/course/course/search-other-information', { params })
} }
// 试卷搜索 // 试卷搜索
export function gatExamList(data: { export function gatExamList(data: {
...@@ -74,6 +85,10 @@ export function getCourseDetails(params: { id: string }) { ...@@ -74,6 +85,10 @@ export function getCourseDetails(params: { id: string }) {
export function getLessonDetails(params: { id: string }) { export function getLessonDetails(params: { id: string }) {
return httpRequest.get('/api/resource/v1/resource/lesson-plan/view', { params }) return httpRequest.get('/api/resource/v1/resource/lesson-plan/view', { params })
} }
// 获取其他资料详情
export function getOtherDetails(params: { id: string }) {
return httpRequest.get('/api/resource/v1/resource/other-information/view', { params })
}
// 章节结构调整 // 章节结构调整
export function dragChapterList(data: { course_id: string; id: string; brother_id: string; type: string }) { export function dragChapterList(data: { course_id: string; id: string; brother_id: string; type: string }) {
return httpRequest.post('/api/resource/v1/course/course/drag', data) return httpRequest.post('/api/resource/v1/course/course/drag', data)
......
<script setup lang="ts">
import { getCourseList, createCharacter } from '../api'
import CardListItem from './CardListItem.vue'
import { useMapStore } from '@/stores/map'
import { useGetCategoryList } from '@/composables/useGetCategoryList'
const store = useMapStore()
const appList = ref()
// const page = reactive({ total: 0, size: 10, currentPage: 1 })
const emit = defineEmits<Emits>()
const props = defineProps({
isShowCourseDialog: {
type: Boolean,
required: true
},
course_id: {
type: String,
required: true
},
chapterName: {
type: String,
required: true
},
chapterID: {
type: String,
required: true
}
})
interface Emits {
(e: 'update:isShowCourseDialog', isShowCourseDialog: boolean): void
(e: 'create'): void
}
// 资源出处 tab触发
const tabValue = ref('1')
const tabChange = () => {
appList.value?.refetch()
}
const handleCancel = () => {
emit('update:isShowCourseDialog', false)
}
const handleSave = () => {
const type = store.mapList
.filter(item => item.key === 'system_chapter_resource_type')[0]
?.values.filter(it => it.label === '课件')[0]?.value
console.log(tableData.list)
const name = tableData.list.filter((item: any) => item.auth_department === true)[0].name
const resource_id = tableData.list.filter((item: any) => item.auth_department === true)[0].id
// console.log(resource_id, '1111', name)
const params: any = {
name: name,
course_id: props.course_id,
resource_type: type,
parent_id: props.chapterID,
resource_id: resource_id
}
createCharacter(params).then(() => {
emit('update:isShowCourseDialog', false)
emit('create')
})
}
let tableData: any = reactive({
list: [],
title: '',
total: ''
})
const listOptions = {
remote: {
httpRequest: getCourseList,
callback(data: any) {
tableData = data
return data
},
params: { tab: tabValue, status: '', authorized: '', name: '' }
},
filters: [
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' }
],
columns: [],
data: tableData
}
// 筛选下拉选择tree 视频分类
let { list: selectTree } = useGetCategoryList()
const defaultProps = {
children: 'children',
label: 'category_name',
value: 'id'
}
const typeFilter = () => {
appList.value.refetch()
}
</script>
<template>
<el-drawer :model-value="isShowCourseDialog" draggable :before-close="handleCancel" size="60%" title="添加课件">
<div class="video-head">
<el-tabs @tab-change="tabChange" v-model="tabValue">
<el-tab-pane label="我的资源" name="1"></el-tab-pane>
<el-tab-pane label="部门资源" name="2"></el-tab-pane>
<el-tab-pane label="公开资源" name="3"></el-tab-pane>
</el-tabs>
</div>
<AppList v-bind="listOptions" ref="appList">
<template #filter-type="{ params }">
<el-tree-select
@change="typeFilter"
clearable
:props="defaultProps"
v-model="params.classification"
:data="selectTree"
/>
</template>
<template #body="{ data }">
<div class="card-list" v-if="data.length">
<div class="card-list-con">
<div style="position: relative" v-for="(item, index) in data" :key="index">
<el-checkbox
v-model="item.auth_department"
style="position: absolute; right: 40px; bottom: 22px"
></el-checkbox>
<CardListItem :tabIndex="tabValue" :data="item"> </CardListItem>
</div>
</div>
</div>
<el-empty v-else description="暂无数据" />
</template>
</AppList>
<el-button type="primary" @click="handleSave">保存</el-button>
</el-drawer>
</template>
<style lang="scss">
.card-list {
display: flex;
flex-direction: column;
}
.card-list-con {
background: #fafafa;
padding: 20px;
display: flex;
flex-wrap: wrap;
}
.video-head {
position: relative;
.video-head-icon {
position: absolute;
top: 0;
right: 0;
font-size: 30px;
color: #666;
cursor: pointer;
}
}
.video-tool-btn {
padding: 10px 0 30px 0;
}
</style>
<script setup lang="ts">
import { getLessonList, createCharacter } from '../api'
import CardListItem from './CardListItem.vue'
import { useMapStore } from '@/stores/map'
import { useGetCategoryList } from '@/composables/useGetCategoryList'
const store = useMapStore()
const appList = ref()
// const page = reactive({ total: 0, size: 10, currentPage: 1 })
const emit = defineEmits<Emits>()
const props = defineProps({
isShowLessonDialog: {
type: Boolean,
required: true
},
course_id: {
type: String,
required: true
},
chapterName: {
type: String,
required: true
},
chapterID: {
type: String,
required: true
}
})
interface Emits {
(e: 'update:isShowLessonDialog', isShowLessonDialog: boolean): void
(e: 'create'): void
}
// 资源出处 tab触发
const tabValue = ref('1')
const tabChange = () => {
appList.value?.refetch()
}
const handleCancel = () => {
emit('update:isShowLessonDialog', false)
}
const handleSave = () => {
const type = store.mapList
.filter(item => item.key === 'system_chapter_resource_type')[0]
?.values.filter(it => it.label === '视频')[0]?.value
console.log(tableData.list)
const name = tableData.list.filter((item: any) => item.auth_department === true)[0].name
const resource_id = tableData.list.filter((item: any) => item.auth_department === true)[0].id
// console.log(resource_id, '1111', name)
const params: any = {
name: name,
course_id: props.course_id,
resource_type: type,
parent_id: props.chapterID,
resource_id: resource_id
}
createCharacter(params).then(() => {
emit('update:isShowLessonDialog', false)
emit('create')
})
}
let tableData: any = reactive({
list: [],
title: '',
total: ''
})
const listOptions = {
remote: {
httpRequest: getLessonList,
callback(data: any) {
tableData = data
return data
},
params: { tab: tabValue, status: '', authorized: '', name: '' }
},
filters: [
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' }
],
columns: [],
data: tableData
}
// 筛选下拉选择tree 视频分类
let { list: selectTree } = useGetCategoryList()
const defaultProps = {
children: 'children',
label: 'category_name',
value: 'id'
}
const typeFilter = () => {
appList.value.refetch()
}
</script>
<template>
<el-drawer :model-value="isShowLessonDialog" draggable :before-close="handleCancel" size="60%" title="添加教案">
<div class="video-head">
<el-tabs @tab-change="tabChange" v-model="tabValue">
<el-tab-pane label="我的资源" name="1"></el-tab-pane>
<el-tab-pane label="部门资源" name="2"></el-tab-pane>
<el-tab-pane label="公开资源" name="3"></el-tab-pane>
</el-tabs>
</div>
<AppList v-bind="listOptions" ref="appList">
<template #filter-type="{ params }">
<el-tree-select
@change="typeFilter"
clearable
:props="defaultProps"
v-model="params.classification"
:data="selectTree"
/>
</template>
<template #body="{ data }">
<div class="card-list" v-if="data.length">
<div class="card-list-con">
<div style="position: relative" v-for="(item, index) in data" :key="index">
<el-checkbox
v-model="item.auth_department"
style="position: absolute; right: 40px; bottom: 22px"
></el-checkbox>
<CardListItem :tabIndex="tabValue" :data="item"> </CardListItem>
</div>
</div>
</div>
<el-empty v-else description="暂无数据" />
</template>
</AppList>
<el-button type="primary" @click="handleSave">保存</el-button>
</el-drawer>
</template>
<style lang="scss">
.card-list {
display: flex;
flex-direction: column;
}
.card-list-con {
background: #fafafa;
padding: 20px;
display: flex;
flex-wrap: wrap;
}
.video-head {
position: relative;
.video-head-icon {
position: absolute;
top: 0;
right: 0;
font-size: 30px;
color: #666;
cursor: pointer;
}
}
.video-tool-btn {
padding: 10px 0 30px 0;
}
</style>
<script setup lang="ts">
import { getOtherList, createCharacter } from '../api'
import CardListItem from './CardListItem.vue'
import { useMapStore } from '@/stores/map'
import { useGetCategoryList } from '@/composables/useGetCategoryList'
const store = useMapStore()
const appList = ref()
// const page = reactive({ total: 0, size: 10, currentPage: 1 })
const emit = defineEmits<Emits>()
const props = defineProps({
isShowOtherDialog: {
type: Boolean,
required: true
},
course_id: {
type: String,
required: true
},
chapterName: {
type: String,
required: true
},
chapterID: {
type: String,
required: true
}
})
interface Emits {
(e: 'update:isShowOtherDialog', isShowOtherDialog: boolean): void
(e: 'create'): void
}
// 资源出处 tab触发
const tabValue = ref('1')
const tabChange = () => {
appList.value?.refetch()
}
const handleCancel = () => {
emit('update:isShowOtherDialog', false)
}
const handleSave = () => {
const type = store.mapList
.filter(item => item.key === 'system_chapter_resource_type')[0]
?.values.filter(it => it.label === '视频')[0]?.value
console.log(tableData.list)
const name = tableData.list.filter((item: any) => item.auth_department === true)[0].name
const resource_id = tableData.list.filter((item: any) => item.auth_department === true)[0].id
// console.log(resource_id, '1111', name)
const params: any = {
name: name,
course_id: props.course_id,
resource_type: type,
parent_id: props.chapterID,
resource_id: resource_id
}
createCharacter(params).then(() => {
emit('update:isShowOtherDialog', false)
emit('create')
})
}
let tableData: any = reactive({
list: [],
title: '',
total: ''
})
const listOptions = {
remote: {
httpRequest: getOtherList,
callback(data: any) {
tableData = data
return data
},
params: { tab: tabValue, status: '', authorized: '', name: '' }
},
filters: [
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'name', label: '标题:' }
],
columns: [],
data: tableData
}
// 筛选下拉选择tree 视频分类
let { list: selectTree } = useGetCategoryList()
const defaultProps = {
children: 'children',
label: 'category_name',
value: 'id'
}
const typeFilter = () => {
appList.value.refetch()
}
</script>
<template>
<el-drawer :model-value="isShowOtherDialog" draggable :before-close="handleCancel" size="60%" title="添加其他资料">
<div class="video-head">
<el-tabs @tab-change="tabChange" v-model="tabValue">
<el-tab-pane label="我的资源" name="1"></el-tab-pane>
<el-tab-pane label="部门资源" name="2"></el-tab-pane>
<el-tab-pane label="公开资源" name="3"></el-tab-pane>
</el-tabs>
</div>
<AppList v-bind="listOptions" ref="appList">
<template #filter-type="{ params }">
<el-tree-select
@change="typeFilter"
clearable
:props="defaultProps"
v-model="params.classification"
:data="selectTree"
/>
</template>
<template #body="{ data }">
<div class="card-list" v-if="data.length">
<div class="card-list-con">
<div style="position: relative" v-for="(item, index) in data" :key="index">
<el-checkbox
v-model="item.auth_department"
style="position: absolute; right: 40px; bottom: 22px"
></el-checkbox>
<CardListItem :tabIndex="tabValue" :data="item"> </CardListItem>
</div>
</div>
</div>
<el-empty v-else description="暂无数据" />
</template>
</AppList>
<el-button type="primary" @click="handleSave">保存</el-button>
</el-drawer>
</template>
<style lang="scss">
.card-list {
display: flex;
flex-direction: column;
}
.card-list-con {
background: #fafafa;
padding: 20px;
display: flex;
flex-wrap: wrap;
}
.video-head {
position: relative;
.video-head-icon {
position: absolute;
top: 0;
right: 0;
font-size: 30px;
color: #666;
cursor: pointer;
}
}
.video-tool-btn {
padding: 10px 0 30px 0;
}
</style>
...@@ -7,7 +7,6 @@ export const routes: Array<RouteRecordRaw> = [ ...@@ -7,7 +7,6 @@ export const routes: Array<RouteRecordRaw> = [
component: AppLayout, component: AppLayout,
children: [ children: [
{ path: '', component: () => import('./views/List.vue') }, { path: '', component: () => import('./views/List.vue') },
{ path: '/course/my/StepTwo', component: () => import('./views/StepTwo.vue') },
{ path: '/course/my/view', component: () => import('./views/View.vue') } { path: '/course/my/view', component: () => import('./views/View.vue') }
] ]
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论