提交 d30e3348 authored 作者: lihuihui's avatar lihuihui
......@@ -2,6 +2,8 @@
import TopInfo from '../components/TopInfo.vue'
import CenterInfo from '../components/CenterInfo.vue'
import BottomInfo from '../components/BottomInfo.vue'
import Operation from '../components/Operation.vue'
import { getCourseDetails } from '../api'
const router = useRouter()
......
......@@ -13,6 +13,37 @@ export function getLessonList(params?: {
}
// 创建教案
export function createLessonPlan(data: { name: string; source: string; classification: string; knowledge_points: string; url: string; type: string; size: string }) {
export function createLessonPlan(data: {
name: string
source: string
classification: string
knowledge_points: string
url: string
type: string
size: string
}) {
return httpRequest.post('/api/resource/v1/resource/lesson-plan/create', data)
}
// 获取教案详情
export function getLessonDetails(params: { id: string }) {
return httpRequest.get('/api/resource/v1/resource/lesson-plan/view', { params })
}
// 部门共享
export function setDepartment(data: { id: string }) {
return httpRequest.post('/api/resource/v1/resource/lesson-plan/set-department', data)
}
// 平台共享
export function setPlatform(data: { id: string }) {
return httpRequest.post('/api/resource/v1/resource/lesson-plan/set-platform', data)
}
// 上下线
export function setStatus(data: { id: string }) {
return httpRequest.post('/api/resource/v1/resource/lesson-plan/set-status', data)
}
// 更改负责人
export function setBelong(data: { id: string; belong_operator: string }) {
return httpRequest.post('/api/resource/v1/resource/lesson-plan/set-belong', data)
}
<script setup lang="ts">
import { setDepartment, setPlatform, setStatus, getProjectList, setBelong } from '../api'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useMapStore } from '@/stores/map'
const store = useMapStore()
console.log(store)
const router = useRouter()
const props = defineProps(['data'])
const path = router.currentRoute.value.path
console.log(path, 'path')
// 详情id
const id = router.currentRoute.value.query.id as string
// 设置部门共享
const handleDepartment = () => {
ElMessageBox.confirm(
`
${
props.data.status == 0
? `该操作将会使本教案资源在您所在的部门“${props.data.organ_id_name}”内部共享,管理者不变,其余人员只能共享使用该资源,确认部门共享吗?`
: `该操作将会取消本教案资源在您所在的部门“${props.data.organ_id_name}”内部共享,部门其余人员将不能再看到该共享资源,确认取消部门共享吗?`
}
`,
'提示',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
setDepartment({ id: id }).then((res: any) => {
if (res.code === 0) {
ElMessage({ message: '更改成功', type: 'success' })
setTimeout(() => {
router.go(0)
}, 500)
}
})
})
}
// 设置平台共享
const handlePlatform = () => {
ElMessageBox.confirm(
`
${
props.data.platform_public == 0
? '该操作将会使本教案资源在e-SaaS平台中公开共享供所有老师使用,资源的管理者不变,其余人员只能共享使用该资源,确认公开该资源吗?'
: '该操作将会取消本教案资源在e-SaaS平台中公开共享,平台所有人员将不能再看到该共享资源,确认取消平台共享吗?'
}
`,
'提示',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
setPlatform({ id: id }).then((res: any) => {
if (res.code === 0) {
ElMessage({ message: '更改成功', type: 'success' })
setTimeout(() => {
router.go(0)
}, 500)
}
})
})
}
// 上下线设置
const handleStatus = () => {
ElMessageBox.confirm(
`
${props.data.status == 0 ? '已下线的资源将不能被关联到课程使用,确认下线该资源吗?' : '确认再次上线该资源吗?'}
`,
'提示',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
setStatus({ id: id }).then((res: any) => {
if (res.code === 0) {
ElMessage({ message: '更改成功', type: 'success' })
setTimeout(() => {
router.go(0)
}, 500)
}
})
})
}
// 更该负责人
const form = reactive({
members: ''
})
const dialogFormVisible = ref(false)
// 人员列表
let members: any = ref([])
const getMembers = () => {
getProjectList({ organization_id: props.data.organ_id }).then((res: any) => {
members.value = res.data.members
})
}
// 点击更改负责人按钮弹窗
const handleMembers = () => {
getMembers()
dialogFormVisible.value = true
}
// 更改负责人确定
const handlesetBelong = () => {
setBelong({ id: id, belong_operator: form.members }).then((res: any) => {
if (res.code === 0) {
ElMessage({ message: '更改成功', type: 'success' })
setTimeout(() => {
dialogFormVisible.value = false
}, 500)
}
})
}
</script>
<template>
<div class="tool-btn-box" v-if="$route.query.id" style="margin-bottom: 20px">
<template v-if="path === '/resource/lessonplan/view'">
<router-link :to="`/resource/lessonplan/update?id=${id}`">
<div class="btn-item">编辑教案信息</div>
</router-link>
</template>
<div class="btn-item" @click="handleDepartment">
{{ props.data.department_public == 0 ? '部门共享' : '取消部门共享' }}
</div>
<div class="btn-item" @click="handlePlatform">
{{ props.data.platform_public == 0 ? '平台共享' : '取消平台共享' }}
</div>
<div class="btn-item" @click="handleStatus">{{ props.data.status == 0 ? '资源上线' : '资源下线' }}</div>
<div class="btn-item" @click="handleMembers">更改负责人</div>
</div>
<el-dialog v-model="dialogFormVisible" title="更改负责人" center>
<el-form :model="form">
<el-form-item>
<div style="width: 500px">
<el-row>
<el-col :span="12"
><div class="grid-content ep-bg-purple" />
资源创建人: {{ props.data.created_operator_name }}
</el-col>
<el-col :span="12"
><div class="grid-content ep-bg-purple-light" />
创建时间: {{ props.data.created_time }}
</el-col>
</el-row>
<el-row>
<el-col :span="12"
><div class="grid-content ep-bg-purple" />
资源负责人: {{ props.data.belong_operator_name }}
</el-col>
<el-col :span="12"
><div class="grid-content ep-bg-purple-light" />
更新时间: {{ props.data.updated_time }}
</el-col>
</el-row>
</div>
<el-select style="width: 500px; margin-top: 20px" v-model="form.members" placeholder="请选择新的资源负责人">
<el-option v-for="item in members" :label="item.name" :value="item.id" :key="item.id" />
</el-select>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button type="primary" @click="handlesetBelong">确认</el-button>
</span>
</template>
</el-dialog>
</template>
<style lang="scss" scoped>
.tool-btn-box {
display: flex;
justify-content: right;
.btn-item {
width: 127px;
line-height: 36px;
background: #aa1941;
border-radius: 20px;
margin-right: 10px;
font-size: 14px;
color: #ffffff;
text-align: center;
cursor: pointer;
}
}
</style>
......@@ -2,6 +2,10 @@
import TopInfo from '../components/TopInfo.vue'
import CenterInfo from '../components/CenterInfo.vue'
import BottomInfo from '../components/BottomInfo.vue'
import Operation from '../components/Operation.vue'
import { getLessonDetails } from '../api'
const router = useRouter()
const listOptions = {
columns: [
{ label: '课程图片', prop: 'img', align: 'center' },
......@@ -20,25 +24,33 @@ const listOptions = {
{ img: 5, cursor_name: '宏观经济学.pptx', type_name: '5', zhang: '5', jie: '吉林师范大学', update: '王重阳' }
]
}
const id = router.currentRoute.value.query.id as string
// 获取详情
let lessonDetails: any = ref({})
getLessonDetails({ id: id }).then((res: any) => {
lessonDetails.value = res.data
})
</script>
<template>
<AppCard title="课件资源信息">
<div class="btn-box">
<!-- <div class="btn-box">
<div class="btn-item">部门共享</div>
<div class="btn-item">平台共享</div>
<div class="btn-item">资源下线</div>
<div class="btn-item">更改负责人</div>
</div>
<TopInfo></TopInfo>
<CenterInfo></CenterInfo>
</div> -->
<Operation :data="lessonDetails" style="margin-bottom: 20px"></Operation>
<TopInfo :data="lessonDetails"></TopInfo>
<CenterInfo v-if="Object.keys(lessonDetails).length" :data="lessonDetails"></CenterInfo>
<BottomInfo></BottomInfo>
</AppCard>
<AppCard title="课件资源关联使用课程">
<AppList v-bind="listOptions" ref="appList" stripe>
<template #table-operate="{ row }">
<el-space>
<router-link :to="`/video/update/${row.id}`">
<router-link :to="`/video/update/?id=${row.id}`">
<el-button style="color: #399ee8" type="primary" link>查看</el-button>
</router-link>
</el-space>
......
......@@ -2,6 +2,7 @@
import TopInfo from '../components/TopInfo.vue'
import CenterInfo from '../components/CenterInfo.vue'
import BottomInfo from '../components/BottomInfo.vue'
import Operation from '../components/Operation.vue'
import { getOtherDetails } from '../api'
const router = useRouter()
......
......@@ -74,11 +74,7 @@ onMounted(() => {
if (props.isEdit) {
form.name = props.rowInfo.name
form.key = props.rowInfo.key
if (props.rowInfo.status === '有效') {
form.status = '1'
} else {
form.status = '0'
}
form.status = props.rowInfo.status
form.remark = props.rowInfo.remark
}
})
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论