This commit is contained in:
daiao 2017-07-06 16:13:46 +08:00
parent cd67988902
commit 788fa96b14
3 changed files with 27 additions and 9 deletions

View File

@ -34,7 +34,8 @@ class MyshixunsController < ApplicationController
render :json => {:host => res['address'], :port => res['port'], :username => username, :password => password}
rescue Exception => e
logger.error(e)
@message = e.try(:message)
render :json => {:error => e.try(:message)}
# @message = e.try(:message)
end
end

View File

@ -0,0 +1,3 @@
<iframe src="http://106.75.96.108:9527?Host=10.9.81.28&Port=40012&Username=root&Password=123123" style="width:100%;border: 0;" id="game_webssh">
</iframe>

View File

@ -2,7 +2,7 @@
<li id="codetab_nav_1" class="blacktab_hover" onclick="HoverLi_new(1);">
<a href="javascript:void(0);" class="tab_type">代码</a>
</li>
<li id="codetab_nav_2" onclick="HoverLi_new(2);">
<li id="codetab_nav_2">
<a href="javascript:void(0);" class="tab_type" >命令行</a>
</li>
<div class="fr mt5 -horizontal">
@ -52,10 +52,8 @@
</div>
<div class="-layout-v -fit" id="coding_area">
<div class="-flex">
<div class="content-editor-inner">
<iframe src="http://127.0.0.1:9527?Host=106.75.96.108&Port=30123&Username=root&Password=@pd:lk4+407" width="100%" id="game_webssh">
</iframe>
<div class="content-editor-inner" id="game_webssh">
<%#= render :partial => 'games/game_webssh' %>
</div>
</div>
</div>
@ -63,8 +61,6 @@
</div>
</div>
<script>
var h = $("#games_repository_contents").height() - $("#top_repository").height() - 50;
$("#game_webssh").css("min-height", h);
function g_l(o){return document.getElementById(o);}
function HoverLi_new(n){
for(var i=1;i<=2;i++){
@ -73,5 +69,23 @@
}
g_l('codotab_con_'+n).className='dis';
g_l('codetab_nav_'+n).className='blacktab_hover';
}
};
$('#codetab_nav_2').on("click", function(){
$.ajax({
url: "<%= open_webssh_myshixun_path %>",
success: function(data){
console.log(data);
if(data.error){
return;
}else{
var html = "<iframe src='http://106.75.96.108:9527?Host=" + data.host + "&Port=" + data.port + "&Username=" + data.username + "&Password=" + data.password + "'" + "style='width:100%;border:0;' id='game_webssh'></iframe>";
$("#codotab_con_2").html(html);
var h = $("#games_repository_contents").height() - $("#top_repository").height() - 10;
$("#game_webssh").css("min-height", h);
HoverLi_new(2);
}
}
})
});
</script>