Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

issues25489
hjm 5 years ago
commit e4223a3be6

@ -1084,14 +1084,23 @@ class ExercisesController < ApplicationController
@shixun_undo = 0
@ques_undo = 0
ex_answer_time = @exercise.time.to_i
@ex_end_time = @exercise.get_exercise_end_time(current_user.id)
if ex_answer_time > 0
exercise_end_time = @exercise.exercise_users.exercise_commit_users(current_user.id)
if exercise_end_time.present?
ex_end_times = exercise_end_time.first.start_at.nil? ? Time.now : exercise_end_time.first.start_at
@ex_end_time = ex_end_times + ex_answer_time.minutes
end
if ex_answer_time > 0 #有剩余时间的时候
user_left_time = get_exercise_left_time(@exercise,current_user)
@ex_end_time = Time.now + user_left_time.to_i.seconds
else
@ex_end_time = @exercise.get_exercise_end_time(current_user.id)
end
# @ex_end_time = @exercise.get_exercise_end_time(current_user.id)
# if ex_answer_time > 0
# left_answer_time = Time.now + ex_answer_time.minutes #判断试卷的倒计时和截止时间哪个先到
# if left_answer_time < @ex_end_time
# exercise_end_time = @exercise.exercise_users.exercise_commit_users(current_user.id)
# if exercise_end_time.present?
# ex_end_times = exercise_end_time.first.start_at.nil? ? Time.now : exercise_end_time.first.start_at
# @ex_end_time = ex_end_times + ex_answer_time.minutes
# end
# end
# end
@exercise_questions.each do |q|
if q.question_type == Exercise::PRACTICAL #当为实训题时
user_myshixun = q.shixun.myshixuns.search_myshixun_user(current_user.id)

@ -142,6 +142,9 @@ module ExercisesHelper
right_users_count = 0
#该问题的正确率
if ex.question_type == Exercise::MULTIPLE #多选题
if standard_answer.size == 1 #以前的多选题答案存在一个表里
standard_answer = standard_answer.first.to_s.split("").map(&:to_i)
end
right_user_ids = user_ids
standard_answer.each do |choice_position|
standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == choice_position}.first&.id
@ -896,7 +899,8 @@ module ExercisesHelper
if ex_time > 0
exercise_user = exercise.exercise_users.find_by(user_id:user.id)
time_mill = ex_time * 60 #转为秒
exercise_end_time = exercise.end_time.present? ? exercise.end_time.to_i : 0
exercise_end_time = exercise.get_exercise_end_time(user.id) #没有考虑分班的情况
# exercise_end_time = exercise.end_time.present? ? exercise.end_time.to_i : 0
exercise_user_start = exercise_user&.start_at.present? ? exercise_user.start_at.to_i : 0
#用户未开始答题时即exercise_user_start为0
if exercise_user_start == 0

@ -6,6 +6,7 @@ module OmniAuth
authorize_url: '/oauth2.0/authorize',
token_url: '/oauth2.0/token'
}
option :token_params, { parse: :query }
def request_phase
super
@ -21,7 +22,17 @@ module OmniAuth
end
end
uid { raw_info['openid'].to_s }
uid do
@uid ||= begin
access_token.options[:mode] = :query
access_token.options[:param_name] = :access_token
# Response Example: "callback( {\"client_id\":\"11111\",\"openid\":\"000000FFFF\"} );\n"
response = access_token.get('/oauth2.0/me')
matched = response.body.match(/"openid":"(?<openid>\w+)"/)
matched[:openid]
end
end
info do
{
@ -35,18 +46,10 @@ module OmniAuth
{ raw_info: user_info }
end
def raw_info
access_token.options[:mode] = :query
@raw_info ||= begin
res = access_token.get('/oauth2.0/me')
JSON.parse(res.body.to_s[10..-4])
end
end
def user_info
access_token.options[:mode] = :query
params = { oauth_consumer_key: options.client_id, openid: raw_info['openid'], format: 'json' }
@user_info ||= access_token.get('/user/get_user_info', params: params).parsed
param = { oauth_consumer_key: options[:client_id], openid: uid, format: 'json' }
@user_info ||= access_token.get('/user/get_user_info', params: param, parse: :json).parsed
end
end
end

@ -48,6 +48,29 @@ class CompetitionCommon extends Component{
}
}
componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) {
console.log("componentDidUpdatess");
console.log(this.props.user);
if (this.props.user && this.props.user.login != "") {
const zul = `/competitions/${this.props.match.params.identifier}/competition_staff.json`;
axios.get((zul)).then((result) => {
if (result) {
if (result.data) {
this.setState({
signupdata: result.data
})
}
}
}).catch((error) => {
//console.log(error);
})
}
}
}
//获取头部信息
getbannerdata=()=>{
let menuid=this.props.location.search.replace('?menu=', '');
let url=`/competitions/${this.props.match.params.identifier}/common_header.json`;
@ -55,7 +78,8 @@ class CompetitionCommon extends Component{
if(response.status===200){
this.setState({
data: response.data,
thiskeys: menuid === undefined || menuid === "" ? response.data.competition_modules[0].id : menuid
thiskeys: menuid === undefined || menuid === "" ? response.data.competition_modules[0].id : menuid,
mode: response.data.mode
})
if(menuid===undefined||menuid===""){
this.getrightdata(
@ -82,6 +106,8 @@ class CompetitionCommon extends Component{
console.log(error)
})
//this.props.user 有可能为空
if (this.props.user && this.props.user.login != "") {
const zul = `/competitions/${this.props.match.params.identifier}/competition_staff.json`;
axios.get((zul)).then((result) => {

@ -369,7 +369,9 @@ function buildColumns(that, student_works, studentData) {
</Tooltip> }
{/* toWorkDetailPage */}
{/* /courses/"+courseId+"/common_homeworks/"+workId+ '/' + record.id +"/appraise */}
<a style={{color:'#4CACFF', marginLeft: '4px'}} href={"javascript:void(0)"} onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)} >{ isAdmin ? '评阅': '查看'}</a>
<a style={{color: '#4CACFF', marginLeft: '4px'}} id={"asdasdasdasd"}
onMouseDown={(e) => that.props.toWorkDetailPage2(e, courseId, workId, record.id)}
onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)}>{isAdmin ? '评阅' : '查看'}</a>
</div>

@ -12,15 +12,15 @@ export function RouteHOC(options = {}) {
return class Wrapper extends Component {
constructor(props) {
super(props);
this.state = {
}
}
toCreateProject = () => {
let url = '/projects/new'
if (window.location.port == 3007) {
// window.location.href
// window.location.href
url = '/testbdweb.educoder.net/projects/new'
}
window.open(
@ -55,8 +55,8 @@ export function RouteHOC(options = {}) {
} else {
this.props.history.push(`/courses/${_courseId}/boards/${workId}/messages/${topicId}`)
}
}
}
toEditPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
@ -78,6 +78,19 @@ export function RouteHOC(options = {}) {
window.open(`/courses/${_courseId}/${secondName}/${_workId}/${_studentWorkId}/appraise`);
}
}
toWorkDetailPage2 = (e, _courseId, _workId, _studentWorkId) => {
console.log("鼠标中键点击了")
console.log(_studentWorkId)
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
const studentWorkId = _courseId.studentWorkId
window.open(`/courses/${courseId}/${secondName}/${_workId || workId}/${_studentWorkId || studentWorkId}/appraise`);
} else {
window.open(`/courses/${_courseId}/${secondName}/${_workId}/${_studentWorkId}/appraise`);
}
}
toNewPage = (courseId) => {
const secondName = this.getModuleName()
this.props.history.push(`/courses/${courseId.coursesId}/${secondName}/${courseId.category_id}/new`)
@ -125,8 +138,8 @@ export function RouteHOC(options = {}) {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/answer`)
}
}
toWorkQuestionPage = (_courseId, _workId) => {
toWorkQuestionPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _workId || _courseId.workId
@ -148,37 +161,36 @@ export function RouteHOC(options = {}) {
}
}
render() {
render() {
const { snackbarOpen} = this.state;
return (
<React.Fragment>
<WrappedComponent {...this.props}
toDetailPage={this.toDetailPage}
toEditPage={this.toEditPage}
toNewPage={this.toNewPage}
toListPage={this.toListPage}
toWorkDetailPage={this.toWorkDetailPage}
toWorkPostPage={this.toWorkPostPage}
toWorkListPage={this.toWorkListPage}
toWorkAnswerPage={this.toWorkAnswerPage}
toWorkQuestionPage={this.toWorkQuestionPage}
toWorkSettingPage={this.toWorkSettingPage}
toCreateProject={this.toCreateProject}
isGroup={this.isGroup}
getModuleName={this.getModuleName}
getModuleType={this.getModuleType}
<WrappedComponent {...this.props}
toDetailPage={this.toDetailPage}
toEditPage={this.toEditPage}
toNewPage={this.toNewPage}
toListPage={this.toListPage}
toWorkDetailPage={this.toWorkDetailPage}
toWorkDetailPage2={this.toWorkDetailPage2}
toWorkPostPage={this.toWorkPostPage}
toWorkListPage={this.toWorkListPage}
toWorkAnswerPage={this.toWorkAnswerPage}
toWorkQuestionPage={this.toWorkQuestionPage}
toWorkSettingPage={this.toWorkSettingPage}
toCreateProject={this.toCreateProject}
isGroup={this.isGroup}
getModuleName={this.getModuleName}
getModuleType={this.getModuleType}
>
</WrappedComponent>
</WrappedComponent>
</React.Fragment>
)
}
}
}
}
}

@ -458,6 +458,7 @@ class Listofworksstudentone extends Component {
:
<a style={{textAlign: "center"}}
className="color-blue"
onMouseDown={(e) => this.Viewstudenttraininginformationtysl2(e, record)}
onClick={() => this.Viewstudenttraininginformation(record)}>{record.operating}</a>
}
@ -810,6 +811,7 @@ class Listofworksstudentone extends Component {
:
<a style={{textAlign: "center"}}
className="color-blue"
onMouseDown={(e) => this.Viewstudenttraininginformationtysl2(e, record)}
onClick={() => this.Viewstudenttraininginformation(record)}>{record.operating}</a>
}
@ -1175,6 +1177,7 @@ class Listofworksstudentone extends Component {
record.submitstate === "未提交" ? <span style={{color: '#9A9A9A'}}>--</span> :
<span>
<a style={{textAlign: "center"}} className="color-blue"
onMouseDown={(e) => this.Viewstudenttraininginformationtysl2(e, record)}
onClick={() => this.Viewstudenttraininginformationt(record)}>查看</a>
</span>
)
@ -1505,6 +1508,7 @@ class Listofworksstudentone extends Component {
record.submitstate === "未提交" ? <span style={{color: '#9A9A9A'}}>--</span> :
<span>
<a style={{textAlign: "center"}} className="color-blue"
onMouseDown={(e) => this.Viewstudenttraininginformationtysl2(e, record)}
onClick={() => this.Viewstudenttraininginformationt(record)}>{record.operating}</a>
</span>
)
@ -2779,7 +2783,16 @@ class Listofworksstudentone extends Component {
}
// 调分
Viewstudenttraininginformationtysl2 = (e, data) => {
// console.log("Viewstudenttraininginformationtysl2");
// console.log("shubiao zhongjian ");
// console.log(e);
this.setState({
userids: data.myid,
})
// this.viewtrainingt(e.myid);
window.open(`/courses/${this.state.props.match.params.coursesId}/shixun_homeworks/${data.myid}/shixun_work_report`, '_blank');
}
// 查看学员实训信息
Viewstudenttraininginformationt = (e) => {
// console.log("Viewstudenttraininginformation");

@ -280,7 +280,7 @@ class Infos extends Component{
}
></Route>
{/* 实训 */}
{/* 实训项目 */}
<Route exact path="/users/:username/shixuns"
render={
(props) => (<InfosShixun {...this.props} {...props} {...this.state} {..._commonProps}/>)
@ -294,7 +294,7 @@ class Infos extends Component{
}
></Route>
{/* 项目 */}
{/* 开发项目 */}
<Route exact path="/users/:username/projects"
render={
(props) => (<InfosProject {...this.props} {...props} {...this.state} {..._commonProps}/>)

@ -45,6 +45,7 @@ class InfosShixun extends Component{
status,
sort_by,
page,
sort_direction,
per_page:this.props.is_current && category && page ==1?17:16
}}).then((result)=>{
if(result){

Loading…
Cancel
Save