提交 d89ac33c 编写于 作者: doc_wei's avatar doc_wei

树添加userToken

上级 43459bc9
...@@ -30,7 +30,6 @@ layui.config({ ...@@ -30,7 +30,6 @@ layui.config({
loadUserMation(); loadUserMation();
//加载用户信息 //加载用户信息
function loadUserMation(){ function loadUserMation(){
if(!isNull(getCookie('userToken'))){
// 获取当前登录员工信息 // 获取当前登录员工信息
systemCommonUtil.getSysCurrentLoginUserMation(function (data){ systemCommonUtil.getSysCurrentLoginUserMation(function (data){
var str = '<img alt="' + data.bean.userName + '" src="' + fileBasePath + data.bean.userPhoto + '"/>' var str = '<img alt="' + data.bean.userName + '" src="' + fileBasePath + data.bean.userPhoto + '"/>'
...@@ -42,9 +41,6 @@ layui.config({ ...@@ -42,9 +41,6 @@ layui.config({
location.href = "../../tpl/index/login.html?url=" + escape("../../tpl/apiPage/apiPage.html"); location.href = "../../tpl/index/login.html?url=" + escape("../../tpl/apiPage/apiPage.html");
}); });
loadApiMicroservices(); loadApiMicroservices();
} else {
location.href = "../../tpl/index/login.html?url=" + escape("../../tpl/apiPage/apiPage.html");
}
} }
/** /**
...@@ -236,7 +232,7 @@ layui.config({ ...@@ -236,7 +232,7 @@ layui.config({
} }
}); });
//退出 // 退出
$("body").on("click", "#exitBtn", function(){ $("body").on("click", "#exitBtn", function(){
winui.window.confirm('确认注销吗?', {id: 'exit-confim', icon: 3, title: '提示', skin: 'msg-skin-message', success: function(layero, index){ winui.window.confirm('确认注销吗?', {id: 'exit-confim', icon: 3, title: '提示', skin: 'msg-skin-message', success: function(layero, index){
var times = $("#exit-confim").parent().attr("times"); var times = $("#exit-confim").parent().attr("times");
......
...@@ -25,7 +25,7 @@ layui.config({ ...@@ -25,7 +25,7 @@ layui.config({
var ztree = null; var ztree = null;
fsTree.render({ fsTree.render({
id: "treeDemo", id: "treeDemo",
url: reqBasePath + "sysenclosure001?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"], url: reqBasePath + "sysenclosure001?loginPCIp=" + returnCitySN["cip"],
checkEnable: false, checkEnable: false,
loadEnable: true,//异步加载 loadEnable: true,//异步加载
showLine: false, showLine: false,
......
...@@ -51,7 +51,7 @@ layui.config({ ...@@ -51,7 +51,7 @@ layui.config({
var ztree = null; var ztree = null;
fsTree.render({ fsTree.render({
id: "treeDemo", id: "treeDemo",
url: reqBasePath + "fileconsole001?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"], url: reqBasePath + "fileconsole001?loginPCIp=" + returnCitySN["cip"],
checkEnable: false, checkEnable: false,
loadEnable: true,//异步加载 loadEnable: true,//异步加载
showLine: false, showLine: false,
......
...@@ -16,7 +16,7 @@ layui.config({ ...@@ -16,7 +16,7 @@ layui.config({
var ztree = null; var ztree = null;
fsTree.render({ fsTree.render({
id: "treeDemo", id: "treeDemo",
url: reqBasePath + "fileconsole001?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"], url: reqBasePath + "fileconsole001?loginPCIp=" + returnCitySN["cip"],
checkEnable: true, checkEnable: true,
loadEnable: true,//异步加载 loadEnable: true,//异步加载
showLine: false, showLine: false,
......
...@@ -19,7 +19,7 @@ layui.config({ ...@@ -19,7 +19,7 @@ layui.config({
var ztree = null; var ztree = null;
fsTree.render({ fsTree.render({
id: "treeDemo", id: "treeDemo",
url: flowableBasePath + "dsFormObjectRelation007?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"] + "&firstTypeCode=" + firstTypeCode + "&language=" + languageType, url: flowableBasePath + "dsFormObjectRelation007?loginPCIp=" + returnCitySN["cip"] + "&firstTypeCode=" + firstTypeCode + "&language=" + languageType,
clickCallback: onClickTree, clickCallback: onClickTree,
onDblClick: onClickTree onDblClick: onClickTree
}, function(id){ }, function(id){
......
...@@ -84,7 +84,7 @@ layui.config({ ...@@ -84,7 +84,7 @@ layui.config({
var el5; var el5;
el5 = eleTree.render({ el5 = eleTree.render({
elem: '.ele5', elem: '.ele5',
url: flowableBasePath + "materialcategory009?userToken=" + getCookie('userToken') + "&loginPCIp=", url: flowableBasePath + "materialcategory009?loginPCIp=",
defaultExpandAll: true, defaultExpandAll: true,
expandOnClickNode: false, expandOnClickNode: false,
highlightCurrent: true highlightCurrent: true
......
...@@ -38,7 +38,7 @@ layui.config({ ...@@ -38,7 +38,7 @@ layui.config({
var materialCategoryType; var materialCategoryType;
fsTree.render({ fsTree.render({
id: "materialCategoryType", id: "materialCategoryType",
url: flowableBasePath + "materialcategory008?userToken=" + getCookie('userToken') + "&loginPCIp=", url: flowableBasePath + "materialcategory008?loginPCIp=",
checkEnable: false, checkEnable: false,
loadEnable: false,//异步加载 loadEnable: false,//异步加载
showLine: false, showLine: false,
......
...@@ -27,7 +27,7 @@ layui.config({ ...@@ -27,7 +27,7 @@ layui.config({
var materialCategoryType; var materialCategoryType;
fsTree.render({ fsTree.render({
id: "materialCategoryType", id: "materialCategoryType",
url: flowableBasePath + "materialcategory008?userToken=" + getCookie('userToken') + "&loginPCIp=", url: flowableBasePath + "materialcategory008?loginPCIp=",
checkEnable: false, checkEnable: false,
loadEnable: false,//异步加载 loadEnable: false,//异步加载
showLine: false, showLine: false,
......
...@@ -84,7 +84,7 @@ layui.config({ ...@@ -84,7 +84,7 @@ layui.config({
var el5; var el5;
el5 = eleTree.render({ el5 = eleTree.render({
elem: '.ele5', elem: '.ele5',
url: flowableBasePath + "materialcategory009?userToken=" + getCookie('userToken') + "&loginPCIp=", url: flowableBasePath + "materialcategory009?loginPCIp=",
defaultExpandAll: true, defaultExpandAll: true,
expandOnClickNode: false, expandOnClickNode: false,
highlightCurrent: true highlightCurrent: true
......
...@@ -91,7 +91,7 @@ layui.config({ ...@@ -91,7 +91,7 @@ layui.config({
var el5; var el5;
el5 = eleTree.render({ el5 = eleTree.render({
elem: '.ele5', elem: '.ele5',
url: flowableBasePath + "materialcategory009?userToken=" + getCookie('userToken') + "&loginPCIp=", url: flowableBasePath + "materialcategory009?loginPCIp=",
defaultExpandAll: true, defaultExpandAll: true,
expandOnClickNode: false, expandOnClickNode: false,
highlightCurrent: true highlightCurrent: true
......
...@@ -52,7 +52,7 @@ layui.config({ ...@@ -52,7 +52,7 @@ layui.config({
var materialCategoryType; var materialCategoryType;
fsTree.render({ fsTree.render({
id: "materialCategoryType", id: "materialCategoryType",
url: flowableBasePath + "materialcategory008?userToken=" + getCookie('userToken') + "&loginPCIp=", url: flowableBasePath + "materialcategory008?loginPCIp=",
checkEnable: true, checkEnable: true,
loadEnable: false,//异步加载 loadEnable: false,//异步加载
chkStyle: "radio", chkStyle: "radio",
......
...@@ -96,7 +96,7 @@ layui.config({ ...@@ -96,7 +96,7 @@ layui.config({
fsTree.render({ fsTree.render({
id: "materialCategoryType", id: "materialCategoryType",
url: flowableBasePath + "materialcategory008?userToken=" + getCookie('userToken') + "&loginPCIp=", url: flowableBasePath + "materialcategory008?loginPCIp=",
checkEnable: true, checkEnable: true,
loadEnable: false,//异步加载 loadEnable: false,//异步加载
chkStyle: "radio", chkStyle: "radio",
......
...@@ -74,7 +74,7 @@ layui.config({ ...@@ -74,7 +74,7 @@ layui.config({
var el5; var el5;
el5 = eleTree.render({ el5 = eleTree.render({
elem: '.ele5', elem: '.ele5',
url: flowableBasePath + "materialcategory009?userToken=" + getCookie('userToken') + "&loginPCIp=", url: flowableBasePath + "materialcategory009?loginPCIp=",
defaultExpandAll: true, defaultExpandAll: true,
expandOnClickNode: false, expandOnClickNode: false,
highlightCurrent: true highlightCurrent: true
......
...@@ -24,7 +24,7 @@ layui.config({ ...@@ -24,7 +24,7 @@ layui.config({
//加载树信息 //加载树信息
fsTree.render({ fsTree.render({
id: "materialCategoryType", id: "materialCategoryType",
url: flowableBasePath + "materialcategory008?userToken=" + getCookie('userToken') + "&loginPCIp=", url: flowableBasePath + "materialcategory008?loginPCIp=",
checkEnable: true, checkEnable: true,
loadEnable: false,//异步加载 loadEnable: false,//异步加载
chkStyle: "radio", chkStyle: "radio",
......
...@@ -17,7 +17,7 @@ layui.config({ ...@@ -17,7 +17,7 @@ layui.config({
var materialCategoryType; var materialCategoryType;
fsTree.render({ fsTree.render({
id: "materialCategoryType", id: "materialCategoryType",
url: flowableBasePath + "salesorder011?userToken=" + getCookie('userToken') + "&loginPCIp=", url: flowableBasePath + "salesorder011?loginPCIp=",
checkEnable: false, checkEnable: false,
loadEnable: false,//异步加载 loadEnable: false,//异步加载
showLine: false, showLine: false,
......
...@@ -137,7 +137,7 @@ layui.config({ ...@@ -137,7 +137,7 @@ layui.config({
var el5; var el5;
el5 = eleTree.render({ el5 = eleTree.render({
elem: '.ele5', elem: '.ele5',
url: flowableBasePath + "materialcategory009?userToken=" + getCookie('userToken') + "&loginPCIp=", url: flowableBasePath + "materialcategory009?loginPCIp=",
defaultExpandAll: true, defaultExpandAll: true,
expandOnClickNode: false, expandOnClickNode: false,
highlightCurrent: true highlightCurrent: true
......
...@@ -90,7 +90,7 @@ layui.config({ ...@@ -90,7 +90,7 @@ layui.config({
var ztree = null; var ztree = null;
fsTree.render({ fsTree.render({
id: "treeDemo", id: "treeDemo",
url: flowableBasePath + "dsFormObjectRelation007?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"] + "&firstTypeCode=IFS" + "&language=" + languageType, url: flowableBasePath + "dsFormObjectRelation007?loginPCIp=" + returnCitySN["cip"] + "&firstTypeCode=IFS" + "&language=" + languageType,
clickCallback: onClickTree, clickCallback: onClickTree,
onDblClick: onClickTree onDblClick: onClickTree
}, function(id){ }, function(id){
......
...@@ -63,7 +63,7 @@ layui.config({ ...@@ -63,7 +63,7 @@ layui.config({
var el5; var el5;
el5 = eleTree.render({ el5 = eleTree.render({
elem: '.ele5', elem: '.ele5',
url: "knowledgetype008?userToken=" + getCookie('userToken') + "&loginPCIp=", url: "knowledgetype008?loginPCIp=",
defaultExpandAll: true, defaultExpandAll: true,
expandOnClickNode: false, expandOnClickNode: false,
highlightCurrent: true highlightCurrent: true
......
...@@ -122,7 +122,7 @@ layui.config({ ...@@ -122,7 +122,7 @@ layui.config({
var el5; var el5;
el5 = eleTree.render({ el5 = eleTree.render({
elem: '.ele5', elem: '.ele5',
url: "knowledgetype008?userToken=" + getCookie('userToken') + "&loginPCIp=", url: "knowledgetype008?loginPCIp=",
defaultExpandAll: true, defaultExpandAll: true,
expandOnClickNode: false, expandOnClickNode: false,
highlightCurrent: true highlightCurrent: true
...@@ -267,7 +267,7 @@ layui.config({ ...@@ -267,7 +267,7 @@ layui.config({
var el2; var el2;
el2 = eleTree.render({ el2 = eleTree.render({
elem: '.ele2', elem: '.ele2',
url: "knowledgetype008?userToken=" + getCookie('userToken') + "&loginPCIp=", url: "knowledgetype008?loginPCIp=",
defaultExpandAll: true, defaultExpandAll: true,
expandOnClickNode: false, expandOnClickNode: false,
highlightCurrent: true highlightCurrent: true
......
...@@ -35,7 +35,7 @@ layui.config({ ...@@ -35,7 +35,7 @@ layui.config({
var el5; var el5;
el5 = eleTree.render({ el5 = eleTree.render({
elem: '.ele5', elem: '.ele5',
url: "knowledgetype008?userToken=" + getCookie('userToken') + "&loginPCIp=", url: "knowledgetype008?loginPCIp=",
defaultExpandAll: true, defaultExpandAll: true,
expandOnClickNode: false, expandOnClickNode: false,
highlightCurrent: true highlightCurrent: true
......
...@@ -16,7 +16,7 @@ layui.config({ ...@@ -16,7 +16,7 @@ layui.config({
var el5; var el5;
el5 = eleTree.render({ el5 = eleTree.render({
elem: '.ele5', elem: '.ele5',
url: "knowledgetype008?userToken=" + getCookie('userToken') + "&loginPCIp=", url: "knowledgetype008?loginPCIp=",
defaultExpandAll: true, defaultExpandAll: true,
expandOnClickNode: false, expandOnClickNode: false,
highlightCurrent: true highlightCurrent: true
......
...@@ -71,7 +71,7 @@ layui.config({ ...@@ -71,7 +71,7 @@ layui.config({
var el5; var el5;
el5 = eleTree.render({ el5 = eleTree.render({
elem: '.ele5', elem: '.ele5',
url: "knowledgetype008?userToken=" + getCookie('userToken') + "&loginPCIp=", url: "knowledgetype008?loginPCIp=",
defaultExpandAll: true, defaultExpandAll: true,
expandOnClickNode: false, expandOnClickNode: false,
highlightCurrent: true highlightCurrent: true
......
...@@ -15,7 +15,7 @@ layui.config({ ...@@ -15,7 +15,7 @@ layui.config({
var parentType; var parentType;
fsTree.render({ fsTree.render({
id: "parentType", id: "parentType",
url: reqBasePath + "knowledgetype001?userToken=" + getCookie('userToken') + "&loginPCIp=", url: reqBasePath + "knowledgetype001?loginPCIp=",
checkEnable: true, checkEnable: true,
loadEnable: false,//异步加载 loadEnable: false,//异步加载
chkStyle: "radio", chkStyle: "radio",
......
...@@ -36,7 +36,7 @@ layui.config({ ...@@ -36,7 +36,7 @@ layui.config({
var ztree = null; var ztree = null;
fsTree.render({ fsTree.render({
id: "treeDemo", id: "treeDemo",
url: reqBasePath + "mynote001?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"], url: reqBasePath + "mynote001?loginPCIp=" + returnCitySN["cip"],
checkEnable: false, checkEnable: false,
dragEnable: true, dragEnable: true,
loadEnable: true,//异步加载 loadEnable: true,//异步加载
...@@ -679,7 +679,7 @@ layui.config({ ...@@ -679,7 +679,7 @@ layui.config({
isNewNote = true; isNewNote = true;
showNewNoteList();//展示最新的笔记 showNewNoteList();//展示最新的笔记
}else{ }else{
AjaxPostUtil.request({url:reqBasePath + "mynote006", params: {parentId: folderId, search: searchTitle}, type: 'json', callback: function(json){ AjaxPostUtil.request({url: reqBasePath + "mynote006", params: {parentId: folderId, search: searchTitle}, type: 'json', callback: function(json){
if(json.returnCode == 0){ if(json.returnCode == 0){
$("#folderChildList").html(getDataUseHandlebars(folderchildlisetTemplate, json)); $("#folderChildList").html(getDataUseHandlebars(folderchildlisetTemplate, json));
initRightMenu(); initRightMenu();
......
...@@ -20,7 +20,7 @@ layui.config({ ...@@ -20,7 +20,7 @@ layui.config({
var ztree = null; var ztree = null;
fsTree.render({ fsTree.render({
id: "treeDemo", id: "treeDemo",
url: reqBasePath + "mynote012?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"]+ "&moveId=" + clickId, url: reqBasePath + "mynote012?loginPCIp=" + returnCitySN["cip"]+ "&moveId=" + clickId,
checkEnable: true, checkEnable: true,
chkStyle: "radio", chkStyle: "radio",
loadEnable: true,//异步加载 loadEnable: true,//异步加载
......
...@@ -40,7 +40,7 @@ layui.config({ ...@@ -40,7 +40,7 @@ layui.config({
function initTree(){ function initTree(){
fsTree.render({ fsTree.render({
id: "treeDemo", id: "treeDemo",
url: reqBasePath + 'planprojectflow001?projectId=' + parent.rowId + "&userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"], url: reqBasePath + 'planprojectflow001?projectId=' + parent.rowId + "&loginPCIp=" + returnCitySN["cip"],
loadEnable: false, loadEnable: false,
clickCallback: onClickTree, clickCallback: onClickTree,
onDblClick: onClickTree, onDblClick: onClickTree,
......
...@@ -157,7 +157,7 @@ layui.config({ ...@@ -157,7 +157,7 @@ layui.config({
var tree = fsTree.render({ var tree = fsTree.render({
id: treeId, id: treeId,
funcNo: funcNo, funcNo: funcNo,
url: reqBasePath + url + "?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"], url: reqBasePath + url + "?loginPCIp=" + returnCitySN["cip"],
clickCallback: onClickTree, clickCallback: onClickTree,
onDblClick: onClickTree, onDblClick: onClickTree,
getTree: getTree getTree: getTree
......
...@@ -60,7 +60,7 @@ layui.config({ ...@@ -60,7 +60,7 @@ layui.config({
var tree = fsTree.render({ var tree = fsTree.render({
id: treeId, id: treeId,
funcNo: funcNo, funcNo: funcNo,
url: reqBasePath + url + "?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"], url: reqBasePath + url + "?loginPCIp=" + returnCitySN["cip"],
getTree: getTree, getTree: getTree,
checkEnable: true, checkEnable: true,
loadEnable: false, loadEnable: false,
......
...@@ -80,7 +80,7 @@ layui.config({ ...@@ -80,7 +80,7 @@ layui.config({
var tree = fsTree.render({ var tree = fsTree.render({
id: treeId, id: treeId,
funcNo: funcNo, funcNo: funcNo,
url: reqBasePath + url + "?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"], url: reqBasePath + url + "?loginPCIp=" + returnCitySN["cip"],
getTree: getTree, getTree: getTree,
checkEnable: true, checkEnable: true,
loadEnable: false, loadEnable: false,
......
...@@ -92,9 +92,8 @@ public class SessionFilter implements Filter { ...@@ -92,9 +92,8 @@ public class SessionFilter implements Filter {
servletResponse.setHeader("Access-Control-Allow-Origin", "*"); servletResponse.setHeader("Access-Control-Allow-Origin", "*");
servletResponse.setHeader("Access-Control-Allow-Credentials", "true"); servletResponse.setHeader("Access-Control-Allow-Credentials", "true");
servletResponse.setHeader("Access-Control-Allow-Methods", "*"); servletResponse.setHeader("Access-Control-Allow-Methods", "*");
// userToken为用户的token
// requestType为请求类型,2为手机端请求,1或者空为PC端请求 // requestType为请求类型,2为手机端请求,1或者空为PC端请求
servletResponse.setHeader("Access-Control-Allow-Headers", "Content-Type,userToken,requestType");//这里“userToken”是我要传到后台的内容key servletResponse.setHeader("Access-Control-Allow-Headers", "Content-Type,userToken,requestType");
servletResponse.setHeader("Access-Control-Expose-Headers", "*"); servletResponse.setHeader("Access-Control-Expose-Headers", "*");
} }
......
...@@ -173,13 +173,12 @@ function isNull(str){ ...@@ -173,13 +173,12 @@ function isNull(str){
function ajaxPost(url, params, callback) { function ajaxPost(url, params, callback) {
var result = null; var result = null;
var headers = {}; var headers = getRequestHeaders();
headers['CSRFToken'] = jQuery("#csrftoken").val(); headers['CSRFToken'] = jQuery("#csrftoken").val();
if (params && typeof params == "object") { if (params && typeof params == "object") {
params = deleteEmptyProp(params); params = deleteEmptyProp(params);
} }
params.userToken = getCookie('userToken');
params.loginPCIp = ""; params.loginPCIp = "";
jQuery.ajax({ jQuery.ajax({
......
...@@ -64,6 +64,12 @@ function initBaseParams(){ ...@@ -64,6 +64,12 @@ function initBaseParams(){
homePagePath = sysMainMation.homePagePath; homePagePath = sysMainMation.homePagePath;
} }
function getRequestHeaders() {
return {
userToken: getCookie('userToken')
};
}
// 编辑加载自定义的js文件 // 编辑加载自定义的js文件
layui.each(customerJS, function(key, jsPath){ layui.each(customerJS, function(key, jsPath){
if(jsPath.lastIndexOf(".js") >=0){ if(jsPath.lastIndexOf(".js") >=0){
......
...@@ -401,12 +401,12 @@ dataGrid.prototype = { ...@@ -401,12 +401,12 @@ dataGrid.prototype = {
var result; var result;
if(!isNull(url)){ if(!isNull(url)){
//用ajax的同步方式 //用ajax的同步方式
parms.userToken = getCookie('userToken');
parms.loginPCIp = returnCitySN["cip"]; parms.loginPCIp = returnCitySN["cip"];
layui.$.ajax({ layui.$.ajax({
url: url, url: url,
async: false, // 改为同步方式 async: false, // 改为同步方式
dataType: "json", dataType: "json",
headers: getRequestHeaders(),
type: method, type: method,
data: parms, data: parms,
beforeSend: function () { beforeSend: function () {
......
...@@ -287,6 +287,7 @@ layui.define(["layer", "laytpl", "upload"], function(i) { ...@@ -287,6 +287,7 @@ layui.define(["layer", "laytpl", "upload"], function(i) {
url: i.url, url: i.url,
type: i.type || "get", type: i.type || "get",
data: i.data, data: i.data,
headers: getRequestHeaders(),
dataType: i.dataType || "json", dataType: i.dataType || "json",
cache: !1, cache: !1,
success: function(json) { success: function(json) {
...@@ -1153,6 +1154,7 @@ layui.define(["layer", "laytpl", "upload"], function(i) { ...@@ -1153,6 +1154,7 @@ layui.define(["layer", "laytpl", "upload"], function(i) {
url : l.url || "", url : l.url || "",
type : 'POST', type : 'POST',
async : false, async : false,
headers: getRequestHeaders(),
data : formData, data : formData,
// 告诉jQuery不要去处理发送的数据 // 告诉jQuery不要去处理发送的数据
processData : false, processData : false,
......
...@@ -708,7 +708,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){ ...@@ -708,7 +708,6 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
} }
that.loading(); that.loading();
data.userToken = getCookie('userToken');
data.loginPCIp = returnCitySN["cip"]; data.loginPCIp = returnCitySN["cip"];
$.ajax({ $.ajax({
...@@ -717,7 +716,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){ ...@@ -717,7 +716,7 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
,contentType: options.contentType ,contentType: options.contentType
,data: data ,data: data
,dataType: 'json' ,dataType: 'json'
,headers: options.headers || {} ,headers: getRequestHeaders()
,success: function(res){ ,success: function(res){
//移除请求遮罩层 //移除请求遮罩层
$("body").find(".mask-req-str").remove(); $("body").find(".mask-req-str").remove();
......
...@@ -46,6 +46,7 @@ layui.define(['layer', 'form', 'fsButtonCommon'], function(exports) { ...@@ -46,6 +46,7 @@ layui.define(['layer', 'form', 'fsButtonCommon'], function(exports) {
url: url, url: url,
type: method, type: method,
async: async, async: async,
headers: getRequestHeaders(),
data: param, data: param,
dataType: "json", dataType: "json",
success: function(result) { success: function(result) {
......
...@@ -167,6 +167,10 @@ layui.define(['layer', "fsCommon"], function(exports) { ...@@ -167,6 +167,10 @@ layui.define(['layer', "fsCommon"], function(exports) {
url : _this.config.url, url : _this.config.url,
autoParam : ["id=parentId"],// 异步加载时需要自动提交父节点属性的参数 autoParam : ["id=parentId"],// 异步加载时需要自动提交父节点属性的参数
dataType : "json", dataType : "json",
beforeSend: function(XHR){
XHR.setRequestHeader("userToken", getCookie('userToken'));
},
headers: getRequestHeaders(),
dataFilter : function(treeId, treeNode, responseData) { dataFilter : function(treeId, treeNode, responseData) {
if (responseData.rows.length > 0) { if (responseData.rows.length > 0) {
$.fn.zTree.getZTreeObj(treeId).addNodes(treeNode, responseData.rows); $.fn.zTree.getZTreeObj(treeId).addNodes(treeNode, responseData.rows);
......
...@@ -207,11 +207,11 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { ...@@ -207,11 +207,11 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
var obj = this, currOptions = obj.options; var obj = this, currOptions = obj.options;
if (!currOptions.url || !currOptions.method) if (!currOptions.url || !currOptions.method)
return; return;
currOptions.data.userToken = getCookie('userToken');
$.ajax({ $.ajax({
url: currOptions.url, url: currOptions.url,
type: currOptions.method, type: currOptions.method,
data: $.extend({}, currOptions.data), data: $.extend({}, currOptions.data),
headers: getRequestHeaders(),
dataType: 'json', dataType: 'json',
async: false, async: false,
success: function (res) { success: function (res) {
......
...@@ -120,10 +120,10 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) { ...@@ -120,10 +120,10 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) {
if (!currOptions.url || !currOptions.method) if (!currOptions.url || !currOptions.method)
return; return;
currOptions.data.userToken = getCookie('userToken');
$.ajax({ $.ajax({
url: currOptions.url, url: currOptions.url,
type: currOptions.method, type: currOptions.method,
headers: getRequestHeaders(),
data: $.extend({}, currOptions.data), data: $.extend({}, currOptions.data),
dataType: 'json', dataType: 'json',
async: false, async: false,
......
...@@ -799,6 +799,7 @@ ...@@ -799,6 +799,7 @@
$.ajax({ $.ajax({
url: currOptions.url, url: currOptions.url,
type: currOptions.method, type: currOptions.method,
headers: getRequestHeaders(),
success: function (res) { success: function (res) {
res = res.data; res = res.data;
if (typeof res === "string") { if (typeof res === "string") {
......
...@@ -38,7 +38,7 @@ layui.config({ ...@@ -38,7 +38,7 @@ layui.config({
function loadMyEnclosureList(){ function loadMyEnclosureList(){
fsTree.render({ fsTree.render({
id: "treeDemo", id: "treeDemo",
url: reqBasePath + "sysenclosure010?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"], url: reqBasePath + "sysenclosure010?loginPCIp=" + returnCitySN["cip"],
checkEnable: true, checkEnable: true,
loadEnable: false,//异步加载 loadEnable: false,//异步加载
showLine: false, showLine: false,
......
...@@ -98,7 +98,7 @@ layui.config({ ...@@ -98,7 +98,7 @@ layui.config({
} }
//加载树时的参数传递 //加载树时的参数传递
urlParams = "?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"] + "&chooseOrNotMy=" + chooseOrNotMy + "&chooseOrNotEmail=" + chooseOrNotEmail; urlParams = "?loginPCIp=" + returnCitySN["cip"] + "&chooseOrNotMy=" + chooseOrNotMy + "&chooseOrNotEmail=" + chooseOrNotEmail;
//各模块的初始化加载情况 false为没加载,true为加载 //各模块的初始化加载情况 false为没加载,true为加载
var allPeopleFirstLoad = false,//所有人员模块是否初始化加载 var allPeopleFirstLoad = false,//所有人员模块是否初始化加载
......
...@@ -77,7 +77,7 @@ layui.config({ ...@@ -77,7 +77,7 @@ layui.config({
if(json.rows != null){ if(json.rows != null){
localStorage.setItem("authpoints", JSON.stringify(json.rows)); localStorage.setItem("authpoints", JSON.stringify(json.rows));
} }
$.cookie('userToken', json.bean.id, {path: '/' }); $.cookie('userToken', json.bean.userToken, {path: '/' });
if(!isNull(json.bean.id)){ if(!isNull(json.bean.id)){
if(checkURL(url)){ if(checkURL(url)){
location.href = url; location.href = url;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册