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

树添加userToken

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