提交 85b600e2 编写于 作者: huangwensu's avatar huangwensu

修改store和校验

上级 46ed9d46
......@@ -95,15 +95,9 @@ export default {
// 获取用户权限
getUserAuth(token) {
let req = null
if(localStorage.getItem('storageToken')) {
req = {
token: localStorage.getItem('storageToken')
}
} else {
req = {
token: token
}
}
vm.GET('common/v1/role',req).then((res) => {
if(res.code == '000000') {
vm.changeIdType(res.data.idType)
......
import * as types from './mutations-types'
export const changeToken = ({commit}, data) => {
commit(types.TOKEN, data)
}
export const changeIdType = ({commit}, data) => {
commit(types.ID_TYPE, data)
}
\ No newline at end of file
export const _token = state => state._token
export const idType = state => state.idType
const getters = {
_token: state => state.common._token,
idType: state => state.common.idType
}
export default getters
import Vue from 'vue'
import Vuex from 'vuex'
import * as actions from './actions'
import * as getters from './getters'
import state from './state'
import mutations from './mutations'
import common from './modules/common'
import getters from './getters'
Vue.use(Vuex)
export default new Vuex.Store({
actions,
getters,
state,
mutations,
modules: {
common
},
getters
})
const common = {
state: {
_token: '',
idType: ''
},
mutations: {
CHANGE_TOKEN: (state, data) => {
state._token = data
},
CHANGE_IDTYPE: (state, data) => {
state.idType = data
}
},
actions: {
changeToken({ commit }, tokenData) {
commit('CHANGE_TOKEN', tokenData)
},
changeIdType({ commit }, idTypeData) {
commit('CHANGE_IDTYPE', idTypeData)
}
}
}
export default common
\ No newline at end of file
export const TOKEN = 'TOKEN'
export const ID_TYPE = 'ID_TYPE'
\ No newline at end of file
import * as types from './mutations-types'
const mutations = {
[types.TOKEN](state, tokenData) {
state._token = tokenData
},
[types.ID_TYPE](state, idTypeData) {
state.idType = idTypeData
}
}
export default mutations
\ No newline at end of file
const state = {
_token: '',
idType: ''
}
export default state
\ No newline at end of file
......@@ -59,24 +59,7 @@ export default {
spanSecondNum: 12,
tableData: [],
count: 0,
messageList:[
// {
// menuName: '审核提醒',
// type: 1,
// portalTime: '2019-01-02',
// content: '王小波创建了"浙江省2019高血压第一季度考试"项目,提醒您审核。'
// },{
// menuName: '审核未通过',
// type: 2,
// portalTime: '2019-01-02',
// content: '王小波创建了"浙江省2019高血压第一季度考试"项目,提醒您审核。'
// },{
// menuName: '审核通过',
// type: 3,
// portalTime: '2019-01-02',
// content: '王小波创建了"浙江省2019高血压第一季度考试"项目,提醒您审核。'
// }
]
messageList:[]
}
},
created() {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册