refactor(用户设置): 更新API调用以匹配后端接口变更
在登录页面中,将手机号输入框的类型从`text`改为`tel`,并将自动完成属性从`mobile`改为`tel`,以提升用户体验。在密码设置页面中,将`updatePasswordAPI`改为`resetPasswordAPI`,以匹配后端接口的更新。在头像设置页面中,将`uploadAvatarAPI`改为`updateUserInfoAPI`,以统一用户信息更新接口。
Showing
3 changed files
with
8 additions
and
8 deletions
| ... | @@ -20,8 +20,8 @@ | ... | @@ -20,8 +20,8 @@ |
| 20 | id="mobile" | 20 | id="mobile" |
| 21 | v-model="mobile" | 21 | v-model="mobile" |
| 22 | name="mobile" | 22 | name="mobile" |
| 23 | - type="text" | 23 | + type="tel" |
| 24 | - autocomplete="mobile" | 24 | + autocomplete="tel" |
| 25 | required | 25 | required |
| 26 | class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-green-500 focus:border-green-500" | 26 | class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-green-500 focus:border-green-500" |
| 27 | /> | 27 | /> | ... | ... |
| 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-03-24 13:32:25 | 4 | + * @LastEditTime: 2025-03-26 00:46:59 |
| 5 | * @FilePath: /mlaj/src/views/profile/settings/AvatarSettingPage.vue | 5 | * @FilePath: /mlaj/src/views/profile/settings/AvatarSettingPage.vue |
| 6 | * @Description: 修改头像页面 | 6 | * @Description: 修改头像页面 |
| 7 | --> | 7 | --> |
| ... | @@ -54,7 +54,7 @@ | ... | @@ -54,7 +54,7 @@ |
| 54 | import { ref, onMounted } from "vue"; | 54 | import { ref, onMounted } from "vue"; |
| 55 | import AppLayout from "@/components/layout/AppLayout.vue"; | 55 | import AppLayout from "@/components/layout/AppLayout.vue"; |
| 56 | import FrostedGlass from "@/components/ui/FrostedGlass.vue"; | 56 | import FrostedGlass from "@/components/ui/FrostedGlass.vue"; |
| 57 | -import { getUserInfoAPI, uploadAvatarAPI } from "@/api/users"; | 57 | +import { getUserInfoAPI, updateUserInfoAPI } from "@/api/users"; |
| 58 | 58 | ||
| 59 | import { useTitle } from '@vueuse/core'; | 59 | import { useTitle } from '@vueuse/core'; |
| 60 | 60 | ||
| ... | @@ -83,7 +83,7 @@ const handleAvatarChange = async (file) => { | ... | @@ -83,7 +83,7 @@ const handleAvatarChange = async (file) => { |
| 83 | const formData = new FormData(); | 83 | const formData = new FormData(); |
| 84 | formData.append("avatar", file); | 84 | formData.append("avatar", file); |
| 85 | 85 | ||
| 86 | - const response = await uploadAvatarAPI(formData); | 86 | + const response = await updateUserInfoAPI(formData); |
| 87 | if (response.data) { | 87 | if (response.data) { |
| 88 | userAvatar.value = response.data.url; | 88 | userAvatar.value = response.data.url; |
| 89 | alert("头像上传成功"); | 89 | alert("头像上传成功"); | ... | ... |
| 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-03-24 13:19:54 | 4 | + * @LastEditTime: 2025-03-26 00:49:20 |
| 5 | * @FilePath: /mlaj/src/views/profile/settings/PasswordSettingPage.vue | 5 | * @FilePath: /mlaj/src/views/profile/settings/PasswordSettingPage.vue |
| 6 | * @Description: 修改密码页面 | 6 | * @Description: 修改密码页面 |
| 7 | --> | 7 | --> |
| ... | @@ -62,7 +62,7 @@ | ... | @@ -62,7 +62,7 @@ |
| 62 | import { ref } from 'vue'; | 62 | import { ref } from 'vue'; |
| 63 | import AppLayout from '@/components/layout/AppLayout.vue'; | 63 | import AppLayout from '@/components/layout/AppLayout.vue'; |
| 64 | import FrostedGlass from '@/components/ui/FrostedGlass.vue'; | 64 | import FrostedGlass from '@/components/ui/FrostedGlass.vue'; |
| 65 | -import { updatePasswordAPI } from '@/api/users'; | 65 | +import { resetPasswordAPI } from '@/api/users'; |
| 66 | 66 | ||
| 67 | import { useTitle } from '@vueuse/core'; | 67 | import { useTitle } from '@vueuse/core'; |
| 68 | 68 | ||
| ... | @@ -82,7 +82,7 @@ const validateConfirmPassword = (val) => val === newPassword.value; | ... | @@ -82,7 +82,7 @@ const validateConfirmPassword = (val) => val === newPassword.value; |
| 82 | const handlePasswordChange = async () => { | 82 | const handlePasswordChange = async () => { |
| 83 | loading.value = true; | 83 | loading.value = true; |
| 84 | try { | 84 | try { |
| 85 | - const response = await updatePasswordAPI({ | 85 | + const response = await resetPasswordAPI({ |
| 86 | oldPassword: oldPassword.value, | 86 | oldPassword: oldPassword.value, |
| 87 | newPassword: newPassword.value | 87 | newPassword: newPassword.value |
| 88 | }); | 88 | }); | ... | ... |
-
Please register or login to post a comment