Merge branch 'dev_aliyun' into develop

Adjustreact
daiao 5 years ago
commit 42616da696

@ -23,23 +23,23 @@ class ApplicationController < ActionController::Base
# 所有请求必须合法签名
def check_sign
# if !Rails.env.development?
# Rails.logger.info("66666 #{params}")
# # suffix = request.url.split(".").last.split("?").first
# # suffix_arr = ["xls", "xlsx", "pdf", "zip"] # excel文件先注释
# # unless suffix_arr.include?(suffix)
# if params[:client_key].present?
# randomcode = params[:randomcode]
# # tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5)
#
# sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
# Rails.logger.info("2222 #{sign}")
# tip_exception(501, "请求不合理") if sign != params[:client_key]
# else
# tip_exception(501, "请求不合理")
# end
# # end
# end
if !Rails.env.development?
Rails.logger.info("66666 #{params}")
# suffix = request.url.split(".").last.split("?").first
# suffix_arr = ["xls", "xlsx", "pdf", "zip"] # excel文件先注释
# unless suffix_arr.include?(suffix)
if params[:client_key].present?
randomcode = params[:randomcode]
# tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5)
sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}")
Rails.logger.info("2222 #{sign}")
tip_exception(501, "请求不合理") if sign != params[:client_key]
else
tip_exception(501, "请求不合理")
end
# end
end
end
# 全局配置参数

@ -6,7 +6,7 @@ module ControllerRescueHandler
Util.logger_error e
render json: {status: -1, message: e.message}
end
rescue_from Mysql2::Error do |e|
rescue_from ActiveRecord::StatementInvalid do |e|
Util.logger_error e
render json: {status: -1, message: "接口数据异常"}
end

@ -110,9 +110,9 @@ class CoursesController < ApplicationController
end
def delete_course_video
video = Video.find_by(uuid: params[:video_id])
video = Video.find_by(id: params[:video_id])
tip_exception(404, "找不到资源") if video.blank?
tip_exception(403, "...") if video.user_id != current_user.id || !current_user.admin_or_business?
tip_exception(403, "...") unless (video.user_id == current_user.id || current_user.admin_or_business?)
video.destroy!
AliyunVod::Service.delete_video([video.uuid]) rescue nil
render_ok

@ -65,6 +65,10 @@ class Subject < ApplicationRecord
excellent ? CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).length : shixuns.pluck(:myshixuns_count).sum
end
def myshixuns_count
shixuns.pluck(:myshixuns_count).sum
end
def all_score
subject_shixun_score + subject_shixun_choose_score
end

