Merge branches 'dev_Ysl' and 'dev_Ysm' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysm

dev_hs
杨树林 6 years ago
commit 817efa053e

@ -12,7 +12,7 @@ class CoursesController < ApplicationController
end
before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
:left_banner, :top_banner]
:left_banner, :top_banner, :informs, :online_learning]
before_action :check_account, only: [:new, :create, :apply_to_join_course, :join_excellent_course]
before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
:left_banner, :top_banner, :apply_to_join_course, :exit_course]

@ -1,7 +1,7 @@
class SubjectsController < ApplicationController
before_action :require_login, :check_auth, except: [:index, :show]
before_action :require_login, :check_auth, except: [:index, :show, :right_banner]
# before_action :check_auth, except: [:index]
before_action :check_account, except: [:index, :show]
before_action :check_account, except: [:index, :show, :right_banner]
before_action :find_subject, except: [:index, :create, :new, :append_to_stage]
before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish,
:search_members, :add_subject_members, :statistics, :shixun_report, :school_report,
@ -85,17 +85,6 @@ class SubjectsController < ApplicationController
# 合作团队
@shixuns = @subject.shixuns.published.pluck(:id)
@courses = @subject.courses if @subject.excellent
@members = @subject.subject_members.includes(:user)
shixuns = @subject.shixuns.published.pluck(:id)
challenge_ids = Challenge.where(shixun_id: shixuns).pluck(:id)
# 实训路径中的所有实训标签
@tags = ChallengeTag.where(challenge_id: challenge_ids).pluck(:name).uniq
# 用户获取的实训标签
# @user_tags = @subject.shixuns.map(&:user_tags_name).flatten.uniq
@user_tags = user_shixun_tags challenge_ids, @user.id
@my_subject_progress = @subject.my_subject_progress
# 访问数变更
@subject.increment!(:visits)
end

@ -23,26 +23,4 @@ if @subject.excellent
json.course_identity @user.course_identity(course)
json.course_status subject_course_status course
end
end
json.members @members do |member|
json.partial! 'subject_member', locals: { user: member.user }
json.role member.role
end
# 技能标签
json.tags @tags do |tag|
unless tag.blank?
json.tag_name tag
json.status @user_tags.include?(tag)
end
end
# 我的进展
json.progress do
json.my_score @subject.my_subject_score
json.all_score @subject.all_score
json.learned @subject.my_subject_progress
json.time @subject.my_consume_time
end

@ -1,16 +0,0 @@
defaults: &defaults
access_key_id: 'test'
access_key_secret: 'test'
base_url: 'http://vod.cn-shanghai.aliyuncs.com'
cate_id: '-1'
callback_url: 'http://47.96.87.25:48080/api/callbacks/aliyun_vod.json'
signature_key: 'test12345678'
development:
<<: *defaults
test:
<<: *defaults
production:
<<: *defaults

@ -58,7 +58,7 @@ namespace :public_course do
# 更新某个课程的某类时间
# 执行示例 bundle exec rake public_course:time args=-1,2932,1,1
# 执行示例 RAILS_ENV=production bundle exec rake public_course:time args=-1,2932,1,1
task :time => :environment do
# course_id = ENV['args'].split(",")[0] # 对应课堂的id
# type = ENV['args'].split(",")[1]
@ -70,13 +70,13 @@ namespace :public_course do
# 讨论区
created_on = random_time start_time, end_time
messages = Message.where(board_id: course.boards)
message_details = MessageDetail.where(message_id: messages)
messages.update_columns(created_on: created_on, updated_on: created_on)
message_details.update_columns(created_at: created_on, updated_at: created_on)
messages.each do |message|
message.update_columns(created_on: created_on, updated_on: created_on)
MessageDetail.where(message_id: message.id).update_all(created_at: created_on, updated_at: created_on)
end
when 2
# 作业
course.homework_commons.each do |homework|
course.homework_commons.each do |homework|
created_at = random_time(start_time, end_time)
publish_time = random_larger_time created_at, start_time, end_time
end_time = random_larger_time publish_time, start_time, end_time

