diff --git a/src/api/login.js b/src/api/login.js index 0a0e7ca..24a753f 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -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 }; diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 8a8fbc5..4368350 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -62,38 +62,6 @@ password: any - - - - - - - - - - - - @@ -113,8 +81,6 @@ export default { loading: false, passwordType: "", companyList: [], - companySelectDialog: false, - loginForm: { username: "", password: "", @@ -140,30 +106,27 @@ export default { }); }, handleLogin() { - this.loading = true; - let { username, password, networkId } = this.loginForm; - serve - .login({ - username, - password: md5(password), - networkId, - }) - .then((res) => { - if (res && res.code === 42014) { - serve - .getRefineryByCustomerId(this.loginForm.username) - .then((res) => { - this.companyList = res.data; - this.companySelectDialog = true; - return; - }); - } - localStorage.setItem("token", res.data.accessToken); - this.$router.replace("/"); - }) - .catch(() => { - this.loading = false; - }); + this.$refs["loginForm"].validate((valid) => { + if (valid) { + this.loading = true; + let { username, password, networkId } = this.loginForm; + serve + .login({ + username, + password: md5(password), + networkId, + }) + .then((res) => { + if (res.data.accessToken) { + localStorage.setItem("token", res.data.accessToken); + this.$router.replace("/"); + } + }) + .catch(() => { + this.loading = false; + }); + } + }); }, }, };