refactor: convert admin console to SPA with dynamic component switching
- Create shell page (pages/admin/index.vue) with AdminLayout + keep-alive - Convert 9 pages to view components (views/*.vue) - AdminLayout emits navigate events instead of uni.redirectTo - Sidebar navigation no longer causes full page reload - List views cached with keep-alive, detail views re-mount fresh - Fix: add name property to 5 cached views for keep-alive matching - Fix: add navigationStyle custom to prevent double nav bar - Fix: remove duplicate mounted() in RecordView/LogView
这个提交包含在:
@@ -6,10 +6,10 @@
|
||||
<view class="sidebar-menu">
|
||||
<view
|
||||
v-for="item in menuItems"
|
||||
:key="item.path"
|
||||
:key="item.view"
|
||||
class="sidebar-item"
|
||||
:class="{ active: currentPage === item.path }"
|
||||
@click="navigate(item.path)"
|
||||
:class="{ active: currentPage === item.view }"
|
||||
@click="navigate(item.view)"
|
||||
>
|
||||
<text class="sidebar-icon">{{ item.icon }}</text>
|
||||
<text>{{ item.label }}</text>
|
||||
@@ -41,32 +41,32 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
menuItems: [
|
||||
{ icon: '📊', label: '仪表盘', path: '/pages/dashboard/index' },
|
||||
{ icon: '📱', label: '设备管理', path: '/pages/device/index' },
|
||||
{ icon: '👥', label: '用户管理', path: '/pages/user/index' },
|
||||
{ icon: '💳', label: '订阅管理', path: '/pages/subscription/index' },
|
||||
{ icon: '📋', label: '护理记录', path: '/pages/record/index' },
|
||||
{ icon: '📝', label: '操作日志', path: '/pages/log/index' },
|
||||
{ icon: '⚙️', label: '系统设置', path: '/pages/settings/index' }
|
||||
{ icon: '📊', label: '仪表盘', view: 'dashboard' },
|
||||
{ icon: '📱', label: '设备管理', view: 'device' },
|
||||
{ icon: '👥', label: '用户管理', view: 'user' },
|
||||
{ icon: '💳', label: '订阅管理', view: 'subscription' },
|
||||
{ icon: '📋', label: '护理记录', view: 'record' },
|
||||
{ icon: '📝', label: '操作日志', view: 'log' },
|
||||
{ icon: '⚙️', label: '系统设置', view: 'settings' }
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pageTitle() {
|
||||
const item = this.menuItems.find(m => m.path === this.currentPage)
|
||||
return item ? `${item.icon} ${item.label}` : '光子美容仪管理后台'
|
||||
var item = this.menuItems.find(m => m.view === this.currentPage)
|
||||
return item ? item.icon + ' ' + item.label : '光子美容仪管理后台'
|
||||
},
|
||||
adminName() {
|
||||
const store = useUserStore()
|
||||
var store = useUserStore()
|
||||
return (store.adminInfo && store.adminInfo.real_name) || '管理员'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
navigate(path) {
|
||||
uni.redirectTo({ url: path })
|
||||
navigate(view) {
|
||||
this.$emit('navigate', view)
|
||||
},
|
||||
onLogout() {
|
||||
const store = useUserStore()
|
||||
var store = useUserStore()
|
||||
store.clearToken()
|
||||
uni.reLaunch({ url: '/pages/login/index' })
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户