|
|
@@ -4,10 +4,9 @@ import avatar from '@/static/image/me/avatar.png'
|
|
|
import consult from '@/static/image/me/consult.png'
|
|
|
import coupon from '@/static/image/me/coupon.png'
|
|
|
import memberShop from '@/static/image/me/memberShop.png'
|
|
|
-import ToolApi from '@/utils'
|
|
|
|
|
|
-const safeHeight = ToolApi.getSafeHeight()
|
|
|
-const titleName = ref<string>('我的')
|
|
|
+const appStore = useAppStore()
|
|
|
+
|
|
|
const userInfo = ref<UserInfo>({
|
|
|
age: 0,
|
|
|
avatar,
|
|
|
@@ -36,10 +35,24 @@ const userModules = ref<UserModule>({
|
|
|
path: '',
|
|
|
},
|
|
|
})
|
|
|
+
|
|
|
+onShow(appStore.fetchCurrentUser)
|
|
|
+
|
|
|
+function goToSetting() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/setting/index',
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function goUserInfo() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/userInfo/index',
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <view class="w-full bg-[#F5F6F7]" :style="`height:calc(100vh - ${safeHeight}px)`">
|
|
|
+ <view class="w-full bg-[#F5F6F7] h-screen">
|
|
|
<view class="me-container p-4 w-full">
|
|
|
<view class="me-card bg-[#FFFFFF] h-[229px] flex flex-col justify-center items-center w-full rounded-xl">
|
|
|
<view class="me-card-info flex flex-1 w-full border-b-1 border-[#E7E7E7] p-4 justify-between items-center">
|
|
|
@@ -48,16 +61,21 @@ const userModules = ref<UserModule>({
|
|
|
<image :src="userInfo.avatar" alt="avatar" class="w-[64px] h-[64px] rounded-full" />
|
|
|
</view>
|
|
|
<view class="me-card-info-login-person flex flex-col justify-between h-[54px]">
|
|
|
- <text class="text-[16px] font-bold ">
|
|
|
- {{ userInfo.nickName }}
|
|
|
+ <text class="text-[16px] font-bold line-clamp-1">
|
|
|
+ <template v-if="appStore.user">
|
|
|
+ {{ appStore.user.username }}
|
|
|
+ </template>
|
|
|
+ <span v-else @click="() => appStore.login()">
|
|
|
+ 请登录
|
|
|
+ </span>
|
|
|
</text>
|
|
|
<view class="h-[fit-content] text-[#999999] ">
|
|
|
- <uni-tag :text="`${userInfo.isLogin ? (`${userInfo.age}岁`) : '年龄'}`" class="mr-2" />
|
|
|
- <uni-tag :text="userInfo.memberType" />
|
|
|
+ <uni-tag :text="`${appStore.age ? (`${appStore.age}岁`) : '年龄'}`" class="mr-2" />
|
|
|
+ <uni-tag :text="appStore.memberType" />
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="me-card-info-edit w-[20px] h-[20px]">
|
|
|
+ <view class="me-card-info-edit w-[20px] h-[20px] shrink-0" @tap="goUserInfo">
|
|
|
<image src="@/static/image/me/edit.png" alt="edit" class="w-full h-full" />
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -66,7 +84,7 @@ const userModules = ref<UserModule>({
|
|
|
v-for="item in userModules" :key="item.id"
|
|
|
class="flex justify-between items-center flex-col me-card-item-module"
|
|
|
>
|
|
|
- <image :src="item.imgUrl" :alt="item.name" class="w-[48px] h-[48px]" />
|
|
|
+ <image :src="item.imgUrl" :alt="item.name" class="w-[48px] h-[48px] shrink-0" />
|
|
|
<text class="text-[12px] text-[#000000]">
|
|
|
{{ item.name }}
|
|
|
</text>
|
|
|
@@ -74,14 +92,12 @@ const userModules = ref<UserModule>({
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <uni-card spacing="0" padding="0" :border="false">
|
|
|
- <view class="uni-body">
|
|
|
- <uni-list :border="false">
|
|
|
- <uni-list-item title="关于我们" show-arrow class="border-b-1 border-[#E7E7E7]" />
|
|
|
- <uni-list-item title="设置" show-arrow />
|
|
|
- </uni-list>
|
|
|
- </view>
|
|
|
- </uni-card>
|
|
|
+ <view class="px-4">
|
|
|
+ <CellGroup>
|
|
|
+ <Cell title="关于我们" border />
|
|
|
+ <Cell title="设置" @tap="goToSetting" />
|
|
|
+ </CellGroup>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|