完善页面细节2

This commit is contained in:
2026-02-25 15:16:18 +08:00
parent bd2036630a
commit 1924272182
20 changed files with 39 additions and 81 deletions

View File

@@ -150,6 +150,21 @@
1. **转为静态导入**: 在 `adminComponentMap.uts` 顶部使用静态 `import` 导入所有管理端子页面组件。 1. **转为静态导入**: 在 `adminComponentMap.uts` 顶部使用静态 `import` 导入所有管理端子页面组件。
2. **组件映射**: 维护 `componentMap` 为静态 Map避免在运行时使用 `defineAsyncComponent`,从而提高页面的加载成功率和抗语法错误风险。 2. **组件映射**: 维护 `componentMap` 为静态 Map避免在运行时使用 `defineAsyncComponent`,从而提高页面的加载成功率和抗语法错误风险。
#### **原因二十二Tab 切换高度抖动 (Tab Switching Height Jitter)**
- **现象**: 在包含多标签切换的配置页面中,切换不同标签时,由于内容块高度差异较大,导致整个容器或页面产生明显的跳动/收缩。
- **原因**: 每个 `v-if``v-show` 对应的内容高度不一致,且父容器没有设置 `min-height` 进行视觉对齐。
- **解决方案**: 为切换内容的公共父容器(如 `.config-body``.tab-content`)设置一个统一的 `min-height`(推荐 400px - 600px 之间,视表单复杂度而定),确保最矮的标签页下仍能撑开容器。
#### **原因二十三:循环依赖导致的 500 错误 (Circular Dependency & AdminLayout)**
- **现象**: 浏览器报 `500 Internal Server Error`,控制台显示 `Failed to fetch dynamically imported module``net::ERR_ABORTED`
- **原因**: 核心布局组件 `AdminLayout.uvue` 导入了 `adminComponentMap.uts`(用于动态渲染子页面),而子页面内部又通过 `import AdminLayout` 引用了布局组件。这种循环依赖在 Vite/UTS 环境下会导致整个加载链路崩溃。
- **解决方案**:
1. 所有在 `adminComponentMap.uts` 中注册的**子页面**Sub-pages**严禁**在 `<template>` 中包裹 `<AdminLayout>`,也**严禁**在 `<script>``import AdminLayout`
2. 布局由主入口统一提供,子页面只需编写内容区的 `<view>`
3. **例外**: 仅当某个页面是独立存在的(例如登录页、引导页),且需要独立布局时,才允许自行包装。
## 🛠️ 完整修复流程 ## 🛠️ 完整修复流程
``` ```

View File

