mirror of https://github.com/tp4a/teleport
parent
6c8e12cdc1
commit
bd6c0152cd
|
@ -127,25 +127,35 @@ $assist.do_teleport = function (args, func_success, func_error) {
|
||||||
|
|
||||||
// console.log('---', data);
|
// console.log('---', data);
|
||||||
var args_ = encodeURIComponent(JSON.stringify(data));
|
var args_ = encodeURIComponent(JSON.stringify(data));
|
||||||
$.ajax({
|
//判断是否使用urlprocotol处理方式
|
||||||
type: 'GET',
|
if ($app.options.url_proto){
|
||||||
timeout: 5000,
|
|
||||||
//url: 'http://localhost:50022/ts_op/' + args_,
|
if(!$("#urlproto").length) {
|
||||||
url: $assist.api_url + '/run/' + args_,
|
var _html = "<div id='urlproto' style='display:none;z-index=-1;'><iframe src=''/></div>";
|
||||||
jsonp: 'callback',
|
$('body').append($(_html));
|
||||||
dataType: 'json',
|
}
|
||||||
success: function (ret) {
|
$("#urlproto").find("iframe").attr("src",'teleport://' + JSON.stringify(data));
|
||||||
console.log('ret', ret);
|
}else{
|
||||||
if (ret.code === TPE_OK) {
|
$.ajax({
|
||||||
func_success();
|
type: 'GET',
|
||||||
} else {
|
timeout: 5000,
|
||||||
func_error(ret.code, ret.message);
|
//url: 'http://localhost:50022/ts_op/' + args_,
|
||||||
|
url: $assist.api_url + '/run/' + args_,
|
||||||
|
jsonp: 'callback',
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (ret) {
|
||||||
|
console.log('ret', ret);
|
||||||
|
if (ret.code === TPE_OK) {
|
||||||
|
func_success();
|
||||||
|
} else {
|
||||||
|
func_error(ret.code, ret.message);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
func_error(TPE_NO_ASSIST, '无法连接到teleport助手,可能尚未启动!');
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
error: function () {
|
}
|
||||||
func_error(TPE_NO_ASSIST, '无法连接到teleport助手,可能尚未启动!');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
if (ret.code === TPE_NO_CORE_SERVER) {
|
if (ret.code === TPE_NO_CORE_SERVER) {
|
||||||
func_error(ret.code, '远程连接请求失败,可能teleport核心服务尚未启动!' + ret.message);
|
func_error(ret.code, '远程连接请求失败,可能teleport核心服务尚未启动!' + ret.message);
|
||||||
|
|
Loading…
Reference in New Issue