提交 c9cced50 authored 作者: 王鹏飞's avatar 王鹏飞

merge..

......@@ -10,7 +10,7 @@ export default {
name: 'VEditor',
props: {
value: { type: String },
disabled: { type: Boolean, default: false }
disabled: { type: Boolean, default: null }
},
data() {
return {
......@@ -18,9 +18,19 @@ export default {
ckEditor: null
}
},
watch: {
value(val) {
if (this.ckEditor.getData() !== val) {
this.ckEditor.setData(val)
}
},
disabled(val) {
this.ckEditor.setReadOnly(val)
}
},
methods: {
createEditor() {
const editor = (this.ckEditor = CKEDITOR.replace(this.textareaElementId, {
const config = {
height: 400,
uiColor: '#eeeeee',
filebrowserImageUploadUrl: '/api/ckeditor/img/upload',
......@@ -71,14 +81,23 @@ export default {
{ name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
{ name: 'insert', items: ['Image', 'Table', 'HorizontalRule'] }
]
}))
}
if (this.readOnly !== null) {
config.readOnly = this.readOnly
}
const editor = (this.ckEditor = CKEDITOR.replace(
this.textareaElementId,
config
))
editor.on('instanceReady', () => {
const data = this.value
editor.fire('lockSnapshot')
editor.setData(data, {
callback: () => {
editor.setReadOnly(this.disabled)
this.bindEvent()
const newData = editor.getData()
......
<template>
<div class="upload">
<el-upload action :show-file-list="false" :http-request="httpRequest">
<el-upload action :show-file-list="false" :http-request="httpRequest" v-bind="$attrs">
<slot></slot>
<el-button type="text" size="small" icon="el-icon-upload">点击上传</el-button>
<template v-slot:tip>
......
......@@ -10,7 +10,7 @@ export default {
name: 'VEditor',
props: {
value: { type: String },
disabled: { type: Boolean, default: false }
disabled: { type: Boolean, default: null }
},
data() {
return {
......@@ -18,9 +18,19 @@ export default {
ckEditor: null
}
},
watch: {
value(val) {
if (this.ckEditor.getData() !== val) {
this.ckEditor.setData(val)
}
},
disabled(val) {
this.ckEditor.setReadOnly(val)
}
},
methods: {
createEditor() {
const editor = (this.ckEditor = CKEDITOR.replace(this.textareaElementId, {
const config = {
height: 400,
uiColor: '#eeeeee',
filebrowserImageUploadUrl: '/api/ckeditor/img/upload',
......@@ -71,14 +81,23 @@ export default {
{ name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
{ name: 'insert', items: ['Image', 'Table', 'HorizontalRule'] }
]
}))
}
if (this.readOnly !== null) {
config.readOnly = this.readOnly
}
const editor = (this.ckEditor = CKEDITOR.replace(
this.textareaElementId,
config
))
editor.on('instanceReady', () => {
const data = this.value
editor.fire('lockSnapshot')
editor.setData(data, {
callback: () => {
editor.setReadOnly(this.disabled)
this.bindEvent()
const newData = editor.getData()
......
......@@ -7,6 +7,7 @@
</div>
</div>
<div class="play-paper-content play-chapter-work">
<el-form ref="form" :disabled="disabled">
<ul>
<li v-for="(item, index) in questions" :key="index">
<div class="work-number">{{index + 1}}.</div>
......@@ -14,22 +15,38 @@
<div class="edit_html" v-html="item.question_content"></div>
</div>
<!-- 文本内容 -->
<v-editor v-model="item.descreption"></v-editor>
<v-editor v-model="item.descreption" :disabled="disabled"></v-editor>
<!-- 上传附件 -->
<v-upload v-model="item.file_url">请上传对应的文件附件:</v-upload>
</li>
</ul>
</el-form>
<template v-if="deadLine">
<p style="color: red">请于截止日期 {{deadLine}} 前提交</p>
</template>
<div class="area-btns">
<!-- 驳回状态 -->
<div class="area-btns" v-if="homeData.status === 1">
<el-button type="primary" @click="onReEdit">重新编辑</el-button>
<div class="play-paper-check">
<h4>作业被驳回,点击“重新编辑”按钮重新编辑内容再次提交</h4>
<div class="play-paper-check-item">
<b>驳回时间:</b>
{{homeData.checker_time}}
</div>
<div class="play-paper-check-item">
<b>驳回说明:</b>
<div class="edit_html" v-html="homeData.check_comments"></div>
</div>
</div>
</div>
<div class="area-btns" v-else>
<el-button
type="primary"
@click="submitWork"
:disabled="!!homeData.checker_time || deadLineFlag"
>{{homeData.checker_time ? '已批改' : '提交'}}</el-button>
:disabled="homeData.status === 0 || deadLineFlag"
>{{homeData.status === 0 ? '已批改' : '提交'}}</el-button>
<span class="help-info">&emsp;&emsp;在获老师批改之前,可以多次提交,将以最后一次提交为准</span>
<template v-if="homeData.checker_time">
<template v-if="homeData.status === 0 && homeData.checker_time">
<div class="play-paper-check">
<h4>
已获批改
......@@ -76,7 +93,8 @@ export default {
homeData: {},
deadLine: '',
deadLineFlag: false,
questions: []
questions: [],
disabled: false
}
},
watch: {
......@@ -107,8 +125,12 @@ export default {
})
cAction.Player.getHomework(this.sid, this.cid, this.id)
.then(data => {
if (Array.isArray(data)) {
return
}
this.homeData = data
// 状态处理
this.disabled = data.status === 0 || data.status === 1
const parseAnswers = JSON.parse(data.work_contents)
this.questions = this.questions.map(item => {
const found = parseAnswers.find(
......@@ -125,7 +147,6 @@ export default {
})
})
.catch(e => {
this.filesArr.pop()
this.$message.error(e.message)
})
.finally(() => {
......@@ -181,12 +202,16 @@ export default {
}
})
.catch(e => {
this.filesArr.pop()
this.$message.error(e.message)
})
.finally(() => {
loading.close()
})
},
// 重新编辑
onReEdit() {
this.disabled = false
this.homeData.status = -1
}
}
}
......
......@@ -20,8 +20,9 @@
), function(global) {
'use strict';
// existing version for noConflict()
global = global || {};
var _Base64 = global.Base64;
var version = "2.5.0";
var version = "2.5.2";
// if node.js and NOT React Native, we use Buffer
var buffer;
if (typeof module !== 'undefined' && module.exports) {
......@@ -82,32 +83,21 @@
} : function(b) {
return b.replace(/[\s\S]{1,3}/g, cb_encode);
};
var _encode = buffer ?
buffer.from && Uint8Array && buffer.from !== Uint8Array.from
? function (u) {
return (u.constructor === buffer.constructor ? u : buffer.from(u))
.toString('base64')
}
: function (u) {
return (u.constructor === buffer.constructor ? u : new buffer(u))
.toString('base64')
var _encode = function(u) {
var isUint8Array = Object.prototype.toString.call(u) === '[object Uint8Array]';
return isUint8Array ? u.toString('base64')
: btoa(utob(String(u)));
}
: function (u) { return btoa(utob(u)) }
;
var encode = function(u, urisafe) {
return !urisafe
? _encode(String(u))
? _encode(u)
: _encode(String(u)).replace(/[+\/]/g, function(m0) {
return m0 == '+' ? '-' : '_';
}).replace(/=/g, '');
};
var encodeURI = function(u) { return encode(u, true) };
// decoder stuff
var re_btou = new RegExp([
'[\xC0-\xDF][\x80-\xBF]',
'[\xE0-\xEF][\x80-\xBF]{2}',
'[\xF0-\xF7][\x80-\xBF]{3}'
].join('|'), 'g');
var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
var cb_btou = function(cccc) {
switch(cccc.length) {
case 4:
......@@ -232,3 +222,4 @@
// that's it!
return {Base64: global.Base64}
}));
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论