Authored by wangtao

fault: 公共接口请求增加参数

@@ -94,7 +94,7 @@ layui.define(['sessions', 'form', 'common'], function (exports) { @@ -94,7 +94,7 @@ layui.define(['sessions', 'form', 'common'], function (exports) {
94 // 跳转地址 94 // 跳转地址
95 var url = getUrlParam("url").split('#/')[0]; 95 var url = getUrlParam("url").split('#/')[0];
96 var map = getUrlParamMap(); 96 var map = getUrlParamMap();
97 - 97 + localStorage.setItem("page_url","zhjk/monitor-web/#/"+url);
98 let arr = []; 98 let arr = [];
99 if(map){ 99 if(map){
100 Object.keys(map).map(_ => arr.push(`${_}=${map[_]}`)); 100 Object.keys(map).map(_ => arr.push(`${_}=${map[_]}`));
@@ -119,6 +119,14 @@ layui.define(['laytpl', 'layer'], function (exports) { @@ -119,6 +119,14 @@ layui.define(['laytpl', 'layer'], function (exports) {
119 // // : (layui.data(setter.tableName)[request.tokenName] || ''); 119 // // : (layui.data(setter.tableName)[request.tokenName] || '');
120 // } 120 // }
121 121
  122 + let userId = localStorage.getItem("userId");
  123 + let userName = localStorage.getItem("lgn");
  124 + let nickName = localStorage.getItem("nickName");
  125 + let hash = btoa(localStorage.getItem("page_url"));
  126 +
  127 + options.data['MjUserId'] = userId;
  128 + options.data['MjUserName'] = userName;
  129 + options.data['MjHash'] = hash;
122 130
123 if(options.method == 'post' || options.method == 'POST' || options.type == 'post' || options.type == 'POST' 131 if(options.method == 'post' || options.method == 'POST' || options.type == 'post' || options.type == 'POST'
124 || options.type == 'delete' || options.method == 'delete' || options.type == 'DELETE' || options.method == 'DELETE'){ 132 || options.type == 'delete' || options.method == 'delete' || options.type == 'DELETE' || options.method == 'DELETE'){
@@ -127,6 +135,9 @@ layui.define(['laytpl', 'layer'], function (exports) { @@ -127,6 +135,9 @@ layui.define(['laytpl', 'layer'], function (exports) {
127 let tokenVal = common.getMjToken(); 135 let tokenVal = common.getMjToken();
128 let tokenKey = common.getMjTokenKey(); 136 let tokenKey = common.getMjTokenKey();
129 options.headers['AuthorizationMj'] = "BearerMj " + tokenVal; 137 options.headers['AuthorizationMj'] = "BearerMj " + tokenVal;
  138 + options.headers['MjUserId'] = userId;
  139 + options.headers['MjUserName'] = userName;
  140 + options.headers['MjHash'] = hash;
130 }); 141 });
131 } else if (request.tokenName) { 142 } else if (request.tokenName) {
132 let tokenVal = options.data[request.tokenName]; 143 let tokenVal = options.data[request.tokenName];
@@ -284,6 +284,7 @@ @@ -284,6 +284,7 @@
284 if(res && res.data){ 284 if(res && res.data){
285 let d = res.data; 285 let d = res.data;
286 localStorage.setItem("mj-user-info",JSON.stringify(d)) 286 localStorage.setItem("mj-user-info",JSON.stringify(d))
  287 + localStorage.setItem("userId",d.userId)
287 if(d.user){ 288 if(d.user){
288 localStorage.setItem("lgn", d.user.username); 289 localStorage.setItem("lgn", d.user.username);
289 session.putUser(d.user.username); 290 session.putUser(d.user.username);