pull/1/head
xiaozhiyong 2 years ago
parent e4b34f6d63
commit 81c21b48f6
  1. 8
      src/api/login.js
  2. 49
      src/views/login/index.vue

@ -3,16 +3,10 @@ import request from "utils/axios.js";
const login = (params) => {
return request.postJson("/oil-identity/oilRefinery/loginOMSByPwd", params);
};
//关联企业
const getRefineryByCustomerId = (phone) => {
return request.get(
`/oil-user/oilCustomerRefineryRelation/getRefineryByCustomerId/${phone}`
);
};
//路由
const getCustomerRouters = () => {
return request.get(
"/oil-identity/oilRefinery/getCustomerRouters/REFINERY_OMS_WEB"
);
};
export default { login, getRefineryByCustomerId, getCustomerRouters };
export default { login, getCustomerRouters };

@ -62,38 +62,6 @@
<span> password: any</span>
</div>
</el-form>
<el-dialog
:visible.sync="companySelectDialog"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="500px"
title="请选择登录企业"
>
<el-table :data="companyList">
<el-table-column property="companyName" label="公司名称" width="200" />
<el-table-column property="parentMark" label="公司性质">
<template slot-scope="{ row }">
<el-tag v-if="row.parentMark === 0" effect="dark" size="normal"
>主体公司</el-tag
>
<el-tag v-else effect="dark" type="info" size="normal"
>分公司</el-tag
>
</template>
</el-table-column>
<el-table-column property="name" label="操作">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click="loginAgain(scope.row.companyId)"
>登录</el-button
>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
@ -113,8 +81,6 @@ export default {
loading: false,
passwordType: "",
companyList: [],
companySelectDialog: false,
loginForm: {
username: "",
password: "",
@ -140,6 +106,8 @@ export default {
});
},
handleLogin() {
this.$refs["loginForm"].validate((valid) => {
if (valid) {
this.loading = true;
let { username, password, networkId } = this.loginForm;
serve
@ -149,21 +117,16 @@ export default {
networkId,
})
.then((res) => {
if (res && res.code === 42014) {
serve
.getRefineryByCustomerId(this.loginForm.username)
.then((res) => {
this.companyList = res.data;
this.companySelectDialog = true;
return;
});
}
if (res.data.accessToken) {
localStorage.setItem("token", res.data.accessToken);
this.$router.replace("/");
}
})
.catch(() => {
this.loading = false;
});
}
});
},
},
};

Loading…
Cancel
Save