Commit 27bdded4 authored by zhengke's avatar zhengke
parents df8eba5d 85be4f66
...@@ -89,32 +89,74 @@ ...@@ -89,32 +89,74 @@
this.attachmentDialogVisible = false; this.attachmentDialogVisible = false;
}, },
//选择文件弹窗 //选择文件弹窗
attachmentSelected(e) { attachmentSelected(fileArray) {
if (e.length) { console.log("fileArray",fileArray);
if (fileArray&&fileArray.length) {
let html = ''; let html = '';
//图片
if (this.uploadType == 1) { if (this.uploadType == 1) {
for (let i in e) { for (let i in e) {
html += '<img src="' + e[i].fileUrl + '" style="max-width: 100%;">'; html += '<img src="' + e[i].fileUrl + '" style="max-width: 100%;">';
} }
} }
if (this.uploadType == 2) { //附件
if (this.uploadType == 2 || this.uploadType == 3 ) {
for (let i in e) { for (let i in e) {
var type = e[i].fileName.split('.')[1]; var type = e[i].fileName.split('.')[1];
if(type=='xlsx'||type=='xls'){ var imgUrl = "";
html += var dataName = "";
`<p><span contenteditable="false" style="display:-webkit-box;margin-top:10px;background: #F7F8FA;padding: 14px 16px;max-width: 572px;overflow: hidden;cursor:pointer;-webkit-box-align: center;text-align:left;cursor:pointer;" name="${e[i].fileName}" data="xls">` + if (type == 'xlsx' || type == 'xls') {
`<img src="http://mooc2-ans.chaoxing.com/images/questionbank/icon/excel.png" style="width:42px; height:42px; overflow:hidden; margin-right:14px;border-radius:4px;"><span style="font-size:14px; color:#181E33; line-height:20px; display:block; overflow:hidden; text-overflow:ellipsis;">${e[i].fileName}</span></span></p>` imgUrl = "http://imgfile.oytour.com/static/excel.png";
dataName = "xls";
} }
if(type=='txt'){ if (type == 'txt') {
html += imgUrl = "http://imgfile.oytour.com/static/txt.png";
`<p><span contenteditable="false" style="display:-webkit-box;margin-top:10px;background: #F7F8FA;padding: 14px 16px;max-width: 572px;overflow: hidden;cursor:pointer;-webkit-box-align: center;text-align:left;cursor:pointer;" name="${e[i].fileName}" data="xls">` + dataName = "txt";
`<img src="http://mooc2-ans.chaoxing.com/images/questionbank/icon/txt.png" style="width:42px; height:42px; overflow:hidden; margin-right:14px;border-radius:4px;"><span style="font-size:14px; color:#181E33; line-height:20px; display:block; overflow:hidden; text-overflow:ellipsis;">${e[i].fileName}</span></span></p>` }
if (type == 'ppt' || type == 'pptx') {
imgUrl = "http://imgfile.oytour.com/static/ppt.png";
dataName = "ppt";
}
if (type == 'doc' || type == 'docx') {
imgUrl = "http://imgfile.oytour.com/static/word.png";
dataName = "doc";
}
if (type == 'mp3') {
imgUrl = "http://imgfile.oytour.com/static/video.png";
dataName = "mp3";
} }
if(type=='ppt'||type=='pptx'){
html += html +=
`<p><span contenteditable="false" style="display:-webkit-box;margin-top:10px;background: #F7F8FA;padding: 14px 16px;max-width: 572px;overflow: hidden;cursor:pointer;-webkit-box-align: center;text-align:left;cursor:pointer;" name="${e[i].fileName}" data="xls">` + `<p><span contenteditable="false" style="display:-webkit-box;margin-top:10px;background: #F7F8FA;padding: 14px 16px;max-width: 572px;overflow: hidden;cursor:pointer;-webkit-box-align: center;text-align:left;cursor:pointer;" name="${e[i].dataName}" data="${e[i].fileName}">` +
`<img src="http://mooc2-ans.chaoxing.com/images/questionbank/icon/ppt.png" style="width:42px; height:42px; overflow:hidden; margin-right:14px;border-radius:4px;"><span style="font-size:14px; color:#181E33; line-height:20px; display:block; overflow:hidden; text-overflow:ellipsis;">${e[i].fileName}</span></span></p>` `<img src="${imgUrl}" style="width:42px; height:42px; overflow:hidden; margin-right:14px;border-radius:4px;"><span style="font-size:14px; color:#181E33; line-height:20px; display:block; overflow:hidden; text-overflow:ellipsis;">${e[i].fileName}</span></span></p>`
}
}
if(this.uploadType==3)
{
for (let i in e) {
var type = e[i].fileName.split('.')[1];
var imgUrl = "";
var dataName = "";
if (type == 'xlsx' || type == 'xls') {
imgUrl = "http://imgfile.oytour.com/static/excel.png";
dataName = "xls";
}
if (type == 'txt') {
imgUrl = "http://imgfile.oytour.com/static/txt.png";
dataName = "txt";
}
if (type == 'ppt' || type == 'pptx') {
imgUrl = "http://imgfile.oytour.com/static/ppt.png";
dataName = "ppt";
} }
if (type == 'doc' || type == 'docx') {
imgUrl = "http://imgfile.oytour.com/static/word.png";
dataName = "doc";
}
html +=
`<p><span contenteditable="false" style="display:-webkit-box;margin-top:10px;background: #F7F8FA;padding: 14px 16px;max-width: 572px;overflow: hidden;cursor:pointer;-webkit-box-align: center;text-align:left;cursor:pointer;" name="${e[i].dataName}" data="${e[i].fileName}">` +
`<img src="${imgUrl}" style="width:42px; height:42px; overflow:hidden; margin-right:14px;border-radius:4px;"><span style="font-size:14px; color:#181E33; line-height:20px; display:block; overflow:hidden; text-overflow:ellipsis;">${e[i].fileName}</span></span></p>`
} }
} }
this.ue.execCommand('inserthtml', html); this.ue.execCommand('inserthtml', html);
......
...@@ -52,12 +52,12 @@ ...@@ -52,12 +52,12 @@
<template> <template>
<span>{{subIndex+1}}小题 {{subItem.SubTitle}}</span><br /> <span>{{subIndex+1}}小题 {{subItem.SubTitle}}</span><br />
</template> </template>
<template v-if="subItem.QuestionKey=='single'||subItem.QuestionKey=='multiple'" <template v-if=" subItem.QuestionKey=='single'||subItem.QuestionKey=='multiple'|| subItem.QuestionKey=='single-number'"
v-for="childItem in subItem.SubAnwser"> v-for="childItem in subItem.SubAnwser">
<span>{{childItem.Name}}.{{childItem.Content}} </span><br /> <span>{{childItem.Name}}.{{childItem.Content}} </span><br />
</template> </template>
</span> </span>
<template v-if="subItem.QuestionKey=='single'||subItem.QuestionKey=='multiple'"> <template v-if="subItem.QuestionKey=='single'||subItem.QuestionKey=='multiple'|| subItem.QuestionKey=='single-number'">
<template v-for="childItem in subItem.SubAnwser"> <template v-for="childItem in subItem.SubAnwser">
<span v-if="childItem.IsAnswer">答案:{{childItem.Name}} </span> <span v-if="childItem.IsAnswer">答案:{{childItem.Name}} </span>
<br v-if="childItem.IsAnswer" /> <br v-if="childItem.IsAnswer" />
......
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