|
@@ -1,64 +1,64 @@
|
|
|
<template>
|
|
|
<div class="login">
|
|
|
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
|
|
|
- <h3 class="title">智慧应急工作台</h3>
|
|
|
- <el-form-item v-if="tenantEnabled" prop="tenantId">
|
|
|
- <el-select v-model="loginForm.tenantId" filterable placeholder="请选择/输入公司名称" style="width: 100%">
|
|
|
- <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"></el-option>
|
|
|
- <template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="username">
|
|
|
- <el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
|
|
|
- <template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="password">
|
|
|
- <el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码" @keyup.enter="handleLogin">
|
|
|
- <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item v-if="captchaEnabled" prop="code">
|
|
|
- <el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="验证码" style="width: 63%" @keyup.enter="handleLogin">
|
|
|
- <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
|
|
- </el-input>
|
|
|
- <div class="login-code">
|
|
|
- <img :src="codeUrl" class="login-code-img" @click="getCode" />
|
|
|
+ <div class="title">欢迎登录</div>
|
|
|
+ <div class="title2">智慧应急工作台</div>
|
|
|
+ <div class="login-box">
|
|
|
+ <div class="login-tabs">
|
|
|
+ <div v-for="(item, index) in tabs" :key="index" :class="tabActive === index ? 'login-tab tab-active' : 'login-tab'">{{ item }}</div>
|
|
|
</div>
|
|
|
- </el-form-item>
|
|
|
- <el-checkbox v-model="loginForm.rememberMe" style="margin: 0 0 25px 0">记住密码</el-checkbox>
|
|
|
- <!--
|
|
|
- <el-form-item style="float: right">
|
|
|
- <el-button circle title="微信登录" @click="doSocialLogin('wechat')">
|
|
|
- <svg-icon icon-class="wechat" />
|
|
|
- </el-button>
|
|
|
- <el-button circle title="MaxKey登录" @click="doSocialLogin('maxkey')">
|
|
|
- <svg-icon icon-class="maxkey" />
|
|
|
- </el-button>
|
|
|
- <el-button circle title="TopIam登录" @click="doSocialLogin('topiam')">
|
|
|
- <svg-icon icon-class="topiam" />
|
|
|
- </el-button>
|
|
|
- <el-button circle title="Gitee登录" @click="doSocialLogin('gitee')">
|
|
|
- <svg-icon icon-class="gitee" />
|
|
|
- </el-button>
|
|
|
- <el-button circle title="Github登录" @click="doSocialLogin('github')">
|
|
|
- <svg-icon icon-class="github" />
|
|
|
- </el-button>
|
|
|
- </el-form-item>
|
|
|
- -->
|
|
|
- <el-form-item style="width: 100%">
|
|
|
- <el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleLogin">
|
|
|
- <span v-if="!loading">登 录</span>
|
|
|
- <span v-else>登 录 中...</span>
|
|
|
- </el-button>
|
|
|
- <div v-if="register" style="float: right">
|
|
|
- <router-link class="link-type" :to="'/register'">立即注册</router-link>
|
|
|
- </div>
|
|
|
- </el-form-item>
|
|
|
+ <el-form-item prop="username">
|
|
|
+ <el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
|
|
|
+ <template #prefix><i class="icon-user" /></template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="password">
|
|
|
+ <el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码" @keyup.enter="handleLogin">
|
|
|
+ <template #prefix><i class="icon-password" /></template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="captchaEnabled" prop="code">
|
|
|
+ <el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="验证码" style="width: 63%" @keyup.enter="handleLogin">
|
|
|
+ <template #prefix><i class="icon-verify" /></template>
|
|
|
+ </el-input>
|
|
|
+ <div class="login-code">
|
|
|
+ <img :src="codeUrl" class="login-code-img" @click="getCode" />
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+<!-- <el-checkbox v-model="loginForm.rememberMe" style="margin: 0 0 25px 0">记住密码</el-checkbox>-->
|
|
|
+ <!--
|
|
|
+ <el-form-item style="float: right">
|
|
|
+ <el-button circle title="微信登录" @click="doSocialLogin('wechat')">
|
|
|
+ <svg-icon icon-class="wechat" />
|
|
|
+ </el-button>
|
|
|
+ <el-button circle title="MaxKey登录" @click="doSocialLogin('maxkey')">
|
|
|
+ <svg-icon icon-class="maxkey" />
|
|
|
+ </el-button>
|
|
|
+ <el-button circle title="TopIam登录" @click="doSocialLogin('topiam')">
|
|
|
+ <svg-icon icon-class="topiam" />
|
|
|
+ </el-button>
|
|
|
+ <el-button circle title="Gitee登录" @click="doSocialLogin('gitee')">
|
|
|
+ <svg-icon icon-class="gitee" />
|
|
|
+ </el-button>
|
|
|
+ <el-button circle title="Github登录" @click="doSocialLogin('github')">
|
|
|
+ <svg-icon icon-class="github" />
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ -->
|
|
|
+ <el-form-item style="width: 100%">
|
|
|
+ <el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleLogin">
|
|
|
+ <span v-if="!loading">登 录</span>
|
|
|
+ <span v-else>登 录 中...</span>
|
|
|
+ </el-button>
|
|
|
+ <div v-if="register" style="float: right">
|
|
|
+ <router-link class="link-type" :to="'/register'">立即注册</router-link>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
</el-form>
|
|
|
<!-- 底部 -->
|
|
|
<div class="el-login-footer">
|
|
|
- <span v-if="false">Copyright © 2018-2024 疯狂的狮子Li All Rights Reserved.</span>
|
|
|
+ <span v-if="false"></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -73,7 +73,9 @@ import { HttpStatus } from '@/enums/RespEnum';
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
const router = useRouter();
|
|
|
-
|
|
|
+const tabActive = ref(0);
|
|
|
+// '粤政易扫码登录',
|
|
|
+const tabs = reactive(['账号密码登录']);
|
|
|
const loginForm = ref<LoginData>({
|
|
|
tenantId: '000000',
|
|
|
username: 'admin',
|
|
@@ -117,18 +119,18 @@ const handleLogin = () => {
|
|
|
if (valid) {
|
|
|
loading.value = true;
|
|
|
// 勾选了需要记住密码设置在 localStorage 中设置记住用户名和密码
|
|
|
- if (loginForm.value.rememberMe) {
|
|
|
- localStorage.setItem('tenantId', String(loginForm.value.tenantId));
|
|
|
- localStorage.setItem('username', String(loginForm.value.username));
|
|
|
- localStorage.setItem('password', String(loginForm.value.password));
|
|
|
- localStorage.setItem('rememberMe', String(loginForm.value.rememberMe));
|
|
|
- } else {
|
|
|
- // 否则移除
|
|
|
- localStorage.removeItem('tenantId');
|
|
|
- localStorage.removeItem('username');
|
|
|
- localStorage.removeItem('password');
|
|
|
- localStorage.removeItem('rememberMe');
|
|
|
- }
|
|
|
+ // if (loginForm.value.rememberMe) {
|
|
|
+ // localStorage.setItem('tenantId', String(loginForm.value.tenantId));
|
|
|
+ // localStorage.setItem('username', String(loginForm.value.username));
|
|
|
+ // localStorage.setItem('password', String(loginForm.value.password));
|
|
|
+ // localStorage.setItem('rememberMe', String(loginForm.value.rememberMe));
|
|
|
+ // } else {
|
|
|
+ // // 否则移除
|
|
|
+ // localStorage.removeItem('tenantId');
|
|
|
+ // localStorage.removeItem('username');
|
|
|
+ // localStorage.removeItem('password');
|
|
|
+ // localStorage.removeItem('rememberMe');
|
|
|
+ // }
|
|
|
// 调用action的登录方法
|
|
|
const [err] = await to(userStore.login(loginForm.value));
|
|
|
if (!err) {
|
|
@@ -221,17 +223,26 @@ onMounted(() => {
|
|
|
}
|
|
|
|
|
|
.title {
|
|
|
- margin: 0px auto 30px auto;
|
|
|
- text-align: center;
|
|
|
- color: #707070;
|
|
|
+ font-size: 24px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #25282e;
|
|
|
+}
|
|
|
+
|
|
|
+.title2 {
|
|
|
+ font-size: 36px;
|
|
|
+ font-weight: bold;
|
|
|
+ margin: 6px 0 20px;
|
|
|
+ color: #25282e;
|
|
|
}
|
|
|
|
|
|
.login-form {
|
|
|
- border-radius: 6px;
|
|
|
- background: #ffffff;
|
|
|
width: 400px;
|
|
|
- padding: 25px 25px 5px 25px;
|
|
|
-
|
|
|
+ .login-box {
|
|
|
+ border-radius: 6px;
|
|
|
+ box-shadow: 0 0 4px #d4e9fe;
|
|
|
+ width: 400px;
|
|
|
+ padding: 25px 25px 5px 25px;
|
|
|
+ }
|
|
|
.el-input {
|
|
|
height: 40px;
|
|
|
|
|
@@ -281,4 +292,64 @@ onMounted(() => {
|
|
|
height: 40px;
|
|
|
padding-left: 12px;
|
|
|
}
|
|
|
+
|
|
|
+.login-tabs {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ width: 100%;
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ border-bottom: 1px solid #eeeeee;
|
|
|
+ margin-bottom: 15px;
|
|
|
+ .login-tab {
|
|
|
+ }
|
|
|
+ .tab-active {
|
|
|
+ color: #5695eb;
|
|
|
+ position: relative;
|
|
|
+ &::before {
|
|
|
+ content: '';
|
|
|
+ width: 100%;
|
|
|
+ height: 1px;
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ background-color: #5695eb;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+:deep(.el-input--large) {
|
|
|
+ .el-input__wrapper {
|
|
|
+ padding: 1px 5px !important;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.icon-user {
|
|
|
+ background: url('@/assets/images/user2.png') no-repeat;
|
|
|
+}
|
|
|
+.icon-password {
|
|
|
+ background: url('@/assets/images/password.png') no-repeat;
|
|
|
+}
|
|
|
+.icon-verify {
|
|
|
+ background: url('@/assets/images/verify.png') no-repeat;
|
|
|
+}
|
|
|
+.icon-user,
|
|
|
+.icon-password,
|
|
|
+.icon-verify {
|
|
|
+ width: 24px;
|
|
|
+ height: 24px;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ margin-right: 10px;
|
|
|
+ position: relative;
|
|
|
+ &::after {
|
|
|
+ content: '';
|
|
|
+ display: inline-block;
|
|
|
+ width: 1px;
|
|
|
+ height: 18px;
|
|
|
+ background-color: #d9d9d9;
|
|
|
+ position: absolute;
|
|
|
+ top: 3px;
|
|
|
+ right: -5px;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|