feat: QQLogin

This commit is contained in:
手瓜一十雪
2024-11-14 22:02:15 +08:00
parent 15a12d0421
commit ce91bb2d7c
6 changed files with 204 additions and 58 deletions

View File

@@ -3,7 +3,7 @@
<h2>WebUi Login</h2>
<t-form ref="form" :data="formData" :colon="true" :label-width="0" @submit="onSubmit">
<t-form-item name="password">
<t-input v-model="formData.password" type="password" clearable placeholder="请输入Token">
<t-input v-model="formData.token" type="password" clearable placeholder="请输入Token">
<template #prefix-icon>
<lock-on-icon />
</template>
@@ -13,7 +13,6 @@
<t-button theme="primary" type="submit" block>登录</t-button>
</t-form-item>
</t-form>
<p class="error-message" v-if="errorMessage">{{ errorMessage }}</p>
</div>
</template>
@@ -22,22 +21,16 @@ import { reactive, ref } from 'vue';
import { MessagePlugin } from 'tdesign-vue-next';
import { LockOnIcon } from 'tdesign-icons-vue-next';
const formData = reactive({
password: '',
});
const errorMessage = ref('');
const formData = reactive({
token: '',
});
const onSubmit = async ({ validateResult, firstError }) => {
if (validateResult === true) {
errorMessage.value = '';
try {
// 处理表单提交逻辑
} catch (error) {
errorMessage.value = '登录失败,请重试';
}
MessagePlugin.success('登录中...');
} else {
errorMessage.value = firstError;
MessagePlugin.error('登录失败');
}
};
</script>