diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb index e100eadcc..a2d34b6ef 100644 --- a/app/libs/aliyun_vod/service/base.rb +++ b/app/libs/aliyun_vod/service/base.rb @@ -13,8 +13,8 @@ module AliyunVod::Service::Base if response.status != 200 message = case result['Code'] - when 'InvalidFileName.Extension' then '不支持的文件格式' - when 'IllegalCharacters' then '文件名称包含非法字符' + when 'InvalidFileName.Extension' then '不支持的视频格式' + when 'IllegalCharacters' then '视频名称包含非法字符' else raise AliyunVod::Error, result['Message'] end raise AliyunVod::Error, message if message.present? diff --git a/app/services/videos/create_auth_service.rb b/app/services/videos/create_auth_service.rb index 3c7ecf2f6..8dc0ddbb3 100644 --- a/app/services/videos/create_auth_service.rb +++ b/app/services/videos/create_auth_service.rb @@ -21,7 +21,14 @@ class Videos::CreateAuthService < ApplicationService private def title - @_title ||= params.delete(:title).to_s.strip + @_title ||= begin + str = params.delete(:title).to_s.strip + if str.length > 30 + "#{str[0, 15]}...#{str.reverse[0,10].reverse}" + else + str + end + end end def filename diff --git a/public/react/src/modules/message/js/MessagSub.js b/public/react/src/modules/message/js/MessagSub.js index ab814aab8..196c460a5 100644 --- a/public/react/src/modules/message/js/MessagSub.js +++ b/public/react/src/modules/message/js/MessagSub.js @@ -470,6 +470,13 @@ class MessagSub extends Component{ } case "Discuss": return window.open(`/shixuns/${item.identifier}/shixun_discuss`); + case "Video": + if(item.tiding_type==="Apply"){ + return window.open(`/managements/video_applies`); + }else if(item.tiding_type==="System"){ + return window.open(`/users/${item.trigger_user.login}/videos`); + } + return ''; default : return window.open("/") } diff --git a/public/react/src/modules/modals/Jointheclass.js b/public/react/src/modules/modals/Jointheclass.js index 3d1eeb384..1150e178b 100644 --- a/public/react/src/modules/modals/Jointheclass.js +++ b/public/react/src/modules/modals/Jointheclass.js @@ -55,8 +55,17 @@ class Jointheclass extends Component { width="600px" >
-

是否确认该加入课堂?

-
+

是否确认该加入课堂?

+
+ this.modalCancel()}>取消 this.setDownload()}>确认
diff --git a/public/react/src/modules/paths/PathDetail/DetailTop.css b/public/react/src/modules/paths/PathDetail/DetailTop.css index 17fdf3996..488e5569d 100644 --- a/public/react/src/modules/paths/PathDetail/DetailTop.css +++ b/public/react/src/modules/paths/PathDetail/DetailTop.css @@ -50,7 +50,7 @@ } .ant-modal-title { font-size: 16px; - font-weight: 700!important; + font-weight: 500!important; color: #333; text-align: center; } \ No newline at end of file diff --git a/public/react/src/modules/paths/PathDetail/DetailTop.js b/public/react/src/modules/paths/PathDetail/DetailTop.js index 6270ffb06..f405a814d 100644 --- a/public/react/src/modules/paths/PathDetail/DetailTop.js +++ b/public/react/src/modules/paths/PathDetail/DetailTop.js @@ -5,6 +5,7 @@ import SendPanel from "./sendPanel.js"; import { getImageUrl } from 'educoder'; import axios from 'axios'; import Modals from '../../modals/Modals'; +import OpenCourse from './OpenCourse'; import Jointheclass from '../../modals/Jointheclass' import './DetailTop.css'; @@ -24,18 +25,21 @@ class DetailTop extends Component{ cardsModalsavetype:false, MenuItemskey:1, courseslist:[], - Pathcourseid:undefined + Pathcourseid:undefined, + OpenCourseTypes:false } } componentDidMount(){ let courseslist=[] - this.props.courses.map((item,key)=>{ - if(1===key+1){ - return( - courseslist.push(item) - ) - } - }) + if(this.props.courses!=undefined&&this.props.courses.length!=0){ + this.props.courses.map((item,key)=>{ + if(1===key+1){ + return( + courseslist.push(item) + ) + } + }) + } this.setState({ courseslist:courseslist }) @@ -196,21 +200,28 @@ class DetailTop extends Component{ this.props.getdatasindex() }; + OpenCoursefun=()=>{ + this.setState({ + OpenCourseTypes:true + }) + } + OpenCourseCancel=()=>{ + this.setState({ + OpenCourseTypes:false + }) + } render(){ let{detailInfoList}=this.props; - let{Modalstype,Modalstopval,cardsModalcancel,cardsModalsave,Modalsbottomval,cardsModalsavetype,loadtype}=this.state; + let{Modalstype,Modalstopval,cardsModalcancel,OpenCourseTypes,Modalsbottomval,cardsModalsavetype,loadtype}=this.state; const radioStyle = { display: 'block', height: '30px', lineHeight: '30px', }; - - //
- let menu = ( - {this.props.courses&&this.props.courses.map((item,key)=>{ + {this.props.courses===undefined||this.props.courses.length===0?"":this.props.courses.map((item,key)=>{ return( this.MenuItems(key+1)}> @@ -226,7 +237,7 @@ class DetailTop extends Component{ return( -
+
- this.ysljoinmodalCancel()} ysljoinmodalCanceltwo={()=>this.ysljoinmodalCanceltwo()}> - {/*
*/} + {this.state.yslJointhe===true?this.ysljoinmodalCancel()} ysljoinmodalCanceltwo={()=>this.ysljoinmodalCanceltwo()}>:""} + {this.state.OpenCourseTypes===true?this.OpenCourseCancel()}/>:""} + { detailInfoList && -
+
{detailInfoList.name} @@ -326,7 +338,7 @@ class DetailTop extends Component{ {this.props.courses===undefined?"":detailInfoList.is_creator===true?
- 开课 + this.OpenCoursefun()}>开课 学习统计 @@ -334,8 +346,7 @@ class DetailTop extends Component{
- {/*{this.props.courses===undefined||this.props.courses.length===0?"":
*/} - {this.props.courses===undefined?"":
+ {this.props.courses===undefined||this.props.courses.length===0?"":
  • {this.state.courseslist.map((item,key)=>{ - // course_id: 1309 - // course_identity: 5 - // course_status: {status: 1, time: "进行至第5周,共1642周"} - // first_category_url: "/courses/1309/informs" return(
    @@ -467,7 +474,7 @@ class DetailTop extends Component{ :this.JoinnowCourse(item.course_id)}>立即报名:""} {item.course_status.status===1? - detailInfoList.is_creator===true? + detailInfoList.is_creator===true?this.JoinnowCourse(item.course_id)}> 进入课堂 :item.course_identity<6? 立即学习 diff --git a/public/react/src/modules/paths/PathDetail/OpenCourse.js b/public/react/src/modules/paths/PathDetail/OpenCourse.js new file mode 100644 index 000000000..b64b9e9e7 --- /dev/null +++ b/public/react/src/modules/paths/PathDetail/OpenCourse.js @@ -0,0 +1,99 @@ +import React, { Component } from 'react'; +import { Modal, Radio, Input} from 'antd'; +import axios from 'axios'; +//加入精品课堂 +class OpenCourse extends Component { + + constructor(props) { + super(props); + this.state={ + value:0 + } + } + + componentDidMount() { + // console.log("加入精品课堂"); + // console.log(this.props); + + } + + modalCancel=()=>{ + this.props.OpenCourseCancel(); + }; + + setDownload=()=>{ + let {value}=this.state; + console.log(this.props.match.params.pathId) + + if(value===0){ + window.open(`/courses/${this.props.match.params.pathId}/newgold/0 `); + }else{ + window.open(`/courses/${this.props.match.params.pathId}/newgold/1`); + } + this.props.OpenCourseCancel(); + } + setpathradioChange = e => { + + this.setState({ + value: e.target.value, + }); + }; + + render() { + // console.log("加入精品课堂2"); + //console.log(this.props.Pathcourseid); + const pathradioStyle = { + display: 'block', + height: '30px', + lineHeight: '30px', + color:'#05101A', + textAlign: 'left', + fontSize: '16px' + }; + const pathradioStyles={ + color:'#999999' + } + return( + + + + ) + } +} + +export default OpenCourse; \ No newline at end of file diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index 0ee4a3904..4f92e5841 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -81,32 +81,7 @@ class PathDetailIndex extends Component{ cardsModalsave:this.cardsModalsave, user_id:undefined, loadtype:false, - courses:[ - { - course_id: 1309, - first_category_url: "/courses/1309/informs", - start_date: "2019-07-16", // 开始时间 - end_date: "2050-12-31", // 结束时间 - student_count: 112, // 学习人数 - course_identity: 5, // 当前用户在该课堂的身份 - course_status: { - status: 1, // status:0:即将开课 1:进行中 2:已结束 - time: "进行至第5周,共1642周" // time:当前进度 - } - }, - { - course_id: 1319, - first_category_url: "/courses/1319/shixun_homeworks/11549", - start_date:"2019-08-16", - end_date:"2050-12-31", - student_count: 112, - course_identity: 1, - course_status: { - status: 0, - time: "" - } - } - ], + courses:undefined, items: getItems(10) } this.onDragEnd = this.onDragEnd.bind(this); diff --git a/public/react/src/modules/paths/ShixunPathCard.js b/public/react/src/modules/paths/ShixunPathCard.js index 79b9c1e13..166c6415a 100644 --- a/public/react/src/modules/paths/ShixunPathCard.js +++ b/public/react/src/modules/paths/ShixunPathCard.js @@ -14,32 +14,6 @@ class ShixunPathCard extends Component{ return(
    - - { pathList && pathList.length > 0 ? ( diff --git a/public/react/src/modules/tpm/SiderBar.js b/public/react/src/modules/tpm/SiderBar.js index 11369024d..beab18fdc 100644 --- a/public/react/src/modules/tpm/SiderBar.js +++ b/public/react/src/modules/tpm/SiderBar.js @@ -109,15 +109,15 @@ class SiderBar extends Component { -

    微信扫一扫

    -

    关注公众号

    +

    微信扫一扫

    +

    关注公众号

    diff --git a/public/react/src/modules/user/usersInfo/Infos.js b/public/react/src/modules/user/usersInfo/Infos.js index 488287b0e..242e25464 100644 --- a/public/react/src/modules/user/usersInfo/Infos.js +++ b/public/react/src/modules/user/usersInfo/Infos.js @@ -298,7 +298,7 @@ class Infos extends Component{ > {/* 项目 */} - () } diff --git a/public/react/src/modules/user/usersInfo/InfosBanner.js b/public/react/src/modules/user/usersInfo/InfosBanner.js index c3badce13..5a0c41c96 100644 --- a/public/react/src/modules/user/usersInfo/InfosBanner.js +++ b/public/react/src/modules/user/usersInfo/InfosBanner.js @@ -100,12 +100,12 @@ class InfosBanner extends Component{ onClick={() => this.setState({moduleName: 'package'})} to={`/users/${username}/package`}>众包
  • - {((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin) - &&
  • + {/* {((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin) + &&
  • this.setState({moduleName: 'videoes'})} - to={`/users/${username}/videoes`}>视频 -
  • } + onClick={() => this.setState({moduleName: 'videos'})} + to={`/users/${username}/videos`}>视频 + } */}
    diff --git a/public/react/src/modules/user/usersInfo/InfosIndex.js b/public/react/src/modules/user/usersInfo/InfosIndex.js index 092ae9009..89d69ab5d 100644 --- a/public/react/src/modules/user/usersInfo/InfosIndex.js +++ b/public/react/src/modules/user/usersInfo/InfosIndex.js @@ -23,6 +23,10 @@ const VideoPublishSuccess = Loadable({ loader: () => import('./video/VideoPublishSuccess'), loading: Loading, }) +const VideoProtocol = Loadable({ + loader: () => import('./video/VideoProtocol'), + loading: Loading, +}) const $ = window.$; class InfosIndex extends Component{ @@ -52,16 +56,23 @@ class InfosIndex extends Component{ {/* 视频发布 */} - () } > - () } > + () + } + > + + diff --git a/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js b/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js index e9789ba6c..9ac0f1a08 100644 --- a/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js +++ b/public/react/src/modules/user/usersInfo/video/AliyunUploaderManager.js @@ -7,6 +7,7 @@ let _path = isDev() ? 'public' : 'build' let _testHost = '' ; // 'http://192.168.2.63:3001/api' ; // '' ; let login = 'innov' +// https://help.aliyun.com/document_detail/52204.html?spm=5176.2020520165.120.d52204.19a47029YWhro7#%E4%B8%8A%E4%BC%A0%E5%9C%B0%E5%9D%80%E5%92%8C%E5%87%AD%E8%AF%81%E6%96%B9%E5%BC%8F(%E6%8E%A8%E8%8D%90%E4%BD%BF%E7%94%A8) let uploader; let $ = window.$ function loadLib(callback) { @@ -63,7 +64,7 @@ function doCreateUploader (options) { if (!uploadInfo.videoId) { - var createUrl = `${_testHost}/users/${login}/video_auths.json?debug=true` + var createUrl = `${_testHost}/users/${login}/video_auths.json` axios.post(createUrl, { title: fileName, file_name: fileName @@ -89,10 +90,12 @@ function doCreateUploader (options) { console.log("onUploadStarted:" + uploadInfo.file.name + ", endpoint:" + uploadInfo.endpoint + ", bucket:" + uploadInfo.bucket + ", object:" + uploadInfo.object) } else { // 如果videoId有值,根据videoId刷新上传凭证 - var refreshUrl = `${_testHost}/users/${login}/video_auths.json?debug=true` + var refreshUrl = `${_testHost}/users/${login}/video_auths.json` axios.put(refreshUrl, { video_id: uploadInfo.videoId, + title: fileName, + file_name: fileName }).then((response) => { if (response.data.status == -1) { options.onUploadError && options.onUploadError(uploadInfo) @@ -102,7 +105,8 @@ function doCreateUploader (options) { var uploadAuth = data.UploadAuth var uploadAddress = data.UploadAddress var videoId = data.VideoId - uploader.setUploadAuthAndAddress(uploadInfo, uploadAuth, uploadAddress, videoId) + uploader.setUploadAuthAndAddress(uploadInfo, uploadAuth, uploadAddress) + // , videoId options.addFileSuccess && options.addFileSuccess(uploadInfo) }).catch((error) => { @@ -145,7 +149,7 @@ function doCreateUploader (options) { // 需要根据 uploadInfo.videoId 调用刷新视频上传凭证接口(https://help.aliyun.com/document_detail/55408.html)重新获取 UploadAuth // 然后调用 resumeUploadWithAuth 方法, 这里是测试接口, 所以我直接获取了 UploadAuth $('#status').text('文件上传超时!') - var refreshUrl = `${_testHost}/users/${login}/video_auths.json?debug=true` + var refreshUrl = `${_testHost}/users/${login}/video_auths.json` axios.put(refreshUrl, { diff --git a/public/react/src/modules/user/usersInfo/video/EditVideoModal.js b/public/react/src/modules/user/usersInfo/video/EditVideoModal.js index 2e4bd7c3a..4ed20d3cd 100644 --- a/public/react/src/modules/user/usersInfo/video/EditVideoModal.js +++ b/public/react/src/modules/user/usersInfo/video/EditVideoModal.js @@ -14,10 +14,10 @@ function EditVideoModal (props) { const _title = form.getFieldsValue().title; function toList() { - history.push(`/users/${username}/videoes`) + history.push(`/users/${username}/videos`) } function toUpload() { - history.push(`/users/${username}/videoes/upload`) + history.push(`/users/${username}/videos/upload`) } function onOk() { form.validateFieldsAndScroll((err, values) => { @@ -57,8 +57,9 @@ function EditVideoModal (props) { { setLoading(false) if (response.data.videos) { - setVideoes(response.data.videos) + setvideos(response.data.videos) setCount(response.data.count) } }).catch(() => { }) } - function fetchReviewVideoes() { + function fetchReviewvideos() { const fetchUrl = `/users/${username}/videos/review.json` setLoading(true) axios.get(fetchUrl, { params: { - per_page: 200 + per_page: 100 } }) .then((response) => { setLoading(false) if (response.data.videos) { - setReviewVideoes(response.data.videos) + setReviewvideos(response.data.videos) setCount(response.data.count) } }).catch(() => { @@ -119,14 +119,14 @@ function InfoVideo (props) { } useEffect(() => { - fetchVideoes() + fetchvideos() }, [pageObj.current, sortKey]) useEffect(() => { if (categoryObj.category == 'all') { - fetchVideoes() + fetchvideos() } else { - fetchReviewVideoes() + fetchReviewvideos() } }, [categoryObj.category]) @@ -139,6 +139,8 @@ function InfoVideo (props) { _clipboard = null; } } else { + videoEl.current && videoEl.current.play() + setTimeout(() => { if (!_clipboard) { _clipboard = new ClipboardJS('.copybtn'); @@ -155,7 +157,7 @@ function InfoVideo (props) { }, []) function editSuccess() { - fetchVideoes() + fetchvideos() } function onEditVideo(item) { @@ -201,6 +203,7 @@ function InfoVideo (props) { width={800 - 1} >