From 20870a9fec921d9394b22ae982385a6d450694f1 Mon Sep 17 00:00:00 2001 From: jingrow Date: Fri, 1 Aug 2025 12:59:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9F=9F=E5=90=8D=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dashboard/src2/pages/NewJsiteDomain.vue | 109 ++++++++++++++++-------- 1 file changed, 72 insertions(+), 37 deletions(-) diff --git a/dashboard/src2/pages/NewJsiteDomain.vue b/dashboard/src2/pages/NewJsiteDomain.vue index f6d05c0..26c69d6 100644 --- a/dashboard/src2/pages/NewJsiteDomain.vue +++ b/dashboard/src2/pages/NewJsiteDomain.vue @@ -34,10 +34,22 @@ class="flex-1 border rounded px-3 py-2" @keyup.enter="checkDomain" /> +
+ + +
@@ -45,29 +57,29 @@ -
+

选择域名后缀

- -
-
- - - - -
- -
+ +
+
+ + + + +
+ +
@@ -85,26 +97,26 @@
- -
- -
+ +
@@ -359,9 +371,9 @@ export default { // 域名后缀相关 suffixSearch: '', suffixSort: 'default', - selectedCategory: 'all', + selectedCategory: 'popular', + showSuffixSelector: false, suffixCategories: [ - { key: 'all', label: '全部域名' }, { key: 'popular', label: '热门域名' }, { key: 'gtd', label: '通用顶级域名' }, { key: 'ntd', label: '新顶级域名' }, @@ -371,7 +383,8 @@ export default { { key: 'business', label: '商业域名' }, { key: 'tech', label: '科技域名' }, { key: 'creative', label: '创意域名' }, - { key: 'lifestyle', label: '生活域名' } + { key: 'lifestyle', label: '生活域名' }, + { key: 'all', label: '全部域名' } ], allSuffixes: [ // 通用顶级域名 (gtd) @@ -886,8 +899,13 @@ export default { }; }, }, + mounted() { + // 添加点击外部关闭域名后缀选择区块的功能 + document.addEventListener('click', this.handleClickOutside); + }, beforeUnmount() { this.stopPaymentCheck(); + document.removeEventListener('click', this.handleClickOutside); }, methods: { async checkDomain() { @@ -981,7 +999,22 @@ export default { getTotalAmount() { const yearlyPrice = this.domainPrice || 0; return (yearlyPrice * this.period).toFixed(2); - } + }, + selectSuffix(suffix) { + this.selectedSuffix = suffix; + this.showSuffixSelector = false; + }, + handleClickOutside(event) { + const suffixButton = event.target.closest('button'); + const suffixSelector = event.target.closest('.border.rounded-lg.p-4.bg-gray-50'); + + if (!suffixButton || !suffixButton.classList.contains('suffix-selector-btn')) { + if (!suffixSelector) { + this.showSuffixSelector = false; + } + } + }, + }, }; @@ -1125,6 +1158,8 @@ export default { } } + + /* 响应式设计 */ @media (max-width: 640px) { .domain-suffix-grid {