Commit db58c5a2 authored by renjintao's avatar renjintao

tenantcode

parent c55e3eaf
<template> <template>
<div class="account"> <div class="account">
<!-- <Carousel v-model="value1" autoplay :autoplay-speed="5000" loop class="zmd"> <!-- <Carousel v-model="value1" autoplay :autoplay-speed="5000" loop class="zmd">
<CarouselItem> <CarouselItem>
<div class="bg bg1"></div> <div class="bg bg1"></div>
...@@ -31,28 +31,31 @@ ...@@ -31,28 +31,31 @@
</div> </div>
<h2 class="mb20">登 录</h2> <h2 class="mb20">登 录</h2>
<Login @on-submit="handleSubmit" class="form_sub"> <Login @on-submit="handleSubmit" class="form_sub">
<div class="mb20" style="height:40px;"> <div class="mb20" style="height: 40px">
<Input v-model="tenantCode" size="large"> <Input ref="iTenantCode" v-model="tenantCode" size="large">
<span slot="prepend">租户号</span> <span slot="prepend">租户号</span>
</Input> </Input>
</div> </div>
<UserName name="username" class="user_name" value="" /> <UserName name="username" class="user_name" value="" />
<Password name="password" class="pass_word" value="" enter-to-submit /> <Password
name="password"
class="pass_word"
value=""
enter-to-submit
/>
<div class="sub_btn"> <div class="sub_btn">
<Submit class="shadown">{{ $t('page.login.submit') }}</Submit> <Submit class="shadown">{{ $t("page.login.submit") }}</Submit>
</div> </div>
</Login> </Login>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import iCopyright from "@/components/copyright"; import iCopyright from "@/components/copyright";
import { import { mapActions } from "vuex";
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";
...@@ -61,19 +64,26 @@ export default { ...@@ -61,19 +64,26 @@ export default {
layout: "empty", layout: "empty",
mixins: [mixins], mixins: [mixins],
components: { components: {
iCopyright iCopyright,
}, },
data() { data() {
return { return {
value1: 0, value1: 0,
autoLogin: true, autoLogin: true,
imgFlag: true, imgFlag: true,
tenantCode: '000001' //tenantCode: '000001'
tenantCode: "",
}; };
}, },
created() { created() {
// this.oidc(); // this.oidc();
}, },
mounted() {
this.$nextTick((x) => {
//正确写法
this.$refs.iTenantCode.focus();
});
},
methods: { methods: {
...mapActions("admin/account", ["login"]), ...mapActions("admin/account", ["login"]),
/** /**
...@@ -81,35 +91,40 @@ export default { ...@@ -81,35 +91,40 @@ export default {
* 表单校验已有 iView Pro 自动完成,如有需要修改,请阅读 iView Pro 文档 * 表单校验已有 iView Pro 自动完成,如有需要修改,请阅读 iView Pro 文档
*/ */
handleSubmit(valid, values) { handleSubmit(valid, values) {
if (this.tenantCode == "") {
this.$Message.error("租户号不能为空");
this.$nextTick((x) => {
//正确写法
this.$refs.iTenantCode.focus();
});
return;
}
if (valid) { if (valid) {
values.tenantcode = this.tenantCode values.tenantcode = this.tenantCode;
const { const { username, password, tenantcode } = values;
username,
password,
tenantcode
} = values;
this.login({ this.login({
username, username,
password, password,
tenantcode tenantcode,
}).then(r => { })
.then((r) => {
if (r > 0) { if (r > 0) {
this.$Message.success("登录成功!"); this.$Message.success("登录成功!");
this.initUserInfo(r); this.initUserInfo(r);
} else { } else {
this.$Message.error("登录失败!"); this.$Message.error("登录失败!");
} }
}).catch(e => { })
console.log(e) .catch((e) => {
// this.$Message.error(e.message) // this.$Message.error(e.message)
}); });
} }
}, },
initUserInfo(id) { initUserInfo(id) {
let parma = { let parma = {
Id: id Id: id,
}; };
this.$http.sysUser.getuserinfo(parma).then(res => { this.$http.sysUser.getuserinfo(parma).then((res) => {
if (res.result) { if (res.result) {
if ( if (
res.result.avatarUrl && res.result.avatarUrl &&
...@@ -124,11 +139,11 @@ export default { ...@@ -124,11 +139,11 @@ export default {
info.userId = info.id; info.userId = info.id;
info.name = info.userName; info.name = info.userName;
this.$store.dispatch("admin/user/set", info, { this.$store.dispatch("admin/user/set", info, {
root: true root: true,
}); });
// setUserInfo // setUserInfo
this.$store.commit("setUserInfo", info); this.$store.commit("setUserInfo", info);
this.$router.replace('/welcome') this.$router.replace("/welcome");
// this.$router.replace(this.$route.query.redirect || "/"); // this.$router.replace(this.$route.query.redirect || "/");
} else { } else {
this.$Message.error("用户信息22查询失败!"); this.$Message.error("用户信息22查询失败!");
...@@ -136,9 +151,9 @@ export default { ...@@ -136,9 +151,9 @@ export default {
}); });
}, },
handlTrance() { handlTrance() {
this.imgFlag = !this.imgFlag this.imgFlag = !this.imgFlag;
} },
} },
}; };
</script> </script>
...@@ -242,7 +257,7 @@ export default { ...@@ -242,7 +257,7 @@ export default {
position: relative; position: relative;
cursor: pointer; cursor: pointer;
width: 90px; width: 90px;
height: 85PX; height: 85px;
float: right; float: right;
.sanjiao { .sanjiao {
......
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