diff --git a/src/api/login.js b/src/api/login.js index 2c79398..a0da21a 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -1,12 +1,13 @@ import request from '@/utils/request' -export function login(phone, password, code, uuid) { +export function login(username, password, phone, code, uuid) { return request({ url: 'auth/login', method: 'post', data: { - phone, + username, password, + phone, code, uuid } diff --git a/src/router/index.js b/src/router/index.js index 0154e35..a42563d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -19,39 +19,39 @@ router.beforeEach((to, from, next) => { NProgress.start() next() NProgress.done() - // if (getToken()) { - // // 已登录且要跳转的页面是登录页 - // if (to.path === '/login') { - // next({ path: '/' }) - // NProgress.done() - // } else { - // if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息 - // store.dispatch('GetInfo').then(() => { // 拉取user_info - // // 动态路由,拉取菜单 - // loadMenus(next, to) - // }).catch(() => { - // store.dispatch('LogOut').then(() => { - // location.reload() // 为了重新实例化vue-router对象 避免bug - // }) - // }) - // // 登录时未拉取 菜单,在此处拉取 - // } else if (store.getters.loadMenus) { - // // 修改成false,防止死循环 - // store.dispatch('updateLoadMenus') - // loadMenus(next, to) - // } else { - // next() - // } - // } - // } else { - // /* has no token*/ - // if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入 - // next() - // } else { - // next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 - // NProgress.done() - // } - // } +// if (getToken()) { +// // 已登录且要跳转的页面是登录页 +// if (to.path === '/login') { +// next({ path: '/' }) +// NProgress.done() +// } else { +// if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息 +// store.dispatch('GetInfo').then(() => { // 拉取user_info +// // 动态路由,拉取菜单 +// loadMenus(next, to) +// }).catch(() => { +// store.dispatch('LogOut').then(() => { +// location.reload() // 为了重新实例化vue-router对象 避免bug +// }) +// }) +// // 登录时未拉取 菜单,在此处拉取 +// } else if (store.getters.loadMenus) { +// // 修改成false,防止死循环 +// store.dispatch('updateLoadMenus') +// loadMenus(next, to) +// } else { +// next() +// } +// } +// } else { +// /* has no token*/ +// if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入 +// next() +// } else { +// next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 +// NProgress.done() +// } +// } }) export const loadMenus = (next, to) => { diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 59cea22..089c87f 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -30,7 +30,7 @@ const user = { Login({ commit }, userInfo) { const rememberMe = userInfo.rememberMe return new Promise((resolve, reject) => { - login(userInfo.phone, userInfo.password, userInfo.code, userInfo.uuid).then(res => { + login(userInfo.username, userInfo.password, userInfo.phone, userInfo.code, userInfo.uuid).then(res => { setToken(res.token, rememberMe) commit('SET_TOKEN', res.token) setUserInfo(res.user, commit) diff --git a/src/views/dashboard/AgencyData.vue b/src/views/dashboard/AgencyData.vue index d8cac2f..aeccbde 100644 --- a/src/views/dashboard/AgencyData.vue +++ b/src/views/dashboard/AgencyData.vue @@ -1,39 +1,41 @@