fix(deps): 去除图片验证码依赖

This commit is contained in:
Soybean
2021-11-01 11:36:02 +08:00
parent 0ec4d218e3
commit 76a1afae4e
6 changed files with 22 additions and 168 deletions

View File

@ -7,17 +7,6 @@
<n-form-item path="pwd">
<n-input v-model:value="model.pwd" placeholder="密码" />
</n-form-item>
<n-form-item path="isCaptcha">
<div class="w-full">
<mi-captcha
:theme-color="theme.themeColor"
:bg-color="themeVars.inputColor"
:text-color="themeVars.textColorBase"
:logo="logo"
@success="handleCaptcha"
/>
</div>
</n-form-item>
<n-space :vertical="true" size="large">
<div class="flex-y-center justify-between">
<n-checkbox v-model:checked="rememberMe">记住我</n-checkbox>
@ -43,27 +32,22 @@
<script lang="ts" setup>
import { reactive, ref } from 'vue';
import { NForm, NFormItem, NInput, NSpace, NCheckbox, NButton, useNotification, useThemeVars } from 'naive-ui';
import { NForm, NFormItem, NInput, NSpace, NCheckbox, NButton, useNotification } from 'naive-ui';
import type { FormInst, FormRules } from 'naive-ui';
import { EnumLoginModule } from '@/enum';
import { useThemeStore } from '@/store';
import { useRouterChange, useRouteQuery, useLoading } from '@/hooks';
import { setToken } from '@/utils';
import { OtherLogin } from './components';
import logo from '@/assets/img/common/logo.png';
const theme = useThemeStore();
const { toHome, toCurrentLogin, toLoginRedirectUrl } = useRouterChange();
const { loginRedirectUrl } = useRouteQuery();
const { loading, startLoading, endLoading } = useLoading();
const notification = useNotification();
const themeVars = useThemeVars();
const formRef = ref<(HTMLElement & FormInst) | null>(null);
const model = reactive({
phone: '15100000000',
pwd: '123456',
isCaptcha: false
pwd: '123456'
});
const rules: FormRules = {
phone: {
@ -75,21 +59,10 @@ const rules: FormRules = {
required: true,
trigger: ['blur', 'input'],
message: '请输入密码'
},
isCaptcha: {
required: true,
type: 'boolean',
trigger: 'change',
message: '请点击按钮进行验证码校验',
validator: (_, value) => value === true
}
};
const rememberMe = ref(false);
function handleCaptcha() {
model.isCaptcha = true;
}
function handleSubmit(e: MouseEvent) {
if (!formRef.value) return;
e.preventDefault();