登录界面新增域名适配租户配置

dev
smallchill 6 years ago
parent baf85345d8
commit 17b116610b
  1. BIN
      public/img/bg/bg.jpg
  2. 10
      src/api/system/tenant.js
  3. 8
      src/page/login/codelogin.vue
  4. 38
      src/page/login/index.vue
  5. 4
      src/page/login/thirdlogin.vue
  6. 31
      src/page/login/userlogin.vue
  7. 25
      src/styles/login.scss

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

@ -58,3 +58,13 @@ export const setting = (ids, form) => {
} }
}) })
} }
export const info = (domain) => {
return request({
url: '/api/blade-system/tenant/info',
method: 'get',
params: {
domain
}
})
}

@ -12,7 +12,7 @@
auto-complete="off" auto-complete="off"
:placeholder="$t('login.phone')"> :placeholder="$t('login.phone')">
<i slot="prefix" <i slot="prefix"
class="icon-shouji"></i> class="icon-shouji"/>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="code"> <el-form-item prop="code">
@ -23,7 +23,7 @@
:placeholder="$t('login.code')"> :placeholder="$t('login.code')">
<i slot="prefix" <i slot="prefix"
class="icon-yanzhengma" class="icon-yanzhengma"
style="margin-top:6px;"></i> style="margin-top:6px;"/>
<template slot="append"> <template slot="append">
<span @click="handleSend" <span @click="handleSend"
class="msg-text" class="msg-text"
@ -54,7 +54,7 @@ export default {
} }
}; };
const validateCode = (rule, value, callback) => { const validateCode = (rule, value, callback) => {
if (value.length != 4) { if (value.length !== 4) {
callback(new Error("请输入4位数的验证码")); callback(new Error("请输入4位数的验证码"));
} else { } else {
callback(); callback();
@ -98,7 +98,7 @@ export default {
const time = setInterval(() => { const time = setInterval(() => {
this.msgTime--; this.msgTime--;
this.msgText = this.msgTime + this.config.MSGSCUCCESS; this.msgText = this.msgTime + this.config.MSGSCUCCESS;
if (this.msgTime == 0) { if (this.msgTime === 0) {
this.msgTime = this.config.MSGTIME; this.msgTime = this.config.MSGTIME;
this.msgText = this.config.MSGINIT; this.msgText = this.config.MSGINIT;
this.msgKey = false; this.msgKey = false;

@ -1,7 +1,8 @@
<template> <template>
<div class="login-container" <div class="login-container"
ref="login"
@keyup.enter.native="handleLogin"> @keyup.enter.native="handleLogin">
<top-color v-show="false"></top-color> <top-color v-show="false"/>
<div class="login-weaper animated bounceInDown"> <div class="login-weaper animated bounceInDown">
<div class="login-left"> <div class="login-left">
<div class="login-time"> <div class="login-time">
@ -16,11 +17,11 @@
<div class="login-main"> <div class="login-main">
<h4 class="login-title"> <h4 class="login-title">
{{ $t('login.title') }}{{website.title}} {{ $t('login.title') }}{{website.title}}
<top-lang></top-lang> <top-lang/>
</h4> </h4>
<userLogin v-if="activeName==='user'"></userLogin> <userLogin v-if="activeName==='user'"/>
<codeLogin v-else-if="activeName==='code'"></codeLogin> <codeLogin v-else-if="activeName==='code'"/>
<thirdLogin v-else-if="activeName==='third'"></thirdLogin> <thirdLogin v-else-if="activeName==='third'"/>
<div class="login-menu"> <div class="login-menu">
<a href="#" <a href="#"
@click.stop="activeName='user'">{{ $t('login.userLogin') }}</a> @click.stop="activeName='user'">{{ $t('login.userLogin') }}</a>
@ -36,15 +37,17 @@
</div> </div>
</template> </template>
<script> <script>
import userLogin from "./userlogin"; import userLogin from "./userlogin";
import codeLogin from "./codelogin"; import codeLogin from "./codelogin";
import thirdLogin from "./thirdlogin"; import thirdLogin from "./thirdlogin";
import { mapGetters } from "vuex"; import {mapGetters} from "vuex";
import { dateFormat } from "@/util/date"; import {dateFormat} from "@/util/date";
import { validatenull } from "@/util/validate"; import {validatenull} from "@/util/validate";
import topLang from "@/page/index/top/top-lang"; import topLang from "@/page/index/top/top-lang";
import topColor from "@/page/index/top/top-color"; import topColor from "@/page/index/top/top-color";
export default { import {info} from "@/api/system/tenant";
export default {
name: "login", name: "login",
components: { components: {
userLogin, userLogin,
@ -84,7 +87,8 @@ export default {
this.getTime(); this.getTime();
}, 1000); }, 1000);
}, },
mounted() {}, mounted() {
},
computed: { computed: {
...mapGetters(["website"]) ...mapGetters(["website"])
}, },
@ -94,9 +98,9 @@ export default {
this.time = dateFormat(new Date()); this.time = dateFormat(new Date());
} }
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
@import "@/styles/login.scss"; @import "@/styles/login.scss";
</style> </style>

@ -5,7 +5,7 @@
<span class="container" <span class="container"
:style="{backgroundColor:'#6ba2d6'}"> :style="{backgroundColor:'#6ba2d6'}">
<i icon-class="wechat" <i icon-class="wechat"
class="iconfont icon-weixin"></i> class="iconfont icon-weixin"/>
</span> </span>
<p class="title">{{$t('login.wechat')}}</p> <p class="title">{{$t('login.wechat')}}</p>
</div> </div>
@ -14,7 +14,7 @@
<span class="container" <span class="container"
:style="{backgroundColor:'#8dc349'}"> :style="{backgroundColor:'#8dc349'}">
<i icon-class="qq" <i icon-class="qq"
class="iconfont icon-qq"></i> class="iconfont icon-qq"/>
</span> </span>
<p class="title">{{$t('login.qq')}}</p> <p class="title">{{$t('login.qq')}}</p>
</div> </div>

@ -11,8 +11,7 @@
v-model="loginForm.tenantId" v-model="loginForm.tenantId"
auto-complete="off" auto-complete="off"
:placeholder="$t('login.tenantId')"> :placeholder="$t('login.tenantId')">
<i slot="prefix" <i slot="prefix" class="icon-quanxian"/>
class="icon-quanxian"></i>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="username"> <el-form-item prop="username">
@ -21,8 +20,7 @@
v-model="loginForm.username" v-model="loginForm.username"
auto-complete="off" auto-complete="off"
:placeholder="$t('login.username')"> :placeholder="$t('login.username')">
<i slot="prefix" <i slot="prefix" class="icon-yonghu"/>
class="icon-yonghu"></i>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
@ -32,11 +30,8 @@
v-model="loginForm.password" v-model="loginForm.password"
auto-complete="off" auto-complete="off"
:placeholder="$t('login.password')"> :placeholder="$t('login.password')">
<i class="el-icon-view el-input__icon" <i class="el-icon-view el-input__icon" slot="suffix" @click="showPassword"/>
slot="suffix" <i slot="prefix" class="icon-mima"/>
@click="showPassword"></i>
<i slot="prefix"
class="icon-mima"></i>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -51,6 +46,7 @@
<script> <script>
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import website from '@/config/website'; import website from '@/config/website';
import {info} from "@/api/system/tenant";
export default { export default {
name: "userlogin", name: "userlogin",
@ -78,7 +74,9 @@ export default {
passwordType: "password" passwordType: "password"
}; };
}, },
created() {}, created() {
this.getTenant();
},
mounted() {}, mounted() {},
computed: { computed: {
...mapGetters(["tagWel"]) ...mapGetters(["tagWel"])
@ -86,7 +84,7 @@ export default {
props: [], props: [],
methods: { methods: {
showPassword() { showPassword() {
this.passwordType == "" this.passwordType === ""
? (this.passwordType = "password") ? (this.passwordType = "password")
: (this.passwordType = ""); : (this.passwordType = "");
}, },
@ -106,6 +104,17 @@ export default {
}); });
} }
}); });
},
getTenant() {
let domain = window.location.href.replace("/#/login", "");
info(domain).then(res => {
const data = res.data;
if (data.success && data.data.tenantId) {
this.tenantMode = false;
this.loginForm.tenantId = data.data.tenantId;
this.$parent.$refs.login.style.backgroundImage = `url(${data.data.backgroundUrl})`;
}
})
} }
} }
}; };

