Browse Source

feat: 修改

ljc 2 weeks ago
parent
commit
c42d61ce1e
4 changed files with 47 additions and 20 deletions
  1. 10 1
      components/cwg-dropdown.vue
  2. 10 13
      components/cwg-tabel.vue
  3. 4 4
      config/index.ts
  4. 23 2
      pages/customer/components/AccountList.vue

+ 10 - 1
components/cwg-dropdown.vue

@@ -145,9 +145,11 @@ const menuClick = (value, index) => {
     close()
 }
 const close = () => {
+  console.log('关闭弹窗2')
     maskShow.value = false
     Object.keys(layout).forEach(key => delete layout[key])
     layout.transform = 'scaleY(0)'
+  console.log('弹窗',layout)
     emit('close')
     emit('change', false)
 }
@@ -156,7 +158,14 @@ onMounted(() => {
     innerInterspace.value = str2px(props.interspace)
     
     uni.$on('logout', () => {
-        close()
+      console.log('关闭弹窗1')
+        if (maskShow.value || Object.keys(layout).length > 0) {
+            maskShow.value = false
+            Object.keys(layout).forEach(key => delete layout[key])
+            layout.transform = 'scaleY(0)'
+            emit('close')
+            emit('change', false)
+        }
     })
 })
 

+ 10 - 13
components/cwg-tabel.vue

@@ -351,7 +351,7 @@ const pageSizeIndex = computed(() => {
 const visiblePages = computed(() => {
     const totalPages = pagination.value.pages
     const currentPage = pagination.value.current
-    const maxVisible = 4 // 显示的页码数量(包括第一页和最后一页)
+    const maxVisible = 6
 
     if (totalPages <= maxVisible) {
         return Array.from({ length: totalPages }, (_, i) => i + 1)
@@ -359,16 +359,12 @@ const visiblePages = computed(() => {
 
     let pages = []
 
-    if (currentPage <= 2) {
-        // 当前页靠前:[1, 2, '...', 最后一页]
-        pages = [1, 2, '...', totalPages]
-    } else if (currentPage >= totalPages - 1) {
-        // 当前页靠后:[1, '...', 倒数第二页, 最后一页]
-        pages = [1, '...', totalPages - 1, totalPages]
+    if (currentPage <= 3) {
+        pages = [1, 2, 3, 4, '...', totalPages]
+    } else if (currentPage >= totalPages - 2) {
+        pages = [1, '...', totalPages - 3, totalPages - 2, totalPages - 1, totalPages]
     } else {
-        // 当前页在中间:由于只显示4个,去掉后面的...直接紧凑展示:[1, '...', 当前页, 最后一页]
-        // 或者:[1, 当前页, '...', 最后一页] 以确保当前页能点到
-        pages = [1, '...', currentPage, totalPages]
+        pages = [1, '...', currentPage, currentPage + 1, '...', totalPages]
     }
 
     return pages
@@ -793,6 +789,7 @@ defineExpose({
         &.is-empty,
         &.is-loading {
             :deep(.uni-table-scroll) {
+                min-height: px2rpx(45);
                 flex-shrink: 0;
                 overflow: visible;
             }
@@ -841,7 +838,7 @@ defineExpose({
     :deep(.uni-table-scroll) {
         width: 100%;
         max-height: calc(100vh - 375px);
-        min-height: px2rpx(300);
+        min-height: px2rpx(600);
         overflow-y: auto;
         overflow-x: auto;
 
@@ -949,7 +946,7 @@ defineExpose({
         }
 
         .uni-table-td {
-            padding: px2rpx(16) px2rpx(15);
+            padding: px2rpx(15) px2rpx(15);
             color: var(--bs-emphasis-color) !important;
             border-bottom: 1px solid var(--bs-light-bg-subtle) !important;
             box-sizing: border-box;
@@ -1080,7 +1077,7 @@ defineExpose({
         padding: 0 px2rpx(4);
         background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
         border-radius: px2rpx(4);
-        font-size: px2rpx(12);
+        font-size: px2rpx(16);
         color: #606266;
         cursor: pointer;
         transition: all 0.3s;

+ 4 - 4
config/index.ts

@@ -18,10 +18,10 @@ const config = {
   Host00: ht + "//ucard." + ho + "." + dt,
   Host85: ht + "//ucard." + ho + "." + dt,
   Host04: ht + "//pay." + ho + "." + dt,
-  // Host80: 'http://192.168.0.21:8000',
-  // Host00: 'http://192.168.0.21:8000',
-  // Host85: 'http://192.168.0.21:8000',
-  // Host04: 'http://192.168.0.21:8004',
+  // Host80: 'http://192.168.0.23:8000',
+  // Host00: 'http://192.168.0.23:8000',
+  // Host85: 'http://192.168.0.23:8000',
+  // Host04: 'http://192.168.0.23:8004',
   Host90: ht + "//data." + ho + "." + dt,
   HostShop: ht + "//shopcustom." + ho + "." + dt,
   HostShopImg: ht + "//shopmanager." + ho + "." + dt,

+ 23 - 2
pages/customer/components/AccountList.vue

@@ -22,7 +22,7 @@
                         <view class="card-header">
                             <view class="nav nav-underline card-header-tabs">
                                 <view class="nav-item cwg-cursor" v-for="(tab, index) in tabs" :key="index"
-                                    @click="cativeIndex = tab.value">
+                                    @click="handleTabClick(tab.value)">
                                     <view class="nav-link" :class="{ 'active': tab.value === cativeIndex }">{{ tab.text
                                     }}
                                     </view>
@@ -63,7 +63,7 @@
 </template>
 
 <script setup lang="ts">
-import { computed, ref, onMounted, watch } from 'vue';
+import { computed, ref, onMounted, watch, onUnmounted } from 'vue';
 import { useI18n } from 'vue-i18n';
 const { t, locale } = useI18n();
 import useRouter from "@/hooks/useRouter";
@@ -218,6 +218,21 @@ const isZh = computed(() => ['cn', 'zh', 'zhHant'].includes(locale.value));
 
 
 const loading = ref(false)
+let debounceTimer: ReturnType<typeof setTimeout> | null = null
+
+const handleTabClick = (value: string) => {
+    if (loading.value) return
+    
+    if (debounceTimer) {
+        clearTimeout(debounceTimer)
+    }
+    
+    debounceTimer = setTimeout(() => {
+        cativeIndex.value = value
+        debounceTimer = null
+    }, 200)
+}
+
 // 获取客户登录信息
 const dialogCheck = ref(false)
 async function getCustomLoginInfo() {
@@ -341,6 +356,12 @@ onMounted(async () => {
     await getAccountList()
 })
 
+onUnmounted(() => {
+    if (debounceTimer) {
+        clearTimeout(debounceTimer)
+    }
+})
+
 watch(cativeIndex, (newVal) => {
     // search.value.platform = tabs.value[newVal].id
     getAccountList()