Browse Source

fix: 修改密码登录后只可以修改自己的账号密码

liangan 1 month ago
parent
commit
8e6f65ae77
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/pages/forgotPassword/forgotPassword.vue

+ 4 - 3
src/pages/forgotPassword/forgotPassword.vue

@@ -17,8 +17,9 @@ import { toast } from '@/utils/toast'
 defineOptions({
   name: 'ForgotPassword', // 忘记密码
 })
+
+const userStore = useUserStore()
 const isLogined = computed(() => {
-  const userStore = useUserStore()
   return !!userStore.token
 })
 
@@ -31,12 +32,11 @@ const step = ref(1)
 
 // 表单数据
 const formData = ref({
-  phone: '',
+  phone: isLogined.value ? userStore.userInfo.phoneNo : '',
   verifyCode: '',
   newPwd: '',
   confirmPwd: '',
 })
-
 // 验证码倒计时
 const countdown = ref(0)
 const countdownTimer = ref<any>(null)
@@ -244,6 +244,7 @@ onUnmounted(() => {
               prop="phone"
               :placeholder="t('auth.forgotPassword.phone.placeholder')"
               no-border
+              :readonly="isLogined"
               type="number"
               custom-class="flex-1"
             />