Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_cs_new
杨树林 6 years ago
commit 0919202427

@ -1,5 +1,5 @@
class ChallengesController < ApplicationController
before_action :require_login, :check_auth
before_action :require_login, :check_auth, except: [:index]
before_action :find_shixun, only: [:new, :create, :index]
skip_before_action :verify_authenticity_token, only: [:create, :update, :create_choose_question, :crud_answer]
before_action :find_challenge, only: [:edit, :show, :update, :create_choose_question, :index_down, :index_up,

@ -49,30 +49,12 @@ class CoursesController < ApplicationController
@user = current_user
# 根据分类查询课堂(全部,我的,最新,最热)
@order = params[:order].present? ? params[:order] : "all"
order_str = @order != "course_members_count" && @order != "created_at" ? "updated_at" : @order
# if @order == "all"
# @course = Course.where(is_delete: 0, is_hidden: 0).select("select c.name, c.id, s.name, u.login, ifnull(concat(u.lastname,u.firstname),
# u.login), s.name from courses c, users u, user_extensions ue, schools s where c.is_delete=0 and
# c.tea_id=u.id and u.id=ue.user_id and ue.school_id=s.id")
# @courses = Course.where(is_delete: 0, is_hidden: 0)
# .order("courses.id = 1309 desc, courses.created_at desc")
# @courses = Course.where(is_delete: 0, is_hidden: 0).select("courses.id, courses.tea_id, courses.name, courses.exercises_count, courses.polls_count,
# courses.is_public, courses.is_end, courses.visits, courses.course_members_count,courses.homework_commons_count,(SELECT MAX(created_at)
# FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a")
# .order("courses.id = 1309 desc, a desc")
if @order == "mine"
tip_exception(401, "..") unless current_user.logged?
@courses = Course.joins(:course_members)
.where("is_delete = 0 AND is_hidden = 0 AND course_members.user_id = ?", @user.id).distinct
elsif @order == "created_at"
# REDO:Extension
@courses = Course.where(is_delete: 0, is_hidden: 0, is_end: 0).distinct
if @order == "visits"
order_str = "courses.id = 1309 DESC, courses.visits DESC"
@courses = Course.where(is_delete: 0, is_hidden: 0)
else
# REDO:Extension
@courses = Course.where(is_delete: 0, is_hidden: 0).distinct
order_str = "courses.id = 1309 DESC, courses.homepage_show DESC, courses.created_at desc"
@courses = Course.where(is_delete: 0, is_hidden: 0, is_end: 0)
end
# 根据搜索关键字进一步筛选
@ -92,7 +74,7 @@ class CoursesController < ApplicationController
.where("#{sql}", keyword: "%#{params[:search]}%").distinct
end
@courses_count = @courses.count("courses.id")
@courses = @courses.order("courses.id = 1309 DESC, courses.#{order_str} DESC")
@courses = @courses.order(order_str)
# 分页
page = params[:page] || 1

@ -1,5 +1,6 @@
class DiscussesController < ApplicationController
LIMIT = 10
before_action :require_login, only: [:create, :reply, :hidden, :reward_code, :plus, :destroy]
before_action :find_container, only: [:index, :hidden]
before_action :find_discuss, except: [:create, :index, :new_message, :reward_code, :forum_discusses, :plus]

@ -2,7 +2,8 @@ class ShixunsController < ApplicationController
include ShixunsHelper
include ApplicationHelper
before_action :require_login, :check_auth, except: [:download_file, :index, :menus]
before_action :require_login, :check_auth, except: [:download_file, :index, :menus, :show, :show_right, :ranking_list,
:discusses, :collaborators, :fork_list, :propaedeutics]
before_action :check_account, only: [:new, :create, :shixun_exec]

@ -1,5 +1,5 @@
class StagesController < ApplicationController
before_action :require_login, :check_auth
before_action :require_login, :check_auth, except: [:index]
before_action :find_subject, only: [:create, :index]
before_action :find_stage, only: [:update, :destroy, :edit, :up_position, :down_position]
before_action :allowed, except: [:index]

@ -1,7 +1,7 @@
class SubjectsController < ApplicationController
before_action :require_login, :check_auth, except: [:index]
before_action :require_login, :check_auth, except: [:index, :show]
# before_action :check_auth, except: [:index]
before_action :check_account, only: [:new, :create]
before_action :check_account, except: [:index, :show]
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,

@ -16,7 +16,7 @@ class CoursesHome extends Component{
this.state = {
limit:16,
page:1,
order:"all",
order:"created_at",
coursesHomelist:undefined,
search:"",
}
@ -118,25 +118,25 @@ class CoursesHome extends Component{
</div>
<div className="mt20 educontent mb20 clearfix">
<a className={ order == "all" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}
onClick={ () => this.changeStatus("all")}>全部</a>
<a className={ order == "mine" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}
onClick={ () => this.changeStatus("mine")}>我的</a>
{/*<a className={ order == "all" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}*/}
{/*onClick={ () => this.changeStatus("all")}>全部</a>*/}
{/*<a className={ order == "mine" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}*/}
{/*onClick={ () => this.changeStatus("mine")}>我的</a>*/}
<a className={ order == "created_at" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}
onClick={ () => this.changeStatus("created_at")}>最新</a>
<a className={ order == "course_members_count" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}
onClick={ () => this.changeStatus("course_members_count")}>最热</a>
<div className="fr mr5 search-new">
{/* <Search
placeholder="课堂名称/教师姓名/学校名称"
id="subject_search_input"
value={search}
onInput={this.inputSearchValue}
onSearch={this.searchValue}
autoComplete="off"
></Search> */}
</div>
<a className={ order == "visits" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}
onClick={ () => this.changeStatus("visits")}>最热</a>
{/*<div className="fr mr5 search-new">*/}
{/*/!* <Search*/}
{/*placeholder="课堂名称/教师姓名/学校名称"*/}
{/*id="subject_search_input"*/}
{/*value={search}*/}
{/*onInput={this.inputSearchValue}*/}
{/*onSearch={this.searchValue}*/}
{/*autoComplete="off"*/}
{/*></Search> *!/*/}
{/*</div>*/}
</div>

@ -122,16 +122,20 @@ class PathModal extends Component{
contentViewScrolledit=(e)=>{
//滑动到底判断
const {shixunmodallist} = this.state;
if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){
if(shixunmodallist.subject_list.length===0){
return;
}else{
let {Searchvalue,type,page,shixunpathlist}=this.state;
let newpage=page+1
this.funshixunpathlist(Searchvalue,type,true,newpage)
this.setState({
page:newpage
})
}
}
}

@ -100,9 +100,13 @@ class ShixunModal extends Component{
}
contentViewScrolledit=(e)=>{
const {shixunmodallist}=this.state;
//滑动到底判断
if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight) {
if (shixunmodallist.shixun_list.length === 0) {
return;
} else {
let {Searchvalue, type, page} = this.state;
let newpage = page + 1
this.setupdatalist(Searchvalue, type, true, newpage)
@ -110,7 +114,7 @@ class ShixunModal extends Component{
page: newpage
})
}
}
}
//搜索

@ -477,9 +477,9 @@ a.white-btn.use_scope-btn:hover{
}
.pathInfobox li{
margin-right: 20px;
height: 15px;
height: 20px;
/*overflow: hidden;*/
line-height: 15px;
line-height: 20px;
}
.width70f{
width: 70px;

@ -783,7 +783,9 @@ class ShixunStudentWork extends Component {
<CheckboxGroup onChange={this.groupgroup}
value={this.state.group_infolist}
style={{paddingTop: '4px'}}>
style={{paddingTop: '4px',float: 'left',
maxWidth: '1020px'}}
>
{data&&data.group_info === undefined ? "" : data&&data.group_info.map((item, key) => {
return (
<span key={key}>

@ -75,10 +75,15 @@ class ShixunWorkReport extends Component {
let homeworkid=this.props.match.params.homeworkid;
let url = `/student_works/${homeworkid}/shixun_work_report.json`
axios.get(url).then((result) => {
if (result.data.status === 403||result.data.status === 401||result.data.status === 407||result.data.status === 408) {
}else{
this.setState({
data:result.data,
spinning:false
})
}
}).catch((error) => {
console.log(error)
this.setState({
@ -111,6 +116,8 @@ class ShixunWorkReport extends Component {
}
render() {
let{data} =this.state;
console.log(data)
console.log(this.props)
let category_id=data===undefined?"":data.category===null?"":data.category.category_id;
let homework_common_id=data===undefined?"":data.homework_common_id;
let homeworkid=this.props.match.params.homeworkid;

@ -195,7 +195,7 @@ class ShixunWorkModal extends Component{
// message:"提示",
// description: response.data.message
// });
this.props.history.replace(`/courses/${this.props.match.params.coursesId}/shixun_homeworks/${this.props.match.params.homeworkid}/student_work?tab=2`);
window.location.href=`/courses/${this.props.match.params.coursesId}/shixun_homeworks/${this.props.match.params.homeworkid}/student_work?tab=2`;
}else if(response.data.status === -1){
notification.open({
message:"提示",

@ -193,12 +193,20 @@ class DetailCards extends Component{
}
startgameid=(id)=>{
if(this.props.checkIfLogin()===false){
this.props.showLoginDialog()
return
}
if(this.props.current_user&&this.props.current_user.profile_completed===false){
this.setState({
AccountProfiletype:true
})
return
}
let url = "/shixuns/" + id + "/shixun_exec.json";
axios.get(url).then((response) => {

@ -326,6 +326,15 @@ class PathDetailIndex extends Component{
return(
<div className="newContainer">
<style>
{
`
.head-right{
line-height: 30px;
}
`
}
</style>
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
@ -417,7 +426,7 @@ class PathDetailIndex extends Component{
</div>
}
{
detailInfoList === undefined ? "" : detailInfoList.progress === null ? "" :
this.props.checkIfLogin()===false?"":detailInfoList === undefined ? "" : detailInfoList.progress === null ? "" :
<div className="edu-back-white myProgress padding40-20 mb10">
<p className="mb20">
<span className="font-16 mr10">我的进展</span>

@ -148,13 +148,9 @@ class addCollaborators extends Component{
let {addPartner,search,partnerList,optionss,checkAll,partnerListid} = this.state;
return(
<div className="edu-back-white bor-top-greyE addTeamMember">
{
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_add_member===true?
<div className="edu-back-white bor-top-greyE addTeamMember">
<a onClick = {this.addBox} className="color-blue">+ 添加合作者</a>
:""
}
<Modal
keyboard={false}
title="添加合作者"
@ -209,7 +205,8 @@ class addCollaborators extends Component{
</div>
</div>
</Modal>
</div>
</div>:""
)
}
}

@ -14,7 +14,7 @@ class ShixunPathSearch extends Component{
constructor(props) {
super(props)
this.state = {
order:"publish_time",
order:"updated_at",
select:0,
search:"",
page:1,
@ -126,20 +126,20 @@ class ShixunPathSearch extends Component{
</div>
</div>
<div className="mt20 educontent mb20 clearfix">
<a href="javascript:void(0)" className={ order == "publish_time" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("publish_time")}>全部</a>
<a href="javascript:void(0)" className={ order == "mine" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("mine")}>我的</a>
<a href="javascript:void(0)" className={ order == "updated_at" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("updated_at")}>最新</a>
<a href="javascript:void(0)" className={ order == "myshixun_count" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("myshixun_count")}>最热</a>
<div className="fr mr5 search-new">
{/* <Search
placeholder="请输入路径名称进行搜索"
id="subject_search_input"
value={search}
onInput={this.inputSearchValue}
onSearch={this.searchValue}
autoComplete="off"
></Search> */}
</div>
{/*<a href="javascript:void(0)" className={ order == "publish_time" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("publish_time")}>全部</a>*/}
{/*<a href="javascript:void(0)" className={ order == "mine" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("mine")}>我的</a>*/}
<a className={ order == "updated_at" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("updated_at")}>最新</a>
<a className={ order == "myshixun_count" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("myshixun_count")}>最热</a>
{/*<div className="fr mr5 search-new">*/}
{/*/!* <Search*/}
{/*placeholder="请输入路径名称进行搜索"*/}
{/*id="subject_search_input"*/}
{/*value={search}*/}
{/*onInput={this.inputSearchValue}*/}
{/*onSearch={this.searchValue}*/}
{/*autoComplete="off"*/}
{/*></Search> *!/*/}
{/*</div>*/}
</div>
<PathCard {...this.props} {...this.state}></PathCard>
{

@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
// /images/educoder/icon/search.svg
import { getImageUrl, toPath } from 'educoder'
import { getImageUrl, toPath ,trigger,broadcastChannelPostMessage} from 'educoder'
import axios from 'axios';
@ -30,8 +30,6 @@ import 'antd/lib/input/style/index.css';
import './TPMIndex.css';
import { trigger, broadcastChannelPostMessage } from 'educoder';
const $ = window.$
// TODO 这部分脚本从公共脚本中直接调用
@ -316,6 +314,7 @@ class NewHeader extends Component {
// this.setState({
// isRender:true
// })
broadcastChannelPostMessage('refreshPage')
window.location.href = "/";
}
}).catch((error) => {

@ -172,6 +172,16 @@ class TPMBanner extends Component {
* 发送至按钮
* */
Senttothe=()=>{
if(this.props.checkIfLogin()===false){
this.props.showLoginDialog()
return
}
if(this.props.current_user&&this.props.current_user.profile_completed===false){
this.setState({
AccountProfiletype:true
})
return
}
let id = this.props.match.params.shixunId;
let url="/shixuns/" + id +"/search_user_courses.json";
this.setState({
@ -384,6 +394,11 @@ class TPMBanner extends Component {
//开始实战按钮
startshixunCombat=(id, reset)=>{
if(this.props.checkIfLogin()===false){
this.props.showLoginDialog()
return
}
if(this.props.current_user&&this.props.current_user.profile_completed===false){
this.setState({
AccountProfiletype:true

@ -220,6 +220,13 @@ class Challenges extends Component {
//开始实战按钮
startshixunCombat = (type, ids, id) => {
if(this.props.checkIfLogin()===false){
this.props.showLoginDialog()
return
}
if(this.props.current_user&&this.props.current_user.profile_completed===false){
this.setState({
AccountProfiletype:true
@ -227,7 +234,7 @@ class Challenges extends Component {
return
}
debugger
let { ChallengesDataList } = this.state;
// let id = this.props.match.params.shixunId;
this.setState({

@ -166,16 +166,16 @@ class ShixunCardList extends Component {
<div className="educontent mt20">
<div className="clearfix">
<div className="fl mr20 font-16 bestChoose shixun_repertoire active"
id={"all"}
onClick={(e)=>this.latestHot(e,1)}>全部
</div>
<div className="fl mr20 font-16 bestChoose shixun_repertoire"
id={mine}
onClick={(e)=>this.onSwitchChange(e,2)}>我的
</div>
{/*<div className="fl mr20 font-16 bestChoose shixun_repertoire active"*/}
{/*id={"all"}*/}
{/*onClick={(e)=>this.latestHot(e,1)}>全部*/}
{/*</div>*/}
{/*<div className="fl mr20 font-16 bestChoose shixun_repertoire"*/}
{/*id={mine}*/}
{/*onClick={(e)=>this.onSwitchChange(e,2)}>我的*/}
{/*</div>*/}
<div className="fl mr20 font-16 bestChoose shixun_repertoire"
<div className="fl mr20 font-16 bestChoose shixun_repertoire active"
id="new"
onClick={(e)=>this.latestHot(e,4)}>最新
</div>
@ -186,26 +186,26 @@ class ShixunCardList extends Component {
</div>
<div className="fl font-16 bestChoose shixun_repertoire ml20 mt1"
style={{display:upcircle===true?"block":"none"}}
// onClick={()=>this.upcircles("asc")}
>
<Tooltip placement="bottom" title={"升序"}>
<Icon type="up-circle" theme="twoTone" />
{/*<Icon type="sort-descending" />*/}
</Tooltip>
</div>
<div className="fl font-16 bestChoose shixun_repertoire ml20 mt1"
// onClick={()=>this.upcircles("desc")}
style={{display:upcircle===true?"none":"block"}}
>
<Tooltip placement="bottom" title={"降序"}>
<Icon type="down-circle" theme="twoTone" />
{/*<Icon type="sort-ascending" />*/}
</Tooltip>
</div>
{/*<div className="fl font-16 bestChoose shixun_repertoire ml20 mt1"*/}
{/*style={{display:upcircle===true?"block":"none"}}*/}
{/*// onClick={()=>this.upcircles("asc")}*/}
{/*>*/}
{/*<Tooltip placement="bottom" title={"升序"}>*/}
{/*<Icon type="up-circle" theme="twoTone" />*/}
{/*/!*<Icon type="sort-descending" />*!/*/}
{/*</Tooltip>*/}
{/*</div>*/}
{/*<div className="fl font-16 bestChoose shixun_repertoire ml20 mt1"*/}
{/*// onClick={()=>this.upcircles("desc")}*/}
{/*style={{display:upcircle===true?"none":"block"}}*/}
{/*>*/}
{/*<Tooltip placement="bottom" title={"降序"}>*/}
{/*<Icon type="down-circle" theme="twoTone" />*/}
{/*/!*<Icon type="sort-ascending" />*!/*/}
{/*</Tooltip>*/}
{/*</div>*/}
<div className="fr mt3">
{/*<div className="fr mt3">*/}
{/*<Search*/}
{/*style={{ width: 300 }}*/}
{/*className="search-new-input fl"*/}
@ -225,11 +225,11 @@ class ShixunCardList extends Component {
onSearch={value => this.Input_search(value)}
autoComplete="off"
></Search> */}
</div>
<div className="fr">
<span className="fl color-grey-6 mr30 font-16 mt5" id="search_name">{
this.props.search_tags === null ? "" : this.props.search_tags
}</span>
{/*</div>*/}
{/*<div className="fr">*/}
{/*<span className="fl color-grey-6 mr30 font-16 mt5" id="search_name">{*/}
{/*this.props.search_tags === null ? "" : this.props.search_tags*/}
{/*}</span>*/}
{/*<div className="fl mr5" style={{marginTop:'1px'}}>*/}
{/*/!* <div className="controlblue"></div>*/}
{/*<span className="controlring"></span> *!/*/}
@ -242,8 +242,8 @@ class ShixunCardList extends Component {
{/*</div>*/}
{/*<span className="fl font-16 cdefault" data-tip-down="隐藏我学习的实训">隐藏我的</span>*/}
</div>
<span className="fr color-grey-6 mr30 font-16" id="search_name"></span>
{/*</div>*/}
{/*<span className="fr color-grey-6 mr30 font-16" id="search_name"></span>*/}
</div>
</div>
);

@ -28,7 +28,7 @@ class ShixunsIndex extends Component {
constructor(props) {
super(props)
this.state={
order_by: "publish_time",
order_by: "new",
page:1,
limit:16,
keyword:"",

Loading…
Cancel
Save