Merge branch 'dev_aliyun' into develop

Adjustreact
daiao 5 years ago
commit dda59f33ef

@ -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

@ -8,6 +8,10 @@ class LiveLink < ApplicationRecord
validates :description, length: { maximum: 100, too_long: "不能超过100个字符" }
def op_auth?
user == User.current || User.current.admin_or_business?
end
def delete_auth?
user == User.current || User.current.admin?
end
end

@ -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

@ -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(
<div className="livePanel">
<p className="mt30 mb10 color-grey-9 pl10">EduCoder支持所有第三方直播平台特别推荐</p>
<ul className="platform">
<li>
<a href="https://ke.qq.com/act/speed_pc/index.html?from=800021837" target="_blank"><img alt="" src={tencent} className="mr8" width="28px"/>
<label className="color-grey-3 pointer">腾讯课堂</label>
</a>
<a href="https://pub.idqqimg.com/pc/misc/files/20200204/2e4cb765bef54f0c919c0ab8ab79d969.pdf" target="_blank" className="color-blue ml20">(简明手册)</a>
</li>
<li>
<a href="https://live.bilibili.com/liveHime?visit_id=a81rbm7v2kk0" target="_blank"><img alt="" src={bilibili} className="mr8" width="52px"/>
<label className="color-grey-3 pointer">哔哩哔哩</label>
</a>
<a href="https://www.bilibili.com/blackboard/live/broadcast-intro.html#/" target="_blank" className="color-blue ml20">(简明手册)</a>
</li>
<li>
<a href="https://www.douyu.com/" target="_blank"><img alt="" src={douyu} className="mr8" width="28px"/>
<label className="color-grey-3 pointer">斗鱼</label>
</a>
<a href="https://www.douyu.com/special/guide/anchor" target="_blank" className="color-blue ml20">(简明手册)</a>
</li>
</ul>
{
lives && lives.length > 0 ?
<React.Fragment>
<p className="font-grey-9 mt20 mb20 pl5"> <span className="color-orange">{liveData && liveData.total_count}</span> </p>
<p className="font-grey-9 mt20 mb20 pl10"> <span className="color-orange">{liveData && liveData.total_count}</span> </p>
<div className="liveContent">
{
lives.map((item,key)=>{
@ -38,9 +64,10 @@ class Live extends Component{
}
</React.Fragment>
:
<div className="edu-back-white">
<NoneData style={{width: '100%'}}></NoneData>
</div>
""
// <div className="edu-back-white">
// <NoneData style={{width: '100%'}}></NoneData>
// </div>
}
</div>
)

@ -72,13 +72,18 @@ class LiveItem extends Component{
</div>
<p className="lineMiddle livesMain mt15 font-12">
<span className="color-grey-9">创建时间{item.created_at}</span>
<span>
{
item.op_auth ?
<span>
<WordsBtn style="grey" onClick={()=>setLiveId(item.id)}>编辑</WordsBtn>
<WordsBtn style="grey" className="ml30" onClick={()=>this.deleteLive(item.id)}>删除</WordsBtn>
</span>:""
<WordsBtn style="grey" onClick={()=>setLiveId(item.id)}>编辑</WordsBtn>:""
}
{
item.delete_auth ?
<WordsBtn style="s" className="ml30" onClick={()=>this.deleteLive(item.id)}>删除</WordsBtn>
:""
}
</span>
</p>
</div>
)

@ -137,10 +137,10 @@ class LiveNew extends Component{
<TextArea rows={4} placeholder="可在此介绍开播具体事项,如开播时间安排等。" />
)}
</Form.Item>
<p className="flex-middle" style={{justifyContent:"space-between"}}>
{/* <p className="flex-middle" style={{justifyContent:"space-between"}}>
<span>EduCoder推荐您使用<a href="https://ke.qq.com/" target="_blank" className="color-blue">腾讯课堂</a></span>
<a href="https://pub.idqqimg.com/pc/misc/files/20200204/2e4cb765bef54f0c919c0ab8ab79d969.pdf" target="_blank" className="color-blue">操作指引</a>
</p>
</p> */}
</Form>
<div className="clearfix mt30 edu-txt-center">
<a onClick={this.cancelNew} className="task-btn mr30">取消</a>

@ -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(
<React.Fragment>
<LivesNew
@ -199,15 +199,21 @@ class VideoIndex extends Component{
</Menu>
</div>
{
(admin || is_teacher) &&
(admin || is_teacher || business) &&
<li className="fr mt18">
{
type === "video" ?
<React.Fragment>
{
upload ?
<WordsBtn style="grey" className="font-16" onClick={()=>this.uploadVideo(false)}>取消</WordsBtn>
:
<WordsBtn style="blue" className="font-16" onClick={this.toUpload}>上传视频</WordsBtn>
}
</React.Fragment>
:
<WordsBtn style="blue" className="font-16 ml30" onClick={this.liveSetting}>直播设置</WordsBtn>
}
</li>
}
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

@ -139,3 +139,15 @@
height: 30px;
line-height: 30px;
}
.platform{
background: #fff;
display: flex;
align-items: center;
padding:20px 10px;
margin-bottom: 10px;
}
.platform > li{
margin-right: 80px;
display: flex;
align-items: center;
}

@ -15,7 +15,7 @@ import uploadHoverIcon from './images/upload_hover.png'
let uploader
const files = []
const MAX_FILE_COUNT = 3
const MAX_FILE_SIZE = 200
const MAX_FILE_SIZE = 500
let noUploads = true
function VideoUploadList (props) {
@ -74,8 +74,8 @@ function VideoUploadList (props) {
clearInput()
return;
}
if (file.size > 200 * 1024 * 1024) {
// 超过200m TODO
if (file.size >(parseInt(MAX_FILE_SIZE) * 1024 * 1024)) {
// 超过500m TODO
clearInput()
showNotification(`视频大小超过${MAX_FILE_SIZE}M`)
return;
@ -428,7 +428,7 @@ function VideoUploadList (props) {
>继续添加</ActionBtn>}
<div className={`description ${noUploads ? 'noUploads' : ''}`}>
<div className="">视频大小不支持断点续传单个视频文件最大200M单次最多支持3个视频文件上传 </div>
<div className="">视频大小不支持断点续传单个视频文件最大500M单次最多支持3个视频文件上传 </div>
<div className="">视频规格aviflvf4vm4vmovmp4rmvbswfwebm </div>
<div className="">温馨提示请勿上传违法视频平台将为每一个视频分配一个地址您可以通过引用该地址将视频使用在实训项目等模块</div>
</div>

Loading…
Cancel
Save