diff --git a/app/controllers/course_second_categories_controller.rb b/app/controllers/course_second_categories_controller.rb index af368a8dc..e5c3366cd 100644 --- a/app/controllers/course_second_categories_controller.rb +++ b/app/controllers/course_second_categories_controller.rb @@ -8,7 +8,7 @@ class CourseSecondCategoriesController < ApplicationController tip_exception("毕设子目录不能重命名") if @category.category_type == "graduation" tip_exception("名称不能为空") if params[:name].blank? tip_exception("已存在同名子目录") if @course_module.course_second_categories.exists?(name: params[:name].strip) - @category.update_attributes(name: params[:name].strip) + @category.update_attributes!(name: params[:name].strip) normal_status(0, "更新成功") end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index f5830adff..230e7f387 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -906,7 +906,6 @@ class CoursesController < ApplicationController CourseAddStudentCreateWorksJob.perform_later(course.id, [current_user.id]) StudentJoinCourseNotifyJob.perform_later(current_user.id, course.id) - logger.info("#####################{course.id}") end end @@ -927,14 +926,18 @@ class CoursesController < ApplicationController role = course_message.content == 2 ? '7' : '9' # 7:老师 9:助教 ApplyTeacherRoleJoinCourseNotifyJob.perform_later(current_user.id, course.id, role) + teacher_role = 1 + message = "#{course_message.content == 2 ? '教师' : '助教'}申请已提交,请等待审核" end end end - if current_user.student_of_course?(course) || current_user.teacher_of_course?(course) - render json: { status: 0, message: "成功", course_id: course.id} + if teacher_role && current_user.student_of_course?(course) + render json: { status: 0, message: message, course_id: course.id} + elsif current_user.student_of_course?(course) + render json: { status: 0, message: "加入成功", course_id: course.id} else - normal_status("申请已提交,请等待审核") + normal_status(message) end rescue => e uid_logger(e.message) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 9edb6bb9d..7a2db0666 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -513,6 +513,111 @@ class ShixunsController < ApplicationController # 以前在开启挑战的时候检测实训是否更新,更新则重置,觉得应该放在TPI更好 # 中间需要一个过渡动画 # TODO: 第一次开启实训都会去判断是否是纯选择题类型,感觉做成在创建关卡的时候就判断该实训是否是纯选择题更加合适 + # def shixun_exec + # if is_shixun_opening? + # tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}") + # end + # current_myshixun = @shixun.current_myshixun(current_user.id) + # + # min_challenges = @shixun.challenges.pluck(:id , :st) + # + # Rails.logger.info("11111111112#{current_myshixun.try(:id)}") + # Rails.logger.info("111111111102#{params[:reset] != 1}") + # + # # 因为读写分离有延迟,所以如果是重置来的请求可以先跳过,重置过来的params[:reset]为1 + # if current_myshixun && params[:reset] != "1" + # games = current_myshixun.games + # # 如果TPM和TPI的管卡数不相等或者关卡顺序错了,说明实训被极大的改动,需要重置,实训发布前打过的实训都需要重置 + # if is_shixun_reset?(games, min_challenges, current_myshixun) + # # 这里页面弹框要收到 当前用户myshixun的identifier. + # tip_show_exception("/myshixuns/#{current_myshixun.try(:identifier)}/reset_my_game") + # end + # + # + # if current_myshixun.repo_name.nil? + # g = Gitlab.client + # repo_name = g.project(current_myshixun.gpid).try(:path_with_namespace) + # current_myshixun.update_column(:repo_name, repo_name) + # end + # + # + # # 如果存在实训,则直接进入实训 + # # 如果实训允许跳关,传参params[:challenge_id]跳入具体的关卡 + # @current_task = + # if params[:challenge_id] + # game = games.where(challenge_id: params[:challenge_id]).take + # if @shixun.task_pass || game.status != 3 + # game + # else + # current_myshixun.current_task(games) + # end + # else + # current_myshixun.current_task(games) + # end + # else + # # 如果未创建关卡一定不能开启实训,否则TPI没法找到当前的关卡 + # if @shixun.challenges_count == 0 + # tip_exception("开启实战前请先创建实训关卡") + # end + # + # # 判断实训是否全为选择题 + # is_choice_type = (min_challenges.size == min_challenges.select{|challenge| challenge.last == 1}.count) + # if !is_choice_type + # commit = GitService.commits(repo_path: @repo_path).try(:first) + # uid_logger("First comit########{commit}") + # tip_exception("开启实战前请先在版本库中提交代码") if commit.blank? + # commit_id = commit["id"] + # end + # + # ActiveRecord::Base.transaction do + # begin + # cloud_bridge = edu_setting('cloud_bridge') + # myshixun_identifier = generate_identifier Myshixun, 10 + # myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier, + # modify_time: @shixun.modify_time, reset_time: @shixun.reset_time, + # onclick_time: Time.now, commit_id: commit_id) + # uid_logger("myshixun_id is #{myshixun.id}") + # + # + # # 其它创建关卡等操作 + # challenges = @shixun.challenges + # # 之所以增加user_id是为了方便统计查询性能 + # game_attrs = %i[challenge_id myshixun_id status user_id open_time identifier modify_time created_at updated_at] + # Game.bulk_insert(*game_attrs) do |worker| + # base_attr = { myshixun_id: myshixun.id, user_id: myshixun.user_id } + # challenges.each_with_index do |challenge, index| + # status = (index == 0 ? 0 : 3) + # game_identifier = generate_identifier(Game, 12) + # worker.add(base_attr.merge(challenge_id: challenge.id, status: status, open_time: Time.now, + # identifier: game_identifier, modify_time: challenge.modify_time)) + # end + # end + # + # # 如果实训是纯选择题,则不需要去fork仓库以及中间层的相关操作了 + # unless is_choice_type + # # fork仓库 + # project_fork(myshixun, @repo_path, current_user.login) + # + # rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path ) + # uid_logger("start openGameInstance") + # uri = "#{cloud_bridge}/bridge/game/openGameInstance" + # logger.info("end openGameInstance") + # params = {tpiID: "#{myshixun.id}", tpmGitURL:rep_url, tpiRepoName: myshixun.repo_name.split("/").last} + # uid_logger("openGameInstance params is #{params}") + # interface_post uri, params, 83, "实训云平台繁忙(繁忙等级:83)" + # end + # + # @current_task = myshixun.current_task(myshixun.games) + # uid_logger("## shixun exec: myshixun id is #{myshixun.id}") + # rescue Exception => e + # uid_logger_error(e.message) + # tip_exception("实训云平台繁忙(繁忙等级:81)") + # raise ActiveRecord::Rollback + # end + # end + # end + # end + def shixun_exec if is_shixun_opening? tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}") @@ -520,10 +625,6 @@ class ShixunsController < ApplicationController current_myshixun = @shixun.current_myshixun(current_user.id) min_challenges = @shixun.challenges.pluck(:id , :st) - - Rails.logger.info("11111111112#{current_myshixun.try(:id)}") - Rails.logger.info("111111111102#{params[:reset] != 1}") - # 因为读写分离有延迟,所以如果是重置来的请求可以先跳过,重置过来的params[:reset]为1 if current_myshixun && params[:reset] != "1" games = current_myshixun.games @@ -540,7 +641,6 @@ class ShixunsController < ApplicationController current_myshixun.update_column(:repo_name, repo_name) end - # 如果存在实训,则直接进入实训 # 如果实训允许跳关,传参params[:challenge_id]跳入具体的关卡 @current_task = @@ -569,51 +669,54 @@ class ShixunsController < ApplicationController commit_id = commit["id"] end - ActiveRecord::Base.transaction do - begin - cloud_bridge = edu_setting('cloud_bridge') - myshixun_identifier = generate_identifier Myshixun, 10 - myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier, - modify_time: @shixun.modify_time, reset_time: @shixun.reset_time, - onclick_time: Time.now, commit_id: commit_id) - uid_logger("myshixun_id is #{myshixun.id}") - - - # 其它创建关卡等操作 - challenges = @shixun.challenges - # 之所以增加user_id是为了方便统计查询性能 - game_attrs = %i[challenge_id myshixun_id status user_id open_time identifier modify_time created_at updated_at] - Game.bulk_insert(*game_attrs) do |worker| - base_attr = { myshixun_id: myshixun.id, user_id: myshixun.user_id } - challenges.each_with_index do |challenge, index| - status = (index == 0 ? 0 : 3) - game_identifier = generate_identifier(Game, 12) - worker.add(base_attr.merge(challenge_id: challenge.id, status: status, open_time: Time.now, - identifier: game_identifier, modify_time: challenge.modify_time)) + begin + ActiveRecord::Base.transaction do + begin + myshixun_identifier = generate_identifier Myshixun, 10 + myshixun_params = {user_id: current_user.id, identifier: myshixun_identifier, + modify_time: @shixun.modify_time, reset_time: @shixun.reset_time, + onclick_time: Time.now, commit_id: commit_id} + @myshixun = @shixun.myshixuns.create!(myshixun_params) + # 其它创建关卡等操作 + challenges = @shixun.challenges + # 之所以增加user_id是为了方便统计查询性能 + game_attrs = %i[challenge_id myshixun_id status user_id open_time identifier modify_time created_at updated_at] + Game.bulk_insert(*game_attrs) do |worker| + base_attr = {myshixun_id: @myshixun.id, user_id: @myshixun.user_id} + challenges.each_with_index do |challenge, index| + status = (index == 0 ? 0 : 3) + game_identifier = generate_identifier(Game, 12) + worker.add(base_attr.merge(challenge_id: challenge.id, status: status, open_time: Time.now, + identifier: game_identifier, modify_time: challenge.modify_time)) + end end + @current_task = @myshixun.current_task(@myshixun.games) + rescue Exception => e + logger.error("------ActiveRecord::RecordInvalid: #{e.message}") + raise("ActiveRecord::RecordInvalid") end - - # 如果实训是纯选择题,则不需要去fork仓库以及中间层的相关操作了 + end + # 如果实训是纯选择题,则不需要去fork仓库以及中间层的相关操作了 + ActiveRecord::Base.transaction do unless is_choice_type # fork仓库 - project_fork(myshixun, @repo_path, current_user.login) - - rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path ) + cloud_bridge = edu_setting('cloud_bridge') + project_fork(@myshixun, @repo_path, current_user.login) + rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path) uid_logger("start openGameInstance") uri = "#{cloud_bridge}/bridge/game/openGameInstance" logger.info("end openGameInstance") - params = {tpiID: "#{myshixun.id}", tpmGitURL:rep_url, tpiRepoName: myshixun.repo_name.split("/").last} + params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last} uid_logger("openGameInstance params is #{params}") interface_post uri, params, 83, "实训云平台繁忙(繁忙等级:83)" end - - @current_task = myshixun.current_task(myshixun.games) - uid_logger("## shixun exec: myshixun id is #{myshixun.id}") - rescue Exception => e - uid_logger_error(e.message) - tip_exception("实训云平台繁忙(繁忙等级:81)") - raise ActiveRecord::Rollback end + rescue Exception => e + if e.message != "ActiveRecord::RecordInvalid" + logger.error("##########project_fork error #{e.message}") + @current_task.destroy! + end + raise ActiveRecord::Rollback end end end diff --git a/app/controllers/stages_controller.rb b/app/controllers/stages_controller.rb index c62832365..3967554aa 100644 --- a/app/controllers/stages_controller.rb +++ b/app/controllers/stages_controller.rb @@ -39,7 +39,7 @@ class StagesController < ApplicationController def update ActiveRecord::Base.transaction do begin - @stage.update_attributes(stage_params) + @stage.update_attributes!(stage_params) @stage.stage_shixuns.destroy_all unless params[:shixun_id].blank? params[:shixun_id].each do |shixun_id| @@ -50,7 +50,7 @@ class StagesController < ApplicationController @subject.update_attributes(updated_at: Time.now) rescue Exception => e uid_logger_error(e.message) - tip_exception("章节更新失败") + tip_exception(e.message) raise ActiveRecord::Rollback end end diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index cc0e06a38..5cbb2a462 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -207,7 +207,7 @@ class SubjectsController < ApplicationController end rescue Exception => e uid_logger(e.message) - tip_exception("发送失败") + tip_exception(e.message) raise ActiveRecord::Rollback end end diff --git a/app/models/stage.rb b/app/models/stage.rb index d255cddeb..db7b5c0b3 100644 --- a/app/models/stage.rb +++ b/app/models/stage.rb @@ -6,6 +6,6 @@ class Stage < ApplicationRecord has_many :stage_shixuns, -> { order("stage_shixuns.position ASC") }, dependent: :destroy has_many :shixuns, :through => :stage_shixuns - validates :name, length: { maximum: 30 } + validates :name, length: { maximum: 60 } validates :description, length: { maximum: 300 } end diff --git a/public/react/src/common/components/Cropper.js b/public/react/src/common/components/Cropper.js index 632950434..3ce30a8b5 100644 --- a/public/react/src/common/components/Cropper.js +++ b/public/react/src/common/components/Cropper.js @@ -102,7 +102,7 @@ class Cropper extends Component { setTimeout(() => { const image = document.getElementById(this.props.imageId || '__image'); this.cropper = new window.Cropper(image, this.options); - }, 1000) + }, 1200) } renew = (image) => { diff --git a/public/react/src/modules/courses/busyWork/UseBank.js b/public/react/src/modules/courses/busyWork/UseBank.js index 671a09fff..ca65e74be 100644 --- a/public/react/src/modules/courses/busyWork/UseBank.js +++ b/public/react/src/modules/courses/busyWork/UseBank.js @@ -194,7 +194,7 @@ class UseBank extends Component{ display: -webkit-flex; } .setImgW .edu-nodata-img{ - width:218px !important; + width: 170px !important; } .bankwidth{ width:24% !important; diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 2a395200c..707c4ba9b 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -408,7 +408,7 @@ class Coursesleftnav extends Component{ this.setState({ Navmodalname:id===2?"新建分班":"添加目录", Navtitles:id===2?"分班名称":"目录名称", - Navplaceholder:id===2?"示例:分班(最佳4个字符)":"示例:第一阶段(最佳4个字符)", + Navplaceholder:"请输入名称,最大限制60个字符", Navmodalnametype:true, Navmodaltypename:id, setnavid:setnavid, @@ -419,7 +419,7 @@ class Coursesleftnav extends Component{ this.setState({ Navmodalname:id===5?"分班重命名":"目录重命名", Navtitles:id===5?"分班名称":"目录名称", - Navplaceholder:id===5?"示例:分班(最佳4个字符)":"示例:第一阶段(最佳4个字符)", + Navplaceholder:"请输入名称,最大限制60个字符", Navmodalnametype:true, Navmodaltypename:id, setnavid:setnavid, diff --git a/public/react/src/modules/courses/coursesPublic/AddcoursesNav.js b/public/react/src/modules/courses/coursesPublic/AddcoursesNav.js index 74c03808a..756ae62a6 100644 --- a/public/react/src/modules/courses/coursesPublic/AddcoursesNav.js +++ b/public/react/src/modules/courses/coursesPublic/AddcoursesNav.js @@ -1,74 +1,74 @@ -import React,{ Component } from "react"; -import { Modal,Checkbox,Input,Select} from "antd"; -const Option = Select.Option; - -class AddcoursesNav extends Component{ - constructor(props){ - super(props); - this.state={ - StudentList_value:"" - } - } - - - - render(){ - // let {StudentList_value}=this.state; - // let {child}=this.props; - // - return( -
- - - - {this.props.addnametab===2? -
-
目录名称:
- -
- 取消 - 确定 -
-
- : this.props.addnametab===4? -
-
选择目录名称:
- - - -
- 取消 - 确定 -
-
- :""} -
- -
- ) - } -} -export default AddcoursesNav; - - +import React,{ Component } from "react"; +import { Modal,Checkbox,Input,Select} from "antd"; +const Option = Select.Option; + +class AddcoursesNav extends Component{ + constructor(props){ + super(props); + this.state={ + StudentList_value:"" + } + } + + + + render(){ + // let {StudentList_value}=this.state; + // let {child}=this.props; + // + return( +
+ + + + {this.props.addnametab===2? +
+
目录名称:
+ +
+ 取消 + 确定 +
+
+ : this.props.addnametab===4? +
+
选择目录名称:
+ + + +
+ 取消 + 确定 +
+
+ :""} +
+ +
+ ) + } +} +export default AddcoursesNav; + + diff --git a/public/react/src/modules/courses/coursesPublic/ModalsRename.js b/public/react/src/modules/courses/coursesPublic/ModalsRename.js index 61d0c1cd7..1398c50ff 100644 --- a/public/react/src/modules/courses/coursesPublic/ModalsRename.js +++ b/public/react/src/modules/courses/coursesPublic/ModalsRename.js @@ -1,63 +1,63 @@ -import React,{ Component } from "react"; -import { Modal,Checkbox,Upload,Button,Icon,message,Input} from "antd"; -import axios from 'axios'; - -class ModalsRename extends Component{ - constructor(props){ - super(props); - this.state={ - name:this.props.NavmodalValue - } - } - - saveNavmoda=()=>{ - let{url}=this.props; - let{name}=this.state; - - axios.post(url, {name:name}).then((result) => { - if(result.data.status===0){ - this.props.showNotification(result.data.message); - this.props.cannerNavmoda(); - this.props.coursupdata(); - }} - ) - } - - setNavmodalValue=(e)=>{ - console.log(e.target.value) - this.setState({ - name:e.target.value - }) - } - - render(){ - return( -
- -
{this.props.Navname}名称:
- -
- this.props.cannerNavmoda()}>取消 - this.saveNavmoda()}>确定 -
-
-
- ) - } -} +import React,{ Component } from "react"; +import { Modal,Checkbox,Upload,Button,Icon,message,Input} from "antd"; +import axios from 'axios'; + +class ModalsRename extends Component{ + constructor(props){ + super(props); + this.state={ + name:this.props.NavmodalValue + } + } + + saveNavmoda=()=>{ + let{url}=this.props; + let{name}=this.state; + + axios.post(url, {name:name}).then((result) => { + if(result.data.status===0){ + this.props.showNotification(result.data.message); + this.props.cannerNavmoda(); + this.props.coursupdata(); + }} + ) + } + + setNavmodalValue=(e)=>{ + console.log(e.target.value) + this.setState({ + name:e.target.value + }) + } + + render(){ + return( +
+ +
{this.props.Navname}名称:
+ +
+ this.props.cannerNavmoda()}>取消 + this.saveNavmoda()}>确定 +
+
+
+ ) + } +} export default ModalsRename; \ No newline at end of file diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index c8b090b8b..73c1dded9 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -301,7 +301,7 @@ class CoursesNew extends Component { if(value!=""){ this.props.form.setFieldsValue({ classroom:value, - course:value + // course:value }); this.Searchvalue(value) } @@ -311,7 +311,7 @@ class CoursesNew extends Component { handleChange=(value)=>{ this.props.form.setFieldsValue({ - course:value, + // course:value, classroom:value }) }; @@ -320,7 +320,7 @@ class CoursesNew extends Component { if(value!="") { this.props.form.setFieldsValue({ - school: value, + // school: value, fetching: true, }); @@ -331,7 +331,7 @@ class CoursesNew extends Component { handleChangeschools=(value)=>{ this.props.form.setFieldsValue({ - school: value, + // school: value, fetching: true, }); } @@ -347,9 +347,9 @@ class CoursesNew extends Component { }; getschool=(value)=>{ - this.props.form.setFieldsValue({ - school: value - }) + // this.props.form.setFieldsValue({ + // school: value + // }) let url="/schools/school_list.json"; axios.get(url,{ params: { @@ -359,7 +359,7 @@ class CoursesNew extends Component { if (result.data.status===0) { this.setState({ searchlistscholl: result.data.school_names, - school: value + // school: value }) } @@ -367,9 +367,9 @@ class CoursesNew extends Component { console.log(error) }) } - showApplyForAddOrgModal = () => { - this.applyForAddOrgForm.setVisible(true) - } + showApplyForAddOrgModal = () => { + this.applyForAddOrgForm.setVisible(true) + } render() { let {datatime,school,searchlistscholl} = this.state; const {getFieldDecorator} = this.props.form; diff --git a/public/react/src/modules/paths/Index.js b/public/react/src/modules/paths/Index.js index a26228ed5..a7efc43bc 100644 --- a/public/react/src/modules/paths/Index.js +++ b/public/react/src/modules/paths/Index.js @@ -1,52 +1,58 @@ -import React, { Component } from 'react'; - -import { SnackbarHOC } from 'educoder'; - - -import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; -import Loadable from 'react-loadable'; -import Loading from '../../Loading'; -import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; - -const PathsDetail = Loadable({ - loader: () => import('./PathDetail/PathDetailIndex'), - loading:Loading, -}) -const PathsNew = Loadable({ - loader: () => import('./PathNew'), - loading:Loading, -}) -const Statistics = Loadable({ - loader: () => import('./SchoolStatistics/Statistics'), - loading:Loading -}) - -const ShixunPaths = Loadable({ - loader: () => import('./ShixunPaths'), - loading:Loading, -}) - - -class Index extends Component{ - constructor(props) { - super(props) - } - render() { - return ( -
- - - ()} - > - ()} - > - - - -
- ) - } -} +import React, { Component } from 'react'; + +import { SnackbarHOC } from 'educoder'; + + +import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; +import Loadable from 'react-loadable'; +import Loading from '../../Loading'; +import { TPMIndexHOC } from '../tpm/TPMIndexHOC'; + +const PathsDetail = Loadable({ + loader: () => import('./PathDetail/PathDetailIndex'), + loading:Loading, +}) +const PathsNew = Loadable({ + loader: () => import('./PathNew'), + loading:Loading, +}) +const Statistics = Loadable({ + loader: () => import('./SchoolStatistics/Statistics'), + loading:Loading +}) + +const ShixunPaths = Loadable({ + loader: () => import('./ShixunPaths'), + loading:Loading, +}) + + +class Index extends Component{ + constructor(props) { + super(props) + } + render() { + return ( +
+ + + + ()} + > + ()} + > + + ()} + > + + {/**/} + + +
+ ) + } +} export default SnackbarHOC() ( TPMIndexHOC(Index) ); \ No newline at end of file diff --git a/public/react/src/modules/paths/PathDetail/DetailCards.js b/public/react/src/modules/paths/PathDetail/DetailCards.js index 115f7066c..0e95f1a48 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCards.js +++ b/public/react/src/modules/paths/PathDetail/DetailCards.js @@ -314,6 +314,7 @@ class DetailCards extends Component{ showparagraphindex }=this.state; const antIcon = ; + return(
+
{ pathCardsList && pathCardsList.map((item,key)=>{ @@ -374,7 +388,7 @@ class DetailCards extends Component{ - {item.stage_name} + {item.stage_name} { idsum===key&&pathCardsedittype===true?'': @@ -442,13 +456,13 @@ class DetailCards extends Component{ : } - + {key+1}-{index+1}  {line.shixun_name} { - line.shixun_status==="暂未公开"? + this.props.current_user&&this.props.current_user.admin===false&&line.shixun_status==="暂未公开"?
  • 暂未公开
  • :
  • diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js index 340505655..912302cb8 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js @@ -402,7 +402,7 @@ class DetailCardsEditAndAdd extends Component{
    *
    - +
    名称不能为空
    必填项
    diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js index 1bf137016..f91cf0e96 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js @@ -435,7 +435,7 @@ class DetailCardsEditAndEdit extends Component{
    *
    - +
    名称不能为空
    必填项
    diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index 1731064c0..61933b765 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -140,10 +140,13 @@ class PathDetailIndex extends Component{ let url="/paths/"+pathid+".json"; axios.get(url).then((result)=>{ if (result.data.status === 407 || result.data.status === 401) { + debugger return; } if (result.data.status === 403) { + debugger + window.location.href = "/403"; return; } @@ -165,9 +168,12 @@ class PathDetailIndex extends Component{ axios.get(url).then((result)=>{ // TODO 403 让后台返回status 403 比较好 if (result.data.status == 407 || result.data.status == 401) { + debugger return; } if (result.data.status === 403 ) { + debugger + window.location.href = "/403"; return; } diff --git a/public/react/src/modules/user/account/ChangeHeaderPicModal.js b/public/react/src/modules/user/account/ChangeHeaderPicModal.js index abb3d0e12..cef643094 100644 --- a/public/react/src/modules/user/account/ChangeHeaderPicModal.js +++ b/public/react/src/modules/user/account/ChangeHeaderPicModal.js @@ -105,11 +105,16 @@ class ChangeHeaderPicModal extends Component{ .then((response) => { // {"status":0,"message":"success","avatar_url":"avatars/User/15739"} if (response.data.status == 0) { - // this.props.getBasicInfo() - this.props.fetchUser() - // 头像更新后会触发AccountPage的DidUpdate,然后会调用getBasicInfo - this.props.showNotification && this.props.showNotification("修改头像成功") - this.setVisible(false) + // this.props.getBasicInfo() + // https://www.trustie.net/issues/22461 + if ( this.props.current_user.image_url.indexOf('avatars/User/b') != -1 + || this.props.current_user.image_url.indexOf('avatars/User/g') != -1 ) { + this.setTimeout(() => { + this.doAfterUpdated() + }, 1000) + } else { + this.doAfterUpdated(); + } } }) .catch(function (error) { @@ -117,6 +122,12 @@ class ChangeHeaderPicModal extends Component{ }); }); } + doAfterUpdated = () => { + this.props.fetchUser() + // 头像更新后会触发AccountPage的DidUpdate,然后会调用getBasicInfo + this.props.showNotification && this.props.showNotification("修改头像成功") + this.setVisible(false) + } render(){ const { course_lists } = this.state