@@ -1,5 +1,4 @@
<template> <template>
<AdminLayout current-page="maintain_dev_config">
<view class="admin-page category-page"> <view class="admin-page category-page">
<view class="admin-sections"> <view class="admin-sections">
<!-- 筛选区域 (1:1 复刻 CRMEB: 横向排列的过滤器) --> <!-- 筛选区域 (1:1 复刻 CRMEB: 横向排列的过滤器) -->
@@ -70,12 +69,10 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from 'vue' import { ref } from 'vue'
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
const categoryList = ref([ const categoryList = ref([
{ id: 9, name: '分销配置', field: 'fenxiao', status: true }, { id: 9, name: '分销配置', field: 'fenxiao', status: true },

View File

@@ -1,17 +1,16 @@
<template> <template>
<AdminLayout current-page="maintain_dev_data"> <view class="admin-page">
<view class="admin-page"> <view class="admin-sections">
<view class="admin-sections"> <!-- 搜索栏 -->
<!-- 搜索栏 --> <view class="admin-card filter-card">
<view class="admin-card filter-card"> <view class="filter-row">
<view class="filter-row"> <view class="filter-item">
<view class="filter-item"> <text class="label">数据搜索:</text>
<text class="label">数据搜索:</text> <input class="filter-input input-large" placeholder="请输入ID,KEY,数据组名称,简介" />
<input class="filter-input input-large" placeholder="请输入ID,KEY,数据组名称,简介" />
</view>
<button class="btn primary" @click="onSearch">查询</button>
</view> </view>
<button class="btn primary" @click="onSearch">查询</button>
</view> </view>
</view>
<!-- 内容区 --> <!-- 内容区 -->
<view class="admin-card content-card"> <view class="admin-card content-card">
@@ -49,12 +48,10 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from 'vue' import { ref } from 'vue'
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
const dataList = ref([ const dataList = ref([
{ id: 49, key: 'routine_seckill_time', name: '秒杀时间段', desc: '秒杀时间段' }, { id: 49, key: 'routine_seckill_time', name: '秒杀时间段', desc: '秒杀时间段' },

View File

@@ -1,6 +1,5 @@
<template> <template>
<AdminLayout current-page="maintain_dev_task"> <view class="admin-page">
<view class="admin-page">
<view class="admin-sections"> <view class="admin-sections">
<!-- 顶部通知 --> <!-- 顶部通知 -->
<view class="admin-card alert-card"> <view class="admin-card alert-card">
@@ -50,12 +49,10 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from 'vue' import { ref } from 'vue'
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
const dataList = ref([ const dataList = ref([
{ id: 1, title: '自动开具/冲红电子发票', desc: '每隔10分钟执行自动开具/冲红电子发票', cycle: '每隔10分钟执行一次', status: true }, { id: 1, title: '自动开具/冲红电子发票', desc: '每隔10分钟执行自动开具/冲红电子发票', cycle: '每隔10分钟执行一次', status: true },

View File

@@ -1,5 +1,4 @@
<template> <template>
<AdminLayout current-page="maintain_dev_event">
<view class="admin-page"> <view class="admin-page">
<view class="admin-sections"> <view class="admin-sections">
<!-- 提示语 --> <!-- 提示语 -->
@@ -37,11 +36,9 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
function onAdd() { function onAdd() {
uni.showToast({ title: '新增系统事件', icon: 'none' }) uni.showToast({ title: '新增系统事件', icon: 'none' })

View File

@@ -1,6 +1,5 @@
<template> <template>
<AdminLayout current-page="maintain_dev_module"> <view class="admin-page">
<view class="admin-page">
<view class="admin-sections"> <view class="admin-sections">
<view class="admin-card content-card"> <view class="admin-card content-card">
<view class="form-container"> <view class="form-container">
@@ -31,11 +30,9 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
function onSubmit() { function onSubmit() {
uni.showToast({ title: '已提交', icon: 'none' }) uni.showToast({ title: '已提交', icon: 'none' })
} }

View File

@@ -1,6 +1,5 @@
<template> <template>
<AdminLayout current-page="maintain_dev_auth"> <view class="admin-page">
<view class="admin-page">
<view class="admin-sections"> <view class="admin-sections">
<!-- 搜索栏 --> <!-- 搜索栏 -->
<view class="admin-card filter-card"> <view class="admin-card filter-card">
@@ -65,12 +64,10 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from 'vue' import { ref } from 'vue'
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
const dataList = ref([ const dataList = ref([
{ id: 1, name: '主页', auth: 'admin-home', route: '菜单: /admin/index', status: true, memo: '主页' }, { id: 1, name: '主页', auth: 'admin-home', route: '菜单: /admin/index', status: true, memo: '主页' },

View File

@@ -1,5 +1,4 @@
<template> <template>
<AdminLayout currentPage="maintain-dev-config">
<view class="admin-maintain-config"> <view class="admin-maintain-config">
<view class="page-header border-shadow"> <view class="page-header border-shadow">
<text class="page-title">开发配置 - 配置分类</text> <text class="page-title">开发配置 - 配置分类</text>
@@ -30,11 +29,9 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -1,6 +1,5 @@
<template> <template>
<AdminLayout current-page="maintain_security_upgrade"> <view class="admin-page">
<view class="admin-page">
<view class="admin-sections"> <view class="admin-sections">
<!-- 提示栏 --> <!-- 提示栏 -->
<view class="alert-info"> <view class="alert-info">
@@ -58,12 +57,10 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from 'vue' import { ref } from 'vue'
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
const activeTab = ref('upgrade') const activeTab = ref('upgrade')
const tabs = [ const tabs = [

View File

@@ -1,6 +1,5 @@
<template> <template>
<AdminLayout currentPage="maintain-security-refresh-cache"> <view class="admin-page">
<view class="admin-page">
<view class="admin-sections"> <view class="admin-sections">
<view class="admin-grid-2"> <view class="admin-grid-2">
<!-- 清除缓存 --> <!-- 清除缓存 -->
@@ -23,11 +22,9 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
function onClearCache() { function onClearCache() {
uni.showModal({ uni.showModal({

View File

@@ -1,6 +1,5 @@
<template> <template>
<AdminLayout currentPage="maintain-sys-info"> <view class="admin-page">
<view class="admin-page">
<view class="admin-sections"> <view class="admin-sections">
<!-- 商业授权 --> <!-- 商业授权 -->
<view class="admin-card info-section"> <view class="admin-card info-section">
@@ -99,11 +98,9 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
function gotoOfficial() { function gotoOfficial() {
uni.showToast({ title: '正在打开官网...', icon: 'none' }) uni.showToast({ title: '正在打开官网...', icon: 'none' })
} }

View File

@@ -124,10 +124,6 @@ const handleSubmit = () => {
</script> </script>
<style scoped> <style scoped>
.admin-marketing-integral-config {
padding: 0px;
}
.box-shadow { .box-shadow {
background-color: #fff; background-color: #fff;
border-radius: 4px; border-radius: 4px;
@@ -169,6 +165,7 @@ const handleSubmit = () => {
.config-body { .config-body {
padding: 40px 60px; padding: 40px 60px;
min-height: 480px;
} }
.form-item { .form-item {

View File

@@ -1,17 +1,14 @@
<template> <template>
<AdminLayout :currentPage="currentPage">
<view class="page"> <view class="page">
<view class="header"> <view class="header">
<text class="title">{{ title }}</text> <text class="title">{{ title }}</text>
<text class="sub-title">页面占位 (自动生成)</text> <text class="sub-title">页面占位 (自动生成)</text>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from 'vue' import { ref } from 'vue'
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
const currentPage = ref<string>('points-config') const currentPage = ref<string>('points-config')
const title = ref<string>('config') const title = ref<string>('config')
</script> </script>

View File

@@ -1,17 +1,14 @@
<template> <template>
<AdminLayout :currentPage="currentPage">
<view class="page"> <view class="page">
<view class="header"> <view class="header">
<text class="title">{{ title }}</text> <text class="title">{{ title }}</text>
<text class="sub-title">页面已修复 (UTF-8)</text> <text class="sub-title">页面已修复 (UTF-8)</text>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from 'vue' import { ref } from 'vue'
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
const currentPage = ref<string>('goods') const currentPage = ref<string>('goods')
const title = ref<string>('goods') const title = ref<string>('goods')
</script> </script>

View File

@@ -1,5 +1,4 @@
<template> <template>
<AdminLayout :currentPage="currentPage">
<view class="Page"> <view class="Page">
<view class="Header"> <view class="Header">
<text class="Title">积分统计</text> <text class="Title">积分统计</text>
@@ -11,13 +10,11 @@
<text class="Mono">{{ params }}</text> <text class="Mono">{{ params }}</text>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
const params = ref('') const params = ref('')
const tab = ref('stats') const tab = ref('stats')

View File

@@ -1,17 +1,14 @@
<template> <template>
<AdminLayout :currentPage="currentPage">
<view class="page"> <view class="page">
<view class="header"> <view class="header">
<text class="title">{{ title }}</text> <text class="title">{{ title }}</text>
<text class="sub-title">页面占位 (自动生成)</text> <text class="sub-title">页面占位 (自动生成)</text>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from 'vue' import { ref } from 'vue'
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
const currentPage = ref<string>('points-record') const currentPage = ref<string>('points-record')
const title = ref<string>('record') const title = ref<string>('record')
</script> </script>

View File

@@ -1,17 +1,14 @@
<template> <template>
<AdminLayout :currentPage="currentPage">
<view class="page"> <view class="page">
<view class="header"> <view class="header">
<text class="title">{{ title }}</text> <text class="title">{{ title }}</text>
<text class="sub-title">积分统计数据,包含积分发放和消费情况?</text> <text class="sub-title">积分统计数据,包含积分发放和消费情况?</text>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from 'vue' import { ref } from 'vue'
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
const currentPage = ref<string>('points-stats') const currentPage = ref<string>('points-stats')
const title = ref<string>('积分统计') const title = ref<string>('积分统计')
</script> </script>

View File

@@ -1,12 +1,11 @@
<template> <template>
<AdminLayout> <view class="marketing-seckill-list">
<view class="marketing-seckill-list"> <view class="filter-card border-shadow">
<view class="filter-card border-shadow"> <view class="filter-row">
<view class="filter-row"> <view class="filter-item">
<view class="filter-item"> <text class="label">活动搜索:</text>
<text class="label">活动搜索:</text> <input class="input-mock" placeholder="请输入活动名称, ID" />
<input class="input-mock" placeholder="请输入活动名称, ID" /> </view>
</view>
<view class="filter-item"> <view class="filter-item">
<text class="label">活动状态:</text> <text class="label">活动状态:</text>
<view class="select-mock"> <view class="select-mock">
@@ -118,11 +117,9 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
import { ref } from 'vue' import { ref } from 'vue'
const seckillList = ref([ const seckillList = ref([

View File

@@ -1,5 +1,4 @@
<template> <template>
<AdminLayout currentPage="product_paramList">
<view class="admin-main"> <view class="admin-main">
<!-- 头部搜索 --> <!-- 头部搜索 -->
<view class="search-card"> <view class="search-card">
@@ -99,12 +98,10 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
interface ParamKV { interface ParamKV {
label: string; label: string;

View File

@@ -1,5 +1,4 @@
<template> <template>
<AdminLayout current-page="setting_system_config">
<view class="admin-page"> <view class="admin-page">
<view class="admin-sections"> <view class="admin-sections">
<view class="admin-card settings-card"> <view class="admin-card settings-card">
@@ -71,12 +70,10 @@
</view> </view>
</view> </view>
</view> </view>
</AdminLayout>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { ref } from "vue" import { ref } from "vue"
import AdminLayout from '@/layouts/admin/AdminLayout.uvue'
const currentTab = ref(8) // 默认打开截图中的“WAF配置” const currentTab = ref(8) // 默认打开截图中的“WAF配置”
const tabs = [ const tabs = [