dev_aliyun_beta
杨树林 6 years ago
parent 827196d046
commit 36eef0dda0

@ -5,9 +5,10 @@ $(document).on('turbolinks:load', function() {
allowClear: true
});
let search_form = $(".search-form");
//导出
$(".shixuns-list-form").on("click","#shixuns-export",function () {
let search_form = $(".search-form");
window.location.href = "/admins/shixuns.xls?" + search_form.serialize();
})
});
}
});

@ -27,7 +27,7 @@ class CoursesController < ApplicationController
:attahcment_category_list,:export_member_scores_excel, :duplicate_course,
:switch_to_teacher, :switch_to_assistant, :switch_to_student, :exit_course,
:informs, :update_informs, :online_learning, :update_task_position, :tasks_list,
:join_excellent_course, :export_couser_info, :export_member_act_score]
:join_excellent_course, :export_couser_info, :export_member_act_score, :new_informs]
before_action :user_course_identity, except: [:join_excellent_course, :index, :create, :new, :apply_to_join_course,
:search_course_list, :get_historical_course_students, :mine, :search_slim, :board_list]
before_action :teacher_allowed, only: [:update, :destroy, :settings, :search_teacher_candidate,

@ -298,6 +298,9 @@ class HomeworksService
else
0
end
else
adjust_score = work.challenge_work_scores.select{|work_score| work_score.challenge_id == game.challenge_id}.last
final_score += adjust_score.score if adjust_score.present?
end
end

@ -344,7 +344,7 @@ a.edu-txt-w40,.edu-txt-w40{ width:40px; display: inline-block;text-align: center
.bor-grey01{border:1px solid #E6EAEB;}
.bor-orange{border:1px solid #FF7500;}
.bor-blue{border:1px solid #5faee3;}
.bor-red{border:1px solid #db0505;}
.bor-red{border:1px solid #db0505 !important;}
.bor-none{border:none;}
.bor-outnone{outline:none; border:0px;}

@ -66,15 +66,19 @@
<table class="edu-pop-table head-color edu-txt-center" cellpadding="0" cellspacing="0">
<thead>
<th width="6%">关卡</th>
<th width="27%" style="text-align: left;">任务名称</th>
<th width="13%">开启时间</th>
<th width="24%" style="text-align: left;">任务名称</th>
<th width="12%">开启时间</th>
<th>评测次数</th>
<th width="13%">完成时间</th>
<th width="15%">耗时</th>
<th>经验值</th>
<th>关卡得分</th>
<th>调分</th>
</thead>
<tbody>
<% @games.each_with_index do |game, index| %>
<% challenge_score = @homework.challenge_score game.challenge_id %>
<% game_score = @work.work_challenge_score game, challenge_score %>
<tr>
<td><%= index + 1 %></td>
<td style="text-align: left;">
@ -88,6 +92,8 @@
<td><%= finished_time game.end_time %></td>
<td><%= ApplicationController.helpers.time_consuming game %></td>
<td><%= game.final_score %> / <%= game.challenge.all_score %></td>
<td><span class="color-orange"><%= game_score %></span> / <%= challenge_score %></td>
<td><%= game_score %></td>
</tr>
<% end %>
</tbody>

@ -22,8 +22,7 @@
</div>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '输入关键字搜索') %>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with': '搜索中...') %>
<%= link_to "清除",admins_shixun_settings_path(status:nil,tag:nil,search_type:nil,keyword:nil),class: "btn btn-default" %>
<%= link_to "清除",admins_shixun_settings_path,class: "btn btn-default",'data-disable-with': '清除中...' %>
<div class="">
<a href="javascript:void(0)" class="btn btn-primary export-absolute" id="shixun-settings-export" data-disable-with = '导出中...'>导出</a>
</div>

@ -1,5 +1,5 @@
<table class="table text-center shixun-settings-list-table">
<thead>
<thead class="thead-light">
<th width="4%">序号</th>
<th width="8%">ID</th>
<th width="12%" class="text-left">实训名称</th>
@ -19,11 +19,15 @@
</th>
</thead>
<tbody>
<% shixun_settings.each_with_index do |shixun,index| %>
<tr id="setting-item-<%= shixun.id %>">
<% page_no = (@params_page.to_i - 1) * 20 + index + 1 %>
<%= render partial: "admins/shixun_settings/shared/td",locals: {shixun: shixun,page_no:page_no} %>
</tr>
<% if shixun_settings.present? %>
<% shixun_settings.each_with_index do |shixun,index| %>
<tr id="setting-item-<%= shixun.id %>">
<% page_no = (@params_page.to_i - 1) * 20 + index + 1 %>
<%= render partial: "admins/shixun_settings/shared/td",locals: {shixun: shixun,page_no:page_no} %>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>

@ -3,7 +3,7 @@
<% end %>
<div class="box search-form-container shixuns-list-form">
<%= form_tag(admins_shixuns_path, method: :get, class: 'form-inline search-form',remote:true) do %>
<%= form_tag(admins_shixuns_path, method: :get, class: 'form-inline search-form',id:"shixuns-search-form",remote:true) do %>
<div class="form-group mr-2">
<label for="status">状态:</label>
<% status_options = [['全部', ''], ["编辑中(#{@editing_shixuns})", "editing"], ["待审核(#{@pending_shixuns})", 'pending'], ["已发布(#{@processed_shixuns})", 'processed'],["已关闭(#{@closed_shixuns})",'closed']] %>
@ -22,7 +22,7 @@
</div>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '输入关键字搜索') %>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with': '搜索中...') %>
<%= link_to "清除",admins_shixuns_path(status:nil,tag:nil,search_type:nil,keyword:nil),class: "btn btn-default" %>
<%= link_to "清除",admins_shixuns_path,class: "btn btn-default",id:"shixuns-clear-search",'data-disable-with': '清除中...' %>
<% end %>
<a href="javascript:void(0)" class="btn btn-primary" id="shixuns-export" data-disable-with = '导出中...'>导出</a>
</div>

@ -14,36 +14,40 @@
<th width="6%">操作</th>
</thead>
<tbody>
<% shixuns.each_with_index do |shixun,index| %>
<tr>
<td><%= (@params_page.to_i - 1) * 20 + index + 1%></td>
<td><%= shixun.identifier %></td>
<td class="text-left"><span><%= link_to overflow_hidden_span(shixun.name), "/shixuns/#{shixun.identifier}", :target => "_blank", :title => shixun.name %></span></td>
<td>
<%= shixun.shixun_main_name.nil? ? "--" : shixun.shixun_main_name %>
</td>
<td>
<% if shixun.try(:fork_from).nil? %>
--
<% else%>
<%= link_to shixun.try(:identifier), shixun_path(shixun.try(:identifier)), target: '_blank'%>
<% end%>
</td>
<td><%= shixun.challenges.where(:st => 0).size %></td>
<td><%= shixun.challenges.where(:st => 1).size %></td>
<td class="shixuns-status-<%= shixun.status %>"><%= shixun_authentication_status shixun %></td>
<td><%= link_to shixun.owner.try(:show_real_name),"/users/#{shixun.owner.try(:login)}",target:'_blank' %></td>
<td><%= format_time shixun.created_at %></td>
<td class="homepage_teacher">
<input type="checkbox" name="sigle_show" value="<%= shixun.id %>" <%= shixun.sigle_training ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_teacher_homepage_<%= shixun.id %>">
<label style="top:-14px;" class="ml20" for="join_teacher_homepage_<%= shixun.id %>"></label>
</td>
<td class="operate">
<% if shixun.status == 0 %>
<%= link_to(l(:button_delete), admins_shixun_path(shixun), :method => :delete, :data => { confirm: "您确定要删除吗?" } ) %>
<% end %>
</td>
</tr>
<% if shixuns.present? %>
<% shixuns.each_with_index do |shixun,index| %>
<tr>
<td><%= (@params_page.to_i - 1) * 20 + index + 1%></td>
<td><%= shixun.identifier %></td>
<td class="text-left"><span><%= link_to overflow_hidden_span(shixun.name), "/shixuns/#{shixun.identifier}", :target => "_blank", :title => shixun.name %></span></td>
<td>
<%= shixun.shixun_main_name.nil? ? "--" : shixun.shixun_main_name %>
</td>
<td>
<% if shixun.try(:fork_from).nil? %>
--
<% else%>
<%= link_to shixun.try(:identifier), shixun_path(shixun.try(:identifier)), target: '_blank'%>
<% end%>
</td>
<td><%= shixun.challenges.where(:st => 0).size %></td>
<td><%= shixun.challenges.where(:st => 1).size %></td>
<td class="shixuns-status-<%= shixun.status %>"><%= shixun_authentication_status shixun %></td>
<td><%= link_to shixun.owner.try(:show_real_name),"/users/#{shixun.owner.try(:login)}",target:'_blank' %></td>
<td><%= format_time shixun.created_at %></td>
<td class="homepage_teacher">
<input type="checkbox" name="sigle_show" value="<%= shixun.id %>" <%= shixun.sigle_training ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_teacher_homepage_<%= shixun.id %>">
<label style="top:-14px;" class="ml20" for="join_teacher_homepage_<%= shixun.id %>"></label>
</td>
<td class="operate">
<% if shixun.status == 0 %>
<%= link_to(l(:button_delete), admins_shixun_path(shixun), :method => :delete, :data => { confirm: "您确定要删除吗?" } ) %>
<% end %>
</td>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>

@ -1,4 +1,5 @@
json.status 0
json.message "调分成功"
json.work_score number_with_precision(@work.work_score, precision: 1)
json.challenge_score number_with_precision(@work.final_score, precision: 1)
json.challenge_score number_with_precision(@work.final_score, precision: 1)
json.overall_appraisal @work.overall_appraisal

@ -533,7 +533,7 @@ input::-ms-clear{display:none;}
.bor-grey-d{border:1px solid #ddd;}
.bor-grey01{border:1px solid #E6EAEB;}
.bor-blue{border:1px solid #5faee3;}
.bor-red{border:1px solid #db0505;}
.bor-red{border:1px solid #db0505 !important;}
.bor-none{border:none;}
.bor-outnone{outline:none; border:0px;}
/*延时*/

@ -536,7 +536,7 @@ input::-ms-clear{display:none;}
.bor-grey-d{border:1px solid #ddd;}
.bor-grey01{border:1px solid #E6EAEB;}
.bor-blue{border:1px solid #5faee3;}
.bor-red{border:1px solid #db0505;}
.bor-red{border:1px solid #db0505 !important;}
.bor-none{border:none;}
.bor-outnone{outline:none; border:0px;}
/*延时*/

@ -399,7 +399,6 @@ class App extends Component {
path="/interesse" component={Interestpage}
/>
<Route path="/shixuns/new" component={Newshixuns}>
</Route>

@ -398,11 +398,13 @@ class Eduinforms extends Component{
<div>
{
informs === null || informs=== undefined ||informs.length === 0 ?
this.state.yslbool===false?
<div className="alltask ">
<div className="edu-tab-con-box clearfix edu-txt-center"><img className="edu-nodata-img mb20"
src={getImageUrl("images/educoder/nodata.png")} />
<p className="edu-nodata-p mb20">暂时还没有相关数据哦</p></div>
</div>
:""
:
<div className="edu-back-white ">

@ -595,23 +595,25 @@ class studentsList extends Component{
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> }
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> }
<style>{`
.drop_down_menu li a {
padding: 0px;
font-size: 14px;
}
.drop_down_menu {
width: 93px;
}
.drop_down_menu li {
overflow: visible;
width: 93px;
}
.drop_down_menu, .drop_down_normal {
padding-top: 10px;
padding-bottom: 8px;
}
`}</style>
.drop_down_menu li a {
padding: 0px;
font-size: 14px;
}
.drop_down_menu {
width: 93px;
}
.drop_down_menu li {
overflow: visible;
width:100%;
box-sizing:boder-box;
float:unset;
}
.drop_down_menu, .drop_down_normal {
padding-top: 10px;
padding-bottom: 8px;
}
`}</style>
{ isAdmin &&
<li className="li_line drop_down fr color-blue font-16">
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>

@ -808,6 +808,7 @@ class CoursesNew extends Component {
],
})(
<Checkbox.Group style={{width: "800px", marginTop: "10px"}}>
<Checkbox value={"announcement"} className="fl">公告栏</Checkbox>
<Checkbox value={"shixun_homework"} className="fl">实训作业</Checkbox>
<Checkbox value={"common_homework"} className="fl">普通作业</Checkbox>
<Checkbox value={"group_homework"} className="fl">分组作业</Checkbox>
@ -869,14 +870,14 @@ class CoursesNew extends Component {
})(
<AutoComplete style={{ width: 280 }}
onSearch={this.handleSearchschool}
// onChange={this.handleChangeschools}
onInput={this.handleSearchschool}
className={"fl construction mr10 yslzxueshis2"}
placeholder="请输入并选择课本堂的所属单位"
dataSource={optionschool}
>
{optionschool}
</AutoComplete>
)}
<span className={"newcoursestitle fl"}>
<span className={"newcoursestitle fl"}>
{/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/}
</span>
<div id='isschool'></div>

@ -1026,10 +1026,11 @@ class Goldsubject extends Component {
<AutoComplete style={{ width: 280 }}
onSearch={this.handleSearchschool}
// onChange={this.handleChangeschools}
onInput={this.handleSearchschool}
className={"fl construction mr10 yslzxueshis2 "}
placeholder="请输入并选择课本堂的所属单位"
dataSource={optionschool}
>
{optionschool}
</AutoComplete>
)}
<span className={"newcoursestitle fl"}>

@ -812,6 +812,7 @@ class PollNew extends Component {
problemtopicbool: false,
bindingid:undefined,
Newdisplay:false,
newoption: false,
})
}else{
@ -821,6 +822,7 @@ class PollNew extends Component {
problemtopic: null,
problemtopicbool: false,
Newdisplay:false,
newoption: false,
})
}
@ -834,12 +836,13 @@ class PollNew extends Component {
q_countst: 1,
bindingid:undefined,
Newdisplay:false,
newoption: false,
})
}else {
this.setState({
q_countst: 1,
Newdisplay:false,
newoption: false,
})
}
@ -1350,6 +1353,7 @@ class PollNew extends Component {
}
this.setState({
Newdisplay:false,
newoption: false,
})
// console.log("deleteadddom 349")
var thiss = this;
@ -1752,7 +1756,7 @@ class PollNew extends Component {
question = {"question": questiontwo};
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 3, null, null, 0, 0,0,0);
this.edittotheserver(object, 3, null, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
@ -1799,27 +1803,49 @@ class PollNew extends Component {
var urlly = `/polls/${poll_id}/poll_questions.json`
var max_choicess = null;
var min_choicess = null;
if (max_choices === 0 && min_choices === 0) {
try {
if (max_choices === 0 && min_choices === 0) {
max_choicess = null;
min_choicess = null;
} else {
max_choicess = max_choices;
min_choicess = min_choices;
}
}catch (e) {
max_choicess = null;
min_choicess = null;
} else {
max_choicess = max_choices;
min_choicess = min_choices;
}
console.log("createquestionsandanswers");
console.log(max_choicess);
console.log(min_choicess);
console.log(length);
axios.post(urlly, {
// console.log("createquestionsandanswers");
// console.log(max_choicess);
// console.log(min_choicess);
// console.log(length);
var datay={};
datay={
question_title: object.question.question_title,
question_type: number,
is_necessary: object.question.is_necessary,
max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
question_answers: option,
question_other_answer: null,
insert_id: insert_id
}).then((result) => {
}
try {
if(number===2){
datay={
question_title: object.question.question_title,
question_type: number,
is_necessary: object.question.is_necessary,
max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
question_answers: option,
question_other_answer: null,
insert_id: insert_id
}
}
}catch (e) {
}
axios.post(urlly, datay).then((result) => {
// try {
if (result !== undefined) {
if (result.data.status === 0) {
@ -1852,27 +1878,50 @@ class PollNew extends Component {
var thiss = this;
var max_choicess = null;
var min_choicess = null;
if (max_choices === 0 && min_choices === 0) {
try {
if (max_choices === 0 && min_choices === 0) {
max_choicess = null;
min_choicess = null;
} else {
max_choicess = max_choices;
min_choicess = min_choices;
}
}catch (e) {
max_choicess = null;
min_choicess = null;
} else {
max_choicess = max_choices;
min_choicess = min_choices;
}
// console.log("createquestionsandanswers");
// console.log(max_choicess);
// console.log(min_choicess);
// console.log(length);
axios.put(url, {
var datay={};
datay={
// debug: true,
question_title: object.question.question_title,
question_type: number,
is_necessary: object.question.is_necessary,
max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
question_answers: option,
question_other_answer: null,
}).then((result) => {
};
try {
if(number===2){
datay={
// debug: true,
question_title: object.question.question_title,
question_type: number,
is_necessary: object.question.is_necessary,
max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
question_answers: option,
question_other_answer: null,
};
}
}catch (e) {
}
axios.put(url,datay).then((result) => {
try {
if (result.data.status === 0) {
this.props.showNotification(`编辑题目成功`);

@ -1,8 +1,9 @@
import React, {Component} from "react";
import {WordsBtn,markdownToHTML} from 'educoder';
import {WordsBtn,markdownToHTML,ActionBtn,queryString,downloadFile} from 'educoder';
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider,InputNumber, Tag,DatePicker,Radio,Tooltip,Spin} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom';
import axios from 'axios';
import ConclusionEvaluation from './shixunreport/ConclusionEvaluation';
import OfficialAcademicTranscript from './shixunreport/OfficialAcademicTranscript';
import Coursesshixundetails from './shixunreport/Coursesshixundetails';
@ -28,13 +29,25 @@ class ShixunWorkReport extends Component {
spinning:true,
DownloadType:false,
DownloadMessageval:undefined,
isspinning:false
}
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
/// 确认是否下载
confirmysl(url,child){
this.setState({ isspinning: true })
let params ={}
if(child!=undefined){
params =child._getRequestParams()!==undefined?child._getRequestParams():{};
}
console.log("170");
console.log(params);
const urll=url+`?${queryString.stringify(params)}`;
axios.get(urll+ '&export=true').then((response) => {
if(response===undefined){
return
}
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){
@ -54,13 +67,13 @@ class ShixunWorkReport extends Component {
}
}else {
this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank');
window.open("/api"+url+'?export=true', '_blank');
this.setState({ isspinning: false })
}
}).catch((error) => {
console.log(error)
});
}
Downloadcal=()=>{
this.setState({
DownloadType:false,
@ -69,11 +82,18 @@ class ShixunWorkReport extends Component {
}
componentDidMount() {
let query = this.props.location.pathname;
const type = query.split('/');
this.setState({
shixuntypes:type[3],
spinning:true
})
this.getdatalist()
}
getdatalist=()=>{
let homeworkid=this.props.match.params.homeworkid;
let url = `/student_works/${homeworkid}/shixun_work_report.json`
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) {
@ -90,11 +110,7 @@ class ShixunWorkReport extends Component {
spinning:false
})
})
let query = this.props.location.pathname;
const type = query.split('/');
this.setState({
shixuntypes:type[3]
})
}
jumptopic=(anchorName)=>{
; if (anchorName) {
@ -118,6 +134,17 @@ class ShixunWorkReport extends Component {
goback = () => {
this.props.history.replace(`/courses/${this.props.match.params.coursesId}/shixun_homeworks/${this.state.data.homework_common_id}/list?tab=0`);
}
setupdalist=(challenge_score,overall_appraisal,work_score)=>{
let {data}=this.state;
let newdata=data;
newdata.challenge_score=challenge_score;
newdata.overall_appraisal=overall_appraisal;
newdata.work_score=work_score;
this.setState({
data:newdata
})
}
render() {
let{data} =this.state;
console.log(data)
@ -156,9 +183,9 @@ class ShixunWorkReport extends Component {
{/*{this.props.isAdmin()?<a className=" fr font-14 ml30 mt10 mr20 color-grey-9 ">导出实训报告数据</a>:""}*/}
<a onClick={this.goback} className="color-grey-6 fr font-16 ml30 mt15 mr20">返回</a>
{this.props.isAdmin() ? <a
className=" color-blue font-16 fr ml30 mt15 mr20"
className=" color-blue font-16 fr ml30 mt15"
onClick={()=>this.confirmysl(`/student_works/${homeworkid}/export_shixun_work_report.pdf`)}
>导出实训报告数据</a> : ""}
> <Spin size="small" spinning={this.state.isspinning}>导出实训报告数据</Spin></a> : ""}
</div>
<div className="stud-class-set">
@ -182,6 +209,8 @@ class ShixunWorkReport extends Component {
{...this.props}
data={data}
jumptopic={this.jumptopic}
getdatalist={()=>this.getdatalist()}
setupdalist={(challenge_score,overall_appraisal,work_score)=>this.setupdalist(challenge_score,overall_appraisal,work_score)}
/>
</div>

@ -9,41 +9,12 @@ class OfficialAcademicTranscript extends Component {
super(props);
this.state = {
loadingstate:true,
datas:undefined
datas:undefined,
customsids:undefined
}
}
componentDidMount() {
}
myjumptopic=(e)=>{
console.log("获取到值");
console.log(e);
this.props.jumptopic(e);
}
editgame_scores=(score,id)=>{
if(score!=null&&score!=undefined){
let work_id=this.props.data.work_id;
let url=`/student_works/${work_id}/adjust_review_score.json`
axios.post(url,{
type:"report",
score:score,
challenge_id:id
}).then((result)=>{
if(result.data.status===0){
this.props.showNotification(result.data.message);
}else{
this.props.showNotification(result.data.message);
}
}).catch((error)=>{
})
}
}
render() {
let {data}=this.props;
let datas=[];
@ -62,8 +33,70 @@ class OfficialAcademicTranscript extends Component {
// adjustmentminute:asdasd
})
})
this.setState({
datas:datas
})
}
}
myjumptopic=(e)=>{
console.log("获取到值");
console.log(e);
this.props.jumptopic(e);
}
editgame_scores=(e,id,maxsum)=>{
let{datas}=this.state;
let newdatas=datas;
let score=e.target.value;
if(score!=null&&score!=undefined&&score!=""){
if(score<0){
this.props.showNotification("不能小于0");
this.setState({
customsids:id
})
}else if(score>maxsum){
this.props.showNotification(`不能大于关卡分值${maxsum}`);
this.setState({
customsids:id
})
}else{
let work_id=this.props.data.work_id;
let url=`/student_works/${work_id}/adjust_review_score.json`
axios.post(url,{
type:"report",
score:score,
challenge_id:id
}).then((result)=>{
if(result.data.status===0){
// this.props.getdatalist()
this.props.showNotification(result.data.message);
this.props.setupdalist(result.data.challenge_score,result.data.overall_appraisal,result.data.work_score)
newdatas.map((item,key)=>{
if(item.challenge_id.id===id){
item.game_scores.game_score=score
}
})
this.setState({
datas:newdatas,
customsids:undefined
})
}else{
this.props.showNotification(result.data.message);
}
}).catch((error)=>{
})
}
}else{
this.props.showNotification("调分为空将不会修改之前的分数");
}
}
render() {
let {datas,customsids}=this.state;
let columns=[{
title: '关卡',
@ -81,9 +114,11 @@ class OfficialAcademicTranscript extends Component {
className:"TaskForms",
render: (text, record) => (
<span>
<span className={"task-hide"} style={{color:"#676767"}}><a className="tasknameName font-14" onClick={()=>this.myjumptopic("id"+record.customs)} title={record.taskname.name} >
{record.taskname.name}{record.taskname.complete_status===2?<span className={"tasknamebox ml10"}>延时</span>:record.taskname.complete_status===3?<span className={"tasknameboxs ml10"}></span>:""}
</a></span>
<span className={"task-hide linhe15"} style={{color:"#676767"}}><a className="tasknameName font-14" onClick={()=>this.myjumptopic("id"+record.customs)} title={record.taskname.name.length>15?record.taskname.name:""} >
{record.taskname.name}
</a>
{record.taskname.complete_status===2?<span className={"tasknamebox ml10"}>延时</span>:record.taskname.complete_status===3?<span className={"tasknameboxs ml10"}></span>:""}
</span>
</span>
),
}, {
@ -156,9 +191,9 @@ class OfficialAcademicTranscript extends Component {
render: (text, record) => (
<span>
<a><InputNumber size="small" defaultValue={record.game_scores.game_score}
onChange={(e) => this.editgame_scores(e,record.challenge_id.id)}
min={0} max={record.game_scores.game_score_full}
<a><InputNumber size="small" className={customsids===record.challenge_id.id?"bor-red":""} defaultValue={record.game_scores.game_score}
onBlur={(e) => this.editgame_scores(e,record.challenge_id.id,record.game_scores.game_score_full)}
// min={0} max={record.game_scores.game_score_full}
/></a>
{/*<a style={{textAlign: "center"}} className="color-blue font-14 mr20">查看</a>*/}
</span>
@ -221,11 +256,11 @@ class OfficialAcademicTranscript extends Component {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 450px;
max-width: 225px;
text-align: left !important;
}
.TaskForms{
width: 450px;
max-width: 260px;
text-align: left !important;
padding: 16px !important;
}
@ -238,6 +273,9 @@ class OfficialAcademicTranscript extends Component {
border-radius: 0px;
width: 66px;
}
.linhe15{
line-height: 15px;
}
`}
</style>
{datas===undefined?"":<Table

@ -581,7 +581,7 @@ class TPMBanner extends Component {
return (
shixunsDetails===undefined?"":
<div>
<div className="shixunDetail">
<div className="shixunDetail_top">
{AccountProfiletype===true?<AccountProfile

@ -28,6 +28,8 @@ import TPMRanking_listComponent from './TPMRanking_listContainer'
import TPMCollaboratorsComponent from './TPMCollaboratorsContainer'
import '../page/tpiPage.css'
const $ = window.$
//任务
// const TPMChallengeComponent = Loadable({
// loader: () => import('./TPMChallengeContainer'),
@ -116,6 +118,13 @@ const TPMUpdatepropaede = Loadable({
})
// 版本库添加文件
const AddFile = Loadable({
loader: () => import('./shixunchild/Repository/RepositoryAddFile'),
loading: Loading,
})
const interceptorUrlArray = ['repository.json', 'commits.json', 'propaedeutics.json'
, 'challenges.json', 'discusses.json', 'ranking_list.json', 'collaborators.json']
const cacheInterceptorUrlMap = {}
@ -258,15 +267,18 @@ class TPMIndex extends Component {
// }
render() {
let url = window.location.href;
let flag = url.indexOf("add_file")>-1;
return (
<div className="newMain clearfix">
<TPMBanner
{...this.props}
{...this.state}
></TPMBanner>
{
!flag &&
<TPMBanner
{...this.props}
{...this.state}
></TPMBanner>
}
<Switch {...this.props}>
<Route path="/shixuns/:shixunId/repository/:repoId/commits" render={
@ -279,10 +291,15 @@ class TPMIndex extends Component {
/>)
}></Route>
<Route path="/shixuns/:shixunId/repository" render={
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
<Route path="/shixuns/:shixunId/repository/add_file" render={
(props) => (<AddFile {...this.props} {...this.state} {...props}
/>)
}></Route>
<Route path="/shixuns/:shixunId/repository" render={
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
{/* <Route exact path="/shixuns/:shixunId/propaedeutics" component={TPMPropaedeuticsComponent}></Route> */}
<Route exact path="/shixuns/:shixunId/propaedeutics" render={

@ -35,14 +35,14 @@ if (!window['indexHOCLoaded']) {
// $('head').append($('<link rel="stylesheet" type="text/css" />')
// .attr('href', `${_url_origin}/stylesheets/educoder/antd.min.css?1525440977`));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?8`));
.attr('href', `${_url_origin}/stylesheets/css/edu-common.css?6`));
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?8`));
.attr('href', `${_url_origin}/stylesheets/educoder/edu-main.css?6`));
// index.html有加载
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?8`));
.attr('href', `${_url_origin}/stylesheets/educoder/edu-all.css?6`));
// $('head').append($('<link rel="stylesheet" type="text/css" />')

@ -13,7 +13,9 @@ import axios from 'axios';
import { trace, trace_collapse ,getImageUrl, toPath} from "educoder";
import RepositoryDirectories from './RepositoryDirectories'
import RepositoryAddFile from './RepositoryAddFile'
import { ActionBtn , NoneData } from 'educoder'
const $ = window.$;
// 点击按钮复制功能
@ -47,8 +49,7 @@ class Repository extends Component {
if(this.props.author!=undefined){
userauthority=this.props.author.login===""||this.props.author.user_id===""||this.props.author.login===null||this.props.author.user_id===null;
}
// console.log(commits)
return (
<React.Fragment>
{/* jfinalshop/WebRoot */}
@ -83,7 +84,12 @@ class Repository extends Component {
<a href="/forums/2784" target="_blank"
className=" guideBtn" >Git使用指南</a>
{/* <RepositoryAddFile {...this.props} {...this.state}></RepositoryAddFile> */}
{
this.props.current_user && this.props.current_user.admin ==true ?
<ActionBtn style="orangeLine" className="ml20" to={`/shixuns/${match.params.shixunId}/repository/add_file`}>+添加文件</ActionBtn>:""
}
<div className="fr font-12 color-grey-9 pr">
<label className="fl mt2">网址克隆</label>
<input type="text" id="copy_rep_content" className="fl url-input mt2"
@ -162,12 +168,7 @@ class Repository extends Component {
</style>
{/* 用户、最近提交时间 */}
{
trees === undefined || trees === null ? <div className="alltask">
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">暂时还没有相关数据哦</p>
</div>
</div> :
trees === undefined || trees === null ? <NoneData></NoneData>:
<div>
<div className="edu-back-skyblue padding10-20 clearfix">
<img alt={author.name} className="radius fl mr10"

@ -1,49 +1,194 @@
import React, { Component } from 'react';
import { ActionBtn } from 'educoder'
import { Form , Modal } from 'antd'
import { Form , Modal , Input , Breadcrumb , Button } from 'antd'
import { Link } from 'react-router-dom'
import axios from 'axios'
/**
---------------------------- START
*/
function getModeByMirrorName(mirror_name) {
let mode = 'javascript'
if (mirror_name && mirror_name.length) {
for (let i = 0; i < mirror_name.length; i++) {
let modeVal = mirrorNameModeMap[mirror_name[i]];
if (modeVal) {
mode = modeVal;
break;
}
}
}
return mode;
}
const _extraKeys = {"Alt-/": "autocomplete"};
function createCMOptions(mirror_name) {
let mode = getModeByMirrorName(mirror_name)
let cmOptions = {
lineNumbers: true,
mode: mode,
theme: "railscasts",
indentUnit:4,
matchBrackets: true,
autoRefresh: true,
smartIndent: true,//智能换行
extraKeys: _extraKeys,
autofocus: true,
styleActiveLine: true,
lint: true,
gutters: ["CodeMirror-linenumbers", "breakpoints", "CodeMirror-lint-markers"]
};
return cmOptions;
}
const mirrorNameModeMap = {
'JFinal': 'text/x-java',
'Java': 'text/x-java',
'Kotlin': 'text/x-kotlin',
'C/C++' : 'text/x-c++src',
'MachineLearning': {
name: "python",
version: 3,
singleLineStringErrors: false
},
'Python2.7': {
name: "python",
version: 3,
singleLineStringErrors: false
},
'Python3.6': {
name: "python",
version: 3,
singleLineStringErrors: false
},
}
/**
---------------------------- END
*/
class RepositoryAddFile extends Component {
constructor(props) {
super(props);
this.state={
visible:false
}
}
addFile = () =>{
this.setState({
visible:true
})
componentDidMount(){
let cmOptions = createCMOptions(this.props.mirror_name)
const extend_editor = window.CodeMirror.fromTextArea(window.$('#codemirror-file-edit')[0]
, cmOptions);
// tpi没setValue也可以
extend_editor.setValue('')
extend_editor.refresh();
// 拖拽也需要用 window.editor_CodeMirror.refresh()
window.editor_tempCodeMirror = extend_editor;
this.extend_editor = extend_editor;
}
cancelAdd = () =>{
this.setState({
visible:false
checkPath= (rule, value, callback) =>{
if (value.indexOf("/") > -1 && value.length==1 ) {
callback('请输入正确的文件路径');
}else{
callback();
}
}
handleSubmit = () =>{
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
let shixunId = this.props.match.params.shixunId;
let url = `/shixuns/${shixunId}/add_file.json`
axios.post(url,{
path:values.path,
message:values.message,
content:this.extend_editor.getValue()
}).then((result)=>{
if(result){
this.props.history.push(`${result.data.url}`)
}
}).catch((error)=>{
console.log(error);
})
}
})
}
render(){
let { visible } = this.state
const {getFieldDecorator} = this.props.form;
let { shixunId } = this.props.match.params;
return(
<React.Fragment>
<ActionBtn style="orangeLine" className="ml20" onClick={this.addFile}>+添加文件</ActionBtn>
<Modal
className={"RepositioryModal"}
title={'添加文件'}
visible={visible}
closable={false}
footer={null}
destroyOnClose={true}
width="550px"
>
<div className="task-popup-content">
<div className="educontent">
<style>
{`
.formStyle .ant-form-item{
margin-bottom:10px!important;
}
.formStyle .ant-col.ant-form-item-label{
margin-left:-10px;
line-height:30px;
margin-bottom:10px;
}
.breadcrumb .ant-breadcrumb-separator{
margin:0px 2px;
}
/*.filecode .CodeMirror.cm-s-railscasts{
border:1px solid #E5E5E5;
}
.filecode .CodeMirror.cm-s-railscasts .CodeMirror-sizer,.filecode .CodeMirror-gutters,.filecode .CodeMirror-scroll{
background:#fff;
}
.filecode .CodeMirror-linenumber{
text-align:center
}*/
`}
</style>
<p className="mt10 mb10">
<Breadcrumb separator='>' className="breadcrumb">
<Breadcrumb.Item href='/shixuns'>实训项目</Breadcrumb.Item>
<Breadcrumb.Item href={`/shixuns/${shixunId}/repository`}>版本库</Breadcrumb.Item>
<Breadcrumb.Item>添加新文件</Breadcrumb.Item>
</Breadcrumb>
</p>
<Form onSubmit={this.handleSubmit} className="formStyle">
<div className="edu-back-white padding20-30 mb10">
<Form.Item label="文件名">
{getFieldDecorator('path', {
rules: [
{required: true, message: "文件名不能为空"},
{
validator:this.checkPath
}]
})(
<Input placeholder="输入文件路径名src/HelloWord.java" className="winput-300-35 fl"/>
)}
</Form.Item>
</div>
<div className="edu-back-white padding30">
<p className="ant-form-item-label">
<label>内容</label>
</p>
<div className="mt10 mb25 repoCMWrapper filecode">
<textarea className="" id="codemirror-file-edit" style={{display:'none'}} name="content"></textarea>
</div>
<Form.Item label="提交信息">
{getFieldDecorator('message', {
rules: [{required: true, message: "请输入提交信息"}],
})(
<textarea className="winput-100-130 fl"></textarea>
)}
</Form.Item>
</div>
<div className="clearfix mt30 edu-txt-center mb10">
<a className="task-btn color-white mr30" onClick={this.cancelAdd}>取消</a>
<a className="task-btn task-btn-orange">提交</a>
<div className="clearfix mt30 edu-txt-right mb30">
<Button type="primary" className="defalutSubmitbtn fr ml20" onClick={this.handleSubmit}>提交</Button>
<Link className="defalutCancelbtn fr" to={`/shixuns/${shixunId}/repository`}>取消</Link>
</div>
</Modal>
</React.Fragment>
</Form>
</div>
)
}
}

@ -526,7 +526,7 @@ input::-ms-clear{display:none;}
.bor-grey01{border:1px solid #E6EAEB;}
.bor-orange{border:1px solid #FF7500;}
.bor-blue{border:1px solid #5faee3;}
.bor-red{border:1px solid #db0505;}
.bor-red{border:1px solid #db0505 !important;}
.bor-none{border:none;}
.bor-outnone{outline:none; border:0px;}
/*延时*/

@ -347,7 +347,7 @@ a.edu-txt-w40,.edu-txt-w40{ width:40px; display: inline-block;text-align: center
.bor-grey01{border:1px solid #E6EAEB;}
.bor-orange{border:1px solid #FF7500;}
.bor-blue{border:1px solid #5faee3;}
.bor-red{border:1px solid #db0505;}
.bor-red{border:1px solid #db0505 !important;}
.bor-none{border:none;}
.bor-outnone{outline:none; border:0px;}

Loading…
Cancel
Save