@ -0,0 +1,67 @@
# add test user
namespace :sync do
task :add_user => :environment do
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
user_count = ENV['args'].split(",")[0].to_i # 用户数
rand_chart = ENV['args'].split(",")[1] # 手机号或者邮箱等前面的随机数
puts rand_chart
puts user_count
(1..user_count).each do |i|
puts i
no = sprintf("%04d", i)
phone = "#{rand_chart}160731#{no}"
mail = "#{rand_chart}#{no}@educoder.net"
code = generate_identifier User, 8
login = "m" + code
l = "赵,钱,孙,李,周,吴,郑,王,冯,陈,褚,卫,蒋,沈,韩,杨,朱,秦,尤,许,何,吕,施,张,孔,曹,严,华,金,魏,陶,姜,黄".split(",")
f = "爱童,安妮,若婷,安煜,博,雷,梅,静,士红,大龙,冰波,慧娟,梅,婧婧,军,淋,真,维,涛,程程,
,,,,,,,,,,,,,,,,访,,,绿,,
,,访,,,,,,,,,,,,访,,,,,,,
,,,,,,,,,,,,,,,,,,绿,,,
,,,,,,,,,,访,,绿,,,,,,,,,
,,绿,,,,,,,,,,,,,,,,,,,
,绿,,,,,,,,,,绿,,,,,,,,,,
,,,,,,,,,,,,,,,,,".split(",")
lastname = l[rand(l.length)].strip + f[rand(f.length)].strip
edit_params = {
login: login,
admin: false,
type: User,
phone: phone,
lastname: lastname,
mail: mail,
authentication: 1,
professional_certification: 1,
profile_completed: true,
is_test: true
}
user = User.create!(edit_params)
puts "aa"
UserExtension.create!(user_id: user.id, school_id: 117)
puts i
end
end
# 随机生成字符
def generate_identifier(container, num)
code = DCODES.sample(num).join
if container == User
while container.exists?(login: code) do
code = DCODES.sample(num).join
end
else
while container.exists?(identifier: code) do
code = DCODES.sample(num).join
end
end
code
end
end

