diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index 814d16d51..5f5eddddc 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -61,7 +61,10 @@ class HackUserLastestCodesController < ApplicationController # 提交记录 def submit_records - @records = @my_hack.hack_user_codes.created_order + records = @my_hack.hack_user_codes + @records_count = records.count + @records = paginate records.created_order + end @@ -163,12 +166,12 @@ class HackUserLastestCodesController < ApplicationController # 通关 if submit_params[:status] == "0" # 编程题已经发布,且之前未通关奖励积分 + @hack.increment!(:pass_num) if @hack.status == 1 && !@my_hack.passed? reward_attrs = { container_id: game.id, container_type: 'Hack', score: @hack.score } RewardGradeService.call(@my_hack.user, reward_attrs) RewardExperienceService.call(@my_hack.user, reward_attrs) # 评测完成更新通过数 - @hack.increment!(:pass_num) @my_hack.update_attributes(passed: true, passed_time: Time.now) end end diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index 7a0fb7635..f93b2dab5 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -100,6 +100,7 @@ class HacksController < ApplicationController @hack.update_attribute(:status, 1) base_attrs = { trigger_user_id: current_user.id, viewed: 0, tiding_type: 'System', user_id: @hack.user_id, + parent_container_type: "HackPublish" } @hack.tidings.create!(base_attrs) render_ok @@ -109,7 +110,8 @@ class HacksController < ApplicationController def cancel_publish @hack.update_attribute(:status, 0) base_attrs = { - trigger_user_id: current_user.id, viewed: 0, tiding_type: 'System', user_id: @hack.user_id + trigger_user_id: current_user.id, viewed: 0, tiding_type: 'System', user_id: @hack.user_id, + parent_container_type: "HackUnPublish" } @hack.tidings.create!(base_attrs) render_ok @@ -129,8 +131,19 @@ class HacksController < ApplicationController def new;end def destroy - @hack.destroy - render_ok + begin + base_attrs = { + user_id: @hack.user_id, viewed: 0, tiding_type: 'System', trigger_user_id: current_user.id, + parent_container_type: "HackDelete", extra: "#{@hack.name}" + } + @hack.tidings.create!(base_attrs) + @hack.destroy + render_ok + rescue => e + logger.error("####hack_delete_error: #{e.message}") + render_error("删除失败") + end + end private diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb index 988cef01a..6cc78536a 100644 --- a/app/controllers/jupyters_controller.rb +++ b/app/controllers/jupyters_controller.rb @@ -80,4 +80,17 @@ class JupytersController < ApplicationController render json: {status: 0} end + def timeinfo_with_tpm + shixun = Shixun.find_by(identifier: params[:identifier]) + info = jupyter_timeinfo_tpm(shixun) + render json: {status: 0}.merge(info) + end + + def timeinfo_with_tpi + myshixun = Myshixun.find_by(identifier: params[:identifier]) + info = jupyter_timeinfo_tpi(shixun) + render json: {status: 0}.merge(info) + end + + end diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 0e9ba477a..255c0f42e 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -376,7 +376,7 @@ class MyshixunsController < ApplicationController # todo: identifier 是以前的密码,用来验证的,新版如果不需要,和中间层协调更改. params = {tpiID: "#{@myshixun.try(:id)}", tpiGitURL: "#{git_myshixun_url}", tpmGitURL: "#{git_shixun_url}", identifier: "xinhu1ji2qu3"} - uri = "#{shixun_tomcat}/bridge/game/resetTpmRepository" + uri = "#{shixun_tomcat}/bridge/game/resetJupyterTpm" res = uri_post uri, params if (res && res['code'] != 0) tip_exception("实训云平台繁忙(繁忙等级:95)") diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 940955e93..859dce6f6 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -216,7 +216,7 @@ class ShixunsController < ApplicationController ShixunInfo.create!(shixun_id: @new_shixun.id, description: @shixun.description, evaluate_script: @shixun.evaluate_script, - shixun_reason: params[:reason].to_s.strip) + fork_reason: params[:reason].to_s.strip) end # 同步私密版本库 @@ -363,7 +363,7 @@ class ShixunsController < ApplicationController page = params[:page] || 1 limit = params[:limit] || 10 @member_count = @shixun.shixun_members.count - @members = @shixun.shixun_members.includes(:user).page(page).per(limit) + @members = @shixun.shixun_members.order("role = 1 desc, created_at asc").includes(:user).page(page).per(limit) end def fork_list diff --git a/app/decorators/grade_decorator.rb b/app/decorators/grade_decorator.rb index ffffa11c9..b89cd99ce 100644 --- a/app/decorators/grade_decorator.rb +++ b/app/decorators/grade_decorator.rb @@ -31,6 +31,9 @@ module GradeDecorator when 'check_ta_answer' then game = Game.find_by(id: container_id) game.present? ? "查看实训“#{game.challenge.shixun.name}”第#{game.challenge.position}关的TA人解答消耗的金币" : '' + when 'hack' then + hack = Hack.find_by(id: container_id) + game.present? ? "完成了题目解答“#{hack.name}”,获得金币奖励:#{hack.score}" : '' end end end \ No newline at end of file diff --git a/app/decorators/tiding_decorator.rb b/app/decorators/tiding_decorator.rb index 130e7f4b8..8e0c402dd 100644 --- a/app/decorators/tiding_decorator.rb +++ b/app/decorators/tiding_decorator.rb @@ -220,11 +220,13 @@ module TidingDecorator when 'Journal' then message = parent_container&.notes.present? ? ':' + message_content_helper(parent_container.notes) : '' I18n.t(locale_format(parent_container_type)) % message + when 'Hack' then + I18n.t(locale_format(parent_container_type)) % parent_container.name end end def discuss_content - I18n.t(locale_format(container.parent_id.present?)) % message_content_helper(container.content) + I18n.t(locale_format(container_type, container.parent_id.present?)) % message_content_helper(container.content) end def grade_content @@ -250,6 +252,9 @@ module TidingDecorator when 'shixunPublish' then name = Shixun.find_by(id: parent_container_id)&.name || '---' I18n.t(locale_format(parent_container_type)) % [name, container.score] + when 'Hack' then + name = Hack.find_by(id: container_id)&.name || '---' + I18n.t(locale_format(parent_container_type)) % [name, container.score] else I18n.t(locale_format(parent_container_type)) % container.score end @@ -405,4 +410,8 @@ module TidingDecorator def subject_start_course_content I18n.t(locale_format) % belong_container&.name end + + def hack_content + I18n.t(locale_format(parent_container_type)) % (container&.name || extra) + end end diff --git a/app/models/discuss.rb b/app/models/discuss.rb index 148d6518b..4491a886c 100644 --- a/app/models/discuss.rb +++ b/app/models/discuss.rb @@ -59,7 +59,7 @@ class Discuss < ApplicationRecord elsif dis_type == 'Hack' user_id = has_parent? ? parent.user_id : Hack.find(dis_id).user_id parent_container_type = 'Hack' - challenge_id = nil + challenge_id = dis_id end base_attrs = { trigger_user_id: user_id, parent_container_id: challenge_id, parent_container_type: parent_container_type, diff --git a/app/models/hack.rb b/app/models/hack.rb index d1ec3932c..37e1f239d 100644 --- a/app/models/hack.rb +++ b/app/models/hack.rb @@ -14,7 +14,7 @@ class Hack < ApplicationRecord # 点赞 has_many :praise_treads, as: :praise_tread_object, dependent: :destroy # 消息 - has_many :tidings, as: :container, dependent: :destroy + has_many :tidings, as: :container belongs_to :user @@ -23,8 +23,6 @@ class Hack < ApplicationRecord scope :opening, -> {where(open_or_not: 1)} scope :mine, -> (author_id){ where(user_id: author_id) } - after_destroy :send_delete_tiding - def language if hack_codes.count == 1 hack_codes.first.language @@ -53,12 +51,4 @@ class Hack < ApplicationRecord user_id == user.id || user.admin_or_business? end - private - def send_delete_tiding - base_attrs = { - user_id: user_id, viewed: 0, tiding_type: 'Delete', trigger_user_id: current_user.id, content: "你删除了题目:#{name}" - } - tidings.create!(base_attrs) - end - end diff --git a/app/models/shixun_info.rb b/app/models/shixun_info.rb index 321b4c44a..7f7aa364e 100644 --- a/app/models/shixun_info.rb +++ b/app/models/shixun_info.rb @@ -1,6 +1,7 @@ class ShixunInfo < ApplicationRecord belongs_to :shixun validates_uniqueness_of :shixun_id + validates_length_of :fork_reason, maximum: 60 after_commit :create_diff_record private diff --git a/app/services/jupyter_service.rb b/app/services/jupyter_service.rb index bff9b5dc6..29f54cb02 100644 --- a/app/services/jupyter_service.rb +++ b/app/services/jupyter_service.rb @@ -213,4 +213,27 @@ module JupyterService _jupyter_active(tpiID) end + def _jupyter_timeinfo(tpiID) + shixun_tomcat = edu_setting('cloud_bridge') + uri = "#{shixun_tomcat}/bridge/jupyter/getTimeInfo" + params = {:tpiID => tpiID} + res = uri_post uri, params + if res && res['code'].to_i != 0 + raise("实训云平台繁忙(繁忙等级:130)") + end + + res['data'] + end + + # 获取时间参数 + def jupyter_timeinfo_tpm(shixun) + tpiID = "tpm#{shixun.id}" + _jupyter_timeinfo(tpiID) + end + + # 获取时间参数 + def jupyter_timeinfo_tpi(myshixun) + tpiID = myshixun.id + _jupyter_timeinfo(tpiID) + end end diff --git a/app/views/comments/_discuss.json.jbuilder b/app/views/comments/_discuss.json.jbuilder index fed402ffa..55b27acdf 100644 --- a/app/views/comments/_discuss.json.jbuilder +++ b/app/views/comments/_discuss.json.jbuilder @@ -12,4 +12,5 @@ if discuss.parent_id else json.praise_count discuss.praises_count json.user_praise discuss.praise_treads.select{|pt| pt.user_id == current_user.id}.length > 0 + json.can_delete discuss.can_deleted?(current_user) && child.count == 0 end \ No newline at end of file diff --git a/app/views/comments/index.json.jbuilder b/app/views/comments/index.json.jbuilder index b176d00b9..bfdbdacbb 100644 --- a/app/views/comments/index.json.jbuilder +++ b/app/views/comments/index.json.jbuilder @@ -1,6 +1,6 @@ json.disscuss_count @discusses_count json.comments @discusses do |discuss| - json.partial! 'comments/discuss', locals: { discuss: discuss} + json.partial! 'comments/discuss', locals: { discuss: discuss, child: discuss.child_discuss(current_user)} json.children discuss.child_discuss(current_user) do |c_d| json.partial! 'comments/discuss', locals: { discuss: c_d } end diff --git a/app/views/hack_user_lastest_codes/submit_records.json.jbuilder b/app/views/hack_user_lastest_codes/submit_records.json.jbuilder index 797bda742..a73d58c4e 100644 --- a/app/views/hack_user_lastest_codes/submit_records.json.jbuilder +++ b/app/views/hack_user_lastest_codes/submit_records.json.jbuilder @@ -1,4 +1,8 @@ -json.array! @records do |hack_user| - json.(hack_user, :id, :created_at, :status, :execute_time, :execute_memory) - json.language hack_user.hack.language -end \ No newline at end of file +json.records do + json.array! @records do |hack_user| + json.(hack_user, :id, :created_at, :status, :execute_time, :execute_memory) + json.language hack_user.hack.language + end +end + +json.records_count @records_count \ No newline at end of file diff --git a/app/views/shixuns/get_data_sets.json.jbuilder b/app/views/shixuns/get_data_sets.json.jbuilder index 82ef309f7..f800d1c32 100644 --- a/app/views/shixuns/get_data_sets.json.jbuilder +++ b/app/views/shixuns/get_data_sets.json.jbuilder @@ -10,4 +10,5 @@ json.data_sets do json.file_path "#{@absolute_folder}/#{set.relative_path_filename}".gsub("/#{@shixun.identifier}", "") end end -json.data_sets_count @data_count \ No newline at end of file +json.data_sets_count @data_count +json.folder_name @absolute_folder \ No newline at end of file diff --git a/bin/bundle b/bin/bundle old mode 100644 new mode 100755 diff --git a/bin/rails b/bin/rails old mode 100644 new mode 100755 diff --git a/bin/rake b/bin/rake old mode 100644 new mode 100755 diff --git a/bin/setup b/bin/setup old mode 100644 new mode 100755 diff --git a/bin/update b/bin/update old mode 100644 new mode 100755 diff --git a/bin/yarn b/bin/yarn old mode 100644 new mode 100755 diff --git a/config/locales/tidings/zh-CN.yml b/config/locales/tidings/zh-CN.yml index f484efdc1..cdde0f97f 100644 --- a/config/locales/tidings/zh-CN.yml +++ b/config/locales/tidings/zh-CN.yml @@ -93,6 +93,7 @@ Challenge: "1_end": "赞了你发布的实训任务:%s,第%s关" "2_end": "踩了你发布的实训任务:%s,第%s关" + Hack_end: "赞了你发布的题目:%s" Memo: true_end: "赞了你的评论:%s" false_end: "赞了发布的帖子:%s" @@ -107,8 +108,16 @@ Issue_end: "赞了你发布的项目Issue:%s" Journal_end: "赞了你的回复%s" Discuss: - true_end: "评论了你的回复:%s" - false_end: "评论了你发布的实训:%s" + Shixun: + true_end: "评论了你的回复:%s" + false_end: "评论了你发布的实训:%s" + Hack: + true_end: "评论了你的回复:%s" + false_end: "评论了你发布的题目:%s" + Hack: + HackPublish_end: "你发布了题目:%s" + HackUnPublish_end: "你撤销发布了题目:%s" + HackDelete_end: "你删除了题目:%s" Grade: Avatar_end: "首次上传头像获得金币奖励:%s金币" Phone_end: "首次绑定手机号码获得金币奖励:%s金币" @@ -118,6 +127,7 @@ Answer: true_end: "查看实训%s第%s关的参考答案消耗金币:%s金币" false_end: "查看实训的参考答案消耗金币:%s金币" + Hack_end: "完成题目解答:%s,获得金币奖励:%s金币" Game_end: "通过实训%s的第%s关获得金币奖励:%s金币" Memo_end: "发布的评论或者帖子获得平台奖励:%s金币" Discusses_end: "发布的评论获得金币奖励:%s金币" diff --git a/config/routes.rb b/config/routes.rb index 45bd13680..7a68ed5e2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -35,6 +35,8 @@ Rails.application.routes.draw do get :reset_with_tpm get :active_with_tpm get :active_with_tpi + get :timeinfo_with_tpm + get :timeinfo_with_tpi post :import_with_tpm end diff --git a/db/migrate/20191225035117_modify_open_or_not_for_hacks.rb b/db/migrate/20191225035117_modify_open_or_not_for_hacks.rb new file mode 100644 index 000000000..6b67d2dfd --- /dev/null +++ b/db/migrate/20191225035117_modify_open_or_not_for_hacks.rb @@ -0,0 +1,5 @@ +class ModifyOpenOrNotForHacks < ActiveRecord::Migration[5.2] + def change + change_column :hacks, :open_or_not, :boolean, :default => false + end +end diff --git a/public/javascripts/jupyter.js b/public/javascripts/jupyter.js index 5ffd34dd4..192b15fe8 100644 --- a/public/javascripts/jupyter.js +++ b/public/javascripts/jupyter.js @@ -37,9 +37,9 @@ document.addEventListener('keydown', (e) => { if(e.data==="stopParent"){ //重置停止 timebool=false; - console.log("父窗口调用停止"); + // console.log("父窗口调用停止"); }else if(e.data==="clonsParent"){ - console.log("父窗口调用启动"); + // console.log("父窗口调用启动"); //取消启动 timebool=true; // runEvery10Sec(); diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index 86938e51d..4e28af31f 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -30,7 +30,7 @@ const env = getClientEnvironment(publicUrl); module.exports = { // You may want 'eval' instead if you prefer to see the compiled output in DevTools. // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s - // devtool: "cheap-module-eval-source-map", + devtool: "cheap-module-eval-source-map", // 开启调试 //devtool: "source-map", // 开启调试 // These are the "entry points" to our application. diff --git a/public/react/src/common/components/comment/CommentIcon.js b/public/react/src/common/components/comment/CommentIcon.js index 97a57da5e..9e9650b47 100644 --- a/public/react/src/common/components/comment/CommentIcon.js +++ b/public/react/src/common/components/comment/CommentIcon.js @@ -4,11 +4,11 @@ * @Github: * @Date: 2019-12-18 10:49:46 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-24 18:04:52 + * @LastEditTime : 2019-12-25 10:03:21 */ import './index.scss'; import React from 'react'; -import { Icon } from 'antd'; +// import { Icon } from 'antd'; // import MyIcon from '../MyIcon'; function CommentIcon ({ type, // 图标类型 @@ -25,13 +25,15 @@ function CommentIcon ({ } const _className = [undefined, null, ''].includes(count) ? 'comment_count_none' : 'comment_count'; + const _classIcon = `iconfont icon-${type} icon_font_size_14 comment_icon `; return ( - + {/* */} + { count } ) diff --git a/public/react/src/common/components/comment/CommentItem.js b/public/react/src/common/components/comment/CommentItem.js index e3a229c50..7360ddfd6 100644 --- a/public/react/src/common/components/comment/CommentItem.js +++ b/public/react/src/common/components/comment/CommentItem.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-17 17:35:17 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-24 18:05:18 + * @LastEditTime : 2019-12-25 14:53:41 */ import './index.scss'; import React, { useState } from 'react'; @@ -28,7 +28,7 @@ function CommentItem ({ // 加载更多评论内容 // const [showMore, setShowMore] = useState(false); // 显示子列数 - const [showItemCount, setShowItemCount] = useState(1); + const [showItemCount, setShowItemCount] = useState(5); // 箭头方向 const [arrow, setArrow] = useState(false); @@ -74,7 +74,7 @@ function CommentItem ({ {author.name || ''} {time || ''} - deleteComment(id)}/> + deleteComment(id)}> ); @@ -95,7 +95,7 @@ function CommentItem ({ const commentAppend = (children = []) => { const len = children.length; - const _moreClass = len > 1 ? 'comment_item_loadmore show' : 'comment_item_loadmore' + const _moreClass = len > showItemCount ? 'comment_item_loadmore show' : 'comment_item_loadmore' const lastTxt = len - showItemCount; const renderChild = (children) => { return children.map((child, i) => { @@ -112,7 +112,7 @@ function CommentItem ({ key={`child_${i}`} className={showOrHide} > -
+
{commentAvatar(author)}
{commentInfo(id, author, time, can_delete)} @@ -179,13 +179,14 @@ function CommentItem ({ handleShowOrHide(id, !hidden ? 1 : 0)} /> {/* 回复 */} {/* 点赞 */} @@ -193,7 +194,7 @@ function CommentItem ({ iconColor={ user_praise ? '#5091FF' : '' } className='comment-icon-margin' theme={user_praise ? 'filled' : ''} - type="like" + type="dianzan" count={praise_count} iconClick={() => handleClickLick(id)} /> diff --git a/public/react/src/common/components/comment/index.scss b/public/react/src/common/components/comment/index.scss index 2e1dc4880..067fc7e9a 100644 --- a/public/react/src/common/components/comment/index.scss +++ b/public/react/src/common/components/comment/index.scss @@ -27,6 +27,13 @@ $ml: 20px; padding: 20px 0; box-sizing: border-box; border-bottom: 1px solid $bdColor; + + .comment_child_item_area:hover{ + .item-close{ + display: inline-block; + } + } + .flex-image{ width: 48px; height: 48px; @@ -46,7 +53,7 @@ $ml: 20px; margin-left: $ml; } .item-close{ - display: inline-block; + display: none; cursor: pointer; float: right; } @@ -54,6 +61,7 @@ $ml: 20px; .item-close.hide{ display: none; } + } .item-ctx{ line-height: $lh22; @@ -140,6 +148,10 @@ $ml: 20px; } } } + + .icon_font_size_14{ + font-size: 14px !important; + } } .comment_form_area, diff --git a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js index 1f7518a9d..f9318eb9d 100644 --- a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js +++ b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js @@ -25,23 +25,22 @@ class NewShixunModel extends Component{ } componentDidMount() { let{page,type,keyword,order,diff,limit,status,sort}=this.state; - let newsort=sort - if(this.props&&this.props.user.course_name===undefined){ - newsort="created_at"; - }else{ - newsort="publish_time"; - } - if(this.props.type==='shixuns'){ - this.getdatalist(page,type,status,keyword,order,diff,limit,undefined,newsort); + this.getdatalist(page,type,status,keyword,order,diff,limit,undefined,sort); }else{ this.getdatalist(page,type,undefined,keyword,order,undefined,limit,undefined,sort); } - } - getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype,sort)=>{ - + getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype,sorts)=>{ + let newsort=sorts; + if(this.props.type==="shixuns"&&type==="mine"){ + if(this.props&&this.props.user.course_name===undefined){ + newsort="created_at"; + }else{ + newsort="publish_time"; + } + } this.setState({ isspinning:true }) @@ -53,14 +52,14 @@ class NewShixunModel extends Component{ url="/subject_lists.json"; } axios.get(url,{params:{ - page, - type, - status, - keyword, - order, - diff, - limit, - sort + page:page, + type:type, + status:status, + keyword:keyword, + order:order, + diff:diff, + limit:limit, + sort:newsort }}).then((response) => { if(response.data){ if(pagetype===undefined){ diff --git a/public/react/src/modules/developer/components/errorResult/index.js b/public/react/src/modules/developer/components/errorResult/index.js index fa568edca..f92ea1773 100644 --- a/public/react/src/modules/developer/components/errorResult/index.js +++ b/public/react/src/modules/developer/components/errorResult/index.js @@ -3,8 +3,8 @@ * @Author: tangjiang * @Github: * @Date: 2019-12-03 15:20:55 - * @LastEditors: tangjiang - * @LastEditTime: 2019-12-03 20:36:24 + * @LastEditors : tangjiang + * @LastEditTime : 2019-12-25 11:41:42 */ import './index.scss'; import React from 'react'; @@ -46,6 +46,7 @@ function ErrorResult (props) { case 3: // 创建pod失败 result = (
+

系统繁忙,请稍后重试

); break; diff --git a/public/react/src/modules/developer/components/execResult/index.js b/public/react/src/modules/developer/components/execResult/index.js index 6f9341b9a..fe90e904b 100644 --- a/public/react/src/modules/developer/components/execResult/index.js +++ b/public/react/src/modules/developer/components/execResult/index.js @@ -3,8 +3,8 @@ * @Author: tangjiang * @Github: * @Date: 2019-11-28 08:44:54 - * @LastEditors: tangjiang - * @LastEditTime: 2019-12-19 10:44:16 + * @LastEditors : tangjiang + * @LastEditTime : 2019-12-25 11:42:10 */ import './index.scss'; import React, { useState, useEffect } from 'react'; @@ -82,7 +82,7 @@ function ExecResult (props) { } else if (state === 4){ return (

- {error_msg} + 系统繁忙,请稍后重试

) } else if (state === -1) { diff --git a/public/react/src/modules/developer/components/textNumber/index.js b/public/react/src/modules/developer/components/textNumber/index.js index 77a58c3e8..a8f743d16 100644 --- a/public/react/src/modules/developer/components/textNumber/index.js +++ b/public/react/src/modules/developer/components/textNumber/index.js @@ -4,11 +4,11 @@ * @Github: * @Date: 2019-11-27 10:58:37 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-24 16:48:56 + * @LastEditTime : 2019-12-25 10:02:03 */ import './index.scss'; import React from 'react'; -import { Icon } from 'antd'; +// import { Icon } from 'antd'; const numberal = require('numeral'); const TextNumber = (props) => { @@ -47,14 +47,18 @@ const TextNumber = (props) => { const renderCtx = (className, theme) => { if (type === 'icon') { // 图标加文字时 const _className = `text_number_area text_icon_numb flex_${position} ${className}`; + const _classIcon = `iconfont icon-${text} numb_icon`; return (
- + > */} + + {renderNumb()}
) diff --git a/public/react/src/modules/developer/index.scss b/public/react/src/modules/developer/index.scss index ad6cc09a3..680bbe228 100644 --- a/public/react/src/modules/developer/index.scss +++ b/public/react/src/modules/developer/index.scss @@ -77,7 +77,12 @@ } } .oj_item_name{ + flex-wrap: wrap; color: #459be5; cursor: pointer; + max-width: 510px; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; } } diff --git a/public/react/src/modules/developer/split_pane_resizer.scss b/public/react/src/modules/developer/split_pane_resizer.scss index 1e240545c..cd8ce22ca 100644 --- a/public/react/src/modules/developer/split_pane_resizer.scss +++ b/public/react/src/modules/developer/split_pane_resizer.scss @@ -117,7 +117,7 @@ } .comp_ctx{ - height: calc(100vh - 178px); + // height: calc(100vh - 178px); overflow-y: hidden; } diff --git a/public/react/src/modules/developer/studentStudy/leftpane/comment/index.js b/public/react/src/modules/developer/studentStudy/leftpane/comment/index.js index 2ec70227d..9b4287e76 100644 --- a/public/react/src/modules/developer/studentStudy/leftpane/comment/index.js +++ b/public/react/src/modules/developer/studentStudy/leftpane/comment/index.js @@ -4,17 +4,21 @@ * @Github: * @Date: 2019-11-27 09:49:35 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-24 17:58:26 + * @LastEditTime : 2019-12-25 10:55:44 */ import './index.scss'; -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import Comment from '../../../../../common/components/comment'; import { connect } from 'react-redux'; import actions from '../../../../../redux/actions'; - +import { Pagination } from 'antd'; const CommentTask = (props) => { + // 当前页 + const [current, setCurrent] = useState(1); + const { + pages, isAdmin, identifier, commentLists, @@ -23,7 +27,8 @@ const CommentTask = (props) => { deleteComment, getCommentLists, showOrHideComment, - replayChildComment + replayChildComment, + changePagination } = props; useEffect(() => { @@ -35,7 +40,6 @@ const CommentTask = (props) => { // 添加评论 const handleAddComment = (ctx) => { - console.log('添加的评论内容: ', ctx); addComment(identifier, { comments: { content: ctx @@ -53,7 +57,7 @@ const CommentTask = (props) => { } // 删除评论 const handleSubmitDeleteComment = (id) => { - console.log('删除评论:', identifier, id); + // console.log('删除评论:', identifier, id); deleteComment(identifier, id); } @@ -72,6 +76,20 @@ const CommentTask = (props) => { }); } + // 点击分页 + const handlePageChange = (page, pageSize) => { + setCurrent(page); + changePagination(page); + // setTimeout(() => { + // 调用查询接口 + getCommentLists(identifier); + // }, 300); + } + + const _style = { + display: pages.total > pages.limit ? 'block' : 'none' + } + return (
{ showOrHideComment={handleShowOrHideComment} submitDeleteComment={handleSubmitDeleteComment} /> + +
+ +
) } const mapStateToProps = (state) => { const { - commentLists // 评论列表 + commentLists, // 评论列表 + pages } = state.commentReducer; const { comment_identifier @@ -98,7 +127,8 @@ const mapStateToProps = (state) => { return { commentLists, isAdmin: userInfo.admin, - identifier: comment_identifier + identifier: comment_identifier, + pages } } @@ -110,6 +140,7 @@ const mapDispatchToProps = (dispatch) => ({ deleteComment: (identifier, id) => dispatch(actions.deleteComment(identifier, id)), likeComment: (identifier, id, params) => dispatch(actions.likeComment(identifier, id, params)), showOrHideComment: (identifier, id, params) => dispatch(actions.showOrHideComment(identifier, id, params)), + changePagination: (page) => dispatch(actions.changePagination(page)) }) export default connect( diff --git a/public/react/src/modules/developer/studentStudy/leftpane/comment/index.scss b/public/react/src/modules/developer/studentStudy/leftpane/comment/index.scss index ba9c132d9..b09eb849b 100644 --- a/public/react/src/modules/developer/studentStudy/leftpane/comment/index.scss +++ b/public/react/src/modules/developer/studentStudy/leftpane/comment/index.scss @@ -1,8 +1,16 @@ .task_comment_task{ + display: flex; + flex-direction: column; + justify-content: space-between; background: #fff; padding: 20px 30px 0; height: calc(100vh - 177px); box-sizing: border-box; overflow-y: auto; border-bottom: 1px solid rgba(244,244,244,1); + + .task_comment_page{ + padding: 10px 0; + text-align: center; + } } \ No newline at end of file diff --git a/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.js b/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.js index da51d524d..34bc6e1c3 100644 --- a/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.js +++ b/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.js @@ -3,12 +3,12 @@ * @Author: tangjiang * @Github: * @Date: 2019-11-27 09:49:33 - * @LastEditors: tangjiang - * @LastEditTime: 2019-12-20 19:35:01 + * @LastEditors : tangjiang + * @LastEditTime : 2019-12-25 14:45:20 */ import './index.scss'; import React, { useState, useEffect } from 'react'; -import { Table, Icon, message } from 'antd'; +import { Table, Icon, message, Pagination } from 'antd'; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; import actions from '../../../../../redux/actions'; @@ -20,6 +20,7 @@ import ErrorResult from '../../../components/errorResult'; const numberal = require('numeral'); const {reviewResult} = CONST; +// 表格列 const columns = [ { title: '提交时间', @@ -60,29 +61,30 @@ const columns = [ } ] -const paginationConfig = { - total: 1, // 总条数 - pageSize: 10, // 每页显示条数 - current: 1, // 当前页数 - showQuickJumper: true -} +// const paginationConfig = { +// total: 1, // 总条数 +// pageSize: 5, // 每页显示条数 +// current: 1, // 当前页数 +// showQuickJumper: true +// } const CommitRecord = (props) => { - const { identifier, + pages, commitRecord, // excuteState, language, operateType, commitRecordDetail, - getUserCommitRecord + getUserCommitRecord, + changeRecordPagination } = props; - const [pagination, setPagination] = useState(paginationConfig); - const [tableData, setTableData] = useState([]); - + const [current, setCurrent] = useState(1); + // const [pagination, setPagination] = useState(paginationConfig); + // const [tableData, setTableData] = useState([]); + // 复制面板 let clipboard; - // const [recordDetail, setRecordDetail] = useState({}); const [renderCtx, setRenderCtx] = useState(() => { return function () { @@ -140,12 +142,12 @@ const CommitRecord = (props) => { getUserCommitRecord(identifier); }, []); // 提交记录变化时,同步到表单数据 - useEffect(() => { - const len = commitRecord.length; - const pageConfig = Object.assign({}, paginationConfig, {total: len}); - setTableData(commitRecord); - setPagination(pageConfig); - }, [commitRecord]); + // useEffect(() => { + // // const len = commitRecord.length; + // // const pageConfig = Object.assign({}, paginationConfig, {total: len}); + // setTableData(commitRecord); + // // setPagination(pageConfig); + // }, [commitRecord]); // 提交详情变化时,显示当前提交信息 useEffect(() => { // setRecordDetail(commitRecordDetail); @@ -179,20 +181,46 @@ const CommitRecord = (props) => { // }); // } // - const handleTableChange = (pagination) => { - setPagination(Object.assign({}, pagination)); + // const handleTableChange = (pagination) => { + // setPagination(Object.assign({}, pagination)); + // } + + const handlePaginationChange = (page) => { + setCurrent(page); + changeRecordPagination(page); + // 调用查询接口 + getUserCommitRecord(identifier); + // setPagination(Object.assign({}, pagination, { current: page})); + // console.log('======>>>>>>', pagination) } // console.log(commitRecord); + + const _style = { + display: pages.total > pages.limit ? 'block' : 'none' + }; + return (
{renderCtx()} - +
+
+
+ +
+ ) } @@ -207,7 +235,8 @@ const mapStateToProps = (state) => { commitRecordDetail, commitRecord, hack, - operateType + operateType, + pages } = ojForUserReducer; const { excuteState } = commonReducer; return { @@ -216,11 +245,13 @@ const mapStateToProps = (state) => { commitRecord, // 提交记录 excuteState, // 代码执行状态 language: hack.language, - operateType + operateType, + pages } } const mapDispatchToProps = (dispatch) => ({ - getUserCommitRecord: (identifier) => dispatch(actions.getUserCommitRecord(identifier)) + getUserCommitRecord: (identifier) => dispatch(actions.getUserCommitRecord(identifier)), + changeRecordPagination: (page) => dispatch(actions.changeRecordPagination(page)) }); export default connect( diff --git a/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.scss b/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.scss index fb099445e..80305f2b8 100644 --- a/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.scss +++ b/public/react/src/modules/developer/studentStudy/leftpane/commitRecord/index.scss @@ -2,7 +2,20 @@ // padding: 20px 30px; padding: 0 20px; overflow-y: auto; - height: calc(100vh - 177px); + // height: calc(100vh - 177px); + height: calc(100vh - 122px); + + .commit_record_table_pagination{ + height: 100%; + display: flex; + flex-direction: column; + justify-content: space-between; + + .commit_record_pagination{ + padding: 10px 0; + text-align: center; + } + } .record_header{ display: flex; // justify-content: space-between; diff --git a/public/react/src/modules/developer/studentStudy/leftpane/index.js b/public/react/src/modules/developer/studentStudy/leftpane/index.js index 53e932db1..d9527a13e 100644 --- a/public/react/src/modules/developer/studentStudy/leftpane/index.js +++ b/public/react/src/modules/developer/studentStudy/leftpane/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-23 11:33:41 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-24 17:16:54 + * @LastEditTime : 2019-12-25 11:07:42 // */ import './index.scss'; import React, { useState, useEffect, useMemo } from 'react'; @@ -96,7 +96,7 @@ const LeftPane = (props) => { // 添加评论 const handleAddComment = (ctx) => { - console.log('添加的评论内容: ', ctx, props.identifier); + // console.log('添加的评论内容: ', ctx, props.identifier); props.identifier && props.addComment(props.identifier, { comments: { content: ctx @@ -104,6 +104,10 @@ const LeftPane = (props) => { }); }; + const _style = { + display: defaultActiveKey === 'record' ? 'none' : 'flex' + }; + return (