修改页面,完成单页模式新增首页返回上一页按钮
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
(function (root, factory) {
|
||||
// 根配置只负责运行环境与接口基础地址。
|
||||
// 根配置负责运行环境、接口基础地址与全站跳转入口。
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
return;
|
||||
@@ -12,6 +12,31 @@
|
||||
var CLIENT_ID = 'ced7e5f0498645c6ec642dcf450b036f';
|
||||
var TENANT_ID = '000000';
|
||||
var TOKEN_KEY = 'genealogy_auth_token';
|
||||
var BLOCKED_NAVIGATION_PROTOCOL = /^(?:javascript|data|vbscript):/i;
|
||||
|
||||
function createNavigationUtil() {
|
||||
return {
|
||||
open: function (url) {
|
||||
var targetUrl = String(url || '').trim();
|
||||
|
||||
if (!targetUrl || BLOCKED_NAVIGATION_PROTOCOL.test(targetUrl) || typeof root.open !== 'function') {
|
||||
return null;
|
||||
}
|
||||
|
||||
var openedWindow = root.open(targetUrl, '_blank', 'noopener');
|
||||
if (openedWindow) openedWindow.opener = null;
|
||||
return openedWindow;
|
||||
},
|
||||
replace: function (url) {
|
||||
var targetUrl = String(url || '').trim();
|
||||
|
||||
if (!targetUrl || BLOCKED_NAVIGATION_PROTOCOL.test(targetUrl)) return;
|
||||
if (root.location && typeof root.location.replace === 'function') {
|
||||
root.location.replace(targetUrl);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 这里只维护运行环境和后端基础地址,具体接口路径统一放在 ApiClient 中。
|
||||
var ENVIRONMENTS = {
|
||||
@@ -48,6 +73,8 @@
|
||||
};
|
||||
}
|
||||
|
||||
root.NavigationUtil = root.NavigationUtil || createNavigationUtil();
|
||||
|
||||
return {
|
||||
getEnvironment: getEnvironment,
|
||||
getApiBaseUrl: getApiBaseUrl,
|
||||
|
||||
Reference in New Issue
Block a user