dev_home
cxt 6 years ago
commit 269c900cac

@ -1,6 +1,6 @@
class ShixunListsController < ApplicationController class ShixunListsController < ApplicationController
def index def index
@results = ShixunSearchService.call(search_params, request.subdomain) @results = ShixunSearchService.call(search_params, current_laboratory)
end end
private private

@ -974,8 +974,14 @@ class ShixunsController < ApplicationController
end end
@course_count = course_ids.length @courses = Course.where(:id => course_ids)
@courses = Course.where(:id => course_ids).page(page).per(limit) ## 云上实验室过滤
unless current_laboratory.main_site?
@courses = @courses.where(laboratory_id: current_laboratory.id )
end
@course_count = @courses.count
@courses = @courses.page(page).per(limit)
end end
# 将实训发送到课程 # 将实训发送到课程

@ -1,6 +1,6 @@
class SubjectListsController < ApplicationController class SubjectListsController < ApplicationController
def index def index
@results = SubjectSearchService.call(search_params, request.subdomain) @results = SubjectSearchService.call(search_params, current_laboratory)
end end
private private

@ -204,6 +204,10 @@ class SubjectsController < ApplicationController
WHERE m.course_id = c.id AND m.role in (1,2,3) WHERE m.course_id = c.id AND m.role in (1,2,3)
AND m.user_id=#{current_user.id} AND c.is_delete = 0 AND c.is_end = 0").map(&:id) AND m.user_id=#{current_user.id} AND c.is_delete = 0 AND c.is_end = 0").map(&:id)
@courses = Course.where(id: course_ids) @courses = Course.where(id: course_ids)
## 云上实验室过滤
unless current_laboratory.main_site?
@courses = @courses.where(laboratory_id: current_laboratory.id )
end
@none_shixun_ids = ShixunSchool.where("school_id != #{current_user.user_extension.try(:school_id).to_i}").pluck(:shixun_id) @none_shixun_ids = ShixunSchool.where("school_id != #{current_user.user_extension.try(:school_id).to_i}").pluck(:shixun_id)
end end

@ -9,10 +9,10 @@ class Laboratory < ApplicationRecord
has_many :portal_images, dependent: :destroy has_many :portal_images, dependent: :destroy
has_many :laboratory_shixuns, dependent: :destroy has_many :laboratory_shixuns, dependent: :destroy
has_many :shixuns, through: :laboratory_shixuns, source: :shixun # has_many :shixuns, through: :laboratory_shixuns, source: :shixun
has_many :laboratory_subjects, dependent: :destroy has_many :laboratory_subjects, dependent: :destroy
has_many :subjects, through: :laboratory_subjects, source: :subject # has_many :subjects, through: :laboratory_subjects, source: :subject
has_many :courses, dependent: :destroy has_many :courses, dependent: :destroy
has_many :competitions, dependent: :destroy has_many :competitions, dependent: :destroy

@ -1,11 +1,11 @@
class ShixunSearchService < ApplicationService class ShixunSearchService < ApplicationService
include ElasticsearchAble include ElasticsearchAble
attr_reader :params, :subdomain attr_reader :params, :laboratory
def initialize(params, subdomain) def initialize(params, laboratory)
@params = params @params = params
@subdomain = subdomain @laboratory = laboratory
end end
def call def call
@ -36,8 +36,13 @@ class ShixunSearchService < ApplicationService
@shixuns = @shixuns.where(trainee: params[:diff]) @shixuns = @shixuns.where(trainee: params[:diff])
end end
laboratory = Laboratory.find_by_subdomain(subdomain) ## 云上实验室过滤
@shixuns = @shixuns.where(id: laboratory.shixuns) if laboratory unless laboratory.main_site?
@shixuns = @shixuns.joins(:laboratory_shixuns).where(laboratory_shixuns: { laboratory_id: @laboratory.id })
end
# laboratory = Laboratory.find_by_subdomain(subdomain)
# @shixuns = @shixuns.where(id: laboratory.shixuns) if laboratory
Shixun.search(keyword, search_options) Shixun.search(keyword, search_options)
end end

@ -1,11 +1,11 @@
class SubjectSearchService < ApplicationService class SubjectSearchService < ApplicationService
include ElasticsearchAble include ElasticsearchAble
attr_reader :params, :subdomain attr_reader :params, :laboratory
def initialize(params, subdomain) def initialize(params, laboratory)
@params = params @params = params
@subdomain = subdomain @laboratory = laboratory
end end
def call def call
@ -18,8 +18,13 @@ class SubjectSearchService < ApplicationService
@subjects = Subject.visible.unhidden @subjects = Subject.visible.unhidden
end end
laboratory = Laboratory.find_by_subdomain(subdomain) # laboratory = Laboratory.find_by_subdomain(subdomain)
@subjects = @subjects.where(id: laboratory.subjects) if laboratory # @subjects = @subjects.where(id: laboratory.subjects) if laboratory
## 云上实验室过滤
unless laboratory.main_site?
@subjects = @subjects.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: laboratory.id })
end
Subject.search(keyword, search_options) Subject.search(keyword, search_options)
end end

