|
|
@@ -1,56 +1,133 @@
|
|
|
<template>
|
|
|
<ElContainer class="h-full">
|
|
|
- <ElAside class="bg-neutral-50 dark:bg-neutral-900">
|
|
|
- <ElMenu class="!border-0" default-active="home" :router="true">
|
|
|
- <ElMenuItem index="home">
|
|
|
- <template #title>
|
|
|
- <div class="w-5 h-5 mr-2"><Home /></div>
|
|
|
- 主页
|
|
|
- </template>
|
|
|
- </ElMenuItem>
|
|
|
- <ElMenuItem index="withdraw" :route="{ name: 'withdraw' }">
|
|
|
- <template #title>
|
|
|
- <div class="w-5 h-5 mr-2"><Wallet /></div>
|
|
|
- 提现申请
|
|
|
- </template>
|
|
|
- </ElMenuItem>
|
|
|
- </ElMenu>
|
|
|
+ <ElAside class="bg-slate-100 dark:bg-zinc-800" v-if="!isMobile">
|
|
|
+ <div class="h-16 px-4 flex items-center justify-center cursor-pointer">
|
|
|
+ <LogoSvg class="fill-black dark:fill-white" /><span class="pl-2 font-[sh]">CHILLGPT</span>
|
|
|
+ </div>
|
|
|
+ <SideMenu :default-active="activeMenu" :menus="menus" />
|
|
|
</ElAside>
|
|
|
<ElContainer>
|
|
|
- <ElHeader class="border-b border-neutral-200 dark:border-neutral-800 flex items-center">
|
|
|
+ <ElHeader class="!h-16 border-b !box-border border-neutral-200 dark:border-neutral-800 flex items-center">
|
|
|
+ <div class="p-4 mr-4 cursor-pointer" @click="toggleMenu" v-if="isMobile">
|
|
|
+ <Menu2 class="w-5 h-5" />
|
|
|
+ </div>
|
|
|
+
|
|
|
<el-breadcrumb separator="/">
|
|
|
- <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
|
|
- <el-breadcrumb-item>提现申请</el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item :to="{ path: '/' }">主页</el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item v-if="route.name !== 'home'">{{
|
|
|
+ route.meta?.title || route.path
|
|
|
+ }}</el-breadcrumb-item>
|
|
|
</el-breadcrumb>
|
|
|
<div class="grow"></div>
|
|
|
- <DarkSwitch />
|
|
|
+ <DarkSwitch class="mr-4" />
|
|
|
+ <el-dropdown @command="onCommand">
|
|
|
+ <UserAvatar />
|
|
|
+ <template #dropdown>
|
|
|
+ <el-dropdown-menu>
|
|
|
+ <el-dropdown-item command="changePassword">修改密码</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="logout">退出登录</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </template>
|
|
|
+ </el-dropdown>
|
|
|
</ElHeader>
|
|
|
<ElMain class="bg-neutral-50 dark:bg-neutral-900">
|
|
|
<RouterView></RouterView>
|
|
|
</ElMain>
|
|
|
</ElContainer>
|
|
|
+
|
|
|
+ <ElDrawer
|
|
|
+ v-model="showDrawer"
|
|
|
+ direction="ltr"
|
|
|
+ size="80%"
|
|
|
+ v-if="isMobile"
|
|
|
+ class="!bg-slate-100 dark:!bg-zinc-800"
|
|
|
+ >
|
|
|
+ <SideMenu :default-active="activeMenu" :menus="menus" />
|
|
|
+ </ElDrawer>
|
|
|
+
|
|
|
+ <ChangePwd v-model="showChangePwdDialog"> </ChangePwd>
|
|
|
</ElContainer>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
import { ElAside, ElContainer, ElHeader, ElMain } from 'element-plus'
|
|
|
-import { Wallet, Home } from '@vicons/tabler'
|
|
|
import DarkSwitch from '@/components/DarkSwitch.vue'
|
|
|
+import SideMenu from '@/components/SideMenu.vue'
|
|
|
+import { useRoute } from 'vue-router'
|
|
|
+import { ref, watch, shallowRef, inject } from 'vue'
|
|
|
+import LogoSvg from '@/components/LogoSvg.vue'
|
|
|
+import { User, MoodSmile, Wallet, Home, ExternalLink, Menu2 } from '@vicons/tabler'
|
|
|
+import UserAvatar from '@/components/UserAvatar.vue'
|
|
|
+import ChangePwd from '@/components/ChangePwd.vue'
|
|
|
+import { http } from '@/plugins/http'
|
|
|
|
|
|
-const menus = [
|
|
|
+const route = useRoute()
|
|
|
+const activeMenu = ref(route.name || 'home')
|
|
|
+const isMobile = inject('isMobile')
|
|
|
+const showDrawer = ref(false)
|
|
|
+const menus = ref([
|
|
|
+ {
|
|
|
+ name: 'home',
|
|
|
+ title: '主页',
|
|
|
+ icon: shallowRef(Home)
|
|
|
+ },
|
|
|
{
|
|
|
- name: 'Dashboard',
|
|
|
- icon: 'el-icon-s-home',
|
|
|
- path: '/home'
|
|
|
+ name: 'user-parent',
|
|
|
+ title: '用户管理',
|
|
|
+ icon: shallowRef(User),
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ name: 'user',
|
|
|
+ title: '用户列表'
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- name: 'Users',
|
|
|
- icon: 'el-icon-user',
|
|
|
- path: '/users'
|
|
|
+ name: 'membership-parent',
|
|
|
+ title: '会员管理',
|
|
|
+ icon: shallowRef(MoodSmile),
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ name: 'membership',
|
|
|
+ title: '会员列表'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'memberOrder',
|
|
|
+ title: '会员订单'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'memberPlan',
|
|
|
+ title: '会员计划'
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
- name: 'Settings',
|
|
|
- icon: 'el-icon-setting',
|
|
|
- path: '/settings'
|
|
|
+ name: 'money',
|
|
|
+ title: '提现申请',
|
|
|
+ icon: shallowRef(Wallet),
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ name: 'withdraw',
|
|
|
+ title: '提现申请'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+])
|
|
|
+function toggleMenu() {
|
|
|
+ showDrawer.value = !showDrawer.value
|
|
|
+}
|
|
|
+watch(route, () => {
|
|
|
+ activeMenu.value = route.name
|
|
|
+})
|
|
|
+const showChangePwdDialog = ref(false)
|
|
|
+function onCommand(cmd) {
|
|
|
+ if (cmd === 'logout') {
|
|
|
+ logout()
|
|
|
+ } else if (cmd === 'changePassword') {
|
|
|
+ showChangePwdDialog.value = true
|
|
|
}
|
|
|
-]
|
|
|
+}
|
|
|
+function logout() {
|
|
|
+ http.setToken(null)
|
|
|
+ location.reload()
|
|
|
+}
|
|
|
</script>
|