Merge remote-tracking branch 'origin/dev_Ysl' into dev_Ysl

dev_cs_new
杨树明 6 years ago
commit 416441edcf

@ -9,8 +9,7 @@ class BiddingUsersController < ApplicationController
end end
def win def win
package = current_user.project_packages.find(params[:project_package_id]) ProjectPackages::WinBiddingService.call(current_package, current_user, params)
ProjectPackages::WinBiddingService.call(package, params)
render_ok render_ok
rescue ProjectPackages::WinBiddingService::Error => ex rescue ProjectPackages::WinBiddingService::Error => ex
render_error(ex.message) render_error(ex.message)

@ -17,8 +17,8 @@ class FilesController < ApplicationController
sort_type = params[:sort_type] || 'created_on' # created_on时间排序 downloads下载次数排序; quotes: 引用次数排序 sort_type = params[:sort_type] || 'created_on' # created_on时间排序 downloads下载次数排序; quotes: 引用次数排序
course_second_category_id = params[:course_second_category_id] || 0 # 0: 为主目录, 其他为次目录id course_second_category_id = params[:course_second_category_id] || 0 # 0: 为主目录, 其他为次目录id
@user = current_user @user = current_user
@attachments = @course.attachments.by_course_second_category_id(course_second_category_id) @attachments = course_second_category_id.to_i == 0 ? @course.attachments : @course.attachments.by_course_second_category_id(course_second_category_id)
.includes(attachment_group_settings: :course_group, author: [:user_extension, :course_members]) @attachments = @attachments.includes(attachment_group_settings: :course_group, author: [:user_extension, :course_members])
.ordered(sort: sort.to_i, sort_type: sort_type.strip) .ordered(sort: sort.to_i, sort_type: sort_type.strip)
get_category(@course, course_second_category_id) get_category(@course, course_second_category_id)

@ -194,7 +194,7 @@ module CoursesHelper
# 获取课堂的资源数 # 获取课堂的资源数
def get_attachment_count(course, category_id) def get_attachment_count(course, category_id)
course.attachments.where(course_second_category_id: category_id).size category_id.to_i == 0 ? course.attachments.size : course.attachments.where(course_second_category_id: category_id).size
end end
# 获取课堂的作业数 # 获取课堂的作业数

@ -1,14 +1,16 @@
class ProjectPackages::WinBiddingService < ApplicationService class ProjectPackages::WinBiddingService < ApplicationService
Error = Class.new(StandardError) Error = Class.new(StandardError)
attr_reader :package, :params attr_reader :package, :user, :params
def initialize(package, params) def initialize(package, user, params)
@package = package @package = package
@user = user
@params = params @params = params
end end
def call def call
raise Error, '没有权限' unless package.creator_id == user.id || user.admin_or_business?
raise Error, '竞标报名还未结束' unless package.bidding_end? raise Error, '竞标报名还未结束' unless package.bidding_end?
raise Error, '该状态下不能选择中标者' unless package.may_finish_bidding? raise Error, '该状态下不能选择中标者' unless package.may_finish_bidding?

@ -10,6 +10,7 @@ json.created_at library.display_created_at
# 创建者 # 创建者
json.creator do json.creator do
json.partial! 'users/user_simple', user: library.user json.partial! 'users/user_simple', user: library.user
json.school_name library.user.school_name
end end
# 封面 # 封面

@ -16,5 +16,11 @@ json.project_packages do
json.deadline_at package.display_deadline_at json.deadline_at package.display_deadline_at
json.published_at package.display_published_at json.published_at package.display_published_at
json.operation do
can_manage = current_user&.id == observed_user.id || current_user&.admin_or_business?
json.can_edit can_manage && package.editable?
json.can_delete can_manage && package.deletable?
end
end end
end end

File diff suppressed because one or more lines are too long

@ -72,6 +72,7 @@
"react-infinite-scroller": "^1.2.4", "react-infinite-scroller": "^1.2.4",
"react-loadable": "^5.3.1", "react-loadable": "^5.3.1",
"react-monaco-editor": "^0.25.1", "react-monaco-editor": "^0.25.1",
"react-player": "^1.11.1",
"react-redux": "5.0.7", "react-redux": "5.0.7",
"react-router": "^4.2.0", "react-router": "^4.2.0",
"react-router-dom": "^4.2.2", "react-router-dom": "^4.2.2",

