yangfeng
2024-02-06 7edf66cafb871c5fb28911dfb02611ef5c9910b2
src/views/login/loginView.vue
@@ -78,11 +78,9 @@
const captchaId = ref('')
const getCaptchaData = () => {
  getCaptcha().then((rsp) => {
    if (rsp.code == 200) {
      captcha.value = rsp.data.picPath
      captchaId.value = rsp.data.captchaId
    }
  getCaptcha().then((rsp: any) => {
    captcha.value = rsp?.data?.picPath
    captchaId.value = rsp?.data?.captchaId
  })
}
onMounted(() => {
@@ -107,19 +105,17 @@
        password: ruleForm.pass,
        captcha: ruleForm.code,
        captchaId: captchaId.value
      }).then((rsp) => {
        if (rsp.code == 200) {
          console.log(rsp)
          setToken(rsp.data.token)
          ElMessage({
            message: '登录成功!',
            type: 'success'
          })
          ruleForm.accountNumber = ''
          ruleForm.pass = ''
          ruleForm.code = ''
          router.push('/')
        }
      }).then((rsp: any) => {
        console.log(rsp)
        setToken(rsp?.data?.token)
        ElMessage({
          message: '登录成功!',
          type: 'success'
        })
        ruleForm.accountNumber = ''
        ruleForm.pass = ''
        ruleForm.code = ''
        router.push('/')
      })
    } else {
      console.log('error submit!')