Commit 79da9020 by 宋珺琪

视频调整、选项图片添加

parent fd831586
......@@ -32,31 +32,80 @@
<div class="right">
<div class="title">
<p>{{title}}({{optionValue}})</p>
<ul style="display: flex;margin-left: 30px">
<li v-for="item in reduceAnswer.img" style="overflow: visible;display: flex">
<img :src="item" alt=""
@click="magnifyPhoto(item)"
style="width: 100px; height:90px; margin-left: 10px;margin-top: -5px">
</li>
</ul>
<i class="iconfont icon-right auto-right"></i>
<span>全卷共1题 <i class="iconfont icon-time"></i><!--倒计时:<b>{{time}}</b>分钟--></span>
<span style="color: black;font-weight: bold">全卷共1题 <i class="iconfont icon-time"></i><!--倒计时:<b>{{time}}</b>分钟--></span>
</div>
<ul style="display: flex;margin-left: 30px">
<li v-for="item in reduceAnswer.img" style="overflow: visible;display: flex">
<img :src="item" alt=""
@click="magnifyPhoto(item)"
style="width: 300px; height:300px; margin-left: 10px;margin-top: -5px">
</li>
</ul>
<div class="content">
<p class="topic">{{showQuestion}}</p>
<div v-if=" optionValue == '单选题'">
<el-radio-group v-model="radio[index]" @change="getChangeLabel" >
<el-radio :label="1" :disabled='radioFlag' :class="[isradio ? (this.reduceAnswer.rightAnswer==='A' ? 'checkboxTrueStyle' : 'radioFlaseStyle'):'noStyle']">{{showAnswer.answerA}}</el-radio>
<el-radio :label="2" :disabled='radioFlag' :class="[isradio ? (this.reduceAnswer.rightAnswer==='B' ? 'checkboxTrueStyle' : 'radioFlaseStyle'):'noStyle']">{{showAnswer.answerB}}</el-radio>
<el-radio :label="3" :disabled='radioFlag' :class="[isradio ? (this.reduceAnswer.rightAnswer==='C' ? 'checkboxTrueStyle' : 'radioFlaseStyle'):'noStyle']">{{showAnswer.answerC}}</el-radio>
<el-radio :label="4" :disabled='radioFlag' :class="[isradio ? (this.reduceAnswer.rightAnswer==='D' ? 'checkboxTrueStyle' : 'radioFlaseStyle'):'noStyle']">{{showAnswer.answerD}}</el-radio>
<!-- <div style="display: flex">-->
<el-radio :label="1" :disabled='radioFlag'
:class="[isradio ? (this.reduceAnswer.rightAnswer==='A' ? 'checkboxTrueStyle' : 'radioFlaseStyle'):'noStyle']">
{{showAnswer.answerA}}
</el-radio>
<ul v-if="showAnswer.Aimg" style="display: flex;margin-left: 30px">
<li style="overflow: visible;display: flex">
<img :src="showAnswer.Aimg" alt=""
@click="magnifyPhoto(showAnswer.Aimg)"
style="width: 300px; height:300px; margin-left: 10px;margin-top: 5px">
</li>
</ul>
<!-- </div>-->
<!-- <div style="display: flex">-->
<el-radio :label="2" :disabled='radioFlag'
:class="[isradio ? (this.reduceAnswer.rightAnswer==='B' ? 'checkboxTrueStyle' : 'radioFlaseStyle'):'noStyle']">
{{showAnswer.answerB}}
</el-radio>
<ul v-if="showAnswer.Bimg" style="display: flex;margin-left: 30px">
<li style="overflow: visible;display: flex">
<img :src="showAnswer.Bimg" alt=""
@click="magnifyPhoto(showAnswer.Bimg)"
style="width: 300px; height:300px; margin-left: 10px;margin-top: 5px">
</li>
</ul>
<!-- </div>-->
<!-- <div style="display: flex">-->
<el-radio :label="3" :disabled='radioFlag'
:class="[isradio ? (this.reduceAnswer.rightAnswer==='C' ? 'checkboxTrueStyle' : 'radioFlaseStyle'):'noStyle']">
{{showAnswer.answerC}}
</el-radio>
<ul v-if="showAnswer.Cimg" style="display: flex;margin-left: 30px">
<li style="overflow: visible;display: flex">
<img :src="showAnswer.Cimg" alt=""
@click="magnifyPhoto(showAnswer.Cimg)"
style="width: 300px; height:300px; margin-left: 10px;margin-top: 5px">
</li>
</ul>
<!-- </div>-->
<!-- <div style="display: flex">-->
<el-radio :label="4" :disabled='radioFlag'
:class="[isradio ? (this.reduceAnswer.rightAnswer==='D' ? 'checkboxTrueStyle' : 'radioFlaseStyle'):'noStyle']">
{{showAnswer.answerD}}
</el-radio>
<ul v-if="showAnswer.Dimg" style="display: flex;margin-left: 30px">
<li style="overflow: visible;display: flex">
<img :src="showAnswer.Dimg" alt=""
@click="magnifyPhoto(showAnswer.Dimg)"
style="width: 300px; height:300px; margin-left: 10px;margin-top: 5px">
</li>
</ul>
<!-- </div>-->
</el-radio-group>
<div class="analysis" id="topic1Right" style="display: none">
<ul>
<li class="first "> <el-tag type="success">正确答案:</el-tag><span class="right">{{reduceAnswer.rightAnswer}}</span></li>
<li class="second"><el-tag>题目解析:</el-tag>
<div class="li2right">{{reduceAnswer.analysis == null ? '无': reduceAnswer.analysis}}</div>
<div class="li2right">{{(reduceAnswer.analysis == null || reduceAnswer.analysis == '') ? '无': reduceAnswer.analysis}}</div>
<!-- <div class="li2right">{{reduceAnswer.analysis == null || reduceAnswer.analysis=='null' ? '强强强强强强强强强强强强强强强刘乾坤万年两年前为了来思考每年的法律手段你疯了目前我强强强强强强强强强强强强强强刘乾坤万年两年前为了来思考每年的法律手段你疯了目前我强强强强强强强强强强强强强强刘乾坤万年两年前为了来思考每年的法律手段你疯了目前我强强强强强强强强强强强强强强刘乾坤万年两年前为了来思考每年的法律手段你疯了目前我强强强强强强强强强强强强强强刘乾坤万年两年前为了来思考每年的法律手段你疯了目前我强强强强强强强强强强强强强强刘乾坤万年两年前为了来思考每年的法律手段你疯了目前我强强强强强强强强强强强强强强刘乾坤万年两年前为了来思考每年的法律手段你疯了目前我强强强强强强强强强强强强强强刘乾坤万年两年前为了来思考每年的法律手段你疯了目前我强强强强强强强强强强强强强强刘乾坤万年两年前为了来思考每年的法律手段你疯了目前我强强强强强强强强强强强强强强刘乾坤万年两年前为了来思考每年的法律手段你疯了目前我强强强强强强强强强强强强强强刘乾坤万年两年前为了来思考每年的法律手段你疯了目前我强强强强强强强强强强强强强刘乾坤万年两年前为了来思考每年的法律手段你疯了目前我们努力去外面人了吗;了米女方老大是哪里发你来撒文风给了你手里的你发了什么劳动法;饿了么人类;魔法师空间是你的看法不射控大部分考生蓝风铃看到看见菲尼克斯的缴纳罚款楼上的你发了看到了妇女四点零分': reduceAnswer.analysis}}</div>-->
</li>
</ul>
......@@ -64,19 +113,59 @@
</div>
<div v-if=" optionValue == '多选题'" >
<el-checkbox-group v-model="checkList" @change="handleCheckboxChange" >
<el-checkbox :label="1" :disabled='radioFlag'
:class=" ischeckBox ?(this.reduceAnswer.rightAnswer.replace(/\s/g, '').split(',').includes('A') ? 'checkboxTrueStyle' : 'checkboxFlaseStyle'):'noStyle'">
{{showAnswer.answerA}}
</el-checkbox>
<el-checkbox :label="2" :disabled='radioFlag'
:class=" ischeckBox ?(this.reduceAnswer.rightAnswer.replace(/\s/g, '').split(',').includes('B') ? 'checkboxTrueStyle' : 'checkboxFlaseStyle'):'noStyle'">
{{showAnswer.answerB}}</el-checkbox >
<el-checkbox :label="3" :disabled='radioFlag'
:class=" ischeckBox ?(this.reduceAnswer.rightAnswer.replace(/\s/g, '').split(',').includes('C') ? 'checkboxTrueStyle' : 'checkboxFlaseStyle'):'noStyle'">
{{showAnswer.answerC}}</el-checkbox >
<el-checkbox :label="4" :disabled='radioFlag'
:class=" ischeckBox ?(this.reduceAnswer.rightAnswer.replace(/\s/g, '').split(',').includes('D') ? 'checkboxTrueStyle' : 'checkboxFlaseStyle'):'noStyle'">
{{showAnswer.answerD}}</el-checkbox >
<div style="display: flex">
<el-checkbox :label="1" :disabled='radioFlag'
:class=" ischeckBox ?(this.reduceAnswer.rightAnswer.replace(/\s/g, '').split(',').includes('A') ? 'checkboxTrueStyle' : 'checkboxFlaseStyle'):'noStyle'">
{{showAnswer.answerA}}
</el-checkbox>
<ul v-if="showAnswer.Aimg" style="display: flex;margin-left: 30px">
<li style="overflow: visible;display: flex">
<img :src="showAnswer.Aimg" alt=""
@click="magnifyPhoto(showAnswer.Aimg)"
style="width: 50px; height:45px; margin-left: 10px;margin-top: 5px">
</li>
</ul>
</div>
<div style="display: flex">
<el-checkbox :label="2" :disabled='radioFlag'
:class=" ischeckBox ?(this.reduceAnswer.rightAnswer.replace(/\s/g, '').split(',').includes('B') ? 'checkboxTrueStyle' : 'checkboxFlaseStyle'):'noStyle'">
{{showAnswer.answerB}}
</el-checkbox>
<ul v-if="showAnswer.Bimg" style="display: flex;margin-left: 30px">
<li style="overflow: visible;display: flex">
<img :src="showAnswer.Bimg" alt=""
@click="magnifyPhoto(showAnswer.Bimg)"
style="width: 50px; height:45px; margin-left: 10px;margin-top: 5px">
</li>
</ul>
</div>
<div style="display:flex;">
<el-checkbox :label="3" :disabled='radioFlag'
:class=" ischeckBox ?(this.reduceAnswer.rightAnswer.replace(/\s/g, '').split(',').includes('C') ? 'checkboxTrueStyle' : 'checkboxFlaseStyle'):'noStyle'">
{{showAnswer.answerC}}
</el-checkbox>
<ul v-if="showAnswer.Cimg" style="display: flex;margin-left: 30px">
<li style="overflow: visible;display: flex">
<img :src="showAnswer.Cimg" alt=""
@click="magnifyPhoto(showAnswer.Cimg)"
style="width: 50px; height:45px; margin-left: 10px;margin-top: 5px">
</li>
</ul>
</div>
<div style="display: flex">
<el-checkbox :label="4" :disabled='radioFlag'
:class=" ischeckBox ?(this.reduceAnswer.rightAnswer.replace(/\s/g, '').split(',').includes('D') ? 'checkboxTrueStyle' : 'checkboxFlaseStyle'):'noStyle'">
{{showAnswer.answerD}}
</el-checkbox>
<ul v-if="showAnswer.Dimg" style="display: flex;margin-left: 30px">
<li style="overflow: visible;display: flex">
<img :src="showAnswer.Dimg" alt=""
@click="magnifyPhoto(showAnswer.Dimg)"
style="width: 50px; height:45px; margin-left: 10px;margin-top: 5px">
</li>
</ul>
</div>
</el-checkbox-group>
<el-button class="submitAnswerClass" type="primary" plain v-show="isOptionSelected" @click="submitAnswer" >提交</el-button>
......@@ -87,7 +176,7 @@
<span class="right">{{reduceAnswer.rightAnswer}}</span></li>
<li class="second">
<el-tag>题目解析:</el-tag>
<div class="li2right">{{reduceAnswer.analysis == null ? '无': reduceAnswer.analysis}}</div>
<div class="li2right">{{(reduceAnswer.analysis == null || reduceAnswer.analysis == '') ? '无': reduceAnswer.analysis}}</div>
</li>
</ul>
</div>
......@@ -104,7 +193,7 @@
<span class="right">{{pdtanswer}}</span></li>
<li class="second">
<el-tag>题目解析:</el-tag>
<div class="li2right">{{reduceAnswer.analysis == null ? '无': reduceAnswer.analysis}}</div>
<div class="li2right">{{(reduceAnswer.analysis == null || reduceAnswer.analysis == '')? '无': reduceAnswer.analysis}}</div>
</li>
</ul>
</div>
......@@ -229,9 +318,13 @@ export default {
this.optionValue = "单选题"
this.showAnswer ={
answerA:reduceAnswer.answerA,
Aimg:reduceAnswer.aimg,
answerB:reduceAnswer.answerB,
Bimg:reduceAnswer.bimg,
answerC:reduceAnswer.answerC,
Cimg:reduceAnswer.cimg,
answerD:reduceAnswer.answerD,
Dimg:reduceAnswer.dimg,
}
}else if (reduceAnswer.oneOrMore=='2'){
this.optionValue = "多选题"
......@@ -535,7 +628,7 @@ export default {
.radioFlaseStyle::before{
content: "×";
position: absolute;
top: -25px;
top: -19px;
left: -8px;
color: #f50808;
font-size: 30px;
......@@ -780,6 +873,7 @@ export default {
}
.flexarea {
display: flex;
padding-top: 90px;
}
.flexarea .right {
flex: 1;
......@@ -919,6 +1013,8 @@ export default {
}
#answer .top {
background-color: rgb(39, 118, 223);
position: fixed;
width: 100%;
}
#answer .item {
display: flex;
......@@ -944,6 +1040,7 @@ export default {
align-items: center;
}
#answer {
position:relative;
padding-bottom: 30px;
}
.icon20 {
......
......@@ -105,63 +105,137 @@
<div class="change" v-if="optionValue == '单选题' || optionValue=='多选题'">
<div class="title">
<el-tag>题目:</el-tag><span>在下面的输入框中输入题目,形如--DNS 服务器和DHCP服务器的作用是()</span>
<el-input
type="textarea"
rows="4"
v-model="postChange.question"
placeholder="请输入题目内容"
resize="none"
class="answer">
</el-input>
<el-upload
class="upload-demo"
action="#"
accept="image/jpg,image/jpeg,image/png"
:auto-upload="false"
:on-change="(file, fileList) => {handlePhotoChange(file, fileList);}"
:on-remove="handleRemove"
:file-list="photoList"
list-type="picture">
<div>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
</div>
<div style="display: flex">
<el-input
type="textarea"
rows="4"
v-model="postChange.question"
placeholder="请输入题目内容"
resize="none"
class="answer">
</el-input>
<el-upload
class="upload-demo"
action="#"
accept="image/jpg,image/jpeg,image/png"
:auto-upload="false"
:on-change="(file, fileList) => {handlePhotoChange(file, fileList);}"
:on-remove="handleRemove"
:file-list="photoList"
list-type="picture"
>
<div>
<el-button size="small" type="primary">选择图片</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
</div>
</el-upload>
</div>
</el-upload>
</div>
<div class="options">
<ul>
<li>
<el-tag type="success">A</el-tag>
<el-input
placeholder="请输入选项A的内容"
v-model="postChange.answerA"
clearable="">
</el-input>
<div style="display: flex;width: 1000px;">
<el-input
placeholder="请输入选项A的内容"
v-model="postChange.answerA"
clearable="">
</el-input>
<el-upload
class="oneSelect-upload-demo"
action="#"
accept="image/jpg,image/jpeg,image/png"
:auto-upload="false"
:on-change="(Afile, AfileList) => {AhandlePhotoChange(Afile, AfileList);}"
:on-remove="AhandleRemove"
:file-list="AphotoList"
:on-exceed="exceedFile"
:limit="1"
list-type="picture">
<div>
<el-button size="small" type="primary">选择图片</el-button>
</div>
</el-upload>
</div>
</li>
<li>
<el-tag type="success">B</el-tag>
<el-input
placeholder="请输入选项B的内容"
v-model="postChange.answerB"
clearable="">
</el-input>
<div style="display: flex;width: 1000px;">
<el-input
placeholder="请输入选项B的内容"
v-model="postChange.answerB"
clearable="">
</el-input>
<el-upload
class="oneSelect-upload-demo"
action="#"
accept="image/jpg,image/jpeg,image/png"
:auto-upload="false"
:on-change="(file, fileList) => {BhandlePhotoChange(file, fileList);}"
:on-remove="BhandleRemove"
:file-list="BphotoList"
:on-exceed="exceedFile"
:limit="1"
list-type="picture">
<div>
<el-button size="small" type="primary">选择图片</el-button>
</div>
</el-upload>
</div>
</li>
<li>
<el-tag type="success">C</el-tag>
<el-input
placeholder="请输入选项C的内容"
v-model="postChange.answerC"
clearable="">
</el-input>
<div style="display: flex;width: 1000px;">
<el-input
placeholder="请输入选项C的内容"
v-model="postChange.answerC"
clearable="">
</el-input>
<el-upload
class="oneSelect-upload-demo"
action="#"
accept="image/jpg,image/jpeg,image/png"
:auto-upload="false"
:on-change="(file, fileList) => {ChandlePhotoChange(file, fileList);}"
:on-remove="ChandleRemove"
:file-list="CphotoList"
:on-exceed="exceedFile"
:limit="1"
list-type="picture">
<div>
<el-button size="small" type="primary">选择图片</el-button>
</div>
</el-upload>
</div>
</li>
<li>
<el-tag type="success">D</el-tag>
<el-input
placeholder="请输入选项D的内容"
v-model="postChange.answerD"
clearable="">
</el-input>
<div style="display:flex;width: 1000px;">
<el-input
placeholder="请输入选项D的内容"
v-model="postChange.answerD"
clearable="">
</el-input>
<el-upload
class="oneSelect-upload-demo"
action="#"
accept="image/jpg,image/jpeg,image/png"
:auto-upload="false"
:on-change="(file, fileList) => {DhandlePhotoChange(file, fileList);}"
:on-remove="DhandleRemove"
:file-list="DphotoList"
:on-exceed="exceedFile"
:limit="1"
list-type="picture">
<div>
<el-button size="small" type="primary">选择图片</el-button>
</div>
</el-upload>
</div>
</li>
</ul>
</div>
......@@ -181,65 +255,37 @@
<el-button v-else type="primary" @click="editSubmit()">确认修改</el-button>
</div>
</div>
<!-- &lt;!&ndash; 填空题部分 &ndash;&gt;
<div class="change fill" v-if="optionValue == '填空题'">
<div class="title">
<el-tag>题目:</el-tag><span>输入题目,形如&#45;&#45;从计算机网络系统组成的角度看,计算机网络可以分为()和()。注意需要考生答题部分一定要用括号(英文半角)括起来。</span>
<el-input
type="textarea"
rows="4"
v-model="postFill.question"
placeholder="请输入题目内容"
resize="none"
class="answer">
</el-input>
</div>
<div class="fillAnswer">
<el-tag>正确答案:</el-tag>
<el-input v-model="postFill.answer"></el-input>
</div>
<div class="title analysis">
<el-tag type="success">解析:</el-tag><span>下方输入框中输入答案解析</span>
<el-input
type="textarea"
rows="4"
v-model="postFill.analysis"
placeholder="请输入答案解析"
resize="none"
class="answer">
</el-input>
</div>
<div class="submit">
<el-button type="primary" @click="fillSubmit()">立即添加</el-button>
</div>
</div>-->
<!-- 判断题 -->
<div class="change judge" v-if="optionValue == '判断题'">
<div class="title">
<el-tag>题目:</el-tag><span>在下面的输入框中输入题目</span>
<el-input
type="textarea"
rows="4"
v-model="postJudge.question"
placeholder="请输入题目内容"
resize="none"
class="answer">
</el-input>
<el-upload
class="upload-demo"
action="#"
accept="image/jpg,image/jpeg,image/png"
:auto-upload="false"
:on-change="(file, fileList) => {handlePhotoChange(file, fileList);}"
:on-remove="handleRemove"
:file-list="photoList"
list-type="picture">
<div>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
</div>
<div style="display:flex;">
<el-input
type="textarea"
rows="4"
v-model="postJudge.question"
placeholder="请输入题目内容"
resize="none"
class="answer">
</el-input>
<el-upload
class="upload-demo"
action="#"
accept="image/jpg,image/jpeg,image/png"
:auto-upload="false"
:on-change="(file, fileList) => {handlePhotoChange(file, fileList);}"
:on-remove="handleRemove"
:on-exceed="exceedFile"
:file-list="photoList"
list-type="picture">
<div>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
</div>
</el-upload>
</div>
</el-upload>
</div>
<div class="judgeAnswer">
<el-radio v-model="postJudge.answer" label="T">正确</el-radio>
......@@ -279,7 +325,11 @@
moreSelect:"",
row:{},//路由上的参数
isAddOrEdit:true,
photoList: [],
photoList:[],
AphotoList: [],
BphotoList: [],
CphotoList: [],
DphotoList: [],
changeNumber: null, //选择题出题数量
fillNumber: null, //填空题出题数量
judgeNumber: null, //判断题出题数量
......@@ -368,6 +418,10 @@
answerB: '',
answerC: '',
answerD: '',
Aimg:'',
Bimg:'',
Cimg:'',
Dimg:'',
},
postFill: { //填空题提交内容
subject: '', //试卷名称
......@@ -397,6 +451,10 @@
optionValue(newValue) {
this.postChange.rightAnswer=''
this.photoList=[]
this.AphotoList=[]
this.BphotoList=[]
this.CphotoList=[]
this.DphotoList=[]
// this.postChange = {}
// this.oneSelect= ''
// this.moreSelect = ""
......@@ -408,10 +466,13 @@
const row = JSON.parse(this.$route.query.row);
console.log(row)
this.row = row
if(row.aimg){this.AphotoList.push({url:row.aimg})}
if(row.bimg){this.BphotoList.push({url:row.bimg})}
if(row.cimg){this.BphotoList.push({url:row.cimg})}
if(row.dimg){this.BphotoList.push({url:row.dimg})}
//点击编辑时获取照片信息并回显
this.$axios(`/api/answersPhoto/${row.questionid}/${row.tablename}/${row.paperid}`).then(res => {
const imgs = res.data.data
console.log(imgs)
if (imgs && imgs.length>0){
imgs.forEach(img=>{
this.photoList.push({
......@@ -419,7 +480,6 @@
})
})
}
console.log(this.photoList)
})
this.isAddOrEdit = false
if (row.oneOrMore=='1'){ //单选题
......@@ -459,14 +519,54 @@
this.getParams()
},
methods: {
//设置只能上传一个文件
exceedFile(files, fileList) {
this.$message.error(
`只能选择 1 个图片,当前共选择了 ${files.length + fileList.length} 个`
);
},
//添加照片
AhandlePhotoChange(file, fileList) {
let self = this;
self.AphotoList = fileList
},
BhandlePhotoChange(file, fileList) {
let self = this;
self.BphotoList = fileList
},
ChandlePhotoChange(file, fileList) {
let self = this;
self.CphotoList = fileList
},
DhandlePhotoChange(file, fileList) {
let self = this;
self.DphotoList = fileList
},
//添加照片
handlePhotoChange(file, fileList) {
let self = this;
self.photoList = fileList
},
//移除照片
AhandleRemove(file,fileList) {
let self = this;
self.AphotoList = fileList
},
BhandleRemove(file,fileList) {
let self = this;
self.BphotoList = fileList
},
ChandleRemove(file,fileList) {
let self = this;
self.CphotoList = fileList
},
DhandleRemove(file,fileList) {
let self = this;
self.DphotoList = fileList
},
//移除照片
handleRemove(file,fileList) {
this.photoList =fileList
let self = this;
self.photoList = fileList
},
create() {
this.$axios({
......@@ -511,6 +611,8 @@
this.postChange.oneOrMore = '1'
this.postChange.rightAnswer = this.oneSelect
this.postChange.subject = this.subject
this.getABCDImg()
console.log(this.postChange)
if (this.optionValue=='多选题' && this.moreSelect){
this.postChange.rightAnswer = this.moreSelect.join(', ');
this.postChange.oneOrMore = '2'
......@@ -518,9 +620,7 @@
this.$axios({ //提交数据到选择题题库表
url: '/api/MultiQuestion',
method: 'post',
data: {
...this.postChange
}
data: {...this.postChange}
}).then(res => { //添加成功显示提示
let status = res.data.code
if(status == 200) {
......@@ -551,6 +651,64 @@
})
})
},
processImageFile(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
const blob = new Blob([file.raw]);
reader.onload = (event) => {
const base64 = event.target.result;
const imageDataUrl = base64.replace(/^[^,]+/, 'data:image/jpg;base64');
resolve(imageDataUrl);
};
reader.onerror = (error) => {
reject(error);
};
reader.readAsDataURL(blob);
});
},
getABCDImg(){
let self = this;
if (this.AphotoList[0]){
const file = this.AphotoList[0];
this.processImageFile(file)
.then((imageDataUrl) => {
self.postChange.Aimg = imageDataUrl;
})
.catch((error) => {
console.error(error);
});
}
if (this.BphotoList[0]){
const file = this.BphotoList[0]; // 获取文件对象
this.processImageFile(file)
.then((imageDataUrl) => {
self.postChange.Bimg = imageDataUrl;
})
.catch((error) => {
console.error(error);
});
}
if (this.CphotoList[0]){
const file = this.CphotoList[0]; // 获取文件对象
this.processImageFile(file)
.then((imageDataUrl) => {
self.postChange.Cimg = imageDataUrl;
})
.catch((error) => {
console.error(error);
});
}
if (this.DphotoList[0]){
const file = this.DphotoList[0]; // 获取文件对象
this.processImageFile(file)
.then((imageDataUrl) => {
self.postChange.Dimg = imageDataUrl;
})
.catch((error) => {
console.error(error);
});
}
},
//单选多选修改
editSubmit(){
console.log(this.photoList)
......@@ -566,6 +724,7 @@
this.postChange.subject = this.row.subject
this.postChange.questionid = this.row.questionid
this.postChange.tablename = this.row.tablename
this.getABCDImg()
this.$axios({ //提交数据到选择题题库表
url: '/api/updateAnswers',
method: 'post',
......@@ -573,6 +732,7 @@
...this.postChange
}
}).then(res => {
console.log(self.row)
var params = new FormData();
params.append('questionId',self.row.questionid)
params.append('questionType','1')
......@@ -687,6 +847,11 @@
</script>
<style lang="less" scoped>
.options{
/deep/.el-input__inner{
height: -webkit-fill-available !important;
}
}
//小对号
/deep/.el-upload-list__item-status-label{
display: block;
......@@ -695,6 +860,11 @@
.upload-demo{
height: 100px;
display: flex;
margin-top: 20px;
}
//单选选项的上传
.oneSelect-upload-demo{
display: flex;
}
//图片列表
/deep/.el-upload-list--picture{
......@@ -735,6 +905,8 @@
}
}
.change {
max-height: 660px; /* 设置固定高度,根据需要调整 */
overflow: auto; /* 添加滚动条 */
margin-top: 20px;
padding: 20px 16px;
background-color: #E7F6F6;
......@@ -753,6 +925,7 @@
}
}
.options {
display: flex;
ul {
display: flex;
flex-direction: column;
......
......@@ -44,6 +44,7 @@
accept="video/*"
:on-change="handlePhotoChange"
:limit="1"
ref="uploadRef"
:show-file-list="false">
<el-button slot="trigger" type="primary" style="margin-left: 10px;" title="只能上传视频文件">上传视频</el-button>
</el-upload>
......@@ -160,6 +161,7 @@
this.videoName = file.name
this.fileList.push(file.raw);
this.submitForm();
},
//移除
handleRemove(file) {
......@@ -195,7 +197,9 @@
this.fileList = []
this.video = ''
this.$message.success('添加成功');
this.videoList()
this.videoList();
// 重置上传组件
this.$refs.uploadRef.clearFiles();
}
})
},
......
......@@ -23,7 +23,7 @@
<source v-for="(item, index) in vUrl"
:key="index"
:src="item"
:type="`${getUrlType(item)}`">
type="video/mp4">
Your browser does not support the video element.
</video>
</template>
......
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