<template>
|
<div class="login">
|
<login-form ref="loginRef"/>
|
<!-- 底部 -->
|
<div class="el-login-footer">
|
<span>Copyright ©2023-{{nowYear}} All Rights Reserved.</span>
|
</div>
|
</div>
|
</template>
|
|
<script setup>
|
import {onMounted, ref, reactive, watch, defineAsyncComponent, nextTick, onUnmounted} from "vue"
|
import useUserStore from '@/store/modules/user'
|
import LoginForm from './components/loginForm'
|
const { proxy } = getCurrentInstance()
|
const route = useRoute()
|
const router = useRouter()
|
const nowYear = ref();
|
// 时间格式化
|
const timeForm = {
|
hour12: false,
|
year: 'numeric',
|
month: '2-digit',
|
day: '2-digit',
|
hour: '2-digit',
|
minute: '2-digit',
|
second: '2-digit'
|
}
|
|
const noticeRef = ref(null)
|
|
const state = reactive({
|
activeMenu: 1,
|
date: '',
|
weekDay: '',
|
dayTime: '',
|
checkDetails: false
|
})
|
|
// 当前时间
|
const getDateTime = () => {
|
const curTime = new Date().toLocaleString('zh', timeForm).replace(/\//g, '-');
|
state.date = curTime.slice(0, 10);
|
nowYear.value = curTime.slice(0, 4);
|
let week = ['日', '一', '二', '三', '四', '五', '六'];
|
let day = new Date().getDay();
|
state.weekDay = '星期' + week[day];
|
let curHour = Number(curTime.slice(10, 13));
|
if (curHour >= 5 && curHour <= 10) {
|
state.dayTime = '上午';
|
}
|
if (curHour > 10 && curHour <= 12) {
|
state.dayTime = '中午';
|
}
|
if (curHour > 12 && curHour <= 18) {
|
state.dayTime = '下午';
|
}
|
if (curHour > 18 && curHour <= 22) {
|
state.dayTime = '晚上';
|
}
|
if (curHour > 22) {
|
state.dayTime = '午夜';
|
}
|
};
|
|
|
const redirect = ref(undefined);
|
|
onMounted(()=>{
|
getDateTime();
|
})
|
|
onUnmounted(()=>{
|
|
})
|
|
watch(route, (newRoute) => {
|
redirect.value = newRoute.query && newRoute.query.redirect;
|
}, { immediate: true });
|
|
</script>
|
|
<style lang='scss' scoped>
|
.login {
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
height: 100%;
|
}
|
|
.el-login-footer {
|
height: 40px;
|
line-height: 40px;
|
position: fixed;
|
bottom: 0;
|
width: 100%;
|
text-align: center;
|
color: #fff;
|
font-size: 12px;
|
letter-spacing: 1px;
|
}
|
</style>
|