refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范

这个提交包含在:
wikiboss
2026-09-20 17:05:22 +08:00
父节点 de3cf8b870
当前提交 9fa1d1fbd0
共有 1679 个文件被更改,包括 204798 次插入 和 16817 次删除

查看文件

@@ -0,0 +1,128 @@
<template>
<view class="left-window-style" :class="isDarkMode ? 'theme-dark' : 'theme-light'">
<view class="second-menu">
<keep-alive>
<component :is="active" :hasLeftWin="hasLeftWin" :leftWinActive="leftWinActive"></component>
</keep-alive>
</view>
</view>
</template>
<script lang="uts">
import componentPage from '@/pages/tabBar/component.uvue'
import API from '@/pages/tabBar/API.uvue'
import CSS from '@/pages/tabBar/CSS.uvue'
import templatePage from '@/pages/tabBar/template.uvue'
import uniUiPage from '@/pages/tabBar/uni-ui.uvue'
import { state, setMatchLeftWindow, setActive, setLeftWinActive } from '@/store/index.uts'
let isPcObserver
export default {
data() {
return {
nav: [
'component',
'API',
'CSS',
'uni-ui',
'template'
],
isPC: false
}
},
components: {
componentPage,
API,
CSS,
templatePage,
uniUiPage
},
computed: {
active() : string {
return state.active
},
hasLeftWin() : boolean {
return !state.noMatchLeftWindow
},
leftWinActive() : string {
return state.leftWinActive.split('/')[3]
},
isDarkMode() : boolean {
return state.isDarkMode
}
},
mounted() {
isPcObserver = uni.createMediaQueryObserver(this)
isPcObserver.observe({
minWidth: 768
}, matched => {
this.isPC = matched
})
this.handlerRoute((this as any).$route)
},
unmounted() {
isPcObserver.disconnect()
},
watch: {
isPC: {
immediate: true,
handler(newMatches : boolean) {
setMatchLeftWindow(newMatches)
}
},
$route(newRoute) {
this.handlerRoute(newRoute)
}
},
methods: {
handlerRoute(newRoute) {
if (this.isPC) {
if (!newRoute.matched.length) {
uni.redirectTo({
url: '/pages/error/404'
})
} else {
// 检查是否为首页
let isHome = newRoute.path === '/' && newRoute.meta?.route === 'pages/tabBar/component'
if (isHome) {
// 自动跳转到第一个子页面
const defaultPage = '/pages/component/view/view'
setLeftWinActive(defaultPage)
setActive('componentPage')
uni.redirectTo({ url: defaultPage })
return
}
setLeftWinActive(newRoute.path)
let active = newRoute.path.split('/')[2]
if (!active && newRoute.meta?.route) {
active = newRoute.meta.route.split('/')[2]
}
if (this.nav.includes(active)) {
if (active === 'component') {
active = 'componentPage'
}
if (active === 'template') {
active = 'templatePage'
}
if (active === 'uni-ui') {
active = 'uniUiPage'
}
setActive(active)
}
}
}
}
}
}
</script>
<style>
.left-window-style {
min-height: calc(100vh - var(--top-window-height));
background-color: var(--background-color,#ffffff);
}
.second-menu {
width: 350px;
background-color: #F8F8F8;
}
</style>

查看文件

@@ -0,0 +1,131 @@
<template>
<view class="top-window-header" :class="isDarkMode ? 'theme-dark' : 'theme-light'">
<view class="left-header">
<navigator class="left-header" open-type="reLaunch" url="/pages/component/view/view">
<image src="/static/test-image/logo.png" class="logo" mode="heightFix"></image>
<text>hello uni-app x</text>
</navigator>
</view>
<custom-tab-bar class="tab-bar-flex" direction="horizontal" :show-icon="false" :selected="current"
@onTabItemTap="toSecondMenu" />
</view>
</template>
<script lang="uts">
type IndexPageItem = {
tabBar : string.PageURIString;
indexPageUrl : string.PageURIString;
}
import { state } from '@/store/index.uts'
export default {
data() {
return {
selected: {
component: 0,
API: 1,
CSS: 2,
'uni-ui': 3,
template: 4
},
current: 0,
indexPage: [{
tabBar: '/pages/tabBar/component',
indexPageUrl: '/pages/component/view/view'
}, {
tabBar: '/pages/tabBar/API',
indexPageUrl: '/pages/API/get-app/get-app'
}, {
tabBar: '/pages/tabBar/CSS',
indexPageUrl: '/pages/CSS/layout/width'
}, {
tabBar: '/pages/tabBar/uni-ui',
indexPageUrl: '/pages/uni-ui/time-format/time-format'
}, {
tabBar: '/pages/tabBar/template',
indexPageUrl: '/pages/template/banner-tabs-feed-nested-scroll/banner-tabs-feed-nested-scroll'
}] as IndexPageItem[]
}
},
computed: {
isDarkMode() : boolean {
return state.isDarkMode
}
},
watch: {
$route: {
// immediate: true,
handler(newRoute) {
const width = uni.getSystemInfoSync().windowWidth
if (width <= 768) {
return
}
let path = newRoute.path
let category
if (path === '/') {
category = 'component'
uni.redirectTo({
url: '/pages/component/view/view'
})
return
} else if (path.indexOf('/pages/tabBar') === 0) {
const indexPageItem = this.indexPage.find(item => item.tabBar === path)
if (!indexPageItem) {
console.error('Invalid page path: ', path)
return
}
uni.redirectTo({
url: indexPageItem.indexPageUrl
})
return
} else {
category = path.split('/')[2]
}
this.current = this.selected[category]
}
}
},
methods: {
toSecondMenu(e : OnTabItemTapOption) {
const activeTabBar = '/' + e.pagePath
for (const item of this.indexPage) {
if (activeTabBar === item.tabBar) {
uni.redirectTo({
url: item.indexPageUrl
})
}
}
}
}
}
</script>
<style>
.top-window-header {
height: 60px;
padding: 0 15px;
flex-direction: row;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
border-bottom: 1px solid #e1e1e1;
color: var(--text-color, #333333);
background-color: var(--list-background-color,#ffffff);
}
.left-header {
flex-direction: row;
align-items: center;
flex: 1;
}
.logo {
height: 30px;
width: 30px;
margin-right: 8px;
}
.tab-bar-flex {
width: 360px;
}
</style>