|
@@ -0,0 +1,62 @@
|
|
|
|
+<script lang="ts" setup>
|
|
|
|
+const formRef = ref<any>()
|
|
|
|
+const account = reactive({
|
|
|
|
+ name: '',
|
|
|
|
+ password: '',
|
|
|
|
+})
|
|
|
|
+const accountRules = {
|
|
|
|
+ name: [{ required: true, type: 'string', message: '请输入账号', trigger: ['blur', 'change'] }],
|
|
|
|
+ password: [
|
|
|
|
+ { required: true, type: 'string', message: '请输入密码', trigger: ['blur', 'change'] },
|
|
|
|
+ ],
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function loginAction(isKeep: boolean) {
|
|
|
|
+ // 是否通过了验证
|
|
|
|
+ formRef.value
|
|
|
|
+ ?.validate()
|
|
|
|
+ .then((res) => {
|
|
|
|
+ // 登录逻辑
|
|
|
|
+ })
|
|
|
|
+ .catch((err) => {
|
|
|
|
+ if (Array.isArray(err) && err.length) {
|
|
|
|
+ showToast(err[0].message)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+defineExpose({
|
|
|
|
+ loginAction,
|
|
|
|
+})
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<template>
|
|
|
|
+ <div class="panel-account">
|
|
|
|
+ <uv-form
|
|
|
|
+ ref="formRef"
|
|
|
|
+ labelPosition="left"
|
|
|
|
+ labelWidth="0"
|
|
|
|
+ :model="account"
|
|
|
|
+ :rules="accountRules"
|
|
|
|
+ >
|
|
|
|
+ <uv-form-item prop="name">
|
|
|
|
+ <uv-input
|
|
|
|
+ placeholder="请输入正确的账号"
|
|
|
|
+ prefixIcon="account"
|
|
|
|
+ size="large"
|
|
|
|
+ prefixIconStyle="font-size: 22px;color: #909399"
|
|
|
|
+ ></uv-input>
|
|
|
|
+ </uv-form-item>
|
|
|
|
+ <uv-form-item prop="password">
|
|
|
|
+ <uv-input
|
|
|
|
+ placeholder="请输入密码"
|
|
|
|
+ prefixIcon="lock"
|
|
|
|
+ type="password"
|
|
|
|
+ size="large"
|
|
|
|
+ prefixIconStyle="font-size: 22px;color: #909399"
|
|
|
|
+ ></uv-input>
|
|
|
|
+ </uv-form-item>
|
|
|
|
+ </uv-form>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<style lang="scss" scoped></style>
|