从系统选择封面

This commit is contained in:
lmj
2022-06-14 19:28:24 +08:00
parent 0936096121
commit 2688ca6b20
4 changed files with 66 additions and 4 deletions

View File

@@ -58,7 +58,10 @@
<el-form-item label="名称" required><el-input maxlength="100" v-model="courseInfo.name" placeholder="课程名称(限100字以内)"></el-input></el-form-item>
<el-form-item label="封面图片" required >
<el-col :span="8">
<imageUpload :value="courseCoverurl" width="160px" height="90px" @success="uploadCoverImgSuccess" @remove="removeCoverImgSuccess"></imageUpload>
<div @click.stop="chooseFile">
<imageUpload :disabled="true" :value="courseCoverurl" width="160px" height="90px" @success="uploadCoverImgSuccess" @subimage="acceptimage" @remove="removeCoverImgSuccess"></imageUpload>
</div>
<div>上传为16:9(:800*450)的png或jpg图片</div>
</el-col>
<el-col :span="16">
@@ -212,6 +215,8 @@
</div>
</el-tab-pane>
</el-tabs>
<filecloud :show="dlgFileChoose.show" @choose="changeCourseImage" @close="choseChoose"></filecloud>
</div>
</template>
@@ -237,6 +242,7 @@ import apiTag from "../../api/modules/tag.js";
import videoPlayer from "@/components/VideoPlayer/index.vue";
import audioPlayer from "@/components/AudioPlayer/index.vue";
import apiCourseFile from '@/api/modules/courseFile.js';
import filecloud from '@/components/FileCloud/index.vue';
import { mapGetters, mapActions } from "vuex";
// import hyperLink from '@/components/Course/hyperLink.vue';
export default {
@@ -246,6 +252,7 @@ export default {
catalogCourseware,
imageUpload,
exam,
filecloud,
homework,
assess,
WxEditor,
@@ -279,6 +286,9 @@ export default {
},
data() {
return {
dlgFileChoose:{
show:false
},
converStatus:4,
courseType: courseType,
isEdit: true,
@@ -350,6 +360,26 @@ export default {
});
},
methods: {
chooseFile(){
this.dlgFileChoose.show=true;
},
choseChoose(){
this.dlgFileChoose.show=false;
},
changeCourseImage(img){
if(!img.path){
return;
}
//console.log(img);
this.dlgFileChoose.show=false;
this.courseInfo.coverImg = img.path;
this.courseCoverurl = this.fileUrl+img.path;
},
acceptimage(value){
this.courseInfo.coverImg = value.path;
this.courseCoverurl = value.path;
},
...mapActions({
getResOwnerTree: "resOwner/getResOwnerTree",
loadResOwners: "resOwner/loadResOwners",

View File

@@ -73,7 +73,10 @@
<!--不显示因为标题已经代表了 <el-form-item label="授课方式">{{courseTypeMap(params.type)}}</el-form-item>-->
<el-form-item label="封面图片" required >
<el-col :span="8">
<imageUpload :value="courseCoverurl" width="160px" height="90px" @success="uploadCoverImgSuccess" @remove="removeCoverImgSuccess"></imageUpload>
<div @click.stop="chooseFile">
<imageUpload :disabled="true" :value="courseCoverurl" width="160px" height="90px" @subimage="acceptimage" @success="uploadCoverImgSuccess" @remove="removeCoverImgSuccess"></imageUpload>
</div>
<div>上传为16:9(:800*450)的png或jpg图片</div>
</el-col>
<el-col :span="16">
@@ -250,6 +253,8 @@
</div>
</el-col>
</el-row>
<filecloud :show="dlgFileChoose.show" @choose="changeCourseImage" @close="choseChoose"></filecloud>
</div>
</template>
@@ -277,6 +282,7 @@ import audioPlayer from '@/components/AudioPlayer/index.vue';
import { mapGetters,mapActions} from 'vuex';
import hyperLink from '@/components/Course/hyperLink.vue';
import apiCourseFile from '../../api/modules/courseFile.js';
import filecloud from '@/components/FileCloud/index.vue';
export default {
name:"auditCourse2",
components: {
@@ -284,6 +290,7 @@ export default {
catalogCourseware,
imageUpload,
exam,
filecloud,
homework,
assess,
WxEditor,
@@ -315,6 +322,9 @@ export default {
},
data() {
return {
dlgFileChoose:{
show:false
},
converStatus:4,
curriculumData:{
url:'',
@@ -391,6 +401,26 @@ export default {
})
},
methods: {
chooseFile(){
this.dlgFileChoose.show=true;
},
choseChoose(){
this.dlgFileChoose.show=false;
},
changeCourseImage(img){
if(!img.path){
return;
}
//console.log(img);
this.dlgFileChoose.show=false;
this.courseInfo.coverImg = img.path;
this.courseCoverurl = this.fileUrl+img.path;
},
acceptimage(value){
this.courseInfo.coverImg = value.path;
this.courseCoverurl = value.path;
},
...mapActions({
getResOwnerTree:'resOwner/getResOwnerTree',
loadResOwners:'resOwner/loadResOwners',

View File

@@ -1,6 +1,6 @@
<template>
<div style="min-width: 700px;">
<el-dialog title="选择图片" :close-on-click-modal="false" :visible.sync="show" width="60%" @close="chose" :modal="false" custom-class="g-dialog">
<el-dialog title="选择图片" :close-on-click-modal="false" :visible.sync="show" width="60%" :show-close="false" :modal="false" custom-class="g-dialog">
<div style="margin: -10px;">
<div style="display: flex;justify-content: space-between;padding: 5px;border-bottom: 1px solid #e0e0e0;">
<div style="padding-top: 10px;">
@@ -36,6 +36,8 @@
</div>
<div slot="footer" class="dialog-footer">
<el-button :disabled="btnDisabled" type="primary" @click="saveChoose()">确认</el-button>
<el-button @click="chose()">取消</el-button>
</div>
</el-dialog>
</div>