From 8827c75d52516797d2be5de6b681151b113677a0 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 6 Nov 2019 10:18:59 +0800 Subject: [PATCH 01/20] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/page/readme.txt | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/page/readme.txt b/public/react/src/modules/page/readme.txt index 882c48ee5..f5e5646e9 100644 --- a/public/react/src/modules/page/readme.txt +++ b/public/react/src/modules/page/readme.txt @@ -1,5 +1,5 @@ state说明 - tasks详情接口 + 顶层state--tasks详情接口 allowed_unlock 为true时,才允许非管理员用户解锁隐藏测试集 discusses_count 总评论数 @@ -124,6 +124,28 @@ state说明 user 当前关卡所属用户的信息 user_praise 当前用户是否点赞 + /MainContentContainer 里的state + repositoryCode: '', + open: false, // 繁忙等级等提示用Dialog,考虑重构封装到根组件 + gameBuilding: false, // 评测中标志 + codeStatus: SAVED, // 0 已修改 1 保存中 2 已保存 3 保存失败 + + codeLoading: true, // code加载中 + readRepoTimeout: false, // 加载代码轮训超时 + resetCodeDialogOpen: false, // 重新加载初始代码弹框的bool控制 + resetPassedCodeDialogOpen: false, // 重新加载上次通过的代码的bool控制 + + isEditablePath: true // 当前文件是否可编辑 + + CodeRepositoryViewContainer 里的state + drawerOpen: false, // 代码目录Drawer的bool控制 repoFilesDrawer + loadingFirstRepoFiles: false, // 代码目录树加载中的bool控制 + fileTreeData: "", // 目录树节点数据[] + fileTreeSelectedKeys: [], // 目录树被选择的节点的key + codeRepositoryViewExpanded: false, -- + tabIndex: 0, // tab值 + settingDrawerOpen: false // 设置面板Drawer的bool控制 + -------------- -------------- -------------- -------------- -------------- -------------- -------------- -------------- -------------- TPIContextProvider From c5dfe2117116865a62403d477af0fb014e64f6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 6 Nov 2019 10:50:46 +0800 Subject: [PATCH 02/20] =?UTF-8?q?=E5=AE=9A=E5=88=B6=E7=AB=9E=E8=B5=9Bstart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 18 +++ .../src/modules/osshackathon/Osshackathon.css | 40 +++++++ .../src/modules/osshackathon/Osshackathon.js | 107 ++++++++++++++++++ 3 files changed, 165 insertions(+) create mode 100644 public/react/src/modules/osshackathon/Osshackathon.css create mode 100644 public/react/src/modules/osshackathon/Osshackathon.js diff --git a/public/react/src/App.js b/public/react/src/App.js index 84b5c0ae4..6b4ba7399 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -268,6 +268,12 @@ const NewCompetitions=Loadable({ loading: Loading, }) +//黑客松定制竞赛 +const Osshackathon=Loadable({ + loader: () => import('./modules/osshackathon/Osshackathon'), + loading: Loading, +}) + const Messagerouting= Loadable({ loader: () => import('./modules/message/js/Messagerouting'), loading: Loading, @@ -497,6 +503,18 @@ class App extends Component { } }> + {/*黑客松定制竞赛*/} + { + return( + + ) + } + } + /> + {/*认证*/} diff --git a/public/react/src/modules/osshackathon/Osshackathon.css b/public/react/src/modules/osshackathon/Osshackathon.css new file mode 100644 index 000000000..54287ccae --- /dev/null +++ b/public/react/src/modules/osshackathon/Osshackathon.css @@ -0,0 +1,40 @@ +.registrationback{ + height: 368px; + width: 1200px; + -ms-flex-direction: column; + flex-direction: column; +} +.textright{ + text-align: right; +} + +.Osshackathonfont{ + width: 80px; + height: 28px; + font-size: 20px; + font-weight:600; + color: rgba(5,16,26,1); + line-height: 28px; +} + +.Osshackathonfontlist{ + width:1188px; + font-size:14px; + font-weight:400; + color:rgba(102,102,102,1); + line-height:24px; +} +.OsshackathonCard{ + width:1200px; + height:150px; + background:rgba(248,248,248,1); + border:1px solid rgba(235,235,235,1); +} + +.OsshackathonCardtitle{ + height:24px; + font-size:24px; + font-weight:400; + color:rgba(5,16,26,1); + line-height:24px; +} \ No newline at end of file diff --git a/public/react/src/modules/osshackathon/Osshackathon.js b/public/react/src/modules/osshackathon/Osshackathon.js new file mode 100644 index 000000000..f15599aff --- /dev/null +++ b/public/react/src/modules/osshackathon/Osshackathon.js @@ -0,0 +1,107 @@ +import React, {Component} from 'react'; +import axios from 'axios'; +import {SnackbarHOC, WordsBtn,getImageUrl} from 'educoder'; +import {Row, Col,Input,Divider,Card,Button} from 'antd'; +import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; +import { CNotificationHOC } from '../courses/common/CNotificationHOC'; +import './Osshackathon.css'; +const { Search } = Input; +class Osshackathon extends Component { + + constructor(props) { + super(props) + this.state = { + + } + } + + componentDidMount() { + + } + + componentDidUpdate = (prevProps) => { + + + } + + render() { + // let {} = this.state; + + return ( +
+ +
+ +
+ + + + console.log(value)} + /> + + +
+ 报名整数:280个 +
+ +
+ + + + 大赛介绍 + + + + + + + + + +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nonne merninisti licere mihi ista + probare, quae sunt a te dicta? Refert tamen, quo modo. +

