chore: optimize the code; 🌟

master
iczer 5 years ago
parent 3ff12474cd
commit 687a3adc37
  1. 11
      src/pages/login/Login.vue
  2. 2
      src/services/user.js
  3. 2
      src/utils/request.js

@ -100,9 +100,11 @@ export default {
this.logging = true this.logging = true
const name = this.form.getFieldValue('name') const name = this.form.getFieldValue('name')
const password = this.form.getFieldValue('password') const password = this.form.getFieldValue('password')
// login(name, password).then(this.afterLogin)
login(name, password) }
.then((res) => { })
},
afterLogin(res) {
this.logging = false this.logging = false
const result = res.data const result = res.data
if (result.code >= 0) { if (result.code >= 0) {
@ -113,9 +115,6 @@ export default {
} else { } else {
this.error = result.message this.error = result.message
} }
})
}
})
} }
} }
} }

@ -7,7 +7,7 @@ import {request, METHOD} from '@/utils/request'
* @param password 账户密码 * @param password 账户密码
* @returns {Promise<AxiosResponse<T>>} * @returns {Promise<AxiosResponse<T>>}
*/ */
function login(name, password) { async function login(name, password) {
return request(LOGIN, METHOD.POST, { return request(LOGIN, METHOD.POST, {
name: name, name: name,
password: password password: password

@ -6,7 +6,7 @@ const METHOD = {
} }
/** /**
* axios请求函数 * axios请求
* @param url 请求地址 * @param url 请求地址
* @param method {METHOD} http method * @param method {METHOD} http method
* @param params 请求参数 * @param params 请求参数

Loading…
Cancel
Save