|
@@ -1,109 +1,118 @@
|
|
|
<template>
|
|
|
- <div id="index">
|
|
|
- <el-row>
|
|
|
- <el-col :span="24" class="main animate__animated animate__backInRight">
|
|
|
- <el-col :span="24" class="one w_1200">
|
|
|
- <el-col :span="24" class="one_1">{{ siteInfo.zhTitle }}</el-col>
|
|
|
- <el-col :span="24" class="one_2">
|
|
|
- <div class="login">
|
|
|
- <el-col :span="24" class="login_1"> 管理登录 </el-col>
|
|
|
- <el-col :span="24" class="login_2">
|
|
|
- <el-col :span="24" class="form">
|
|
|
- <el-form ref="formRef" :model="form" :rules="rules" label-width="auto">
|
|
|
- <!-- <el-form-item>
|
|
|
- <el-radio-group v-model="form.type" style="padding-left: 15px">
|
|
|
- <el-radio label="SelfUser">个人用户</el-radio>
|
|
|
- <el-radio label="Unit">企业用户</el-radio>
|
|
|
- <el-radio label="Research">科研单位</el-radio>
|
|
|
- <el-radio label="Admin">管理员</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item> -->
|
|
|
- <el-form-item label="" prop="account">
|
|
|
- <el-input v-model="form.account" placeholder="请输入登录账号">
|
|
|
- <template #prefix>
|
|
|
- <el-icon>
|
|
|
- <User />
|
|
|
- </el-icon>
|
|
|
- </template>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="" prop="password">
|
|
|
- <el-input v-model="form.password" type="password" show-password placeholder="请输入登录密码">
|
|
|
- <template #prefix>
|
|
|
- <el-icon>
|
|
|
- <Unlock />
|
|
|
- </el-icon>
|
|
|
- </template>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-col :span="24" class="btn">
|
|
|
- <el-button type="primary" @click="toSave(formRef)">提交登录</el-button>
|
|
|
- </el-col>
|
|
|
- </el-form>
|
|
|
- </el-col>
|
|
|
- </el-col>
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- </el-col>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <div class="login-container">
|
|
|
+ <!-- 登录表单 -->
|
|
|
+ <el-card class="card">
|
|
|
+ <div class="text">
|
|
|
+ <h2>{{ siteInfo.zhTitle }}</h2>
|
|
|
+ </div>
|
|
|
+ <el-form ref="loginFormRef" :model="loginData" :rules="loginRules" class="login-form">
|
|
|
+ <!-- 用户名 -->
|
|
|
+ <el-form-item prop="username">
|
|
|
+ <el-input v-model="loginData.username" size="large" placeholder="请输入登录账号">
|
|
|
+ <template #prefix>
|
|
|
+ <el-icon>
|
|
|
+ <User />
|
|
|
+ </el-icon>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- 密码 -->
|
|
|
+ <el-form-item prop="password">
|
|
|
+ <el-input v-model="loginData.password" size="large" type="password" show-password placeholder="请输入登录密码">
|
|
|
+ <template #prefix>
|
|
|
+ <el-icon>
|
|
|
+ <Unlock />
|
|
|
+ </el-icon>
|
|
|
+ </template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- 登录按钮 -->
|
|
|
+ <el-button :loading="loading" type="primary" size="large" class="button" @click.prevent="handleLogin">{{ $t('login.login') }} </el-button>
|
|
|
+ </el-form>
|
|
|
+ </el-card>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-<script setup lang="ts">
|
|
|
-import { toSave, formRef, form, rules } from './index';
|
|
|
-import { siteInfo } from '@/layout/site';
|
|
|
+<script setup>
|
|
|
+import { siteInfo } from '@/layout/site'
|
|
|
+// 接口
|
|
|
+import { LoginStore } from '@/store/api/login'
|
|
|
+import { useRoute } from 'vue-router'
|
|
|
+
|
|
|
+const route = useRoute()
|
|
|
+const loginStore = LoginStore()
|
|
|
+const loading = ref(false) // 按钮loading
|
|
|
+const loginFormRef = ref({}) // 登录表单ref
|
|
|
+const loginData = ref({
|
|
|
+ username: 'admin',
|
|
|
+ password: '123456'
|
|
|
+})
|
|
|
+const loginRules = computed(() => {})
|
|
|
+/**
|
|
|
+ * 登录
|
|
|
+ */
|
|
|
+function handleLogin() {
|
|
|
+ loginFormRef.value.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ loading.value = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
-.main {
|
|
|
+.login-container {
|
|
|
+ overflow-y: auto;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
display: flex;
|
|
|
- flex-direction: column;
|
|
|
- width: 100vw;
|
|
|
- height: 100vh;
|
|
|
- overflow: hidden;
|
|
|
- background: url('@/assets/bglogin.jpg');
|
|
|
- background-repeat: no-repeat;
|
|
|
- background-size: 100% 100%;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ background: url('@/assets/images/login-bg.jpg') no-repeat center right;
|
|
|
+
|
|
|
+ .login-form {
|
|
|
+ padding: 30px 10px 0 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .card {
|
|
|
+ width: 20%;
|
|
|
+ height: 50%;
|
|
|
+ border-radius: 15px;
|
|
|
+ padding: 20px;
|
|
|
+ box-shadow: var(--el-box-shadow-light);
|
|
|
|
|
|
- .one {
|
|
|
- .one_1 {
|
|
|
+ .text {
|
|
|
text-align: center;
|
|
|
- color: #ffffff;
|
|
|
- font-size: 30px;
|
|
|
- margin: 5% 0 40px 0;
|
|
|
}
|
|
|
|
|
|
- .one_2 {
|
|
|
- text-align: center;
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
+ .button {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.el-form-item {
|
|
|
+ background: var(--el-input-bg-color);
|
|
|
+ border: 1px solid var(--el-border-color);
|
|
|
+ border-radius: 5px;
|
|
|
+}
|
|
|
|
|
|
- .login {
|
|
|
- width: 500px;
|
|
|
- height: 500px;
|
|
|
- background-color: #ffffff;
|
|
|
- border-radius: 5px;
|
|
|
- padding: 10px;
|
|
|
+:deep(.el-input) {
|
|
|
+ padding: 5px;
|
|
|
|
|
|
- .login_1 {
|
|
|
- text-align: center;
|
|
|
- margin: 30px 0;
|
|
|
- font-size: 25px;
|
|
|
- color: #409eff;
|
|
|
- font-weight: 700;
|
|
|
- }
|
|
|
+ .el-input__wrapper {
|
|
|
+ padding: 0;
|
|
|
+ background-color: transparent;
|
|
|
+ box-shadow: none;
|
|
|
|
|
|
- .login_2 {
|
|
|
- .type {
|
|
|
- margin: 0 0 10px 0;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ &.is-focus,
|
|
|
+ &:hover {
|
|
|
+ box-shadow: none !important;
|
|
|
}
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
-:deep(.el-input-group__append, .el-input-group__prepend) {
|
|
|
- padding: 0;
|
|
|
+ input:-webkit-autofill {
|
|
|
+ /* 通过延时渲染背景色变相去除背景颜色 */
|
|
|
+ transition: background-color 1000s ease-in-out 0s;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|