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 1/3] =?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 2/3] 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 (
-