|
@@ -2,28 +2,26 @@
|
|
|
<sign-layout class="user-login" :title="t('auth.login.title')">
|
|
<sign-layout class="user-login" :title="t('auth.login.title')">
|
|
|
<el-form ref="formRef" :model="formData" :rules="formRules">
|
|
<el-form ref="formRef" :model="formData" :rules="formRules">
|
|
|
<el-form-item prop="accountCode">
|
|
<el-form-item prop="accountCode">
|
|
|
- <el-input :placeholder="t('auth.login.accountCode')" v-model="formData.accountCode"></el-input>
|
|
|
|
|
|
|
+ <el-input :placeholder="t('auth.login.accountCode')" v-model="formData.accountCode" size="large" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item prop="password">
|
|
<el-form-item prop="password">
|
|
|
- <el-input type="password" :placeholder="t('auth.login.password')" v-model="formData.password">
|
|
|
|
|
- </el-input>
|
|
|
|
|
|
|
+ <el-input type="password" :placeholder="t('auth.login.password')" v-model="formData.password" size="large" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item prop="verifyCode">
|
|
<el-form-item prop="verifyCode">
|
|
|
- <el-input :placeholder="t('auth.login.verifyCode')" v-model="formData.verifyCode">
|
|
|
|
|
- <template #append>
|
|
|
|
|
- <img :src="verifyImage" />
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-input>
|
|
|
|
|
|
|
+ <div class="el-form-item--col">
|
|
|
|
|
+ <el-input :placeholder="t('auth.login.verifyCode')" v-model="formData.verifyCode" size="large" />
|
|
|
|
|
+ <el-image :src="verifyImage" style="width: 180px; height: 38px; cursor: pointer;" @click="run()"
|
|
|
|
|
+ v-if="verifyImage" />
|
|
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<!-- <el-form-item>
|
|
<!-- <el-form-item>
|
|
|
- <el-checkbox label="记住账号" v-model="remember"></el-checkbox>
|
|
|
|
|
|
|
+ <el-checkbox label="记住密码" v-model="remember"></el-checkbox>
|
|
|
</el-form-item> -->
|
|
</el-form-item> -->
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
<el-button class="submit" type="primary" :loading="loading" @click="formSubmit">
|
|
<el-button class="submit" type="primary" :loading="loading" @click="formSubmit">
|
|
|
<span v-if="loading">{{ t('auth.login.loading') }}</span>
|
|
<span v-if="loading">{{ t('auth.login.loading') }}</span>
|
|
|
<span v-else>{{ t('operation.login') }}</span>
|
|
<span v-else>{{ t('operation.login') }}</span>
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- <!-- <el-button>注册</el-button> -->
|
|
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</sign-layout>
|
|
</sign-layout>
|
|
@@ -33,6 +31,7 @@
|
|
|
import { shallowRef } from 'vue'
|
|
import { shallowRef } from 'vue'
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
import { ElMessage, FormInstance, FormRules } from 'element-plus'
|
|
import { ElMessage, FormInstance, FormRules } from 'element-plus'
|
|
|
|
|
+import { useRequest } from '@/hooks/request'
|
|
|
import { verifyCode } from '@/services/api/user'
|
|
import { verifyCode } from '@/services/api/user'
|
|
|
import { useLogin } from '@/business/login'
|
|
import { useLogin } from '@/business/login'
|
|
|
import { useRouterStore, i18n } from '@/stores'
|
|
import { useRouterStore, i18n } from '@/stores'
|
|
@@ -59,11 +58,19 @@ const formRules: FormRules = {
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const { run } = useRequest(verifyCode, {
|
|
|
|
|
+ manual: true,
|
|
|
|
|
+ onSuccess: (res) => {
|
|
|
|
|
+ formData.key = res.data.key
|
|
|
|
|
+ verifyImage.value = res.data.img
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
const formSubmit = () => {
|
|
const formSubmit = () => {
|
|
|
- loading.value = true
|
|
|
|
|
formRef.value?.validate(async (valid) => {
|
|
formRef.value?.validate(async (valid) => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
try {
|
|
try {
|
|
|
|
|
+ loading.value = true
|
|
|
await userLogin()
|
|
await userLogin()
|
|
|
await menuStore.getUserRoutes()
|
|
await menuStore.getUserRoutes()
|
|
|
const redirect = route.query.redirect
|
|
const redirect = route.query.redirect
|
|
@@ -80,14 +87,5 @@ const formSubmit = () => {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-service.onReady().then(() => {
|
|
|
|
|
- verifyCode().then(({ data }) => {
|
|
|
|
|
- formData.key = data.key
|
|
|
|
|
- verifyImage.value = data.img
|
|
|
|
|
- })
|
|
|
|
|
-})
|
|
|
|
|
-</script>
|
|
|
|
|
-
|
|
|
|
|
-<style lang="less" scoped>
|
|
|
|
|
-@import './index.less';
|
|
|
|
|
-</style>
|
|
|
|
|
|
|
+service.onReady().then(() => run())
|
|
|
|
|
+</script>
|