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 @@ ...@@ -97,7 +97,7 @@
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import { Loading, Message } from 'element-ui'; import { Message } from 'element-ui';
import Util from "../../tool"; import Util from "../../tool";
Vue.prototype.$message = Message Vue.prototype.$message = Message
...@@ -379,17 +379,12 @@ ...@@ -379,17 +379,12 @@
return false; return false;
} }
let loadingInstance = Loading.service({
background: 'rgba(0, 0, 0, 0)'
});
this.$http('post', "/auth/login", { this.$http('post', "/auth/login", {
mobile: this.form.mobile, mobile: this.form.mobile,
password: this.form.password, password: this.form.password,
captcha: this.form.captcha, captcha: this.form.captcha,
captcha_key: this.form.captcha_key captcha_key: this.form.captcha_key
}).then(res => { }).then(res => {
loadingInstance.close();
if (res.code === 0) { if (res.code === 0) {
sessionStorage.removeItem('tabs'); sessionStorage.removeItem('tabs');
localStorage.removeItem('supplier_id'); localStorage.removeItem('supplier_id');
...@@ -452,15 +447,10 @@ ...@@ -452,15 +447,10 @@
return false; return false;
} }
var loadingInstance = Loading.service({
background: 'rgba(0, 0, 0, 0)'
});
this.$http('post', "/auth/smsLogin", { this.$http('post', "/auth/smsLogin", {
mobile: this.smsForm.mobile, mobile: this.smsForm.mobile,
sms_code: this.smsForm.smsCode sms_code: this.smsForm.smsCode
}).then(res => { }).then(res => {
loadingInstance.close();
if (res.code === 0) { if (res.code === 0) {
sessionStorage.removeItem('tabs'); sessionStorage.removeItem('tabs');
localStorage.removeItem('supplier_id'); localStorage.removeItem('supplier_id');
...@@ -517,15 +507,10 @@ ...@@ -517,15 +507,10 @@
return false; return false;
} }
var loadingInstance = Loading.service({
background: 'rgba(0, 0, 0, 0)'
});
this.$http('post', "/api/user/bindMobile", { this.$http('post', "/api/user/bindMobile", {
mobile: this.bindForm.mobile, mobile: this.bindForm.mobile,
sms_code: this.bindForm.smsCode sms_code: this.bindForm.smsCode
}).then(res => { }).then(res => {
loadingInstance.close();
if (res.code === 0) { if (res.code === 0) {
this.$message({ this.$message({
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