123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <template>
- <el-dialog
- v-model="visible"
- :title="L['loginDialog']['登录']"
- width="500px"
- :before-close="handleClose"
- align-center
- modal-class="login-dialog-model"
- >
- <div class="login-form">
- <el-form :model="form" ref="formRef" label-position="top">
- <el-form-item :label="L['loginDialog']['邮箱']">
- <el-input v-model="form.email" clearable />
- </el-form-item>
- <el-form-item class="item-password" :label="L['loginDialog']['密码']">
- <el-input v-model="form.password" show-password type="password" />
- <div class="actions">
- <el-button type="text" @click="onForgotPassword"
- >{{ L['忘记密码'] }}</el-button
- >
- </div>
- </el-form-item>
- </el-form>
- </div>
- <div class="login-bottom">
- <el-button class="login-btn" @click="onLogin" round>{{ L['loginDialog']['登录'] }}</el-button>
- <el-button type="default" class="register-btn" @click="onRegister" round
- >{{ L['注册'] }}</el-button
- >
- </div>
- </el-dialog>
- </template>
- <script setup>
- import { ref, reactive, defineExpose } from "vue";
- const L = getCurLanguage();
- const visible = ref(false);
- const form = reactive({
- email: "",
- password: "",
- });
- const emit = defineEmits(["login", "register", "forgot", "close"]);
- function open() {
- visible.value = true;
- }
- function close() {
- visible.value = false;
- }
- function handleClose() {
- close();
- emit("close");
- }
- function onLogin() {
- emit("login", { ...form });
- close();
- }
- function onRegister() {
- emit("register");
- close();
- }
- function onForgotPassword() {
- emit("forgot");
- }
- defineExpose({ open });
- </script>
- <style lang="scss">
- .login-dialog-model {
- .el-dialog__body {
- padding: 20px 40px;
- }
- }
- </style>
- <style lang="scss" scoped>
- .login-form {
- display: flex;
- justify-content: center;
- :deep(.el-input) {
- width: 300px;
- }
- :deep(.el-input__inner) {
- height: 40px;
- }
- .item-password {
- position: relative;
- .actions {
- position: absolute;
- right: 0;
- top: -35px;
- .el-button {
- color: #606266;
- }
- }
- }
- }
- .login-bottom {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- :deep(.el-button) {
- width: 300px;
- height: 35px;
- margin-left: 0;
- margin-top: 10px;
- }
- .login-btn {
- background-color: $colorMain;
- color: #fff;
- }
- .register-btn {
- &:hover {
- color: $colorMain;
- }
- }
- }
- </style>
|