Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

94 wiersze
3.3 KiB

  1. <template>
  2. <div class="min-h-screen flex flex-col bg-slate-50">
  3. <!-- 顶部导航 -->
  4. <header class="sticky top-0 z-50 bg-white/80 backdrop-blur-md border-b border-slate-200/60">
  5. <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
  6. <div class="flex items-center justify-between h-16">
  7. <!-- Logo -->
  8. <NuxtLink to="/" class="flex items-center gap-2 shrink-0">
  9. <div class="w-8 h-8 rounded-lg bg-indigo-500 flex items-center justify-center">
  10. <span class="text-white font-bold text-sm">奇</span>
  11. </div>
  12. <span class="text-lg font-semibold text-slate-800 hidden sm:block">奇想宇宙</span>
  13. </NuxtLink>
  14. <!-- 导航链接 -->
  15. <nav class="hidden md:flex items-center gap-1">
  16. <NuxtLink
  17. v-for="item in navItems"
  18. :key="item.to"
  19. :to="item.to"
  20. class="px-3 py-2 text-sm rounded-lg text-slate-600 hover:text-indigo-600 hover:bg-indigo-50 transition-colors duration-200"
  21. active-class="text-indigo-600 bg-indigo-50 font-medium"
  22. >
  23. {{ item.label }}
  24. </NuxtLink>
  25. </nav>
  26. <!-- 右侧操作 -->
  27. <div class="flex items-center gap-3">
  28. <template v-if="isLogin">
  29. <span class="text-xs text-slate-500 hidden sm:inline">
  30. 余额 <span class="text-indigo-600 font-semibold">{{ userInfo.balance }}</span> 点
  31. </span>
  32. <NuxtLink
  33. to="/works"
  34. class="px-3 py-2 text-sm text-slate-600 hover:text-indigo-600 hover:bg-indigo-50 rounded-lg transition-colors duration-200"
  35. >
  36. 我的作品
  37. </NuxtLink>
  38. <div class="w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center">
  39. <span class="text-indigo-600 text-xs font-bold">
  40. {{ (userInfo.nickname || userInfo.user_name || '用')[0] }}
  41. </span>
  42. </div>
  43. </template>
  44. <button
  45. v-else
  46. class="px-4 py-2 text-sm font-medium text-white bg-indigo-500 hover:bg-indigo-600 rounded-lg transition-colors duration-200 cursor-pointer"
  47. @click="showLogin = true"
  48. >
  49. 登录
  50. </button>
  51. </div>
  52. </div>
  53. </div>
  54. </header>
  55. <!-- 主体内容 -->
  56. <main class="flex-1">
  57. <slot />
  58. </main>
  59. <!-- 页脚 -->
  60. <footer class="border-t border-slate-200 bg-white py-8 mt-auto">
  61. <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center text-sm text-slate-400">
  62. <p>&copy; {{ new Date().getFullYear() }} 奇想宇宙 AIonline. All rights reserved.</p>
  63. </div>
  64. </footer>
  65. <!-- 登录弹窗 -->
  66. <LoginModal
  67. v-if="showLogin"
  68. @close="showLogin = false"
  69. @login-success="onLoginSuccess"
  70. />
  71. </div>
  72. </template>
  73. <script setup>
  74. const navItems = [
  75. { label: '首页', to: '/' },
  76. { label: 'AI 取名', to: '/ai-name' },
  77. { label: '动漫头像', to: '/anime-avatar' },
  78. { label: '充值', to: '/recharge' },
  79. ]
  80. const { userInfo, isLogin, showLogin, setLogin } = useUser()
  81. function onLoginSuccess(data) {
  82. setLogin(data)
  83. showLogin.value = false
  84. }
  85. </script>