dev_202412
yujialong 2 months ago
parent 878645d672
commit 04c306898f
  1. 2
      src/views/course/content/index.vue
  2. 2
      src/views/course/content/source.vue
  3. 29
      src/views/course/detail.vue
  4. 2
      src/views/shop/add.vue

@ -445,7 +445,7 @@ export default {
] ]
this.moveVisible = true this.moveVisible = true
} else { } else {
this.$message.warning('请选择小节!') this.$message.warning('请选择资源!')
} }
}, },
// //

@ -20,7 +20,7 @@
@click="course.shrink = !course.shrink"></i> @click="course.shrink = !course.shrink"></i>
<el-checkbox class="check" v-model="course.check" @change="checkCourse(course)"></el-checkbox> <el-checkbox class="check" v-model="course.check" @change="checkCourse(course)"></el-checkbox>
<img v-if="course.coverUrl" class="cover" :src="course.coverUrl" alt=""> <img v-if="course.coverUrl" class="cover" :src="course.coverUrl" alt="">
<span class="course-name">{{ course.curriculumName }}</span> <span class="course-name">{{ course.curriculumName || course.courseName }}</span>
</div> </div>
<div v-if="course.shrink" class="chapters"> <div v-if="course.shrink" class="chapters">
<!-- 章节 --> <!-- 章节 -->

@ -86,8 +86,8 @@
<el-card shadow="hover"> <el-card shadow="hover">
<div class="cover-wrap"> <div class="cover-wrap">
<el-upload name="file" accept=".jpg,.png,.jpeg,.gif" ref="upload" drag :on-remove="handleRemove" <el-upload name="file" accept=".jpg,.png,.jpeg,.gif" ref="upload" drag :on-remove="handleRemove"
:on-error="uploadError" :before-remove="beforeRemove" :limit="1" :on-exceed="handleExceed" action="" :on-error="uploadError" :before-remove="beforeRemove" :limit="10000" :file-list="fileList"
:http-request="handleRequest"> :on-exceed="handleExceed" action="" :http-request="handleRequest">
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text"> <div class="el-upload__text">
<p>将图片拖到此处<em>点击上传</em></p> <p>将图片拖到此处<em>点击上传</em></p>
@ -322,6 +322,7 @@ export default {
isAdd: true, isAdd: true,
editorConfig, editorConfig,
step: 1, step: 1,
defaultCover: 'https://izhixinyun.com/images/course-cover.png',
form: { form: {
curriculumName: "", curriculumName: "",
curriculumType: '', curriculumType: '',
@ -335,7 +336,7 @@ export default {
systemIdByAssessment: [], systemIdByAssessment: [],
systemIdByPractice: [], systemIdByPractice: [],
supplier: [], supplier: [],
coverUrl: 'https://izhixinyun.com/images/course-cover.png', coverUrl: '',
curriculumDisciplines: [ curriculumDisciplines: [
{ {
professionalClassList: [], professionalClassList: [],
@ -346,6 +347,7 @@ export default {
} }
], ],
}, },
fileList: [],
rules: { rules: {
curriculumName: [ curriculumName: [
{ required: true, message: "请输入课程名称", trigger: "blur" } { required: true, message: "请输入课程名称", trigger: "blur" }
@ -432,12 +434,10 @@ export default {
this.filterChecked(); this.filterChecked();
}, 500); }, 500);
} }
},
created () {
}, },
mounted () { mounted () {
if (this.cid) this.isAdd = false if (this.cid) this.isAdd = false
this.form.coverUrl = this.defaultCover
this.getSubject() this.getSubject()
this.getConfig() this.getConfig()
this.getSystem() this.getSystem()
@ -447,7 +447,16 @@ export default {
methods: { methods: {
getInfoData () { getInfoData () {
this.$post(`${this.api.curriculumDetail}?cid=${this.cid}`).then(({ data }) => { this.$post(`${this.api.curriculumDetail}?cid=${this.cid}`).then(({ data }) => {
if (!data.coverUrl) data.coverUrl = 'https://izhixinyun.com/images/course-cover.png' const cover = data.coverUrl
if (!cover) {
data.coverUrl = this.defaultCover
} else if (!cover.includes('course-cover')) {
this.fileList = [{
name: cover,
url: cover,
}]
}
if (data.supplier) data.supplier = data.supplier.split(',').map(e => +e) if (data.supplier) data.supplier = data.supplier.split(',').map(e => +e)
this.form = data this.form = data
this.$nextTick(() => { this.$nextTick(() => {
@ -569,6 +578,10 @@ export default {
async handleRequest ({ file }) { async handleRequest ({ file }) {
Oss.upload(file).then(res => { Oss.upload(file).then(res => {
this.form.coverUrl = res.url this.form.coverUrl = res.url
this.fileList = [{
name: res.url,
url: res.url
}]
}) })
}, },
uploadError (err, file, fileList) { uploadError (err, file, fileList) {
@ -583,7 +596,7 @@ export default {
}, },
handleRemove () { handleRemove () {
Oss.del(this.form.coverUrl) Oss.del(this.form.coverUrl)
this.form.coverUrl = '' this.form.coverUrl = this.defaultCover
}, },
// //

@ -1640,7 +1640,7 @@ export default {
back () { back () {
this.pass = true this.pass = true
// //
if (this.updateTime) { if (!this.isDetail && this.updateTime) {
this.$confirm(`所填写内容暂未保存,是否保存?`, '提示', { this.$confirm(`所填写内容暂未保存,是否保存?`, '提示', {
type: 'warning', type: 'warning',
confirmButtonText: '是', confirmButtonText: '是',

Loading…
Cancel
Save