diff --git a/public/react/src/common/quillForEditor/FillBlot.js b/public/react/src/common/quillForEditor/FillBlot.js
index 5e5e2aa77..07b8b4a47 100644
--- a/public/react/src/common/quillForEditor/FillBlot.js
+++ b/public/react/src/common/quillForEditor/FillBlot.js
@@ -8,19 +8,15 @@
*/
import Quill from 'quill';
let Inline = Quill.import('blots/inline');
-// const BlockEmbed = Quill.import('blots/embed');
class FillBlot extends Inline {
- static create (value) {
+ static create(value) {
const node = super.cerate(value);
- // node.classList.add('icon icon-bianji2');
- // node.setAttribute('data-fill', 'fill');
- console.log('编辑器值===》》》》》', value);
node.setAttribute('data_index', value.data_index);
- node.nodeValue = value.text;
+ node.nodeValue = value.text;
return node;
}
-
- static value (node) {
+
+ static value(node) {
return {
// dataSet: node.getAttribute('data-fill'),
data_index: node.getAttribute('data_index')
diff --git a/public/react/src/common/quillForEditor/ImageBlot.js b/public/react/src/common/quillForEditor/ImageBlot.js
index 5ff84b249..0a9bec733 100644
--- a/public/react/src/common/quillForEditor/ImageBlot.js
+++ b/public/react/src/common/quillForEditor/ImageBlot.js
@@ -17,7 +17,6 @@ export default class ImageBlot extends BlockEmbed {
const node = super.create();
node.setAttribute('alt', value.alt);
node.setAttribute('src', value.url);
- // console.log('~~~~~~~~~~~', node, value);
node.addEventListener('click', function () {
value.onclick(value.url);
}, false);
@@ -33,25 +32,14 @@ export default class ImageBlot extends BlockEmbed {
}
// 宽度和高度都不存在时,
if (!value.width && !value.height) {
- // node.setAttribute('display', 'block');
node.setAttribute('width', '100%');
}
- // node.setAttribute('style', { cursor: 'pointer' });
-
- // if (node.onclick) {
- // console.log('image 有图片点击事件======》》》》》》');
- // // node.setAttribute('onclick', node.onCLick);
- // }
- // 给图片添加点击事件
- // node.onclick = () => {
- // value.onClick && value.onClick(value.url);
- // }
return node;
}
// 获取节点值
- static value (node) {
+ static value(node) {
return {
alt: node.getAttribute('alt'),
@@ -61,7 +49,6 @@ export default class ImageBlot extends BlockEmbed {
height: node.height,
display: node.getAttribute('display'),
id: node.id,
- // style: node.style
};
}
}
diff --git a/public/react/src/common/quillForEditor/index.js b/public/react/src/common/quillForEditor/index.js
index ba37059ba..46b02b94e 100644
--- a/public/react/src/common/quillForEditor/index.js
+++ b/public/react/src/common/quillForEditor/index.js
@@ -20,16 +20,17 @@ import { fetchUploadImage } from '../../services/ojService.js';
import { getImageUrl } from 'educoder'
import ImageBlot from './ImageBlot';
import FillBlot from './FillBlot';
+import LinkBlot from './link-blot'
var Size = Quill.import('attributors/style/size');
-// const Color = Quill.import('attributes/style/color');
Size.whitelist = ['14px', '16px', '18px', '20px', false];
-var fonts = ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong'];
+var fonts = ['Microsoft-YaHei', 'SimSun', 'SimHei', 'KaiTi', 'FangSong'];
var Font = Quill.import('formats/font');
Font.whitelist = fonts; //将字体加入到白名单
window.Quill = Quill;
window.katex = katex;
Quill.register(ImageBlot);
Quill.register(Size);
+Quill.register(LinkBlot);
Quill.register(Font, true);
// Quill.register({'modules/toolbar': Toolbar});
Quill.register({
@@ -38,7 +39,7 @@ Quill.register({
// Quill.register(Color);
-function QuillForEditor ({
+function QuillForEditor({
placeholder,
readOnly,
autoFocus = false,
@@ -51,17 +52,16 @@ function QuillForEditor ({
onContentChange,
addFill, // 点击填空成功的回调
deleteFill // 删除填空,返回删除的下标
- // getQuillContent
}) {
// toolbar 默认值
const defaultConfig = [
'bold', 'italic', 'underline',
- {size: ['14px', '16px', '18px', '20px']},
- {align: []}, {list: 'ordered'}, {list: 'bullet'}, // 列表
- {script: 'sub'}, {script: 'super'},
+ { size: ['14px', '16px', '18px', '20px'] },
+ { align: [] }, { list: 'ordered' }, { list: 'bullet' }, // 列表
+ { script: 'sub' }, { script: 'super' },
{ 'color': [] }, { 'background': [] },
- { 'font': []},
- {header: [1,2,3,4,5,false]},
+ { 'font': [] },
+ { header: [1, 2, 3, 4, 5, false] },
'blockquote', 'code-block',
'link', 'image', 'video',
'formula',
@@ -77,7 +77,6 @@ function QuillForEditor ({
// 文本内容变化时
const handleOnChange = content => {
- // getQuillContent && getQuillContent(quill);
onContentChange && onContentChange(content, quill);
};
@@ -86,9 +85,7 @@ function QuillForEditor ({
const bindings = {
tab: {
key: 9,
- handler: function () {
- console.log('调用了tab=====>>>>');
- }
+ handler: function () { }
},
backspace: {
key: 'Backspace',
@@ -104,11 +101,10 @@ function QuillForEditor ({
* index: 删除元素的位置
* length: 删除元素的个数
*/
- const {index, length} = range;
+ const { index, length } = range;
const _start = length === 0 ? index - 1 : index;
const _length = length || 1;
let delCtx = this.quill.getText(_start, _length); // 删除的元素
- // aa
const reg = /▁/g;
const delArrs = delCtx.match(reg);
if (delArrs) {
@@ -216,7 +212,7 @@ function QuillForEditor ({
const ops = value.ops || [];
ops.forEach((item, i) => {
if (item.insert['image']) {
- item.insert['image'] = Object.assign({}, item.insert['image'], {style: { cursor: 'pointer' }, onclick: (url) => showUploadImage(url)});
+ item.insert['image'] = Object.assign({}, item.insert['image'], { style: { cursor: 'pointer' }, onclick: (url) => showUploadImage(url) });
}
});
}
@@ -225,7 +221,7 @@ function QuillForEditor ({
if (!deepEqual(previous, current)) {
setSelection(quill.getSelection())
if (typeof value === 'string' && value) {
- // debugger
+ // debugger
quill.clipboard.dangerouslyPasteHTML(value, 'api');
if (autoFocus) {
quill.focus();
@@ -273,9 +269,9 @@ function QuillForEditor ({
// 返回结果
return (
-
+
);
}
diff --git a/public/react/src/common/quillForEditor/link-blot.js b/public/react/src/common/quillForEditor/link-blot.js
new file mode 100644
index 000000000..8f508dd34
--- /dev/null
+++ b/public/react/src/common/quillForEditor/link-blot.js
@@ -0,0 +1,21 @@
+import Quill from "quill";
+const Inline = Quill.import('blots/inline');
+
+export default class LinkBlot extends Inline {
+ static create(value) {
+ let node = super.create()
+ let rs = value
+ if (rs.indexOf('http://') < 0) {
+ rs = 'http://' + rs
+ }
+ node.setAttribute('href', rs)
+ node.setAttribute('target', '_blank')
+ return node;
+ }
+
+ static formats(node) {
+ return node.getAttribute('href');
+ }
+}
+LinkBlot.blotName = 'link'
+LinkBlot.tagName = 'a'
\ No newline at end of file
From 5b700a15e10397a48fc9b66869d580b094ebcd26 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 9 Mar 2020 21:01:33 +0800
Subject: [PATCH 08/48] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/files_controller.rb | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index b4604892d..c1fa48be8 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -192,11 +192,15 @@ class FilesController < ApplicationController
end
end
else
+ tip_exception("资源名称不能为空") if params[:name].blank?
+ tip_exception("资源名称不能超过60个字符") if params[:name].strip.length > 60
+ tip_exception("链接地址不能为空") if params[:link].blank?
attachment = Attachment.new
attachment.container = @course
attachment.course_second_category_id = course_second_category_id
- attachment.filename = params[:name]
- attachment.link = params[:link]
+ attachment.author_id = current_user.id
+ attachment.filename = params[:name].strip
+ attachment.link = params[:link].strip
attachment.description = params[:description]
attachment.is_public = params[:is_public] && @course.is_public == 1 ? 1 : 0
attachment.is_publish = @atta_is_publish
From 88c3dbb284c8c08788cc3253d806d479d54f3481 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 9 Mar 2020 21:04:29 +0800
Subject: [PATCH 09/48] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 4a40c84b3..2e94e435d 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -137,7 +137,7 @@ class CoursesController < ApplicationController
category = @course.course_second_categories.find_by(id: params[:new_category_id])
if params[:new_category_id].to_i == 0 || category.present?
- videos = @course.course_videos.where(video_id: params[:video_ids])
+ videos = @course.course_videos.where(video_id: params[:video_ids]).or(@course.course_videos.where(id: params[:video_ids]))
videos.update_all(course_second_category_id: params[:new_category_id])
normal_status(0, "操作成功")
From e59665ccb1aecf02fe4a07372b7e68f06152d127 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Mon, 9 Mar 2020 21:11:05 +0800
Subject: [PATCH 10/48] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=A7=86=E9=A2=91?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users/videos_controller.rb | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/app/controllers/users/videos_controller.rb b/app/controllers/users/videos_controller.rb
index 0ae240dd7..645c25362 100644
--- a/app/controllers/users/videos_controller.rb
+++ b/app/controllers/users/videos_controller.rb
@@ -1,6 +1,6 @@
class Users::VideosController < Users::BaseController
before_action :private_user_resources!, :check_account
- before_action :require_teacher!
+ before_action :require_teacher!, except: [:destroy]
before_action :require_auth_teacher!, except: [:index, :review]
helper_method :current_video
@@ -53,6 +53,19 @@ class Users::VideosController < Users::BaseController
render_error(ex.message)
end
+ def destroy
+ video = observed_user.videos.find_by(id: params[:video_id])
+ render_forbidden unless video.user_id != observed_user.id || !current_user.admin_or_business?
+ return render_not_found if video.blank?
+ return render_error('该状态下不能删除视频') unless video.pending?
+
+ video.destroy!
+
+ AliyunVod::Service.delete_video([video.uuid]) rescue nil
+
+ render_ok
+ end
+
private
def current_video
From ce1293ab9b440921401c543fc88739d61137acb3 Mon Sep 17 00:00:00 2001
From: caicai8 <1149225589@qq.com>
Date: Mon, 9 Mar 2020 21:14:38 +0800
Subject: [PATCH 11/48] =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=BA=8C=E7=BA=A7?=
=?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=92=8C=E5=A4=96=E9=93=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/public/css/demo_index.html | 184 ++++++++++++++++++
public/react/public/css/iconfont.css | 44 ++++-
public/react/public/css/iconfont.eot | Bin 87360 -> 88664 bytes
public/react/public/css/iconfont.js | 2 +-
public/react/public/css/iconfont.json | 56 ++++++
public/react/public/css/iconfont.svg | 24 +++
public/react/public/css/iconfont.ttf | Bin 87192 -> 88496 bytes
public/react/public/css/iconfont.woff | Bin 55256 -> 55920 bytes
public/react/public/css/iconfont.woff2 | Bin 46304 -> 46852 bytes
public/react/src/modules/courses/Index.js | 2 +-
.../src/modules/courses/ListPageIndex.js | 6 +-
.../src/modules/courses/Video/MoveBox.js | 128 ++++++++++++
.../react/src/modules/courses/Video/Video.js | 41 +++-
.../src/modules/courses/Video/VideoIndex.js | 116 +++++++----
.../src/modules/courses/Video/VideoLink.js | 86 ++++++++
.../courses/coursesDetail/CoursesLeftNav.js | 65 ++++---
.../user/usersInfo/video/EditVideoModal.js | 43 +++-
.../user/usersInfo/video/InfosVideo.css | 22 +++
.../user/usersInfo/video/VideoInReviewItem.js | 31 ++-
.../user/usersInfo/video/images/default.png | Bin 0 -> 69294 bytes
20 files changed, 753 insertions(+), 97 deletions(-)
create mode 100644 public/react/src/modules/courses/Video/MoveBox.js
create mode 100644 public/react/src/modules/courses/Video/VideoLink.js
create mode 100644 public/react/src/modules/user/usersInfo/video/images/default.png
diff --git a/public/react/public/css/demo_index.html b/public/react/public/css/demo_index.html
index 281ac40d0..7b0854698 100644
--- a/public/react/public/css/demo_index.html
+++ b/public/react/public/css/demo_index.html
@@ -30,6 +30,54 @@
+ -
+
+
移动
+ 
+
+
+ -
+
+
下移2
+ 
+
+
+ -
+
+
上移2
+ 
+
+
+ -
+
+
下移
+ 
+
+
+ -
+
+
上移
+ 
+
+
+ -
+
+
编辑
+ 
+
+
+ -
+
+
删除
+ 
+
+
+ -
+
+
选择
+ 
+
+
-
编辑
@@ -2012,6 +2060,78 @@
+ -
+
+
+ 移动
+
+ .icon-yidong
+
+
+
+ -
+
+
+ 下移2
+
+ .icon-xiayi1
+
+
+
+ -
+
+
+ 上移2
+
+ .icon-shangyi1
+
+
+
+ -
+
+
+ 下移
+
+ .icon-xiayi
+
+
+
+ -
+
+
+ 上移
+
+ .icon-shangyi
+
+
+
+ -
+
+
+ 编辑
+
+ .icon-bianji5
+
+
+
+ -
+
+
+ 删除
+
+ .icon-shanchu3
+
+
+
+ -
+
+
+ 选择
+
+ .icon-xuanze
+
+
+
-
@@ -4939,6 +5059,70 @@
+ -
+
+
移动
+ #icon-yidong
+
+
+ -
+
+
下移2
+ #icon-xiayi1
+
+
+ -
+
+
上移2
+ #icon-shangyi1
+
+
+ -
+
+
下移
+ #icon-xiayi
+
+
+ -
+
+
上移
+ #icon-shangyi
+
+
+ -
+
+
编辑
+ #icon-bianji5
+
+
+ -
+
+
删除
+ #icon-shanchu3
+
+
+ -
+
+
选择
+ #icon-xuanze
+
+
-