From 75f2d4d22556ef6b15ec15b55552a7ffea20c921 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Tue, 11 Feb 2020 15:18:09 +0800 Subject: [PATCH 1/7] business --- public/react/src/modules/courses/Video/VideoIndex.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/Video/VideoIndex.js b/public/react/src/modules/courses/Video/VideoIndex.js index c24b0f8d1..7dbeca7f3 100644 --- a/public/react/src/modules/courses/Video/VideoIndex.js +++ b/public/react/src/modules/courses/Video/VideoIndex.js @@ -179,7 +179,7 @@ class VideoIndex extends Component{ } render(){ const { videos , upload , videoData , type , liveData , lives , page , liveVisible , isSpining , liveId } = this.state; - const { admin , is_teacher } = this.props.user; + const { admin , is_teacher , business } = this.props.user; return( { - (admin || is_teacher) && + (admin || is_teacher || business) &&
  • { upload ? From e48282e29bbb01ff119eb0dbf083024b782049d7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 11 Feb 2020 15:45:00 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E6=9D=83=E9=99=90?= =?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/live_links_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/live_links_controller.rb b/app/controllers/live_links_controller.rb index f4b49d4aa..fe2de4afe 100644 --- a/app/controllers/live_links_controller.rb +++ b/app/controllers/live_links_controller.rb @@ -2,7 +2,8 @@ class LiveLinksController < ApplicationController before_action :require_login before_action :find_course, only: [:index, :create] before_action :user_course_identity, :teacher_allowed, only: [:create] - before_action :edit_auth, only: [:edit, :update, :destroy] + before_action :edit_auth, only: [:edit, :update] + before_action :delete_auth, only: [:destroy] def index lives = @course.live_links @@ -58,6 +59,10 @@ class LiveLinksController < ApplicationController end def edit_auth + tip_exception(403, "无权限操作") unless current_user.id == current_live.user_id || current_user.admin_or_business? + end + + def delete_auth tip_exception(403, "无权限操作") unless current_user.id == current_live.user_id || current_user.admin? end end \ No newline at end of file From c3c16bc0b4029c6ba87e5ae4bbb4332629c1073e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 11 Feb 2020 15:48:20 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E6=9D=83=E9=99=90?= =?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/models/live_link.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/live_link.rb b/app/models/live_link.rb index 5dcfaf3d3..b1865071f 100644 --- a/app/models/live_link.rb +++ b/app/models/live_link.rb @@ -8,6 +8,6 @@ class LiveLink < ApplicationRecord validates :description, length: { maximum: 100, too_long: "不能超过100个字符" } def op_auth? - user == User.current || User.current.admin? + user == User.current || User.current.admin_or_business? end end From e13a86f299fd81c5b6cef5944728cadb3ad19f79 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 11 Feb 2020 15:50:04 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E6=9D=83=E9=99=90?= =?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/models/live_link.rb | 4 ++++ app/views/live_links/index.json.jbuilder | 1 + 2 files changed, 5 insertions(+) diff --git a/app/models/live_link.rb b/app/models/live_link.rb index b1865071f..52c1e3657 100644 --- a/app/models/live_link.rb +++ b/app/models/live_link.rb @@ -10,4 +10,8 @@ class LiveLink < ApplicationRecord def op_auth? user == User.current || User.current.admin_or_business? end + + def delete_auth? + user == User.current || User.current.admin? + end end diff --git a/app/views/live_links/index.json.jbuilder b/app/views/live_links/index.json.jbuilder index e951f24bc..e497a068b 100644 --- a/app/views/live_links/index.json.jbuilder +++ b/app/views/live_links/index.json.jbuilder @@ -5,6 +5,7 @@ json.lives @lives do |live| json.author_login live.user.login json.author_img url_to_avatar(live.user) json.op_auth live.op_auth? + json.delete_auth live.delete_auth? json.created_at live.created_at.strftime('%Y-%m-%d') end json.my_live_id @my_live_id From f59a271c79d892122e13c0d54f4727f9ce883169 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Tue, 11 Feb 2020 15:55:54 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E7=9A=84=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/Video/LiveItem.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/Video/LiveItem.js b/public/react/src/modules/courses/Video/LiveItem.js index 095a8fc62..a2fff5b98 100644 --- a/public/react/src/modules/courses/Video/LiveItem.js +++ b/public/react/src/modules/courses/Video/LiveItem.js @@ -72,13 +72,18 @@ class LiveItem extends Component{

    创建时间:{item.created_at} - { - item.op_auth ? + - setLiveId(item.id)}>编辑 - this.deleteLive(item.id)}>删除 - :"" - } + { + item.op_auth ? + setLiveId(item.id)}>编辑:"" + } + { + item.delete_auth ? + this.deleteLive(item.id)}>删除 + :"" + } +

    ) From 7d039aee99c998e24121956d4f35ac4472d378c4 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Wed, 12 Feb 2020 09:50:02 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/Video/Live.js | 39 +++++++++++++++--- .../src/modules/courses/Video/LiveNew.js | 4 +- .../src/modules/courses/Video/VideoIndex.js | 14 +++++-- .../courses/Video/images/WeiBaiTong.png | Bin 0 -> 5612 bytes .../modules/courses/Video/images/bilibili.png | Bin 0 -> 7954 bytes .../modules/courses/Video/images/douyu.jpg | Bin 0 -> 358711 bytes .../modules/courses/Video/images/tencent.png | Bin 0 -> 2226 bytes .../react/src/modules/courses/Video/video.css | 12 ++++++ .../user/usersInfo/video/VideoUploadList.js | 8 ++-- 9 files changed, 61 insertions(+), 16 deletions(-) create mode 100644 public/react/src/modules/courses/Video/images/WeiBaiTong.png create mode 100644 public/react/src/modules/courses/Video/images/bilibili.png create mode 100644 public/react/src/modules/courses/Video/images/douyu.jpg create mode 100644 public/react/src/modules/courses/Video/images/tencent.png diff --git a/public/react/src/modules/courses/Video/Live.js b/public/react/src/modules/courses/Video/Live.js index f8c39a000..7d0e01d2b 100644 --- a/public/react/src/modules/courses/Video/Live.js +++ b/public/react/src/modules/courses/Video/Live.js @@ -1,9 +1,14 @@ import React,{ Component } from "react"; -import { Switch , Pagination } from 'antd'; -import { NoneData } from 'educoder'; +import { Pagination } from 'antd'; +// import { NoneData } from 'educoder'; import LiveItem from './LiveItem'; import './video.css'; + +import bilibili from './images/bilibili.png'; +import tencent from './images/tencent.png'; +import WeiBaiTong from './images/WeiBaiTong.png'; +import douyu from './images/douyu.jpg'; class Live extends Component{ render(){ @@ -11,10 +16,31 @@ class Live extends Component{ return(
    +

    EduCoder支持所有第三方直播平台,特别推荐:

    + { lives && lives.length > 0 ? -

    {liveData && liveData.total_count} 个视频

    +

    {liveData && liveData.total_count} 个视频

    { lives.map((item,key)=>{ @@ -38,9 +64,10 @@ class Live extends Component{ } : -
    - -
    + "" + //
    + // + //
    }
    ) diff --git a/public/react/src/modules/courses/Video/LiveNew.js b/public/react/src/modules/courses/Video/LiveNew.js index 897dd714a..a295a6fe5 100644 --- a/public/react/src/modules/courses/Video/LiveNew.js +++ b/public/react/src/modules/courses/Video/LiveNew.js @@ -137,10 +137,10 @@ class LiveNew extends Component{