+ + + + + + 大赛介绍 + + + + + + + +

Card content

+

Card content

+
+
+ +
+ ) + } + +} + + + +export default CNotificationHOC() (TPMIndexHOC (Osshackathon)) ; \ No newline at end of file From acbe11385916072f992635828b430e44266ddfcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 6 Nov 2019 10:53:11 +0800 Subject: [PATCH 03/20] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/Resource/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index d5b3b5ad2..c63348c83 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -1002,15 +1002,14 @@ class Fileslists extends Component{ } > - {this.props.isAdmin()||this.props.isStudent() ? 0?:""} + />:"":""} { From 27bb96d426165e5ca066a2d2f41123e7c0d261b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 6 Nov 2019 10:57:29 +0800 Subject: [PATCH 04/20] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=95=99=E5=AD=A6?= =?UTF-8?q?=E5=9B=A2=E9=98=9F=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/paths/PathDetail/Modifytext.js | 23 ++++++++++++++--- .../paths/PathDetail/PathDetailIndex.js | 25 ++++++++++++++++--- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/paths/PathDetail/Modifytext.js b/public/react/src/modules/paths/PathDetail/Modifytext.js index ca12659a9..c7d95cd1a 100644 --- a/public/react/src/modules/paths/PathDetail/Modifytext.js +++ b/public/react/src/modules/paths/PathDetail/Modifytext.js @@ -54,6 +54,12 @@ class Modifytext extends Component { } + //取消 + hideUpdating = () => { + this.props.modifysy(3); + + } + render() { const {getFieldDecorator} = this.props.form; @@ -96,7 +102,7 @@ class Modifytext extends Component { } .settingFormsy input { - width: 275px; + width: 200px; height: 32px; } .settingFormsy input.validateInput { @@ -147,9 +153,18 @@ class Modifytext extends Component {

-
- {/*
this.yhBanksfalse()}>

取消

*/} - +
+ +
diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index b393d1bb6..02ef25aa1 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -3,7 +3,7 @@ import {getImageUrl,markdownToHTML, configShareForCustom} from 'educoder'; import DetailTop from './DetailTop.js'; import DetailCards from './DetailCards.js' import AddCollaborators from "./addCollaborators.js"; -import {Icon,Tooltip} from 'antd'; +import {Icon, Tooltip, Popover} from 'antd'; import { BrowserRouter as Router, Route, Link } from "react-router-dom"; import { DragDropContext , Draggable, Droppable} from 'react-beautiful-dnd'; import '../../paths/ShixunPaths.css'; @@ -498,6 +498,10 @@ class PathDetailIndex extends Component{ }).catch((error) => { console.log(error); }) + } else if (i === 3) { + this.setState({ + modify: false + }) } } @@ -506,6 +510,12 @@ class PathDetailIndex extends Component{ team_title: name }) } + + maincontent = () => { + return (
+
this.modifysy(1)}>重命名
+
) + } render(){ this.updatamakedown("shixuns_propaedeutics"); @@ -664,17 +674,24 @@ class PathDetailIndex extends Component{ members ===undefined ?"":members === null ?"":
{ - detailInfoList === undefined ? "" : detailInfoList.allow_add_member === true ? + detailInfoList === undefined ? +

{team_title}

: detailInfoList.allow_add_member === true ? ( modify === false ? -

this.modifysy(1)}>{team_title}

+ +
+

this.modifysy(1)}>{team_title}

+ + + +
: this.modifysy(i)} setteam_title={(name) => this.setteam_title(name)}> ) - : "" + :

