Commit d3157a29 authored by tyyin lan's avatar tyyin lan

feat: 个人设置

parent 3f76482f
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
name="viewport" name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/> />
<link rel="stylesheet" href="//at.alicdn.com/t/c/font_4711453_vbf79y4vtuk.css" /> <link rel="stylesheet" href="//at.alicdn.com/t/c/font_4711453_a5ytfgvaagl.css" />
<title>Model Link</title> <title>Model Link</title>
</head> </head>
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
import { computed, h, ref, watchEffect } from 'vue' import { computed, h, ref, watchEffect } from 'vue'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { Plus } from '@icon-park/vue-next' import { Plus, Logout, Me } from '@icon-park/vue-next'
import type { MenuOption } from 'naive-ui' import type { MenuOption } from 'naive-ui'
import CustomIcon from '@/components/custom-icon/custom-icon.vue'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
// import LanguageSetting from '@/components/language-setting/language-setting.vue' // import LanguageSetting from '@/components/language-setting/language-setting.vue'
...@@ -46,12 +45,17 @@ const menuOptions = computed<MenuOption[]>(() => { ...@@ -46,12 +45,17 @@ const menuOptions = computed<MenuOption[]>(() => {
] ]
}) })
const avatarOptions = computed(() => { const userConfigOptions = computed(() => {
return [ return [
{ {
label: () => h('div', {}, t('common_module.logout')), label: () => h('div', '个人设置'),
key: 'logout', key: 'PersonalSettings',
icon: () => h(CustomIcon, { icon: 'teenyicons:logout-solid' }), icon: () => h(Me, { theme: 'outline', size: 14, strokeWidth: 3 }),
},
{
label: () => h('div', t('common_module.logout')),
key: 'Logout',
icon: () => h(Logout, { theme: 'outline', size: 14, strokeWidth: 3 }),
}, },
] ]
}) })
...@@ -64,8 +68,8 @@ function handleToPersonAppSettingPage() { ...@@ -64,8 +68,8 @@ function handleToPersonAppSettingPage() {
router.push({ name: 'PersonalAppSetting' }) router.push({ name: 'PersonalAppSetting' })
} }
function handleDropdownSelect(key: string) { function handleUserConfigOptionsSelect(key: string) {
if (key === 'logout') { if (key === 'Logout') {
userStore.logout().then(() => { userStore.logout().then(() => {
router.push({ name: 'Login' }) router.push({ name: 'Login' })
}) })
...@@ -119,28 +123,28 @@ function handleMenuValueChange(key: string) { ...@@ -119,28 +123,28 @@ function handleMenuValueChange(key: string) {
<div class="mb-[20px] mt-6"> <div class="mb-[20px] mt-6">
<div> <div>
<NDropdown <n-dropdown
v-if="userStore.isLogin" v-if="userStore.isLogin"
trigger="click" trigger="click"
placement="top" placement="top"
:options="avatarOptions" :options="userConfigOptions"
@select="handleDropdownSelect" @select="handleUserConfigOptionsSelect"
> >
<div <div
class="flex h-full cursor-pointer items-center rounded-[6px] px-[12px] py-[4px] transition hover:bg-[#F3F3F5]" class="flex h-full cursor-pointer items-center rounded-[6px] px-[12px] py-[4px] transition hover:bg-[#F3F3F5]"
> >
<NAvatar round :size="40" object-fit="cover" :src="userStore.userInfo.avatarUrl || defaultAvatar" /> <n-avatar round :size="40" object-fit="cover" :src="userStore.userInfo.avatarUrl || defaultAvatar" />
<div class="ml-3 line-clamp-1 max-w-[140px] select-none break-all text-base"> <div class="ml-3 line-clamp-1 max-w-[140px] flex-1 select-none break-all text-base">
{{ userStore.userInfo.nickName || t('common_module.not_login_text') }} {{ userStore.userInfo.nickName || t('common_module.not_login_text') }}
</div> </div>
</div> </div>
</NDropdown> </n-dropdown>
<div v-else> <div v-else>
<NButton type="primary" class="w-full! rounded-md!" @click="handleToLogin"> <n-button type="primary" class="w-full! rounded-md!" @click="handleToLogin">
{{ t('common_module.login_now') }} {{ t('common_module.login_now') }}
</NButton> </n-button>
</div> </div>
</div> </div>
...@@ -152,16 +156,16 @@ function handleMenuValueChange(key: string) { ...@@ -152,16 +156,16 @@ function handleMenuValueChange(key: string) {
</template> </template>
<style lang="scss"> <style lang="scss">
.v-binder-follower-container { // .v-binder-follower-container {
.n-dropdown-menu { // .n-dropdown-menu {
--n-border-radius: 10px !important; // --n-border-radius: 10px !important;
--n-box-shadow: -3px 3px 4px 0px #f2f2f2 !important; // --n-box-shadow: -3px 3px 4px 0px #f2f2f2 !important;
padding: 6px 0 !important; // padding: 6px 0 !important;
} // }
.n-dropdown-menu .n-dropdown-option-body { // .n-dropdown-menu .n-dropdown-option-body {
padding: 0 10px; // padding: 0 10px;
} // }
} // }
</style> </style>
import { type RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/index.vue'
export default [
{
path: '/personal/settings',
meta: {
rank: 1001,
title: '',
},
component: Layout,
children: [
{
path: '',
name: 'PersonalSettings',
meta: {
rank: 1001,
title: 'router_title_module.personal_settings',
},
component: () => import('@/views/personal-settings/personal-settings.vue'),
},
],
},
] as RouteRecordRaw[]
...@@ -23,10 +23,10 @@ const defaultLanguageOptions = [ ...@@ -23,10 +23,10 @@ const defaultLanguageOptions = [
label: '中文繁體', label: '中文繁體',
key: 'zh-HK', key: 'zh-HK',
}, },
// { {
// label: 'English', label: 'English',
// key: 'en', key: 'en',
// }, },
] ]
const localeKey = ss.get('i18nextLng') || defaultLocale const localeKey = ss.get('i18nextLng') || defaultLocale
......
...@@ -9,6 +9,8 @@ function createDefaultUserInfoFactory(): UserInfo { ...@@ -9,6 +9,8 @@ function createDefaultUserInfoFactory(): UserInfo {
avatarUrl: '', avatarUrl: '',
nickName: '', nickName: '',
mobilePhone: '', mobilePhone: '',
remark: '',
email: '',
} }
} }
......
...@@ -3,6 +3,8 @@ export interface UserInfo { ...@@ -3,6 +3,8 @@ export interface UserInfo {
mobilePhone: string mobilePhone: string
nickName: string nickName: string
avatarUrl: string avatarUrl: string
remark: string
email: string
} }
export interface UserState { export interface UserState {
......
...@@ -93,7 +93,7 @@ const emailLoginFormRules = shallowReadonly<FormRules>({ ...@@ -93,7 +93,7 @@ const emailLoginFormRules = shallowReadonly<FormRules>({
const phoneNumberAreaOptions = computed(() => { const phoneNumberAreaOptions = computed(() => {
return [ return [
{ {
label: `+86 ${t('login_module.mainland_china')}`, label: `+86${t('login_module.mainland_china')}`,
value: '+86', value: '+86',
}, },
{ {
......
This diff is collapsed.
...@@ -167,6 +167,7 @@ declare namespace I18n { ...@@ -167,6 +167,7 @@ declare namespace I18n {
multi_model_dialogue: string multi_model_dialogue: string
explore: string explore: string
application_square: string application_square: string
personal_settings: string
} }
personal_space_module: { personal_space_module: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment