From 3150461d126e63187f50e08ca787ebb6c8c42692 Mon Sep 17 00:00:00 2001 From: ibuler Date: Sat, 12 Dec 2015 23:37:28 +0800 Subject: [PATCH] bug fix --- templates/jasset/asset_cu_list.html | 18 +++++++++++++----- templates/jasset/asset_list.html | 15 ++++++++++++--- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/templates/jasset/asset_cu_list.html b/templates/jasset/asset_cu_list.html index 7ab1958ca..f59be1929 100644 --- a/templates/jasset/asset_cu_list.html +++ b/templates/jasset/asset_cu_list.html @@ -159,14 +159,25 @@ var href = $(this).attr('href'); var new_url = '{% url "terminal" %}?id=' + $(this).attr('value') + '&role='; var hostname = $(this).closest('tr').find('.hostname a')[0].innerHTML; + var title = 'Jumpserver Web Terminal' + ' '+ hostname +''; $.ajax({ type: 'GET', url: url, data: {}, success: function(data){ var dataArray = data.split(','); - if (dataArray.length == 1 && data != 'error'){ - var title = 'Jumpserver Web Terminal' + ' '+ hostname +''; + if (data == 'error' || data == '' || data == null || data == undefined){ + layer.alert('没有授权角色') + } else if (dataArray.length == 1 && data != 'error' && navigator.platform == 'Win32') { + layer.open({ + type: 2, + title: title, + maxmin: true, + shade: false, + area: ['628px', '420px'], + content: new_url + data + }); + } else if (dataArray.length == 1 && data != 'error'){ layer.open({ type: 2, title: title, @@ -176,14 +187,11 @@ content: new_url+data }); //window.open(new_url + data, '', 'location=no, resizeable=no, height=410, width=625, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,status=no'); - } else if (dataArray.length == '1' && data == 'error'){ - layer.alert('没有授权角色') } else { aUrl = ''; $.each(dataArray, function(index, value){ aUrl += '' + value + ' ' }); - console.log(aUrl); layer.alert(aUrl, { skin: 'layui-layer-molv', title: '多个角色,请选择一个连接', diff --git a/templates/jasset/asset_list.html b/templates/jasset/asset_list.html index 8aea9e1d5..4775eba0d 100644 --- a/templates/jasset/asset_list.html +++ b/templates/jasset/asset_list.html @@ -232,10 +232,18 @@ if (data == 'error' || data == '' || data == null || data == undefined){ layer.alert('没有授权角色') } - else if (dataArray.length == 1 && data != 'error'){ + else if (dataArray.length == 1 && data != 'error' && navigator.platform == 'Win32'){ var title = 'Jumpserver Web Terminal' + ' '+ hostname +''; - console.log(new_url+data); layer.open({ + type: 2, + title: title, + maxmin: true, + shade: false, + area: ['628px', '420px'], + content: new_url+data + }); + } else if (dataArray.length == 1 && data != 'error'){ + layer.open({ type: 2, title: title, maxmin: true, @@ -243,7 +251,8 @@ area: ['628px', '452px'], content: new_url+data }); - } else { + } + else { aUrl = ''; $.each(dataArray, function(index, value){ aUrl += '' + value + ' '