提交 5ec334f0 authored 作者: matian's avatar matian

bug fixes

上级 daa7a5cb
...@@ -12,7 +12,10 @@ const form = reactive({ ...@@ -12,7 +12,10 @@ const form = reactive({
resource_id: '' resource_id: ''
}) })
const rules = reactive<FormRules>({ const rules = reactive<FormRules>({
name: [{ required: true, message: '请输入章名称', trigger: 'blur' }] name: [
{ required: true, message: '请输入章名称', trigger: 'blur' },
{ min: 1, max: 25, trigger: 'blur' }
]
}) })
const props = defineProps({ const props = defineProps({
isShowDialog: { isShowDialog: {
...@@ -80,7 +83,7 @@ onMounted(() => { ...@@ -80,7 +83,7 @@ onMounted(() => {
> >
<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="name"> <el-form-item label="章-名称:" prop="name">
<el-input v-model="form.name"></el-input> <el-input v-model="form.name" maxlength="25"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
......
...@@ -83,7 +83,7 @@ onMounted(() => { ...@@ -83,7 +83,7 @@ onMounted(() => {
<p>{{ chapterName }}</p> <p>{{ chapterName }}</p>
</el-form-item> </el-form-item>
<el-form-item label="节-名称:" prop="name"> <el-form-item label="节-名称:" prop="name">
<el-input v-model="form.name"></el-input> <el-input v-model="form.name" maxlength="25"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
......
...@@ -230,7 +230,7 @@ const createCourseForm = () => { ...@@ -230,7 +230,7 @@ const createCourseForm = () => {
<!-- 添加考试 --> <!-- 添加考试 -->
<AddExam :data="examList" @change="changeExam" style="width: 100%"></AddExam> <AddExam :data="examList" @change="changeExam" style="width: 100%"></AddExam>
</el-form-item> </el-form-item>
<el-form-item label="课程考试:" prop="live_id"> <el-form-item label="周期性直播" prop="live_id">
<!-- 添加直播 --> <!-- 添加直播 -->
<AddLive :data="liveList" @change="changeLive" style="width: 100%"></AddLive> <AddLive :data="liveList" @change="changeLive" style="width: 100%"></AddLive>
</el-form-item> </el-form-item>
......
...@@ -373,7 +373,7 @@ const imgUrl = (node: any) => { ...@@ -373,7 +373,7 @@ const imgUrl = (node: any) => {
color: #b2833d; color: #b2833d;
border: none; border: none;
border-radius: 16px; border-radius: 16px;
margin: 8px; margin: 3px;
} }
.btn_edit { .btn_edit {
color: #b2833d; color: #b2833d;
......
...@@ -11,7 +11,9 @@ const router = useRouter() ...@@ -11,7 +11,9 @@ const router = useRouter()
const route = useRoute() const route = useRoute()
const props = defineProps(['data']) const props = defineProps(['data'])
const emit = defineEmits<{
(e: 'update'): void
}>()
// 详情id // 详情id
const id = route.query.id as string const id = route.query.id as string
// 设置部门共享 // 设置部门共享
...@@ -37,6 +39,7 @@ const handleDepartment = () => { ...@@ -37,6 +39,7 @@ const handleDepartment = () => {
setTimeout(() => { setTimeout(() => {
router.go(0) router.go(0)
}, 500) }, 500)
emit('update')
} }
}) })
}) })
...@@ -65,6 +68,7 @@ const handlePlatform = () => { ...@@ -65,6 +68,7 @@ const handlePlatform = () => {
setTimeout(() => { setTimeout(() => {
router.go(0) router.go(0)
}, 500) }, 500)
emit('update')
} }
}) })
}) })
...@@ -93,6 +97,7 @@ const handleStatus = () => { ...@@ -93,6 +97,7 @@ const handleStatus = () => {
setTimeout(() => { setTimeout(() => {
router.go(0) router.go(0)
}, 500) }, 500)
emit('update')
} }
}) })
}) })
...@@ -118,6 +123,7 @@ const handlesetBelong = () => { ...@@ -118,6 +123,7 @@ const handlesetBelong = () => {
setBelong({ id: id, belong_operator: form.members }).then((res: any) => { setBelong({ id: id, belong_operator: form.members }).then((res: any) => {
if (res.code === 0) { if (res.code === 0) {
ElMessage({ message: '更改成功', type: 'success' }) ElMessage({ message: '更改成功', type: 'success' })
emit('update')
setTimeout(() => { setTimeout(() => {
dialogFormVisible.value = false dialogFormVisible.value = false
}, 500) }, 500)
...@@ -134,6 +140,7 @@ const courseAuthorizeConfirm = () => { ...@@ -134,6 +140,7 @@ const courseAuthorizeConfirm = () => {
if (res.code === 0) { if (res.code === 0) {
ElMessage({ message: '授权成功', type: 'success' }) ElMessage({ message: '授权成功', type: 'success' })
dialogVisibleAuthorize.value = false dialogVisibleAuthorize.value = false
emit('update')
} }
}) })
} }
......
...@@ -85,6 +85,85 @@ const basicInfo = computed((): IBasicInfo[] => { ...@@ -85,6 +85,85 @@ const basicInfo = computed((): IBasicInfo[] => {
}) })
return basicList return basicList
}) })
const add0 = (m: number) => {
return m < 10 ? '0' + m : m
}
const format = (n: number) => {
const time = new Date(n)
const y = time.getFullYear()
const m = time.getMonth() + 1
const d = time.getDate()
const h = time.getHours()
const mm = time.getMinutes()
const s = time.getSeconds()
return y + '-' + add0(m) + '-' + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s)
}
const listOptions = computed(() => {
return {
data: props.data.examinations,
columns: [
{
label: '试卷名称',
prop: 'paper_title'
},
{
label: '组卷模式',
prop: 'paper_type',
computed: (row: any) => {
return row.row.paper_type === 1 ? '选题组卷' : '自动组卷'
}
},
{
label: '试卷用途',
prop: 'paper_uses',
computed: (row: any) => {
if (row.row.paper_type === 1) {
return '考试'
} else if (row.row.paper_type === 2) {
return '课后作业'
} else if (row.row.paper_type === 3) {
return '课程测试'
}
}
},
{ label: '总分', prop: 'paper_total_score', align: 'center' },
{ label: '及格分数', prop: 'pass_score', align: 'center' }
]
}
})
const liveOptions = computed(() => {
return {
data: props.data.meetings,
columns: [
{ label: '会议code', prop: 'meeting_code', align: 'center' },
{ label: '主题', prop: 'subject', align: 'center' },
{
label: '开始时间',
prop: 'start_time',
align: 'center',
computed({ row }: any) {
if (row.start_time === undefined) {
return '-'
} else {
return format(parseInt(row.start_time) * 1000)
}
}
},
{
label: '结束时间',
prop: 'end_time',
align: 'center',
computed({ row }: any) {
if (row.end_time === undefined) {
return '-'
} else {
return format(parseInt(row.end_time) * 1000)
}
}
}
]
}
})
</script> </script>
<template> <template>
<div class="info-box"> <div class="info-box">
...@@ -100,12 +179,20 @@ const basicInfo = computed((): IBasicInfo[] => { ...@@ -100,12 +179,20 @@ const basicInfo = computed((): IBasicInfo[] => {
</div> </div>
</div> </div>
</div> </div>
<div class="bottom-info"> <div class="bottom-info">
<div class="lecturer-list"> <div class="lecturer-list">
<div class="item" v-for="item in props.data.lecturers" :key="item.id"> <div v-for="item in props.data.lecturers" :key="item.id">
<el-popover placement="top-start" :title="item.name" trigger="hover">
<div v-html="item.summarize"></div>
<template #reference>
<div class="item">
<div class="avatar" :style="`background-image:url(${item.avatar})`"></div> <div class="avatar" :style="`background-image:url(${item.avatar})`"></div>
<div class="name">{{ item.name }}</div> <div class="name">{{ item.name }}</div>
</div> </div>
</template>
</el-popover>
</div>
</div> </div>
<div class="other-info"> <div class="other-info">
<div class="item"> <div class="item">
...@@ -122,7 +209,9 @@ const basicInfo = computed((): IBasicInfo[] => { ...@@ -122,7 +209,9 @@ const basicInfo = computed((): IBasicInfo[] => {
<div class="item"> <div class="item">
<img src="https://webapp-pub.oss-cn-beijing.aliyuncs.com/center_resource/course-view-icon12.png" /> <img src="https://webapp-pub.oss-cn-beijing.aliyuncs.com/center_resource/course-view-icon12.png" />
<div class="label">课程授权信息</div> <div class="label">课程授权信息</div>
<div class="value" v-for="(item, index) in props.data" :key="index">{{ item.department_name }}</div> <div class="value" v-for="(item, index) in props.data.auth_departments" :key="index">
{{ item.department_name }}
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -139,6 +228,12 @@ const basicInfo = computed((): IBasicInfo[] => { ...@@ -139,6 +228,12 @@ const basicInfo = computed((): IBasicInfo[] => {
<el-form-item label="授课目标:"> <el-form-item label="授课目标:">
<v-editor disabled v-model="form.target" class="editor" :height="200"></v-editor> <v-editor disabled v-model="form.target" class="editor" :height="200"></v-editor>
</el-form-item> </el-form-item>
<el-form-item label="课程考试:">
<AppList v-bind="listOptions" style="width: 100%"> </AppList>
</el-form-item>
<el-form-item label="周期性直播:">
<AppList v-bind="liveOptions" style="width: 100%"> </AppList>
</el-form-item>
</el-form> </el-form>
</div> </div>
</template> </template>
......
...@@ -10,30 +10,39 @@ const route = useRoute() ...@@ -10,30 +10,39 @@ const route = useRoute()
const id = route.query.id as string const id = route.query.id as string
const courseDetails:any = ref({}) const courseDetails: any = ref({})
onMounted(() => { onMounted(() => {
// 课程详情 // 课程详情
getViewCourseDetails({ id: id }).then((res:any) => { handleGetViewCourseDetails()
})
const handleGetViewCourseDetails = () => {
getViewCourseDetails({ id: id }).then((res: any) => {
courseDetails.value = res.data courseDetails.value = res.data
}) })
}) }
const handleFresh = () => {
handleGetViewCourseDetails()
}
</script> </script>
<template> <template>
<AppCard title="查阅课程"> <AppCard title="查阅课程">
<Operation :data="courseDetails"></Operation> <Operation :data="courseDetails" @update="handleFresh"></Operation>
<div class="course-view"> <div class="course-view">
<div class="course-left_info"> <div class="course-left_info">
<ViewCourseInfo :data="courseDetails"></ViewCourseInfo> <ViewCourseInfo :data="courseDetails"></ViewCourseInfo>
<ViewCourseChapter v-if="Object.keys(courseDetails).length" :data="courseDetails.chapters[0]?.children || []"></ViewCourseChapter> <ViewCourseChapter
v-if="Object.keys(courseDetails).length"
:data="courseDetails.chapters[0]?.children || []"
></ViewCourseChapter>
</div> </div>
</div> </div>
</AppCard> </AppCard>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.course-view{ .course-view {
display: flex; display: flex;
.course-left_info{ .course-left_info {
width: 840px; width: 840px;
display: flex; display: flex;
} }
......
...@@ -149,7 +149,7 @@ const liveOptions = computed(() => { ...@@ -149,7 +149,7 @@ const liveOptions = computed(() => {
prop: 'start_time', prop: 'start_time',
align: 'center', align: 'center',
computed({ row }: any) { computed({ row }: any) {
return format(parseInt(row.start_time)) return format(parseInt(row.start_time) * 1000)
} }
}, },
{ {
...@@ -157,7 +157,7 @@ const liveOptions = computed(() => { ...@@ -157,7 +157,7 @@ const liveOptions = computed(() => {
prop: 'end_time', prop: 'end_time',
align: 'center', align: 'center',
computed({ row }: any) { computed({ row }: any) {
return format(parseInt(row.end_time)) return format(parseInt(row.end_time) * 1000)
} }
}, },
{ label: '操作', slots: 'table-operate', align: 'center' } { label: '操作', slots: 'table-operate', align: 'center' }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论