Merge branches 'dev_aliyun', 'yslcompetition' and 'ysm1' of https://bdgit.educoder.net/Hjqreturn/educoder into yslcompetition

dev_sync_trustie
杨树林 5 years ago
commit 2e2fe14ff4

@ -11,6 +11,7 @@
//= require select2
//= require jquery.cxselect
//= require bootstrap-datepicker
//= require bootstrap-datetimepicker
//= require bootstrap.viewer
//= require jquery.mloading
//= require jquery-confirm.min

@ -116,7 +116,8 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController
keyword = params[:keyword].to_s.strip
if keyword.present?
teams = teams.joins(users: { user_extension: :school }).where('schools.name LIKE ?', "%#{keyword}%")
teams = teams.joins(users: { user_extension: :school })
.where('competition_teams.name LIKE :keyword OR schools.name LIKE :keyword', keyword: "%#{keyword}%")
end
@all_count = teams.count

@ -1,2 +1,3 @@
class WeappSettings::Advert < WeappSetting
default_scope { order(position: :asc) }
end

@ -9,22 +9,22 @@ class Admins::DragWeappAdvertService < ApplicationService
def call
return if move.position + 1 == after&.position # 未移动
carousels = WeappSettings::Advert.all
adverts = WeappSettings::Advert.all
ActiveRecord::Base.transaction do
if after.blank? || move.id == after.id # 移动至末尾
total = carousels.count
total = adverts.count
carousels.where('position > ?', move.position).update_all('position = position - 1')
adverts.where('position > ?', move.position).update_all('position = position - 1')
move.update!(position: total)
return
end
if move.position > after.position # 前移
carousels.where('position >= ? AND position < ?', after.position, move.position).update_all('position = position + 1')
adverts.where('position >= ? AND position < ?', after.position, move.position).update_all('position = position + 1')
move.update!(position: after.position)
else # 后移
carousels.where('position > ? AND position < ?', move.position, after.position).update_all('position = position - 1')
adverts.where('position > ? AND position < ?', move.position, after.position).update_all('position = position - 1')
move.update!(position: after.position - 1)
end
end

