mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
路由修改
This commit is contained in:
30
sop-admin/sop-admin-front/assets/js/profile.js
Normal file
30
sop-admin/sop-admin-front/assets/js/profile.js
Normal 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;
|
||||
})();
|
Reference in New Issue
Block a user