提交 75f84279 authored 作者: lihuihui's avatar lihuihui

更改文件目录

上级 bab50a3f
import { getCategoryList } from '@/api/base'
export function useCategory() {
let list = $ref([])
onMounted(() => {
getCategoryList({ type: 'tree' }).then((res: any) => {
list = res.data
console.log(list)
})
})
return { list }
}
\ No newline at end of file
<script setup lang="ts"> <script setup lang="ts">
import TopInfo from '../components/view/TopInfo.vue' import TopInfo from '../components/TopInfo.vue'
import CenterInfo from '../components/view/CenterInfo.vue' import CenterInfo from '../components/CenterInfo.vue'
import BottomInfo from '../components/view/BottomInfo.vue' import BottomInfo from '../components/BottomInfo.vue'
import { getCourseDetails } from '../api' import { getCourseDetails } from '../api'
const router = useRouter() const router = useRouter()
......
import httpRequest from '@/utils/axios' import httpRequest from '@/utils/axios'
// 获取视频列表 // 获取教案列表
export function getVideoList(params?: { type?: string; page?: number; page_size?: number }) { export function getLessonList(params?: {
return httpRequest.get('/api/psp/backend/video/index', { params }) tab: string
status?: string
authorized?: string
classification?: string
page?: number
['per-page']?: number
}) {
return httpRequest.get('/api/resource/v1/resource/lesson-plan/list', { params })
} }
// 创建视频 // 获取项目列表
export function createVideo(data: { course_name: string; cover_page: string; type: string; weight?: string }) { export function getProjectList(params: { organization_id: string }) {
return httpRequest.post('/api/psp/backend/video/create', data) return httpRequest.get('/api/resource/v1/util/members', { params })
} }
// 获取分类列表
// 更新视频 export function getCategoryList(params: { type: string; category_name?: string }) {
export function updateVideo(data: { id: string; course_name: string; cover_page: string; type: string; weight?: string }) { return httpRequest.get('/api/resource/v1/backend/category/list', { params })
return httpRequest.post('/api/psp/backend/video/update', data)
} }
// 获取视频详情 // 创建教案
export function getVideo(params: { id: string }) { export function createLessonPlan(data: { name: string; source: string; classification: string; knowledge_points: string; url: string; type: string; size: string }) {
return httpRequest.get('/api/psp/backend/video/view', { params }) return httpRequest.post('/api/resource/v1/resource/lesson-plan/create', data)
} }
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import { getCategoryList } from '@/api/base' import { getCategoryList } from '@/api/base'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { createLessonPlan } from '../api'
// 路由 // 路由
const router = useRouter() const router = useRouter()
...@@ -38,6 +39,12 @@ ...@@ -38,6 +39,12 @@
return return
} }
const id = router.currentRoute.value.query.id as string const id = router.currentRoute.value.query.id as string
const formFile = form.file[0]
form.url = formFile.url
form.type = formFile.type
form.size = formFile.size
const params = Object.assign({}, form)
delete params.file
if (id !== '' && id) { if (id !== '' && id) {
// const params = Object.assign({ id: id }, form) // const params = Object.assign({ id: id }, form)
// updateVideo(params).then((res: any) => { // updateVideo(params).then((res: any) => {
...@@ -51,16 +58,16 @@ ...@@ -51,16 +58,16 @@
// } // }
// }) // })
} else { } else {
// createVideo(form).then((res:any) => { createLessonPlan(params).then((res:any) => {
// if (res.code === 0) { if (res.code === 0) {
// ElMessage({ message: '创建成功', type: 'success' }) ElMessage({ message: '创建成功', type: 'success' })
// setTimeout(() => { setTimeout(() => {
// router.push({ router.push({
// path: '/resource/video' path: '/resource/lessonplan'
// }) })
// }, 1000) }, 1000)
// } }
// }) })
} }
} else { } else {
......
<script setup lang="ts"> <script setup lang="ts">
import TopInfo from '../components/view/TopInfo.vue' import TopInfo from '../components/TopInfo.vue'
import CenterInfo from '../components/view/CenterInfo.vue' import CenterInfo from '../components/CenterInfo.vue'
import BottomInfo from '../components/view/BottomInfo.vue' import BottomInfo from '../components/BottomInfo.vue'
const listOptions = { const listOptions = {
columns: [ columns: [
{ label: '课程图片', prop: 'img', align: 'center' }, { label: '课程图片', prop: 'img', align: 'center' },
...@@ -39,12 +39,7 @@ const listOptions = { ...@@ -39,12 +39,7 @@ const listOptions = {
<template #table-operate="{ row }"> <template #table-operate="{ row }">
<el-space> <el-space>
<router-link :to="`/video/update/${row.id}`"> <router-link :to="`/video/update/${row.id}`">
<el-button <el-button style="color: #399ee8" type="primary" link>查看</el-button>
style="color: #399EE8;"
type="primary"
link
>查看</el-button
>
</router-link> </router-link>
</el-space> </el-space>
</template> </template>
...@@ -52,17 +47,17 @@ const listOptions = { ...@@ -52,17 +47,17 @@ const listOptions = {
</AppCard> </AppCard>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.btn-box{ .btn-box {
display: flex; display: flex;
justify-content: right; justify-content: right;
.btn-item{ .btn-item {
width: 127px; width: 127px;
line-height: 36px; line-height: 36px;
background: #AA1941; background: #aa1941;
border-radius: 20px; border-radius: 20px;
margin-right: 10px; margin-right: 10px;
font-size: 14px; font-size: 14px;
color: #FFFFFF; color: #ffffff;
text-align: center; text-align: center;
} }
} }
......
<script setup lang="ts"> <script setup lang="ts">
import { getVideoList, getProjectList } from '../api' import { getVideoList, getProjectList } from '../api'
import { getCategoryList } from '@/api/base' // import { getCategoryList } from '@/api/base'
import CardListItem from '../components/CardListItem.vue' import CardListItem from '../components/CardListItem.vue'
import { Expand, Search } from '@element-plus/icons-vue' import { Expand, Search } from '@element-plus/icons-vue'
import { useCategory } from '@/composables/useCategory'
// 筛选项目列表 // 筛选项目列表
let projectList: any = $ref([]) let projectList: any = $ref([])
...@@ -17,7 +18,6 @@ const tabChange = () => { ...@@ -17,7 +18,6 @@ const tabChange = () => {
appList.value.refetch() appList.value.refetch()
} }
// 列表切换 // 列表切换
const isCard = ref(false) const isCard = ref(false)
...@@ -62,10 +62,11 @@ const listOptions = $computed(() => { ...@@ -62,10 +62,11 @@ const listOptions = $computed(() => {
}) })
// 下拉选择tree 视频分类 // 下拉选择tree 视频分类
let selectTree = $ref([]) let { list: selectTree } = useCategory()
getCategoryList({ type: 'tree' }).then((res: any) => { console.log(selectTree)
selectTree = res.data // getCategoryList({ type: 'tree' }).then((res: any) => {
}) // selectTree = res.data
// })
const defaultProps = { const defaultProps = {
children: 'children', children: 'children',
label: 'category_name', label: 'category_name',
...@@ -91,7 +92,7 @@ const defaultProps = { ...@@ -91,7 +92,7 @@ const defaultProps = {
<AppList v-bind="listOptions" ref="appList"> <AppList v-bind="listOptions" ref="appList">
<template #header-aside></template> <template #header-aside></template>
<template #table-cover="{ row }"> <template #table-cover="{ row }">
<img :src="row.cover" style="width:150px;display: block;"> <img :src="row.cover" style="width: 150px; display: block" />
</template> </template>
<template #filter-type="{ params }"> <template #filter-type="{ params }">
<el-tree-select :props="defaultProps" v-model="params.classification" :data="selectTree" /> <el-tree-select :props="defaultProps" v-model="params.classification" :data="selectTree" />
...@@ -121,8 +122,8 @@ const defaultProps = { ...@@ -121,8 +122,8 @@ const defaultProps = {
</AppCard> </AppCard>
</template> </template>
<style lang="scss"> <style lang="scss">
.card-list{ .card-list {
background: #FAFAFA; background: #fafafa;
padding: 20px; padding: 20px;
display: flex; display: flex;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论