@ -5,11 +5,12 @@
<th width="16%">邮件地址</th>
<th width="10%">手机号码</th>
<th width="14%">单位</th>
<th width="8%">角色</th>
<th width="10%"><%= sort_tag('创建于', name: 'created_on', path: admins_users_path) %></th>
<th width="10%"><%= sort_tag('最后登录', name: 'last_login_on', path: admins_users_path) %></th>
<th width="6%"><%= sort_tag('经验值', name: 'experience', path: admins_users_path) %></th>
<th width="6%"><%= sort_tag('金币', name: 'grade', path: admins_users_path) %></th>
<th width="20%">操作</th>
<th width="12%">操作</th>
</tr>
</thead>
<tbody>
@ -24,6 +25,7 @@
<td><%= overflow_hidden_span display_text(user.mail), width: 150 %></td>
<td><%= overflow_hidden_span display_text(user.phone), width: 100 %></td>
<td><%= overflow_hidden_span display_text(user.school_name), width: 150 %></td>
<td><%= user.identity %></td>
<td><%= display_text(user.created_on&.strftime('%Y-%m-%d %H:%M')) %></td>
<td><%= display_text(user.last_login_on&.strftime('%Y-%m-%d %H:%M')) %></td>
<td><%= user.experience.to_i %></td>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -25131,118 +25131,145 @@ input.form-control {
flex: 1;
}
/* line 32, app/assets/stylesheets/common.scss */
.fl {
float: left;
}
/* line 33, app/assets/stylesheets/common.scss */
.no_padding {
padding: 0px !important;
}
/* line 34, app/assets/stylesheets/common.scss */
.font-12 {
font-size: 12px !important;
}
/* line 34, app/assets/stylesheets/common.scss */
/* line 35, app/assets/stylesheets/common.scss */
.font-14 {
font-size: 14px !important;
}
/* line 35, app/assets/stylesheets/common.scss */
/* line 36, app/assets/stylesheets/common.scss */
.font-16 {
font-size: 16px !important;
}
/* line 36, app/assets/stylesheets/common.scss */
/* line 37, app/assets/stylesheets/common.scss */
.font-18 {
font-size: 18px !important;
}
/* line 37, app/assets/stylesheets/common.scss */
/* line 38, app/assets/stylesheets/common.scss */
.font-20 {
font-size: 20px !important;
}
/* line 38, app/assets/stylesheets/common.scss */
/* line 39, app/assets/stylesheets/common.scss */
.font-24 {
font-size: 24px !important;
}
/* line 39, app/assets/stylesheets/common.scss */
/* line 40, app/assets/stylesheets/common.scss */
.padding10-5 {
padding: 10px 5px;
}
/* line 40, app/assets/stylesheets/common.scss */
/* line 41, app/assets/stylesheets/common.scss */
.width100 {
width: 100%;
}
/* line 41, app/assets/stylesheets/common.scss */
/* line 42, app/assets/stylesheets/common.scss */
.mb10 {
margin-bottom: 10px;
}
/* line 42, app/assets/stylesheets/common.scss */
/* line 43, app/assets/stylesheets/common.scss */
.mt10 {
margin-top: 10px;
}
/* line 43, app/assets/stylesheets/common.scss */
/* line 44, app/assets/stylesheets/common.scss */
.mr10 {
margin-right: 10px;
}
/* line 44, app/assets/stylesheets/common.scss */
/* line 45, app/assets/stylesheets/common.scss */
.ml10 {
margin-left: 10px;
}
/* line 44, app/assets/stylesheets/common.scss */
/* line 45, app/assets/stylesheets/common.scss */
.ml20 {
margin-left: 20px;
}
/* line 45, app/assets/stylesheets/common.scss */
/* line 46, app/assets/stylesheets/common.scss */
.textarea-width-100 {
width: 100%;
resize: none;
border: 1px solid #ccc;
}
/* line 46, app/assets/stylesheets/common.scss */
/* line 47, app/assets/stylesheets/common.scss */
.padding10 {
padding: 10px;
}
/* line 47, app/assets/stylesheets/common.scss */
/* line 48, app/assets/stylesheets/common.scss */
.padding5-10 {
padding: 5px 10px;
}
/* line 48, app/assets/stylesheets/common.scss */
/* line 49, app/assets/stylesheets/common.scss */
.position-r {
position: relative;
}
/* line 49, app/assets/stylesheets/common.scss */
/* line 50, app/assets/stylesheets/common.scss */
.color-grey-c {
color: #ccc;
}
/* line 50, app/assets/stylesheets/common.scss */
/* line 51, app/assets/stylesheets/common.scss */
.color-blue {
color: #4CACFF;
}
/* line 51, app/assets/stylesheets/common.scss */
/* line 52, app/assets/stylesheets/common.scss */
.color-orange {
color: #ff6800;
}
/* line 53, app/assets/stylesheets/common.scss */
.inline-block {
display: inline-block;
}
/* line 52, app/assets/stylesheets/common.scss */
/* line 54, app/assets/stylesheets/common.scss */
.hide {
display: none;
}
/* line 53, app/assets/stylesheets/common.scss */
/* line 55, app/assets/stylesheets/common.scss */
.show {
display: block;
}
/* line 57, app/assets/stylesheets/common.scss */
.input_small {
-webkit-box-flex: 0 !important;
flex: 0 0 6% !important;
}
/* line 58, app/assets/stylesheets/common.scss */
.input_middle {
-webkit-box-flex: 0 !important;
flex: 0 0 13% !important;
}
/* line 2, app/assets/stylesheets/admins/auth_schools.scss */
.admins-auth-schools-index-page .list-item-title {
padding-bottom: 5px;
@ -25590,7 +25617,68 @@ input.form-control {
/* line 38, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .setBtn_s {
height: 35px;
line-height: 5px;
line-height: 20px;
}
/* line 43, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .sponsor_label {
border: 1px solid #4CACFF;
border-radius: 5px;
background-color: rgba(76, 172, 255, 0.3);
color: #333;
padding: 0px 4px;
height: 30px;
line-height: 30px;
float: left;
margin: 4px 5px;
}
/* line 54, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .sponsor_label span {
display: block;
float: left;
height: 28px;
line-height: 28px;
margin-right: 5px;
}
/* line 62, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .sponsor_label a {
font-size: 18px;
float: left;
height: 28px;
line-height: 28px;
}
/* line 70, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel {
padding: 0px 15px;
}
/* line 73, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .large_panel_part {
border-top: 1px solid #eaeaea;
}
/* line 76, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .large_panel_part:first-child {
border: none;
}
/* line 80, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .large_panel_part > .row, .admins-competition-settings-index-page .large_panel .small_panel > .row {
border-bottom: 1px solid #eaeaea;
padding: 20px 0px;
}
/* line 84, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .small_panel {
margin-left: 20px;
}
/* line 87, app/assets/stylesheets/admins/competition_settings.scss */
.admins-competition-settings-index-page .large_panel .row:last-child {
border: none;
}
/* line 4, app/assets/stylesheets/admins/cooperatives.scss */

@ -136155,6 +136155,19 @@ $(document).on('turbolinks:load', function(){
}
});
//添加主办方或者开放范围
function addSponsor(item){
var html='<div class="sponsor_label">\n' +
' <input type="hidden" value="school_id" />\n' +
' <span>caicai</span>\n' +
' <a href="javascript:void(0)" onclick="del_sponsor(this)">×</a>\n' +
' </div>';
$(item).parents(".sponsorPanel").append(html);
}
//删除
function del_sponsor(item){
$(item).parents(".sponsor_label").remove();
}
$(function () {
//MD编辑
@ -136297,7 +136310,8 @@ $(function () {
}
})
})
});
//新增子阶段
function add_task_sub(item){
var index = $(item).parents(".large_panel_part").attr("attr_line");
@ -136403,7 +136417,7 @@ function Del_tab(item) {
$(item).parents(".large_panel_part").remove();
}
//新增tab
function addNewTab() {
function addNewTab() {
var count = parseInt($("#large_panel").find(".large_panel_part").length)+1;
var html = '<div class="large_panel_part" attr_line="'+count+'"><div class="row d-flex mt-3">\n' +
' <span class="col-1 mt-2">tab标题</span>\n' +

@ -15767,118 +15767,145 @@ input.form-control {
flex: 1;
}
/* line 32, app/assets/stylesheets/common.scss */
.fl {
float: left;
}
/* line 33, app/assets/stylesheets/common.scss */
.no_padding {
padding: 0px !important;
}
/* line 34, app/assets/stylesheets/common.scss */
.font-12 {
font-size: 12px !important;
}
/* line 34, app/assets/stylesheets/common.scss */
/* line 35, app/assets/stylesheets/common.scss */
.font-14 {
font-size: 14px !important;
}
/* line 35, app/assets/stylesheets/common.scss */
/* line 36, app/assets/stylesheets/common.scss */
.font-16 {
font-size: 16px !important;
}
/* line 36, app/assets/stylesheets/common.scss */
/* line 37, app/assets/stylesheets/common.scss */
.font-18 {
font-size: 18px !important;
}
/* line 37, app/assets/stylesheets/common.scss */
/* line 38, app/assets/stylesheets/common.scss */
.font-20 {
font-size: 20px !important;
}
/* line 38, app/assets/stylesheets/common.scss */
/* line 39, app/assets/stylesheets/common.scss */
.font-24 {
font-size: 24px !important;
}
/* line 39, app/assets/stylesheets/common.scss */
/* line 40, app/assets/stylesheets/common.scss */
.padding10-5 {
padding: 10px 5px;
}
/* line 40, app/assets/stylesheets/common.scss */
/* line 41, app/assets/stylesheets/common.scss */
.width100 {
width: 100%;
}
/* line 41, app/assets/stylesheets/common.scss */
/* line 42, app/assets/stylesheets/common.scss */
.mb10 {
margin-bottom: 10px;
}
/* line 42, app/assets/stylesheets/common.scss */
/* line 43, app/assets/stylesheets/common.scss */
.mt10 {
margin-top: 10px;
}
/* line 43, app/assets/stylesheets/common.scss */
/* line 44, app/assets/stylesheets/common.scss */
.mr10 {
margin-right: 10px;
}
/* line 44, app/assets/stylesheets/common.scss */
/* line 45, app/assets/stylesheets/common.scss */
.ml10 {
margin-left: 10px;
}
/* line 44, app/assets/stylesheets/common.scss */
/* line 45, app/assets/stylesheets/common.scss */
.ml20 {
margin-left: 20px;
}
/* line 45, app/assets/stylesheets/common.scss */
/* line 46, app/assets/stylesheets/common.scss */
.textarea-width-100 {
width: 100%;
resize: none;
border: 1px solid #ccc;
}
/* line 46, app/assets/stylesheets/common.scss */
/* line 47, app/assets/stylesheets/common.scss */
.padding10 {
padding: 10px;
}
/* line 47, app/assets/stylesheets/common.scss */
/* line 48, app/assets/stylesheets/common.scss */
.padding5-10 {
padding: 5px 10px;
}
/* line 48, app/assets/stylesheets/common.scss */
/* line 49, app/assets/stylesheets/common.scss */
.position-r {
position: relative;
}
/* line 49, app/assets/stylesheets/common.scss */
/* line 50, app/assets/stylesheets/common.scss */
.color-grey-c {
color: #ccc;
}
/* line 50, app/assets/stylesheets/common.scss */
/* line 51, app/assets/stylesheets/common.scss */
.color-blue {
color: #4CACFF;
}
/* line 51, app/assets/stylesheets/common.scss */
/* line 52, app/assets/stylesheets/common.scss */
.color-orange {
color: #ff6800;
}
/* line 53, app/assets/stylesheets/common.scss */
.inline-block {
display: inline-block;
}
/* line 52, app/assets/stylesheets/common.scss */
/* line 54, app/assets/stylesheets/common.scss */
.hide {
display: none;
}
/* line 53, app/assets/stylesheets/common.scss */
/* line 55, app/assets/stylesheets/common.scss */
.show {
display: block;
}
/* line 57, app/assets/stylesheets/common.scss */
.input_small {
-webkit-box-flex: 0 !important;
flex: 0 0 6% !important;
}
/* line 58, app/assets/stylesheets/common.scss */
.input_middle {
-webkit-box-flex: 0 !important;
flex: 0 0 13% !important;
}
/* line 3, app/assets/stylesheets/colleges/statistic.scss */
.colleges-statistics-page .college-body-container .statistic-header {
width: 100%;

@ -24775,118 +24775,145 @@ input.form-control {
flex: 1;
}
/* line 32, app/assets/stylesheets/common.scss */
.fl {
float: left;
}
/* line 33, app/assets/stylesheets/common.scss */
.no_padding {
padding: 0px !important;
}
/* line 34, app/assets/stylesheets/common.scss */
.font-12 {
font-size: 12px !important;
}
/* line 34, app/assets/stylesheets/common.scss */
/* line 35, app/assets/stylesheets/common.scss */
.font-14 {
font-size: 14px !important;
}
/* line 35, app/assets/stylesheets/common.scss */
/* line 36, app/assets/stylesheets/common.scss */
.font-16 {
font-size: 16px !important;
}
/* line 36, app/assets/stylesheets/common.scss */
/* line 37, app/assets/stylesheets/common.scss */
.font-18 {
font-size: 18px !important;
}
/* line 37, app/assets/stylesheets/common.scss */
/* line 38, app/assets/stylesheets/common.scss */
.font-20 {
font-size: 20px !important;
}
/* line 38, app/assets/stylesheets/common.scss */
/* line 39, app/assets/stylesheets/common.scss */
.font-24 {
font-size: 24px !important;
}
/* line 39, app/assets/stylesheets/common.scss */
/* line 40, app/assets/stylesheets/common.scss */
.padding10-5 {
padding: 10px 5px;
}
/* line 40, app/assets/stylesheets/common.scss */
/* line 41, app/assets/stylesheets/common.scss */
.width100 {
width: 100%;
}
/* line 41, app/assets/stylesheets/common.scss */
/* line 42, app/assets/stylesheets/common.scss */
.mb10 {
margin-bottom: 10px;
}
/* line 42, app/assets/stylesheets/common.scss */
/* line 43, app/assets/stylesheets/common.scss */
.mt10 {
margin-top: 10px;
}
/* line 43, app/assets/stylesheets/common.scss */
/* line 44, app/assets/stylesheets/common.scss */
.mr10 {
margin-right: 10px;
}
/* line 44, app/assets/stylesheets/common.scss */
/* line 45, app/assets/stylesheets/common.scss */
.ml10 {
margin-left: 10px;
}
/* line 44, app/assets/stylesheets/common.scss */
/* line 45, app/assets/stylesheets/common.scss */
.ml20 {
margin-left: 20px;
}
/* line 45, app/assets/stylesheets/common.scss */
/* line 46, app/assets/stylesheets/common.scss */
.textarea-width-100 {
width: 100%;
resize: none;
border: 1px solid #ccc;
}
/* line 46, app/assets/stylesheets/common.scss */
/* line 47, app/assets/stylesheets/common.scss */
.padding10 {
padding: 10px;
}
/* line 47, app/assets/stylesheets/common.scss */
/* line 48, app/assets/stylesheets/common.scss */
.padding5-10 {
padding: 5px 10px;
}
/* line 48, app/assets/stylesheets/common.scss */
/* line 49, app/assets/stylesheets/common.scss */
.position-r {
position: relative;
}
/* line 49, app/assets/stylesheets/common.scss */
/* line 50, app/assets/stylesheets/common.scss */
.color-grey-c {
color: #ccc;
}
/* line 50, app/assets/stylesheets/common.scss */
/* line 51, app/assets/stylesheets/common.scss */
.color-blue {
color: #4CACFF;
}
/* line 51, app/assets/stylesheets/common.scss */
/* line 52, app/assets/stylesheets/common.scss */
.color-orange {
color: #ff6800;
}
/* line 53, app/assets/stylesheets/common.scss */
.inline-block {
display: inline-block;
}
/* line 52, app/assets/stylesheets/common.scss */
/* line 54, app/assets/stylesheets/common.scss */
.hide {
display: none;
}
/* line 53, app/assets/stylesheets/common.scss */
/* line 55, app/assets/stylesheets/common.scss */
.show {
display: block;
}
/* line 57, app/assets/stylesheets/common.scss */
.input_small {
-webkit-box-flex: 0 !important;
flex: 0 0 6% !important;
}
/* line 58, app/assets/stylesheets/common.scss */
.input_middle {
-webkit-box-flex: 0 !important;
flex: 0 0 13% !important;
}
/* line 4, app/assets/stylesheets/cooperative/carousels.scss */
.cooperative-carousels-index-page .carousels-card .custom-carousel-item > .drag {
cursor: move;

@ -6,15 +6,6 @@ import axios from 'axios';
import './Competitionsindex.css';
import NoneData from "../../courses/coursesPublic/NoneData";
const { SubMenu } = Menu;
const IconText = ({ type, text }) => (
<span>
<Icon type={type} style={{ marginRight: 8 }} />
{text}
</span>
);
class CompetitionsIndex extends Component{
constructor(props) {
super(props)

@ -6,7 +6,7 @@ import axios from 'axios';
import NoneData from "../../courses/shixunHomework/shixunHomework";
import './Competitionteams.css';
const { Header, Footer, Sider, Content } = Layout;
const { Content } = Layout;
class Competitionteams extends Component{
constructor(props) {

@ -10,7 +10,7 @@ import NoneData from "../../courses/shixunHomework/shixunHomework";
import './CompetitionCommon.css';
const { Header, Footer, Sider, Content } = Layout;
const {Sider } = Layout;
class CompetitionCommon extends Component{
constructor(props) {
@ -20,6 +20,7 @@ class CompetitionCommon extends Component{
bannerdata:undefined,
module_type:undefined,
mdContentdata:undefined,
chart_rules:undefined,
Competitionedittype:false
}
}
@ -84,28 +85,48 @@ class CompetitionCommon extends Component{
this.getlistdata(keys)
}
getlistdata=(keys)=>{
getlistdata=(keys,listkey)=>{
let{data}=this.state;
this.setState({
thiskeys:keys
})
data&&data.competition_modules.map((item,key)=>{
if(keys===item.position){
this.getrightdata(item.id,item.module_type,item.module_url,item.has_url)
this.getrightdata(item.id,item.module_type,item.module_url,item.has_url,listkey)
return
}
})
}
getrightdata=(id,typeid,module_url,has_url)=>{
this.setState({
module_id:id,
module_type:typeid
})
getnewchartdata=(typeid,tabkey)=>{
if(typeid==="chart"){
let url=`/competitions/${this.props.match.params.identifier}/chart_rules.json`;
axios.get(url)
.then((response) => {
if(response.status===200){
this.setState({
chart_rules:response.data,
tabkey:tabkey===undefined?response.data.stages[0].id===null?"0":`${response.data.stages[0].id}`:tabkey
})
}
}).catch((error) => {
console.log(error)
})
}
}
getrightdata=(id,typeid,module_url,has_url,listkey)=>{
if(typeid==="enroll"){
this.props.history.replace(`/newcompetitions/${this.props.match.params.identifier}/enroll`);
return
}
this.getnewchartdata(typeid,listkey)
if(has_url===false){
let url=`${module_url}`;
axios.get(url).then((response) => {
@ -122,6 +143,10 @@ class CompetitionCommon extends Component{
return
}
this.setState({
module_id:id,
module_type:typeid
})
}
Competitionedit=()=>{
@ -176,7 +201,12 @@ class CompetitionCommon extends Component{
}
}
Competitioncallback=(key)=>{
this.setState({
tabkey:key
})
}
render() {
let {data,bannerdata,module_type,Competitionedittype,mdContentdata}=this.state;
@ -228,7 +258,7 @@ class CompetitionCommon extends Component{
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status==="nearly_published"?"--":data&&data.visits_count}</div>
</Col>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516" onClick={()=>this.gotocourse(`/newcompetitions/${this.props.match.params.identifier}/enroll`)}>{data.competition_status==="nearly_published"?"--":data&&data.member_count}</div>
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516" onClick={data.competition_status==="nearly_published"?"":()=>this.gotocourse(`/newcompetitions/${this.props.match.params.identifier}/enroll`)}>{data.competition_status==="nearly_published"?"--":data&&data.member_count}</div>
</Col>
</Row>
</Col>
@ -293,6 +323,7 @@ class CompetitionCommon extends Component{
{...this.props}
{...this.state}
Competitionedit={()=>this.Competitionedit()}
Competitioncallback={(e)=>this.Competitioncallback(e)}
/>:"":Competitionedittype===false?<CompetitionContents
Competitionedit={()=>this.Competitionedit()}
{...this.props}
@ -304,7 +335,8 @@ class CompetitionCommon extends Component{
{/*/>*/}
{Competitionedittype===true?<CompetitionContentsMd
hideCompetitionedit={()=>this.hideCompetitionedit()}
getlistdata={(keys)=>this.getlistdata(keys)}
getlistdata={(keys,listkey)=>this.getlistdata(keys,listkey)}
Competitioncallback={(e)=>this.Competitioncallback(e)}
{...this.props}
{...this.state}
/>:""}

@ -1,10 +1,9 @@
import React, { Component } from 'react';
import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table} from 'antd';
import axios from 'axios';
import {markdownToHTML,getImageUrl} from 'educoder';
import NoneData from "../../courses/shixunHomework/shixunHomework";
const { Header, Footer, Sider, Content } = Layout;
const { Content } = Layout;
const { TabPane } = Tabs;
const { Meta } = Card;
@ -18,16 +17,6 @@ class CompetitionContents extends Component{
componentDidMount(){
window.document.title = '竞赛';
this.gettitledata()
}
gettitledata=()=>{
let url=`/competitions/${this.props.match.params.identifier}/chart_rules.json`;
axios.get(url)
.then((response) => {
console.log(response)
}).catch((error) => {
console.log(error)
})
}
@ -83,23 +72,34 @@ class CompetitionContents extends Component{
}
];
let {chart_rules,tabkey}=this.props;
return (
return (
<div>
<Tabs tabBarExtraContent={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?operations:"":""}>
<TabPane tab="总排行榜" key="1">
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML("Content of tab 1").replace(/▁/g, "▁▁▁")}}>
</Content>
</TabPane>
<TabPane tab="决赛排行榜" key="2">
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML("Content of tab 2").replace(/▁/g, "▁▁▁")}}>
</Content>
</TabPane>
<TabPane tab="预赛排行榜" key="3">
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML("Content of tab 3").replace(/▁/g, "▁▁▁")}}>
</Content>
</TabPane>
</Tabs>
{chart_rules===undefined?"":<Tabs onChange={(e)=>this.props.Competitioncallback(e)} activeKey={this.props.tabkey} tabBarExtraContent={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?operations:"":""}>
{chart_rules.stages.map((item,key)=>{
return(
<TabPane tab={item.name} key={item.id===null?0:item.id}>
{chart_rules.rule_contents.map((items,keys)=>{
if(item.id===items.competition_stage_id){
return(
<Content key={keys} className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(items.content).replace(/▁/g, "▁▁▁")}}>
</Content>
)
}else if(item.id===null&&items.competition_stage_id===0){
return(
<Content key={keys} className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(items.content).replace(/▁/g, "▁▁▁")}}>
</Content>
)
}
})}
</TabPane>
)
})}
</Tabs>}
<Col className="gutter-row Competitioncharts mt30 mb30">

@ -1,42 +1,80 @@
import React, { Component } from 'react';
import {Button, Card, Row, Col ,Upload,Icon,message} from 'antd';
import {Button, Card, Row, Col ,Upload,Icon,message,Tabs} from 'antd';
import axios from 'axios';
import {getImageUrl,getUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder';
import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
const { TabPane } = Tabs;
class CompetitionContentsMd extends Component{
constructor(props) {
super(props)
this.contentMdRef = React.createRef();
this.state={
contentFileList:[]
contentFileList:[],
chartmodule_id:undefined
}
}
componentDidUpdate =(prevState)=>{
if(prevState!=this.props){
this.getchartdata();
}
}
componentDidMount(){
window.document.title = '竞赛';
let {mdContentdata}=this.props;
// this.gettitledata()
this.getchartdata()
}
getchartdata=()=>{
let {mdContentdata,chart_rules}=this.props;
// is_pdf: false
//
let contentFileList = mdContentdata===undefined?[]:mdContentdata.attachments===undefined?[]:mdContentdata.attachments.map((item) => {
return {
id: item.id,
uid: item.id,
name: appendFileSizeToUploadFile(item),
url: item.url,
filesize: item.filesize,
status: 'done',
response:{id: item.id}
}
if(this.props.module_type==="chart"){
let type=true;
if(chart_rules===undefined){
}else{
chart_rules.rule_contents.map((items,keys)=>{
debugger
if(parseInt(this.props.tabkey)===items.competition_stage_id){
console.log(items)
this.contentMdRef.current.setValue(items.content);
this.setState({
contentFileList:undefined,
chartmodule_id:items.id
})
this.setState({
contentFileList:contentFileList
})
this.contentMdRef.current.setValue(mdContentdata===undefined?"":mdContentdata.md_content===undefined?"":mdContentdata.md_content || '')
type=false;
}
})
if(type===true){
this.contentMdRef.current.setValue("");
this.setState({
contentFileList:undefined,
chartmodule_id:undefined
})
}
}
}else{
let contentFileList = mdContentdata===undefined?[]:mdContentdata.attachments===undefined?[]:mdContentdata.attachments.map((item) => {
return {
id: item.id,
uid: item.id,
name: appendFileSizeToUploadFile(item),
url: item.url,
filesize: item.filesize,
status: 'done',
response:{id: item.id}
}
})
this.setState({
contentFileList:contentFileList
})
this.contentMdRef.current.setValue(mdContentdata===undefined?"":mdContentdata.md_content===undefined?"":mdContentdata.md_content || '')
}
}
handleContentUploadChange = (info) => {
@ -45,7 +83,6 @@ class CompetitionContentsMd extends Component{
}
onAttachmentRemove = (file, stateName) => {
debugger
if(file.response!=undefined){
this.props.confirm({
content: '是否确认删除?',
@ -90,22 +127,37 @@ class CompetitionContentsMd extends Component{
handleSubmit = () => {
let {contentFileList}=this.state;
const mdContnet = this.contentMdRef.current.getValue().trim();
let attachment_ids = contentFileList.map(item => {
return item.response ? item.response.id : item.id
})
console.log(attachment_ids)
let attachment_ids=undefined
if(contentFileList!=undefined){
attachment_ids= contentFileList.map(item => {
return item.response ? item.response.id : item.id
})
}
let url=`/competitions/${this.props.match.params.identifier}/update_md_content.json`;
axios.post(url,{
md_content_id:this.props.mdContentdata.md_id,
competition_module_id:this.props.mdContentdata.id,
content:mdContnet,
attachment_ids:attachment_ids
let newstage_id=parseInt(this.props.tabkey)===0||null?undefined:parseInt(this.props.tabkey)
let data={}
if(this.props.module_type==="chart"){
data={
md_content_id:this.state.chartmodule_id,
competition_module_id:this.props.module_id,
stage_id:newstage_id,
content:mdContnet,
}
}else{
data={
md_content_id:this.props.mdContentdata.md_id,
competition_module_id:this.props.mdContentdata.id,
content:mdContnet,
attachment_ids:attachment_ids
}
}
let url=`/competitions/${this.props.match.params.identifier}/update_md_content.json`;
axios.post(url,data
).then((response) => {
if(response.data.status===0){
this.props.showNotification(response.data.message);
this.props.getlistdata(this.props.thiskeys);
this.props.getlistdata(this.props.thiskeys,this.props.tabkey);
this.props.hideCompetitionedit();
}else{
this.props.showNotification(response.data.message);
@ -117,6 +169,7 @@ class CompetitionContentsMd extends Component{
}
render() {
let {contentFileList}=this.state;
let {chart_rules}=this.props;
const uploadProps = {
width: 600,
fileList: contentFileList,
@ -136,18 +189,28 @@ class CompetitionContentsMd extends Component{
return isLt150M;
},
};
console.log(contentFileList)
// console.log(this.props.tabkey)
// console.log(chart_rules)
console.log(this.props.mdContentdata)
return (
<div>
{chart_rules===undefined?"":this.props.module_type==="chart"?<Tabs activeKey={this.props.tabkey} onChange={(e)=>this.props.Competitioncallback(e)}>
{chart_rules.stages.map((item,key)=>{
return(
<TabPane tab={item.name} key={item.id===null?0:item.id}></TabPane>
)
})}
</Tabs>:""}
<TPMMDEditor ref={this.contentMdRef} placeholder="请输入任务内容说明最大限制5000个字符" mdID={'courseContentMD'} refreshTimeout={1500}
className="courseMessageMD" initValue={this.state.description}></TPMMDEditor>
<Upload {...uploadProps} className="upload_1 newWorkUpload">
{this.props.module_type==="chart"?"":<Upload {...uploadProps} className="upload_1 newWorkUpload">
<Button className="uploadBtn">
<Icon type="upload" /> 上传附件
</Button>
(单个文件150M以内)
</Upload>
</Upload>}
<div className="clearfix mt30 mb30">
{/* htmlType="submit" */}

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import { Route, Link, Switch } from "react-router-dom";
import Loading from '../../Loading';
@ -41,8 +41,7 @@ class Competitions extends Component {
}
componentDidMount(){
console.log("Competitions竞赛");
console.log(this.props);
window.document.title = '竞赛';
}

Loading…
Cancel
Save