|
|
@ -1,53 +1,62 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div class="login">
|
|
|
|
<div class="login" :class="loginClass">
|
|
|
|
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
|
|
|
|
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
|
|
|
|
<h3 class="title">甘蔗育种大数据平台</h3>
|
|
|
|
<h3 class="title">甘蔗育种大数据平台</h3>
|
|
|
|
|
|
|
|
<el-divider content-position="center">欢迎登录</el-divider>
|
|
|
|
<el-form-item prop="username">
|
|
|
|
<el-form-item prop="username">
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
v-model="loginForm.username"
|
|
|
|
v-model="loginForm.username"
|
|
|
|
type="text"
|
|
|
|
type="text"
|
|
|
|
size="large"
|
|
|
|
size="large"
|
|
|
|
auto-complete="off"
|
|
|
|
auto-complete="off"
|
|
|
|
placeholder="账号"
|
|
|
|
placeholder="账号"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
|
|
|
<template #prefix>
|
|
|
|
|
|
|
|
<svg-icon icon-class="user" class="el-input__icon input-icon"/>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</el-input>
|
|
|
|
</el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item prop="password">
|
|
|
|
<el-form-item prop="password">
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
v-model="loginForm.password"
|
|
|
|
v-model="loginForm.password"
|
|
|
|
type="password"
|
|
|
|
type="password"
|
|
|
|
size="large"
|
|
|
|
size="large"
|
|
|
|
auto-complete="off"
|
|
|
|
auto-complete="off"
|
|
|
|
placeholder="密码"
|
|
|
|
show-password
|
|
|
|
@keyup.enter="handleLogin"
|
|
|
|
placeholder="密码"
|
|
|
|
|
|
|
|
@keyup.enter="handleLogin"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
|
|
|
<template #prefix>
|
|
|
|
|
|
|
|
<svg-icon icon-class="password" class="el-input__icon input-icon"/>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</el-input>
|
|
|
|
</el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item prop="code" v-if="captchaEnabled">
|
|
|
|
<el-form-item prop="code" v-if="captchaEnabled">
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
v-model="loginForm.code"
|
|
|
|
v-model="loginForm.code"
|
|
|
|
size="large"
|
|
|
|
size="large"
|
|
|
|
auto-complete="off"
|
|
|
|
auto-complete="off"
|
|
|
|
placeholder="验证码"
|
|
|
|
placeholder="验证码"
|
|
|
|
style="width: 63%"
|
|
|
|
style="width: 63%"
|
|
|
|
@keyup.enter="handleLogin"
|
|
|
|
@keyup.enter="handleLogin"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
|
|
|
<template #prefix>
|
|
|
|
|
|
|
|
<svg-icon icon-class="validCode" class="el-input__icon input-icon"/>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</el-input>
|
|
|
|
</el-input>
|
|
|
|
<div class="login-code">
|
|
|
|
<div class="login-code">
|
|
|
|
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
|
|
|
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
|
|
|
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
|
|
|
<el-form-item style="width:100%;">
|
|
|
|
<el-form-item style="width:60%;margin: 20px auto">
|
|
|
|
<el-button
|
|
|
|
<el-button
|
|
|
|
:loading="loading"
|
|
|
|
round
|
|
|
|
size="large"
|
|
|
|
:loading="loading"
|
|
|
|
type="primary"
|
|
|
|
size="large"
|
|
|
|
style="width:100%;"
|
|
|
|
type="primary"
|
|
|
|
@click.prevent="handleLogin"
|
|
|
|
style="width:100%;"
|
|
|
|
|
|
|
|
@click.prevent="handleLogin"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<span v-if="!loading">登 录</span>
|
|
|
|
<span v-if="!loading">登 录</span>
|
|
|
|
<span v-else>登 录 中...</span>
|
|
|
|
<span v-else>登 录 中...</span>
|
|
|
@ -59,22 +68,28 @@
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
<!-- 底部 -->
|
|
|
|
<!-- 底部 -->
|
|
|
|
<div class="el-login-footer">
|
|
|
|
<div class="el-login-footer">
|
|
|
|
<span>Copyright © 2018-2024 ruoyi.vip All Rights Reserved.</span>
|
|
|
|
<span>中国科学院计算技术研究所 研制</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
<script setup>
|
|
|
|
import { getCodeImg } from "@/api/login";
|
|
|
|
import {getCodeImg} from "@/api/login";
|
|
|
|
import Cookies from "js-cookie";
|
|
|
|
import Cookies from "js-cookie";
|
|
|
|
import { encrypt, decrypt } from "@/utils/jsencrypt";
|
|
|
|
import {encrypt, decrypt} from "@/utils/jsencrypt";
|
|
|
|
import useUserStore from '@/store/modules/user'
|
|
|
|
import useUserStore from '@/store/modules/user'
|
|
|
|
|
|
|
|
import useAppStore from "@/store/modules/app.js";
|
|
|
|
|
|
|
|
import {useWindowSize} from "@vueuse/core";
|
|
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
const userStore = useUserStore()
|
|
|
|
const route = useRoute();
|
|
|
|
const route = useRoute();
|
|
|
|
const router = useRouter();
|
|
|
|
const router = useRouter();
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
const {proxy} = getCurrentInstance();
|
|
|
|
|
|
|
|
const {width, height} = useWindowSize();
|
|
|
|
|
|
|
|
const WIDTH = 992; // refer to Bootstrap's responsive design
|
|
|
|
|
|
|
|
const loginClass = computed(() => ({
|
|
|
|
|
|
|
|
desktop: width.value - 1 > WIDTH
|
|
|
|
|
|
|
|
}))
|
|
|
|
const loginForm = ref({
|
|
|
|
const loginForm = ref({
|
|
|
|
username: "admin",
|
|
|
|
username: "admin",
|
|
|
|
password: "admin123",
|
|
|
|
password: "admin123",
|
|
|
@ -84,9 +99,9 @@ const loginForm = ref({
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const loginRules = {
|
|
|
|
const loginRules = {
|
|
|
|
username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
|
|
|
|
username: [{required: true, trigger: "blur", message: "请输入您的账号"}],
|
|
|
|
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
|
|
|
password: [{required: true, trigger: "blur", message: "请输入您的密码"}],
|
|
|
|
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
|
|
|
code: [{required: true, trigger: "change", message: "请输入验证码"}]
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const codeUrl = ref("");
|
|
|
|
const codeUrl = ref("");
|
|
|
@ -98,8 +113,8 @@ const register = ref(false);
|
|
|
|
const redirect = ref(undefined);
|
|
|
|
const redirect = ref(undefined);
|
|
|
|
|
|
|
|
|
|
|
|
watch(route, (newRoute) => {
|
|
|
|
watch(route, (newRoute) => {
|
|
|
|
redirect.value = newRoute.query && newRoute.query.redirect;
|
|
|
|
redirect.value = newRoute.query && newRoute.query.redirect;
|
|
|
|
}, { immediate: true });
|
|
|
|
}, {immediate: true});
|
|
|
|
|
|
|
|
|
|
|
|
function handleLogin() {
|
|
|
|
function handleLogin() {
|
|
|
|
proxy.$refs.loginRef.validate(valid => {
|
|
|
|
proxy.$refs.loginRef.validate(valid => {
|
|
|
@ -107,9 +122,9 @@ function handleLogin() {
|
|
|
|
loading.value = true;
|
|
|
|
loading.value = true;
|
|
|
|
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
|
|
|
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
|
|
|
if (loginForm.value.rememberMe) {
|
|
|
|
if (loginForm.value.rememberMe) {
|
|
|
|
Cookies.set("username", loginForm.value.username, { expires: 30 });
|
|
|
|
Cookies.set("username", loginForm.value.username, {expires: 30});
|
|
|
|
Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 });
|
|
|
|
Cookies.set("password", encrypt(loginForm.value.password), {expires: 30});
|
|
|
|
Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 });
|
|
|
|
Cookies.set("rememberMe", loginForm.value.rememberMe, {expires: 30});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// 否则移除
|
|
|
|
// 否则移除
|
|
|
|
Cookies.remove("username");
|
|
|
|
Cookies.remove("username");
|
|
|
@ -125,7 +140,7 @@ function handleLogin() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
return acc;
|
|
|
|
}, {});
|
|
|
|
}, {});
|
|
|
|
router.push({ path: redirect.value || "/", query: otherQueryParams });
|
|
|
|
router.push({path: redirect.value || "/", query: otherQueryParams});
|
|
|
|
}).catch(() => {
|
|
|
|
}).catch(() => {
|
|
|
|
loading.value = false;
|
|
|
|
loading.value = false;
|
|
|
|
// 重新获取验证码
|
|
|
|
// 重新获取验证码
|
|
|
@ -168,11 +183,24 @@ getCookie();
|
|
|
|
justify-content: center;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
align-items: center;
|
|
|
|
height: 100%;
|
|
|
|
height: 100%;
|
|
|
|
background-image: url("../assets/images/login-background.jpg");
|
|
|
|
//背景图片居中显示
|
|
|
|
|
|
|
|
background-position: center;
|
|
|
|
|
|
|
|
//登录页背景图片
|
|
|
|
|
|
|
|
background-image: url("../assets/images/v2_rxo8qp.png") ;
|
|
|
|
background-size: cover;
|
|
|
|
background-size: cover;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//pc网页登录控件居右
|
|
|
|
|
|
|
|
.desktop {
|
|
|
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
|
|
|
.el-form {
|
|
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
right: 10%;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.title {
|
|
|
|
.title {
|
|
|
|
margin: 0px auto 30px auto;
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
|
|
margin: 20px auto 50px auto;
|
|
|
|
text-align: center;
|
|
|
|
text-align: center;
|
|
|
|
color: #707070;
|
|
|
|
color: #707070;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -182,46 +210,56 @@ getCookie();
|
|
|
|
background: #ffffff;
|
|
|
|
background: #ffffff;
|
|
|
|
width: 400px;
|
|
|
|
width: 400px;
|
|
|
|
padding: 25px 25px 5px 25px;
|
|
|
|
padding: 25px 25px 5px 25px;
|
|
|
|
|
|
|
|
|
|
|
|
.el-input {
|
|
|
|
.el-input {
|
|
|
|
height: 40px;
|
|
|
|
height: 40px;
|
|
|
|
|
|
|
|
|
|
|
|
input {
|
|
|
|
input {
|
|
|
|
height: 40px;
|
|
|
|
height: 40px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.input-icon {
|
|
|
|
.input-icon {
|
|
|
|
height: 39px;
|
|
|
|
height: 39px;
|
|
|
|
width: 14px;
|
|
|
|
width: 14px;
|
|
|
|
margin-left: 0px;
|
|
|
|
margin-left: 0px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-tip {
|
|
|
|
.login-tip {
|
|
|
|
font-size: 13px;
|
|
|
|
font-size: 13px;
|
|
|
|
text-align: center;
|
|
|
|
text-align: center;
|
|
|
|
color: #bfbfbf;
|
|
|
|
color: #bfbfbf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-code {
|
|
|
|
.login-code {
|
|
|
|
width: 33%;
|
|
|
|
width: 33%;
|
|
|
|
height: 40px;
|
|
|
|
height: 40px;
|
|
|
|
float: right;
|
|
|
|
float: right;
|
|
|
|
|
|
|
|
|
|
|
|
img {
|
|
|
|
img {
|
|
|
|
cursor: pointer;
|
|
|
|
cursor: pointer;
|
|
|
|
vertical-align: middle;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-login-footer {
|
|
|
|
.el-login-footer {
|
|
|
|
height: 40px;
|
|
|
|
height: 40px;
|
|
|
|
line-height: 40px;
|
|
|
|
line-height: 40px;
|
|
|
|
position: fixed;
|
|
|
|
position: fixed;
|
|
|
|
bottom: 0;
|
|
|
|
bottom: 10px;
|
|
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
width: 100%;
|
|
|
|
width: 100%;
|
|
|
|
text-align: center;
|
|
|
|
text-align: center;
|
|
|
|
color: #fff;
|
|
|
|
color: #fff;
|
|
|
|
font-family: Arial;
|
|
|
|
font-family: Arial;
|
|
|
|
font-size: 12px;
|
|
|
|
font-size: 18px;
|
|
|
|
letter-spacing: 1px;
|
|
|
|
letter-spacing: 1px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-code-img {
|
|
|
|
.login-code-img {
|
|
|
|
height: 40px;
|
|
|
|
height: 40px;
|
|
|
|
padding-left: 12px;
|
|
|
|
padding-left: 12px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|