@ -5,13 +5,15 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
margin: 0 auto; margin: 0 auto;
background: url(/img/bg/cloud.jpg) 0 bottom repeat-x #049ec4; background-image: url("/img/bg/bg.jpg");
animation: animate-cloud 20s linear infinite; background-size: 100% 100%;
} }
.login-weaper { .login-weaper {
margin: 0 auto; margin: 0 auto;
width: 1000px; width: 1000px;
box-shadow: -4px 5px 10px rgba(0, 0, 0, 0.4); box-shadow: -4px 5px 10px rgba(0, 0, 0, 0.4);
.el-input-group__append { .el-input-group__append {
border: none; border: none;
} }
@ -24,6 +26,7 @@
align-items: center; align-items: center;
display: flex; display: flex;
} }
.login-left { .login-left {
border-top-left-radius: 5px; border-top-left-radius: 5px;
border-bottom-left-radius: 5px; border-bottom-left-radius: 5px;
@ -35,9 +38,11 @@
width: 50%; width: 50%;
position: relative; position: relative;
} }
.login-left .img { .login-left .img {
width: 140px; width: 140px;
} }
.login-time { .login-time {
position: absolute; position: absolute;
left: 25px; left: 25px;
@ -49,6 +54,7 @@
font-size: 18px; font-size: 18px;
overflow: hidden; overflow: hidden;
} }
.login-left .title { .login-left .title {
margin-top: 60px; margin-top: 60px;
text-align: center; text-align: center;
@ -68,17 +74,21 @@
float: left; float: left;
box-sizing: border-box; box-sizing: border-box;
} }
.login-main { .login-main {
margin: 0 auto; margin: 0 auto;
width: 65%; width: 65%;
box-sizing: border-box; box-sizing: border-box;
} }
.login-main > h3 { .login-main > h3 {
margin-bottom: 20px; margin-bottom: 20px;
} }
.login-main > p { .login-main > p {
color: #76838f; color: #76838f;
} }
.login-title { .login-title {
color: #333; color: #333;
margin-bottom: 40px; margin-bottom: 40px;
@ -87,16 +97,19 @@
text-align: center; text-align: center;
letter-spacing: 4px; letter-spacing: 4px;
} }
.login-menu { .login-menu {
margin-top: 40px; margin-top: 40px;
width: 100%; width: 100%;
text-align: center; text-align: center;
a { a {
color: #999; color: #999;
font-size: 12px; font-size: 12px;
margin: 0px 8px; margin: 0px 8px;
} }
} }
.login-submit { .login-submit {
width: 100%; width: 100%;
height: 45px; height: 45px;
@ -111,17 +124,22 @@
font-family: "neo"; font-family: "neo";
transition: 0.25s; transition: 0.25s;
} }
.login-form { .login-form {
margin: 10px 0; margin: 10px 0;
i { i {
color: #333; color: #333;
} }
.el-form-item__content { .el-form-item__content {
width: 100%; width: 100%;
} }
.el-form-item { .el-form-item {
margin-bottom: 12px; margin-bottom: 12px;
} }
.el-input { .el-input {
input { input {
padding-bottom: 10px; padding-bottom: 10px;
@ -132,6 +150,7 @@
color: #333; color: #333;
border-bottom: 1px solid rgb(235, 237, 242); border-bottom: 1px solid rgb(235, 237, 242);
} }
.el-input__prefix { .el-input__prefix {
i { i {
padding: 0 5px; padding: 0 5px;
@ -140,12 +159,14 @@
} }
} }
} }
.login-code { .login-code {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-around; justify-content: space-around;
margin: 0 0 0 10px; margin: 0 0 0 10px;
} }
.login-code-img { .login-code-img {
margin-top: 2px; margin-top: 2px;
width: 100px; width: 100px;

Loading…
Cancel
Save