路由修改

This commit is contained in:
tanghc
2019-03-19 12:50:35 +08:00
parent 2231fdece1
commit 48b0ed87a1
19 changed files with 339 additions and 149 deletions

View File

@@ -0,0 +1,30 @@
;(function () {
var currentProfile = ApiUtil.getParam('profile') || 'default';
ApiUtil.post('system.profile.list', {}, function (resp) {
var profileList = resp.data;
var html = ['<div class="layui-tab layui-tab-brief" style="margin-top: 0px;">'];
html.push('<ul id="profileList" class="layui-tab-title">')
for (var i = 0; i < profileList.length; i++) {
var profile = profileList[i];
var cls = currentProfile == profile ? 'layui-this' : '';
html.push('<li><a class="' + cls + '" href="' + getCurrentPage(profile) + '">' + profile + '</a></li>');
}
html.push('</ul>')
html.push('</div>')
$('.x-body').prepend(html.join(''));
});
function getCurrentPage(profile) {
var currentUrl = location.href.toString();
var indexStart = currentUrl.lastIndexOf('/') + 1;
var indexEnd = currentUrl.lastIndexOf('?');
var page = indexEnd > -1
? currentUrl.substring(indexStart, indexEnd)
: currentUrl.substring(indexStart);
return page + '?q=' + new Date().getTime() + '&profile=' + profile;
}
window.profile = currentProfile;
})();