Commit 98cb6ba5 authored by renjintao's avatar renjintao

login tenantcode

parent d87fcd76
<template> <template>
<div class="account"> <div class="account">
<vue-particles color="#dedede"></vue-particles> <vue-particles color="#dedede"></vue-particles>
<div class="login"> <div class="login">
<div class="page-account-top"> <div class="page-account-top">
...@@ -10,6 +10,11 @@ ...@@ -10,6 +10,11 @@
</div> </div>
<h3 class="mb20">用户登陆</h3> <h3 class="mb20">用户登陆</h3>
<Login @on-submit="handleSubmit"> <Login @on-submit="handleSubmit">
<div class="" style="height:40px;margin-bottom:15px;">
<Input v-model="tenantCode" size="large">
<span slot="prepend">租户号</span>
</Input>
</div>
<UserName name="username" value="13211111111" /> <UserName name="username" value="13211111111" />
<Password name="password" value="1" enter-to-submit /> <Password name="password" value="1" enter-to-submit />
<div class="page-account-auto-login mb20"> <div class="page-account-auto-login mb20">
...@@ -21,11 +26,14 @@ ...@@ -21,11 +26,14 @@
</div> </div>
</Login> </Login>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import iCopyright from "@/components/copyright"; import iCopyright from "@/components/copyright";
import { mapActions } from "vuex"; import {
mapActions
} from "vuex";
import mixins from "../mixins"; import mixins from "../mixins";
import Oidc from "oidc-client"; import Oidc from "oidc-client";
import util from "@/libs/util"; import util from "@/libs/util";
...@@ -33,14 +41,17 @@ var mgr = new Oidc.UserManager(window.authConfig); ...@@ -33,14 +41,17 @@ var mgr = new Oidc.UserManager(window.authConfig);
export default { export default {
layout: "empty", layout: "empty",
mixins: [mixins], mixins: [mixins],
components: { iCopyright }, components: {
iCopyright
},
data() { data() {
return { return {
value1: 0, value1: 0,
autoLogin: true autoLogin: true,
tenantCode: '000001'
}; };
}, },
head(){ head() {
return { return {
title: 'SaaS MES 制造执行---系统管理', title: 'SaaS MES 制造执行---系统管理',
meta: [{ meta: [{
...@@ -61,10 +72,17 @@ export default { ...@@ -61,10 +72,17 @@ export default {
*/ */
handleSubmit(valid, values) { handleSubmit(valid, values) {
if (valid) { if (valid) {
const { username, password } = values; values.tenantcode = this.tenantCode
alert(JSON.stringify(values))
const {
username,
password,
tenantcode
} = values;
this.login({ this.login({
username, username,
password password,
tenantcode
}).then(r => { }).then(r => {
if (r > 0) { if (r > 0) {
this.$Message.success("登陆成功!"); this.$Message.success("登陆成功!");
...@@ -89,7 +107,7 @@ export default { ...@@ -89,7 +107,7 @@ export default {
res.result.avatarUrl = fileUrlDown + res.result.avatarUrl; res.result.avatarUrl = fileUrlDown + res.result.avatarUrl;
} }
let info = res.result; let info = res.result;
info.tenantCode= info.tenantCode =
info.auth = ["admin"]; info.auth = ["admin"];
info.avatar = info.avatarUrl; info.avatar = info.avatarUrl;
info.userId = info.id; info.userId = info.id;
...@@ -108,8 +126,10 @@ export default { ...@@ -108,8 +126,10 @@ export default {
} }
}; };
</script> </script>
<style lang="less"> <style lang="less">
@jianju: 40px; @jianju: 40px;
.account { .account {
position: fixed; position: fixed;
width: 100%; width: 100%;
...@@ -117,12 +137,14 @@ export default { ...@@ -117,12 +137,14 @@ export default {
bottom: 0; bottom: 0;
background-image: url("../../../assets/images/login/login_bg.jpg"); background-image: url("../../../assets/images/login/login_bg.jpg");
background-size: cover; background-size: cover;
#particles-js{
#particles-js {
z-index: 2; z-index: 2;
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100vh; height: 100vh;
} }
.login { .login {
position: absolute; position: absolute;
z-index: 99; z-index: 99;
...@@ -132,15 +154,18 @@ export default { ...@@ -132,15 +154,18 @@ export default {
padding: 20px 50px; padding: 20px 50px;
border-radius: 10px; border-radius: 10px;
left: 50%; left: 50%;
top:50%; top: 50%;
color: #ddd; color: #ddd;
transform: translate(-50%,-50%); transform: translate(-50%, -50%);
box-shadow: 1px 15px 35px #022d36; box-shadow: 1px 15px 35px #022d36;
.mt20 { .mt20 {
margin-top: 50px; margin-top: 50px;
.shadown { .shadown {
box-shadow: 1px -5px -15px #2680eb; box-shadow: 1px -5px -15px #2680eb;
} }
.ivu-btn-large { .ivu-btn-large {
height: 50px !important; height: 50px !important;
} }
......
...@@ -22,13 +22,15 @@ export const actions = { ...@@ -22,13 +22,15 @@ export const actions = {
dispatch dispatch
}, { }, {
username = '', username = '',
password = '' password = '',
tenantcode = ''
} = {}) { } = {}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 开始请求登录接口 // 开始请求登录接口
AccountLogin({ AccountLogin({
username, username,
password password,
tenantcode
}) })
.then(async res => { .then(async res => {
// 设置 cookie 一定要存 uuid 和 token 两个 cookie // 设置 cookie 一定要存 uuid 和 token 两个 cookie
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment