修改部分会议提到的bug
This commit is contained in:
@@ -47,6 +47,7 @@ async function getCourseInfo() { // 获取课程信息
|
||||
const res = await api.getCourse({id:course_id.value})
|
||||
if(res.code === 0) {
|
||||
chapter_info.value = res.data.course_ware_json
|
||||
res.data.course.price /=100
|
||||
form.value = res.data.course
|
||||
}
|
||||
}
|
||||
@@ -83,12 +84,15 @@ const submitForm = async (formEl) => {
|
||||
})
|
||||
}
|
||||
async function saveStep1() {
|
||||
form.value.course_category_id = subjectList.value.filter((item,i) => {
|
||||
return item.name === form.value.subject
|
||||
})[0].id
|
||||
let params = {
|
||||
step1:{
|
||||
...form.value
|
||||
}
|
||||
}
|
||||
params.step1.price = parseInt(params.step1.price)
|
||||
params.step1.price = parseFloat(params.step1.price)*100
|
||||
let func_name =''
|
||||
if(course_id.value) { // 编辑
|
||||
params.course_id = parseInt(course_id.value)
|
||||
@@ -153,6 +157,10 @@ function handleAvatarSuccess(res) {
|
||||
form.value.cover = res.data.file.url
|
||||
handlerChange()
|
||||
}
|
||||
function handleIntroSuccess(res) {
|
||||
form.value.intro = res.data.file.url
|
||||
handlerChange()
|
||||
}
|
||||
function beforeAvatarUpload(file) {
|
||||
const isLt05M = file.size / 1024 / 1024 < 20
|
||||
const isJPG = file.type.indexOf('image/') === -1
|
||||
@@ -215,11 +223,22 @@ function handlerChange(e) {
|
||||
<el-input @change="handlerChange" placeholder="请输入课程价格" type="number" v-model="form.price" />
|
||||
</el-form-item>
|
||||
<el-form-item label="课程简介">
|
||||
<el-input @change="handlerChange" v-model="form.intro" type="textarea" />
|
||||
</el-form-item>
|
||||
<el-form-item label="包含试听">
|
||||
<el-switch @change="handlerChange" v-model="form.is_audition" active-text="是" inactive-text="否" :active-value="1" :inactive-value="-1" />
|
||||
<!-- <el-input @change="handlerChange" v-model="form.intro" type="textarea" />-->
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
:action="`${path}/fileUploadAndDownload/upload`"
|
||||
:headers="{ 'x-token': userStore.token }"
|
||||
:show-file-list="false"
|
||||
:on-success="handleIntroSuccess"
|
||||
:before-upload="beforeAvatarUpload"
|
||||
>
|
||||
<img v-if="form.intro" :src="form.intro" class="avatar" />
|
||||
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="包含试听">-->
|
||||
<!-- <el-switch @change="handlerChange" v-model="form.is_audition" active-text="是" inactive-text="否" :active-value="1" :inactive-value="-1" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="设置精品">
|
||||
<el-switch @change="handlerChange" v-model="form.is_boutique" active-text="是" inactive-text="否" :active-value="1" :inactive-value="-1" />
|
||||
</el-form-item>
|
||||
|
||||
@@ -27,6 +27,7 @@ const props = defineProps(['course_id','chapter_info'])
|
||||
const emit = defineEmits(['reload'])
|
||||
import UploadCommon from '@/components/upload/common.vue'
|
||||
// 变量
|
||||
const is_sub = ref(-1)
|
||||
const dialogChapterVisible = ref(false)
|
||||
// const dialogChapterTitle = ref('')
|
||||
const chapterForm = ref({pid:0,sort:0})
|
||||
@@ -61,6 +62,7 @@ function addChapterFunc() { // 添加大章节
|
||||
dialogChapterTitle.value = '添加大章节'
|
||||
}
|
||||
async function deleteChapterFunc(item) { //删除大章节
|
||||
is_sub.value = -1
|
||||
delFunc(item.course_chapter_id)
|
||||
}
|
||||
function delFunc(id) {
|
||||
@@ -71,7 +73,9 @@ function delFunc(id) {
|
||||
})
|
||||
.then(async() => {
|
||||
const res = await api.delChapter({
|
||||
ids:[id]
|
||||
ids:[id],
|
||||
course_id:parseInt(props.course_id),
|
||||
sub:parseInt(is_sub.value)
|
||||
})
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
@@ -132,14 +136,17 @@ function editChapterChildFunc(item,main_index) { // 打开编辑子章节窗口
|
||||
// item.exam_ids =item.exam_id?[item.exam_id]: []
|
||||
item.examination_id = item.exam_id
|
||||
chapterChildForm.value = _.cloneDeep(item)
|
||||
chapterChildForm.value.price /= 100
|
||||
dialogChapterChildVisible.value = true
|
||||
}
|
||||
function deleteChapterChildFunc(item) { // 删除子章节
|
||||
is_sub.value = 1
|
||||
delFunc(item.course_subsection_id)
|
||||
}
|
||||
async function enterChapterChildDialog() { // 提交小章节
|
||||
chapterChildForm.value.sort = parseInt(chapterChildForm.value.sort)
|
||||
chapterChildForm.value.price = parseInt(chapterChildForm.value.price)
|
||||
// chapterChildForm.value.price = parseInt(chapterChildForm.value.price*100)
|
||||
chapterChildForm.value.price = chapterChildForm.value.price*100
|
||||
const params = {
|
||||
...chapterChildForm.value
|
||||
}
|
||||
@@ -219,7 +226,9 @@ function addExamFunc(data) {
|
||||
{{scope.row.exam_id === 0?'未添加习题':scope.row.exam_id}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="章节价格" min-width="60" prop="price" />
|
||||
<el-table-column align="left" label="章节价格" min-width="60" prop="price">
|
||||
<template #default="scope">{{scope.row.price/100}}</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="left" label="是否免费" min-width="60">-->
|
||||
<!-- <template #default="scope">-->
|
||||
<!-- {{scope.row.is_free === 1? '是':'否'}}-->
|
||||
|
||||
@@ -191,7 +191,9 @@ function viewCourseFunc(row) { // 查看课程
|
||||
<el-table-column align="left" label="id" min-width="60" prop="course_id" sortable="custom" />
|
||||
<el-table-column align="left" label="名称" min-width="150" prop="name" />
|
||||
<el-table-column align="left" label="科目" min-width="150" prop="subject" />
|
||||
<el-table-column align="left" label="价格" min-width="150" prop="price" />
|
||||
<el-table-column align="left" label="价格" min-width="150" prop="price">
|
||||
<template #default="scope">{{scope.row.price/100}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="状态" min-width="150" prop="status">
|
||||
<template #default="scope">
|
||||
{{scope.row.status == 1?'上架':scope.row.status == 2?'待审核':scope.row.status == 3?'通过':scope.row.status == 4?'未通过':'下架'}}
|
||||
|
||||
Reference in New Issue
Block a user