@ -76,6 +76,7 @@ class CompetitionsIndex extends Component{
.courses-head{ .courses-head{
width: 100%; width: 100%;
height: 300px; height: 300px;
background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.competition_banner_url === null ?`images/educoder/competitions/courses.jpg`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.competition_banner_url)});
background-color: #081C4B; background-color: #081C4B;
background-size: cover; background-size: cover;
background-position: center; background-position: center;
@ -85,7 +86,7 @@ class CompetitionsIndex extends Component{
` `
} }
</style> </style>
<div className="courses-head pr Competitionshead " style={{"background":`url(${getImageUrl(`images/educoder/competitions/courses.jpg`)})`}}> <div className="courses-head pr Competitionshead ">
<div className="edu-txt-center pathNavLine"> <div className="edu-txt-center pathNavLine">
<div className="inline path-nav"></div> <div className="inline path-nav"></div>
</div> </div>

@ -111,6 +111,22 @@ class CoursesHome extends Component{
{...this.state} {...this.state}
/>} />}
<div className="newMain clearfix"> <div className="newMain clearfix">
<style>
{
`
.courses-head{
width: 100%;
height: 300px;
background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.course_banner_url === null ?`images/educoder/competitions/courses.jpg`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.course_banner_url)});
background-color: #081C4B;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
`
}
</style>
<div className="courses-head pr" > <div className="courses-head pr" >
<div className="edu-txt-center pathNavLine"> <div className="edu-txt-center pathNavLine">
<div className="inline path-nav"> <div className="inline path-nav">

