mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-09 02:46:44 +08:00
Merge branch 'third' of https://codeup.aliyun.com/6265f483e4166464dc2f9c14/boeu/portal into third
This commit is contained in:
@@ -116,32 +116,65 @@
|
||||
</el-form-item> -->
|
||||
<el-form-item label="题干" prop="title">
|
||||
<el-input
|
||||
class="inputclass"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
maxlength="500"
|
||||
show-word-limit
|
||||
v-model="question.title"
|
||||
placeholder="请输入题干"></el-input>
|
||||
placeholder="请输入题干">
|
||||
</el-input>
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
:action="uploadImgUrl"
|
||||
:on-success="handleUploadSuccess"
|
||||
:on-remove="handleRemove"
|
||||
:before-remove="beforeRemove"
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed"
|
||||
:file-list="fileList">
|
||||
<el-button size="small" type="primary">点击上传图片</el-button>
|
||||
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<div v-for="(o, i) in question.optionList" :key="i">
|
||||
<div v-for="(o, i) in question.optionList" :key="i" >
|
||||
<el-form-item :label="'选项' + (i + 1)">
|
||||
<el-input
|
||||
style="width: 300px; margin-right: 10px"
|
||||
v-model="question.optionList[i].content"
|
||||
placeholder="填写选择题的选项内容"></el-input>
|
||||
placeholder="填写选择题的选项内容">
|
||||
</el-input>
|
||||
<!-- <el-input
|
||||
v-if="question.type == 2"
|
||||
style="width: 80px; margin-right: 10px"
|
||||
v-model="question.optionList[i].score"
|
||||
placeholder="得分"></el-input> -->
|
||||
<!-- v-else -->
|
||||
<!-- <div class="optionbox"> -->
|
||||
|
||||
<el-upload
|
||||
class="upload-demo Optionsimage"
|
||||
:action="uploadImgUrl"
|
||||
:data=" curOption"
|
||||
:on-success="handleUploadOptionsSuccess"
|
||||
:on-remove="handleRemove"
|
||||
:before-remove="beforeRemove"
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed"
|
||||
:file-list="fileList">
|
||||
<el-button style="font-size: 18px;padding-top:0;" icon="el-icon-picture-outline" type="text"></el-button>
|
||||
<!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> -->
|
||||
</el-upload>
|
||||
<!-- </div> -->
|
||||
<el-radio v-if="question.type == 1" v-model="question.optionList[i].isAnswer" @change="radioChange(i)" :label="true">正确</el-radio>
|
||||
<el-checkbox
|
||||
v-else
|
||||
v-model="question.optionList[i].isAnswer"
|
||||
style="width: 80px; margin-right: 10px">正确</el-checkbox>
|
||||
style="width: 80px; margin-right: 10px">正确
|
||||
</el-checkbox>
|
||||
<el-button type="text" @click="removeOption(i)">删除</el-button>
|
||||
</el-form-item>
|
||||
|
||||
</div>
|
||||
<center>
|
||||
<el-button type="text" @click="addOption">添加选项</el-button>
|
||||
@@ -298,12 +331,13 @@ const questionData = {
|
||||
project: "",
|
||||
createPerson: "",
|
||||
moduel: "",
|
||||
images:"",
|
||||
statue: 0,
|
||||
optionList: [
|
||||
{ content: "", score: "", isAnswer: false },
|
||||
{ content: "", score: "", isAnswer: false },
|
||||
{ content: "", score: "", isAnswer: false },
|
||||
{ content: "", score: "", isAnswer: false },
|
||||
{ content: "", score: "", isAnswer: false ,images:""},
|
||||
{ content: "", score: "", isAnswer: false ,images:""},
|
||||
{ content: "", score: "", isAnswer: false ,images:""},
|
||||
{ content: "", score: "", isAnswer: false ,images:""},
|
||||
],
|
||||
// resSysId: [], // 试题目录
|
||||
difficulty: "", // 难度
|
||||
@@ -317,6 +351,9 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
curOption:[],
|
||||
uploadImgUrl: process.env.VUE_APP_BASE_API + "/xboe/sys/xuploader/file/upload", // 上传的图片服务器地址
|
||||
fileList:[],
|
||||
resOwnerListMap: [],
|
||||
// resOwnerName: resOwnerIndexName,
|
||||
ownership: [],
|
||||
@@ -377,11 +414,34 @@ export default {
|
||||
this.loadData(1);
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.getResOwnerTree().then(rs=>{
|
||||
this.resOwnerListMap=rs;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
handleUploadOptionsSuccess(res){
|
||||
this.curOption.push(res.result.filePath);
|
||||
questionData.optionList[0].images = this.curOption[0];
|
||||
questionData.optionList[1].images = this.curOption[1];
|
||||
questionData.optionList[2].images = this.curOption[2];
|
||||
questionData.optionList[3].images = this.curOption[3];
|
||||
console.log(questionData)
|
||||
},
|
||||
handleUploadSuccess(res) {
|
||||
console.log(res.result.filePath);
|
||||
questionData.images = res.result.filePath;
|
||||
console.log(questionData.images)
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
console.log(file, fileList);
|
||||
},
|
||||
handleExceed(files, fileList) {
|
||||
this.$message.warning(`当前限制选择 1 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
||||
},
|
||||
beforeRemove(file, fileList) {
|
||||
return this.$confirm(`确定移除 ${ file.name }?`);
|
||||
},
|
||||
downloadTemplate(){
|
||||
let fileName = "试题导入模板.xls";
|
||||
let link = document.createElement('a'); //创建a标签
|
||||
@@ -514,6 +574,7 @@ export default {
|
||||
// 判断题没有optionList
|
||||
this.question.optionList = [];
|
||||
}
|
||||
console.log(questionData,'llkk')
|
||||
examQuestionApi
|
||||
.save(this.question)
|
||||
.then((res) => {
|
||||
@@ -614,7 +675,7 @@ export default {
|
||||
},
|
||||
addOption() {
|
||||
if (this.question.optionList.length < 10) {
|
||||
this.question.optionList.push({ content: "", score: "", isAnswer: 0 });
|
||||
this.question.optionList.push({ content: "", score: "", isAnswer: 0 ,images:""});
|
||||
}
|
||||
},
|
||||
removeOption(i) {
|
||||
@@ -627,6 +688,30 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
::v-deep .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item{
|
||||
margin-bottom: 23px !important;
|
||||
}
|
||||
.inputclass{
|
||||
position: relative;
|
||||
}
|
||||
::v-deep .el-upload-list{
|
||||
position: absolute !important;
|
||||
left: 20px !important;
|
||||
// top:0 !important;
|
||||
margin-top: -10px !important;
|
||||
}
|
||||
.optionbox{
|
||||
float: right;
|
||||
}
|
||||
.Optionsimage{
|
||||
margin-right: 20px;
|
||||
margin-top: 0 !important;
|
||||
display: inline-block;
|
||||
height: 30px;
|
||||
}
|
||||
.upload-demo{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.svg-icon {
|
||||
margin-right: 8px;
|
||||
font-size: 19px;
|
||||
|
||||
Reference in New Issue
Block a user