新增日志页面嵌套监控的公共方法,后续根据需求合入公共代码
Showing
2 changed files
with
28 additions
and
7 deletions
@@ -58,6 +58,9 @@ layui.define(['sessions', 'form', 'common'],function (exports) { | @@ -58,6 +58,9 @@ layui.define(['sessions', 'form', 'common'],function (exports) { | ||
58 | var tokenStr = getUrlParam("Authorization").replace('Bearer%20','').replace('Bearer ',''); | 58 | var tokenStr = getUrlParam("Authorization").replace('Bearer%20','').replace('Bearer ',''); |
59 | // 跳转地址 | 59 | // 跳转地址 |
60 | var url = getUrlParam("url").split('#/')[0]; | 60 | var url = getUrlParam("url").split('#/')[0]; |
61 | + if(url.indexOf('(')!=-1 && url.indexOf(')')!=-1 ){ | ||
62 | + url = url.replace('(','?').replace(':','=').replace(',','&').replace(')',''); | ||
63 | + } | ||
61 | 64 | ||
62 | // 日志地址 | 65 | // 日志地址 |
63 | var logApi = 'http://192.168.0.44:8080'; | 66 | var logApi = 'http://192.168.0.44:8080'; |
@@ -89,10 +92,15 @@ layui.define(['sessions', 'form', 'common'],function (exports) { | @@ -89,10 +92,15 @@ layui.define(['sessions', 'form', 'common'],function (exports) { | ||
89 | //contentType: 'application/x-www-form-urlencoded', | 92 | //contentType: 'application/x-www-form-urlencoded', |
90 | success:function(rsp){ | 93 | success:function(rsp){ |
91 | if(rsp.code == 0){ | 94 | if(rsp.code == 0){ |
92 | - console.log(JSON.stringify(rsp.data)); | ||
93 | var name = rsp.object.username; | 95 | var name = rsp.object.username; |
94 | - var pwd = common.Base64.decode(rsp.object.password); | ||
95 | - console.log(pwd); | 96 | + try { |
97 | + var SubtleCrypto=new SubtleCrypto(); | ||
98 | + var pwd = SubtleCrypto.decrypt(rsp.object.password); | ||
99 | + console.log(pwd); | ||
100 | + }catch (e) { | ||
101 | + | ||
102 | + } | ||
103 | + | ||
96 | var field = {}; | 104 | var field = {}; |
97 | field.username = name; | 105 | field.username = name; |
98 | field.password = '123456'; | 106 | field.password = '123456'; |
@@ -127,7 +135,15 @@ layui.define(['sessions', 'form', 'common'],function (exports) { | @@ -127,7 +135,15 @@ layui.define(['sessions', 'form', 'common'],function (exports) { | ||
127 | localStorage.setItem("loginUrl", location.href); | 135 | localStorage.setItem("loginUrl", location.href); |
128 | 136 | ||
129 | //登入成功的提示与跳转 | 137 | //登入成功的提示与跳转 |
130 | - window.location = window.location.origin + '/start/index.html?show=0&access_token='+data.access_token+'#/'+url; | 138 | + if(url.indexOf("ajConfig")!=-1){ |
139 | + if(url.indexOf("ajConfig/view")!=-1){ | ||
140 | + window.location = window.location.origin + '/vue3/index.html#/' + url; | ||
141 | + }else { | ||
142 | + window.location = window.location.origin + '/vue3/index.html?show=0&access_token=' + data.access_token + '#/' + url; | ||
143 | + } | ||
144 | + }else { | ||
145 | + window.location = window.location.origin + '/start/index.html?show=0&access_token=' + data.access_token + '#/' + url; | ||
146 | + } | ||
131 | 147 | ||
132 | } else { | 148 | } else { |
133 | layer.msg('登录失败,请重试', {icon: 5, time: 500}); | 149 | layer.msg('登录失败,请重试', {icon: 5, time: 500}); |
@@ -6,9 +6,14 @@ | @@ -6,9 +6,14 @@ | ||
6 | 6 | ||
7 | 7 | ||
8 | var global = {}; | 8 | var global = {}; |
9 | - | ||
10 | -global.layui = window.parent.layui; | ||
11 | -global.layer = window.parent.layer; | 9 | +console.log(window.parent); |
10 | +if (window.parent.frames[0] != window.self) { | ||
11 | + global.layui = window.parent.layui; | ||
12 | + global.layer = window.parent.layer; | ||
13 | +}else { | ||
14 | + global.layui = undefined; | ||
15 | + global.layer = undefined; | ||
16 | +} | ||
12 | 17 | ||
13 | global.common = { | 18 | global.common = { |
14 | getUserName : function (){ | 19 | getUserName : function (){ |
-
Please register or login to post a comment