富文本添加视频上传

master
yujialong 3 months ago
parent 081c4613bf
commit a0d8246419
  1. 5
      public/static/ueditorPlus/dialogs/video/video.js
  2. 14
      public/static/ueditorPlus/ueditor.config.js
  3. 10
      src/pages/testPaper/detail/index.vue

@ -321,14 +321,13 @@
/* 插入上传视频 */ /* 插入上传视频 */
function insertUpload () { function insertUpload () {
var videoObjs = [], var videoObjs = [],
uploadDir = editor.getOpt('videoUrlPrefix'),
width = $G('upload_width').value || 420, width = $G('upload_width').value || 420,
height = $G('upload_height').value || 280, height = $G('upload_height').value || 280,
align = findFocus("upload_alignment", "name") || 'none'; align = findFocus("upload_alignment", "name") || 'none';
for (var key in uploadVideoList) { for (var key in uploadVideoList) {
var file = uploadVideoList[key]; var file = uploadVideoList[key];
videoObjs.push({ videoObjs.push({
url: uploadDir + file.url, url: file.url,
width: width, width: width,
height: height, height: height,
align: align align: align
@ -420,6 +419,7 @@
$('#filePickerReady').after($('<div>').html(lang.errorNotSupport)).hide(); $('#filePickerReady').after($('<div>').html(lang.errorNotSupport)).hide();
return; return;
} else if (!editor.getOpt('videoActionName')) { } else if (!editor.getOpt('videoActionName')) {
console.log("🚀 ~ actionUrl:", actionUrl, editor, editor.getOpt('videoActionName'))
$('#filePickerReady').after($('<div>').html(lang.errorLoadConfig)).hide(); $('#filePickerReady').after($('<div>').html(lang.errorLoadConfig)).hide();
return; return;
} }
@ -778,7 +778,6 @@
try { try {
var responseText = (ret._raw || ret), var responseText = (ret._raw || ret),
json = utils.str2json(responseText); json = utils.str2json(responseText);
json = editor.getOpt('serverResponsePrepare')(json);
if (json.state == 'SUCCESS') { if (json.state == 'SUCCESS') {
uploadVideoList.push({ uploadVideoList.push({
'url': json.url, 'url': json.url,

@ -49,6 +49,7 @@
UEDITOR_CORS_URL: CORS_URL, UEDITOR_CORS_URL: CORS_URL,
loadConfigFromServer: false,
// 服务器统一请求接口路径 // 服务器统一请求接口路径
serverUrl: "http://192.168.31.51:9000/exam/exam/upload/configAndUpload", serverUrl: "http://192.168.31.51:9000/exam/exam/upload/configAndUpload",
imageActionName: "imgUpload", imageActionName: "imgUpload",
@ -59,10 +60,12 @@
".gif", ".gif",
".bmp" ".bmp"
], ],
fontfamily: [], fontfamily: [],
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义 //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义
// , "insertvideo"
toolbars: [ toolbars: [
["fullscreen", "source", "|", "bold", "italic", "underline", "forecolor", "fontfamily", "fontsize", "|", "justifyleft", "justifycenter", "justifyright", "justifyjustify", "|", "insertimage", "inserttable", 'formula', "gapfilling", 'combox'] ["fullscreen", "source", "|", "bold", "italic", "underline", "forecolor", "fontfamily", "fontsize", "|", "link", "unlink", "anchor", "|", "imagenone", "imageleft", "imagecenter", "imageright", "|", "justifyleft", "justifycenter", "justifyright", "justifyjustify", "|", "insertcode", "insertimage", "insertvideo", "inserttable", 'formula', "gapfilling", 'combox']
] ]
// 公式配置 // 公式配置
, formulaConfig: { , formulaConfig: {
@ -95,12 +98,19 @@
// return true; // return true;
// } // }
} }
// 插入图片自定义配置 // 插入图片自定义配置
, imageConfig: { , imageConfig: {
// 禁止本地上传 // 禁止本地上传
disableUpload: false, disableUpload: false,
} }
, videoConfig: {
disableUpload: false,
selectCallback: null,
}
, videoActionName: 'imgUpload'
, videoAllowFiles: [
".mp4",
]
, zIndex: 2000 , zIndex: 2000
, fullscreen: false , fullscreen: false

@ -141,7 +141,7 @@
<span class="label">{{ questionTypes.find(e => e.id === item.questionType).name }}</span> <span class="label">{{ questionTypes.find(e => e.id === item.questionType).name }}</span>
</div> </div>
<div class="stem" :id="'stem' + ques.questionVersionId" v-html="getQuesStem(ques)"></div> <div class="stem" :id="'stem' + ques.questionVersionId" v-html="getQuesStem(ques)"></div>
<p v-if="item.questionType !== 'fill_blank'"><el-input class="score" placeholder="请输入" <p v-if="item.questionType !== 'fill_blank'"><el-input class="score" placeholder="请输入分值"
v-model="ques.score" /></p> v-model="ques.score" /></p>
</div> </div>
@ -627,7 +627,7 @@ export default {
let result = stem let result = stem
while ((match = regex.exec(stem)) !== null) { while ((match = regex.exec(stem)) !== null) {
const newInput = `<input type="text" class="fill-input" value="${jsonText && jsonText.scores ? jsonText.scores[index] : ''}">` const newInput = `<input type="text" class="fill-input" placeholder="请输入分值" value="${jsonText && jsonText.scores ? jsonText.scores[index] : ''}">`
result = result.replace(match[0], newInput) result = result.replace(match[0], newInput)
index++ index++
} }
@ -1016,7 +1016,7 @@ export default {
} }
/deep/.score { /deep/.score {
width: 70px; width: 100px;
margin: 0 10px; margin: 0 10px;
.el-input__inner { .el-input__inner {
@ -1036,6 +1036,10 @@ export default {
border: 1px solid #DCDEE0; border: 1px solid #DCDEE0;
border-radius: 2px; border-radius: 2px;
&::placeholder {
color: #cfd1db;
}
&:focus { &:focus {
outline: none; outline: none;
} }

Loading…
Cancel
Save