ssh-manager/static/js/openterm.js
2020-11-16 16:41:02 +08:00

33 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

openterm = function () {
var pass_info = $('form').serializeArray();
var obj = {}; //声明一个对象
$.each(pass_info, function (index, field) {
obj[field.name] = field.value; //通过变量,将属性值,属性一起放到对象中
})
obj.id = GetQueryString("id")
http_send("/getterm", obj, openterm_callback)
}
openterm_callback = function (result) {
parent.layer.closeAll('iframe');
parent.getinfo();
var getData = GetRequest();
if (top) {
top.layui.home.TabController.add(getData.sername, "/term?sid=" + result.data);
} else {
layer.msg("请不要单独打开本页面")
}
}
GetRequest = function () {
var url = decodeURI(decodeURI(location.search)); //获取url中"?"符后的字串使用了两次decodeRUI解码
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
return theRequest;
}
}