接口
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import * as types from '../types'
|
||||
import { getStore, setStore } from '@config/utils.js'
|
||||
|
||||
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.107:8080/hlapp' : 'http://192.168.81.100:8081/hl_nlapp'
|
||||
const imgBaseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.100/' : 'http://192.168.81.107/'
|
||||
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.171:8018' : 'http://192.168.81.171:8018'
|
||||
const imgBaseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.171:8018' : 'http://192.168.81.171:8018'
|
||||
const state = {
|
||||
baseUrl: getStore('baseUrl') || baseUrl,
|
||||
imgBaseUrl: getStore('imgBaseUrl') || imgBaseUrl,
|
||||
|
||||
@@ -2,10 +2,6 @@ import * as types from '../types'
|
||||
import { getStore, setStore } from '@config/utils.js'
|
||||
|
||||
const state = {
|
||||
accountId: getStore('accountId') || '',
|
||||
accountName: getStore('accountName') || '',
|
||||
userName: getStore('userName') || '',
|
||||
deptName: getStore('deptName') || '',
|
||||
userInfo: getStore('userInfo') ? getStore('userInfo') : '',
|
||||
saveToken: getStore('saveToken') || ''
|
||||
}
|
||||
@@ -20,26 +16,13 @@ const getters = {
|
||||
}
|
||||
|
||||
const actions = {
|
||||
setUserInfo ({ commit }, res) {
|
||||
setStore('accountId', res.account_id)
|
||||
setStore('accountName', res.account_name)
|
||||
setStore('userName', res.user_name)
|
||||
setStore('deptName', res.dept_name)
|
||||
commit(types.SET_USER_INFO, res)
|
||||
},
|
||||
setSignOut ({ commit }) {
|
||||
localStorage.removeItem('accountId')
|
||||
localStorage.removeItem('accountName')
|
||||
localStorage.removeItem('userName')
|
||||
localStorage.removeItem('deptName')
|
||||
commit(types.SET_SIGN_OUT)
|
||||
},
|
||||
saveUserInfo ({commit}, res) {
|
||||
setStore('userInfo', res)
|
||||
commit(types.SAVE_USER_INFO, res)
|
||||
},
|
||||
delUserInfo ({commit}, res) {
|
||||
localStorage.removeItem('userInfo')
|
||||
localStorage.removeItem('saveToken')
|
||||
commit(types.DEL_USER_INFO, res)
|
||||
},
|
||||
saveToken ({commit}, res) {
|
||||
@@ -49,23 +32,10 @@ const actions = {
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
[types.SET_USER_INFO] (state, res) {
|
||||
state.accountId = res.account_id
|
||||
state.accountName = res.account_name
|
||||
state.userName = res.user_name
|
||||
state.deptName = res.dept_name
|
||||
},
|
||||
[types.SET_SIGN_OUT] (state) {
|
||||
state.accountId = ''
|
||||
state.accountName = ''
|
||||
state.userName = ''
|
||||
state.deptName = ''
|
||||
},
|
||||
[types.SAVE_USER_INFO] (state, res) {
|
||||
state.userInfo = res
|
||||
},
|
||||
[types.DEL_USER_INFO] (state, res) {
|
||||
state.userInfo = res
|
||||
},
|
||||
[types.SAVE_TOKEN] (state, res) {
|
||||
state.saveToken = res
|
||||
|
||||
@@ -9,8 +9,6 @@ export const COM_SHOW_ALERT = 'COM_SHOW_ALERT'
|
||||
export const COM_ALERT_MSG = 'COM_ALERT_MSG'
|
||||
|
||||
// 用户
|
||||
export const SET_USER_INFO = 'SET_USER_INFO'
|
||||
export const SET_SIGN_OUT = 'SET_SIGN_OUT'
|
||||
export const SAVE_USER_INFO = 'SAVE_USER_INFO'
|
||||
export const DEL_USER_INFO = 'DEL_USER_INFO'
|
||||
export const SAVE_TOKEN = 'SAVE_TOKEN'
|
||||
|
||||
Reference in New Issue
Block a user