|
@@ -1,10 +1,9 @@
|
|
|
<template>
|
|
|
- <div id="login">
|
|
|
+ <div id="login">
|
|
|
<div id="login_wrapper">
|
|
|
-
|
|
|
<img class="login-bg" :src="$setting.login_bg" alt />
|
|
|
- <img class="login-icon" :src="$setting.login_logo">
|
|
|
- <el-form
|
|
|
+ <img class="login-icon" :src="$setting.login_logo">
|
|
|
+ <!-- <el-form
|
|
|
:model="ruleForm"
|
|
|
:rules="rules"
|
|
|
ref="ruleForm"
|
|
@@ -63,7 +62,32 @@
|
|
|
>登录</el-button
|
|
|
>
|
|
|
</el-form-item>
|
|
|
- </el-form>
|
|
|
+ </el-form> -->
|
|
|
+ <div class="login-box" id="login-container">
|
|
|
+ <span class="login-title">ETA — 让投研领先市场半步</span>
|
|
|
+ <el-tabs v-model="activeModel" @tab-click="handleClick">
|
|
|
+ <el-tab-pane label="账号登录" name="ordinaryModel">
|
|
|
+ <OrdinaryModel ref="ordinaryModel"
|
|
|
+ :loginCheck="loginCheck"
|
|
|
+ :accountCheck="accountCheck"
|
|
|
+ @clearnHint="clearnHint"
|
|
|
+ />
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="手机号登录" name="mobileModel">
|
|
|
+ <MobileModel ref="mobileModel"/>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="邮箱登录" name="emailModel">
|
|
|
+ <EmailModel ref="emailModel"/>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="medium"
|
|
|
+ @click.native="handleLogin"
|
|
|
+ :loading="logining"
|
|
|
+ class="submit_btn"
|
|
|
+ >登录</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -72,159 +96,187 @@
|
|
|
import { userLogin, departInterence } from "@/api/api.js";
|
|
|
import http from "@/api/http.js";
|
|
|
import md5 from "@/utils/md5.js";
|
|
|
+import EmailModel from "./login_manage/EmailModel.vue";
|
|
|
+import MobileModel from "./login_manage/MobileModel.vue";
|
|
|
+import OrdinaryModel from "./login_manage/OrdinaryModel.vue";
|
|
|
export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- b: new http.Base64(),
|
|
|
- logining: false, //登录loadding
|
|
|
- ruleForm: {
|
|
|
- account: "",
|
|
|
- checkPass: "",
|
|
|
- },
|
|
|
- rules: {
|
|
|
- account: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: "请输入用户名",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
- ],
|
|
|
- checkPass: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: "请输入密码",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- checked: false, //是否保持登录状态
|
|
|
- visible: true, //密码输入类型
|
|
|
- };
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.keyupSubmit(); //回车登录
|
|
|
- let userAccount = localStorage.getItem("account") || null;
|
|
|
- let userCheckPass = localStorage.getItem("checkPass") || null;
|
|
|
- if (userAccount) {
|
|
|
- this.ruleForm.account = this.b.decode(userAccount);
|
|
|
- this.ruleForm.checkPass = this.b.decode(userCheckPass);
|
|
|
- this.checked = true;
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- keyupSubmit() {
|
|
|
- //回车登录
|
|
|
- document.onkeydown = (e) => {
|
|
|
- let keyval = window.event.keyCode;
|
|
|
- if (keyval === 13) {
|
|
|
- this.handleSubmit2();
|
|
|
- }
|
|
|
- };
|
|
|
+ components: { OrdinaryModel, MobileModel, EmailModel },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ b: new http.Base64(),
|
|
|
+ logining: false,
|
|
|
+ ruleForm: {
|
|
|
+ account: "",
|
|
|
+ checkPass: "",
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ account: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入用户名",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ checkPass: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入密码",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ checked: false,
|
|
|
+ visible: true,
|
|
|
+
|
|
|
+ activeModel: 'ordinaryModel',
|
|
|
+ /* form check */
|
|
|
+ loginCheck:false, //账号或密码错误
|
|
|
+ accountCheck:false,//账号异常:多次输错密码、长时间未登录
|
|
|
+ accountForbidden:false,//账号被禁用
|
|
|
+ mobileCheck:false,//手机号未绑定
|
|
|
+ emailCheck:false,//邮箱未绑定
|
|
|
+ };
|
|
|
},
|
|
|
- handleSubmit2() {
|
|
|
- //登录
|
|
|
- let that = this;
|
|
|
- this.$refs.ruleForm.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- that.logining = true;
|
|
|
- var loginParams = {
|
|
|
- Username: that.ruleForm.account,
|
|
|
- Password: md5.hex_md5(that.ruleForm.checkPass),
|
|
|
- IsRemember: this.checked,
|
|
|
- };
|
|
|
- userLogin(loginParams).then(async (res) => {
|
|
|
- if (res.Ret === 200) {
|
|
|
- localStorage.setItem("auth", res.Data.Authorization);
|
|
|
- localStorage.setItem("userName", res.Data.RealName);
|
|
|
- localStorage.setItem("Role", res.Data.RoleTypeCode);
|
|
|
- localStorage.setItem("RoleIdentity", res.Data.SysRoleTypeCode);
|
|
|
- localStorage.setItem("RoleType", res.Data.ProductName);
|
|
|
- localStorage.setItem("ManageType", res.Data.Authority);
|
|
|
- localStorage.setItem("AdminId", res.Data.AdminId);
|
|
|
- localStorage.setItem("AdminName", res.Data.AdminName);
|
|
|
- if (this.checked) {
|
|
|
- localStorage.setItem(
|
|
|
- "account",
|
|
|
- this.b.encode(this.ruleForm.account)
|
|
|
- );
|
|
|
- localStorage.setItem(
|
|
|
- "checkPass",
|
|
|
- this.b.encode(this.ruleForm.checkPass)
|
|
|
- );
|
|
|
- } else {
|
|
|
- localStorage.removeItem("account");
|
|
|
- localStorage.removeItem("checkPass");
|
|
|
- }
|
|
|
-
|
|
|
- let path = "";
|
|
|
- switch (res.Data.RoleTypeCode) {
|
|
|
- case "rai_researcher":
|
|
|
- case "ficc_researcher":
|
|
|
- case "researcher":
|
|
|
- path = "/reportlist";
|
|
|
- break;
|
|
|
- case "compliance": //合规
|
|
|
- path = "/contractapprovallist";
|
|
|
- break;
|
|
|
- case "special_researcher": //特邀研究员
|
|
|
- path = "/dataList";
|
|
|
- break;
|
|
|
- case "special_ficc_seller":
|
|
|
- path = "/meetingCalendar";
|
|
|
- break;
|
|
|
- default:
|
|
|
- path = await this.getOtherRolePath("myCalendar");
|
|
|
- }
|
|
|
- this.$router.push({ path });
|
|
|
- }
|
|
|
- that.logining = false;
|
|
|
- });
|
|
|
+ created() {
|
|
|
+ this.keyupSubmit(); //回车登录
|
|
|
+ let userAccount = localStorage.getItem("account") || null;
|
|
|
+ let userCheckPass = localStorage.getItem("checkPass") || null;
|
|
|
+ if (userAccount) {
|
|
|
+ this.ruleForm.account = this.b.decode(userAccount);
|
|
|
+ this.ruleForm.checkPass = this.b.decode(userCheckPass);
|
|
|
+ this.checked = true;
|
|
|
}
|
|
|
- });
|
|
|
},
|
|
|
- changePass(value) {
|
|
|
- //密码输入格式切换
|
|
|
- this.visible = !(value === "show");
|
|
|
- },
|
|
|
- getOtherRolePath(pathVal) {
|
|
|
- return departInterence.getMenu().then((res) => {
|
|
|
- let resolvePath = "";
|
|
|
- if (res.Ret === 200) {
|
|
|
- let menuList = res.Data.List || [];
|
|
|
- if(!menuList.length){
|
|
|
- this.$message.error('该账号没有任何菜单权限,请联系管理员')
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- // 是否已经拿到菜单信息
|
|
|
- sessionStorage.setItem("hasGetMenu", "true");
|
|
|
- sessionStorage.setItem("MenuList", JSON.stringify(menuList));
|
|
|
- /* 是否有数据报表权限 */
|
|
|
- this.$store.commit(
|
|
|
- "SET_DATA_AUTH",
|
|
|
- menuList.some((item) => item.name === "数据报表")
|
|
|
- );
|
|
|
-
|
|
|
- for (let i = 0; i < menuList.length; i++) {
|
|
|
- const arr=menuList[i].children||[]
|
|
|
-
|
|
|
- if(arr.some(it => it.path == pathVal)){
|
|
|
- resolvePath = "/" + pathVal;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- return resolvePath || "/" + menuList[0].children[0].path;
|
|
|
+ methods: {
|
|
|
+ keyupSubmit() {
|
|
|
+ //回车登录
|
|
|
+ document.onkeydown = (e) => {
|
|
|
+ let keyval = window.event.keyCode;
|
|
|
+ if (keyval === 13) {
|
|
|
+ this.handleSubmit2();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ handleSubmit2() {
|
|
|
+ //登录
|
|
|
+ let that = this;
|
|
|
+ this.$refs.ruleForm.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ that.logining = true;
|
|
|
+ var loginParams = {
|
|
|
+ Username: that.ruleForm.account,
|
|
|
+ Password: md5.hex_md5(that.ruleForm.checkPass),
|
|
|
+ IsRemember: this.checked,
|
|
|
+ };
|
|
|
+ userLogin(loginParams).then(async (res) => {
|
|
|
+ if (res.Ret === 200) {
|
|
|
+ localStorage.setItem("auth", res.Data.Authorization);
|
|
|
+ localStorage.setItem("userName", res.Data.RealName);
|
|
|
+ localStorage.setItem("Role", res.Data.RoleTypeCode);
|
|
|
+ localStorage.setItem("RoleIdentity", res.Data.SysRoleTypeCode);
|
|
|
+ localStorage.setItem("RoleType", res.Data.ProductName);
|
|
|
+ localStorage.setItem("ManageType", res.Data.Authority);
|
|
|
+ localStorage.setItem("AdminId", res.Data.AdminId);
|
|
|
+ localStorage.setItem("AdminName", res.Data.AdminName);
|
|
|
+ if (this.checked) {
|
|
|
+ localStorage.setItem("account", this.b.encode(this.ruleForm.account));
|
|
|
+ localStorage.setItem("checkPass", this.b.encode(this.ruleForm.checkPass));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ localStorage.removeItem("account");
|
|
|
+ localStorage.removeItem("checkPass");
|
|
|
+ }
|
|
|
+ let path = "";
|
|
|
+ switch (res.Data.RoleTypeCode) {
|
|
|
+ case "rai_researcher":
|
|
|
+ case "ficc_researcher":
|
|
|
+ case "researcher":
|
|
|
+ path = "/reportlist";
|
|
|
+ break;
|
|
|
+ case "compliance": //合规
|
|
|
+ path = "/contractapprovallist";
|
|
|
+ break;
|
|
|
+ case "special_researcher": //特邀研究员
|
|
|
+ path = "/dataList";
|
|
|
+ break;
|
|
|
+ case "special_ficc_seller":
|
|
|
+ path = "/meetingCalendar";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ path = await this.getOtherRolePath("myCalendar");
|
|
|
+ }
|
|
|
+ this.$router.push({ path });
|
|
|
+ }
|
|
|
+ that.logining = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ changePass(value) {
|
|
|
+ //密码输入格式切换
|
|
|
+ this.visible = !(value === "show");
|
|
|
+ },
|
|
|
+ getOtherRolePath(pathVal) {
|
|
|
+ return departInterence.getMenu().then((res) => {
|
|
|
+ let resolvePath = "";
|
|
|
+ if (res.Ret === 200) {
|
|
|
+ let menuList = res.Data.List || [];
|
|
|
+ if (!menuList.length) {
|
|
|
+ this.$message.error('该账号没有任何菜单权限,请联系管理员');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 是否已经拿到菜单信息
|
|
|
+ sessionStorage.setItem("hasGetMenu", "true");
|
|
|
+ sessionStorage.setItem("MenuList", JSON.stringify(menuList));
|
|
|
+ /* 是否有数据报表权限 */
|
|
|
+ this.$store.commit("SET_DATA_AUTH", menuList.some((item) => item.name === "数据报表"));
|
|
|
+ for (let i = 0; i < menuList.length; i++) {
|
|
|
+ const arr = menuList[i].children || [];
|
|
|
+ if (arr.some(it => it.path == pathVal)) {
|
|
|
+ resolvePath = "/" + pathVal;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return resolvePath || "/" + menuList[0].children[0].path;
|
|
|
+ }
|
|
|
+ return "/" + pathVal;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleClick(tab) {
|
|
|
+ },
|
|
|
+ handleLogin(){
|
|
|
+ //先进行判空的表单验证
|
|
|
+ this.$refs[this.activeModel].$refs.modelForm.validate((valid)=>{
|
|
|
+ if(valid){
|
|
|
+ //根据activeName 调用不同的登陆接口
|
|
|
+ //账号密码错误 将loginCheck置为true
|
|
|
+ //账号异常 将accountCheck置为true
|
|
|
+ this.loginCheck = !this.loginCheck
|
|
|
+ //都Ok就进系统
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ clearnHint(){
|
|
|
+ this.loginCheck = false
|
|
|
+ this.accountCheck = false
|
|
|
}
|
|
|
- return "/" + pathVal;
|
|
|
- });
|
|
|
},
|
|
|
- },
|
|
|
- destroyed() {
|
|
|
- document.onkeydown = null;
|
|
|
- },
|
|
|
+ destroyed() {
|
|
|
+ document.onkeydown = null;
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
+<style lang="scss">
|
|
|
+#login{
|
|
|
+ .el-tabs__nav-wrap::after {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ .el-tabs__item{
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
<style lang="scss" scoped>
|
|
|
#login {
|
|
|
width: 100%;
|
|
@@ -250,14 +302,14 @@ export default {
|
|
|
|
|
|
.login-icon {
|
|
|
position: absolute;
|
|
|
- top: 40px;
|
|
|
+ top: 40px;
|
|
|
right: 40px;
|
|
|
}
|
|
|
.login-title {
|
|
|
color: #333;
|
|
|
font-size: 30px;
|
|
|
display: block;
|
|
|
- text-align: center;
|
|
|
+ text-align: center;
|
|
|
margin-bottom: 30px;
|
|
|
}
|
|
|
|