@ -1,5 +1,6 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import { getUrl2 } from "educoder"; import { getUrl2 } from "educoder";
import ReactPlayer from 'react-player'
const $ = window.$ const $ = window.$
let _url_origin = getUrl2() let _url_origin = getUrl2()
@ -15,9 +16,12 @@ class Clappr extends Component{
} }
componentDidMount() { componentDidMount() {
return;
const source = this.props.source || "http://your.video/here.mp4" const source = this.props.source || "http://your.video/here.mp4"
const { id, type } = this.props const { id, type } = this.props
const _id = `#_player${id}` const _id = `#_player${id}`
if (!window['Clappr'] && window['ClapprLoading'] == true) { if (!window['Clappr'] && window['ClapprLoading'] == true) {
setTimeout(() => { setTimeout(() => {
this.componentDidMount() this.componentDidMount()
@ -26,6 +30,7 @@ class Clappr extends Component{
} }
// && window['clappr-playback-rate-plugin'] // && window['clappr-playback-rate-plugin']
if (window['Clappr'] ) { if (window['Clappr'] ) {
// https://github.com/clappr/clappr/issues/1839
// http://clappr.github.io/classes/Player.html#method_mute // http://clappr.github.io/classes/Player.html#method_mute
this['player'+id] = new window.Clappr.Player({ this['player'+id] = new window.Clappr.Player({
source: source, parentId: _id, source: source, parentId: _id,
@ -83,12 +88,14 @@ class Clappr extends Component{
const _id = `_player${id}` const _id = `_player${id}`
return( return(
<React.Fragment> <React.Fragment>
<style>{` {/* https://github.com/CookPete/react-player/issues/686 */}
<ReactPlayer url={source} playing={false} controls={true} width={400} height={ type == 'mp3' ? 55 : 290}/>
{/* <style>{`
.playback_rate { .playback_rate {
margin-right: 16px; margin-right: 16px;
} }
`}</style> `}</style>
<div id={_id} className={className + ' ' + type}></div> <div id={_id} className={className + ' ' + type}></div> */}
</React.Fragment> </React.Fragment>
) )
} }

@ -18,7 +18,7 @@ class EffectDisplayContent extends Component {
.effectDisplay .content>div { .effectDisplay .content>div {
flex: 1 flex: 1
} }
.effectDisplay .clappr { .effectDisplay .clappr, .effectDisplay .contentWrap {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
@ -32,13 +32,13 @@ class EffectDisplayContent extends Component {
{content3 && <p className="content_title edu-txt-center fl font-18 mr03precent">预期输出{typeName}</p>} {content3 && <p className="content_title edu-txt-center fl font-18 mr03precent">预期输出{typeName}</p>}
</div> </div>
<div className="clearfix df content" > <div className="clearfix df content" >
{content1 && <div className="fl mr03precent pt10 mb50"> {content1 && <div className="fl mr03precent pt10 mb50 contentWrap">
{content1} {content1}
</div>} </div>}
{content2 && <div className="fl mr03precent pt10 mb50"> {content2 && <div className="fl mr03precent pt10 mb50 contentWrap">
{content2} {content2}
</div>} </div>}
{content3 && <div className="fl mr03precent pt10 mb50"> {content3 && <div className="fl mr03precent pt10 mb50 contentWrap">
{content3} {content3}
</div>} </div>}
</div> </div>

@ -246,7 +246,7 @@ class TraineetraininginformationModal extends Component {
{this.props.boolgalist === false? {this.props.boolgalist === false?
<div> <div>
{ {
this.props.game_list === undefined?"" : this.props.game_list.length<4? this.props.game_list === undefined?"" : this.props.game_list.length<5?
<div className="edu-table edu-back-white "> <div className="edu-table edu-back-white ">
<style> <style>
{ {
@ -296,7 +296,7 @@ class TraineetraininginformationModal extends Component {
<div> <div>
{ {
this.props.game_list === undefined?"" : this.props.game_list.length<4? this.props.game_list === undefined?"" : this.props.game_list.length<5?
<div className="edu-table edu-back-white "> <div className="edu-table edu-back-white ">
<style> <style>
{ {

@ -126,11 +126,11 @@ class MessagSub extends Component{
<p> <p>
<a className="mr20 private_message_a" onMouseDown={()=>this.myCome(item)}>{item.trigger_user.name}</a> <a className="mr20 private_message_a" onMouseDown={()=>this.myCome(item)}>{item.trigger_user.name}</a>
<span className="color-grey-c">{item.time}</span> <span className="color-grey-c">{item.time}</span>
{this.state.typeysl==="apply"?( {item.tiding_type==="Apply"?(
item.status===0? item.status===0?
<span className="edu-filter-btn ml20 edu-filter-btn-red">待处理</span>:"" <span className="edu-filter-btn ml20 edu-filter-btn-red">待处理</span>:""
):""} ):""}
{this.state.typeysl==="apply"?( {item.tiding_type==="Apply"?(
item.status===1? item.status===1?
<span className="edu-filter-btn ml20 edu-filter-btn-green">已处理</span>:"" <span className="edu-filter-btn ml20 edu-filter-btn-green">已处理</span>:""
):""} ):""}

@ -368,17 +368,20 @@ class MainContentContainer extends Component {
} }
componentDidMount() { componentDidMount() {
// if (this.binded == true) {
// return;
window.$(window.documents).bind("submitChoose",function(){ // } else {
// this.binded = true
alert("hello world!"); // window.$(window).unload( ()=>{
// alert(111)
}); // var fileUpdatePromise = this.doFileUpdateRequest(true)
// });
// }
}
componentWillUnmount() {
// window.$(window).off( "unload" )
} }
doFileUpdateRequestOnCodeMirrorBlur = () => { doFileUpdateRequestOnCodeMirrorBlur = () => {
var fileUpdatePromise = this.doFileUpdateRequest(true) var fileUpdatePromise = this.doFileUpdateRequest(true)

@ -934,7 +934,7 @@ submittojoinclass=(value)=>{
<div className="fl mr30 edu-menu-panel headIcon"> <div className="fl mr30 edu-menu-panel headIcon">
{ user===undefined?"":user.login===""?"": <a { user===undefined?"":user.login===""?"": <a
href={this.props.Headertop===undefined?"":this.props.Headertop.message_url} href={`/message/${user.user_id}/user_tidings`}
style={{position:'relative'}} style={{position:'relative'}}
> >
<i className="iconfont icon-xiaoxilingdang color-white"></i> <i className="iconfont icon-xiaoxilingdang color-white"></i>

Loading…
Cancel
Save