diff --git a/developer/edit_app.php b/developer/edit_app.php index 24bdd1a..fc2a662 100644 --- a/developer/edit_app.php +++ b/developer/edit_app.php @@ -285,13 +285,65 @@ if (!($conn instanceof mysqli)) {
- +
- > + > + +
+
+
+ > + +
+
+ > + +
+
+
+ > + +
+
+ > + +
+
+
+ > + +
+
+ > + +
+
+ > + +
+
+
+ >
- > + >
@@ -361,6 +413,65 @@ function removeImage(imageId) { // 从DOM中移除图片元素 event.target.closest('.position-relative').remove(); } + + // 平台子选项显示控制 + document.getElementById('windows').addEventListener('change', function() { + const suboptions = document.getElementById('windows_suboptions'); + suboptions.style.display = this.checked ? 'block' : 'none'; + if (!this.checked) { + document.querySelectorAll('input["windows_version"]').forEach(radio => radio.checked = false); + } + }); + + document.getElementById('linux').addEventListener('change', function() { + const suboptions = document.getElementById('linux_suboptions'); + suboptions.style.display = this.checked ? 'block' : 'none'; + if (!this.checked) { + document.querySelectorAll('input[name="linux_distribution"]').forEach(radio => radio.checked = false); + } + }); + + // 表单提交验证 + document.querySelector('form').addEventListener('submit', function(e) { + // 验证Windows子选项 + if (document.getElementById('windows').checked && !document.querySelector('input[name="windows_version"]:checked')) { + e.preventDefault(); + Swal.fire({ + title: '提示', + text: '请选择Windows版本(XP以前或Win7以后)', + icon: 'warning', + confirmButtonText: '确定' + }); + return; + } + + // 验证Linux子选项 + if (document.getElementById('linux').checked && !document.querySelector('input[name="linux_distribution"]:checked')) { + e.preventDefault(); + Swal.fire({ + title: '提示', + text: '请选择Linux发行版(Ubuntu、Arch Linux或CentOS)', + icon: 'warning', + confirmButtonText: '确定' + }); + return; + } + + // 更新平台值包含子选项信息 + const platforms = []; + if (document.getElementById('android').checked) platforms.push('Android'); + if (document.getElementById('ios').checked) platforms.push('iOS'); + if (document.getElementById('macos').checked) platforms.push('macos'); + if (document.getElementById('windows').checked) { + platforms.push(document.querySelector('input[name="windows_version"]:checked').value); + } + if (document.getElementById('linux').checked) { + platforms.push(document.querySelector('input[name="linux_distribution"]:checked').value); + } + + // 设置隐藏字段值 + document.getElementById('platforms_hidden').value = JSON.stringify(platforms); + }); \ No newline at end of file