Commit a714e453 authored by FangYuePeng's avatar FangYuePeng

修复课程封面回显问题

parent bd058208
......@@ -268,7 +268,7 @@
<template slot-scope="scope">
<div :id="step(scope.$index)">
<el-image
:src="scope.row.imageSrc"
:src="scope.row.path"
:preview-src-list="scope.row.srclist"
style="width:100%;height:100%;"
@click="handleClickStop(scope.$index)"
......@@ -1223,7 +1223,9 @@ export default {
path: '/courseInformation/examinationManagement/index',
query: {
bussinessId: data.bussinessId,
name: data.tlessonName
courseId: data.businessId,
name: data.lessonName,
passingGrade: data.passingGrade
}
})
},
......
......@@ -50,6 +50,14 @@
@click="handleAdd"
>{{ commonField.addName }}</el-button>
<!-- <input id="btn_file" type="file" style="display:none" @change="fileupload">-->
<!-- //导入按钮-->
<el-button
:class="commonField.importClass"
:type="commonField.typeWarning"
:icon="commonField.importIcon"
:size="commonField.smallSize"
@click="handleImport"
>{{ commonField.importName }}</el-button>
</el-form-item>
</div>
</el-form>
......@@ -286,6 +294,44 @@
<el-button type="primary" @click="submit">确 定</el-button>
</div>
</el-dialog>
<!-- 导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="500px" append-to-body>
<el-upload
ref="upload"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
:on-change="employeeUpload"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:on-preview="handlePreview"
:file-list="fileList"
drag
>
<i class="el-icon-upload" />
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
<div slot="tip" class="el-upload__tip">
<el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
</div>
<div slot="tip" class="el-upload__tip" style="color:red">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button class="cancelBtn" @click="upload.open = false">取 消</el-button>
<el-button class="submitBtn" :loading="importLoading" type="primary" @click="submitFileForm">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -297,6 +343,8 @@ import {
delTeaExamQuestions, getTeaExamQuestions,
listTeaExamQuestions, updateStatus, updateTeaExamQuestions
} from '@/api/examination/teaExamQuestions'
import {importExcel, importTemplateTrialCourse} from "@/api/try/teaTrialCourse";
import {getToken} from "@/utils/auth";
export default {
name: 'ExaminationPaper',
props: {
......@@ -307,6 +355,20 @@ export default {
},
data() {
return {
upload: {
// 是否显示弹出层(开课导入)
open: false,
// 弹出层标题(开课导入)
title: '',
// 是否禁用上传
isUploading: false,
// 设置上传的请求头部
headers: { Authorization: 'Bearer ' + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + '/teatrialcourse/importDictData'
},
// 文件上传加载状态
importLoading: false,
title: '',
imageSrc: require('@/assets/image/test.png'),
imagePath: 'http://49.232.167.247:20020/eduServer/',
......@@ -785,6 +847,84 @@ export default {
},
justOut(event) {
// $("#pic").remove();
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = '导入'
this.upload.open = true
},
/** 下载模板操作 */
importTemplate() {
importTemplateTrialCourse().then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '试题模板' + '.xlsx' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
// this.download(response.msg);
})
},
// 文件上传中处理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true
},
// 文件上传成功处理
handleFileSuccess(response, file, fileList) {
this.upload.open = false
this.upload.isUploading = false
this.$refs.upload.clearFiles()
this.$alert(response.msg, '导入结果', { dangerouslyUseHTMLString: true })
this.getList()
},
// 提交上传文件
submitFileForm() {
// this.$refs.upload.submit()
this.importLoading = true
if (this.fileList.length === 0) {
this.$message.warning('请上传文件')
// 导入成功后关闭弹出框
this.importLoading = false
this.upload.open = true
} else { // 根据后台需求数据格式
var formData = new FormData() // 当前为空
formData.append('file', this.fileList)
importExcel(formData).then(res => {
if (res.code === 200) {
this.$message.success(res.data)
this.fileList = []
// 导入成功后关闭弹出框
this.upload.open = false
// 导入成功后刷新页面
this.getList()
}
this.importLoading = false
}).catch(err => {
this.$message.success(err.message)
this.importLoading = false
})
}
},
/** 导入change*/
employeeUpload(file, fileList) {
if (fileList.length > 1) {
fileList.splice(0, 1)
}
this.fileList = fileList[0].raw
},
/** 导入remove操作*/
handleRemove(file, fileList) {
this.fileList = []
},
/** 导入beforeRemove操作*/
beforeRemove(file, fileList) {
this.fileList = []
},
/* 上传文件所需求 */
handlePreview(file) {
}
}
}
......
......@@ -2,7 +2,11 @@
<template>
<div class="app-container">
<!-- 标题-->
<div class="examinationTitle">{{ name }}</div>
<div class="examinationTitle">{{ name }}
<span v-if="activeName==='ExaminationPaper'" class="score">及格分数:
<el-input v-model="passingGrade" type="text" maxlength="3" @blur="handleGradeChange(passingGrade)" ></el-input>
</span>
</div>
<el-tabs v-model="activeName" @tab-click="tabClick">
<el-tab-pane label="试题管理" name="ExaminationPaper">
<examination-paper :bussiness-id="courseId" />
......@@ -17,6 +21,7 @@
import ExaminationPaper from '@/views/courseInformation/examinationManagement/examinationPaper.vue'
import QuestionManagement from '@/views/courseInformation/examinationManagement/questionManagement.vue'
import {updateBLesson} from "@/api/courseManagement/indexApi";
export default {
name: 'ExaminationManagement',
......@@ -30,19 +35,48 @@ export default {
activeName: 'ExaminationPaper',
courseId: null,
bussinessId: '', // 业务id
name: '' // 课程名称
name: '' ,// 课程名称
passingGrade:'',//及格分数
id: null
}
},
// mounted() {
// // 接受路由传递的参数
// this.courseId = this.$route.query.bussinessId
// this.name = this.$route.query.name
// },
created() {
// 接受路由传递的参数
this.courseId = this.$route.query.bussinessId
this.id = this.$route.query.courseId
this.name = this.$route.query.name
console.log(this.bussinessId, this.name)
this.passingGrade = this.$route.query.passingGrade
console.log(this.id, this.name,this.passingGrade)
},
methods: {
tabClick() {
// 在tab切换时更新bussinessId
console.log('name', this.name)
},
handleGradeChange(grade) {
const form = {
businessId: this.id,
passingGrade: grade
}
console.log(form)
updateBLesson(form).then(res => {
if (res.code === 200) {
this.$message({
message: '保存成功',
type: 'success'
})
} else {
this.$message({
message: '保存失败',
type: 'error'
})
}
})
}
}
}
......@@ -54,9 +88,23 @@ export default {
margin-top: -20px;
.examinationTitle {
font-size: 20px;
font-size: 25px;
font-weight: bold;
margin-bottom: 20px;
margin: 20px 20px 20px 0;
white-space: nowrap;
}
.score{
margin-left: 5px;
font-size: 18px;
font-weight:normal;
}
.score>>>.el-input__inner{
width: 100px;
border-top: 0;
border-right: 0;
border-left: 0;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment