<template>
|
<div class="h100 relative">
|
<div class="login-container flex h100">
|
<div class="login-left">
|
<div class="login-left-logo">
|
<img :src="logoMini" />
|
<div class="login-left-logo-text">
|
<span>{{ getThemeConfig.globalViceTitle }}</span>
|
<span class="login-left-logo-text-msg">{{ getThemeConfig.globalViceTitleMsg }}</span>
|
</div>
|
</div>
|
<div class="login-left-img">
|
<img :src="loginMain" />
|
</div>
|
<img :src="loginBg" class="login-left-waves" />
|
</div>
|
<div class="login-right flex">
|
<div class="login-right-warp flex-margin">
|
<span class="login-right-warp-one"></span>
|
<span class="login-right-warp-two"></span>
|
<div class="login-right-warp-mian">
|
<div class="login-right-warp-main-title">{{ getThemeConfig.globalTitle }} 欢迎您!</div>
|
<div class="login-right-warp-main-form">
|
<div v-if="!state.isScan">
|
<el-tabs v-model="state.tabsActiveName" @tab-change="handleTabChange">
|
<el-tab-pane :label="$t('message.label.one1')" name="account">
|
<Account @login="handleAfterLogin" />
|
</el-tab-pane>
|
<el-tab-pane :label="$t('message.label.two2')" name="mobile">
|
<Mobile @login="handleAfterLogin" />
|
</el-tab-pane>
|
<el-tab-pane label="微信" name="wechat">
|
<div id="wechat-login" class="flex justify-center items-center">
|
<div class="flex flex-col items-center justify-center">
|
<iframe
|
ref="wechatQrRef"
|
sandbox="allow-top-navigation allow-scripts"
|
style="width: 300px; height: 213px; overflow: hidden"
|
frameborder="0"
|
></iframe>
|
<span class="relative top-[-10px]" :class="{ 'text-red-400': wechatTip.type === 'error' }">{{
|
wechatTip.value
|
}}</span>
|
</div>
|
</div>
|
</el-tab-pane>
|
</el-tabs>
|
</div>
|
<Scan v-if="state.isScan" />
|
<div class="login-content-main-sacn" @click="scanClick">
|
<i class="iconfont" :class="state.isScan ? 'icon-diannao1' : 'icon-barcode-qr'"></i>
|
<div class="login-content-main-sacn-delta"></div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<LayoutFooter class="footer absolute" v-if="isFooter" />
|
</div>
|
</template>
|
|
<script setup lang="ts" name="loginIndex">
|
import { ElMessage } from 'element-plus';
|
import { storeToRefs } from 'pinia';
|
import { computed, defineAsyncComponent, nextTick, onMounted, reactive, ref } from 'vue';
|
import { useI18n } from 'vue-i18n';
|
import { useRoute } from 'vue-router';
|
import profileMan from '/@/assets/profile/man.svg';
|
import router from '/@/router';
|
import { initBackEndControlRoutes } from '/@/router/backEnd';
|
import { initFrontEndControlRoutes } from '/@/router/frontEnd';
|
import { useThemeConfig } from '/@/stores/themeConfig';
|
import { useUserInfo } from '/@/stores/userInfo';
|
import { NextLoading } from '/@/utils/loading';
|
import { accessSessionKey, clearAccessTokens } from '/@/utils/request';
|
import { Local } from '/@/utils/storage';
|
import { SERVE_URL } from '/@/constants';
|
import { useLogin } from '/@/hooks/useLogin';
|
|
const storesThemeConfig = useThemeConfig();
|
const { themeConfig } = storeToRefs(storesThemeConfig);
|
|
// 引入组件
|
const Account = defineAsyncComponent(() => import('/@/views/login/component/account.vue'));
|
const Mobile = defineAsyncComponent(() => import('/@/views/login/component/mobile.vue'));
|
const Scan = defineAsyncComponent(() => import('/@/views/login/component/scan.vue'));
|
const LayoutFooter = defineAsyncComponent(() => import('/@/layout/footer/index.vue'));
|
const route = useRoute();
|
|
|
// 设置 footer 显示/隐藏
|
const isFooter = computed(() => {
|
return themeConfig.value.isFooter && !route.meta.isIframe;
|
});
|
|
const getActiveLoginName = () => {
|
const isWechatLogin = Local.get('isWechatLogin');
|
if (isWechatLogin) {
|
Local.remove('isWechatLogin');
|
return 'wechat';
|
}
|
return 'account';
|
};
|
|
const state = reactive({
|
tabsActiveName: getActiveLoginName(),
|
isScan: false,
|
});
|
|
// 获取布局配置信息
|
const getThemeConfig = computed(() => {
|
return themeConfig.value;
|
});
|
const loginMain = window.globalConfig.SoftWareInfo.loginMain;
|
const logoMini = window.globalConfig.SoftWareInfo.logoMini;
|
const loginBg = window.globalConfig.SoftWareInfo.loginBg;
|
const { handleAfterLogin } = useLogin();
|
// 页面加载时
|
onMounted(() => {
|
NextLoading.done();
|
if (state.tabsActiveName === 'wechat') {
|
nextTick(() => {
|
openWechatLogin();
|
});
|
}
|
});
|
|
const scanClick = () => {
|
// state.isScan = !state.isScan;
|
return;
|
};
|
//#region ====================== 微信登陆 ======================
|
|
//切换用户登录页面
|
const handleTabChange = (item) => {
|
resetWechatTip();
|
switch (item) {
|
case 'wechat':
|
// getWechartQrCode();
|
openWechatLogin();
|
break;
|
case 'accountUser':
|
break;
|
case 'phoneUser':
|
break;
|
}
|
};
|
|
const getWechatTipInfo = () => {
|
const wechatLoginMsgInfo = Local.get('wechatLoginMsgInfo');
|
if (wechatLoginMsgInfo) {
|
Local.remove('wechatLoginMsgInfo');
|
return wechatLoginMsgInfo;
|
}
|
return { type: 'info', value: '使用微信扫一扫登陆' };
|
};
|
|
const wechatTip = ref(getWechatTipInfo());
|
|
const resetWechatTip = () => {
|
wechatTip.value = {
|
type: 'info',
|
value: '使用微信扫一扫登陆',
|
};
|
};
|
|
const wechatQrRef = ref<HTMLIFrameElement>();
|
|
const openWechatLogin = () => {
|
if (!wechatQrRef.value) return;
|
const url = `${SERVE_URL}JJJHHH/home?isWxLogin=Y`;
|
const appid = 'wx4ea2dca37170074c';
|
const state = (new Date().getTime() / 1000).toString();
|
const base64 = btoa(`
|
.impowerBox .title {display:none;}
|
|
.impowerBox .status.status_browser p:nth-of-type(2){
|
display: none;
|
}
|
|
.impowerBox .qrcode {
|
width: 170px;
|
margin-top:0;
|
|
}
|
.impowerBox .status{
|
}
|
.info{
|
display: none;
|
}
|
#tpl_for_iframe{
|
height:100%;
|
overflow: hidden;
|
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
}
|
|
`);
|
const wechatAuthUrl = `https://open.weixin.qq.com/connect/qrconnect?appid=${appid}&redirect_uri=${encodeURIComponent(
|
`http://apiv3.xpump.net/User/wxUserLoginCB.html?from=wi&url=${url}`
|
)}&response_type=code&scope=snsapi_login&state=${state}&href=data:text/css;base64,${base64}#wechat_redirect`;
|
wechatQrRef.value.src = wechatAuthUrl;
|
};
|
//#endregion
|
</script>
|
|
<style scoped lang="scss">
|
.login-container {
|
height: 100%;
|
background: var(--el-color-white);
|
.login-left {
|
flex: 1;
|
position: relative;
|
background-color: rgba(211, 239, 255, 1);
|
margin-right: 100px;
|
.login-left-logo {
|
display: flex;
|
align-items: center;
|
position: absolute;
|
top: 50px;
|
left: 80px;
|
z-index: 1;
|
animation: logoAnimation 0.3s ease;
|
img {
|
width: 52px;
|
height: 52px;
|
}
|
.login-left-logo-text {
|
display: flex;
|
flex-direction: column;
|
span {
|
margin-left: 10px;
|
font-size: 28px;
|
color: #26a59a;
|
}
|
.login-left-logo-text-msg {
|
font-size: 12px;
|
color: #32a99e;
|
}
|
}
|
}
|
.login-left-img {
|
position: absolute;
|
top: 50%;
|
left: 50%;
|
transform: translate(-50%, -50%);
|
width: 100%;
|
height: 52%;
|
img {
|
width: 100%;
|
height: 100%;
|
animation: error-num 0.6s ease;
|
}
|
}
|
.login-left-waves {
|
position: absolute;
|
top: 0;
|
right: -100px;
|
}
|
}
|
.login-right {
|
width: 700px;
|
.login-right-warp {
|
border: 1px solid var(--el-color-primary-light-3);
|
border-radius: 3px;
|
width: 500px;
|
height: 440px;
|
position: relative;
|
overflow: hidden;
|
background-color: var(--el-color-white);
|
.login-right-warp-one,
|
.login-right-warp-two {
|
position: absolute;
|
display: block;
|
width: inherit;
|
height: inherit;
|
&::before,
|
&::after {
|
content: '';
|
position: absolute;
|
z-index: 1;
|
}
|
}
|
.login-right-warp-one {
|
&::before {
|
filter: hue-rotate(0deg);
|
top: 0px;
|
left: 0;
|
width: 100%;
|
height: 3px;
|
background: linear-gradient(90deg, transparent, var(--el-color-primary));
|
animation: loginLeft 3s linear infinite;
|
}
|
&::after {
|
filter: hue-rotate(60deg);
|
top: -100%;
|
right: 2px;
|
width: 3px;
|
height: 100%;
|
background: linear-gradient(180deg, transparent, var(--el-color-primary));
|
animation: loginTop 3s linear infinite;
|
animation-delay: 0.7s;
|
}
|
}
|
.login-right-warp-two {
|
&::before {
|
filter: hue-rotate(120deg);
|
bottom: 2px;
|
right: -100%;
|
width: 100%;
|
height: 3px;
|
background: linear-gradient(270deg, transparent, var(--el-color-primary));
|
animation: loginRight 3s linear infinite;
|
animation-delay: 1.4s;
|
}
|
&::after {
|
filter: hue-rotate(300deg);
|
bottom: -100%;
|
left: 0px;
|
width: 3px;
|
height: 100%;
|
background: linear-gradient(360deg, transparent, var(--el-color-primary));
|
animation: loginBottom 3s linear infinite;
|
animation-delay: 2.1s;
|
}
|
}
|
.login-right-warp-mian {
|
display: flex;
|
flex-direction: column;
|
height: 100%;
|
.login-right-warp-main-title {
|
height: 130px;
|
line-height: 130px;
|
font-size: 27px;
|
text-align: center;
|
letter-spacing: 3px;
|
animation: logoAnimation 0.3s ease;
|
animation-delay: 0.3s;
|
color: var(--el-text-color-primary);
|
}
|
.login-right-warp-main-form {
|
flex: 1;
|
padding: 0 50px 50px;
|
.login-content-main-sacn {
|
position: absolute;
|
top: 0;
|
right: 0;
|
width: 50px;
|
height: 50px;
|
overflow: hidden;
|
cursor: pointer;
|
transition: all ease 0.3s;
|
color: var(--el-color-primary);
|
&-delta {
|
position: absolute;
|
width: 35px;
|
height: 70px;
|
z-index: 2;
|
top: 2px;
|
right: 21px;
|
background: var(--el-color-white);
|
transform: rotate(-45deg);
|
}
|
&:hover {
|
opacity: 1;
|
transition: all ease 0.3s;
|
color: var(--el-color-primary) !important;
|
}
|
i {
|
width: 47px;
|
height: 50px;
|
display: inline-block;
|
font-size: 48px;
|
position: absolute;
|
right: 1px;
|
top: 0px;
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
.footer {
|
bottom: 0;
|
}
|
</style>
|