Commit 0d364efd by liangjianmin

refactor(login): remove loading instance from login methods for cleaner code

- Eliminated unnecessary loading instance creation in the login, SMS login, and mobile binding methods to streamline the code.
- Retained message handling for user feedback upon successful operations.
parent b15f1f95
Showing with 1 additions and 16 deletions
......@@ -97,7 +97,7 @@
</template>
<script>
import Vue from 'vue';
import { Loading, Message } from 'element-ui';
import { Message } from 'element-ui';
import Util from "../../tool";
Vue.prototype.$message = Message
......@@ -379,17 +379,12 @@
return false;
}
let loadingInstance = Loading.service({
background: 'rgba(0, 0, 0, 0)'
});
this.$http('post', "/auth/login", {
mobile: this.form.mobile,
password: this.form.password,
captcha: this.form.captcha,
captcha_key: this.form.captcha_key
}).then(res => {
loadingInstance.close();
if (res.code === 0) {
sessionStorage.removeItem('tabs');
localStorage.removeItem('supplier_id');
......@@ -452,15 +447,10 @@
return false;
}
var loadingInstance = Loading.service({
background: 'rgba(0, 0, 0, 0)'
});
this.$http('post', "/auth/smsLogin", {
mobile: this.smsForm.mobile,
sms_code: this.smsForm.smsCode
}).then(res => {
loadingInstance.close();
if (res.code === 0) {
sessionStorage.removeItem('tabs');
localStorage.removeItem('supplier_id');
......@@ -517,15 +507,10 @@
return false;
}
var loadingInstance = Loading.service({
background: 'rgba(0, 0, 0, 0)'
});
this.$http('post', "/api/user/bindMobile", {
mobile: this.bindForm.mobile,
sms_code: this.bindForm.smsCode
}).then(res => {
loadingInstance.close();
if (res.code === 0) {
this.$message({
message: '绑定成功',
......
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 sign in to comment