Commit 7da0f74e by 宋珺琪

添加视频按钮、解决添加照片bug

parent 79da9020
...@@ -23,6 +23,13 @@ ...@@ -23,6 +23,13 @@
}}" class="router1">个人统计 }}" class="router1">个人统计
</router-link> </router-link>
</li> </li>
<li>
<router-link
:to="{
path: '/videoList',
}" class="router1">视频
</router-link>
</li>
<li><i class="iconfont icon-arrLeft icon20"></i></li> <li><i class="iconfont icon-arrLeft icon20"></i></li>
</ul> </ul>
</div> </div>
...@@ -1039,6 +1046,13 @@ export default { ...@@ -1039,6 +1046,13 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
} }
//视频
#answer .top .item li:nth-child(5){
display: flex;
align-items: center;
justify-content: center;
margin-left: 10px;
}
#answer { #answer {
position:relative; position:relative;
padding-bottom: 30px; padding-bottom: 30px;
......
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
action="#" action="#"
accept="image/jpg,image/jpeg,image/png" accept="image/jpg,image/jpeg,image/png"
:auto-upload="false" :auto-upload="false"
:on-change="(file, fileList) => {BhandlePhotoChange(file, fileList);}" :on-change="(Bfile, BfileList) => {BhandlePhotoChange(Bfile, BfileList);}"
:on-remove="BhandleRemove" :on-remove="BhandleRemove"
:file-list="BphotoList" :file-list="BphotoList"
:on-exceed="exceedFile" :on-exceed="exceedFile"
...@@ -418,10 +418,10 @@ ...@@ -418,10 +418,10 @@
answerB: '', answerB: '',
answerC: '', answerC: '',
answerD: '', answerD: '',
Aimg:'', aimg:'',
Bimg:'', bimg:'',
Cimg:'', cimg:'',
Dimg:'', dimg:'',
}, },
postFill: { //填空题提交内容 postFill: { //填空题提交内容
subject: '', //试卷名称 subject: '', //试卷名称
...@@ -449,15 +449,18 @@ ...@@ -449,15 +449,18 @@
//监听optionValue题目类型的变化 去重置正确选项的值 //监听optionValue题目类型的变化 去重置正确选项的值
watch: { watch: {
optionValue(newValue) { optionValue(newValue) {
this.postChange.rightAnswer='' if (!this.$route.query.row){
//如果不是编辑再监听执行重置的操作
this.photoList=[] this.photoList=[]
this.AphotoList=[] this.AphotoList=[]
this.BphotoList=[] this.BphotoList=[]
this.CphotoList=[] this.CphotoList=[]
this.DphotoList=[] this.DphotoList=[]
// this.postChange = {} this.postChange = {}
// this.oneSelect= '' this.oneSelect= ''
// this.moreSelect = "" this.moreSelect = ""
}
} }
}, },
created() { created() {
...@@ -466,10 +469,6 @@ ...@@ -466,10 +469,6 @@
const row = JSON.parse(this.$route.query.row); const row = JSON.parse(this.$route.query.row);
console.log(row) console.log(row)
this.row = 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 => { this.$axios(`/api/answersPhoto/${row.questionid}/${row.tablename}/${row.paperid}`).then(res => {
const imgs = res.data.data const imgs = res.data.data
...@@ -514,7 +513,10 @@ ...@@ -514,7 +513,10 @@
this.postJudge.answer = row.rightAnswer this.postJudge.answer = row.rightAnswer
this.postJudge.analysis = row.analysis //解析 this.postJudge.analysis = row.analysis //解析
} }
if(row.aimg){this.AphotoList.push({url:row.aimg})}
if(row.bimg){this.BphotoList.push({url:row.bimg})}
if(row.cimg){this.CphotoList.push({url:row.cimg})}
if(row.dimg){this.DphotoList.push({url:row.dimg})}
} }
this.getParams() this.getParams()
}, },
...@@ -542,11 +544,11 @@ ...@@ -542,11 +544,11 @@
let self = this; let self = this;
self.DphotoList = fileList self.DphotoList = fileList
}, },
//添加照片
handlePhotoChange(file, fileList) { handlePhotoChange(file, fileList) {
let self = this; let self = this;
self.photoList = fileList self.photoList = fileList
}, },
//移除照片
AhandleRemove(file,fileList) { AhandleRemove(file,fileList) {
let self = this; let self = this;
self.AphotoList = fileList self.AphotoList = fileList
...@@ -563,7 +565,6 @@ ...@@ -563,7 +565,6 @@
let self = this; let self = this;
self.DphotoList = fileList self.DphotoList = fileList
}, },
//移除照片
handleRemove(file,fileList) { handleRemove(file,fileList) {
let self = this; let self = this;
self.photoList = fileList self.photoList = fileList
...@@ -606,21 +607,22 @@ ...@@ -606,21 +607,22 @@
this.postPaper.paperId = paperId this.postPaper.paperId = paperId
}, },
//选择题题库提交 //选择题题库提交
changeSubmit() { async changeSubmit() {
await this.getABCDImg()
let self = this; let self = this;
this.postChange.oneOrMore = '1' this.postChange.oneOrMore = '1'
this.postChange.rightAnswer = this.oneSelect this.postChange.rightAnswer = this.oneSelect
this.postChange.subject = this.subject this.postChange.subject = this.subject
this.getABCDImg()
console.log(this.postChange)
if (this.optionValue=='多选题' && this.moreSelect){ if (this.optionValue=='多选题' && this.moreSelect){
this.postChange.rightAnswer = this.moreSelect.join(', '); this.postChange.rightAnswer = this.moreSelect.join(', ');
this.postChange.oneOrMore = '2' this.postChange.oneOrMore = '2'
} }
console.log(self.postChange)
this.$axios({ //提交数据到选择题题库表 this.$axios({ //提交数据到选择题题库表
url: '/api/MultiQuestion', url: '/api/MultiQuestion',
method: 'post', method: 'post',
data: {...this.postChange} data: {...self.postChange}
}).then(res => { //添加成功显示提示 }).then(res => { //添加成功显示提示
let status = res.data.code let status = res.data.code
if(status == 200) { if(status == 200) {
...@@ -634,7 +636,6 @@ ...@@ -634,7 +636,6 @@
let questionId = res.data.data.questionId let questionId = res.data.data.questionId
this.postPaper.questionId = questionId this.postPaper.questionId = questionId
this.postPaper.questionType = 1 this.postPaper.questionType = 1
console.log(this.postPaper)
var params = new FormData(); var params = new FormData();
params.append('questionId',questionId) params.append('questionId',questionId)
params.append('questionType','1') params.append('questionType','1')
...@@ -666,52 +667,70 @@ ...@@ -666,52 +667,70 @@
reader.readAsDataURL(blob); reader.readAsDataURL(blob);
}); });
}, },
getABCDImg(){ async getABCDImg(){
let self = this; let self = this;
if (this.AphotoList[0]){ if (self.AphotoList[0]){
const file = this.AphotoList[0]; const file = self.AphotoList[0];
this.processImageFile(file) if (file.raw){
await self.processImageFile(file)
.then((imageDataUrl) => { .then((imageDataUrl) => {
self.postChange.Aimg = imageDataUrl; self.postChange.aimg = imageDataUrl;
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
}); });
}else {
self.postChange.aimg = file.url
} }
if (this.BphotoList[0]){ }
const file = this.BphotoList[0]; // 获取文件对象 if (self.BphotoList[0]){
this.processImageFile(file) const file = self.BphotoList[0]; // 获取文件对象
if (file.raw){
await self.processImageFile(file)
.then((imageDataUrl) => { .then((imageDataUrl) => {
self.postChange.Bimg = imageDataUrl; self.postChange.bimg = imageDataUrl;
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
}); });
}else {
self.postChange.bimg = file.url
} }
if (this.CphotoList[0]){
const file = this.CphotoList[0]; // 获取文件对象 }
this.processImageFile(file) if (self.CphotoList[0]){
const file = self.CphotoList[0]; // 获取文件对象
if (file.raw){
await self.processImageFile(file)
.then((imageDataUrl) => { .then((imageDataUrl) => {
self.postChange.Cimg = imageDataUrl; self.postChange.cimg = imageDataUrl;
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
}); });
}else {
self.postChange.cimg = file.url
} }
if (this.DphotoList[0]){
const file = this.DphotoList[0]; // 获取文件对象 }
this.processImageFile(file) if (self.DphotoList[0]){
const file = self.DphotoList[0]; // 获取文件对象
if (file.raw){
await self.processImageFile(file)
.then((imageDataUrl) => { .then((imageDataUrl) => {
self.postChange.Dimg = imageDataUrl; self.postChange.dimg = imageDataUrl;
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
}); });
}else {
self.postChange.dimg = file.url
}
} }
}, },
//单选多选修改 //单选多选修改
editSubmit(){ async editSubmit(){
console.log(this.photoList)
let self = this; let self = this;
this.postChange.oneOrMore = '1' this.postChange.oneOrMore = '1'
this.postChange.rightAnswer = this.oneSelect this.postChange.rightAnswer = this.oneSelect
...@@ -724,7 +743,7 @@ ...@@ -724,7 +743,7 @@
this.postChange.subject = this.row.subject this.postChange.subject = this.row.subject
this.postChange.questionid = this.row.questionid this.postChange.questionid = this.row.questionid
this.postChange.tablename = this.row.tablename this.postChange.tablename = this.row.tablename
this.getABCDImg() await this.getABCDImg()
this.$axios({ //提交数据到选择题题库表 this.$axios({ //提交数据到选择题题库表
url: '/api/updateAnswers', url: '/api/updateAnswers',
method: 'post', method: 'post',
...@@ -732,7 +751,6 @@ ...@@ -732,7 +751,6 @@
...this.postChange ...this.postChange
} }
}).then(res => { }).then(res => {
console.log(self.row)
var params = new FormData(); var params = new FormData();
params.append('questionId',self.row.questionid) params.append('questionId',self.row.questionid)
params.append('questionType','1') params.append('questionType','1')
...@@ -744,7 +762,6 @@ ...@@ -744,7 +762,6 @@
params.append('files', base64.dataURLtoFile(file.url)); params.append('files', base64.dataURLtoFile(file.url));
} }
}); });
console.log(params)
this.$axios({ this.$axios({
url: '/api/updateAnswersPhoto', url: '/api/updateAnswersPhoto',
method: 'Post', method: 'Post',
...@@ -789,7 +806,6 @@ ...@@ -789,7 +806,6 @@
params.append('files', base64.dataURLtoFile(file.url)); params.append('files', base64.dataURLtoFile(file.url));
} }
}); });
console.log(params)
this.$axios({ this.$axios({
url: '/api/updateAnswersPhoto', url: '/api/updateAnswersPhoto',
method: 'Post', method: 'Post',
......
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