This commit is contained in:
2025-06-24 18:06:33 +08:00
commit 5601a107e5
100 changed files with 24494 additions and 0 deletions

46
src/vuex/modules/com.js Normal file
View File

@@ -0,0 +1,46 @@
import * as types from '../types'
import { getStore, setStore } from '@js/mUtils.js'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://localhost:8099' : 'http://localhost:8099'
/**
* App通用配置
*/
const state = {
baseUrl: getStore('baseUrl') || baseUrl,
setTime: getStore('setTime') || 15000,
setJxtTime: getStore('setJxtTime') || 3000,
pageNo: getStore('pageNo') || '1'
}
const actions = {
setConfig ({commit}, res) {
setStore('baseUrl', res.baseUrl)
setStore('setTime', res.setTime)
setStore('setJxtTime', res.setJxtTime)
setStore('pageNo', res.pageNo)
commit(types.COM_CONFIG, res)
}
}
const getters = {
baseUrl: state => state.baseUrl,
setTime: state => state.setTime,
setJxtTime: state => state.setJxtTime,
pageNo: state => state.pageNo
}
const mutations = {
[types.COM_CONFIG] (state, res) {
state.baseUrl = res.baseUrl
state.setTime = res.setTime
state.setJxtTime = res.setJxtTime
state.pageNo = res.pageNo
}
}
export default {
state,
actions,
getters,
mutations
}

52
src/vuex/modules/user.js Normal file
View File

@@ -0,0 +1,52 @@
import * as types from '../types'
import { getStore, setStore } from '@js/mUtils.js'
const state = {
accountId: getStore('accountId') || '',
accountName: getStore('accountName') || '',
userName: getStore('userName') || '',
deptUuid: getStore('deptUuid') || ''
}
const getters = {
accountId: state => state.accountId,
accountName: state => state.accountName,
userName: state => state.userName,
deptUuid: state => state.deptUuid
}
const actions = {
setUserInfo ({ commit }, res) {
setStore('accountId', res.account_id)
setStore('accountName', res.account_name)
setStore('userName', res.user_name)
setStore('deptUuid', res.dept_uuid)
commit(types.SET_USER_INFO, res)
},
setSignOut ({ commit }) {
localStorage.removeItem('accountId')
localStorage.removeItem('userName')
localStorage.removeItem('accountName')
localStorage.removeItem('deptUuid')
commit(types.SET_SIGN_OUT)
}
}
const mutations = {
[types.SET_USER_INFO] (state, res) {
state.accountId = res.account_id
state.accountName = res.account_name
state.userName = res.user_name
state.memberName = res.member_name
},
[types.SET_SIGN_OUT] (state) {
state.accountId = ''
}
}
export default {
state,
getters,
actions,
mutations
}

14
src/vuex/store.js Normal file
View File

@@ -0,0 +1,14 @@
import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import com from './modules/com'
Vue.use(Vuex)
export default new Vuex.Store({
modules: {
user,
com
}
})

6
src/vuex/types.js Normal file
View File

@@ -0,0 +1,6 @@
// 公共配置
export const COM_CONFIG = 'COM_CONFIG'
// 用户
export const SET_USER_INFO = 'SET_USER_INFO'
export const SET_SIGN_OUT = 'SET_SIGN_OUT'