Browse Source

修复iOS端创建表单页面可拖动问题

Boss
Default User 4 weeks ago
parent
commit
7d6c98d9c6
  1. 26
      supply.html

26
supply.html

@ -5783,6 +5783,9 @@
// 隐藏body滚动条,避免双滚动条 // 隐藏body滚动条,避免双滚动条
document.body.style.overflow = 'hidden'; document.body.style.overflow = 'hidden';
// 防止iOS上的页面拖动
preventiOSScrolling();
// 重新加载联系人数据,确保最新 // 重新加载联系人数据,确保最新
loadContacts(); loadContacts();
@ -5922,6 +5925,22 @@
setupAutoSave(); setupAutoSave();
} }
// 防止iOS页面拖动的函数
function preventiOSScrolling() {
// 阻止触摸事件的默认行为,防止页面滚动
document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, { passive: false });
}
// 恢复iOS页面滚动的函数
function restoreiOSScrolling() {
// 移除触摸事件监听器,恢复页面滚动
document.removeEventListener('touchmove', function(e) {
e.preventDefault();
}, { passive: false });
}
// 隐藏创建货源模态框 // 隐藏创建货源模态框
function hideAddSupplyModal() { function hideAddSupplyModal() {
// 保存当前表单状态 // 保存当前表单状态
@ -5930,6 +5949,9 @@
// 恢复body滚动条 // 恢复body滚动条
document.body.style.overflow = 'auto'; document.body.style.overflow = 'auto';
// 恢复iOS页面滚动
restoreiOSScrolling();
// 不再禁用添加按钮,而是在点击时检查数量并弹出提示 // 不再禁用添加按钮,而是在点击时检查数量并弹出提示
// 确保添加按钮始终可用,以便用户可以点击并看到提示信息 // 确保添加按钮始终可用,以便用户可以点击并看到提示信息
} }
@ -8923,6 +8945,10 @@
// 对于普通modal,使用display: none隐藏 // 对于普通modal,使用display: none隐藏
if (modal.classList.contains('modal')) { if (modal.classList.contains('modal')) {
modal.style.display = 'none'; modal.style.display = 'none';
// 恢复iOS页面滚动
restoreiOSScrolling();
// 恢复body滚动条
document.body.style.overflow = 'auto';
} }
// 对于select-modal,使用移除active类来隐藏 // 对于select-modal,使用移除active类来隐藏
else if (modal.classList.contains('select-modal')) { else if (modal.classList.contains('select-modal')) {

Loading…
Cancel
Save