diff --git a/app/assets/img/default-avatar.png b/app/assets/img/default-avatar.png new file mode 100644 index 0000000..4a766b0 Binary files /dev/null and b/app/assets/img/default-avatar.png differ diff --git a/app/assets/img/phone.png b/app/assets/img/phone.png new file mode 100644 index 0000000..fb00c69 Binary files /dev/null and b/app/assets/img/phone.png differ diff --git a/app/assets/img/wechat.png b/app/assets/img/wechat.png new file mode 100644 index 0000000..a19f1e9 Binary files /dev/null and b/app/assets/img/wechat.png differ diff --git a/app/auto-imports.d.ts b/app/auto-imports.d.ts new file mode 100644 index 0000000..37fff4d --- /dev/null +++ b/app/auto-imports.d.ts @@ -0,0 +1,13 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// noinspection JSUnusedGlobalSymbols +// Generated by unplugin-auto-import +// biome-ignore lint: disable +export {} +declare global { + const useDialog: typeof import('naive-ui')['useDialog'] + const useLoadingBar: typeof import('naive-ui')['useLoadingBar'] + const useMessage: typeof import('naive-ui')['useMessage'] + const useNotification: typeof import('naive-ui')['useNotification'] +} diff --git a/app/components.d.ts b/app/components.d.ts new file mode 100644 index 0000000..f3bfd85 --- /dev/null +++ b/app/components.d.ts @@ -0,0 +1,27 @@ +/* eslint-disable */ +// @ts-nocheck +// Generated by unplugin-vue-components +// Read more: https://github.com/vuejs/core/pull/3399 +export {} + +/* prettier-ignore */ +declare module 'vue' { + export interface GlobalComponents { + NAvatar: typeof import('naive-ui')['NAvatar'] + NBadge: typeof import('naive-ui')['NBadge'] + NButton: typeof import('naive-ui')['NButton'] + NDropdown: typeof import('naive-ui')['NDropdown'] + NForm: typeof import('naive-ui')['NForm'] + NFormItem: typeof import('naive-ui')['NFormItem'] + NFormTtem: typeof import('naive-ui')['NFormTtem'] + NIcon: typeof import('naive-ui')['NIcon'] + NInput: typeof import('naive-ui')['NInput'] + NInputgroup: typeof import('naive-ui')['NInputgroup'] + NInputGroup: typeof import('naive-ui')['NInputGroup'] + NModal: typeof import('naive-ui')['NModal'] + NQrCode: typeof import('naive-ui')['NQrCode'] + NSpace: typeof import('naive-ui')['NSpace'] + RouterLink: typeof import('vue-router')['RouterLink'] + RouterView: typeof import('vue-router')['RouterView'] + } +} diff --git a/app/components/LoginModal.vue b/app/components/LoginModal.vue index db31771..6dd8e3b 100644 --- a/app/components/LoginModal.vue +++ b/app/components/LoginModal.vue @@ -1,125 +1,260 @@ - \ No newline at end of file + + + diff --git a/app/components/WechatLoginQr.vue b/app/components/WechatLoginQr.vue new file mode 100644 index 0000000..3a433b1 --- /dev/null +++ b/app/components/WechatLoginQr.vue @@ -0,0 +1,120 @@ + + + + + diff --git a/app/layouts/default.vue b/app/layouts/default.vue index ab403b8..f7424a5 100644 --- a/app/layouts/default.vue +++ b/app/layouts/default.vue @@ -3,20 +3,11 @@ import { Bell, Binary, Code2, Crown, GraduationCap, Image, LayoutGrid, Lightbulb, Maximize, Monitor, Plus, Search, User, Workflow } from 'lucide-vue-next'; -import { -NAvatar, -NBadge, NButton, NDropdown, NInput, NSpace -} from 'naive-ui'; - - - -onMounted(() => { - const userStore = useUserStore() - userStore.checkLoginStatus() -}) - - - +import { ref, onMounted } from 'vue' +const isClient = ref(false) +const modalStore = useModalStore() +// import ../assets/img/default-avatar.png +import defaultAvatar from '../assets/img/default-avatar.png' // 路径到图标的映射 const iconMap: any = { '/model-square': LayoutGrid, @@ -38,6 +29,9 @@ const route = useRoute() const menuStore = useMenuStore() +import { useUserStore } from "@/stores/user"; +const userStore = useUserStore(); + // 监听路由变化 watch( () => route.path, @@ -46,9 +40,9 @@ watch( }, { immediate: true } // 这样一进入页面就会执行一次 ) - - - +onMounted(() => { + isClient.value = true +}) // 更新菜单项中的图标 menuStore.menuItems = menuStore.menuItems.map(item => ({ ...item, @@ -68,24 +62,44 @@ const notificationOptions = [ ] // 用户下拉选项 -const userOptions = [ +const userOptions = ref([ { - label: '个人中心', - key: 'profile' + label: '我的模型', + key: 'model' }, { - label: '创作中心', - key: 'creator' + label: '我的作品', + key: 'project' }, { - type: 'divider', - key: 'd1' + label: '我的点赞', + key: 'like' + }, + { + label: '账号设置', + key: 'userSettings' }, { label: '退出登录', key: 'logout' } -] +]) + +const handleUserSelect = async(key: string) => { + if (key === 'logout') { + try { + await request.post('/logout') + userStore.logout() + window.location.href = '/' + } catch (error) { + console.error('Logout failed:', error) + } + } +} + +const handleLogin = () => { + modalStore.showLoginModal() +}