Showing
2 changed files
with
22 additions
and
7 deletions
@@ -101,6 +101,13 @@ layui.extend({ | @@ -101,6 +101,13 @@ layui.extend({ | ||
101 | } | 101 | } |
102 | //请求视图渲染 | 102 | //请求视图渲染 |
103 | view().render(path.join('/')).then(function (res) { | 103 | view().render(path.join('/')).then(function (res) { |
104 | + let pageId = pathURL; | ||
105 | + | ||
106 | + // 如果地址是通用页面,business/index/redirectUrl | ||
107 | + if(router.href.indexOf('business/index/redirectUrl') != -1){ | ||
108 | + pageId = router.href; | ||
109 | + } | ||
110 | + | ||
104 | //遍历页签选项卡 | 111 | //遍历页签选项卡 |
105 | var matchTo | 112 | var matchTo |
106 | , tabs = $('#LAY_app_tabsheader>li'); | 113 | , tabs = $('#LAY_app_tabsheader>li'); |
@@ -108,7 +115,7 @@ layui.extend({ | @@ -108,7 +115,7 @@ layui.extend({ | ||
108 | tabs.each(function (index) { | 115 | tabs.each(function (index) { |
109 | var li = $(this) | 116 | var li = $(this) |
110 | , layid = li.attr('lay-id'); | 117 | , layid = li.attr('lay-id'); |
111 | - if (layid === pathURL) { | 118 | + if (layid === pageId) { |
112 | matchTo = true; | 119 | matchTo = true; |
113 | tabsPage.index = index; | 120 | tabsPage.index = index; |
114 | } | 121 | } |
@@ -130,10 +137,14 @@ layui.extend({ | @@ -130,10 +137,14 @@ layui.extend({ | ||
130 | } catch (e) { | 137 | } catch (e) { |
131 | } | 138 | } |
132 | if (!tabName) { | 139 | if (!tabName) { |
140 | + // 获取路由页面名称 | ||
141 | + let name = router.search.name; | ||
133 | //lsq 页面刷新后名称改变 2022-03-30 | 142 | //lsq 页面刷新后名称改变 2022-03-30 |
134 | if (routerPath.indexOf('ajConfig') != -1 && routerPath.indexOf('view') != -1) { | 143 | if (routerPath.indexOf('ajConfig') != -1 && routerPath.indexOf('view') != -1) { |
135 | tabName = localStorage.getItem(router.search.ajConfig); | 144 | tabName = localStorage.getItem(router.search.ajConfig); |
136 | - } else { | 145 | + } else if(name){ |
146 | + tabName = name; | ||
147 | + }else { | ||
137 | tabName = res.title | 148 | tabName = res.title |
138 | 149 | ||
139 | } | 150 | } |
@@ -144,9 +155,10 @@ layui.extend({ | @@ -144,9 +155,10 @@ layui.extend({ | ||
144 | if (!matchTo) { | 155 | if (!matchTo) { |
145 | $(APP_BODY).append('<div class="layadmin-tabsbody-item layui-show"></div>'); | 156 | $(APP_BODY).append('<div class="layadmin-tabsbody-item layui-show"></div>'); |
146 | tabsPage.index = tabs.length; | 157 | tabsPage.index = tabs.length; |
158 | + | ||
147 | element.tabAdd(FILTER_TAB_TBAS, { | 159 | element.tabAdd(FILTER_TAB_TBAS, { |
148 | title: '<span>' + (tabName || '新标签页') + '</span>' | 160 | title: '<span>' + (tabName || '新标签页') + '</span>' |
149 | - , id: pathURL | 161 | + , id: pageId |
150 | , attr: router.href | 162 | , attr: router.href |
151 | }); | 163 | }); |
152 | } | 164 | } |
@@ -156,9 +168,9 @@ layui.extend({ | @@ -156,9 +168,9 @@ layui.extend({ | ||
156 | setter.pageTabs || this.container.scrollTop(0); //如果不开启标签页,则跳转时重置滚动条 | 168 | setter.pageTabs || this.container.scrollTop(0); //如果不开启标签页,则跳转时重置滚动条 |
157 | 169 | ||
158 | //定位当前tabs | 170 | //定位当前tabs |
159 | - element.tabChange(FILTER_TAB_TBAS, pathURL); | 171 | + element.tabChange(FILTER_TAB_TBAS, pageId); |
160 | // 修改为当前菜单名称 | 172 | // 修改为当前菜单名称 |
161 | - $('* [lay-id="' + pathURL + '"] span').text(tabName) | 173 | + $('* [lay-id="' + pageId + '"] span').text(tabName) |
162 | admin.tabsBodyChange(tabsPage.index); | 174 | admin.tabsBodyChange(tabsPage.index); |
163 | 175 | ||
164 | }).done(function () { | 176 | }).done(function () { |
1 | -<title id="indexTitle"></title> | 1 | +<title id="indexTitle"> </title> |
2 | 2 | ||
3 | <script template type="text/html"> | 3 | <script template type="text/html"> |
4 | {{# | 4 | {{# |
@@ -8,7 +8,10 @@ | @@ -8,7 +8,10 @@ | ||
8 | var pageVersion = router.search.pageVersion; | 8 | var pageVersion = router.search.pageVersion; |
9 | 9 | ||
10 | if (label){ | 10 | if (label){ |
11 | - $('#indexTitle span').val(label); | 11 | + setTimeout(()=>{ |
12 | + $('.layui-this span').text(decodeURIComponent(label)); | ||
13 | + $('#indexTitle').text(label); | ||
14 | + },200); | ||
12 | } | 15 | } |
13 | if(redirectUrl){ | 16 | if(redirectUrl){ |
14 | redirectUrl = redirectUrl.replace("$$","#/").replace(/[$]/g,'/'); | 17 | redirectUrl = redirectUrl.replace("$$","#/").replace(/[$]/g,'/'); |
-
Please register or login to post a comment