feat: 获取手机号

This commit is contained in:
2025-08-10 20:30:48 +08:00
parent e252f7d377
commit 59a4f5827f
2 changed files with 17 additions and 3 deletions

View File

@@ -37,12 +37,13 @@
<script setup>
import { ref, onMounted } from 'vue'
import { getLoginUserPhone } from '@/request/api/LoginApi'
// 假数据
const userInfo = ref({
avatar: '/static/default-avatar.png',
nickname: '微信用户',
phone: '182****0628'
phone: ''
})
// 功能菜单列表(带 type 区分操作类型)
@@ -53,11 +54,18 @@ const menuList = ref([
{ label: '联系客服', type: 'action', action: 'contactService' }
])
// 生命周期
// 生命周期钩子
onMounted(() => {
// TODO: 这里调用接口获取用户信息
getLoginUserPhoneInfo()
})
const getLoginUserPhoneInfo = async () => {
const res = await getLoginUserPhone()
if (res.code === 0) {
userInfo.value.phone = res.data
}
}
// 处理菜单点击
const handleMenuClick = (item) => {
if (item.type === 'navigate' && item.url) {