feat: 开始全页面提交

This commit is contained in:
augushong
2025-08-15 23:16:13 +08:00
parent 7b5a84bcc3
commit 578fa91d36
4 changed files with 151 additions and 64 deletions

View File

@@ -69,14 +69,9 @@
* @param isParent
*/
delete: function (tabId, isParent) {
// todo 未知BUG不知道是不是layui问题必须先删除元素
$('.layuimini-tab .layui-tab-title .layui-unselect.layui-tab-bar').remove();
if (isParent === true) {
parent.layui.element.tabDelete('layuiminiTab', tabId);
} else {
element.tabDelete('layuiminiTab', tabId);
}
ua.findIndexPage(function (window) {
window.layui.element.tabDelete('layuiminiTab', tabId);
});
},
/**
@@ -117,21 +112,33 @@
check: function (tabId, isIframe) {
// 判断选项卡上是否有
var checkTab = false;
if (isIframe === undefined || isIframe === false) {
$('.layui-tab-title li').each(function () {
// if (isIframe === undefined || isIframe === false) {
// $('.layui-tab-title li').each(function () {
// var checkTabId = $(this).attr('lay-id');
// if (checkTabId != null && checkTabId === tabId) {
// checkTab = true;
// }
// });
// } else {
// parent.layui.$('.layui-tab-title li').each(function () {
// var checkTabId = $(this).attr('lay-id');
// if (checkTabId != null && checkTabId === tabId) {
// checkTab = true;
// }
// });
// }
ua.findIndexPage(function (window) {
window.layui.$('.layui-tab-title li').each(function () {
var checkTabId = $(this).attr('lay-id');
if (checkTabId != null && checkTabId === tabId) {
checkTab = true;
}
});
} else {
parent.layui.$('.layui-tab-title li').each(function () {
var checkTabId = $(this).attr('lay-id');
if (checkTabId != null && checkTabId === tabId) {
checkTab = true;
}
});
}
});
return checkTab;
},
@@ -245,14 +252,29 @@
var tabId = $(this).attr('layuimini-content-href'),
href = $(this).attr('layuimini-content-href'),
title = $(this).attr('data-title'),
back = $(this).attr('data-back') || 0,
external = $(this).attr('data-external') || false,
target = $(this).attr('target');
if(back == 0){
if (href.indexOf("?") === -1) {
href += '?backTagId=' + ua.getCurrentPageId();
} else {
href += '&backTagId=' + ua.getCurrentPageId();
}
}
href = external ? href : ua.url(href);
tabId = href;
if (target === '_blank') {
parent.layer.close(loading);
window.open(href, '_blank');
return false;
}
if (tabId === null || tabId === undefined) tabId = new Date().getTime();
var checkTab = miniTab.check(tabId, true);
if (!checkTab) {
miniTab.create({
tabId: tabId,
@@ -264,6 +286,11 @@
}
parent.layui.element.tabChange('layuiminiTab', tabId);
parent.layer.close(loading);
if(back == 1){
console.log(back);
miniTab.delete(ua.getCurrentPageId());
}
});
/**
@@ -404,19 +431,19 @@
if (!options.urlHashLocation) return false;
var tabId = location.hash.replace(/^#/, '');
if (tabId === null || tabId === undefined || tabId === '') return false;
// 判断是否为首页
if (tabId === options.homeInfo.href || tabId === options.homeInfo.mb_href) return false;
// 判断tab是否已存在
if($('.layuimini-tab .layui-tab-content [lay-id="'+tabId+'"]').length > 0) {
if ($('.layuimini-tab .layui-tab-content [lay-id="' + tabId + '"]').length > 0) {
element.tabChange('layuiminiTab', tabId);
return false;
}
// 判断是否为右侧菜单
var menu = miniTab.searchMenu(tabId, options.menuList);
if (menu !== undefined) {
miniTab.create({
tabId: tabId,