@ -21,7 +21,7 @@ class Weapps::SubjectQuery < ApplicationQuery
subjects = subjects.left_joins(:shixuns).select('subjects.id, subjects.name, subjects.excellent, subjects.stages_count, subjects.status, subjects.homepage_show,
subjects.shixuns_count, subjects.updated_at, IFNULL(sum(shixuns.myshixuns_count), 0) myshixuns_count')
.group('subjects.id').order("(homepage_show, #{order_type}) #{sort_type}")
.group('subjects.id').order("subjects.homepage_show #{sort_type}, #{order_type} #{sort_type}")
subjects
end

@ -1,4 +1,4 @@
json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv
json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv, :user_id
json.play_duration video.video_play_duration
json.published_at video.display_published_at

@ -1,6 +1,6 @@
json.subjects @subjects do |subject|
json.(subject, :id, :excellent, :name, :stages_count, :shixuns_count)
json.myshixuns_count subject.excellent ? subject.member_count : subject.myshixuns_count
json.myshixuns_count subject.myshixuns_count
json.challenges_count subject.subject_challenge_count
json.image_url url_to_avatar(subject)
json.allow_visit subject.status > 1 || User.current.manager_of_subject?(subject) || User.current.admin?

@ -3,7 +3,7 @@ json.subject do
json.description @subject.description
json.shixuns_count @subject.shixuns_count
json.challenges_count @subject.subject_challenge_count
json.member_count @subject.member_count
json.member_count @subject.myshixuns_count
json.subject_score @subject.all_score
json.learning_notes @subject.learning_notes
end

@ -9,8 +9,8 @@ namespace :subjects do
buffer_size = 0
column_value = "subject_id, study_count, course_study_count, initiative_study, passed_count, course_used_count, " +
"school_used_count, created_at, updated_at"
subjects.find_in_batches(batch_size: 50) do |s, index|
Parallel.each_with_index(s, in_processes: 4) do |subject|
subjects.find_in_batches(batch_size: 50) do |s|
Parallel.each_with_index(s, in_processes: 4) do |subject, index|
puts("---------------------data_statistic: #{subject.id}")
Rails.logger.info("---------------------data_statistic: #{subject.id}")
data = Subjects::DataStatisticService.new(subject)

@ -17,8 +17,8 @@
<meta name=”Description” Content=”EduCoder翻转课堂教学模式颠覆了传统教学模式让教师与学生的关系由“权威”变成了“伙伴”。将学习的主动权转交给学生使学生可个性化化学学生的学习主体得到了彰显。”>
<meta name=”Description” Content=”EduCoder实训项目为单个知识点关卡实践训练帮助学生巩固单一弱点强化学习。 >
<meta name=”Description” Content=”EduCoder实践教学平台各类大赛为进一步提高各类学生综合运用高级语言程序设计能力培养创新意识和实践探索精神发掘优秀软件人才。 >
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=0.3, maximum-scale=0.3, user-scalable=no">
<!-- <meta name="viewport" id="viewport" content="width=device-width, initial-scale=0.3, maximum-scale=0.3, user-scalable=no">-->
<meta name="viewport" id="viewport" content="width=device-width, initial-scale=0.3, maximum-scale=0.3">
<meta name="theme-color" content="#000000">
<!--<meta http-equiv="cache-control" content="no-cache,no-store, must-revalidate" />-->
@ -44,13 +44,13 @@
window.__isR = true;
// 不支持ie9 ie10
if (
( navigator.userAgent.indexOf('MSIE 9') != -1
( navigator.userAgent.indexOf('MSIE 9') != -1
|| navigator.userAgent.indexOf('MSIE 10') != -1 )
&&
&&
location.pathname.indexOf("/compatibility") == -1) {
debugger;
// location.href = './compatibility'
location.href = '/compatibility.html'
location.href = '/compatibility.html'
}
// const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
const isWeiXin = (/MicroMessenger/i.test(navigator.userAgent.toLowerCase()));
@ -203,10 +203,10 @@
<script type="text/javascript" src="https://testeduplus2.educoder.net/javascripts/educoder/edu_application.js"></script> -->
<script type="text/javascript" src="https://cdn.bootcss.com/quill/1.3.7/quill.core.min.js"></script>
<script>
document.body.addEventListener('touchmove', function (e) {
e.preventDefault(); //阻止默认的处理方式(阻止下拉滑动的效果)
}, {passive: false});
</script>
<!-- <script>-->
<!-- document.body.addEventListener('touchmove', function (e) {-->
<!-- e.preventDefault(); //阻止默认的处理方式(阻止下拉滑动的效果)-->
<!-- }, {passive: false});-->
<!-- </script>-->
</body>
</html>

@ -36,6 +36,11 @@ class LiveNew extends Component{
})
}
})
}else{
this.props.form.setFieldsValue({
url:undefined,
description:undefined
})
}
this.setState({
isSpining:false
@ -45,6 +50,7 @@ class LiveNew extends Component{
handleSubmit=()=>{
this.props.form.validateFields((err, values) => {
if(!err){
console.log("2")
const { liveId } = this.props;
if(liveId){
// 修改
@ -89,10 +95,14 @@ class LiveNew extends Component{
}
validateDesc= (rule, value, callback) => {
if(!value){
callback();
}
if (value.length > 100) {
callback("直播说明不能超过100个字");
}else{
callback();
}
callback();
}
cancelNew=()=>{

@ -10,6 +10,7 @@ import ClipboardJS from 'clipboard'
import './video.css';
import '../../user/usersInfo/video/InfosVideo.css'
import axios from 'axios';
const DEFAULT_VIDEO_WIDTH_IN_MD = "90%" // 400
const DEFAULT_VIDEO_HEIGHT_IN_MD = "55%" // 400
@ -17,7 +18,6 @@ const DEFAULT_VIDEO_HEIGHT_IN_MD = "55%" // 400
const videoEl = null;
let _clipboard = null;
class Video extends Component{
constructor(props){
super(props);
@ -69,9 +69,8 @@ class Video extends Component{
// 编辑成功后回调的方法
editSuccess=()=>{
const { page } = this.state;
this.props.showNotification("视频名称修改成功!");
const { listFunc } = this.props;
const { listFunc , page } = this.props;
listFunc && listFunc(page);
}
@ -132,13 +131,43 @@ class Video extends Component{
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>`
}
// 删除事件
deleteVideo=(item)=>{
this.props.confirm({
content: '该视频将被删除,不可恢复',
subContent:'是否确认删除?',
onOk: () => {
const CourseId=this.props.match.params.coursesId;
const url = `/courses/${CourseId}/delete_course_video.json`;
axios.delete(url,{
params:{
video_id:item.id
}
}).then(result=>{
if(result){
this.props.showNotification(`删除成功!`);
this.props.updataleftNavfun();
const { listFunc , page } = this.props;
listFunc && listFunc(page);
}
}).catch(error=>{
console.log(error);
})
},
onCancel() {
console.log('Cancel');
},
});
}
render(){
const { visible , videoVisible , videoId } = this.state;
const CourseId=this.props.match.params.coursesId;
const login=this.props.user&&this.props.user.login;
const _inputValue = videoId && this.getCopyText(videoId.file_url, videoId.cover_url);
const { admin , is_teacher ,business} = this.props.user;
const { admin , is_teacher ,business , user_id} = this.props.user;
const { videos , upload , uploadVideo , videoData , changePage ,pageSize ,page } = this.props;
@ -195,6 +224,7 @@ class Video extends Component{
onMaskClick={this.onMaskClick}
getCopyText={this.getCopyText}
operation={operation}
deleteVideo={(admin || item.user_id === user_id) ? this.deleteVideo : undefined}
>
</VideoInReviewItem>
)

@ -180,6 +180,7 @@ class VideoIndex extends Component{
render(){
const { videos , upload , videoData , type , liveData , lives , page , liveVisible , isSpining , liveId } = this.state;
const { admin , is_teacher , business } = this.props.user;
// console.log("p",this.props);
return(
<React.Fragment>
<LivesNew
@ -189,6 +190,16 @@ class VideoIndex extends Component{
{...this.props}
{...this.state}
></LivesNew>
{
liveVisible ?
<style>{
`
body{
width: 100%!important;
overflow: hidden!important;
}
`}</style>:""
}
<div className="edu-back-white" style={{marginBottom:"1px"}}>
<div className="clearfix pl30 pr30 menuDiv">

@ -247,7 +247,7 @@ const App = (props) => {
<section className="static_section_header">
<div className="header_title">
<span className="title-p">学习统计</span>
<span className="title-sub">Android综合实训之物联网移动应用</span>
<span className="title-sub"></span>
</div>
<div className="header-number header-flex">
<StaticNumberAndTxt

@ -30,13 +30,13 @@
font-weight: bold;
&::before{
position: absolute;
content: '';
border-left: 1px solid rgba(192,196,204,1);
right: -10px;
top: 2px;
bottom: 0px;
margin-left: 10px;
//position: absolute;
//content: '';
//border-left: 1px solid rgba(192,196,204,1);
//right: -10px;
//top: 2px;
//bottom: 0px;
//margin-left: 10px;
}
}
.title-sub{
@ -105,7 +105,7 @@
.ant-table-thead{
th{
background: rgba(241,248,255,1);
}
.ant-table-column-title{
color: #303133;
@ -152,5 +152,5 @@
}
.tool-clazz{
max-width: 200px !important;
max-width: 200px !important;
}

@ -57,7 +57,7 @@
z-index: 99;
}
.videoItem .square-main {
padding: 9px 8px;
padding: 15px 10px;
background: #fff;
border-radius:12px;

@ -20,7 +20,7 @@ const clipboardMap = {}
function VideoInReviewItem (props) {
const theme = useContext(ThemeContext);
const { history, file_url, cover_url, title, created_at, published_at, isReview, id
, onEditVideo, onMaskClick, getCopyText, showNotification,vv,play_duration,operation} = props;
, onEditVideo, onMaskClick, getCopyText, showNotification,vv,play_duration,operation , deleteVideo} = props;
useEffect(()=> {
if (!isReview) {
_clipboard = new ClipboardJS(`.copybtn_item_${id}`);
@ -73,6 +73,15 @@ function VideoInReviewItem (props) {
</Tooltip> } {vv===0?"":vv}
</span>
{ isReview != true && <div>
{
deleteVideo &&
<Tooltip title="删除" placement="bottom">
<i className="icon-shanchu iconfont" onClick={() => deleteVideo(props)}
style={{ marginTop: '1px', display: 'inline-block'}}
></i>
</Tooltip>
}
{
operation &&
<Tooltip title="编辑" placement="bottom">

Loading…
Cancel
Save