Commit a15e2609 authored by 黄奎's avatar 黄奎

页面修改

parent 72f0d618
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
uploadType: "1", //1-上传图片,2-上传附件,3-上传音频 uploadType: "1", //1-上传图片,2-上传附件,3-上传音频
//默认图片域名 //默认图片域名
defaultImgDomain: "http://imgfile.oytour.com/static/", defaultImgDomain: "http://imgfile.oytour.com/static/",
ViewDomain: "http://192.168.1.36:8140",
}; };
}, },
watch: { watch: {
...@@ -104,7 +105,6 @@ ...@@ -104,7 +105,6 @@
}, },
//选择文件弹窗 //选择文件弹窗
attachmentSelected(fileArray) { attachmentSelected(fileArray) {
console.log("this.uploadType", this.uploadType)
if (fileArray && fileArray.length) { if (fileArray && fileArray.length) {
let html = ''; let html = '';
//图片 //图片
...@@ -114,19 +114,17 @@ ...@@ -114,19 +114,17 @@
}) })
} }
//附件 //附件
else if (this.uploadType == 2) { else {
fileArray.forEach(item => { fileArray.forEach(item => {
var obj = this.getIcon(item.fileName);
html += this.getIconContent(item); html += this.getIconContent(item);
if (obj.fileType == 4) {
html += this.audioIframeStr(item);
} else if (obj.fileType == 1 || obj.fileType == 2 || obj.fileType == 3) {
html += this.fileIframeList(item,obj.fileType);
}
}) })
} }
//音频
else if (this.uploadType == 3) {
fileArray.forEach(item => {
html += this.getIconContent(item);
html += this.audioIframeStr(item);
})
}
if (html && html != '') { if (html && html != '') {
this.ue.execCommand('inserthtml', html); this.ue.execCommand('inserthtml', html);
} }
...@@ -143,7 +141,8 @@ ...@@ -143,7 +141,8 @@
getIcon(fileName) { getIcon(fileName) {
var obj = { var obj = {
iconUrl: "", iconUrl: "",
dataType: "" dataType: "",
fileType: 0, //1视频,2-pdf,3-word、ppt、xls,4-mp3
} }
if (!fileName) { if (!fileName) {
obj.iconUrl = this.defaultImgDomain + "file.png"; obj.iconUrl = this.defaultImgDomain + "file.png";
...@@ -155,63 +154,53 @@ ...@@ -155,63 +154,53 @@
obj.dataType = type; obj.dataType = type;
if (type === 'video' || type === 'svideo') { if (type === 'video' || type === 'svideo') {
obj.iconUrl = this.defaultImgDomain + "video.png"; obj.iconUrl = this.defaultImgDomain + "video.png";
obj.fileType = 1;
} else if (type === 'txt' || type === 'text') { } else if (type === 'txt' || type === 'text') {
obj.iconUrl = this.defaultImgDomain + "txt.png"; obj.iconUrl = this.defaultImgDomain + "txt.png";
} else if (type === 'xls' || type === 'xlsx') { } else if (type === 'xls' || type === 'xlsx') {
obj.iconUrl = this.defaultImgDomain + "excel.png"; obj.iconUrl = this.defaultImgDomain + "excel.png";
obj.fileType = 3;
} else if (type === 'doc' || type === 'docx') { } else if (type === 'doc' || type === 'docx') {
obj.iconUrl = this.defaultImgDomain + "word.png"; obj.iconUrl = this.defaultImgDomain + "word.png";
obj.fileType = 3;
} else if (type === 'zip' || type === 'rar' || type === 'gz') { } else if (type === 'zip' || type === 'rar' || type === 'gz') {
obj.iconUrl = this.defaultImgDomain + "zip.png"; obj.iconUrl = this.defaultImgDomain + "zip.png";
} else if (type === 'mp3') { } else if (type === 'mp3') {
obj.iconUrl = this.defaultImgDomain + "sound.png"; obj.iconUrl = this.defaultImgDomain + "sound.png";
obj.fileType = 4;
} else if (type === 'pdf') { } else if (type === 'pdf') {
obj.iconUrl = this.defaultImgDomain + "pdf.png"; obj.iconUrl = this.defaultImgDomain + "pdf.png";
obj.fileType = 2;
} else if (type === 'ppt' || type === 'pptx') { } else if (type === 'ppt' || type === 'pptx') {
obj.iconUrl = this.defaultImgDomain + "ppt.png"; obj.iconUrl = this.defaultImgDomain + "ppt.png";
obj.fileType = 3;
} else if (type === 'avi' || type === 'rmvb' || type === '3gp' || type === 'mpg' || } else if (type === 'avi' || type === 'rmvb' || type === '3gp' || type === 'mpg' ||
type === 'mpeg' || type === 'mov' || type === 'wmv' || type === 'asf' || type === 'mpeg' || type === 'mov' || type === 'wmv' || type === 'asf' ||
type === 'mkv' || type === 'mp4' || type === 'vob' || type === 'f4v' || type === 'mkv' || type === 'mp4' || type === 'vob' || type === 'f4v' ||
type === 'flv') { type === 'flv') {
obj.iconUrl = this.defaultImgDomain + "movie.png"; obj.iconUrl = this.defaultImgDomain + "movie.png";
obj.fileType = 1;
} else { } else {
obj.iconUrl = this.defaultImgDomain + "unknown.png"; obj.iconUrl = this.defaultImgDomain + "unknown.png";
} }
return obj; return obj;
}, },
//音频[MP3]
audioIframeStr(data) { audioIframeStr(data) {
var fileUrl = encodeURIComponent(data.fileUrl); var fileUrl = encodeURIComponent(data.fileUrl);
return '<p><iframe height="62px" width="auto" frameborder="0" allowtransparency="true" ' + return '<p><iframe height="62px" width="auto" frameborder="0" allowtransparency="true" ' +
' style="background-color:transparent;border-radius: 3px;overflow: hidden;z-index: 0;" scrolling="no" ' + ' style="background-color:transparent;border-radius: 3px;overflow: hidden;z-index: 0;" scrolling="no" ' +
' src="http://192.168.1.36:8140/index.html?fileName='+data.fileName+'&url='+ fileUrl + ' src="' + this.ViewDomain + '/index.html?fileName=' + data.fileName + '&url=' + fileUrl +
'" class="ans-insertaudio-module" module="_insertaudio">' + ' </iframe></p>'; '" class="ans-insertaudio-module" module="_insertaudio">' + ' </iframe></p>';
}, },
//其他方法 //视频、PDF、WORD、PPT、EXCEL
getTypeList(data){ fileIframeList(data,fileType) {
//视频1 音频 2 ppt/word 3 //视频1 音频 2 ppt/word 3
if(this.uploadType==3){ var fileUrl = encodeURIComponent(data.fileUrl);
var fileUrl = encodeURIComponent(data.fileUrl); return '<p><iframe height="62px" width="auto" frameborder="0" allowtransparency="true" ' +
return '<p><iframe height="62px" width="auto" frameborder="0" allowtransparency="true" ' + ' style="background-color:transparent;border-radius: 3px;overflow: hidden;z-index: 0;" scrolling="no" ' +
' style="background-color:transparent;border-radius: 3px;overflow: hidden;z-index: 0;" scrolling="no" ' + ' src="' + this.ViewDomain + '/read.html?fileName=' + data.fileName + '&url=' + fileUrl + '&fileType=' + fileType+
' src="http://192.168.1.36:8140/read.html?fileName='+data.fileName+'&url='+ fileUrl +'&fileType='+2+ '" class="ans-insertaudio-module" module="_insertaudio">' + ' </iframe></p>'; '" class="ans-insertaudio-module" module="_insertaudio">' + ' </iframe></p>';
}
if(this.uploadType==2){
'<p class="attachNew" ><em style="font-style:normal; display:block;min-height:2px;"></em>' +
'<span data="' + objId + '" type="' + dataType + '" name="' + fileName + '" contenteditable="false" style="margin-top:10px;background:#F7F8FA;padding:14px 16px;max-width:572px;zoom:1;overflow:hidden;cursor:pointer;display:block;position: relative;" >' +
'<img src="http://mooc2-ans.chaoxing.com/images/questionbank/icon/' + iconName + '" style=" width:42px; height:42px; overflow:hidden; margin-right:14px; display:block; border-radius:4px;float:left;">' +
'<span style=" display:block;min-height:42px; display:table-cell; vertical-align:middle;display:-webkit-box; -webkit-box-pack:center; -webkit-box-orient:vertical; display:-moz-box; -moz-box-pack:center; -moz-box-orient:vertical;">\n' +
'\t\t<span style=" -webkit-box-flex:1; width:510px\\0; display:block; display:-webkit-box; -webkit-box-pack:center; -webkit-box-orient:vertical; display:-moz-box; -moz-box-pack:center; -moz-box-orient:vertical;">\n' +
'\t\t\t<span style=" padding-right:72px; padding-right:0\\9; font-size:14px; color:#181E33; line-height:20px; display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">' + fileName + '</span>\n' +
'\t\t\t<span style=" display:block; padding-right:72px; padding-right:0\\9; line-height:18px; margin-top:4px; font-size:12px; color:#A8A8B3; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;">' + size + '</span>\n' +
'\t\t</span>\n' +
'\t</span>\n' +
'</span></p>';
}
}, },
loadUe() { loadUe() {
const _this = this; const _this = this;
......
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