{team_title}

} { members===undefined? From 608939149c296e4ca7b7a72e0ff9d16871b21a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 6 Nov 2019 10:59:01 +0800 Subject: [PATCH 05/20] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/SelectResource.js | 4 +- .../courses/coursesPublic/SelectSetting.js | 41 ++++++++++--------- .../courses/coursesPublic/sendResource.js | 2 + 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/SelectResource.js b/public/react/src/modules/courses/coursesPublic/SelectResource.js index a49319eca..8cc73b13b 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectResource.js +++ b/public/react/src/modules/courses/coursesPublic/SelectResource.js @@ -1,5 +1,5 @@ import React,{ Component } from "react"; -import { Modal,Checkbox,Select,Input,Spin,Icon,Radio,DatePicker} from "antd"; +import { Modal,Checkbox,Select,Input,Spin,Icon,Radio,DatePicker,Tooltip} from "antd"; import locale from 'antd/lib/date-picker/locale/zh_CN'; import axios from'axios'; import {handleDateString} from 'educoder'; @@ -421,6 +421,7 @@ class Selectresource extends Component{ 立即发布 + 延迟发布 + (按照设置的时间定时发布)
diff --git a/public/react/src/modules/courses/coursesPublic/SelectSetting.js b/public/react/src/modules/courses/coursesPublic/SelectSetting.js index c557fe8df..1b1e5837c 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectSetting.js +++ b/public/react/src/modules/courses/coursesPublic/SelectSetting.js @@ -529,25 +529,28 @@ class Selectsetting extends Component{ 立即发布 - - 延迟发布 - - + + + 延迟发布 + + + + (按照设置的时间定时发布) diff --git a/public/react/src/modules/courses/coursesPublic/sendResource.js b/public/react/src/modules/courses/coursesPublic/sendResource.js index 2904d42e1..bf178761c 100644 --- a/public/react/src/modules/courses/coursesPublic/sendResource.js +++ b/public/react/src/modules/courses/coursesPublic/sendResource.js @@ -398,6 +398,7 @@ class Sendresource extends Component{ 立即发布 + 延迟发布 + (按照设置的时间定时发布) From 47733e01e883bfb84f420abefdcb1c88293e12cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 6 Nov 2019 11:00:05 +0800 Subject: [PATCH 06/20] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/coursesPublic/SelectResource.js | 4 ++-- .../react/src/modules/courses/coursesPublic/SelectSetting.js | 4 ++-- .../react/src/modules/courses/coursesPublic/sendResource.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/SelectResource.js b/public/react/src/modules/courses/coursesPublic/SelectResource.js index 8cc73b13b..edc1fc81b 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectResource.js +++ b/public/react/src/modules/courses/coursesPublic/SelectResource.js @@ -421,9 +421,9 @@ class Selectresource extends Component{ 立即发布 - + - 延迟发布 + 延期发布 立即发布 - + - 延迟发布 + 延期发布 立即发布 - + - 延迟发布 + 延期发布 Date: Wed, 6 Nov 2019 11:23:41 +0800 Subject: [PATCH 07/20] =?UTF-8?q?=E9=BB=91=E5=AE=A2=E6=9D=BE=E5=AE=9A?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/javascripts/trustie_hacks.js | 2 + app/assets/stylesheets/trustie_hacks.scss | 3 ++ app/controllers/trustie_hacks_controller.rb | 48 +++++++++++++++++++ app/helpers/trustie_hacks_helper.rb | 2 + app/models/hack_user.rb | 3 ++ app/models/trustie_hack.rb | 4 ++ app/models/trustie_hackathon.rb | 5 ++ app/views/trustie_hacks/edit.json.jbuilder | 1 + .../edit_hackathon.json.jbuilder | 2 + app/views/trustie_hacks/index.json.jbuilder | 9 ++++ config/routes.rb | 8 ++++ ...0191105093740_create_trustie_hackathons.rb | 10 ++++ .../20191105093919_create_trustie_hacks.rb | 11 +++++ .../20191105094146_create_hack_users.rb | 9 ++++ .../trustie_hacks_controller_spec.rb | 5 ++ spec/helpers/trustie_hacks_helper_spec.rb | 15 ++++++ spec/models/hack_user_spec.rb | 5 ++ spec/models/trustie_hack_spec.rb | 5 ++ spec/models/trustie_hackathon_spec.rb | 5 ++ 19 files changed, 152 insertions(+) create mode 100644 app/assets/javascripts/trustie_hacks.js create mode 100644 app/assets/stylesheets/trustie_hacks.scss create mode 100644 app/controllers/trustie_hacks_controller.rb create mode 100644 app/helpers/trustie_hacks_helper.rb create mode 100644 app/models/hack_user.rb create mode 100644 app/models/trustie_hack.rb create mode 100644 app/models/trustie_hackathon.rb create mode 100644 app/views/trustie_hacks/edit.json.jbuilder create mode 100644 app/views/trustie_hacks/edit_hackathon.json.jbuilder create mode 100644 app/views/trustie_hacks/index.json.jbuilder create mode 100644 db/migrate/20191105093740_create_trustie_hackathons.rb create mode 100644 db/migrate/20191105093919_create_trustie_hacks.rb create mode 100644 db/migrate/20191105094146_create_hack_users.rb create mode 100644 spec/controllers/trustie_hacks_controller_spec.rb create mode 100644 spec/helpers/trustie_hacks_helper_spec.rb create mode 100644 spec/models/hack_user_spec.rb create mode 100644 spec/models/trustie_hack_spec.rb create mode 100644 spec/models/trustie_hackathon_spec.rb diff --git a/app/assets/javascripts/trustie_hacks.js b/app/assets/javascripts/trustie_hacks.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/app/assets/javascripts/trustie_hacks.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/trustie_hacks.scss b/app/assets/stylesheets/trustie_hacks.scss new file mode 100644 index 000000000..78786cfb3 --- /dev/null +++ b/app/assets/stylesheets/trustie_hacks.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the trustie_hacks controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/trustie_hacks_controller.rb b/app/controllers/trustie_hacks_controller.rb new file mode 100644 index 000000000..ebc7f1578 --- /dev/null +++ b/app/controllers/trustie_hacks_controller.rb @@ -0,0 +1,48 @@ +class TrustieHacksController < ApplicationController + before_action :require_admin, :except => [:index] + before_action :require_login, :except => [:index] + before_action :find_hackathon + before_action :find_hack, :except => [:create, :index] + + def index + ## 分页参数 + page = params[:page] || 1 + limit = params[:limit] || 16 + + hacks = @hackathon.trustie_hacks + @hackathon_users_count = hacks.sum(:hack_users_count) + + @hacks = hacks.page(page).per(limit) + + end + + def edit ;end + + def create + @hackathon.trustie_hacks.create!(name: params[:name], description: params[:description]) + render_ok + end + + def update + @hack.update_attributes(name: params[:name], description: params[:description]) + end + + def edit_hackathon ;end + + def update_hackathon + @hackathon.update_attributes(name: params[:name], description: params[:description]) + end + + + private + + def find_hackathon + @hackathon = TrustieHackathon.first || + TrustieHackathon.create(name: params[:name], description: params[:description]) + end + + def find_hack + @hack = TrustieHack.find params[:id] + end + +end diff --git a/app/helpers/trustie_hacks_helper.rb b/app/helpers/trustie_hacks_helper.rb new file mode 100644 index 000000000..3ebe3a9cc --- /dev/null +++ b/app/helpers/trustie_hacks_helper.rb @@ -0,0 +1,2 @@ +module TrustieHacksHelper +end diff --git a/app/models/hack_user.rb b/app/models/hack_user.rb new file mode 100644 index 000000000..7b8030841 --- /dev/null +++ b/app/models/hack_user.rb @@ -0,0 +1,3 @@ +class HackUser < ApplicationRecord + belongs_to :trustie_hack, counter_cache: true +end diff --git a/app/models/trustie_hack.rb b/app/models/trustie_hack.rb new file mode 100644 index 000000000..898bf2195 --- /dev/null +++ b/app/models/trustie_hack.rb @@ -0,0 +1,4 @@ +class TrustieHack < ApplicationRecord + has_many :hack_users, :dependent => :destroy + belongs_to :trustie_hackathon, counter_cache: true +end diff --git a/app/models/trustie_hackathon.rb b/app/models/trustie_hackathon.rb new file mode 100644 index 000000000..7269e7856 --- /dev/null +++ b/app/models/trustie_hackathon.rb @@ -0,0 +1,5 @@ +class TrustieHackathon < ApplicationRecord + + has_many :trustie_hacks, :dependent => :destroy + +end diff --git a/app/views/trustie_hacks/edit.json.jbuilder b/app/views/trustie_hacks/edit.json.jbuilder new file mode 100644 index 000000000..9ee35736f --- /dev/null +++ b/app/views/trustie_hacks/edit.json.jbuilder @@ -0,0 +1 @@ +json.(@hack, :id, :name, :description) \ No newline at end of file diff --git a/app/views/trustie_hacks/edit_hackathon.json.jbuilder b/app/views/trustie_hacks/edit_hackathon.json.jbuilder new file mode 100644 index 000000000..52eda0fb8 --- /dev/null +++ b/app/views/trustie_hacks/edit_hackathon.json.jbuilder @@ -0,0 +1,2 @@ +json.name @hackathon&.name +json.description @hackathon&.description \ No newline at end of file diff --git a/app/views/trustie_hacks/index.json.jbuilder b/app/views/trustie_hacks/index.json.jbuilder new file mode 100644 index 000000000..05e3fd7c7 --- /dev/null +++ b/app/views/trustie_hacks/index.json.jbuilder @@ -0,0 +1,9 @@ +json.hackathon do + json.(@hackathon, :id, :name, :description) + json.hackathon_users_count @hackathon_users_count +end + +json.hacks @hacks do |hack| + json.(hack, :id, :name, :description, :hack_users_count) +end + diff --git a/config/routes.rb b/config/routes.rb index 3cf18fe75..96b8f006c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1105,6 +1105,14 @@ Rails.application.routes.draw do end end + resources :trustie_hacks, path: :osshackathon do + collection do + get :edit_hackathon + post :update_hackathon + end + + end + #git 认证回调 match 'gitauth/*url', to: 'gits#auth', via: :all diff --git a/db/migrate/20191105093740_create_trustie_hackathons.rb b/db/migrate/20191105093740_create_trustie_hackathons.rb new file mode 100644 index 000000000..4e806d346 --- /dev/null +++ b/db/migrate/20191105093740_create_trustie_hackathons.rb @@ -0,0 +1,10 @@ +class CreateTrustieHackathons < ActiveRecord::Migration[5.2] + def change + create_table :trustie_hackathons do |t| + t.string :name + t.string :description + t.integer :trustie_hacks_count, default: 0 + t.timestamps + end + end +end diff --git a/db/migrate/20191105093919_create_trustie_hacks.rb b/db/migrate/20191105093919_create_trustie_hacks.rb new file mode 100644 index 000000000..d4f65516e --- /dev/null +++ b/db/migrate/20191105093919_create_trustie_hacks.rb @@ -0,0 +1,11 @@ +class CreateTrustieHacks < ActiveRecord::Migration[5.2] + def change + create_table :trustie_hacks do |t| + t.string :name + t.string :description + t.references :user + t.integer :hack_users_count, default: 0 + t.timestamps + end + end +end diff --git a/db/migrate/20191105094146_create_hack_users.rb b/db/migrate/20191105094146_create_hack_users.rb new file mode 100644 index 000000000..2ef654b5b --- /dev/null +++ b/db/migrate/20191105094146_create_hack_users.rb @@ -0,0 +1,9 @@ +class CreateHackUsers < ActiveRecord::Migration[5.2] + def change + create_table :hack_users do |t| + t.references :user + t.references :trustie_hack + t.timestamps + end + end +end diff --git a/spec/controllers/trustie_hacks_controller_spec.rb b/spec/controllers/trustie_hacks_controller_spec.rb new file mode 100644 index 000000000..bad650328 --- /dev/null +++ b/spec/controllers/trustie_hacks_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe TrustieHacksController, type: :controller do + +end diff --git a/spec/helpers/trustie_hacks_helper_spec.rb b/spec/helpers/trustie_hacks_helper_spec.rb new file mode 100644 index 000000000..6d48a0072 --- /dev/null +++ b/spec/helpers/trustie_hacks_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the TrustieHacksHelper. For example: +# +# describe TrustieHacksHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe TrustieHacksHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/hack_user_spec.rb b/spec/models/hack_user_spec.rb new file mode 100644 index 000000000..5bd8221dc --- /dev/null +++ b/spec/models/hack_user_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe HackUser, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/trustie_hack_spec.rb b/spec/models/trustie_hack_spec.rb new file mode 100644 index 000000000..d4423cd2c --- /dev/null +++ b/spec/models/trustie_hack_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe TrustieHack, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/trustie_hackathon_spec.rb b/spec/models/trustie_hackathon_spec.rb new file mode 100644 index 000000000..7334fd52c --- /dev/null +++ b/spec/models/trustie_hackathon_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe TrustieHackathon, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 8db6bc68e12a067830c04b1722d3362f2292c836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 6 Nov 2019 11:28:30 +0800 Subject: [PATCH 08/20] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/osshackathon/Osshackathon.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/public/react/src/modules/osshackathon/Osshackathon.js b/public/react/src/modules/osshackathon/Osshackathon.js index f15599aff..f2bf71e32 100644 --- a/public/react/src/modules/osshackathon/Osshackathon.js +++ b/public/react/src/modules/osshackathon/Osshackathon.js @@ -77,6 +77,7 @@ class Osshackathon extends Component { probare, quae sunt a te dicta? Refert tamen, quo modo.

+ {/*学生身份*/} @@ -94,6 +95,26 @@ class Osshackathon extends Component {

Card content

Card content

+ + {/*教师身份*/} + + + + + 大赛介绍 + + + + + + +

Card content

+

Card content

+
+ + From 2819db81d9ec87a03ebfe16fa2c8616d6f1b7be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 6 Nov 2019 11:39:34 +0800 Subject: [PATCH 09/20] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E6=96=87=E6=A1=88?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/exercise/new/SingleEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/exercise/new/SingleEditor.js b/public/react/src/modules/courses/exercise/new/SingleEditor.js index 08ab4fd90..0b1b7599a 100644 --- a/public/react/src/modules/courses/exercise/new/SingleEditor.js +++ b/public/react/src/modules/courses/exercise/new/SingleEditor.js @@ -304,7 +304,7 @@ class SingleEditor extends Component{ 标准答案: : - 请点击正确选项 + "" } From 67ea90b1db81a9b289b4996bf9499c9dcbae1afd Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 6 Nov 2019 11:42:50 +0800 Subject: [PATCH 10/20] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=89=BE=E4=B8=8D?= =?UTF-8?q?=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 9f33405a9..c0231a701 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -513,7 +513,6 @@ Rails.application.routes.draw do post :join_exercise_banks # 加入习题集 post :publish # 立即发布 post :end_exercise # 立即截止 -`` end end @@ -875,6 +874,14 @@ Rails.application.routes.draw do resources :searchs, only: [:index] end + + resources :trustie_hacks, path: :osshackathon do + collection do + get :edit_hackathon + post :update_hackathon + end + + end end namespace :admins do @@ -1113,14 +1120,6 @@ Rails.application.routes.draw do end end - resources :trustie_hacks, path: :osshackathon do - collection do - get :edit_hackathon - post :update_hackathon - end - - end - #git 认证回调 match 'gitauth/*url', to: 'gits#auth', via: :all From 92981a3aaa80037a86421b539d0b0ceed50bb1c0 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 6 Nov 2019 11:45:15 +0800 Subject: [PATCH 11/20] competition certificate --- app/controllers/competitions/prizes_controller.rb | 11 +++++++++-- app/views/competitions/prizes/show.json.jbuilder | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/competitions/prizes_controller.rb b/app/controllers/competitions/prizes_controller.rb index e8119a67f..c87026042 100644 --- a/app/controllers/competitions/prizes_controller.rb +++ b/app/controllers/competitions/prizes_controller.rb @@ -1,8 +1,10 @@ class Competitions::PrizesController < Competitions::BaseController before_action :require_prize_user! + helper_method :current_prize_user + def show - self_prizes = current_competition.competition_prize_users.where(user_id: current_user.id).includes(:competition_team).order(:competition_prize_id) + self_prizes = current_competition.competition_prize_users.where(user_id: current_prize_user.id).includes(:competition_team).order(:competition_prize_id) @leader = self_prizes.any?{ |prize_user| prize_user.leader? && prize_user.competition_prize.category == 'bonus' } # 是否为队长并且有奖金奖励 if @leader @@ -22,8 +24,13 @@ class Competitions::PrizesController < Competitions::BaseController private def require_prize_user! - return if current_competition.competition_prize_users.exists?(user: current_user) + return if current_competition.competition_prize_users.exists?(user: current_prize_user) + return if current_user.admin_or_business? || current_user.id == current_prize_user.id render_forbidden end + + def current_prize_user + @_current_prize_user ||= User.find(params[:user_id]) + end end \ No newline at end of file diff --git a/app/views/competitions/prizes/show.json.jbuilder b/app/views/competitions/prizes/show.json.jbuilder index 9bb6b8256..18113a7ed 100644 --- a/app/views/competitions/prizes/show.json.jbuilder +++ b/app/views/competitions/prizes/show.json.jbuilder @@ -5,7 +5,7 @@ if @leader json.bank_account_editable @bank_account_editable end -json.all_certified current_user.all_certified? +json.all_certified current_prize_user.all_certified? json.personal_certifications do json.array! @self_prizes do |prize_user| json.url personal_competition_certificate_path(current_competition.identifier, prize_user) From 219ced5c2c65f97ed447db38d4b42ece24467484 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 6 Nov 2019 11:45:17 +0800 Subject: [PATCH 12/20] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/trustie_hacks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/trustie_hacks_controller.rb b/app/controllers/trustie_hacks_controller.rb index ebc7f1578..f427caf72 100644 --- a/app/controllers/trustie_hacks_controller.rb +++ b/app/controllers/trustie_hacks_controller.rb @@ -10,7 +10,7 @@ class TrustieHacksController < ApplicationController limit = params[:limit] || 16 hacks = @hackathon.trustie_hacks - @hackathon_users_count = hacks.sum(:hack_users_count) + @hackathon_users_count = hacks ? 0 : hacks.sum(:hack_users_count) @hacks = hacks.page(page).per(limit) From 8d3de79f75caa78a466ff8c044301a6083b88db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 6 Nov 2019 11:45:18 +0800 Subject: [PATCH 13/20] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/paths/PathDetail/PathDetailIndex.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index 02ef25aa1..d23cf5634 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -682,7 +682,11 @@ class PathDetailIndex extends Component{

this.modifysy(1)}>{team_title}

- +
: From a60ce17d966473c330a80f105bb3228938880ceb Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 6 Nov 2019 11:50:21 +0800 Subject: [PATCH 14/20] competition certificate download --- app/controllers/competitions/certificates_controller.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/competitions/certificates_controller.rb b/app/controllers/competitions/certificates_controller.rb index 68dad41c1..7572d8bbb 100644 --- a/app/controllers/competitions/certificates_controller.rb +++ b/app/controllers/competitions/certificates_controller.rb @@ -1,6 +1,11 @@ class Competitions::CertificatesController < Competitions::BaseController def personal - prize_user = CompetitionPrizeUser.find_by!(user: current_user, id: params[:id]) + prize_user = + if current_user.admin_or_business? + CompetitionPrizeUser.find(params[:id]) + else + CompetitionPrizeUser.find_by!(user: current_user, id: params[:id]) + end return render_not_found unless prize_user.certificate_exist? team = prize_user.competition_team @@ -12,7 +17,7 @@ class Competitions::CertificatesController < Competitions::BaseController def team team = CompetitionTeam.find(params[:id]) - return render_forbidden unless team.team_members.exists?(user_id: current_user.id) + return render_forbidden unless current_user.admin_or_business? || team.team_members.exists?(user_id: current_user.id) return render_not_found unless team.certificate_exists? prize = team.competition_prize_users.first.competition_prize From 9f3acd65b783f478d00c395da4fbfaa0e2e274ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 6 Nov 2019 12:12:01 +0800 Subject: [PATCH 15/20] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/common/educoder.js | 2 +- .../courses/coursesPublic/SelectResource.js | 2 +- .../courses/coursesPublic/SelectSetting.js | 2 +- .../courses/coursesPublic/sendResource.js | 2 +- public/react/src/modules/login/LoginDialog.js | 32 +++++----- .../modules/user/LoginRegisterComponent.js | 61 ++++++++++--------- 6 files changed, 54 insertions(+), 47 deletions(-) diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index 73c707c9b..004cd91c0 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -1,4 +1,4 @@ -import { from } from '_array-flatten@2.1.2@array-flatten'; +//import { from } from '_array-flatten@2.1.2@array-flatten'; // export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil'; diff --git a/public/react/src/modules/courses/coursesPublic/SelectResource.js b/public/react/src/modules/courses/coursesPublic/SelectResource.js index edc1fc81b..13c201cd0 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectResource.js +++ b/public/react/src/modules/courses/coursesPublic/SelectResource.js @@ -421,7 +421,7 @@ class Selectresource extends Component{ 立即发布 - + 延期发布 立即发布 - + 延期发布 立即发布 - + 延期发布 this.openweixinlogin()}> 微信登录 - this.openqqlogin()} className={"ml10"}> - qq登录 - + {/*this.openqqlogin()} className={"ml10"}>*/} + {/*qq登录*/} + {/**/} -

:

- - ———————— 快速登录 ———————— -

-

} +

:""} + + {/*

*/} + + {/*———————— 快速登录 ————————*/} + {/*

*/} + {/*

*/} } {weixinlogin===true?