@ -1,12 +1,12 @@
.courses-head{ /*.courses-head{*/
width: 100%; /*width: 100%;*/
height: 300px; /*height: 300px;*/
background-image: url(./courses.jpg); /*background-image: url(./courses.jpg);*/
background-color: #081C4B; /*background-color: #081C4B;*/
background-size: cover; /*background-size: cover;*/
background-position: center; /*background-position: center;*/
background-repeat: no-repeat; /*background-repeat: no-repeat;*/
} /*}*/
a{ a{
text-decoration: none; text-decoration: none;
color: #05101a; color: #05101a;

@ -3,7 +3,7 @@ import { Input , Spin , Pagination } from "antd";
import './css/moopCases.css' import './css/moopCases.css'
import '../courses/css/Courses.css' import '../courses/css/Courses.css'
import { ActionBtn , LinkAfterLogin } from 'educoder'; import { ActionBtn , LinkAfterLogin ,getImageUrl} from 'educoder';
import axios from 'axios' import axios from 'axios'
@ -98,7 +98,7 @@ class CaseList extends Component{
return( return(
<React.Fragment> <React.Fragment>
<img src={mainImg} width="100%" /> <img src={this.props.mygetHelmetapi&&this.props.mygetHelmetapi.moop_cases_banner_url===null?mainImg:getImageUrl(this.props.mygetHelmetapi&&this.props.mygetHelmetapi.moop_cases_banner_url)} width="100%" />
<div className="educontent"> <div className="educontent">
<div className="edu-back-white mb30 mt30"> <div className="edu-back-white mb30 mt30">
<p className="padding20-30 clearfix bor-bottom-greyE"> <p className="padding20-30 clearfix bor-bottom-greyE">

@ -49,7 +49,9 @@ class Index extends Component{
></Route> ></Route>
{/*<Route path="/paths/:pathId" exact component = {PathsDetail} {...this.props} {...this.state}></Route>*/} {/*<Route path="/paths/:pathId" exact component = {PathsDetail} {...this.props} {...this.state}></Route>*/}
<Route exact path="/paths" exact component={ShixunPaths} {...this.props} {...this.state}></Route> <Route path="/paths" exact
render={(props)=>(<ShixunPaths {...this.props} {...this.state} {...props}/>)}
></Route>
</Switch> </Switch>
</div> </div>
) )

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import axios from 'axios'; import axios from 'axios';
import {Input} from 'antd'; import {Input} from 'antd';
import {getImageUrl} from 'educoder'; import {getImageUrl} from 'educoder';
import PathCard from "./ShixunPathCard.js"; import PathCard from "./ShixunPathCard";
import UpgradeModals from '../modals/UpgradeModals'; import UpgradeModals from '../modals/UpgradeModals';
import Pagination from '@icedesign/base/lib/pagination'; import Pagination from '@icedesign/base/lib/pagination';
import '@icedesign/base/lib/pagination/style.js'; import '@icedesign/base/lib/pagination/style.js';
@ -116,11 +116,14 @@ class ShixunPathSearch extends Component{
render() { render() {
let { order,sortList,search,page,total_count,select }=this.state; let { order,sortList,search,page,total_count,select }=this.state;
// console.log()
return ( return (
<div> <div>
{this.state.updata===undefined?"":<UpgradeModals {this.state.updata===undefined?"":<UpgradeModals
{...this.state} {...this.state}
/>} />}
<<<<<<< HEAD
{/*<style>*/} {/*<style>*/}
{/*{*/} {/*{*/}
{/*`*/} {/*`*/}
@ -136,6 +139,24 @@ class ShixunPathSearch extends Component{
{/*`*/} {/*`*/}
{/*}*/} {/*}*/}
{/*</style>*/} {/*</style>*/}
=======
<style>
{
`
.pathImg{
width: 100%;
height: 300px;
background-image: url(${getImageUrl(this.props.mygetHelmetapi&&this.props.mygetHelmetapi.subject_banner_url===null?`images/path/path.png`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.subject_banner_url)});
background-color: #000a4f;
/* background-size: cover; */
background-position: center;
background-repeat: no-repeat;
}
`
}
</style>
>>>>>>> develop
<div className="pr"> <div className="pr">
<div className="pathImg"></div> <div className="pathImg"></div>
<div className="edu-back-white padding20 pathIndexNav"> <div className="edu-back-white padding20 pathIndexNav">

@ -22,15 +22,15 @@
background: #DDECF9; background: #DDECF9;
color: #4CACFF color: #4CACFF
} }
.pathImg{ /*.pathImg{*/
width: 100%; /*width: 100%;*/
height: 300px; /*height: 300px;*/
background-image: url(../../images/path/path.png); /*background-image: url(../../images/path/path.png);*/
background-color: #000a4f; /*background-color: #000a4f;*/
/* background-size: cover; */ /*!* background-size: cover; *!*/
background-position: center; /*background-position: center;*/
background-repeat: no-repeat; /*background-repeat: no-repeat;*/
} /*}*/
/* 首页-最新最热 */ /* 首页-最新最热 */
.mainPageArray span{ .mainPageArray span{

@ -16,7 +16,10 @@ class ShixunPath extends Component{
return( return(
<div> <div>
<div className="newMain clearfix"> <div className="newMain clearfix">
<PathSearch></PathSearch> <PathSearch
{...this.state}
{...this.props}
></PathSearch>
</div> </div>
</div> </div>

@ -19,8 +19,17 @@ class NewFooter extends Component {
return ( return (
<div className="newFooter edu-txt-center "> <div className="newFooter edu-txt-center ">
{/*newContainers*/} {/*newContainers*/}
{this.props.user&&this.props.user.main_site===false?<style>
{
`
.newFooter {
height: 50px;
}
`
}
</style>:""}
<div className="inner-footer_con"> <div className="inner-footer_con">
<div className="footercon"> {this.props.user&&this.props.user.main_site===true?<div className="footercon">
{/* <div className="inline mt40 mb5"> {/* <div className="inline mt40 mb5">
<a href="/" className="fl" style={{height:'70px'}}> <a href="/" className="fl" style={{height:'70px'}}>
<img alt="高校智能化教学与实训平台" src={getImageUrl(`images/educoder/headNavLogo.png?1526520218`)} width="70px"> <img alt="高校智能化教学与实训平台" src={getImageUrl(`images/educoder/headNavLogo.png?1526520218`)} width="70px">
@ -37,7 +46,7 @@ class NewFooter extends Component {
<li><Link to="/help/help_center" className="fl" target="_blank">帮助中心</Link></li> <li><Link to="/help/help_center" className="fl" target="_blank">帮助中心</Link></li>
<li><Link to="/help/feedback" className="fl" target="_blank">意见反馈</Link></li> <li><Link to="/help/feedback" className="fl" target="_blank">意见反馈</Link></li>
</ul> </ul>
</div> </div>:""}
<div> <div>
{this.props.mygetHelmetapi === null ? "" : {this.props.mygetHelmetapi === null ? "" :
this.props.mygetHelmetapi===undefined|| this.props.mygetHelmetapi.footer===null||this.props.mygetHelmetapi.footer===undefined? this.props.mygetHelmetapi===undefined|| this.props.mygetHelmetapi.footer===null||this.props.mygetHelmetapi.footer===undefined?

Loading…
Cancel
Save