Commit 04722f7e authored by guozhipeng's avatar guozhipeng

前端调整

parent 72d8623a
...@@ -287,35 +287,14 @@ sap.ui.define( ...@@ -287,35 +287,14 @@ sap.ui.define(
// initDict(){}, // initDict(){},
getBaseUrl() { getBaseUrl() {
let that = this; let that = this;
if(location.host === 'localhost:8089'){
// that.getSessionStorage().put('baseUrlCache', '');
}
let baseUrlCache = this.getSessionStorage().get('baseUrlCache'); let baseUrlCache = this.getSessionStorage().get('baseUrlCache');
if (this.isEmpty(baseUrlCache)) { if (this.isEmpty(baseUrlCache)) {
jQuery.ajax(sap.ui.require.toUrl("sap/ui/demo/mock/config.json"), { var protocol = window.location.protocol;
dataType: "json", var hostname = window.location.hostname;
async: false, var port = window.location.port ? ':' + window.location.port : ''; // 如果端口号不是默认,则添加':'和端口号
success: function (oData) { baseUrlCache = protocol + '//' + hostname + port + "/";
baseUrlCache = oData.Config.baseUrl console.log("[baseUrlCache]", baseUrlCache);
let currentEnvironment = that.getSessionStorage().get('currentEnvironment')
if(currentEnvironment){
baseUrlCache = oData.Config[currentEnvironment]
}
if (!oData.Config.isServerConfig) {
let str = ""
if (oData.Config.port.trim()) {
str = ":" + oData.Config.port + "/"
}
baseUrlCache = window.location.protocol + '//' + window.location.hostname + (str ? str : '/')
}
that.getSessionStorage().put('baseUrlCache', baseUrlCache); that.getSessionStorage().put('baseUrlCache', baseUrlCache);
},
error: function () {
}
});
} }
return baseUrlCache; return baseUrlCache;
}, },
......
...@@ -123,19 +123,6 @@ sap.ui.define([ ...@@ -123,19 +123,6 @@ sap.ui.define([
// return !!(sap.ui.Device.os.android || sap.ui.Device.os.ios || sap.ui.Device.os.windows.phone || sap.ui.Device.os.blackberry); // return !!(sap.ui.Device.os.android || sap.ui.Device.os.ios || sap.ui.Device.os.windows.phone || sap.ui.Device.os.blackberry);
return !!(sap.ui.Device.os.android || sap.ui.Device.os.ios || sap.ui.Device.os.blackberry); return !!(sap.ui.Device.os.android || sap.ui.Device.os.ios || sap.ui.Device.os.blackberry);
}, },
//获取cookie
getCookie: function(name) {
let matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
},
//设置cookie
setCookie: function(name, value, expireHours) {
var cookieExp = new Date();
cookieExp.setHours(cookieExp.getHours() + expireHours);
document.cookie = name + "=" + encodeURIComponent(value) + "; path=/; expires=" + cookieExp.toUTCString();
},
// 登录 // 登录
onLogin: function(oEvent) { onLogin: function(oEvent) {
// this.getRouter().navTo("menu", {}, true); // this.getRouter().navTo("menu", {}, true);
...@@ -150,21 +137,17 @@ sap.ui.define([ ...@@ -150,21 +137,17 @@ sap.ui.define([
MessageBox.warning(this.i18n("Msg_input_username_password")); MessageBox.warning(this.i18n("Msg_input_username_password"));
return; return;
} }
console.log("JSESSIONID=", this.getCookie('JSESSIONID')); console.log("onLoginUrl=", that.baseUrl+"login/login");
let busyDialog = new sap.m.BusyDialog(); let busyDialog = new sap.m.BusyDialog();
busyDialog.open(); busyDialog.open();
jQuery.ajax({ jQuery.ajax({
method: "POST", method: "POST",
data: JSON.stringify(param), data: JSON.stringify(param),
// url: "/login",
url: that.baseUrl+"login/login", url: that.baseUrl+"login/login",
// url: "http://localhost:8080/login/login",
contentType: 'application/json', contentType: 'application/json',
authorization: 'Basic c2FiaW5lOnBhc3Nfc2FiaW5l',
dataType: 'json', dataType: 'json',
success: function(data){ success: function(data){
// console.log('data',data)
// 关闭进度条 // 关闭进度条
busyDialog.close(); busyDialog.close();
// if(data.flag){ // if(data.flag){
......
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
"baseUrl_pre": "https://lianchuangjie-pre.unibetter-ic.com/", "baseUrl_pre": "https://lianchuangjie-pre.unibetter-ic.com/",
"baseUrl_pro": "https://sap.unibetter-ic.com/", "baseUrl_pro": "https://sap.unibetter-ic.com/",
"isServerConfig":false, "isServerConfig":false,
"port": "8080" "port": ""
} }
} }
...@@ -310,9 +310,7 @@ sap.ui.define( ...@@ -310,9 +310,7 @@ sap.ui.define(
str = ":" + oData.Config.port + "/" str = ":" + oData.Config.port + "/"
} }
baseUrlCache = window.location.protocol + '//' + window.location.hostname + (str ? str : '/') baseUrlCache = window.location.protocol + '//' + window.location.hostname + (str ? str : '/')
console.log("getBaseUrl-isServerConfig-baseUrlCache ", baseUrlCache);
} }
console.log("getBaseUrl-baseUrlCache ", baseUrlCache);
that.getSessionStorage().put('baseUrlCache', baseUrlCache); that.getSessionStorage().put('baseUrlCache', baseUrlCache);
}, },
error: function () { error: function () {
......
...@@ -123,6 +123,19 @@ sap.ui.define([ ...@@ -123,6 +123,19 @@ sap.ui.define([
// return !!(sap.ui.Device.os.android || sap.ui.Device.os.ios || sap.ui.Device.os.windows.phone || sap.ui.Device.os.blackberry); // return !!(sap.ui.Device.os.android || sap.ui.Device.os.ios || sap.ui.Device.os.windows.phone || sap.ui.Device.os.blackberry);
return !!(sap.ui.Device.os.android || sap.ui.Device.os.ios || sap.ui.Device.os.blackberry); return !!(sap.ui.Device.os.android || sap.ui.Device.os.ios || sap.ui.Device.os.blackberry);
}, },
//获取cookie
getCookie: function(name) {
let matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
},
//设置cookie
setCookie: function(name, value, expireHours) {
var cookieExp = new Date();
cookieExp.setHours(cookieExp.getHours() + expireHours);
document.cookie = name + "=" + encodeURIComponent(value) + "; path=/; expires=" + cookieExp.toUTCString();
},
// 登录 // 登录
onLogin: function(oEvent) { onLogin: function(oEvent) {
// this.getRouter().navTo("menu", {}, true); // this.getRouter().navTo("menu", {}, true);
...@@ -137,6 +150,7 @@ sap.ui.define([ ...@@ -137,6 +150,7 @@ sap.ui.define([
MessageBox.warning(this.i18n("Msg_input_username_password")); MessageBox.warning(this.i18n("Msg_input_username_password"));
return; return;
} }
console.log("JSESSIONID=", this.getCookie('JSESSIONID'));
let busyDialog = new sap.m.BusyDialog(); let busyDialog = new sap.m.BusyDialog();
busyDialog.open(); busyDialog.open();
...@@ -147,6 +161,7 @@ sap.ui.define([ ...@@ -147,6 +161,7 @@ sap.ui.define([
url: that.baseUrl+"login/login", url: that.baseUrl+"login/login",
// url: "http://localhost:8080/login/login", // url: "http://localhost:8080/login/login",
contentType: 'application/json', contentType: 'application/json',
authorization: 'Basic c2FiaW5lOnBhc3Nfc2FiaW5l',
dataType: 'json', dataType: 'json',
success: function(data){ success: function(data){
// console.log('data',data) // console.log('data',data)
......
{ {
"Config": { "Config": {
"baseUrl": "https://lianchuangjie-test.unibetter-ic.com/", "baseUrl": "http://127.0.0.1:8080/",
"baseUrl_tes": "https://lianchuangjie-tes.unibetter-ic.com/", "baseUrl_tes": "https://lianchuangjie-tes.unibetter-ic.com/",
"baseUrl_pre": "https://lianchuangjie-pre.unibetter-ic.com/", "baseUrl_pre": "https://lianchuangjie-pre.unibetter-ic.com/",
"baseUrl_pro": "https://sap.unibetter-ic.com/", "baseUrl_pro": "https://sap.unibetter-ic.com/",
"isServerConfig":true, "isServerConfig":false,
"port": "9999" "port": "8080"
} }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment