Commit 04722f7e authored by guozhipeng's avatar guozhipeng

前端调整

parent 72d8623a
......@@ -287,35 +287,14 @@ sap.ui.define(
// initDict(){},
getBaseUrl() {
let that = this;
if(location.host === 'localhost:8089'){
// that.getSessionStorage().put('baseUrlCache', '');
}
let baseUrlCache = this.getSessionStorage().get('baseUrlCache');
if (this.isEmpty(baseUrlCache)) {
jQuery.ajax(sap.ui.require.toUrl("sap/ui/demo/mock/config.json"), {
dataType: "json",
async: false,
success: function (oData) {
baseUrlCache = oData.Config.baseUrl
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 : '/')
}
var protocol = window.location.protocol;
var hostname = window.location.hostname;
var port = window.location.port ? ':' + window.location.port : ''; // 如果端口号不是默认,则添加':'和端口号
baseUrlCache = protocol + '//' + hostname + port + "/";
console.log("[baseUrlCache]", baseUrlCache);
that.getSessionStorage().put('baseUrlCache', baseUrlCache);
},
error: function () {
}
});
}
return baseUrlCache;
},
......
......@@ -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.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) {
// this.getRouter().navTo("menu", {}, true);
......@@ -150,21 +137,17 @@ sap.ui.define([
MessageBox.warning(this.i18n("Msg_input_username_password"));
return;
}
console.log("JSESSIONID=", this.getCookie('JSESSIONID'));
console.log("onLoginUrl=", that.baseUrl+"login/login");
let busyDialog = new sap.m.BusyDialog();
busyDialog.open();
jQuery.ajax({
method: "POST",
data: JSON.stringify(param),
// url: "/login",
url: that.baseUrl+"login/login",
// url: "http://localhost:8080/login/login",
contentType: 'application/json',
authorization: 'Basic c2FiaW5lOnBhc3Nfc2FiaW5l',
dataType: 'json',
success: function(data){
// console.log('data',data)
// 关闭进度条
busyDialog.close();
// if(data.flag){
......
......@@ -5,6 +5,6 @@
"baseUrl_pre": "https://lianchuangjie-pre.unibetter-ic.com/",
"baseUrl_pro": "https://sap.unibetter-ic.com/",
"isServerConfig":false,
"port": "8080"
"port": ""
}
}
......@@ -310,9 +310,7 @@ sap.ui.define(
str = ":" + oData.Config.port + "/"
}
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);
},
error: function () {
......
......@@ -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.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) {
// this.getRouter().navTo("menu", {}, true);
......@@ -137,6 +150,7 @@ sap.ui.define([
MessageBox.warning(this.i18n("Msg_input_username_password"));
return;
}
console.log("JSESSIONID=", this.getCookie('JSESSIONID'));
let busyDialog = new sap.m.BusyDialog();
busyDialog.open();
......@@ -147,6 +161,7 @@ sap.ui.define([
url: that.baseUrl+"login/login",
// url: "http://localhost:8080/login/login",
contentType: 'application/json',
authorization: 'Basic c2FiaW5lOnBhc3Nfc2FiaW5l',
dataType: 'json',
success: function(data){
// console.log('data',data)
......
{
"Config": {
"baseUrl": "https://lianchuangjie-test.unibetter-ic.com/",
"baseUrl": "http://127.0.0.1:8080/",
"baseUrl_tes": "https://lianchuangjie-tes.unibetter-ic.com/",
"baseUrl_pre": "https://lianchuangjie-pre.unibetter-ic.com/",
"baseUrl_pro": "https://sap.unibetter-ic.com/",
"isServerConfig":true,
"port": "9999"
"isServerConfig":false,
"port": "8080"
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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