hookehuyr

feat(用户设置): 添加手机号显示功能

在用户设置页面中显示用户的手机号码,从API响应中获取并绑定到模板
1 <!-- 1 <!--
2 * @Date: 2025-03-24 13:04:21 2 * @Date: 2025-03-24 13:04:21
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-06-13 11:23:19 4 + * @LastEditTime: 2025-06-13 11:41:59
5 * @FilePath: /mlaj/src/views/profile/SettingsPage.vue 5 * @FilePath: /mlaj/src/views/profile/SettingsPage.vue
6 * @Description: 用户设置页面 6 * @Description: 用户设置页面
7 --> 7 -->
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
92 <div class="flex items-center justify-between"> 92 <div class="flex items-center justify-between">
93 <div> 93 <div>
94 <h3 class="text-base font-medium text-gray-900">修改手机号</h3> 94 <h3 class="text-base font-medium text-gray-900">修改手机号</h3>
95 - <p class="text-sm text-gray-500">修改手机号</p> 95 + <p class="text-sm text-gray-500">{{ phone }}</p>
96 </div> 96 </div>
97 <ChevronRightIcon class="w-5 h-5 text-gray-400" /> 97 <ChevronRightIcon class="w-5 h-5 text-gray-400" />
98 </div> 98 </div>
...@@ -123,6 +123,9 @@ const userAvatar = ref(''); ...@@ -123,6 +123,9 @@ const userAvatar = ref('');
123 // 用户名 123 // 用户名
124 const username = ref(''); 124 const username = ref('');
125 125
126 +// 手机号
127 +const phone = ref('');
128 +
126 // 获取用户信息 129 // 获取用户信息
127 onMounted(async () => { 130 onMounted(async () => {
128 try { 131 try {
...@@ -130,6 +133,7 @@ onMounted(async () => { ...@@ -130,6 +133,7 @@ onMounted(async () => {
130 if (response.data) { 133 if (response.data) {
131 userAvatar.value = response.data.user.avatar; 134 userAvatar.value = response.data.user.avatar;
132 username.value = response.data.user.name; 135 username.value = response.data.user.name;
136 + phone.value = response.data.user.mobile;
133 } 137 }
134 } catch (error) { 138 } catch (error) {
135 console.error('获取用户信息失败:', error); 139 console.error('获取用户信息失败:', error);
......