合并阿里云

dev_local_2
杨树林 5 years ago
commit a90ef4becf

@ -324,7 +324,7 @@ class GraduationTasksController < ApplicationController
tip_exception("缺少截止时间参数") if params[:end_time].blank?
tip_exception("截止时间必须晚于当前时间") if params[:end_time] <= strf_time(Time.now)
tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
@course.end_date.present? && params[:end_time] > @course.end_date.end_of_day
@course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
# ActiveRecord::Base.transaction do
begin
@ -401,7 +401,7 @@ class GraduationTasksController < ApplicationController
tip_exception("截止时间不能早于当前时间") if params[:end_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S")
tip_exception("截止时间不能早于发布时间") if params[:publish_time] > params[:end_time]
tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
@course.end_date.present? && params[:end_time] > @course.end_date.end_of_day
@course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
@task.publish_time = params[:publish_time]
@task.end_time = params[:end_time]
@ -414,7 +414,7 @@ class GraduationTasksController < ApplicationController
tip_exception("截止时间不能为空") if params[:end_time].blank?
tip_exception("截止时间不能早于当前时间") if params[:end_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S")
tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
@course.end_date.present? && params[:end_time] > @course.end_date.end_of_day
@course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day)
@task.end_time = params[:end_time]
end
@ -426,7 +426,7 @@ class GraduationTasksController < ApplicationController
tip_exception("补交结束时间不能为空") if params[:late_time].blank?
tip_exception("补交结束时间不能早于截止时间") if params[:late_time] <= @task.end_time
tip_exception("补交结束时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
@course.end_date.present? && params[:late_time] > @course.end_date.end_of_day
@course.end_date.present? && params[:late_time] > strf_time(@course.end_date.end_of_day)
tip_exception("迟交扣分应为正整数") if params[:late_penalty] && params[:late_penalty].to_i < 0
@task.allow_late = true

@ -271,7 +271,11 @@ class MyshixunsController < ApplicationController
unless @hide_code || @myshixun.shixun&.vnc_evaluate
# 远程版本库文件内容
last_content = GitService.file_content(repo_path: @repo_path, path: path)["content"]
content = params[:content]
content = if @myshixun.mirror_name.select {|a| a.include?("MachineLearning") || a.include?("Python")}.present? && params[:content].present?
params[:content].gsub(/\t/, ' ').gsub(/ /, ' ') # 这个不是空格在windows机器上带来的问题
else
params[:content]
end
Rails.logger.info("###11222333####{content}")
Rails.logger.info("###222333####{last_content}")

@ -264,8 +264,9 @@ class QuestionBanksController < ApplicationController
# new_exercise.create_exercise_list
# exercise.update_column(:quotes, exercise.quotes+1)
# end
new_exercise if new_exercise.save!
new_exercise.save!
exercise.update_column(:quotes, exercise.quotes+1)
new_exercise
end
end
@ -292,8 +293,9 @@ class QuestionBanksController < ApplicationController
# new_poll.create_polls_list
# poll.update_column(:quotes, poll.quotes+1)
# end
new_poll if new_poll.save!
new_poll.save!
poll.update_column(:quotes, poll.quotes+1)
new_poll
end
end

@ -81,7 +81,7 @@ module TidingDecorator
end
def student_join_course_content
I18n.t(locale_format) % Course.find_by(id: container_id)&.name
I18n.t(locale_format) % [trigger_user.show_real_name, Course.find_by(id: container_id)&.name]
end
def teacher_join_course_content

@ -46,8 +46,7 @@ class Subject < ApplicationRecord
# 挑战过路径的成员数(金课统计去重后的报名人数)
def member_count
excellent && CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).length > shixuns.pluck(:myshixuns_count).sum ?
CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).length : shixuns.pluck(:myshixuns_count).sum
excellent ? CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).length : shixuns.pluck(:myshixuns_count).sum
end
def all_score

@ -22,4 +22,9 @@ class Tiding < ApplicationRecord
value
end
def anonymous?
(container_type == 'StudentWorksScore' && extra.to_i == 3) ||
(container_type == 'StudentWorksScoresAppeal' && parent_container_type == 'StudentWork' && tiding_type == 'System')
end
end

@ -1,6 +1,6 @@
class UserExtension < ApplicationRecord
# identity 0: 教师教授 1: 学生, 2: 专业人士, 3: 开发者
enum identity: { teacher: 0, student: 1, professional: 2, developer: 3, cnmooc: 4, unselect: -1 }
enum identity: { teacher: 0, student: 1, professional: 2, developer: 3, enterprise: 4, unselect: -1 }
belongs_to :user, touch: true
belongs_to :school, optional: true

@ -17,8 +17,11 @@ json.homework_type homework_type
json.time tiding.how_long_time
json.new_tiding tiding.unread?(@onclick_time)
# 需要系统头像
show_system_user = tiding.trigger_user_id.zero? || tiding.tiding_type == 'System' || tiding.anonymous?
json.trigger_user do
if tiding.trigger_user_id.zero? || (tiding.trigger_user_id == 1 && tiding.tiding_type == 'System')
if show_system_user
json.id 0
json.name "系统"
json.login ""

@ -19,7 +19,7 @@
"9_2_end": "你提交的加入课堂申请:%s教师, 审核未通过"
"7_1_end": "你提交的加入课堂申请:%s助教, 审核已通过"
"7_2_end": "你提交的加入课堂申请:%s助教, 审核未通过"
StudentJoinCourse_end: "加入了课堂:%s学生"
StudentJoinCourse_end: "%s 加入了课堂:%s学生"
TeacherJoinCourse:
"2_end": "%s将你加入课堂%s教师"
"3_end": "%s将你加入课堂%s助教"
@ -202,6 +202,7 @@
2_end: "别人对你的匿评发起的申诉申请:%s审核未通过"
StudentWork:
Apply_end: "发起了匿评申诉申请:%s"
HomeworkCommon_end: "发起了匿评申诉申请:%s"
System_end: "有人对你的匿评发起了申诉:%s"
Department_end: "你选填的二级单位:%s%s因不符合规范,已被系统删除.请重新选择"
Library:

@ -13,7 +13,9 @@
professional: 专业人士
developer: 从业者
enterprise: 组织
unselect: 未选择
"0": 教师
"1": 学生
"2": 专业人士
"3": 专业人士
"3": 从业者
"4": 组织

@ -81,8 +81,10 @@ namespace :public_classes do
homework.update_columns(publish_time: publish_time, end_time: end_time, created_at: created_at, updated_at: updated_at)
homework.homework_detail_manual.update_columns(comment_status: 6, created_at: created_at, updated_at: updated_at)
homework.update_homework_work_score
homework.update_attribute('calculation_time', end_time)
homework.student_works.where("work_status !=0 and update_time > '#{end_time}'").update_all(update_time: end_time)
# homework.student_works.where("work_status !=0 and update_time > '#{end_time}'").update_all(update_time: end_time)
end
when 3
# 试卷

File diff suppressed because one or more lines are too long

@ -1,5 +1,5 @@
'use strict';
// extract-css-assets-webpack-plugin
const autoprefixer = require('autoprefixer');
const path = require('path');
const webpack = require('webpack');

File diff suppressed because one or more lines are too long

