Commit 98cb6ba5 authored by renjintao's avatar renjintao

login tenantcode

parent d87fcd76
<template>
<div class="account">
<div class="account">
<vue-particles color="#dedede"></vue-particles>
<div class="login">
<div class="page-account-top">
<div class="page-account-top-logo tc">
<img src="@/assets/images/logo.png" alt="logo" />
<div class="page-account-top">
<div class="page-account-top-logo tc">
<img src="@/assets/images/logo.png" alt="logo" />
</div>
<div class="tc">SaaS MES 制造执行---系统管理</div>
</div>
<div class="tc">SaaS MES 制造执行---系统管理</div>
</div>
<h3 class="mb20">用户登陆</h3>
<Login @on-submit="handleSubmit">
<UserName name="username" value="13211111111" />
<Password name="password" value="1" enter-to-submit />
<div class="page-account-auto-login mb20">
<Checkbox v-model="autoLogin">{{ $t('page.login.remember') }}</Checkbox>
<a href>{{ $t('page.login.forgot') }}</a>
</div>
<div class="mt20">
<Submit class="shadown">{{ $t('page.login.submit') }}</Submit>
</div>
</Login>
<h3 class="mb20">用户登陆</h3>
<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" />
<Password name="password" value="1" enter-to-submit />
<div class="page-account-auto-login mb20">
<Checkbox v-model="autoLogin">{{ $t('page.login.remember') }}</Checkbox>
<a href>{{ $t('page.login.forgot') }}</a>
</div>
<div class="mt20">
<Submit class="shadown">{{ $t('page.login.submit') }}</Submit>
</div>
</Login>
</div>
</div>
</div>
</template>
<script>
import iCopyright from "@/components/copyright";
import { mapActions } from "vuex";
import {
mapActions
} from "vuex";
import mixins from "../mixins";
import Oidc from "oidc-client";
import util from "@/libs/util";
var mgr = new Oidc.UserManager(window.authConfig);
export default {
layout: "empty",
mixins: [mixins],
components: { iCopyright },
data() {
return {
value1: 0,
autoLogin: true
};
},
head(){
return {
title: 'SaaS MES 制造执行---系统管理',
meta: [{
hid: "description",
name: "description",
content: "funny jokes page"
}]
}
},
created() {
// this.oidc();
},
methods: {
...mapActions("admin/account", ["login"]),
/**
* @description 登录
* 表单校验已有 iView Pro 自动完成,如有需要修改,请阅读 iView Pro 文档
*/
handleSubmit(valid, values) {
if (valid) {
const { username, password } = values;
this.login({
username,
password
}).then(r => {
if (r > 0) {
this.$Message.success("登陆成功!");
this.initUserInfo(r);
} else {
this.$Message.error("登陆失败!");
}
});
}
layout: "empty",
mixins: [mixins],
components: {
iCopyright
},
initUserInfo(id) {
let parma = {
Id: id
};
this.$http.sysUser.getuserinfo(parma).then(res => {
if (res.result) {
if (
res.result.avatarUrl &&
res.result.avatarUrl != "" &&
res.result.avatarUrl != null
) {
res.result.avatarUrl = fileUrlDown + res.result.avatarUrl;
}
let info = res.result;
info.tenantCode=
info.auth = ["admin"];
info.avatar = info.avatarUrl;
info.userId = info.id;
info.name = info.userName;
this.$store.dispatch("admin/user/set", info, {
root: true
});
// setUserInfo
this.$store.commit("setUserInfo", info);
this.$router.replace(this.$route.query.redirect || "/");
} else {
this.$Message.error("用户信息22查询失败!");
data() {
return {
value1: 0,
autoLogin: true,
tenantCode: '000001'
};
},
head() {
return {
title: 'SaaS MES 制造执行---系统管理',
meta: [{
hid: "description",
name: "description",
content: "funny jokes page"
}]
}
},
created() {
// this.oidc();
},
methods: {
...mapActions("admin/account", ["login"]),
/**
* @description 登录
* 表单校验已有 iView Pro 自动完成,如有需要修改,请阅读 iView Pro 文档
*/
handleSubmit(valid, values) {
if (valid) {
values.tenantcode = this.tenantCode
alert(JSON.stringify(values))
const {
username,
password,
tenantcode
} = values;
this.login({
username,
password,
tenantcode
}).then(r => {
if (r > 0) {
this.$Message.success("登陆成功!");
this.initUserInfo(r);
} else {
this.$Message.error("登陆失败!");
}
});
}
},
initUserInfo(id) {
let parma = {
Id: id
};
this.$http.sysUser.getuserinfo(parma).then(res => {
if (res.result) {
if (
res.result.avatarUrl &&
res.result.avatarUrl != "" &&
res.result.avatarUrl != null
) {
res.result.avatarUrl = fileUrlDown + res.result.avatarUrl;
}
let info = res.result;
info.tenantCode =
info.auth = ["admin"];
info.avatar = info.avatarUrl;
info.userId = info.id;
info.name = info.userName;
this.$store.dispatch("admin/user/set", info, {
root: true
});
// setUserInfo
this.$store.commit("setUserInfo", info);
this.$router.replace(this.$route.query.redirect || "/");
} else {
this.$Message.error("用户信息22查询失败!");
}
});
}
});
}
}
};
</script>
<style lang="less">
@jianju: 40px;
.account {
position: fixed;
width: 100%;
top: 0;
bottom: 0;
background-image: url("../../../assets/images/login/login_bg.jpg");
background-size: cover;
#particles-js{
z-index: 2;
position: absolute;
position: fixed;
width: 100%;
height: 100vh;
}
.login {
position: absolute;
z-index: 99;
background-color: #214f5f;
width: 500px;
height: 540px;
padding: 20px 50px;
border-radius: 10px;
left: 50%;
top:50%;
color: #ddd;
transform: translate(-50%,-50%);
box-shadow: 1px 15px 35px #022d36;
.mt20 {
margin-top: 50px;
.shadown {
box-shadow: 1px -5px -15px #2680eb;
}
.ivu-btn-large {
height: 50px !important;
}
top: 0;
bottom: 0;
background-image: url("../../../assets/images/login/login_bg.jpg");
background-size: cover;
#particles-js {
z-index: 2;
position: absolute;
width: 100%;
height: 100vh;
}
.login {
position: absolute;
z-index: 99;
background-color: #214f5f;
width: 500px;
height: 540px;
padding: 20px 50px;
border-radius: 10px;
left: 50%;
top: 50%;
color: #ddd;
transform: translate(-50%, -50%);
box-shadow: 1px 15px 35px #022d36;
.mt20 {
margin-top: 50px;
.shadown {
box-shadow: 1px -5px -15px #2680eb;
}
.ivu-btn-large {
height: 50px !important;
}
}
}
}
}
</style>
\ No newline at end of file
</style>
......@@ -22,13 +22,15 @@ export const actions = {
dispatch
}, {
username = '',
password = ''
password = '',
tenantcode = ''
} = {}) {
return new Promise((resolve, reject) => {
// 开始请求登录接口
AccountLogin({
username,
password
password,
tenantcode
})
.then(async res => {
// 设置 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