From bd0e2efc352c425312bfea086ee746f82e18e3fc Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Fri, 5 Jul 2019 11:30:23 +0800
Subject: [PATCH 01/15] =?UTF-8?q?=E6=94=BE=E5=BC=80display=20=E6=B5=8B?=
=?UTF-8?q?=E8=AF=95=E7=9C=8B=E7=9C=8B=E6=9C=89=E4=BB=80=E4=B9=88=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/context/TPIContextProvider.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js
index 75d6b0e2..7fa0c90f 100644
--- a/public/react/src/context/TPIContextProvider.js
+++ b/public/react/src/context/TPIContextProvider.js
@@ -540,7 +540,9 @@ pop_box_new(htmlvalue, 480, 182);
const currentGamePassed = this.props.game !== 2 && status === 2
- currentGamePassed && this.language_display(response);
+ // currentGamePassed &&
+ // 放开display 测试看看有什么问题
+ this.language_display(response);
// 评测通过了,立即同步costTime
currentGamePassed && this._updateCostTime(true, true);
From a0feb16a6abc508d6d3d5eacb389c55e097a4176 Mon Sep 17 00:00:00 2001
From: p31729568
Date: Fri, 5 Jul 2019 23:19:45 +0800
Subject: [PATCH 02/15] fix competition enroll bug
---
app/controllers/competition_teams_controller.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb
index c0bde5e4..5b68c433 100644
--- a/app/controllers/competition_teams_controller.rb
+++ b/app/controllers/competition_teams_controller.rb
@@ -153,7 +153,7 @@ class CompetitionTeamsController < ApplicationController
# 新增加的成员
ids = new_member_ids - team_member_ids
- raise @message unless check_member_enroll_limited?(@competition, ids) # 有成员已经加入其他战队,并且只能一次报名
+ raise @message unless check_member_enroll_limited?(@competition, ids - [@team.user_id]) # 有成员已经加入其他战队,并且只能一次报名; 减去创建者
ids.each do |user_id|
next if user_id.to_i == @team.user_id
@@ -170,7 +170,7 @@ class CompetitionTeamsController < ApplicationController
# 新增加的老师
ids = new_teacher_ids - teacher_ids
- raise @message unless check_teacher_enroll_limited?(@competition, ids) # 有老师已经加入其他战队,并且只能一次报名
+ raise @message unless check_teacher_enroll_limited?(@competition, ids - [@team.user_id]) # 有老师已经加入其他战队,并且只能一次报名;减去创建者
ids.each do |user_id|
next if user_id.to_i == @team.user_id
From cf661355756ebf67aaaeb9c18e96faba580d66d9 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Sat, 6 Jul 2019 09:25:35 +0800
Subject: [PATCH 03/15] interval
---
.../react/src/context/TPIContextProvider.js | 110 ++++++++++++++----
.../react/src/modules/page/main/ActionView.js | 17 ++-
2 files changed, 100 insertions(+), 27 deletions(-)
diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js
index 7fa0c90f..605329f7 100644
--- a/public/react/src/context/TPIContextProvider.js
+++ b/public/react/src/context/TPIContextProvider.js
@@ -30,7 +30,7 @@ import _ from 'lodash'
import TPIContext from './TPIContext'
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
-
+const $ = window.$;
// 主题自定义
const theme = createMuiTheme({
palette: {
@@ -424,6 +424,7 @@ pop_box_new(htmlvalue, 480, 182);
// // // test
// const response = {}
+ // response.data = {"tpm_modified":false,"tpm_cases_modified":false,"hide_code":false,"forbid_copy":false,"output_sets":{"test_sets":"{\"is_public\":1,\"result\":true,\"actual_output\":\"\\u6d4b\\u8bd5\\u901a\\u8fc7\\r\\n\",\"compile_success\":1,\"input\":\"\",\"output\":\"\\u6d4b\\u8bd5\\u901a\\u8fc7\\r\\n\"}","had_test_count":1,"test_sets_count":1,"had_passed_testsests_error_count":1},"latest_output":null,"mirror_name":["JavaWeb","Web"],"multi_webssh":false,"has_answer":true,"st":0,"discusses_count":8,"game_count":5,"myshixun":{"id":47887,"shixun_id":700,"identifier":"cfaigrnqh7","gpid":48996,"status":1,"user_id":1,"commit_id":"1e0489a960588c019f71319e627fa16fa7342bf0","modify_time":"2018-03-08T09:41:45+08:00","reset_time":"2018-03-08T09:41:45+08:00","system_tip":true},"challenge":{"id":2074,"subject":"\u642d\u5efa\u4f60\u7684\u7b2c\u4e00\u4e2aWeb\u670d\u52a1\u5668","position":1,"shixun_id":700,"st":0,"score":100,"exec_time":120,"path":"JavaWeb/WebContent/hello.jsp","task_pass":"###\u642d\u5efa\u4f60\u7684\u7b2c\u4e00\u4e2aWeb\u670d\u52a1\u5668\r\n\r\n[TOC]\r\n\r\n---\r\n\r\n####\u4efb\u52a1\u63cf\u8ff0\r\n\r\n\u8ba4\u8bc6\u548c\u4f7f\u7528\u670d\u52a1\u5668\u662f\u5b66\u4e60JavaWeb\u5fc5\u987b\u8981\u638c\u63e1\u7684\u77e5\u8bc6\uff0c\u672c\u5173\u9700\u8981\u4f60\u6839\u636e\u6587\u4e2d\u6b65\u9aa4\uff0c**\u642d\u5efa\u4f60\u7684\u7b2c\u4e00\u4e2aTomcat\u670d\u52a1\u5668**\u3002\r\n\r\n####\u76f8\u5173\u77e5\u8bc6\r\n##### \u4ec0\u4e48\u662f\u670d\u52a1\u5668\uff08Server\uff09\r\n\u670d\u52a1\u5668\u4e00\u822c\u662f\u7531\u4e00\u53f0\u6216\u8005\u591a\u53f0\u8ba1\u7b97\u673a\u7ec4\u6210\u7684\u8bbe\u5907\uff0c\u5173\u4e8e\u670d\u52a1\u5668\u4f60\u53ef\u4ee5\u7b80\u5355\u7406\u89e3\u4e3a\uff1a**\u63a5\u6536\u8bf7\u6c42\uff0c\u505a\u51fa\u54cd\u5e94**\u7684\u8bbe\u5907\u3002\r\n![](/attachments/download/185624)\r\n\u6839\u636e\u670d\u52a1\u5668\u63d0\u4f9b\u7684\u670d\u52a1\u7c7b\u578b\u4e0d\u540c\uff0c\u5206\u4e3a`\u6587\u4ef6\u670d\u52a1\u5668`\uff0c`\u6570\u636e\u5e93\u670d\u52a1\u5668`\uff0c`\u5e94\u7528\u7a0b\u5e8f\u670d\u52a1\u5668`\uff0c`WEB\u670d\u52a1\u5668`\u7b49\u3002\u5728\u8fd9\u91cc\u6211\u4eec\u4e3b\u8981\u5b66\u4e60`WEB\u670d\u52a1\u5668`\u3002\r\n##### \u670d\u52a1\u7aef\u5e94\u7528\r\n\u6211\u4eec\u90fd\u77e5\u9053\u3002\u5982\u679c\u4e00\u53f0\u8ba1\u7b97\u673a\u6ca1\u6709\u64cd\u4f5c\u7cfb\u7edf\u90a3\u4e48\u8fd9\u53f0\u8ba1\u7b97\u673a\u5c31\u53ea\u80fd\u7b97\u662f\u4e00\u4e2a\u94c1\u76d2\u5b50\uff0c\u6240\u4ee5\u670d\u52a1\u5668\u540c\u6837\u4e5f\u9700\u8981\u6709\u64cd\u4f5c\u7cfb\u7edf\uff0c\u670d\u52a1\u5668\u7684\u64cd\u4f5c\u7cfb\u7edf\u4f7f\u7528\u6700\u591a\u7684\u662fwindows\u3001Linux\u3001unix\u8fd9\u4e09\u79cd\u64cd\u4f5c\u7cfb\u7edf\uff0c\u800cLinux\u7531\u4e8e\u6027\u80fd\u4f18\u8d8a\uff0c\u4ef7\u683c\u4fbf\u5b9c\uff0c\u5b89\u5168\u6027\u9ad8\u7b49\u4f18\u70b9\u5df2\u7ecf\u6210\u4e3a\u4e86\u670d\u52a1\u5668\u64cd\u4f5c\u7cfb\u7edf\u7684\u9996\u9009\u3002\r\n\u90a3\u6211\u4eec\u6709\u4e86\u64cd\u4f5c\u7cfb\u7edf\u4e86\u4e4b\u540e\u9700\u8981\u4ec0\u4e48\u5462\uff1f\u76f8\u4fe1\u4f60\u5df2\u7ecf\u60f3\u5230\u4e86\uff0c\u9700\u8981\u88c5\u8f6f\u4ef6\uff0c\u4e5f\u5c31\u662f\u670d\u52a1\u5668\u5e94\u7528\u7a0b\u5e8f\u3002\u5e38\u89c1\u7684WEB\u670d\u52a1\u5668\u7a0b\u5e8f\u6709\u5f88\u591a\u4f8b\u5982\uff1aIIS,Kangle\uff0cnginx\uff0cTomcat\uff0capache\uff0cWebLogic\u7b49\u7b49\uff0c\u8fd9\u91cc\u5c31\u4e0d\u4e00\u4e00\u5c55\u5f00\u4ecb\u7ecd\u4e86\uff0c\u5728\u540e\u9762\u7684\u8bfe\u7a0b\u4e2d\uff0c\u6211\u4eec\u4e3b\u8981\u5b66\u4e60\u7684\u662fTomcat\u3002\r\n![](/attachments/download/185627)\r\n##### \u642d\u5efa\u4f60\u7684\u7b2c\u4e00\u4e2a\u670d\u52a1\u5668\r\n\u63a5\u4e0b\u6765\u6211\u4eec\u5728\u81ea\u5df1\u7684\u8ba1\u7b97\u673a\u4e0a\u642d\u5efa\u4e00\u4e2aTomcat\u670d\u52a1\u5668\u3002\r\n1. \u9996\u5148\u6211\u4eec\u9700\u8981\u4e0b\u8f7d\u548c\u89e3\u538bTomcat\uff0c\u4e0b\u8f7d\u5730\u5740\uff1ahttps://tomcat.apache.org/download-70.cgi\r\n![](/attachments/download/185674)\r\n![](/attachments/download/185675)\r\n1. \u8fdb\u5165Tomcat\u6587\u4ef6\u5939\u4e0b\u7684`bin`\u76ee\u5f55\uff0c\u70b9\u51fb`startup.bat`\u542f\u52a8Tomcat\u3002\r\n![](/attachments/download/185677)\r\n![](/attachments/download/185678)\r\n1. \u5728\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165 http://localhost:8080 \u770b\u5230\u5982\u4e0b\u754c\u9762\u5c31\u8bf4\u660eTomcat\u670d\u52a1\u5668\u5df2\u7ecf\u642d\u5efa\u597d\u5566\u3002\r\n![](/attachments/download/185680)\r\n1. \u642d\u5efa\u597d\u4e4b\u540e\uff0c\u901a\u8fc7\u672c\u673a\u7684Ip\u5730\u5740\u4e5f\u53ef\u4ee5\u8bbf\u95ee\uff0c\u5728\u540c\u4e00\u4e2a\u5c40\u57df\u7f51\u4e0b\u7684\u5176\u4ed6\u4eba\u4e5f\u53ef\u4ee5\u901a\u8fc7IP\u8bbf\u95ee\u4f60\u7684\u7f51\u7ad9\u54e6\u3002\u5982\u4e0b\uff1a\r\n![](/attachments/download/185681)\r\n1. \u5982\u679c\u4ee5\u4e0a\u6b65\u9aa4\u4f60\u90fd\u80fd\u5b8c\u6210\uff0c\u90a3\u606d\u559c\u4f60\u5df2\u7ecf\u642d\u5efa\u4e86\u4e00\u4e2a\u670d\u52a1\u5668\u5566\uff0c\u597d\u4e86\uff0c\u63a5\u4e0b\u6765\u4e00\u8d77\u6211\u4eec\u6765\u5199\u4e00\u4e2a\u7f51\u9875\u7136\u540e\u8bbf\u95ee\u5b83\u3002\r\n![](/attachments/download/185684)\r\n\u8f93\u5165\u5982\u4e0b\u4ee3\u7801\uff1a\r\n```html\r\n\r\n\r\n\r\n \r\n Title \r\n\r\n\r\n\thello tomcat\r\n\r\n\r\n```\r\n1. \u6309\u7167\u4e4b\u524d\u6b65\u9aa4\u542f\u52a8Tomcat\u670d\u52a1\u5668\uff0c\u8f93\u5165\u5730\u5740\uff1ahttp://localhost:8080/helloTomcat.html \u770b\u5230\u5982\u4e0b\u754c\u9762\u5373\u53ef\u3002\r\n![](/attachments/download/186129)\r\n\r\n\r\n####\u7f16\u7a0b\u8981\u6c42\r\n\u6bcf\u6b21\u4f60\u8fdb\u5165\u5b9e\u8bad\u6211\u4eec\u4f1a\u5728\u540e\u53f0\u5e2e\u4f60\u642d\u5efa\u597d\u670d\u52a1\u5668\u8fd0\u884c\u6240\u9700\u7684\u73af\u5883\uff0c\u8bf7\u5728\u53f3\u4fa7\u7f16\u8f91\u5668\u4e2d\u8f93\u5165`hello educoder`\uff0c\u70b9\u51fb\u8bc4\u6d4b-->\u67e5\u770b\u6548\u679c\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u4f60\u521a\u521a\u7f16\u5199\u4ee3\u7801\u5b9e\u73b0\u7684\u6548\u679c\u54e6\u3002\r\n\r\n---\r\n\u5f00\u59cb\u4f60\u7684\u4efb\u52a1\u5427,\u795d\u4f60\u6210\u529f\uff01","modify_time":null,"web_route":"JavaWeb/hello.jsp","answer":null},"game":{"id":164106,"status":2,"myshixun_id":47887,"user_id":1,"final_score":100,"challenge_id":2074,"identifier":"gzoactubhfej","answer_open":0,"test_sets_view":false,"cost_time":572,"star":5,"modify_time":null},"shixun":{"id":700,"name":"JSP\u5165\u95e8","gpid":45335,"modify_time":"2018-03-08T09:41:45+08:00","reset_time":"2018-03-08T09:41:45+08:00","language":null,"status":2,"identifier":"xb39mzfr","test_set_permission":true,"hide_code":false,"forbid_copy":false,"hidden":false,"webssh":0,"user_id":30406,"code_hidden":false,"task_pass":false,"exec_time":120,"multi_webssh":false,"vnc":false},"record":18.972,"grade":233138,"prev_game":null,"next_game":"pkf2tn8hl43r","username":"Coder","image_url":"avatars/User/1","user_url":"/users/innov","praise_count":0,"user_praise":false,"time_limit":120,"tomcat_url":"http://117.50.12.63","is_teacher":true,"power":1,"myshixun_manager":true,"zip_path":"https://testbdgit.educoder.net/api/v3/projects/48996/repository/archive?&private_token=priEn3UwXfJs3PmyXn_G"}
// response.data = {"tpm_modified":false,"tpm_cases_modified":false,"hide_code":false,"forbid_copy":false,"output_sets":{"test_sets":"{\"is_public\":1,\"result\":null,\"actual_output\":null,\"compile_success\":null,\"input\":\"9\",\"output\":\"3\\r\\n\"},{\"is_public\":1,\"result\":null,\"actual_output\":null,\"compile_success\":null,\"input\":\"110.25\",\"output\":\"10.5\\r\\n\"},{\"is_public\":0,\"result\":null,\"actual_output\":null,\"compile_success\":null,\"input\":\"-100\",\"output\":\"\\u65e0\\u7b97\\u672f\\u5e73\\u65b9\\u6839\\r\\n\"}","had_test_count":0,"test_sets_count":3,"had_passed_testsests_error_count":0},"latest_output":null,"mirror_name":["C/C++"],"multi_webssh":false,"has_answer":true,"st":0,"discusses_count":8,"game_count":3,"myshixun":{"id":140292,"shixun_id":49,"identifier":"ihprfcq2ta","gpid":156599,"status":0,"user_id":116,"commit_id":"5955e66e34b3b70913b4cb2f62ec5d84cdbe26c9","modify_time":"2017-10-13T15:14:34+08:00","reset_time":"2017-10-13T15:14:34+08:00","system_tip":false},"challenge":{"id":81,"subject":"\u6c42\u4e00\u4e2a\u6570\u7684\u7b97\u672f\u5e73\u65b9\u6839","position":2,"shixun_id":49,"st":0,"score":100,"path":"src/step2/SquareRoot.cpp","task_pass":"[TOC]\r\n\r\n---\r\n\r\n####\u4efb\u52a1\u63cf\u8ff0\r\n\u672c\u5173\u4efb\u52a1\u662f\u901a\u8fc7\u8c03\u7528`sqrt`\u51fd\u6570\u6765\u5b9a\u4e49\u4e00\u4e2a\u6c42\u7b97\u672f\u5e73\u65b9\u6839\u7684\u51fd\u6570\u5e76\u4ee5\u6b64\u6765\u8ba1\u7b97\u4e00\u4e2a\u6570\u7684\u7b97\u672f\u5e73\u65b9\u6839\u3002\r\n\r\n####\u76f8\u5173\u77e5\u8bc6\r\n\u5982\u679c\u4e00\u4e2a\u975e\u8d1f\u6570`x`\u7684\u5e73\u65b9\u7b49\u4e8e`a`\uff0c\u5373`$$x^2 = a$$`\uff0c`(a \u2265 0)`\uff0c\u90a3\u4e48\u8fd9\u4e2a\u975e\u8d1f\u6570`x`\u53eb\u505a`a`\u7684\u7b97\u672f\u5e73\u65b9\u6839\u3002`a`\u7684\u7b97\u672f\u5e73\u65b9\u6839\u8bb0\u4e3a`$$\\sqrt{a}$$`\uff0c\u8bfb\u4f5c`\u6839\u53f7a`\uff0c`a`\u53eb\u505a\u88ab\u5f00\u65b9\u6570\u3002\r\n\r\nC++\u4e2d\uff0c\u53ef\u4ee5\u8c03\u7528\u5e93\u51fd\u6570`sqrt()`\u6765\u6c42\u4e00\u4e2a\u6570\u7684\u7b97\u672f\u5e73\u65b9\u6839\u3002\r\n\r\n####\u7f16\u7a0b\u8981\u6c42\r\n\u672c\u5173\u7684\u7f16\u7a0b\u4efb\u52a1\u662f\u901a\u8fc7\u8c03\u7528`sqrt()`\u51fd\u6570\u6765\u8865\u5168`step2/SquareRoot.cpp`\u6587\u4ef6\u4e2d\u7684`SquareRoot(float n)`\u51fd\u6570\uff0c\u4ee5\u5b9e\u73b0\u8ba1\u7b97\u4e00\u4e2a\u6570\u7684\u7b97\u672f\u5e73\u65b9\u6839\u7684\u8981\u6c42\u3002\r\n\r\n\u6ce8\u610f\uff1a\r\n* \u5982\u679c\u8f93\u5165\u7684\u6570\u6ca1\u6709\u7b97\u6570\u5e73\u65b9\u6839\uff0c\u8fd4\u56de`-1`\u3002\r\n* \u5177\u4f53\u8bf7\u53c2\u89c1\u540e\u7eed\u6d4b\u8bd5\u6837\u4f8b\u3002\r\n\r\n\u672c\u5173\u6d89\u53ca\u7684\u4ee3\u7801\u6587\u4ef6`step2/SquareRoot.cpp`\u4e2d\u7684`SquareRoot`\u51fd\u6570\u7684\u4ee3\u7801\u6846\u67b6\u5982\u4e0b\uff1a\r\n\r\n```cpp\r\n#include \r\n\r\n// \u6c42n\u7684\u7b97\u672f\u5e73\u65b9\u6839\r\ndouble SquareRoot(float n)\r\n{\r\n // \u8bf7\u5728\u6b64\u6dfb\u52a0\u4ee3\u7801\uff0c\u8865\u5168\u51fd\u6570SquareRoot\r\n /********** Begin *********/\r\n\r\n\r\n /********** End **********/\r\n}\r\n```\r\n\r\n####\u6d4b\u8bd5\u8bf4\u660e\r\n\u672c\u5173\u7684\u6d4b\u8bd5\u6587\u4ef6\u662f`step2/SquareRootTest.cpp`\uff0c\u6d4b\u8bd5\u8fc7\u7a0b\u5982\u4e0b\uff1a\r\n1. \u5e73\u53f0\u7f16\u8bd1`step2/SquareRootTest.cpp`\uff0c\u7136\u540e\u94fe\u63a5\u76f8\u5173\u7a0b\u5e8f\u5e93\u5e76\u751f\u6210`SquareRootTest.exe`\uff1b\r\n2. \u5e73\u53f0\u8fd0\u884c`SquareRootTest.exe`\uff0c\u5e76\u4ee5\u6807\u51c6\u8f93\u5165\u65b9\u5f0f\u63d0\u4f9b\u6d4b\u8bd5\u8f93\u5165\uff1b\r\n3. \u5e73\u53f0\u83b7\u53d6`SquareRootTest.exe`\u7684\u8f93\u51fa\uff0c\u7136\u540e\u5c06\u5176\u4e0e\u9884\u671f\u8f93\u51fa\u5bf9\u6bd4\uff0c\u5982\u679c\u4e00\u81f4\u5219\u6d4b\u8bd5\u901a\u8fc7\uff1b\u5426\u5219\u6d4b\u8bd5\u5931\u8d25\u3002\r\n\r\n\u4ee5\u4e0b\u662f\u5e73\u53f0\u5bf9`step2/SquareRootTest.cpp`\u7684\u6837\u4f8b\u6d4b\u8bd5\u96c6\uff1a\r\n\r\n\u6d4b\u8bd5\u8f93\u5165\uff1a`9`\r\n\u9884\u671f\u8f93\u51fa\uff1a`3`\r\n\r\n\u6d4b\u8bd5\u8f93\u5165\uff1a`110.25`\r\n\u9884\u671f\u8f93\u51fa\uff1a`10.5`\r\n\r\n\u6d4b\u8bd5\u8f93\u5165\uff1a`-8`\r\n\u9884\u671f\u8f93\u51fa\uff1a`-1`\r\n\r\n\u5f00\u59cb\u4f60\u7684\u4efb\u52a1\u5427\uff0c\u795d\u4f60\u6210\u529f\uff01\r\n","modify_time":null,"web_route":null,"answer":null},"game":{"id":448025,"status":0,"myshixun_id":140292,"user_id":116,"final_score":0,"challenge_id":81,"identifier":"gih9uzwn8xfc","answer_open":0,"test_sets_view":false,"cost_time":0,"star":0,"modify_time":null,"open_time":"2019-05-30T11:00:19+08:00","updated_at":"2019-05-30T11:00:19+08:00"},"shixun":{"id":49,"name":"C++\u4e4b\u6574\u6570\u8ba1\u7b97\u57fa\u7840","gpid":2018,"modify_time":"2017-10-13T15:14:34+08:00","reset_time":"2017-10-13T15:14:34+08:00","language":"C++","propaedeutics":"####C++\u53d1\u5c55\u5386\u7a0b\r\nC++\u662f\u4e00\u79cd\u901a\u7528\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u5b83\u4e0d\u4f46\u62e5\u6709\u6570\u636e\u5c01\u88c5\u3001\u6570\u636e\u9690\u85cf\u3001\u7ee7\u627f\u3001\u91cd\u7528\u3001\u91cd\u8f7d\u4ee5\u53ca\u591a\u6001\u7b49\u7279\u6027\uff0c\u8fd8\u652f\u6301\u8fc7\u7a0b\u5316\u7a0b\u5e8f\u8bbe\u8ba1\u3001\u9762\u5411\u5bf9\u8c61\u7a0b\u5e8f\u8bbe\u8ba1\u3001\u6cdb\u578b\u7a0b\u5e8f\u8bbe\u8ba1\u7b49\u591a\u79cd\u7a0b\u5e8f\u8bbe\u8ba1\u98ce\u683c\uff0c\u540c\u65f6\u8fd8\u63d0\u4f9b\u4e86\u5e95\u5c42\u5185\u5b58\u64cd\u4f5c\u7684\u529f\u80fd\u3002\u5176\u8bbe\u8ba1\u4eae\u70b9\u5728\u4e8e\u4f7f\u7528\u6027\u80fd\uff0c\u6548\u7387\u548c\u7075\u6d3b\u6027\uff0c\u662f\u8fc4\u4eca\u4e3a\u6b62\u6700\u53d7\u5e7f\u5927\u7a0b\u5e8f\u5458\u6b22\u8fce\u7684\u7f16\u7a0b\u8bed\u8a00\u4e4b\u4e00\u3002\r\n\r\n1979\u5e74\uff0c\u4e39\u9ea6\u8ba1\u7b97\u673a\u79d1\u5b66\u5bb6Bjarne Stroustrup\u535a\u58eb\u5728\u7f8e\u56fdAT&T\u8d1d\u5c14\u5b9e\u9a8c\u5ba4\u5f00\u59cb\u4e86\u4ece\u4e8b\u5c06C\u6539\u826f\u4e3a\u5e26\u7c7b\u7684C\uff08C with classes\uff09\u7684\u5de5\u4f5c\u30021983\u5e74\u8be5\u8bed\u8a00\u88ab\u6b63\u5f0f\u547d\u540d\u4e3aC++\uff0c\u5b83\u7684\u547d\u540d\u6765\u6e90\u4e8eC\u8bed\u8a00\u4e2d\u7684\u201c++\u201d\u8fd0\u7b97\u7b26\uff0c\u8fd9\u662f\u4e00\u79cd\u5e38\u89c1\u7684\u547d\u540d\u7ea6\u5b9a\uff0c\u5374\u5145\u5206\u5c55\u793a\u4e86\u5176\u4eceC\u8bed\u8a00\u6539\u8fdb\u7684\u5386\u53f2\uff0c\u66f4\u5f70\u663e\u4e86\u4e00\u79cd\u66f4\u52a0\u5f3a\u5927\u7684\u8ba1\u7b97\u673a\u7f16\u7a0b\u8bed\u8a00\u3002\r\n![](/attachments/download/169261)\r\n\r\nStroustrup\u535a\u58eb\u521b\u9020C++\u7684\u52a8\u673a\u4e3b\u8981\u6765\u6e90\u4e8e\u4ed6\u5728\u535a\u58eb\u671f\u95f4\u7684\u7f16\u7a0b\u7ecf\u9a8c\uff0c\u5c3d\u7ba1\u4ed6\u4f7f\u7528\u8fc7Simula\u548cALGOL\uff0c\u4e5f\u63a5\u89e6\u8fc7C\uff0c\u4f46\u4ed6\u7684\u521d\u8877\u662f\u9700\u8981\u4e00\u95e8\u7f16\u7a0b\u7b80\u5355\u3001\u6b63\u786e\u53ef\u9760\u3001\u9ad8\u6548\u8fd0\u884c\u4e14\u53ef\u79fb\u690d\u7684\u8bed\u8a00\uff0c\u56e0\u6b64\uff0c\u901a\u7528\u6027\u5f3a\u3001\u5feb\u901f\u3001\u4fbf\u643a\u4e14\u5e7f\u6cdb\u4f7f\u7528\u7684C\u8bed\u8a00\u88ab\u9009\u4e2d\u3002 \r\n\r\n####C++\u8bed\u8a00\u7279\u6027\r\n* \u652f\u6301\u6570\u636e\u5c01\u88c5\u548c\u6570\u636e\u9690\u85cf\r\nC++\u4e2d\uff0c\u7c7b\u662f\u652f\u6301\u6570\u636e\u5c01\u88c5\u7684\u5de5\u5177\uff0c\u5bf9\u8c61\u5219\u662f\u6570\u636e\u5c01\u88c5\u7684\u5b9e\u73b0\u3002C++\u901a\u8fc7\u65b0\u5efa\u7528\u6237\u5b9a\u4e49\u7c7b\u6765\u652f\u6301\u6570\u636e\u5c01\u88c5\u548c\u6570\u636e\u9690\u85cf\u3002\r\n\r\n* \u652f\u6301\u7ee7\u627f\u548c\u91cd\u7528\r\nC++\u7ee7\u627f\u548c\u91cd\u7528\u7684\u601d\u60f3\u662f\u5728\u73b0\u6709\u7c7b\u7684\u57fa\u7840\u4e0a\u58f0\u660e\u65b0\u7c7b\u578b\u3002\u901a\u8fc7\u7ee7\u627f\u548c\u91cd\u7528\u53ef\u4ee5\u66f4\u6709\u6548\u5730\u7ec4\u7ec7\u7a0b\u5e8f\u7ed3\u6784\uff0c\u660e\u786e\u7c7b\u95f4\u5173\u7cfb\uff0c\u5e76\u5145\u5206\u5229\u7528\u5df2\u6709\u7c7b\u6765\u5b8c\u6210\u66f4\u590d\u6742\u3001\u6df1\u5165\u7684\u5f00\u53d1\u3002\r\n\r\n* \u652f\u6301\u591a\u6001\u6027\r\nC++\u7684\u591a\u6001\u6027\u4e3a\u6bcf\u4e2a\u7c7b\u6307\u5b9a\u4e86\u8868\u73b0\u884c\u4e3a\uff0c\u4f7f\u5f97\u4e00\u4e2a\u5bf9\u8c61\u53ef\u4ee5\u6709\u72ec\u7279\u7684\u8868\u73b0\u65b9\u5f0f\uff0c\u800c\u53e6\u4e00\u4e2a\u5bf9\u8c61\u6709\u53e6\u4e00\u79cd\u8868\u73b0\u65b9\u5f0f\u3002\r\n\r\n####C++\u77e5\u8bc6\u70b9\u9884\u89c8\r\n\u4f5c\u4e3a\u4e00\u95e8\u6bd4C\u66f4\u5f3a\u5927\u7684\u901a\u7528\u7f16\u7a0b\u8bed\u8a00\uff0cC++\u6db5\u76d6\u4e86\u66f4\u4e3a\u4e30\u5bcc\u7684\u77e5\u8bc6\u70b9\uff0c\u5982\uff1a\u57fa\u672c\u6982\u5ff5\uff0c\u8f93\u5165\u548c\u8f93\u51fa\uff0c\u63a7\u5236\u8bed\u53e5\uff0c\u6570\u7ec4\uff0c\u51fd\u6570\uff0c\u6307\u9488\uff0c\u7ed3\u6784\u3001\u8054\u5408\u548c\u679a\u4e3e\uff0c\u94fe\u8868\uff0c\u7c7b\u548c\u5bf9\u8c61\uff0c\u7c7b\u548c\u5bf9\u8c61\u7684\u4f7f\u7528\uff0c\u8fd0\u7b97\u7b26\u91cd\u8f7d\uff0c\u7ee7\u627f\uff0c\u591a\u6001\uff0c\u5f02\u5e38\uff0c\u6a21\u677f\u7b49\u3002\u5177\u4f53\u5982\u4e0b\uff1a\r\n\r\n* \u57fa\u672c\u6982\u5ff5\uff1a\u5b57\u7b26\u96c6\u548c\u5173\u952e\u5b57\u3001\u57fa\u672c\u6570\u636e\u7c7b\u578b\u3001\u5e38\u91cf\u4e0e\u53d8\u91cf\u3001\u7c7b\u578b\u8f6c\u6362\u3001\u8fd0\u7b97\u7b26\u4e0e\u8868\u8fbe\u5f0f\u3002\r\n\r\n* \u8f93\u5165\u548c\u8f93\u51fa\uff1a\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u51fd\u6570\u3001\u683c\u5f0f\u5316\u8f93\u5165\u8f93\u51fa\u51fd\u6570\u3001\u7528\u6d41\u8fdb\u884c\u8f93\u5165/\u8f93\u51fa\u3001\u6d41\u64cd\u7eb5\u7b97\u5b50\u3002\r\n\r\n* \u63a7\u5236\u8bed\u53e5\uff1a\u9009\u62e9\u8bed\u53e5\uff08`if\u3001if-else\u3001switch`\uff09\u3001\u5faa\u73af\u8bed\u53e5\uff08`for\u3001while\u3001do-while`\uff09\u3001\u8df3\u8f6c\u8bed\u53e5\uff08`break\u3001continue\u3001goto`\uff09\u3002\r\n\r\n* \u6570\u7ec4\uff1a\u4e00\u7ef4\u6570\u7ec4\u3001\u4e8c\u7ef4\u6570\u7ec4\u3001\u591a\u7ef4\u6570\u7ec4\u3001\u5b57\u7b26\u4e32\u3002\r\n\r\n* \u51fd\u6570\uff1a\u9884\u5b9a\u4e49\u51fd\u6570\u3001\u51fd\u6570\u7684\u5b9a\u4e49\u548c\u8c03\u7528\u3001\u51fd\u6570\u91cd\u8f7d\u3001\u5b58\u50a8\u7c7b\u522b\u3001\u4f5c\u7528\u57df\u3001\u9012\u5f52\u51fd\u6570\u3001\u9884\u5904\u7406\u6307\u4ee4\u3002\r\n\r\n* \u6307\u9488\uff1a\u6307\u9488\u7684\u5b9a\u4e49\u3001\u6307\u9488\u7684\u8fd0\u7b97\u3001\u6307\u9488\u4e0e\u6570\u7ec4\u3001\u5b57\u7b26\u6307\u9488\u4e0e\u5b57\u7b26\u6570\u7ec4\u3001\u6307\u9488\u4e0e`const`\u9650\u5b9a\u7b26\u3001\u6307\u9488\u4e0e\u5f15\u7528\u3001\u52a8\u6001\u5185\u5b58\u5206\u914d\u3001\u51fd\u6570\u6307\u9488\u3002\r\n\r\n* \u7ed3\u6784\u3001\u8054\u5408\u548c\u679a\u4e3e\uff1a\u7ed3\u6784\u7684\u5b9a\u4e49\u3001\u7ed3\u6784\u4e0e\u51fd\u6570\u3001\u7ed3\u6784\u4e0e\u6570\u7ec4\u3001\u7ed3\u6784\u4e0e\u6307\u9488\u3001\u8054\u5408\u7684\u5b9a\u4e49\u548c\u4f7f\u7528\u3001\u679a\u4e3e\u548c\u679a\u4e3e\u578b\u53d8\u91cf\u7684\u5b9a\u4e49\u3002\r\n\r\n* \u94fe\u8868\uff1a\u5355\u9879\u94fe\u8868\u3001\u53cc\u5411\u94fe\u8868\u3002\r\n\r\n* \u7c7b\u548c\u5bf9\u8c61\uff1a\u7c7b\u548c\u5bf9\u8c61\u7684\u5b9a\u4e49\u3001\u6784\u9020\u51fd\u6570\u3001\u6790\u6784\u51fd\u6570\u3002\r\n\r\n* \u7c7b\u548c\u5bf9\u8c61\u7684\u4f7f\u7528\uff1a\u7c7b\u7684\u590d\u5408\u3001`this`\u6307\u9488\u3001`const`\u7279\u6027\u3001\u53cb\u5143\u51fd\u6570\u548c\u53cb\u5143\u7c7b\u3002\r\n\r\n* \u8fd0\u7b97\u7b26\u91cd\u8f7d\uff1a\u8fd0\u7b97\u7b26\u91cd\u8f7d\u7684\u6982\u5ff5\u3001\u8fd0\u7b97\u7b26\u6210\u5458\u51fd\u6570\u4e0e\u53cb\u5143\u51fd\u6570\u3001\u5355\u76ee\u8fd0\u7b97\u7b26\u91cd\u8f7d\u3001\u91cd\u8f7d\u6d41\u63d2\u5165\u548c\u6d41\u63d0\u53d6\u8fd0\u7b97\u7b26\u3001\u53cc\u76ee\u8fd0\u7b97\u7b26\u91cd\u8f7d\u3001\u8d4b\u503c\u8fd0\u7b97\u7b26\u91cd\u8f7d\u3001\u7c7b\u578b\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\r\n\r\n* \u7ee7\u627f\uff1a\u7ee7\u627f\u7684\u5b9a\u4e49\u3001\u7c7b\u6307\u9488\u3001\u591a\u91cd\u7ee7\u627f\u3002\r\n\r\n* \u591a\u6001\uff1a\u865a\u51fd\u6570\u3001\u62bd\u8c61\u57fa\u7c7b\u548c\u7eaf\u865a\u51fd\u6570\u3001\u865a\u6790\u6784\u51fd\u6570\u3002\r\n\r\n* \u5f02\u5e38\uff1a\u5f02\u5e38\u7684\u629b\u51fa\u548c\u4f20\u64ad\u3001\u5f02\u5e38\u7684\u6355\u83b7\u548c\u5904\u7406\u3002\r\n\r\n* \u6a21\u677f\uff1a\u51fd\u6570\u6a21\u677f\u3001\u7c7b\u6a21\u677f\u3002\r\n\r\n####C++\u4e0e\u5176\u4ed6\u7f16\u7a0b\u8bed\u8a00\u7684\u5bf9\u6bd4\r\nC++\u8bed\u8a00\u4e0e\u5176\u4ed6\u4e3b\u6d41\u7f16\u7a0b\u8bed\u8a00\u7684\u5bf9\u6bd4\u5982\u4e0b\uff1a\r\n![](/attachments/download/169262)\r\n\r\n![](/attachments/download/169266)\r\n\u5f53\u7136\uff0c\u4e0a\u8ff0\u56fe\u8868\u5217\u51fa\u7684\u7f16\u7a0b\u8bed\u8a00\u4e00\u76f4\u5904\u4e8e\u53d1\u5c55\u548c\u53d8\u5316\u4e2d\uff0c\u5176\u4e2d\u7684\u5bf9\u6bd4\u4ec5\u4f9b\u53c2\u8003\u3002\u6211\u4eec\u5728\u9009\u62e9\u4e00\u79cd\u5f00\u53d1\u8bed\u8a00\u65f6\uff0c\u4e0d\u4ec5\u8981\u8003\u8651\u8bed\u8a00\u672c\u8eab\u7684\u7279\u6027\uff0c\u5f88\u591a\u65f6\u5019\u8fd8\u9700\u8981\u8003\u8651\u5f00\u53d1\u56e2\u961f\u7684\u7279\u70b9\uff0c\u5df2\u6709\u8f6f\u4ef6\u8d44\u4ea7\u7684\u7f16\u7a0b\u8bed\u8a00\u548c\u67b6\u6784\uff0c\u5f53\u5730\u7a0b\u5e8f\u5458\u4eba\u624d\u7684\u5206\u5e03\u7279\u70b9\u7b49\u5404\u79cd\u56e0\u7d20\u3002\r\n\r\n####\u53c2\u8003\u6587\u732e\r\n* \u738b\u633a\u3001\u5468\u4f1a\u5e73\u3001\u8d3e\u4e3d\u4e3d\u3001\u5f90\u9521\u5c71\u8457\uff0cC++\u7a0b\u5e8f\u8bbe\u8ba1\uff08\u7b2c3\u7248\uff09\uff0c\u6e05\u534e\u5927\u5b66\u51fa\u7248\u793e\uff0c2015\u5e742\u6708\u7b2c3\u7248\r\n* \u8c2d\u6d69\u5f3a\u8457\uff0cC++\u9762\u5411\u5bf9\u8c61\u7a0b\u5e8f\u8bbe\u8ba1\uff08\u7b2c2\u7248\uff09\uff0c\u6e05\u534e\u5927\u5b66\u51fa\u7248\u793e\uff0c2014\u5e747\u6708\u7b2c2\u7248\r\n* Wikipeida, C++, https://en.wikipedia.org/wiki/C%2B%2B\r\n* \u767e\u5ea6\u767e\u79d1, C++, http://baike.baidu.com/item/C++","status":2,"identifier":"nf9ja46l","test_set_permission":true,"hide_code":false,"forbid_copy":false,"hidden":false,"webssh":0,"user_id":6,"code_hidden":false,"task_pass":false,"exec_time":40,"multi_webssh":false,"vnc":false},"record":null,"grade":50,"prev_game":"25razqibyps6","next_game":"p9ea4h8zx7fg","username":"\u77f3\u5934","image_url":"avatars/User/b","user_url":"/users/shitou","praise_count":0,"user_praise":false,"time_limit":40,"tomcat_url":"http://10.9.63.225","is_teacher":false,"power":1,"myshixun_manager":true,"vnc":false}
// response.data.shixun.vnc = true
// response.data.vnc_url = 'http://117.50.12.63:43149/vnc_lite.html?password=headless'
@@ -498,13 +499,46 @@ pop_box_new(htmlvalue, 480, 182);
currentPassedGameGainExperience: experience,
})
}
+ initDisplayInterval = () => {
+ let remain = 60
+ if (this.displayInterval) {
+ window.clearInterval(this.displayInterval)
+ }
+ this.displayInterval = window.setInterval(() => {
+ const button = $('#showWebDisplayButton');
+ if (button.length) {
+ button.html(`查看效果(${remain})`)
+ if (remain == 0) {
+ button.html('查看效果')
+ }
+ }
+ if (remain == 0) {
+ window.clearInterval(this.displayInterval)
+ this.displayInterval = null
+ return;
+ }
+
+ remain -= 1;
+ }, 1000)
+ }
language_display(data) {
const { game, tomcat_url } = this.state;
- const $ = window.$;
const challenge = Object.assign({}, this.state.challenge)
if(challenge.isWeb && data.port != -1) {
// var $result = $("#php_display");
challenge.showWebDisplayButton = true; // ActionView处是否出现查看效果按钮
+ if (this.showWebDisplayButtonTimeout) {
+ window.clearTimeout(this.showWebDisplayButtonTimeout)
+ }
+ this.showWebDisplayButtonTimeout = window.setTimeout(() => {
+ this.setState({ challenge: update(challenge,
+ {
+ showWebDisplayButton: { $set: false },
+ })
+ })
+ this.showWebDisplayButtonTimeout = null
+ }, 61 * 1000)
+ this.initDisplayInterval()
const path = challenge.web_route || challenge.path
const webDisplayUrl = `${tomcat_url}:${data.port}/${path}`
challenge.webDisplayUrl = webDisplayUrl
@@ -540,25 +574,10 @@ pop_box_new(htmlvalue, 480, 182);
const currentGamePassed = this.props.game !== 2 && status === 2
- // currentGamePassed &&
- // 放开display 测试看看有什么问题
- this.language_display(response);
-
// 评测通过了,立即同步costTime
currentGamePassed && this._updateCostTime(true, true);
- if (currentGamePassed) {
- game.status = 2;
- game.next_game = next_game;
- } else {
- this.showDialog({
- contentText: ,
- isSingleButton: true
- })
- }
+
const output_sets = {
"test_sets": test_sets,
@@ -570,10 +589,47 @@ pop_box_new(htmlvalue, 480, 182);
"had_passed_testsests_hidden_count": had_passed_testsests_hidden_count,
"had_passed_testsests_public_count": had_passed_testsests_public_count
};
+ let test_sets_array = []
if (output_sets && output_sets.test_sets) {
- const test_sets_array = JSON.parse("[" + output_sets.test_sets + "]");
+ test_sets_array = JSON.parse("[" + output_sets.test_sets + "]");
output_sets.test_sets_array = test_sets_array;
}
+ // 检查是否编译通过
+ let compileSuccess = false;
+ if (test_sets_array && test_sets_array.length) {
+ test_sets_array.some((item) => {
+ if (item.compile_success) {
+ compileSuccess = true;
+ return true;
+ }
+ })
+ }
+ // currentGamePassed &&
+ // 放开display 测试看看有什么问题
+ // TODO 编译通过才调用display
+ compileSuccess && this.language_display(response);
+
+ if (currentGamePassed) {
+ game.status = 2;
+ game.next_game = next_game;
+ } else {
+ this.showDialog({
+ contentText: ,
+ isSingleButton: true,
+ // showDisplayButton: compileSuccess && this.state.challenge.showWebDisplayButton == true
+ // ? 查看效果 : ''
+ })
+ }
this.setState({
testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), // 重置测试集展开状态
@@ -660,12 +716,13 @@ pop_box_new(htmlvalue, 480, 182);
@param okButtonText “确定”按钮显示文本,如 继续查看
*/
showDialog(params) {
- const { contentText, callback, moreButtonsRender, okButtonText, isSingleButton } = params;
+ const { contentText, callback, moreButtonsRender, okButtonText, isSingleButton, showDisplayButton } = params;
this.dialogOkCallback = callback;
this.moreButtonsRender = moreButtonsRender
this.okButtonText = okButtonText;
this.isSingleButton = !!isSingleButton
+ this.showDisplayButton = showDisplayButton
this.setState({
gDialogOpen: true,
gDialogContentText: contentText
@@ -718,6 +775,11 @@ pop_box_new(htmlvalue, 480, 182);
match: this.props.match
}}
>
+
this.handleGdialogClose()}
@@ -729,9 +791,11 @@ pop_box_new(htmlvalue, 480, 182);
- { this.isSingleButton ? :
diff --git a/public/react/src/modules/page/main/ActionView.js b/public/react/src/modules/page/main/ActionView.js
index ff515748..c12a41aa 100644
--- a/public/react/src/modules/page/main/ActionView.js
+++ b/public/react/src/modules/page/main/ActionView.js
@@ -25,7 +25,14 @@ const styles = theme => ({
color: '#4CACFF',
border: '1px solid #4CACFF'
}
+ },
+ hoverButton: {
+ margin: theme.spacing.unit,
+ height: '30px',
+ padding: '0 16px',
+ color: '#4CACFF',
+ border: '1px solid #4CACFF'
},
buttonText: {
color: '#1B4061 !important',
@@ -64,10 +71,12 @@ class ActionView extends Component {
{/*将第一个按钮改为visibility方式隐藏,不然加载时测评按钮会出现没有垂直居中的情况*/}
- this.showWebDisplay(challenge)}
- style={{ visibility: challenge.showWebDisplayButton ? '': 'hidden'}}>
- 查看效果
-
+
+ this.showWebDisplay(challenge)}
+ style={{ visibility: challenge.showWebDisplayButton ? '': 'hidden'}} id="showWebDisplayButton">
+ 查看效果
+
+
{
From 63a60603f3682d5c4b6508d1fc45d77982666d70 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Sat, 6 Jul 2019 09:46:05 +0800
Subject: [PATCH 04/15] =?UTF-8?q?=E8=AF=95=E7=94=A8=E7=94=B3=E8=AF=B7?=
=?UTF-8?q?=E7=9A=84=E7=9F=AD=E4=BF=A1=E9=80=9A=E7=9F=A5=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/account_controller.rb | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 987f2b70..3368da12 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -1066,12 +1066,14 @@ class AccountController < ApplicationController
# end
elsif !User.current.user_extensions.school.nil?
@tip = "申请已提交,我们将在5分钟内完成审核"
- unless apply_action.present?
+ if !apply_action.present?
ApplyAction.create(:user_id => User.current.id, :status => 0, :ip_addr => request.remote_ip, :container_type => "TrialAuthorization", :apply_reason => params[:apply_reason])
- begin
- status = Trustie::Sms.send(mobile:17680641960, send_type:'user_apply_auth',name:'管理员' )
- rescue => e
- Rails.logger.error "发送验证码出错: #{e}"
+ if user_ex.identity == 0 || user_ex.identity == 2
+ begin
+ status = Trustie::Sms.send(mobile:17680641960, send_type:'user_apply_auth',name:'管理员' )
+ rescue => e
+ Rails.logger.error "发送验证码出错: #{e}"
+ end
end
end
end
From 89bc81d159d4c9bc2eecb2202a70026867e6388b Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 8 Jul 2019 10:12:14 +0800
Subject: [PATCH 05/15] =?UTF-8?q?=E8=B0=83=E6=95=B4pdf=E5=AF=BC=E5=87=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 136 +++++++++++----------
1 file changed, 69 insertions(+), 67 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 304fcb7d..b25dfa20 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -79,89 +79,91 @@ class StudentWorkController < ApplicationController
@shixun = Shixun.select([:id, :gpid, :name]).find(HomeworkCommonsShixuns.where(:homework_common_id => @homework.id).pluck(:shixun_id).first)
@challenges = Challenge.select([:id]).where(:shixun_id => @shixun.id)
@myshixun = @work.myshixun
- @games = Game.where(:myshixun_id => @myshixun.id).includes(:challenge, :game_codes,:outputs).reorder("challenges.position") # 页面循环需要outputs
+ @games = Game.where(:myshixun_id => @myshixun.id).includes(:challenge, :game_codes, :outputs).reorder("challenges.position") # 页面循环需要outputs
# 用户个人信息
@user_name = @work.user.show_real_name
@student_id = @work.user.user_extensions.try(:student_id).nil? ? '--' : @work.user.user_extensions.try(:student_id)
- student_works_user_id = StudentWork.where(:homework_common_id => @homework.id).pluck(:user_id)
- myshixuns = @shixun.myshixuns.where(:user_id => student_works_user_id).includes(games: [:outputs])
-
- # 课堂实训中,评测次数最大值
- @total_evaluate_max = 0
- @user_evaluate_count = 0
- # 为了取最小efficiency。最小值是一个不确定数
- @min_efficiency = []
- power = []
- @game_user_query = []
- myshixuns.each do |myshixun|
- # 用户个人实训总得分
- user_total_score = 0
- # consume_time通关的关卡总耗时间;all_tine实训的总耗时
- pass_consume_time = 0
- all_time = 0
- # evaluate_count: 每次总评测次数;eff_score:用户得分/总评测次数;round_size:log(所有课堂实训最大评测次数/当前实训评测次数)
- evaluate_count = 0
- eff_score = 0
-
- myshixun.games.each do |game|
- evaluate_count += game.outputs.first.try(:query_index).to_i # 评测次数
- # y_score = (evaluate_count == 0 ? 0 : (user_total_score / evaluate_count.to_f))
- # eff_score = format("%.2f", y_score).to_f
- if game.status == 2
- pass_consume_time += (game.cost_time / 60.0).to_f
+ unless params[:pdf]
+ student_works_user_id = StudentWork.where(:homework_common_id => @homework.id).pluck(:user_id)
+ myshixuns = @shixun.myshixuns.where(:user_id => student_works_user_id).includes(:games)
+
+ # 课堂实训中,评测次数最大值
+ @total_evaluate_max = 0
+ @user_evaluate_count = 0
+ # 为了取最小efficiency。最小值是一个不确定数
+ @min_efficiency = []
+ power = []
+ @game_user_query = []
+ myshixuns.each do |myshixun|
+ # 用户个人实训总得分
+ user_total_score = 0
+ # consume_time通关的关卡总耗时间;all_tine实训的总耗时
+ pass_consume_time = 0
+ all_time = 0
+ # evaluate_count: 每次总评测次数;eff_score:用户得分/总评测次数;round_size:log(所有课堂实训最大评测次数/当前实训评测次数)
+ evaluate_count = 0
+ eff_score = 0
+
+ myshixun.games.each do |game|
+ evaluate_count += game.evaluate_count.to_i # 评测次数
+ # y_score = (evaluate_count == 0 ? 0 : (user_total_score / evaluate_count.to_f))
+ # eff_score = format("%.2f", y_score).to_f
+ if game.status == 2
+ pass_consume_time += (game.cost_time / 60.0).to_f
+ end
+ all_time += (game.cost_time / 60.0).to_f
+ user_total_score += game.status == 2 ? game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i : 0
+ if myshixun.user_id == @work.user.id
+ @game_user_query << [game.id, game.evaluate_count.to_i]
+ end
end
- all_time += (game.cost_time / 60.0).to_f
- user_total_score += game.status == 2 ? game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i : 0
+
+ # 当前用户评测最大次数
if myshixun.user_id == @work.user.id
- @game_user_query << [game.id, game.outputs.first.try(:query_index).to_i]
+ @user_evaluate_count = evaluate_count
end
- end
- # 当前用户评测最大次数
- if myshixun.user_id == @work.user.id
- @user_evaluate_count = evaluate_count
- end
-
- x_time = (all_time <= 1) ? 1 : Math.log(all_time).to_f
- consume_time = format("%.2f", x_time).to_f
+ x_time = (all_time <= 1) ? 1 : Math.log(all_time).to_f
+ consume_time = format("%.2f", x_time).to_f
- efficiency = (pass_consume_time == 0 ? 0 : Math.log((user_total_score / pass_consume_time.to_f) + 1.0))
- efficiency = format("%.2f", efficiency).to_f
- @min_efficiency << efficiency
+ efficiency = (pass_consume_time == 0 ? 0 : Math.log((user_total_score / pass_consume_time.to_f) + 1.0))
+ efficiency = format("%.2f", efficiency).to_f
+ @min_efficiency << efficiency
- @total_evaluate_max = @total_evaluate_max > evaluate_count.to_i ? @total_evaluate_max : evaluate_count
- power << {:consume_time => consume_time, :evaluate_count => evaluate_count, :user_id => myshixun.user_id,
- :user_total_score => user_total_score, :efficiency => efficiency}
- end
+ @total_evaluate_max = @total_evaluate_max > evaluate_count.to_i ? @total_evaluate_max : evaluate_count
+ power << {:consume_time => consume_time, :evaluate_count => evaluate_count, :user_id => myshixun.user_id,
+ :user_total_score => user_total_score, :efficiency => efficiency}
+ end
- # 数据库操作改成对数组操作
- min_efficiency = @min_efficiency.min
- result_list = []
- power.each do |p|
- y_score = (p[:evaluate_count] == 0 ? 0 : (p[:user_total_score] / p[:evaluate_count].to_f))
- eff_score = format("%.2f", y_score).to_f
+ # 数据库操作改成对数组操作
+ min_efficiency = @min_efficiency.min
+ result_list = []
+ power.each do |p|
+ y_score = (p[:evaluate_count] == 0 ? 0 : (p[:user_total_score] / p[:evaluate_count].to_f))
+ eff_score = format("%.2f", y_score).to_f
- user_id = p[:user_id]
- consume_time = p[:consume_time]
- efficiency = p[:efficiency] < 0 ? format("%.2f", p[:efficiency] - min_efficiency).to_f : p[:efficiency]
- round_size = (p[:evaluate_count] == 0 ? 0 : Math.log(@total_evaluate_max / p[:evaluate_count].to_f)) * 3.14
- result_list << {:eff_score => eff_score, :user_id => user_id, :consume_time => consume_time, :efficiency => efficiency, :round_size => round_size}
- end
+ user_id = p[:user_id]
+ consume_time = p[:consume_time]
+ efficiency = p[:efficiency] < 0 ? format("%.2f", p[:efficiency] - min_efficiency).to_f : p[:efficiency]
+ round_size = (p[:evaluate_count] == 0 ? 0 : Math.log(@total_evaluate_max / p[:evaluate_count].to_f)) * 3.14
+ result_list << {:eff_score => eff_score, :user_id => user_id, :consume_time => consume_time, :efficiency => efficiency, :round_size => round_size}
+ end
- @power = []
- @efficiency = []
- result_list.sort{|x, y| x[:efficiency] <=> y[:efficiency]}.each_with_index do |result, index|
- @efficiency << [index+1, result[:efficiency], result[:user_id]]
- if result[:user_id] == @work.user.id
- @myself_eff = [index+1, result[:efficiency]]
- @myself_power = [result[:consume_time], result[:eff_score], result[:round_size]]
+ @power = []
+ @efficiency = []
+ result_list.sort{|x, y| x[:efficiency] <=> y[:efficiency]}.each_with_index do |result, index|
+ @efficiency << [index+1, result[:efficiency], result[:user_id]]
+ if result[:user_id] == @work.user.id
+ @myself_eff = [index+1, result[:efficiency]]
+ @myself_power = [result[:consume_time], result[:eff_score], result[:round_size]]
+ end
end
- end
- result_list.sort{|x, y| x[:consume_time] <=> y[:consume_time]}.each do |result|
- @power << [result[:consume_time], result[:eff_score], result[:round_size], result[:user_id]]
+ result_list.sort{|x, y| x[:consume_time] <=> y[:consume_time]}.each do |result|
+ @power << [result[:consume_time], result[:eff_score], result[:round_size], result[:user_id]]
+ end
end
From ce83676e3def74cdb6be91a924552aa21a6cef37 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 8 Jul 2019 10:23:18 +0800
Subject: [PATCH 06/15] =?UTF-8?q?=E8=B0=83=E6=95=B4pdf=E5=AF=BC=E5=87=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/shixun_work_report.html.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/student_work/shixun_work_report.html.erb b/app/views/student_work/shixun_work_report.html.erb
index e83cd3d7..748cbb9f 100644
--- a/app/views/student_work/shixun_work_report.html.erb
+++ b/app/views/student_work/shixun_work_report.html.erb
@@ -77,8 +77,8 @@
<% end %>
<%= game.try(:open_time).nil? || game.status == 3 ? "--" : format_time(game.open_time) %>
- <% user_query = @game_user_query.select{|user_query| user_query[0] == game.id} %>
- <%= user_query.blank? ? "--" : user_query.first[1] %>
+ <%# user_query = @game_user_query.select{|user_query| user_query[0] == game.id} %>
+ <%= game.evaluate_count.to_i == 0 ? "--" : game.evaluate_count.to_i %>
<%= game.try(:end_time).nil? ? "--" : format_time(game.end_time) %>
<%= game.consumes_time %>
<%= game.status == 2 ? (game.final_score.to_i < 0 ? 0 : game.challenge.choose_score.to_i) : 0 %> / <%= game.challenge.choose_score %>
From 85de5b6c12e944a381bb0657278c5bfa6a657ad0 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 8 Jul 2019 11:38:53 +0800
Subject: [PATCH 07/15] =?UTF-8?q?=E8=B0=83=E6=95=B4pdf=E5=AF=BC=E5=87=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index b25dfa20..65be029c 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -85,13 +85,18 @@ class StudentWorkController < ApplicationController
@user_name = @work.user.show_real_name
@student_id = @work.user.user_extensions.try(:student_id).nil? ? '--' : @work.user.user_extensions.try(:student_id)
+ # 当前用户评测最大次数
+ @user_evaluate_count = 0
+ if myshixun.user_id == @work.user.id
+ @user_evaluate_count = @myshixun.games.pluck(:evaluate_count).sum.to_i
+ end
+
unless params[:pdf]
student_works_user_id = StudentWork.where(:homework_common_id => @homework.id).pluck(:user_id)
myshixuns = @shixun.myshixuns.where(:user_id => student_works_user_id).includes(:games)
# 课堂实训中,评测次数最大值
@total_evaluate_max = 0
- @user_evaluate_count = 0
# 为了取最小efficiency。最小值是一个不确定数
@min_efficiency = []
power = []
@@ -120,11 +125,6 @@ class StudentWorkController < ApplicationController
end
end
- # 当前用户评测最大次数
- if myshixun.user_id == @work.user.id
- @user_evaluate_count = evaluate_count
- end
-
x_time = (all_time <= 1) ? 1 : Math.log(all_time).to_f
consume_time = format("%.2f", x_time).to_f
From a496de41ee2dca70d495de8b45d9c8e8284fcb4f Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 8 Jul 2019 11:41:10 +0800
Subject: [PATCH 08/15] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 65be029c..01299409 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -88,7 +88,7 @@ class StudentWorkController < ApplicationController
# 当前用户评测最大次数
@user_evaluate_count = 0
if myshixun.user_id == @work.user.id
- @user_evaluate_count = @myshixun.games.pluck(:evaluate_count).sum.to_i
+ @user_evaluate_count = @myshixun.games.sum(:evaluate_count).to_i
end
unless params[:pdf]
From 4b4a0d52e6a8373b67625bd463e7e90b163501b5 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Mon, 8 Jul 2019 11:43:12 +0800
Subject: [PATCH 09/15] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index 01299409..d8b572ea 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -87,8 +87,8 @@ class StudentWorkController < ApplicationController
# 当前用户评测最大次数
@user_evaluate_count = 0
- if myshixun.user_id == @work.user.id
- @user_evaluate_count = @myshixun.games.sum(:evaluate_count).to_i
+ if @myshixun.user_id == @work.user.id
+ @user_evaluate_count = @myshixun.games.pluck(:evaluate_count).sum.to_i
end
unless params[:pdf]
From f7a2057433b26612929b4c250894a47527b2c92f Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Tue, 9 Jul 2019 09:50:50 +0800
Subject: [PATCH 10/15] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E9=BB=98=E8=AE=A4?=
=?UTF-8?q?=E4=BC=9A=E9=85=8D=E7=BD=AE=E4=B8=80=E4=B8=AA=E8=84=9A=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/shixuns_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index 965f15f3..7c248e92 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -792,7 +792,7 @@ class ShixunsController < ApplicationController
shixun_script = modify_shixun_script @shixun, shixun_script
end
end
- #@shixun.evaluate_script = shixun_script
+ @shixun.evaluate_script = shixun_script
ActiveRecord::Base.transaction do
begin
From 77617c62488fe8b0f448ec8c00ac7e8f9a4e55e8 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Tue, 9 Jul 2019 14:38:10 +0800
Subject: [PATCH 11/15] =?UTF-8?q?=E8=BF=90=E8=90=A5=E4=BA=BA=E5=91=98?=
=?UTF-8?q?=E7=9A=84=E5=AE=9E=E8=AE=AD=E6=8A=A5=E5=91=8A=E6=9F=A5=E7=9C=8B?=
=?UTF-8?q?=E6=9D=83=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/student_work/_shixun_work_show.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/student_work/_shixun_work_show.html.erb b/app/views/student_work/_shixun_work_show.html.erb
index 77e3062f..3c0447de 100644
--- a/app/views/student_work/_shixun_work_show.html.erb
+++ b/app/views/student_work/_shixun_work_show.html.erb
@@ -7,7 +7,7 @@
<%= link_to @shixun.name, shixun_path(@shixun), :class => "edu-info-dark fl task-hide",:style=>"max-width:300px", :target => "_blank" %>
- <% if User.current.has_teacher_role(@homework.course) || User.current.admin? || @work.user == User.current %>
+ <% if User.current.has_teacher_role(@homework.course) || User.current.admin? || User.current.business? || @work.user == User.current %>
经验值:<%= @myshixun.total_score %>
From fc2a8a43a8adb4641b94d9d564353dfe566b148a Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Wed, 10 Jul 2019 10:33:32 +0800
Subject: [PATCH 12/15] drag resize
---
public/react/public/js/js_min_all.js | 26 ++++++++++++++++++++
public/react/src/modules/page/MainContent.js | 15 ++++++++++-
public/react/src/modules/page/VNCDisplay.js | 6 ++++-
3 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/public/react/public/js/js_min_all.js b/public/react/public/js/js_min_all.js
index 19daead5..0c139046 100644
--- a/public/react/public/js/js_min_all.js
+++ b/public/react/public/js/js_min_all.js
@@ -206,6 +206,7 @@ $(function(){
// window resize
$(window).on('resize', function() {
+ // _resizeVNC_if_needed()
$('.CodeMirror.cm-s-railscasts').css("height", $("#games_repository_contents").height() - repositoryTabHeight);
})
@@ -1182,6 +1183,7 @@ $(function(){ // 这里重新加一次事件监听,不在原有事件的基
dragging = true;
dragDom = lab;
$('#htmlIframe').css('pointer-events', 'none')
+ $('#can-drag').show()
return false;
}
);
@@ -1202,7 +1204,10 @@ $(function(){ // 这里重新加一次事件监听,不在原有事件的基
doc.live("mouseup", function(e) {
// 在大窗口将下边测试集滚动条拖上去后,将窗口缩小,再拖下来就有这种情况 https://www.trustie.net/issues/16326
+ $('#can-drag').hide()
+
if (dragging === true) {
+ // _resizeVNC_if_needed()
window.editor_CodeMirror && window.editor_CodeMirror.refresh()
// 使得iframe可以继续捕获事件
$('#htmlIframe').css('pointer-events', 'inherit')
@@ -1210,6 +1215,27 @@ $(function(){ // 这里重新加一次事件监听,不在原有事件的基
dragging = false;
});
})
+function _resizeVNC_if_needed() {
+ return;
+ if (window.__isVNC) {
+ // $('#screen>div').width('1024px').height('768px')
+ var trueHeight = $('#game_right_contents').height();
+ var width = $('#game_right_contents').width()
+
+ // __rfb && __rfb.get_display().autoscale(width, trueHeight)
+
+ return;
+ if (trueHeight < 768) {
+ var width = $('#game_right_contents').width()
+ var _left = width - $('#screen').width() / 2
+ var scale = (trueHeight / 768).toFixed(5)
+ // _left
+ $('#screen').css('transform', 'scale(' + scale + ', ' + scale +')').css('transform-origin', 0 + 'px 0px')
+ } else {
+ $('#screen').css('transform', 'scale(' + 1 + ', ' + 1 +')')
+ }
+ }
+}
// ---------------------------------------------------------------------------------------------
/**
diff --git a/public/react/src/modules/page/MainContent.js b/public/react/src/modules/page/MainContent.js
index a0ac70f1..6902b7f2 100644
--- a/public/react/src/modules/page/MainContent.js
+++ b/public/react/src/modules/page/MainContent.js
@@ -46,7 +46,8 @@ class MainContent extends Component {
} else {
games_repository_contents_style = {overflow: 'hidden', height: '445px'}
}
- const showIframeContent = shixun && shixun.vnc == true
+ const showIframeContent = shixun && shixun.vnc == true
+ // window.__isVNC = showIframeContent && !!vnc_url
return (
@@ -55,6 +56,18 @@ class MainContent extends Component {
{/* 左侧任务说明等功能的区域 */}
+
+ {showIframeContent && vnc_url &&
}
diff --git a/public/react/src/modules/page/VNCDisplay.js b/public/react/src/modules/page/VNCDisplay.js
index 1e443ed1..57d26731 100644
--- a/public/react/src/modules/page/VNCDisplay.js
+++ b/public/react/src/modules/page/VNCDisplay.js
@@ -13,6 +13,7 @@ class VNCDisplay extends Component {
// When this function is called we have
// successfully connected to a server
function connectedToServer(e) {
+ $('#top_bar').hide()
status("Connected to " + desktopName);
}
// This function is called when we are disconnected
@@ -109,6 +110,8 @@ class VNCDisplay extends Component {
// Set parameters that can be changed on an active connection
rfb.viewOnly = readQueryVariable('view_only', false);
rfb.scaleViewport = readQueryVariable('scale', false);
+ rfb.resizeSession = true
+ window.__rfb = rfb;
}
render() {
@@ -116,7 +119,7 @@ class VNCDisplay extends Component {
return (
-