全局代码格式 优化

This commit is contained in:
Pan
2017-07-06 17:56:17 +08:00
parent 622a8c3a69
commit de992c50a6
73 changed files with 3156 additions and 3151 deletions

View File

@@ -4,10 +4,7 @@ const getters = {
token: state => state.user.token,
avatar: state => state.user.avatar,
name: state => state.user.name,
uid: state => state.user.uid,
email: state => state.user.email,
introduction: state => state.user.introduction,
auth_type: state => state.user.auth_type,
status: state => state.user.status,
roles: state => state.user.roles,
setting: state => state.user.setting,

View File

@@ -5,10 +5,7 @@ const user = {
state: {
user: '',
status: '',
email: '',
code: '',
uid: undefined,
auth_type: '',
token: Cookies.get('Admin-Token'),
name: '',
avatar: '',
@@ -20,21 +17,12 @@ const user = {
},
mutations: {
SET_AUTH_TYPE: (state, type) => {
state.auth_type = type;
},
SET_CODE: (state, code) => {
state.code = code;
},
SET_TOKEN: (state, token) => {
state.token = token;
},
SET_UID: (state, uid) => {
state.uid = uid;
},
SET_EMAIL: (state, email) => {
state.email = email;
},
SET_INTRODUCTION: (state, introduction) => {
state.introduction = introduction;
},
@@ -70,7 +58,6 @@ const user = {
const data = response.data;
Cookies.set('Admin-Token', response.data.token);
commit('SET_TOKEN', data.token);
commit('SET_EMAIL', email);
resolve();
}).catch(error => {
reject(error);
@@ -78,7 +65,6 @@ const user = {
});
},
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
@@ -87,7 +73,6 @@ const user = {
commit('SET_ROLES', data.role);
commit('SET_NAME', data.name);
commit('SET_AVATAR', data.avatar);
commit('SET_UID', data.uid);
commit('SET_INTRODUCTION', data.introduction);
resolve(response);
}).catch(error => {
@@ -100,7 +85,7 @@ const user = {
LoginByThirdparty({ commit, state }, code) {
return new Promise((resolve, reject) => {
commit('SET_CODE', code);
loginByThirdparty(state.status, state.email, state.code, state.auth_type).then(response => {
loginByThirdparty(state.status, state.email, state.code).then(response => {
commit('SET_TOKEN', response.data.token);
Cookies.set('Admin-Token', response.data.token);
resolve();
@@ -110,7 +95,6 @@ const user = {
});
},
// 登出
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {