dev_winse
cxt 6 years ago
commit 72b73199f9

@ -1129,12 +1129,12 @@ class CoursesController < ApplicationController
def validate_course_name
tip_exception("课堂名称不能为空!") if params[:course][:name].blank?
if params[:subject_id].blank? || @course.subject.blank?
if params[:subject_id].blank? || (@course && @course.subject.blank?)
tip_exception("课程名称不能为空!") if params[:course_list_name].blank?
tip_exception("课堂名称应以课程名称开头命名") unless params[:course][:name].index(params[:course_list_name]) &&
params[:course][:name].index(params[:course_list_name]) == 0
else
@subject = @course ? @course.subject : Subject.find_by!(id: params[:subject_id])
@subject = @course.present? ? @course.subject : Subject.find_by!(id: params[:subject_id])
tip_exception("开始时间不能为空") if params[:start_date].blank?
tip_exception("结束时间不能为空") if params[:end_date].blank?
tip_exception("结束时间必须晚于开始时间") if params[:end_date] <= params[:start_date]

@ -23,24 +23,19 @@ class MyshixunsController < ApplicationController
begin
ActiveRecord::Base.transaction do
begin
@shixun = Shixun.select(:id, :identifier).find(@myshixun.shixun_id)
@shixun = Shixun.select(:id, :identifier, :challenges_count).find(@myshixun.shixun_id)
@myshixun.destroy!
StudentWork.where(:myshixun_id => @myshixun.id).update_all(:myshixun_id => 0, :work_status => 0)
# 实训在申请发布前,是否玩过实训,如果玩过需要更改记录,防止二次重置
shixun_mod = ShixunModify.where(:shixun_id => @shixun.id, :myshixun_id => @myshixun.id, :status => 1).take
shixun_mod.update_column(:status, 0) if shixun_mod
rescue Exception => e
logger.error("######reset_my_game_failed:#{e.message}")
raise("ActiveRecord::RecordInvalid")
end
end
# 删除版本库
GitService.delete_repository(repo_path: @repo_path)
GitService.delete_repository(repo_path: @repo_path) unless @shixun.is_choice_type?
rescue Exception => e
if e.message != "ActiveRecord::RecordInvalid"
logger.error("######delete_repository_error:#{e.message}")
logger.error("######delete_repository_error-:#{e.message}")
end
raise "delete_repository_error:#{e.message}"
end

@ -4,7 +4,7 @@ class StudentWorksController < ApplicationController
before_action :require_login, :check_auth
before_action :find_homework, only: [:new, :create, :search_member_list, :check_project, :relate_project,
:cancel_relate_project]
:cancel_relate_project, :delete_work]
before_action :find_work, only: [:shixun_work_report, :adjust_review_score, :shixun_work, :commit_des, :update_des,
:adjust_score, :show, :adjust_score, :supply_attachments, :revise_attachment,
:comment_list, :add_score, :add_score_reply, :destroy_score, :appeal_anonymous_score,
@ -15,12 +15,12 @@ class StudentWorksController < ApplicationController
before_action :teacher_allowed, only: [:adjust_score, :adjust_review_score, :deal_appeal_score]
before_action :course_student, only: [:new, :commit_des, :update_des, :create, :edit, :update, :search_member_list, :relate_project,
:cancel_relate_project, :relate_project]
:cancel_relate_project, :relate_project, :delete_work]
before_action :my_work, only: [:commit_des, :update_des, :edit, :update, :revise_attachment, :appeal_anonymous_score,
:cancel_appeal]
before_action :edit_duration, only: [:edit, :update]
before_action :edit_duration, only: [:edit, :update, :delete_work]
before_action :end_or_late, only: [:new, :create, :search_member_list, :commit_des, :update_des]
before_action :require_score_id, only: [:destroy_score, :add_score_reply, :appeal_anonymous_score, :deal_appeal_score, :cancel_appeal]
@ -60,6 +60,20 @@ class StudentWorksController < ApplicationController
@members = @members.page(page).per(limit).includes(:course_group, user: :user_extension)
end
def delete_work
begin
work = @homework.student_works.find_by!(user_id: params[:user_id])
work.update_attributes(description: nil, project_id: 0,
late_penalty: 0, work_status: 0,
commit_time: nil, update_time: nil, group_id: 0,
commit_user_id: nil, final_score: nil, work_score: nil, teacher_score: nil, teaching_asistant_score: nil)
normal_status("删除成功")
rescue Exception => e
uid_logger(e.message)
tip_exception(e.message)
end
end
def create
student_work = @homework.student_works.find_or_create_by(user_id: current_user.id)

@ -543,7 +543,7 @@ module ExportHelper
end
def format_sheet_name name
name = name.gsub(":", "-")
name = name.gsub(":", "-").gsub("/", "_")
end
def rename_same_file(name, index)

@ -5,7 +5,7 @@ class Course < ApplicationRecord
belongs_to :teacher, class_name: 'User', foreign_key: :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, class_name: 'School', foreign_key: :school_id #定义一个方法school该方法通过school_id来调用School表
belongs_to :course_list
belongs_to :course_list, optional: true
# 所属实践课程
belongs_to :subject, optional: true
@ -91,7 +91,7 @@ class Course < ApplicationRecord
NORMAL = 6 # 普通用户
Anonymous = 7 # 普未登录
validates :name, presence: true, length: { maximum: 30 }
validates :name, presence: true, length: { maximum: 60 }
after_create :create_board_sync, :act_as_course_activity, :send_tiding

@ -82,7 +82,7 @@ class Myshixun < ApplicationRecord
# 通关时间
def passed_time
self.status == 1 ? self.games.map(&:end_time).max : "--"
self.status == 1 ? self.games.select{|game| game.status == 2}.map(&:end_time).max : "--"
end
# 耗时

@ -1,5 +1,5 @@
json.course_list_id @course.course_list.id
json.course_list_name @course.course_list.name
json.course_list_id @course.course_list&.id
json.course_list_name @course.course_list&.name
json.name @course.name
json.course_id @course.id
json.school @course.school&.name

@ -11,7 +11,7 @@ json.array! @members do |member|
json.partial! 'users/user', locals: { user: member.user }
json.user_shixuns_count member.user.shixuns.published.count
#json.fans_count member.user.fan_count
json.brief_introduction member.user.user_extension.brief_introduction
#json.brief_introduction member.user.user_extension.brief_introduction
json.identity member.user.identity
json.school_name member.user.school_name
json.shixun_manager member.role == 1

@ -7,7 +7,7 @@ json.grade @user.grade
json.follow_count @user.follow_count
json.fan_count @user.fan_count
json.identity @user.identity
j#son.brief_introduction @user.user_extension&.brief_introduction
#json.brief_introduction @user.user_extension&.brief_introduction
json.authentication @user.authentication
json.professional_certification @user.professional_certification
json.phone_binded @user.phone_binded?

@ -437,6 +437,7 @@ Rails.application.routes.draw do
get :check_project
get :cancel_relate_project
post :relate_project
delete :delete_work
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

@ -69,19 +69,33 @@ class ListPageIndex extends Component{
super(props);
this.state={
yslGuideone:undefined,
mysearch:undefined,
}
}
componentDidMount(){
var yslGuideone = window.sessionStorage.getItem('yslGuideone');
console.log("77");
var yslGuideone = window.localStorage.getItem('yslGuideone');
console.log("78");
console.log(yslGuideone);
var mysearchs= this.props.location.search===""?undefined:this.props.location.search===undefined?undefined:this.props.location.search==="?exhibition=true"?true:undefined;
this.setState({
yslGuideone:yslGuideone,
mysearch:mysearchs,
})
try {
if (yslGuideone === "true") {
console.log("true 字符串");
this.setState({
yslGuideone:true,
})
} else {
this.setState({
yslGuideone:false,
});
console.log("false 字符串");
}
}catch (e) {
console.log(e);
this.setState({
yslGuideone:false,
});
}
}
//
@ -93,20 +107,33 @@ class ListPageIndex extends Component{
// })
// }
componentWillUnmount(){
window.sessionStorage.setItem('yslGuideone', false);
// window.localStorage.setItem('yslGuideone', "false");
}
setwindowlocal=(bool)=>{
window.sessionStorage.setItem('yslGuideone', bool);
this.setState({
yslGuideone:bool,
mysearch:undefined,
});
var currenturl = this.props.location.pathname;
var newUrl = (currenturl.split("?"))[0];
window.history.pushState('','',newUrl);
window.localStorage.setItem('yslGuideone', bool);
try {
if (bool === "true") {
console.log("115");
console.log("true 字符串");
this.setState({
yslGuideone:true,
})
} else {
this.setState({
yslGuideone:false,
});
console.log("124");
console.log("false 字符串");
}
}catch (e) {
console.log(e);
this.setState({
yslGuideone:false,
});
}
}
render() {
let {yslGuideone,mysearch} =this.state;
let {yslGuideone} =this.state;
// console.log("98");
// console.log(yslGuideone);
// console.log(this.props.isAdmin());
@ -118,10 +145,10 @@ class ListPageIndex extends Component{
<div className="newMain clearfix">
{/*头部banner*/}
<CoursesBanner {...this.props}></CoursesBanner>
{/*{mysearch!==undefined?*/}
{/*下面是指引哦*/}
{/*{yslGuideone!==undefined?*/}
{/*(*/}
{/* mysearch===true?*/}
{/* yslGuideone===true?*/}
{/* <Guide*/}
{/* setwindowlocal={(b)=>this.setwindowlocal(b)}*/}
{/* >*/}

@ -310,7 +310,7 @@ class BoardsNew extends Component{
<span className="fl font-24 color-grey-3">{this.isEdit ? "编辑" : "新建"}帖子</span>
<a href="javascript:void(0)" className="color-grey-6 fr font-16 mr2"
onClick={() => this.props.history.goBack()}>
返回
{/*返回*/}
</a>
</p>
{/* notRequired */}

@ -283,11 +283,11 @@ class GraduateTaskItem extends Component{
{this.props.isAdmin?
<div className="mt13">
<WordsBtn style="blue" to={"/courses/"+coursesId+"/graduation_tasks/"+taskid+"/edit"} className="colorblue font-16 mrf4 fr">
<a className="btn colorblue">编辑</a>
<WordsBtn style="blue" to={"/courses/"+coursesId+"/graduation_tasks/"+categoryid+"/"+taskid+"/setting"} className="colorblue font-16 mrf4 fr">
<a className="btn colorblue">设置</a>
</WordsBtn>
<WordsBtn style="blue" to={"/courses/"+coursesId+"/graduation_tasks/"+categoryid+"/"+taskid+"/setting"} className="colorblue font-16 mr20 fr">
<a className="btn colorblue" >设置</a>
<WordsBtn style="blue" to={"/courses/"+coursesId+"/graduation_tasks/"+taskid+"/edit"} className="colorblue font-16 mr20 fr">
<a className="btn colorblue" >编辑</a>
</WordsBtn>
</div>

@ -218,9 +218,9 @@ class studentsList extends Component{
})
this.fetchAll()
const isAdmin = this.props.isAdmin()
if (isAdmin) {
this.fetchCourseGroups()
}
// if (isAdmin) {
this.fetchCourseGroups();
// }
isAdmin && on('addStudentSuccess', this.addStudentSuccessListener)
isAdmin && on('updateNavSuccess', this.updateNavSuccess)

@ -41,7 +41,8 @@ class CoursesNew extends Component {
searchlist: [],
searchlistscholl:[],
listvalue: undefined,
fetching:false
fetching:false,
boolxinjian:false,
}
}
@ -80,6 +81,9 @@ class CoursesNew extends Component {
}).catch((error) => {
console.log(error);
})
this.setState({
boolxinjian:false,
});
}else{
let url = "/courses/new.json"
axios.get(url).then((result) => {
@ -96,18 +100,25 @@ class CoursesNew extends Component {
});
this.handleSearchschool(user_school);
this.setState({
boolxinjian:true,
});
}
}
componentDidUpdate(prevProps){
// if(prevProps.current_user!=this.props.current_user){
// if(this.props.current_user.user_identity==="学生"){
// window.location.href ="/403"
// }
// }
}
componentDidUpdate(prevProps) {
if(prevProps.current_user !== this.props.current_user){
let user_school=this.props.current_user&&this.props.current_user.user_school;
this.props.form.setFieldsValue({
school:user_school,
});
this.setState({
school:user_school,
});
this.handleSearchschool(user_school);
}
}
onChangeTimepublishs = (date, dateString) => {
if(dateString===""){
this.setState({
@ -206,8 +217,23 @@ class CoursesNew extends Component {
if (response.data.status === 0) {
// this.goback()
window.location.href=first_category_url+"?exhibition=true";
window.sessionStorage.setItem('yslGuideone', true);
window.location.href=first_category_url;
if(this.state.boolxinjian===true) {
var yslGuideone = window.localStorage.getItem('yslGuideone');
try {
if (yslGuideone === null) {
window.localStorage.setItem('yslGuideone', "true");
return
}
if (yslGuideone === undefined) {
window.localStorage.setItem('yslGuideone', "true");
return
}
} catch (e) {
}
}
}
}).catch((error) => {
console.log(error)
@ -251,8 +277,24 @@ class CoursesNew extends Component {
).then((response) => {
if (response.status === 200) {
// this.goback
window.location.href=response.data.first_category_url+"?exhibition=true";
window.sessionStorage.setItem('yslGuideone', true);
window.location.href=response.data.first_category_url;
if(this.state.boolxinjian===true){
var yslGuideone = window.localStorage.getItem('yslGuideone');
try {
if(yslGuideone=== null){
window.localStorage.setItem('yslGuideone', "true");
return
}
if(yslGuideone=== undefined){
window.localStorage.setItem('yslGuideone', "true");
return
}
}catch (e) {
}
}
}
}).catch((error) => {
console.log(error)
@ -405,9 +447,10 @@ class CoursesNew extends Component {
const propsWithoutForm = Object.assign({}, this.props)
delete propsWithoutForm.form
const options = this.state.searchlist && this.state.searchlist.map(d => <Option key={d.name} value={d.name}>{d.name}</Option>);
const optionschool = this.state.searchlistscholl&&this.state.searchlistscholl.map(z => <Option key={z} value={z}>{z}</Option>);
const optionschool = this.state.searchlistscholl===undefined?"":this.state.searchlistscholl===null?"":this.state.searchlistscholl==="[]"?"":this.state.searchlistscholl.map(z => <Option key={z} value={z}>{z}</Option>);
// console.log(this.props.current_user.user_school)
// form合并了
console.log("获取到的数据");
console.log(this.state);
console.log(this.props);
console.log(this.props.current_user);

@ -6,7 +6,9 @@ import guihome2 from "../../../images/guideimg/guihome2.jpg";
import guihome3 from "../../../images/guideimg/guihome3.jpg";
import guihome4 from "../../../images/guideimg/guihome4.jpg";
import guihome5 from "../../../images/guideimg/guihome5.jpg";
import guihome6 from "../../../images/guideimg/guihome6.jpg";
import guihome6 from "../../../images/guideimg/guihome6.jpg";
// import guihome6 from "../../../images/guideimg/guihome6.png";
// import guihome7 from "../../../images/guideimg/guihome7.png";
class Guide extends Component {
@ -60,7 +62,7 @@ class Guide extends Component {
page:i,
})
if(i===7){
this.props.setwindowlocal(false);
this.props.setwindowlocal("false");
}
}
render() {
@ -123,6 +125,7 @@ class Guide extends Component {
page===6?
<div className="guide-content">
<img className={mywidth===1?"ysldiv61024":mywidth===2?"ysldiv61280":mywidth===3?"ysldiv61440":mywidth===4?"ysldiv61680":mywidth===5?"ysldiv61900":mywidth===6?"ysldiv61366":mywidth===7?"ysldiv61600":"ysldiv61900"} src={guihome6} onClick={(i)=>this.thissetPage(7)}/>
{/*<img className={mywidth===1?"ysldiv71024":mywidth===2?"ysldiv71280":mywidth===3?"ysldiv71440":mywidth===4?"ysldiv71680":mywidth===5?"ysldiv71900":mywidth===6?"ysldiv71366":mywidth===7?"ysldiv71600":"ysldiv71900"} src={guihome7} onClick={(i)=>this.thissetPage(7)}/>*/}
</div>
:
""

@ -157,6 +157,7 @@ class ShixunStudentWork extends Component {
lunxun:false,
duplicatechecking:false,
});
return;
}
}
}
@ -177,6 +178,9 @@ class ShixunStudentWork extends Component {
description: response.data.message
});
}
this.setState({
lunxun:true,
})
setInterval(() => {
console.log("开始轮询了");
if(this.state.lunxun===true){

@ -470,4 +470,49 @@
margin-left: 27%;
margin-right: 0;
height: 40%;
}
.ysldiv71900{
margin-top: 16%;
margin-left: 34%;
margin-right: 19%
}
.ysldiv71680{
margin-top: 18%;
margin-left: 31%;
margin-right: 14%;
}
.ysldiv71600{
margin-top: 19%;
margin-left: 30%;
margin-right: 12%;
}
.ysldiv71440{
margin-top: 21%;
margin-left: 28%;
margin-right: 8%;
}
.ysldiv71280{
margin-top: 24%;
margin-left: 25%;
margin-right: 3%;
height: 53%;
}
.ysldiv71366{
margin-top: 22%;
margin-left: 26%;
margin-right: 6%;
height: 53%;
}
.ysldiv71024{
margin-top: 31%;
margin-left: 27%;
margin-right: 0;
height: 40%;
}
Loading…
Cancel
Save