refine code

This commit is contained in:
Pan 2017-08-22 15:09:25 +08:00 committed by 花裤衩
parent 62d2f62bff
commit b8ecda19d8
6 changed files with 11 additions and 17 deletions

View file

@ -1,22 +1,22 @@
import fetch from 'utils/fetch';
import fetch from 'utils/fetch'
export function loginByUsername(username, password) {
const data = {
username,
password
};
}
return fetch({
url: '/login/login',
method: 'post',
data
});
})
}
export function logout() {
return fetch({
url: '/login/logout',
method: 'post'
});
})
}
export function getInfo(token) {
@ -24,6 +24,6 @@ export function getInfo(token) {
url: '/user/info',
method: 'get',
params: { token }
});
})
}

View file

@ -34,7 +34,7 @@ export default {
if (userMap[token]) {
return userMap[token];
} else {
return Promise.reject('a');
return Promise.reject('error');
}
},
logout: () => 'success'

View file

@ -12,7 +12,7 @@ function hasPermission(roles, permissionRoles) {
}
// register global progress.
const whiteList = ['/login', '/authredirect', '/reset', '/sendpwd']// 不重定向白名单
const whiteList = ['/login', '/authredirect']// 不重定向白名单
router.beforeEach((to, from, next) => {
NProgress.start() // 开启Progress
if (getToken()) { // 判断是否有token

View file

@ -40,12 +40,6 @@ const user = {
},
SET_ROLES: (state, roles) => {
state.roles = roles;
},
LOGIN_SUCCESS: () => {
console.log('login success')
},
LOGOUT_USER: state => {
state.user = '';
}
},

View file

@ -78,8 +78,8 @@
})
} else {
this.$message({
message: '请选择一条或多条记录导出',
type: 'warning'
message: '请选择一条或多条记录导出',
type: 'warning'
});
}
},

View file

@ -24,7 +24,7 @@
<div class='tips'>账号:admin 密码随便填</div>
<div class='tips'>账号:editor 密码随便填</div>
<el-button class='thirdPart-button' type="primary" @click='showDialog=true'>打开第三方登录</el-button>
<el-button class='thirdparty-button' type="primary" @click='showDialog=true'>打开第三方登录</el-button>
</el-form>
<el-dialog title="第三方验证" :visible.sync="showDialog">
@ -198,7 +198,7 @@
color: $dark_gray;
cursor: pointer;
}
.thirdPart-button{
.thirdparty-button{
position: absolute;
right: 35px;
bottom: 28px;