@ -115,15 +115,16 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
.tag-green{
position: absolute;
left: 10px;
bottom: 95px;}
bottom: 90px;}
.tag-green .tag-name{display: block;width: auto;
/*background-image: url("/images/educoder/tag1.png");*/
background: #000000;
border: 1px solid #fff;
border-radius: 3px;
font-size: 14px;
opacity: 0.56;
background-size: 100% 100%;padding: 0px 8px;color: #fff;float: left;}
.tag-orange{position: absolute;right: 0px;top:20px;}
.tag-orange{position: absolute;right: 0px;top:12px;}
.tag-orange .tag-name{display: block;width: auto;background-color:#FF6800;
background-size: 100% 100%;padding: 0px 8px;color: #fff;float: left;
height: 28px;

File diff suppressed because one or more lines are too long

@ -73,4 +73,13 @@ html, body {
}
.formItemInline .ant-form-item-control-wrapper {
flex: 1;
}
/* 兼容性 */
/* 火狐有滚动条时高度问题 */
@-moz-document url-prefix() {
.newContainers {
min-height: calc(100% - 60px) !important;
}
}

@ -462,7 +462,7 @@ class CoursesBanner extends Component {
}
</style>
{excellent===true?
<span className="tag-orangces fl"><span className="tag-names mt10 ml15">课程</span></span>
<span className="tag-orangces fl"><span className="tag-names mt10 ml15">课程</span></span>
:""}
<span className={"TabsWarp"}>
<CoursesListType

@ -228,6 +228,11 @@ class ShixunsHome extends Component {
return(
<div className="square-Item" key={key} id={item.id} style={{width:'286px'}}>
{item.excellent === false ? "" :
<div className="tag-orange">
<span className="tag-name">开放课程</span>
</div>}
<div className="tag-green">
<span className="tag-name"> {item.tag_name}</span>
{/*<img style={{display:item.tag_name===null?"none":'block'}} src={require(`./tag2.png`)}/>*/}
@ -301,7 +306,11 @@ class ShixunsHome extends Component {
.taglistleft{
position: absolute;
left: 10px;
bottom: 125px;
bottom: 118px;
}
.square-Item:nth-child(4n+0) {
margin-right: 25px;
}
`
}

@ -41,7 +41,7 @@
}
.solidright{
border-right: 1px solid #000;
border-right:1px solid #CDCDCD;
height: 42px;
}
.ant-modal-title {
@ -53,4 +53,8 @@
font-weight: 500!important;
color: #333;
text-align: center;
}
.pd4020{
padding: 0 40px 0 20px !important;
}

@ -31,6 +31,7 @@ class DetailTop extends Component{
}
componentDidMount(){
let courseslist=[]
if(this.props.courses!=undefined&&this.props.courses.length!=0){
this.props.courses.map((item,key)=>{
if(1===key+1){
@ -44,6 +45,27 @@ class DetailTop extends Component{
courseslist:courseslist
})
}
componentDidUpdate=(prevProps)=> {
if(prevProps.courses!=this.props.courses){
let courseslist=[]
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
})
}
}
allow_deletepath=()=>{
this.setState({
Modalstype:true,
@ -260,7 +282,7 @@ class DetailTop extends Component{
<style>
{
`
.tag-orange .tag-name{
.pathoranges .tag-name{
display: block;
width: auto;
background-color: #FF6800;
@ -276,8 +298,8 @@ class DetailTop extends Component{
`
}
</style>
{this.props.courses===undefined?"":
<span className="tag-orange">
{detailInfoList===undefined?"":detailInfoList.excellent === false ? "" :
<span className="pathoranges">
<span className="tag-name mt6 ml10">开放课程</span>
</span>}
{detailInfoList===undefined?"":detailInfoList.allow_statistics===true?
@ -348,7 +370,7 @@ class DetailTop extends Component{
{this.props.courses===undefined||this.props.courses.length===0?"":<div className="userNavs mt20">
<li className={"fl"}>
<li className={"fl pd4020"}>
<style>
{
`
@ -444,7 +466,8 @@ class DetailTop extends Component{
}
</li>
<li className={"fr"}>
<li className={"fr mr25"}>
<style>
{
`
@ -454,6 +477,14 @@ class DetailTop extends Component{
background: rgba(191,191,191,1) !important;
color: #fff;
}
.mr51{
margin-right: 51px;
}
.pathbtens{
width: 150px !important;
height: 44px !important;
line-height: 44px !important;
}
`
}
</style>
@ -461,31 +492,31 @@ class DetailTop extends Component{
return(
<div key={key}>
{item.course_status.status===0?<a className="mr30 shixun_detail pointer fl user-colorgrey-green">即将开课</a>:""}
{item.course_status.status===1?<a className="mr30 shixun_detail pointer fl color-orange">{item.course_status.time}</a>:""}
{item.course_status.status===0?<div className="mr51 shixun_detail pointer fl user-colorgrey-green">即将开课</div>:""}
{item.course_status.status===1?<div className="mr51 shixun_detail pointer fl color-orange">{item.course_status.time}</div>:""}
{item.course_status.status===2?
detailInfoList.is_creator===true?<a className="mr30 shixun_detail pointer fl user-colorgrey-9b">已结束</a>:item.course_identity<6?
<a className="mr30 shixun_detail pointer fl user-colorgrey-9b">已结束</a>:"":""}
detailInfoList.is_creator===true?<div className="mr51 shixun_detail pointer fl user-colorgrey-9b">已结束</div>:item.course_identity<6?
<div className="mr51 shixun_detail pointer fl user-colorgrey-9b">已结束</div>:"":""}
{item.course_status.status===0?
detailInfoList.is_creator===true?<a className="fr user_default_btn task-btn-orange font-18 mt28" href={item.first_category_url} target="_blank">
detailInfoList.is_creator===true?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">
进入课堂
</a>:item.course_identity<6?<div className="fr user_default_btn background191 font-18 mt28"></div>
:<a className="fr user_default_btn task-btn-orange font-18 mt28" onClick={()=>this.JoinnowCourse(item.course_id)}>立即报名</a>:""}
</a>:item.course_identity<6?<div className="fr user_default_btn background191 font-18 mt28 pathbtens"></div>
:<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" onClick={()=>this.JoinnowCourse(item.course_id)}>立即报名</a>:""}
{item.course_status.status===1?
detailInfoList.is_creator===true?<a className="fr user_default_btn task-btn-orange font-18 mt28" onClick={()=>this.JoinnowCourse(item.course_id)}>
detailInfoList.is_creator===true?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" onClick={()=>this.JoinnowCourse(item.course_id)}>
进入课堂
</a>:item.course_identity<6?<a className="fr user_default_btn task-btn-orange font-18 mt28" href={item.first_category_url} target="_blank">
</a>:item.course_identity<6?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">
立即学习
</a>:<a className="fr user_default_btn task-btn-orange font-18 mt28" onClick={()=>this.JoinnowCourse(item.course_id)}></a>:""}
</a>:<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" onClick={()=>this.JoinnowCourse(item.course_id)}></a>:""}
{item.course_status.status===2?
detailInfoList.is_creator===true?<a className="fr user_default_btn task-btn-orange font-18 mt28" href={item.first_category_url} target="_blank">
detailInfoList.is_creator===true?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">
进入课堂
</a>:item.course_identity<6?<a className="fr user_default_btn task-btn-orange font-18 mt28" href={item.first_category_url} target="_blank">
</a>:item.course_identity<6?<a className="fr user_default_btn task-btn-orange font-18 mt28 pathbtens" href={item.first_category_url} target="_blank">
进入课堂
</a>:<div className="fr user_default_btn background191 font-18 mt28"></div>:""}
</a>:<div className="fr user_default_btn background191 font-18 mt28 pathbtens"></div>:""}
</div>
)})}

@ -7,7 +7,7 @@ class OpenCourse extends Component {
constructor(props) {
super(props);
this.state={
value:0
value:1
}
}
@ -68,10 +68,10 @@ class OpenCourse extends Component {
<div className={"tabeltext-alignleft"}>
<p className={"mt20 mb20 font-16"}>
<Radio.Group onChange={this.setpathradioChange} value={this.state.value}>
<Radio style={pathradioStyle} value={0}>
<Radio style={pathradioStyle} value={1}>
开放课堂<span style={pathradioStyles}>所有用户可以随时访问</span>
</Radio>
<Radio style={pathradioStyle} value={1}>
<Radio style={pathradioStyle} value={0}>
私有课堂<span style={pathradioStyles}>仅报名参与的课堂成员可以访问</span>
</Radio>
</Radio.Group>

@ -476,7 +476,7 @@ class PathDetailIndex extends Component{
</div>
}
{
this.props.checkIfLogin()===false?"123213":progress === undefined ? "" : progress === null ? "" :
this.props.checkIfLogin()===false?"":progress === undefined ? "" : progress === null ? "" :
<div className="edu-back-white myProgress padding40-20 mb10">
<p className="mb20">
<span className="font-16 mr10">我的进展</span>

@ -97,6 +97,19 @@ export default class TPMFork_listComponent extends Component {
<span className="fl font-16">Fork实训列表</span>
<a href={"/shixuns/"+shixunsID+"/challenges"} className="font-16 color-grey-9 fr">返回</a>
</div>
<style>
{
`
.taglistleft{
position: absolute;
left: 10px;
bottom: 118px;
}
`
}
</style>
{/*<Loading visible={Forkvisible} shape="dot-circle" style={{width:'100%'}}color='#4AC7FF'>*/}
<Spin spinning={Forkvisible} size="large" style={{marginTop:'15%'}}>
<div className="mt30 square-list clearfix mh320">
@ -105,7 +118,7 @@ export default class TPMFork_listComponent extends Component {
return(
<div className="square-Item" key={key} id={item.id}>
<div className="tag-green">
<div className="tag-green taglistleft">
<span className="tag-name"> {item.tag_name}</span>
{/*<img src={require(`./shixunCss/tag2.png`)}/>*/}
</div>

@ -35,14 +35,14 @@ if (!window['indexHOCLoaded']) {
// $('head').append($('<link rel="stylesheet" type="text/css" />')
// .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?6`));
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?8`));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?6`));
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?8`));
// index.html有加载
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?6`));
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?8`));
// $('head').append($('<link rel="stylesheet" type="text/css" />')

@ -37,7 +37,7 @@ function VideoUpload (props) {
</div>
</div>
<div>
<div className="courseForm">
<span className="titleLabel">标题</span>
<Input placeholder={`标题支持最多${MAX_LENGTH}个字符`} onInput={titleChange} maxLength={MAX_LENGTH} suffix={
<span className="color-grey-6 font-13">{String(title.length)}/{MAX_LENGTH}</span>

@ -61,6 +61,10 @@ function VideoUploadList (props) {
// alert("请先选择需要上传的文件!")
return
}
if (file.type && file.type.indexOf('ogm') != -1) {
showNotification(`不支持的视频格式`)
return;
}
if (file.size > 200 * 1024 * 1024) {
// 超过200m TODO
clearInput()

@ -117,15 +117,16 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px}
.tag-green{
position: absolute;
left: 10px;
bottom: 95px;}
bottom: 90px;}
.tag-green .tag-name{display: block;width: auto;
/*background-image: url("/images/educoder/tag1.png");*/
background: #000000;
border: 1px solid #fff;
border-radius: 3px;
font-size: 14px;
opacity: 0.56;
background-size: 100% 100%;padding: 0px 8px;color: #fff;float: left;}
.tag-orange{position: absolute;right: 0px;top:20px;}
.tag-orange{position: absolute;right: 0px;top:12px;}
.tag-orange .tag-name{display: block;width: auto;background-color:#FF6800;
background-size: 100% 100%;padding: 0px 8px;color: #fff;float: left;
height: 28px;

Loading…
Cancel
Save