From c85f134c9db8c84125daf9107052c01382d36791 Mon Sep 17 00:00:00 2001 From: 18571350067 Date: Mon, 15 Nov 2021 00:11:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=95=B0=E6=8D=AE=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E5=8F=8A=E9=A2=98=E7=9B=AE=E6=89=B9=E9=87=8F=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=92=8C=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/course/CourseAdd.vue | 160 ++++++++++++--------- src/views/course/courseDetail.vue | 76 ++++++---- src/views/course/question/QuestionList.vue | 80 +++++++---- 3 files changed, 194 insertions(+), 122 deletions(-) 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 @@