提交 9ed4007c authored 作者: lihuihui's avatar lihuihui
...@@ -55,6 +55,10 @@ export function getCategoryList(params: { type: string; category_name?: string } ...@@ -55,6 +55,10 @@ export function getCategoryList(params: { type: string; category_name?: string }
} }
// 获取项目列表 // 获取项目列表
export function getProjectList(params: { organization_id?: string, project_id?: string }) { export function getProjectList(params: { organization_id?: string; project_id?: string }) {
return httpRequest.get('/api/resource/v1/util/members', { params }) return httpRequest.get('/api/resource/v1/util/members', { params })
} }
// 获取试题分类
export function getQuestionCategory(params: { project_tag: string }) {
return httpRequest.get(`/api/qbs/admin/v2/question-category/tree/${params.project_tag}`, { params })
}
import type { IMenuItem } from '@/types' import type { IMenuItem } from '@/types'
import { Expand, Document, VideoCamera, Suitcase, Collection, Files, Monitor, Edit, User, Filter, Coordinate, Notebook, Picture } from '@element-plus/icons-vue' import {
FolderOpened,
ToiletPaper,
VideoCamera,
Suitcase,
Collection,
Files,
Monitor,
Edit,
User,
Filter,
Coordinate,
Notebook,
Picture
} from '@element-plus/icons-vue'
export const menus: IMenuItem[] = [ export const menus: IMenuItem[] = [
{ {
tag: 'v1-resource', tag: 'v1-resource',
...@@ -20,7 +34,7 @@ export const menus: IMenuItem[] = [ ...@@ -20,7 +34,7 @@ export const menus: IMenuItem[] = [
}, },
{ {
tag: 'v1-resource-lesson-plan-list', tag: 'v1-resource-lesson-plan-list',
icon: Collection, icon: FolderOpened,
name: '教案', name: '教案',
path: '/resource/lessonplan' path: '/resource/lessonplan'
}, },
...@@ -31,14 +45,14 @@ export const menus: IMenuItem[] = [ ...@@ -31,14 +45,14 @@ export const menus: IMenuItem[] = [
path: '/resource/other' path: '/resource/other'
}, },
{ {
icon: Expand, icon: Collection,
name: '题库管理', name: '题库管理',
path: '/' path: 'https://qa-center.ezijing.com/question/list'
}, },
{ {
icon: Document, icon: ToiletPaper,
name: '试卷管理', name: '试卷管理',
path: '/' path: 'https://qa-center.ezijing.com/paper/list'
} }
] ]
}, },
......
...@@ -64,11 +64,11 @@ const fetchList = (isReset = false) => { ...@@ -64,11 +64,11 @@ const fetchList = (isReset = false) => {
if (beforeRequest) { if (beforeRequest) {
requestParams = beforeRequest(requestParams, isReset) requestParams = beforeRequest(requestParams, isReset)
} }
// for (const key in params) { for (const key in params) {
// if (params[key] === '' || params[key] === undefined || params[key] === undefined) { if (params[key] === '' || params[key] === undefined || params[key] === undefined) {
// delete params[key] delete params[key]
// } }
// } }
loading.value = true loading.value = true
return ( return (
httpRequest(requestParams) httpRequest(requestParams)
......
...@@ -7,6 +7,7 @@ export default { ...@@ -7,6 +7,7 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { menus } from '@/assets/menus' import { menus } from '@/assets/menus'
import type { IMenuItem } from '@/types' import type { IMenuItem } from '@/types'
const router = useRouter()
const route = useRoute() const route = useRoute()
const menuList = $computed<IMenuItem[]>(() => { const menuList = $computed<IMenuItem[]>(() => {
...@@ -27,22 +28,40 @@ const defaultActive = computed(() => { ...@@ -27,22 +28,40 @@ const defaultActive = computed(() => {
}) })
return found ? found.path : '/' return found ? found.path : '/'
}) })
function isUrl(path: string) {
return /^https?:\/\//.test(path)
}
function handleClick(path: string) {
if (isUrl(path)) {
window.open(path)
} else {
router.push(path)
}
}
</script> </script>
<template> <template>
<aside class="app-aside"> <aside class="app-aside">
<nav class="nav"> <nav class="nav">
<el-menu :default-active="defaultActive" :router="true" class="app-menu"> <el-menu :default-active="defaultActive" class="app-menu">
<template v-for="item in menuList" :key="item.path"> <template v-for="item in menuList" :key="item.path">
<el-sub-menu :index="item.path" v-permission="item.tag" v-if="item.children"> <el-sub-menu :index="item.path" v-permission="item.tag" v-if="item.children">
<template #title> <template #title>
<el-icon><component :is="item.icon"></component></el-icon>{{ item.name }} <el-icon><component :is="item.icon"></component></el-icon>{{ item.name }}
</template> </template>
<el-menu-item :index="subitem.path" v-for="subitem in item.children" :key="subitem.path" v-permission="subitem.tag"> <el-menu-item
:index="subitem.path"
v-for="subitem in item.children"
:key="subitem.path"
v-permission="subitem.tag"
@click="handleClick(subitem.path)"
>
{{ subitem.name }} {{ subitem.name }}
</el-menu-item> </el-menu-item>
</el-sub-menu> </el-sub-menu>
<el-menu-item :index="item.path" v-permission="item.tag" v-else> <el-menu-item :index="item.path" v-permission="item.tag" @click="handleClick(item.path)" v-else>
<el-icon><component :is="item.icon"></component></el-icon>{{ item.name }} <el-icon><component :is="item.icon"></component></el-icon>{{ item.name }}
</el-menu-item> </el-menu-item>
</template> </template>
......
import { getQuestionCategory } from '@/api/base'
export function useQuestionList() {
const list = ref([])
getQuestionCategory({ project_tag: 'resourse_ci' }).then((res: any) => {
list.value = res.data.filter((item: any) => {
item.children = detailChild(item.children)
return item.children
})
})
const detailChild = (child: any) => {
if (!child) return []
return child.filter((item: any) => {
item.children = detailChild(item.children)
return item.children
})
}
return { list }
}
...@@ -11,16 +11,19 @@ export function searchLive(params: { name: string; 'per-page'?: string }) { ...@@ -11,16 +11,19 @@ export function searchLive(params: { name: string; 'per-page'?: string }) {
} }
// 试卷搜索 // 试卷搜索
export function searchExam(data: { export function searchExam(params: {
nonce: string project_tag: string
timestamp: string id?: string
signature: string paper_title?: string
paper_title: string permission: string
limit: string paper_type?: string
is_all: number paper_labels?: string
project_prefix: string paper_category?: string
paper_categories?: string
page?: string
limit?: string
}) { }) {
return httpRequest.post('/api/qbs/api/v1/question-papers/search', data) return httpRequest.get(`/api/qbs/admin/v2/question-papers/resourse_ci`, { params })
} }
// 新建课件 // 新建课件
...@@ -154,18 +157,6 @@ export function getOtherList(params?: { ...@@ -154,18 +157,6 @@ export function getOtherList(params?: {
}) { }) {
return httpRequest.get('/api/resource/v1/course/course/search-other-information', { params }) 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 }) { export function getVideoDetails(params: { id: string }) {
......
<script setup lang="ts"> <script setup lang="ts">
import { searchExam } from '../../api' import AddExamDialog from './AddExamDialog.vue'
const emit = defineEmits(['change'])
const props = defineProps({ const props = defineProps({
data: { data: {
type: Array type: Array
} }
}) })
const emit = defineEmits(['change'])
const listOptions = computed(() => { const listOptions = computed(() => {
return { return {
columns: [ columns: [
// { label: '', slots: 'table-avatar', align: 'center' },
{ label: '试卷名称', prop: 'paper_title', align: 'center' }, { label: '试卷名称', prop: 'paper_title', align: 'center' },
{ {
label: '组卷模式', label: '组卷模式',
...@@ -36,80 +33,27 @@ const listOptions = computed(() => { ...@@ -36,80 +33,27 @@ const listOptions = computed(() => {
{ label: '及格分数', prop: 'pass_score', align: 'center' }, { label: '及格分数', prop: 'pass_score', align: 'center' },
{ label: '操作', slots: 'table-operate', align: 'center' } { label: '操作', slots: 'table-operate', align: 'center' }
], ],
data: allLecturers.value.filter((item: any) => lecturerValue.value.find((i: any) => i === item.id)) data: props.data
} }
}) })
const addExam = ref([])
const isShowExamDialog = ref(false)
// 试卷弹窗 // // 删除考试
const dialogVisible = ref(false)
interface ListItem {
paper_title: string
id: string
}
const options = ref<ListItem[]>([])
const loading = ref(false)
// 所有被搜索出来的值
const allLecturers: any = ref([])
// 考试选中的值
const lecturerValue = ref([])
// 远程搜索
const remoteMethod = (query: string) => {
if (query) {
loading.value = true
searchExam({
paper_title: query,
limit: '100',
is_all: 1,
project_prefix: 'resourse_ci',
signature: 'UG7wBenexQhiuD2wpCwuxkU0jqcj006d',
timestamp: '32322323',
nonce: '3232'
}).then((res: any) => {
loading.value = false
options.value = res.data.data
options.value.forEach((item: any) => {
const findItem = allLecturers.value.find((cItem: any) => cItem.id === item.id)
if (!findItem) {
allLecturers.value.push(item)
}
})
})
} else {
options.value = []
}
}
watch(
() => props.data,
value => {
if (value?.length) {
const list: any = value.map((item: any) => {
return item.id
})
lecturerValue.value = list
allLecturers.value = value
options.value = value as []
}
},
{ immediate: true }
)
// 删除考试
const removeLectuter = (id: string) => { const removeLectuter = (id: string) => {
const index = lecturerValue.value.findIndex((ids: string) => ids === id) const index = addExam.value.findIndex((ids: string) => ids === id)
lecturerValue.value.splice(index, 1) addExam.value.splice(index, 1)
changeData() handleAddExam('')
} }
const handleAddExam = (val: any) => {
const changeData = () => { addExam.value = val
emit('change', lecturerValue.value) emit('change', val)
} }
</script> </script>
<template> <template>
<div> <div>
<el-button type="primary" @click="dialogVisible = true">添加课程考试</el-button> <el-button type="primary" @click="isShowExamDialog = true">添加课程考试</el-button>
<AppList v-bind="listOptions" ref="appList"> <AppList v-bind="listOptions" ref="appList">
<template #table-avatar="{ row }"> <template #table-avatar="{ row }">
<img :src="row.avatar" style="width: 50px; height: 50px; display: block; margin: 0 auto" /> <img :src="row.avatar" style="width: 50px; height: 50px; display: block; margin: 0 auto" />
...@@ -121,29 +65,10 @@ const changeData = () => { ...@@ -121,29 +65,10 @@ const changeData = () => {
<el-button plain @click="removeLectuter(row.id)">删除</el-button> <el-button plain @click="removeLectuter(row.id)">删除</el-button>
</template> </template>
</AppList> </AppList>
<el-dialog v-model="dialogVisible" width="400px" title="添加考试"> <AddExamDialog
<div style="display: flex; justify-content: center"> v-if="isShowExamDialog === true"
<el-select v-model:isShowExamDialog="isShowExamDialog"
@change="changeData" @create="handleAddExam"
v-model="lecturerValue" />
multiple
filterable
remote
reserve-keyword
placeholder="请输入试卷名称"
:remote-method="remoteMethod"
:loading="loading"
>
<el-option v-for="item in options" :key="item.id" :label="item.paper_title" :value="item.id" />
</el-select>
</div>
<template #footer>
<span class="dialog-footer">
<!-- <el-button @click="dialogVisible = false">取消</el-button> -->
<el-button type="primary" @click="dialogVisible = false">确认</el-button>
</span>
</template>
</el-dialog>
</div> </div>
</template> </template>
<style lang="scss"></style>
<script setup lang="ts">
import { searchExam } from '../../api'
import { useQuestionList } from '@/composables/useQuestionList'
const appList = ref()
let { list: selectTree } = useQuestionList()
const tabValue = ref('1')
const multipleSelection: any = ref([])
const emit = defineEmits<Emits>()
defineProps({
isShowExamDialog: {
type: Boolean,
required: true
}
})
interface Emits {
(e: 'update:isShowExamDialog', isShowExamDialog: boolean): void
(e: 'create', multipleSelection: any): void
}
const listOptions = {
remote: {
httpRequest: searchExam,
beforeRequest(params: any) {
params.paper_categories = [params.paper_categories]
return params
},
callback(data: any) {
return { list: data.data }
},
params: {
project_tag: 'resourse_ci',
id: '',
paper_title: '',
permission: tabValue,
paper_type: '',
paper_labels: '',
paper_category: '',
paper_categories: ''
}
},
filters: [
{ prop: 'classification', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'paper_title', label: '标题:' }
],
columns: [
{ type: 'selection', fixed: 'left' },
{ type: 'index', label: '序号', fixed: 'left' },
{
label: '组卷模式',
prop: 'paper_type',
computed: (row: any) => {
return row.row.paper_type === 1 ? '选题组卷' : '自动组卷'
}
},
{
label: '试卷用途',
prop: 'paper_uses',
computed: (row: any) => {
const map = { 1: '考试', 2: '课后作业', 3: '课程测试' }
return map[row.row.paper_uses] || row.row.paper_uses
}
},
{ label: '试卷分类', prop: 'paper_category.name', minWidth: 200 },
{ label: '试卷名称', prop: 'paper_title', minWidth: 200 },
{ label: '总分', prop: 'paper_total_score' },
{ label: '及格分数', prop: 'pass_score' },
{ label: '更新时间', prop: 'updated_at' }
]
}
// 资源出处 tab触发
const tabChange = () => {
appList.value?.refetch()
}
const handleCancel = () => {
emit('update:isShowExamDialog', false)
}
// 保存
const handleSave = () => {
emit('update:isShowExamDialog', false)
emit('create', multipleSelection)
}
// 筛选下拉选择tree 视频分类
const defaultProps = {
children: 'children',
label: 'category_name',
value: 'id'
}
// 刷新
const typeFilter = () => {
appList.value.refetch()
}
const handleSelectionChange = (val: any) => {
multipleSelection.value = val
}
</script>
<template>
<el-drawer :model-value="isShowExamDialog" 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-tabs>
</div>
<AppList v-bind="listOptions" ref="appList" @selection-change="handleSelectionChange">
<template #filter-type="{ params }">
<el-tree-select
@change="typeFilter"
clearable
:props="defaultProps"
v-model="params.paper_categories"
:data="selectTree"
/>
</template>
</AppList>
<div class="btn-box" style="display: flex; justify-content: center">
<el-button type="primary" @click="handleSave">保存</el-button>
</div>
</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>
...@@ -3,7 +3,6 @@ import { createCharacter, editCharacter } from '../../api' ...@@ -3,7 +3,6 @@ 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()
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
const ruleFormRef = ref<FormInstance>() const ruleFormRef = ref<FormInstance>()
// 封面状态 // 封面状态
...@@ -80,7 +79,7 @@ onMounted(() => { ...@@ -80,7 +79,7 @@ onMounted(() => {
:title="isEdit ? '编辑:章' : '新增:章'" :title="isEdit ? '编辑:章' : '新增:章'"
> >
<el-form :model="form" :rules="rules" ref="ruleFormRef" label-width="80px"> <el-form :model="form" :rules="rules" ref="ruleFormRef" label-width="80px">
<el-form-item label="章-名称:" prop="type"> <el-form-item label="章-名称:" prop="name">
<el-input v-model="form.name"></el-input> <el-input v-model="form.name"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
......
<script setup lang="ts"> <script setup lang="ts">
import { gatExamList, createCharacter } from '../../api' import { searchExam, createCharacter } from '../../api'
import { useGetCategoryList } from '@/composables/useGetCategoryList' import { useQuestionList } from '@/composables/useQuestionList'
const appList = ref() const appList = ref()
let { list: selectTree } = useGetCategoryList() let { list: selectTree } = useQuestionList()
const tabValue = ref('1') const tabValue = ref('1')
const multipleSelection: any = ref([]) const multipleSelection: any = ref([])
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
const props = defineProps({ const props = defineProps({
...@@ -16,7 +15,6 @@ const props = defineProps({ ...@@ -16,7 +15,6 @@ const props = defineProps({
type: String, type: String,
required: true required: true
}, },
chapterName: { chapterName: {
type: String, type: String,
required: true required: true
...@@ -36,23 +34,28 @@ interface Emits { ...@@ -36,23 +34,28 @@ interface Emits {
} }
const listOptions = { const listOptions = {
remote: { remote: {
httpRequest: gatExamList, httpRequest: searchExam,
beforeRequest(params: any) {
params.paper_categories = [params.paper_categories]
return params
},
callback(data: any) { callback(data: any) {
return { list: data.data } return { list: data.data }
}, },
params: { params: {
tab: tabValue, project_tag: 'resourse_ci',
id: '',
paper_title: '', paper_title: '',
is_all: 1, permission: tabValue,
project_prefix: 'x1', paper_type: '',
signature: 'UG7wBenexQhiuD2wpCwuxkU0jqcj006d', paper_labels: '',
timestamp: '32322323', paper_category: '',
nonce: '3232' paper_categories: ''
} }
}, },
filters: [ filters: [
{ prop: 'classification', label: '类别:', slots: 'filter-type' }, { prop: 'paper_categories', label: '类别:', slots: 'filter-type' },
{ type: 'input', prop: 'paper_category.name', label: '标题:' } { type: 'input', prop: 'paper_title', label: '标题:' }
], ],
columns: [ columns: [
{ type: 'selection', fixed: 'left' }, { type: 'selection', fixed: 'left' },
...@@ -118,18 +121,20 @@ const typeFilter = () => { ...@@ -118,18 +121,20 @@ 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="title"> <el-drawer
:model-value="isShowExamDialog"
draggable
:before-close="handleCancel"
size="60%"
:title="`添加${props.btnInfo.btn_name}`"
>
<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>
<el-tab-pane label="部门资源" name="2"></el-tab-pane> <el-tab-pane label="公开资源" name="2"></el-tab-pane>
<el-tab-pane label="公开资源" name="3"></el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
<AppList v-bind="listOptions" ref="appList" @selection-change="handleSelectionChange"> <AppList v-bind="listOptions" ref="appList" @selection-change="handleSelectionChange">
......
...@@ -17,11 +17,12 @@ interface IliveList { ...@@ -17,11 +17,12 @@ interface IliveList {
let liveList = ref<IliveList[]>([]) let liveList = ref<IliveList[]>([])
// 封面状态 // 封面状态
const form = reactive({ let form = reactive({
name: '' name: '',
resource_id: ''
}) })
const rules = reactive<FormRules>({ const rules = reactive<FormRules>({
name: [{ required: true, message: '请输入直播名称', trigger: 'change' }] name: [{ required: true, message: '请输入章节名称', trigger: 'change' }]
}) })
const props = defineProps({ const props = defineProps({
isShowLiveDialog: { isShowLiveDialog: {
...@@ -60,8 +61,7 @@ const handleConfirm = () => { ...@@ -60,8 +61,7 @@ const handleConfirm = () => {
{ {
course_id: props.course_id, course_id: props.course_id,
resource_type: props.btnInfo.resource_type, resource_type: props.btnInfo.resource_type,
parent_id: props.chapterID, parent_id: props.chapterID
resource_id: lecturerValue.value[0]
}, },
form form
) )
...@@ -71,9 +71,8 @@ const handleConfirm = () => { ...@@ -71,9 +71,8 @@ const handleConfirm = () => {
}) })
} }
const loading = ref(false) const loading = ref(false)
// 直播选中的值 // 直播选中的值
const lecturerValue = ref([]) // const lecturerValue = ref('')
// 所有被搜索出来的值 // 所有被搜索出来的值
const allLecturers: any = ref([]) const allLecturers: any = ref([])
...@@ -94,19 +93,29 @@ const handleLiveList = (query: string) => { ...@@ -94,19 +93,29 @@ const handleLiveList = (query: string) => {
liveList.value = [] liveList.value = []
} }
} }
const changeLive = (val: any) => {
if (val !== '') {
form.name = allLecturers.value?.filter((item: any) => item.id === val)[0].subject
} else {
form.name = ''
}
}
</script> </script>
<template> <template>
<el-dialog :model-value="isShowLiveDialog" draggable :before-close="handleCancel" width="30%" title="添加直播"> <el-dialog :model-value="isShowLiveDialog" draggable :before-close="handleCancel" width="30%" title="添加直播">
<el-form :model="form" :rules="rules" ref="ruleFormRef" label-width="120px"> <el-form :model="form" :rules="rules" ref="ruleFormRef" label-width="120px">
<el-form-item props="lecturerValue" label="直播名称:"> {{ form.resource_id }}
<el-form-item props="form.resource_id" label="直播名称:">
<el-select <el-select
v-model="lecturerValue" v-model="form.resource_id"
clearable
filterable filterable
remote remote
reserve-keyword placeholder="请输入直播名称或者直播id"
placeholder="请输入直播名称"
:remote-method="handleLiveList" :remote-method="handleLiveList"
:loading="loading" :loading="loading"
style="width: 200px"
@change="changeLive"
> >
<el-option v-for="item in liveList" :key="item.id" :label="item.subject" :value="item.id" /> <el-option v-for="item in liveList" :key="item.id" :label="item.subject" :value="item.id" />
</el-select> </el-select>
......
...@@ -79,10 +79,10 @@ onMounted(() => { ...@@ -79,10 +79,10 @@ onMounted(() => {
:title="props.isEdit ? '编辑:节' : '新增:节'" :title="props.isEdit ? '编辑:节' : '新增:节'"
> >
<el-form :model="form" :rules="rules" ref="ruleFormRef" label-width="80px"> <el-form :model="form" :rules="rules" ref="ruleFormRef" label-width="80px">
<el-form-item label="所属章:" prop="type"> <el-form-item label="所属章:" prop="chapterName">
<p>{{ chapterName }}</p> <p>{{ chapterName }}</p>
</el-form-item> </el-form-item>
<el-form-item label="节-名称:" prop="type"> <el-form-item label="节-名称:" prop="name">
<el-input v-model="form.name"></el-input> <el-input v-model="form.name"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
......
...@@ -49,9 +49,6 @@ const defaultProps = { ...@@ -49,9 +49,6 @@ const defaultProps = {
const typeFilter = () => { const typeFilter = () => {
appList.value.refetch() appList.value.refetch()
} }
const title = computed(() => {
return `添加${props.btnInfo.btn_name}`
})
const listOptions = computed(() => { const listOptions = computed(() => {
console.log(props.btnInfo.resource_type) console.log(props.btnInfo.resource_type)
...@@ -110,7 +107,13 @@ const handleSave = () => { ...@@ -110,7 +107,13 @@ const handleSave = () => {
</script> </script>
<template> <template>
<el-drawer :model-value="isShowAddDialog" draggable :before-close="handleCancel" size="60%" :title="title"> <el-drawer
:model-value="isShowAddDialog"
draggable
:before-close="handleCancel"
size="60%"
:title="`添加${props.btnInfo.btn_name}`"
>
<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>
......
...@@ -10,9 +10,9 @@ const props: any = defineProps<{ data: object; tabIndex: string }>() ...@@ -10,9 +10,9 @@ const props: any = defineProps<{ data: object; tabIndex: string }>()
<div class="cover-img" :style="`background-image:url(${props.data.cover})`"></div> <div class="cover-img" :style="`background-image:url(${props.data.cover})`"></div>
<div class="tool-pop-btn"> <div class="tool-pop-btn">
<div style="min-width: 100%"> <div style="min-width: 100%">
<router-link v-if="props.data.auth_edit" :to="`/resource/video/update?id=${props.data.id}`"> <!-- <router-link v-if="props.data.auth_edit" :to="`/resource/video/update?id=${props.data.id}`">
<div class="edit-btn">编辑</div> <div class="edit-btn">编辑</div>
</router-link> </router-link> -->
</div> </div>
<div style="min-width: 100%"> <div style="min-width: 100%">
<router-link v-if="props.data.auth_view" :to="`/resource/video/view?id=${props.data.id}`"> <router-link v-if="props.data.auth_view" :to="`/resource/video/view?id=${props.data.id}`">
......
<script lang="ts" setup> <script lang="ts" setup>
import { Plus } from '@element-plus/icons-vue' import { Plus } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { getCharacter, delCharacter, getVideoDetails, dragChapterList } from '../api'
import {
getCharacter,
delCharacter,
getVideoDetails,
getCourseWareDetails,
getLessonDetails,
dragChapterList,
getOtherDetails
} from '../api'
import AddSectionDialog from '../components/stepTwoComponents/AddSectionDialog.vue' import AddSectionDialog from '../components/stepTwoComponents/AddSectionDialog.vue'
import AddLiveDialog from '../components/stepTwoComponents/AddLiveDialog.vue' import AddLiveDialog from '../components/stepTwoComponents/AddLiveDialog.vue'
import AddVideoDialog from '../components/stepTwoComponents/AddVideoDialog.vue' import AddVideoDialog from '../components/stepTwoComponents/AddVideoDialog.vue'
...@@ -34,9 +24,6 @@ const chapterID = ref('') ...@@ -34,9 +24,6 @@ const chapterID = ref('')
const btnInfo = ref({}) // 按钮信息 const btnInfo = ref({}) // 按钮信息
const isEdit = ref(false) const isEdit = ref(false)
const videoUrl = ref('') const videoUrl = ref('')
// const courseUrl = ref('')
// const lessonPlanUrl = ref('')
const otherUrl = ref('')
const btnList = [ const btnList = [
{ {
btn_name: '视频', btn_name: '视频',
...@@ -84,7 +71,6 @@ const handleChapterList = () => { ...@@ -84,7 +71,6 @@ const handleChapterList = () => {
// 新增章节 // 新增章节
const handleAddChapter = () => { const handleAddChapter = () => {
isShowDialog.value = true isShowDialog.value = true
console.log(isShowDialog.value)
isEdit.value = false isEdit.value = false
} }
// 页面刷新 // 页面刷新
...@@ -93,10 +79,8 @@ const handleFresh = () => { ...@@ -93,10 +79,8 @@ const handleFresh = () => {
} }
// 添加小节 // 添加小节
const handleAddSection = (node: any) => { const handleAddSection = (node: any) => {
console.log(node, 'oooo')
chapterName.value = node.label chapterName.value = node.label
chapterID.value = node.key chapterID.value = node.key
console.log(isShowSectionDialog.value)
isShowSectionDialog.value = true isShowSectionDialog.value = true
} }
//编辑章节 //编辑章节
...@@ -113,10 +97,12 @@ const handleEdit = (node: any) => { ...@@ -113,10 +97,12 @@ const handleEdit = (node: any) => {
} }
// 删除章节 // 删除章节
const handleDel = (node: any) => { const handleDel = (node: any) => {
const params = { id: node.key, course_id: id } ElMessageBox.confirm('确定要删除吗?', '提示').then(() => {
delCharacter(params).then(() => { const params = { id: node.key, course_id: id }
ElMessage.success('删除成功') delCharacter(params).then(() => {
handleFresh() ElMessage.success('删除成功')
handleFresh()
})
}) })
} }
...@@ -138,9 +124,7 @@ const handleAddDialog = (node: any, item: any) => { ...@@ -138,9 +124,7 @@ const handleAddDialog = (node: any, item: any) => {
isShowExamDialog.value = true isShowExamDialog.value = true
} }
} }
//查阅 //查阅
const handleConsult = (node: any) => { const handleConsult = (node: any) => {
console.log(node.data.resource_type, '000') console.log(node.data.resource_type, '000')
// 视频 // 视频
...@@ -153,25 +137,10 @@ const handleConsult = (node: any) => { ...@@ -153,25 +137,10 @@ const handleConsult = (node: any) => {
} }
// 下载 // 下载
const handleDownload = (node: any) => { const handleDownload = (node: any) => {
if (node.data.resource_type === '10') { console.log(node.data.resource.can_view)
// 课件 window.open(node.data.resource.url)
getCourseWareDetails({ id: node.data.resource_id }).then((res: any) => {
otherUrl.value = res.data.url
window.open(otherUrl.value)
})
} else if (node.data.resource_type === '11') {
//教案
getLessonDetails({ id: node.data.resource_id }).then(res => {
otherUrl.value = res.data.url
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)
})
}
} }
//拖拽
const allowDrop = (draggingNode: any, dropNode: any, type: any) => { const allowDrop = (draggingNode: any, dropNode: any, type: any) => {
console.log(draggingNode.data, dropNode, type) console.log(draggingNode.data, dropNode, type)
if (draggingNode.data.depth === dropNode.data.depth) { if (draggingNode.data.depth === dropNode.data.depth) {
...@@ -185,6 +154,7 @@ const allowDrop = (draggingNode: any, dropNode: any, type: any) => { ...@@ -185,6 +154,7 @@ const allowDrop = (draggingNode: any, dropNode: any, type: any) => {
return false return false
} }
} }
//拖拽列表
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 = {
...@@ -225,12 +195,14 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) => ...@@ -225,12 +195,14 @@ const handleDrop = (startNode: any, endNode: any, position: any, event: any) =>
class="btn_edit" class="btn_edit"
v-if="data.depth === '3' && node.data.resource_type === '2'" v-if="data.depth === '3' && node.data.resource_type === '2'"
@click="handleConsult(node)" @click="handleConsult(node)"
:disabled="node.data.resource.can_view !== true"
>查阅</el-link >查阅</el-link
> >
<el-link <el-link
class="btn_edit" class="btn_edit"
v-if="data.depth === '3' && node.data.resource_type !== '2' && node.data.resource_type !== '6'" v-if="data.depth === '3' && node.data.resource_type !== '2' && node.data.resource_type !== '6'"
@click="handleDownload(node)" @click="handleDownload(node)"
:disabled="node.data.resource.can_view !== true"
>下载</el-link >下载</el-link
> >
......
...@@ -9,14 +9,14 @@ const props: any = defineProps<{ data: object; tabIndex: string }>() ...@@ -9,14 +9,14 @@ const props: any = defineProps<{ data: object; tabIndex: string }>()
<div class="cover-img" :style="`background-image:url(${props.data.cover})`"></div> <div class="cover-img" :style="`background-image:url(${props.data.cover})`"></div>
<div class="tool-pop-btn"> <div class="tool-pop-btn">
<div style="min-width: 100%"> <div style="min-width: 100%">
<router-link v-if="props.data.auth_view" :to="`/resource/video/view?id=${props.data.id}`"> <router-link v-if="props.data.auth_edit" :to="`/resource/video/update?id=${props.data.id}`">
<div class="view-btn">查看</div> <div class="edit-btn">编辑</div>
</router-link> </router-link>
</div> </div>
<div style="min-width: 100%"> <div style="min-width: 100%">
<!-- <router-link v-if="props.data.auth_view" :to="`/resource/video/view?id=${props.data.id}`"> --> <router-link v-if="props.data.auth_view" :to="`/resource/video/view?id=${props.data.id}`">
<div class="view-btn">选择</div> <div class="view-btn">查看</div>
<!-- </router-link> --> </router-link>
</div> </div>
</div> </div>
</div> </div>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论