diff --git a/src/views/course/CourseAdd.vue b/src/views/course/CourseAdd.vue index 6754fbc..4a45dbc 100644 --- a/src/views/course/CourseAdd.vue +++ b/src/views/course/CourseAdd.vue @@ -2,13 +2,16 @@
- 返回 + 返回
- + @@ -16,8 +19,7 @@ - 商业 - 政务 + {{item.name}} @@ -25,7 +27,14 @@ - + {{ dataValue }}分钟 @@ -41,8 +50,7 @@ - 医疗 - 建筑 + {{item.name}} @@ -61,7 +69,7 @@ - {{ item.name }} + {{ item.name }} @@ -76,7 +84,14 @@ - +
上传
@@ -96,9 +111,9 @@ -
- 保存 -
+
+ 保存 +
@@ -109,6 +124,7 @@ import { courseAdd, getCourseDetails } from '@/api/course/course' import storage from 'store' import { ACCESS_TOKEN } from '@/store/mutation-types' +import { dictionaryDropDown } from '@/api/sys/dictionaryItem' export default { name: 'step1', @@ -116,38 +132,37 @@ export default { return { dataValue: 1, form: { - coverPath:'', + coverPath: '', }, - personType: [ - { id: '1', name: '人员类别1' }, - { id: '2', name: '人员类别2' }, - { id: '3', name: '人员类别3' }, - ], - url:'', + url: '', previewVisible: false, fileList: [], - previewImage :[ - - ] - + previewImage: [], + dictPerson:[], + dictCourseType:[], + industry:[] } }, components: { courseAdd, - getCourseDetails + getCourseDetails, }, created() { if (this.$route.query.id) { - getCourseDetails({ id: this.$route.query.id }).then(res => { - this.form = res.data; + getCourseDetails({ id: this.$route.query.id }).then((res) => { + this.form = res.data - this.form.courseType = this.form.courseType + ''; - this.form.industryInvolved = this.form.industryInvolved + ''; - this.form.isRequired = this.form.isRequired + ''; - - }); + // this.form.courseType = this.form.courseType + '' + // this.form.industryInvolved = this.form.industryInvolved + '' + this.form.isRequired = this.form.isRequired + '' + // this.form.is + this.dictEcho(); + }) } + + this.dictionaryDropDown() }, + methods: { // getPersonType() { // return dictGet(Object.assign(parameter)).then((res) => { @@ -170,60 +185,75 @@ export default { }) }, + dictionaryDropDown () { + this.formLoading = true + // 行业 + dictionaryDropDown({ dictionaryCode: '0007' }).then((res) => { + this.industry = res.data + this.formLoading = false + }) + // 课程类别 + dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => { + this.dictCourseType = res.data + this.formLoading = false + }) + // 人员类型 + dictionaryDropDown({ dictionaryCode: '0005' }).then((res) => { + this.dictPerson = res.data + this.formLoading = false + }) + }, + + // 编辑回显字典项 + dictEcho(){ + console.log("form___",this.form) + }, + + + //返回 - goback(){ - this.$router.push({path:"/course/CourseList",query:{ - courseName:this.$route.query.courseName - } }) + goback() { + this.$router.push({ + path: '/course/CourseList', + query: { + courseName: this.$route.query.courseName, + }, + }) }, getToken() { - let hreader = {}; - hreader[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN); - return hreader; + let hreader = {} + hreader[ACCESS_TOKEN] = storage.get(ACCESS_TOKEN) + return hreader }, onSuccess(file) { - console.log('1---', file); - + console.log('1---', file) }, handleCancel() { - this.previewVisible = false; + this.previewVisible = false }, async handlePreview(file) { if (!file.url && !file.preview) { - file.preview = await getBase64(file.originFileObj); + file.preview = await getBase64(file.originFileObj) } - this.previewImage = file.url || file.preview; - this.previewVisible = true; + this.previewImage = file.url || file.preview + this.previewVisible = true }, handleChange({ fileList }) { - this.fileList = fileList; - console.log("fileList-------",fileList); - this.fileList.file=fileList[0]; - console.log('file``````',this.fileList.file) - console.log('response``````',this.fileList.file.response.url) - - - this.form.coverPath = this.fileList.file.response.url; - - console.log("url",this.form.coverPath) - - + this.fileList = fileList + this.fileList.file = fileList[0] + this.form.coverPath = this.fileList.file.response.url }, - }, - } // 图片预览Base64 function getBase64(file) { return new Promise((resolve, reject) => { - const reader = new FileReader(); - reader.readAsDataURL(file); - reader.onload = () => resolve(reader.result); - reader.onerror = error => reject(error); - }); + const reader = new FileReader() + reader.readAsDataURL(file) + reader.onload = () => resolve(reader.result) + reader.onerror = (error) => reject(error) + }) } - - diff --git a/src/views/course/courseDetail.vue b/src/views/course/courseDetail.vue index 38c46ef..745f36d 100644 --- a/src/views/course/courseDetail.vue +++ b/src/views/course/courseDetail.vue @@ -1,45 +1,69 @@ @@ -48,7 +72,7 @@ export default { width: 100px; text-align: center; } -.buttonGroup{ +.buttonGroup { width: 100%; height: auto; text-align: center; diff --git a/src/views/course/question/QuestionList.vue b/src/views/course/question/QuestionList.vue index ab4a17a..0a4f661 100644 --- a/src/views/course/question/QuestionList.vue +++ b/src/views/course/question/QuestionList.vue @@ -1,5 +1,4 @@