|
|
|
@ -30,9 +30,9 @@ |
|
|
|
|
</el-form> |
|
|
|
|
<!-- <div class="submit gradient" @click="submit">登录</div> --> |
|
|
|
|
<div class="btn"> |
|
|
|
|
<div @click="Router.push('/')">返回首页</div> |
|
|
|
|
<div class="gradient" @click="submit">登录</div> |
|
|
|
|
</div> |
|
|
|
|
<div @click="Router.push('/')">返回首页</div> |
|
|
|
|
<div class="gradient" @click="submit">登录</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="registered"> |
|
|
|
|
还没账号? |
|
|
|
@ -48,7 +48,7 @@ import { onMounted, reactive, ref, toRefs, watch } from 'vue' |
|
|
|
|
import { getCode } from '@/api/user' |
|
|
|
|
import userStore from '@/store/module/user' |
|
|
|
|
import { ElMessage } from 'element-plus' |
|
|
|
|
import { useRouter,useRoute } from 'vue-router' |
|
|
|
|
import { useRouter, useRoute } from 'vue-router' |
|
|
|
|
import RegisTered from './registered.vue' |
|
|
|
|
const route = useRoute() |
|
|
|
|
const useUserStore = userStore() |
|
|
|
@ -80,17 +80,20 @@ const submit = async () => { |
|
|
|
|
password: form.value.password, |
|
|
|
|
username: form.value.account, |
|
|
|
|
} |
|
|
|
|
const res = await useUserStore.login(data) |
|
|
|
|
console.log(res) |
|
|
|
|
|
|
|
|
|
if (res === 0) { |
|
|
|
|
ElMessage('验证码错误') |
|
|
|
|
getcodeinfo() |
|
|
|
|
} else if (res === 1) { |
|
|
|
|
ElMessage('账号或密码错误') |
|
|
|
|
getcodeinfo() |
|
|
|
|
} else { |
|
|
|
|
Router.push('/') |
|
|
|
|
try { |
|
|
|
|
const res = await useUserStore.login(data) |
|
|
|
|
console.log(res) |
|
|
|
|
if (res === 0) { |
|
|
|
|
ElMessage('验证码错误') |
|
|
|
|
getcodeinfo() |
|
|
|
|
} else if (res === 1) { |
|
|
|
|
ElMessage('账号或密码错误') |
|
|
|
|
getcodeinfo() |
|
|
|
|
} else { |
|
|
|
|
Router.push('/') |
|
|
|
|
} |
|
|
|
|
} catch (error: any) { |
|
|
|
|
ElMessage(error.data.message) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
onMounted(() => { |
|
|
|
@ -98,7 +101,7 @@ onMounted(() => { |
|
|
|
|
// setTimeout(() => { |
|
|
|
|
// getcodeinfo() |
|
|
|
|
// },6000) |
|
|
|
|
if(route.query.registered){ |
|
|
|
|
if (route.query.registered) { |
|
|
|
|
registered() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -191,26 +194,26 @@ const backLoginEvent = () => { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.btn { |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: space-between; |
|
|
|
|
margin-top: 45px; |
|
|
|
|
div { |
|
|
|
|
width: 210px; |
|
|
|
|
height: 42px; |
|
|
|
|
text-align: center; |
|
|
|
|
line-height: 42px; |
|
|
|
|
font-size: 14px; |
|
|
|
|
cursor: pointer; |
|
|
|
|
border-radius: 10px; |
|
|
|
|
} |
|
|
|
|
div:nth-child(1) { |
|
|
|
|
border: 1px solid #dbdbdb; |
|
|
|
|
color: #3c3c3c; |
|
|
|
|
} |
|
|
|
|
div:nth-child(2) { |
|
|
|
|
color: #fff; |
|
|
|
|
} |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: space-between; |
|
|
|
|
margin-top: 45px; |
|
|
|
|
div { |
|
|
|
|
width: 210px; |
|
|
|
|
height: 42px; |
|
|
|
|
text-align: center; |
|
|
|
|
line-height: 42px; |
|
|
|
|
font-size: 14px; |
|
|
|
|
cursor: pointer; |
|
|
|
|
border-radius: 10px; |
|
|
|
|
} |
|
|
|
|
div:nth-child(1) { |
|
|
|
|
border: 1px solid #dbdbdb; |
|
|
|
|
color: #3c3c3c; |
|
|
|
|
} |
|
|
|
|
div:nth-child(2) { |
|
|
|
|
color: #fff; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
:deep(.el-form-item) { |
|
|
|
|
display: flex; |
|
|
|
|
flex-direction: column; |
|
|
|
|