@ -34,8 +34,9 @@
// location.href = './compatibility'
location.href = '/compatibility.html'
}
const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
if (isMobile) {
// const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
const isWeiXin = (/MicroMessenger/i.test(navigator.userAgent.toLowerCase()));
if (isWeiXin) {
document.write('<script type="text/javascript" src="/javascripts/wx/jweixin-1.3.0.js"><\/script>');
}
</script>

@ -9,8 +9,8 @@ import {
Route,
Switch
} from 'react-router-dom';
import axios from 'axios';
import '@icedesign/base/dist/ICEDesignBase.css';
import '@icedesign/base/dist/ICEDesignBase.css';
import '@icedesign/base/index.scss';
@ -37,7 +37,7 @@ import {MuiThemeProvider, createMuiTheme} from 'material-ui/styles';
import history from './history';
import {SnackbarHOC, configShareForIndex} from 'educoder'
import {SnackbarHOC} from 'educoder'
import {initAxiosInterceptors} from './AppConfig'
@ -298,61 +298,7 @@ class App extends Component {
mydisplay:true,
})
};
initWXShare = () => {
if (window.wx) {
const wx = window.wx
const url = '/wechats/js_sdk_signature.json'
const currentUrl = window.location.href.split('#')[0]
// window.encodeURIComponent()
axios.post(url, {
url: window.__testUrl || currentUrl,
}).then((response) => {
console.log('got res')
const data = response.data;
wx.config({
debug: false,
appId: data.appid,
timestamp: data.timestamp,
nonceStr: data.noncestr,
signature: data.signature,
jsApiList: [
'onMenuShareTimeline',//
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'onMenuShareQZone'
]
});
wx.ready(function () {
console.log('wx is ready')
// var shareData = {
// title: 'EduCoder - 首页',
// desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台提供企业级工程实训以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动将传统的知识传授和时兴的工程实战一体化。',
// link: currentUrl,
// imgUrl: window.__testImageUrl
// || (currentUrl.endsWith('/') ? currentUrl : currentUrl + '/') + 'react/build/images/share_logo_icon.jpg'
// };
// wx.onMenuShareAppMessage(shareData);//分享给好友
// wx.onMenuShareTimeline(shareData);//分享到朋友圈
// wx.onMenuShareQQ(shareData);//分享给手机QQ
// wx.onMenuShareWeibo(shareData);//分享腾讯微博
// wx.onMenuShareQZone(shareData);//分享到QQ空间
configShareForIndex('/')
});
wx.error(function (res) {
console.log('wx is error')
console.log(res)
//alert(res.errMsg);//错误提示
});
}).catch((error) => {
console.log(error)
})
}
}
disableVideoContextMenu = () => {
window.$( "body" ).on( "mousedown", "video", function(event) {
if(event.which === 3) {
@ -374,7 +320,6 @@ class App extends Component {
});
initAxiosInterceptors(this.props)
this.initWXShare()
//
// axios.interceptors.response.use((response) => {
// // console.log("response"+response);

@ -4,3 +4,5 @@ export function isDev() {
// const isMobile
export const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
// const isWeiXin = (/MicroMessenger/i.test(navigator.userAgent.toLowerCase()));

@ -1,3 +1,4 @@
import axios from 'axios'
const host = window.location.protocol + '//' + window.location.host
const wx = window.wx
function share(shareData) {
@ -11,7 +12,51 @@ function share(shareData) {
console.log(e)
}
}
const urlDoneMap = {}
function requestForSignatrue (callback) {
const currentUrl = window.location.href.split('#')[0]
if (window.wx) {
if (urlDoneMap[currentUrl]) {
callback && callback()
} else {
const wx = window.wx
const url = '/wechats/js_sdk_signature.json'
urlDoneMap[currentUrl] = true
// window.encodeURIComponent()
axios.post(url, {
url: window.__testUrl || currentUrl,
}).then((response) => {
console.log('got res')
const data = response.data;
wx.config({
debug: false,
appId: data.appid,
timestamp: data.timestamp,
nonceStr: data.noncestr,
signature: data.signature,
jsApiList: [
'onMenuShareTimeline',//
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'onMenuShareQZone'
]
});
wx.ready(function () {
callback && callback()
});
wx.error(function (res) {
console.log('wx is error')
console.log(res)
//alert(res.errMsg);//错误提示
});
}).catch((error) => {
console.log(error)
})
}
}
}
/**
实践课程 平台提供涵盖基础入门案例实践和创新应用的完整实训项目体系通过由浅入深的实训路径帮助学生快速提升实战能力
实训项目 覆盖不同专业的IT实验和实训每周更新无需配置本机实验环境随时随地开启企业级真实实训
@ -20,66 +65,71 @@ function share(shareData) {
*/
export function configShareForIndex (path) {
if (!wx) return;
var shareData = {
title: 'EduCoder - 首页',
desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台提供企业级工程实训以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动将传统的知识传授和时兴的工程实战一体化。',
link: host + (path || ''),
imgUrl: window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
requestForSignatrue(() => {
var shareData = {
title: 'EduCoder - 首页',
desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台提供企业级工程实训以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动将传统的知识传授和时兴的工程实战一体化。',
link: host + (path || ''),
imgUrl: window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
})
}
export function configShareForPaths () {
if (!wx) return;
console.log('configShareForPaths', host)
var shareData = {
title: 'EduCoder - 实践课程',
desc: '平台提供涵盖基础入门、案例实践和创新应用的完整实训项目体系,通过由浅入深的实训路径,帮助学生快速提升实战能力。',
link: `${host}/paths`,
imgUrl: window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
requestForSignatrue(() => {
console.log('configShareForPaths', host)
var shareData = {
title: 'EduCoder - 实践课程',
desc: '平台提供涵盖基础入门、案例实践和创新应用的完整实训项目体系,通过由浅入深的实训路径,帮助学生快速提升实战能力。',
link: `${host}/paths`,
imgUrl: window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
})
}
export function configShareForShixuns () {
if (!wx) return;
console.log('configShareForShixuns', host)
requestForSignatrue(() => {
console.log('configShareForShixuns', host)
var shareData = {
title: 'EduCoder - 实训项目',
desc: '覆盖不同专业的IT实验和实训每周更新无需配置本机实验环境随时随地开启企业级真实实训。',
link: `${host}/shixuns`,
imgUrl: window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
var shareData = {
title: 'EduCoder - 实训项目',
desc: '覆盖不同专业的IT实验和实训每周更新无需配置本机实验环境随时随地开启企业级真实实训。',
link: `${host}/shixuns`,
imgUrl: window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
})
}
export function configShareForCourses () {
if (!wx) return;
console.log('configShareForCourses', host)
requestForSignatrue(() => {
console.log('configShareForCourses', host)
var shareData = {
title: 'EduCoder - 翻转课堂',
desc: '自动评测实训任务,支持技能统计,提供教学活动分析报告,减轻教师和助教的辅导压力,免去作业发布和批改的困扰,实时了解学生学习情况,全面提升教师施教效率和水平。',
link: `${host}/courses`,
imgUrl: window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
var shareData = {
title: 'EduCoder - 翻转课堂',
desc: '自动评测实训任务,支持技能统计,提供教学活动分析报告,减轻教师和助教的辅导压力,免去作业发布和批改的困扰,实时了解学生学习情况,全面提升教师施教效率和水平。',
link: `${host}/courses`,
imgUrl: window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
})
}
// detail
export function configShareForCustom (title, desc, path, imgUrl) {
if (!wx) return;
console.log('configShareForCustom', host)
var shareData = {
title: title,
desc: desc,
link: `${host}/${path}`,
imgUrl: imgUrl || window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
export function configShareForCustom (title, desc, imgUrl, path) {
requestForSignatrue(() => {
console.log('configShareForCustom', host)
const _path = window.location.href.split('#')[0];
var shareData = {
title: title,
desc: desc,
link: `${host}/${path || _path}`,
imgUrl: imgUrl || window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
})
}

@ -68,7 +68,7 @@ class CommentInput extends Component {
</textarea>
</div>
<div className="tips"
style={{ 'float': 'left', 'margin-top': '6px', 'font-size': '12px', 'color': '#ff6800'}}>
style={{ 'float': 'left', 'marginTop': '6px', 'fontSize': '12px', 'color': '#ff6800'}}>
请勿粘贴答案否则将造成账号禁用等后果
</div>
<div className="fr buttons" style={{ minWidth:'25px', height: '32px' }}>

@ -141,7 +141,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV
$("#" + _id + " [type=\"inline\"]").bind("click", function () {
_editorName.cm.replaceSelection("`$$$$`");
var __Cursor = _editorName.cm.getDoc().getCursor();
_editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
_editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
_editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");

@ -78,7 +78,7 @@ class NewShixunModel extends Component{
{item.map((list,key)=>{
return(
<Menu.Item key={key} id={list.id}>
<a target="_blank" href={`/paths/${list.id}`} className={"newshixun500"} title={list.name}>{list.name}</a>
<a target="_blank" href={`/paths/${list.id}`} className={"newshixun500"}>{list.name}</a>
</Menu.Item>
)
})}
@ -340,26 +340,45 @@ class NewShixunModel extends Component{
`body{ overflow: hidden !important; }
.ant-drawer-content{ overflow:auto !important; background: #f5f5f5; }
.yslbottomsj{position: absolute;bottom: -8px;}
.ant-drawer-close{
font-size:24px !important;
}
.ant-drawer-body {
padding:15px 24px 24px 0px;
}
`
}
</style>
<Drawer
placement="bottom"
closable={false}
closable={true}
destroyOnClose={true}
onClose={()=>this.props.hideNewShixunModelType()}
visible={this.props.NewShixunModelType}
height={'100%'}
>
<Spin spinning={this.state.isspinning}>
<div className={"clearfix educontent pr"}>
<div className={"clearfix educontent pr mb60shixun"}>
<div className={"square-list clearfix"}>
<div className="newshixunheadersear">
<div style={{height:"53px"}}></div>
<style>
{
`
.ant-input, .ant-input .ant-input-suffix{
background-color: #fff !important;
}
.packinput .ant-input{
border: 1px solid rgba(217,217,217,1) !important;
}
`
}
</style>
<Search
style={{ width: "800px"}}
style={{ width: "780px"}}
className="packinput"
placeholder="实训信息 / 院校名称 / 创建者"
value={this.state.keyword}
@ -378,8 +397,8 @@ class NewShixunModel extends Component{
<span className="fl color-grey-9 pointer mr30">
<a className={" color-grey-6"} onClick={()=>this.updatedlist(order)}>学习人数</a>
<sapn className="relativef ml5 " >
<i className={order==="desc"?"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9"}></i>
<i className={order==="asc"?"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9"}></i>
<i className={order==="asc"?"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-up font-12 ntopsj color-grey-9"}></i>
<i className={order==="desc"?"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9 color-blue":"iconfont icon-sanjiaoxing-down font-12 nyslbottomsj color-grey-9"}></i>
</sapn>
</span>
@ -397,8 +416,8 @@ class NewShixunModel extends Component{
</div>
<div className="font-12 alltopiscright ml25 fr">
<span className={"fr pointer color-grey-3"} onClick={()=>this.props.hideNewShixunModelType()}>返回</span>
<span className={type==="mine"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 pointer color-grey-3"} onClick={()=>this.belongto("mine")}>我的实训</span>
{/*<span className={"fr pointer color-grey-3"} onClick={()=>this.props.hideNewShixunModelType()}>返回</span>*/}
<span className={type==="mine"?"fr topcsactive pointer color-grey-3 color-blue":"fr pointer color-grey-3"} onClick={()=>this.belongto("mine")}>我的实训</span>
<span className={type==="all"?"fr mr30 topcsactive pointer color-grey-3 color-blue":"fr mr30 pointer color-grey-3"} onClick={()=>this.belongto("all")}>全部实训</span>
</div>
@ -409,7 +428,7 @@ class NewShixunModel extends Component{
{shixun_list===undefined?"":shixun_list.length===0?"":shixun_list.map((item,key)=>{
return(
<div className="mt20 edu-back-white pd20 relativef newshixunlist" key={key}>
<div className="mt10 edu-back-white pd20 relativef newshixunlist" key={key}>
<div className="clearfix">
<div className="item-body">
<div className="clearfix ds pr contentSection">
@ -419,7 +438,7 @@ class NewShixunModel extends Component{
className="fl task-hide edu-txt-left mt3"
name="shixun_homework[]"
></Checkbox>
<a target="_blank" href={`/shixuns/${item.identifier}/challenges`} title={item.title} className="ml15 fl font-16 color-dark maxwidth1100"
<a target="_blank" href={`/shixuns/${item.identifier}/challenges`} className="ml15 fl font-16 color-dark maxwidth1100"
dangerouslySetInnerHTML={{__html: item.title}}
>
</a>
@ -439,7 +458,7 @@ class NewShixunModel extends Component{
`
}
</style>
{JSON.stringify(item.description) == "{}"?"":<div className="newshixunmodelmidfont newradioStyles" title={item.description} dangerouslySetInnerHTML={{__html: item.description}}>
{JSON.stringify(item.description) == "{}"?"":<div className="newshixunmodelmidfont newradioStyles" dangerouslySetInnerHTML={{__html: item.description}}>
</div>}
{item.challenge_names.length===0?"":<div className="newshixunmodelbotfont">
@ -511,15 +530,21 @@ class NewShixunModel extends Component{
:shixun_list.length===0? <NoneData></NoneData>:""
}
{
shixun_list===undefined?"":shixun_list.length===0?"":<div className={" edu-txt-center padding20-30"}>
<Button className={"mr20 newshixunmode"} onClick={()=>this.props.hideNewShixunModelType()}>取消</Button>
<Button className={"newshixunmode"} type="primary" onClick={()=>this.savecouseShixunModal()} loading={this.state.hometypepvisible}>确定</Button>
</div>}
</div>
</div>
<div className="clearfix bor-bottom-greyE edu-back-white orderingbox newshixunbottombtn"
>
{
shixun_list===undefined?"":shixun_list.length===0?"":<div className={" edu-txt-center padding13-30"}>
<Button className={"mr20 newshixunmode"} onClick={()=>this.props.hideNewShixunModelType()}>取消</Button>
<Button className={"newshixunmode mr40"} type="primary" onClick={()=>this.savecouseShixunModal()} loading={this.state.hometypepvisible}>确定</Button>
</div>}
</div>
</Spin>
</Drawer>
</div>

@ -195,7 +195,7 @@
width: 100px;
height: 38px;
border-radius: 3px;
border: 1px solid rgba(191,191,191,1);
/*border: 1px solid rgba(191,191,191,1);*/
}
.ntopsj {
@ -248,3 +248,22 @@
color: #4CACFF;
}
.newshixunbottombtn{
position: fixed;
z-index: 1000;
bottom: 0px;
width: 100%;
height: 63px;
background: rgba(255,255,255,1);
box-shadow: 0px -4px 4px 0px rgba(0,0,0,0.05);
}
.mb60shixun{
margin-bottom: 60px !important;
}
.padding13-30 {
padding: 13px 30px;
box-sizing: border-box;
}

@ -182,6 +182,10 @@ class SingleEditor extends Component{
this.setState({ standard_answers })
}
onOptionContentChange = (value, index) => {
if (index >= this.state.question_choices.length) {
// TODO 新建然后删除CD选项再输入题干会调用到这里且index是3
return;
}
let question_choices = this.state.question_choices.slice(0);
question_choices[index] = value;
this.setState({ question_choices })

@ -35,10 +35,15 @@ class ShixunWorkDetails extends Component {
}
}).then((result) => {
if (result.status === 200) {
this.setState({
data:result.data,
spinning:false
})
if (result.data.status === 403 || result.data.status === 401 || result.data.status === 407 || result.data.status === 408|| result.data.status === 409 || result.data.status === 500) {
}else{
this.setState({
data:result.data,
spinning:false
})
}
}
}).catch((error) => {
console.log(error)
@ -50,7 +55,33 @@ class ShixunWorkDetails extends Component {
shixuntypes:type[3]
})
}
updatas=()=>{
this.setState({
spinning:true
})
let homeworkid=this.props.match.params.homeworkid;
let userid=this.props.match.params.userid;
let url = "/homework_commons/"+homeworkid+"/code_review_detail.json";
axios.get(url,{
params: {
user_id:userid,
}
}).then((result) => {
if (result.status === 200) {
if (result.data.status === 403 || result.data.status === 401 || result.data.status === 407 || result.data.status === 408|| result.data.status === 409 || result.data.status === 500) {
}else{
this.setState({
data:result.data,
spinning:false
})
}
}
}).catch((error) => {
console.log(error)
})
}
goback=(sum)=>{
// let{data}=this.state
// if(sum===1){
@ -102,14 +133,18 @@ class ShixunWorkDetails extends Component {
<span className="fl color-orange font-14">非编程类型任务不参与查重</span>
<span className="fr mt4">
<span className={"color656565"}>被查作品</span>
<span className={"mr20"}>{data&&data.username}</span>
<span className={"color-orange"}>{data&&data.final_score}</span>
<span className={"mr50"}><span className={"color-orange"}>{data&&data.username}</span></span>
{data&&data.eff_score===null||data&&data.eff_score===undefined||data&&data.eff_score_full===null||data&&data.eff_score_full===undefined?"":<span className={"mr50"}>效率分<span className={"color-orange"}>{data&&data.eff_score}</span>/{data&&data.eff_score_full}</span>}
<span className={""}>最终成绩<span className={"color-orange"}>{data&&data.final_score}</span></span>
</span>
</div>
<div className="stud-class-set bor-bottom-greyE">
<div className="clearfix edu-back-white poll_list">
<ShixunCustomsPass
{...this.props}
{...this.state}
updatas={()=>this.updatas()}
data={data}
/>
</div>

@ -1,10 +1,10 @@
import React, {Component} from "react";
import {WordsBtn} from 'educoder';
import {Table} from "antd";
import {Table,InputNumber} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom';
import moment from 'moment';
import { MonacoDiffEditor } from 'react-monaco-editor';
import axios from 'axios';
class ShixunCustomsPass extends Component {
constructor(props) {
@ -18,10 +18,51 @@ class ShixunCustomsPass extends Component {
componentDidMount() {
}
editgame_scores=(e,id,maxsum,code_rate,copy_user_id)=>{
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:"review",
score:score,
challenge_id:id,
code_rate:code_rate,
copy_user_id:copy_user_id
}).then((result)=>{
if(result.data.status===0){
this.props.updatas();
this.props.showNotification(result.data.message);
}else{
this.props.showNotification(result.data.message);
}
}).catch((error)=>{
})
}
}else{
this.props.showNotification("调分为空将不会修改之前的分数");
}
}
render() {
let {data}=this.props;
console.log(data)
let {customsids}=this.state;
// console.log(data)
let datas=[];
data&&data.challenge_list.forEach((item,key)=>{
@ -33,6 +74,8 @@ class ShixunCustomsPass extends Component {
finishtime:item.copy_username,
elapsedtime:item.copy_end_time===null?"无":item.copy_end_time===undefined?"无":item.copy_end_time===""?"无":moment(item.copy_end_time).format('YYYY-MM-DD HH:mm:ss'),
empvalue:item.code_rate,
challenge_id:{id:item.id},
copy_user_id:item.copy_user_id
// adjustmentminute:asdasd
})
})
@ -112,6 +155,22 @@ class ShixunCustomsPass extends Component {
render: (text, record) => (
<span className={"color-grey-9"}>
{record.elapsedtime}
</span>
),
},{
title: '调分',
key: 'adjustmentminute',
dataIndex: 'adjustmentminute',
render: (text, record) => (
<span>
<a>
{record.copy_user_id===null?"":<InputNumber size="small" className={customsids===record.challenge_id.id?"bor-red":""} defaultValue={record.evaluating.final_score}
onBlur={(e) => this.editgame_scores(e,record.challenge_id.id,record.evaluating.all_score,record.empvalue,record.copy_user_id)}
// min={0} max={record.game_scores.game_score_full}
/>}
</a>
{/*<a style={{textAlign: "center"}} className="color-blue font-14 mr20">查看</a>*/}
</span>
),
}, {
@ -138,7 +197,15 @@ class ShixunCustomsPass extends Component {
// },
if(this.props.isAdmin()===false){
columns.some((item,key)=> {
if (item.title === "调分") {
columns.splice(key, 1)
return true
}
}
)
}
return (
<div>
@ -177,6 +244,9 @@ class ShixunCustomsPass extends Component {
.customsPass{
text-align: left !important;
}
.ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 16px 12px;
}
`}
</style>
{datas===undefined?"":<Table

@ -101,9 +101,9 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback){
});
$("#"+ id +" [type=\"inline\"]").bind("click", function(){
editorName.cm.replaceSelection("$$$$");
editorName.cm.replaceSelection("`$$$$`");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch-2);
editorName.cm.setCursor(__Cursor.line, __Cursor.ch-3);
editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");

@ -390,10 +390,156 @@ class ShixunsHome extends Component {
{/*导师排行榜*/}
<div className="pt60 pb60 mb30 mentor-ranking">
<div className="educontent">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>导师排行榜</p>
<p className="color-grey-cd font-12">MENTOR RANKING</p>
</div>
<div className="ranking clearfix">
<ul className="grade color-dark">
{
homedatalist===undefined?"":homedatalist.teachers.map((item,key)=>{
if(key===1){
return(
<li className="mt35 pr" key={key}>
<img src={getImageUrl("images/educoder/huangguan-two.png")} className="huangguan" />
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url} />
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
{
homedatalist===undefined?"":homedatalist.teachers.map((item,key)=>{
if(key===0){
return(
<li className="pr" key={key}>
<img src={getImageUrl("images/educoder/huangguan.png")} className="huangguan" />
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url} />
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
{
homedatalist===undefined?"":homedatalist.teachers.map((item,key)=>{
if(key===2){
return(
<li className="mt35 pr" key={key}>
<img src={getImageUrl("images/educoder/huangguan-three.png")} className="huangguan" />
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url} />
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
</ul>
<br />
<ul className="grade mt30">
{
homedatalist===undefined?"":homedatalist.teachers.map((item,key)=>{
if(key>2) {
return (
<li key={key}>
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url}/>
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
</ul>
</div>
</div>
</div>
{/*程序员排行榜*/}
<div className="pt60 pb60 mb30 pro-ranking">
<div className="educontent">
<div className="edu-txt-center">
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>程序员排行榜</p>
<p className="color-grey-cd font-12">PROGRAMMER RANKING</p>
</div>
<div className="ranking clearfix">
<ul className="grade color-dark">
{
homedatalist===undefined?"":homedatalist.students.map((item,key)=>{
if(key===1){
return(
<li className="mt35 pr" key={key}>
<img src={getImageUrl("images/educoder/huangguan-two.png")} className="huangguan" />
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url} />
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
{
homedatalist===undefined?"":homedatalist.students.map((item,key)=>{
if(key===0){
return(
<li className="pr" key={key}>
<img src={getImageUrl("images/educoder/huangguan.png")} className="huangguan" />
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url} />
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
{
homedatalist===undefined?"":homedatalist.students.map((item,key)=>{
if(key===2){
return(
<li className="mt35 pr" key={key}>
<img src={getImageUrl("images/educoder/huangguan-three.png")} className="huangguan" />
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url} />
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
</ul>
<br />
<ul className="grade mt30">
{
homedatalist===undefined?"":homedatalist.students.map((item,key)=>{
if(key>2) {
return (
<li key={key}>
<a href={"/users/"+item.login} className="color-dark">
<img src={'/images/'+item.image_url}/>
<p className="task-hide rankName mt5">{item.username}</p>
</a>
</li>
)
}
})}
</ul>
</div>
</div>
</div>
</div>
</Spin>
</div>

@ -308,11 +308,12 @@ class MainContentContainer extends Component {
// })
}).then((fetchRepositoryCodeResponse) => {
// monaca 需要刷新,不然无法编辑
if (this.retryAndRefresh && fetchRepositoryCodeResponse.data.content) {
this.retryAndRefresh = false;
window.location.reload()
return;
}
// 加了dispose应该不会重现了暂时注释掉reload
// if (this.retryAndRefresh && fetchRepositoryCodeResponse.data.content) {
// this.retryAndRefresh = false;
// window.location.reload()
// return;
// }
// 空字符串还是正常切换
if (fetchRepositoryCodeResponse.data.status == 0) {
readingRepoTimes = readingRepoTimes + 1;
@ -530,7 +531,7 @@ class MainContentContainer extends Component {
let codeContent = this.state.repositoryCode;
if (window['editor_CodeMirror']) {
codeContent = window.editor_CodeMirror.getValue();
} else if (window.editor_monaco) {
} else if (window.editor_monaco && window.editor_monaco.getModel()) { // (编程切选择题) 如果dispose了model为空
codeContent = window.editor_monaco.getValue()
}
if (checkIfCodeChanged === true && this.oldRepositoryCode == codeContent) {

@ -245,6 +245,10 @@ class TPIMonaco extends Component {
// extend_editor.clearHistory()
}
}
componentWillUnmount() {
this.editor_monaco && this.editor_monaco.dispose()
}
componentDidMount() {
checkIfLoaded(() => {
let value = [

@ -48,6 +48,8 @@ function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callb
imageUploadURL: imageUrl,//url
onload: function () {
// this.previewing();
var id = this.id;
var editorName = this;
$("#" + id + " [type=\"latex\"]").bind("click", function () {
editorName.cm.replaceSelection("```latex");
editorName.cm.replaceSelection("\n");
@ -58,9 +60,9 @@ function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callb
});
$("#" + id + " [type=\"inline\"]").bind("click", function () {
editorName.cm.replaceSelection("$$$$");
editorName.cm.replaceSelection("`$$$$`");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");

@ -168,7 +168,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV
$("#" + _id + " [type=\"inline\"]").bind("click", function () {
_editorName.cm.replaceSelection("`$$$$`");
var __Cursor = _editorName.cm.getDoc().getCursor();
_editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
_editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
_editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");

@ -156,9 +156,9 @@ function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callb
});
$("#" + id + " [type=\"inline\"]").bind("click", function () {
editorName.cm.replaceSelection("$$$$");
editorName.cm.replaceSelection("`$$$$`");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");

@ -16,8 +16,8 @@ require('codemirror/lib/codemirror.css');
let origin = getUrl();
let path = getUrl("/editormd/lib/")
let path = '/editormd/lib/'
path = getUrl("/editormd/lib/")
const $ = window.$;
let timeout;
@ -171,7 +171,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV
$("#" + _id + " [type=\"inline\"]").bind("click", function () {
_editorName.cm.replaceSelection("`$$$$`");
var __Cursor = _editorName.cm.getDoc().getCursor();
_editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
_editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
_editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");

@ -130,9 +130,9 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback) {
});
$("#" + id + " [type=\"inline\"]").bind("click", function () {
editorName.cm.replaceSelection("$$$$");
editorName.cm.replaceSelection("`$$$$`");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");

@ -73,9 +73,9 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback) {
});
$("#" + id + " [type=\"inline\"]").bind("click", function () {
editorName.cm.replaceSelection("$$$$");
editorName.cm.replaceSelection("`$$$$`");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");

@ -51,9 +51,9 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback) {
});
$("#" + id + " [type=\"inline\"]").bind("click", function () {
editorName.cm.replaceSelection("$$$$");
editorName.cm.replaceSelection("`$$$$`");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");

@ -160,9 +160,9 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback) {
});
$("#" + id + " [type=\"inline\"]").bind("click", function () {
editorName.cm.replaceSelection("$$$$");
editorName.cm.replaceSelection("`$$$$`");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");

@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import { getImageUrl ,markdownToHTML} from 'educoder'
import { getImageUrl ,markdownToHTML, configShareForCustom} from 'educoder'
import { CircularProgress } from 'material-ui/Progress';
@ -51,6 +51,7 @@ class Challenges extends Component {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else{
configShareForCustom(this.props.shixunsDetails.name, response.data.description)
this.setState({
ChallengesDataList: response.data,
sumidtype: false,

Loading…
Cancel
Save