Merge branches 'dev_aliyun' and 'dev_chen' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_chen

dev_chen
杨树明 5 years ago
commit bf49924733

@ -68,8 +68,9 @@ class GitsController < ApplicationController
end end
else else
uid_logger_error("shixun is not exist") uid_logger_error("shixun is not exist")
# result = false # 找TPI的版本库是不是自己
result = true # 为了测试跳出 myshixun = Myshixun.find_by(repo_name: repo_name)
result = (myshixun.present? && system_user&.id == myshixun.user_id ? true : false)
end end
end end
end end

@ -1,4 +1,4 @@
json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv, :user_id, :transcoded json.extract! video, :id, :title, :cover_url, :vv, :user_id, :transcoded
json.play_url url_base64_encode(video.play_url) json.play_url url_base64_encode(video.play_url)
json.file_url url_base64_encode(video.file_url) json.file_url url_base64_encode(video.file_url)
json.play_duration video.video_play_duration json.play_duration video.video_play_duration

@ -1,4 +1,15 @@
json.count @count json.count @count
json.videos @videos do |video| json.videos @videos do |video|
json.partial! 'users/videos/video', locals: { video: video } #json.partial! 'users/videos/video', locals: { video: video }
json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv, :user_id, :transcoded
#json.play_url url_base64_encode(video.play_url)
#json.file_url url_base64_encode(video.file_url)
json.play_duration video.video_play_duration
json.published_at video.display_published_at
json.created_at video.display_created_at
json.updated_at video.display_updated_at
user = video.user
json.user_name user&.real_name
json.user_img url_to_avatar(user)
json.user_login user&.login
end end

@ -133,11 +133,9 @@ class TPIContextProvider extends Component {
}) })
} }
componentWillMount () {
// 拦截判断是否离开当前页面
}
componentWillUnmount() { componentWillUnmount() {
this.costTimeInterval && window.clearInterval(this.costTimeInterval) this.costTimeInterval && window.clearInterval(this.costTimeInterval)
} }
componentDidMount() { componentDidMount() {
@ -195,6 +193,8 @@ class TPIContextProvider extends Component {
if (window.location.port == 3007) { if (window.location.port == 3007) {
testPath = 'http://test-newweb.educoder.net' testPath = 'http://test-newweb.educoder.net'
} }
// var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time` // var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time`
var url = `${testPath}/api/tasks/${ game.identifier }/cost_time${getRandomNumber()}` var url = `${testPath}/api/tasks/${ game.identifier }/cost_time${getRandomNumber()}`
window.$.ajax({ window.$.ajax({

@ -108,7 +108,6 @@ class Video extends Component {
setVideoVisible = (flag) => { setVideoVisible = (flag) => {
this.setState({ this.setState({
videoVisible: flag videoVisible: flag
}) })
@ -236,14 +235,15 @@ class Video extends Component {
className="showVideoModal" className="showVideoModal"
width={800 - 1} width={800 - 1}
> >
{videoId && <VideoPanel src={this.state.videourl===null?videoId.file_url:Base64.decode(videoId.file_url)} videoId={videoId.videoId} courseId={CourseId} logWatchHistory={logWatchHistory} />} {this.state.videourl===null?'':videoId &&<VideoPanel src={Base64.decode(videoId.file_url)} videoId={videoId.videoId} courseId={CourseId} logWatchHistory={logWatchHistory} />}
{/* {videoId && <VideoPanel src={Base64.decode(videoId.file_url)} videoId={videoId.videoId} courseId={CourseId} logWatchHistory={logWatchHistory} />} */}
<div className="df copyLine" style={{}}> {this.props.isAdmin()===false?'':<div className="df copyLine" style={{}}>
<Input value={_inputValue} <Input value={_inputValue}
className="dark" className="dark"
></Input> ></Input>
<ActionBtn className="copybtn" data-clipboard-text={_inputValue}>复制视频地址</ActionBtn> <ActionBtn className="copybtn" data-clipboard-text={_inputValue}>复制视频地址</ActionBtn>
</div> </div>}
</HeadlessModal> </HeadlessModal>
<div className="videoPanel"> <div className="videoPanel">
{ {

@ -11,6 +11,7 @@ import HeadlessModal from '../common/HeadlessModal'
import ClipboardJS from 'clipboard' import ClipboardJS from 'clipboard'
import VideoPlay from '../../../courses/Video/video-play'; import VideoPlay from '../../../courses/Video/video-play';
import { logWatchHistory } from '../../../../services/video-service'; import { logWatchHistory } from '../../../../services/video-service';
import { Base64 } from 'js-base64';
function useModal(initValue) { function useModal(initValue) {
const [visible, setVisible] = useState(initValue) const [visible, setVisible] = useState(initValue)
@ -250,8 +251,10 @@ function InfoVideo(props) {
}); });
} }
function getCopyText(file_url, cover_url) { function getCopyText(file_url, cover_url) {
return `<video src="${file_url}" controls="true" controlslist="nodownload" width="${DEFAULT_VIDEO_WIDTH_IN_MD}" height="${DEFAULT_VIDEO_HEIGHT_IN_MD}" poster="${cover_url}">您的浏览器不支持 video 标签。</video>` if(file_url){
} return `<video src="${Base64.decode(file_url)}" controls="true" controlslist="nodownload" width="${DEFAULT_VIDEO_WIDTH_IN_MD}" height="${DEFAULT_VIDEO_HEIGHT_IN_MD}" poster="${cover_url}">您的浏览器不支持 video 标签。</video>`
}
}
const _inputValue = getCopyText(videoId.file_url, videoId.cover_url); const _inputValue = getCopyText(videoId.file_url, videoId.cover_url);
const sorts = sortKey.split('-') const sorts = sortKey.split('-')
@ -268,7 +271,7 @@ function InfoVideo(props) {
className="showVideoModal" className="showVideoModal"
width={800 - 1} width={800 - 1}
> >
{videoModalObj.visible && <VideoPlay src={videoId.file_url} videoId={videoId.videoId} logWatchHistory={logWatchHistory} />} {videoModalObj.visible && <VideoPlay src={Base64.decode(videoId.file_url)} videoId={videoId.videoId} logWatchHistory={logWatchHistory} />}
<div className="df copyLine"> <div className="df copyLine">
<Input value={_inputValue} <Input value={_inputValue}
className="dark" className="dark"

Loading…
Cancel
Save